/* ============================================================
   impacsys-v6-ext.css — v6 확장 레이어
   - impacsys-v6.css 토큰 변수만 참조할 것 (직접 색상값 금지)
   - v6에 없는 저장소 전용 컴포넌트만 작성
   ============================================================ */

/* ── 다크모드 토큰 오버라이드 (v6.css html.dark 와 동일 메커니즘) ── */
html.dark {
  --text:            #f2f4f7;
  --text-soft:       #d1d8e2;
  --secondary:       #b8c0cc;
  --tertiary:        #7f8da3;
  --separator:       rgba(255, 255, 255, 0.10);
  --separator-soft:  rgba(255, 255, 255, 0.06);
  --canvas:          #0b111c;
  --surface:         rgba(19, 26, 39, 0.90);
  --solid:           #121a2a;
  --accent:          #58a6ff;
  --accent-pressed:  #8bc2ff;
  --accent-soft:     rgba(88, 166, 255, 0.16);
  --green:           #34d399;
  --green-soft:      rgba(52, 211, 153, 0.15);
  --orange:          #fbbf24;
  --orange-soft:     rgba(251, 191, 36, 0.15);
  --red:             #f87171;
  --red-soft:        rgba(248, 113, 113, 0.15);
  --shadow-hairline: 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-soft:     0 10px 28px rgba(0, 0, 0, 0.32);
  --shadow-lift:     0 22px 48px rgba(0, 0, 0, 0.40);
}


/* ── 프로그레스 바 (대시보드 시스템 지표용) ── */
.im-progress {
  height: 6px;
  background: var(--separator);
  border-radius: 999px;
  overflow: hidden;
}
.im-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 300ms ease;
}
.im-progress-bar.ok     { background: var(--green); }
.im-progress-bar.warn   { background: var(--orange); }
.im-progress-bar.danger { background: var(--red); }

/* ── 페이지 타이틀 ── */
#pageTitle {
  font-size: 16px;
  font-weight: 760;
  margin: 0;
  color: var(--text);
}

/* ── 알림 모달 (imAlert) ── */
#imAlertModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.36);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#imAlertModal.open { display: flex; }
.im-alert-box {
  background: var(--solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  width: 100%;
  max-width: 360px;
  overflow: hidden;
}
.im-alert-head { padding: 20px 20px 12px; display: flex; gap: 12px; align-items: flex-start; }
.im-alert-icon { width: 40px; height: 40px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.im-alert-foot { padding: 0 20px 20px; display: flex; gap: 8px; justify-content: flex-end; }

/* ── 메트릭 아이콘 ── */
.im-metric-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.im-metric-icon.blue   { background: var(--accent-soft); color: var(--accent); }
.im-metric-icon.green  { background: var(--green-soft);  color: var(--green); }
.im-metric-icon.orange { background: var(--orange-soft); color: var(--orange); }
.im-metric-icon.red    { background: var(--red-soft);    color: var(--red); }

/* ── 로그인 페이지 ── */
.im-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas);
}
.im-login-box {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  background: var(--solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

/* ── 페이지네이션 ── */
.v6-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}
.v6-pagination a,
.v6-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  color: var(--secondary);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background 120ms, color 120ms;
}
.v6-pagination a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.v6-pagination .is-active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(0, 113, 227, 0.18);
}
.v6-pagination .is-disabled {
  color: var(--tertiary);
  background: var(--separator-soft);
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════
   MASTER CONSOLE LAYOUT — Sidebar Mode
   ═══════════════════════════════════════════ */

.mc-console {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}

.mc-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--separator);
  background: rgba(251, 251, 253, 0.82);
  backdrop-filter: blur(22px) saturate(1.25);
  overflow: hidden;
}

html.dark .mc-sidebar {
  background: rgba(18, 18, 22, 0.88);
}

.mc-brand {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  flex-shrink: 0;
}

.mc-brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  color: white;
  background: linear-gradient(180deg, #2c8dff, var(--accent));
  box-shadow: 0 10px 22px rgba(0,113,227,0.24);
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}

.mc-brand-title { margin: 0; font-weight: 800; color: var(--text); font-size: 14px; }
.mc-brand-subtitle { margin: 1px 0 0; color: var(--secondary); font-size: 11px; }

/* Readiness 위젯 */
.mc-readiness {
  margin: 0 14px 10px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.72);
  box-shadow: var(--shadow-hairline);
  flex-shrink: 0;
}
html.dark .mc-readiness { background: rgba(255,255,255,0.06); }

.mc-readiness-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.mc-readiness strong { font-weight: 780; font-size: 13px; color: var(--text); }
.mc-readiness p { margin: 4px 0 0; color: var(--secondary); font-size: 12px; }
.mc-readiness-bar {
  height: 5px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--separator);
}
.mc-readiness-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 600ms ease;
}

/* Nav */
.mc-nav {
  flex: 1;
  min-height: 0;
  padding: 4px 10px 16px;
  overflow-y: auto;
  scrollbar-width: none;
}
.mc-nav::-webkit-scrollbar { width: 0; }

.mc-nav-label {
  padding: 16px 12px 7px;
  color: var(--tertiary);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.mc-nav-link {
  height: 39px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  color: var(--text-soft);
  font-weight: 680;
  margin-bottom: 2px;
  transition: background 140ms ease, color 140ms ease;
  text-decoration: none;
  font-size: 13px;
}
.mc-nav-link:hover { background: rgba(0,0,0,0.035); color: var(--text); }
html.dark .mc-nav-link:hover { background: rgba(255,255,255,0.06); }
.mc-nav-link.active {
  color: var(--text);
  background: white;
  box-shadow: var(--shadow-hairline), 0 8px 18px rgba(0,0,0,0.05);
}
html.dark .mc-nav-link.active { background: rgba(255,255,255,0.1); box-shadow: none; }
.mc-nav-link.active .mc-nav-icon { color: var(--accent); background: var(--accent-soft); }

.mc-nav-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--secondary);
  background: rgba(118,118,128,0.08);
  flex-shrink: 0;
}
.mc-nav-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* Sidebar footer */
.mc-sidebar-footer {
  flex-shrink: 0;
  padding: 14px;
  border-top: 1px solid var(--separator-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mc-user-mini { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mc-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  color: var(--text);
  background: white;
  box-shadow: var(--shadow-hairline);
  font-weight: 780;
  font-size: 14px;
  flex-shrink: 0;
}
html.dark .mc-avatar { background: rgba(255,255,255,0.1); }
.mc-user-name { font-weight: 760; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-user-role { font-size: 11px; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main area (sidebar mode) */
.mc-main { min-width: 0; display: flex; flex-direction: column; }

.mc-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid var(--separator);
  background: rgba(245,245,247,0.78);
  backdrop-filter: blur(22px) saturate(1.25);
  flex-shrink: 0;
}
html.dark .mc-topbar { background: rgba(14,14,18,0.82); }

.mc-topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.mc-scope {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-hairline);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 720;
  color: var(--text);
  cursor: default;
  min-width: 160px;
}
.mc-scope-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 780;
  flex-shrink: 0;
}

.mc-search-wrap {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-hairline);
  width: min(360px, 30vw);
}
.mc-search {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}
.mc-search::placeholder { color: var(--tertiary); }
.mc-search-icon { width: 16px; height: 16px; stroke: var(--tertiary); stroke-width: 1.9; fill: none; flex-shrink: 0; }

.mc-topbar-actions { display: flex; align-items: center; gap: 6px; }

.mc-shell { flex: 1; padding: 28px 30px; }

/* ═══════════════════════════════════════════
   MASTER CONSOLE LAYOUT — Topbar Mode
   ═══════════════════════════════════════════ */

.mc-app-shell { min-height: 100vh; }

.mc-global-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--separator);
  background: rgba(245,245,247,0.82);
  backdrop-filter: blur(22px) saturate(1.25);
}
html.dark .mc-global-header { background: rgba(14,14,18,0.88); }

.mc-topline {
  height: 66px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
}

.mc-brand-inline { display: flex; align-items: center; gap: 12px; }

.mc-primary-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}
.mc-nav-pill {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text-soft);
  font-weight: 720;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 140ms, color 140ms;
}
.mc-nav-pill:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.mc-nav-pill.active {
  color: var(--text);
  background: white;
  box-shadow: var(--shadow-hairline), 0 8px 18px rgba(0,0,0,0.05);
}
html.dark .mc-nav-pill.active { background: rgba(255,255,255,0.1); box-shadow: none; }
.mc-nav-pill svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.mc-header-actions { display: flex; align-items: center; gap: 6px; }

.mc-contextbar {
  min-height: 50px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 8px 28px;
  border-top: 1px solid var(--separator-soft);
  background: rgba(255,255,255,0.42);
}
html.dark .mc-contextbar { background: rgba(255,255,255,0.04); }

.mc-subnav {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.mc-subnav::-webkit-scrollbar { height: 0; }
.mc-subnav button {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 680;
  white-space: nowrap;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.mc-subnav button:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.mc-subnav button.active { background: rgba(0,113,227,0.1); color: var(--accent); font-weight: 720; }

.mc-context-meta { font-size: 12px; color: var(--secondary); white-space: nowrap; }

.mc-topbar-content { padding: 28px 30px; }

/* ═══════════════════════════════════════════
   레이아웃 모드 토글
   ═══════════════════════════════════════════ */

/* topbar 모드일 때 sidebar 숨김, topbar 표시 */
html.layout-sidebar .mc-app-shell { display: none; }
html.layout-topbar .mc-console { display: none; }

/* 기본: sidebar */
html:not(.layout-topbar) .mc-app-shell { display: none; }

/* icon btn (재사용) */
.mc-icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-hairline);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 120ms, color 120ms, transform 120ms;
  text-decoration: none;
  font-size: 14px;
}
.mc-icon-btn:hover { background: white; color: var(--text); transform: translateY(-1px); }
html.dark .mc-icon-btn:hover { background: rgba(255,255,255,0.1); }
.mc-icon-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* 알림 모달은 양쪽 레이아웃에서 공유 */
