/* SecureVault 디자인 시스템 — 리셋·타이포그래피·콘솔 쉘 레이아웃(사이드바/탑바/콘텐츠)·유틸리티 */

@import url("./fonts/pretendard/pretendard.css");

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--surface-page);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-feature-settings: "tnum" 0, "ss01" 0;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, kbd, pre, samp, .mono { font-family: var(--font-mono); font-size: .92em; }
strong, b { font-weight: var(--weight-semibold); color: var(--text-strong); }
hr { border: 0; border-top: 1px solid var(--border-subtle); margin: var(--space-6) 0; }
table { border-collapse: collapse; border-spacing: 0; }
::selection { background: var(--brand-subtle-2); color: var(--text-strong); }

:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ── 타이포 ───────────────────────────────── */
h1, h2, h3, h4, .h1, .h2, .h3, .h4 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  color: var(--text-strong);
  line-height: var(--leading-snug);
}
h1, .h1 { font-size: var(--text-2xl); }
h2, .h2 { font-size: var(--text-xl); }
h3, .h3 { font-size: var(--text-lg); }
h4, .h4 { font-size: var(--text-md); font-family: var(--font-body); font-weight: var(--weight-semibold); letter-spacing: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-brand);
}
.text-strong { color: var(--text-strong); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-brand { color: var(--text-brand); }
.text-danger { color: var(--danger-text); }
.text-success { color: var(--success-text); }
.text-warning { color: var(--warning-text); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-all { word-break: break-all; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── 콘솔 쉘 ─────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column;
  z-index: var(--z-sidebar);
  transition: transform var(--duration-base) var(--ease-standard);
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.brand-mark {
  width: 30px; height: 30px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--brand);
  color: var(--text-on-brand);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--text-md);
  letter-spacing: -0.02em;
  color: var(--text-strong);
  line-height: 1.1;
}
.brand-sub {
  font-size: 11px; color: var(--text-faint);
  font-family: var(--font-mono); letter-spacing: .02em;
  margin-top: 2px;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: var(--space-3) var(--space-3) var(--space-4); }
.nav-section {
  padding: var(--space-4) var(--space-3) var(--space-1);
  font-size: 11px; font-weight: var(--weight-semibold);
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--nav-section);
}
.nav-section:first-child { padding-top: var(--space-2); }
.nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  height: 36px; padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--nav-text);
  font-size: var(--text-base); font-weight: var(--weight-medium);
  text-decoration: none;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.nav-item:hover { background: var(--nav-bg-hover); color: var(--nav-text-hover); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--nav-bg-active); color: var(--nav-text-active); }
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-item[aria-current="page"] .icon { opacity: 1; }
.nav-item .nav-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--neutral-chip); color: var(--neutral-chip-text);
  font-family: var(--font-mono); font-size: 11px; font-weight: var(--weight-semibold);
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-item .nav-count.is-warning { background: var(--warning-subtle); color: var(--warning-text); }
.nav-item .nav-count.is-danger { background: var(--danger-subtle); color: var(--danger-text); }
.nav-item .nav-count:empty { display: none; }

.sidebar-foot {
  padding: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}
.sys-pill {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  font-size: var(--text-sm); color: var(--text-body);
  text-decoration: none;
}
.sys-pill:hover { text-decoration: none; background: var(--surface-hover); }
.sys-pill .status-dot { margin-left: auto; }

.main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar);
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0 var(--content-pad);
  background: var(--surface-topbar);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.topbar-title h1 { font-size: var(--text-lg); line-height: 1.2; }
.topbar-title .page-desc { font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.topbar .menu-toggle { display: none; }

.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  padding: var(--space-6) var(--content-pad) var(--space-16);
}
.page { display: none; }
.page.is-active { display: block; animation: page-in var(--duration-base) var(--ease-out); }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-header {
  display: flex; align-items: flex-start; gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.page-header .lead { color: var(--text-muted); font-size: var(--text-sm); margin-top: var(--space-1); max-width: 64ch; }
.page-header .actions { margin-left: auto; display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }

.section { margin-bottom: var(--space-8); }
.section-head {
  display: flex; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.section-head h2 { font-size: var(--text-md); }
.section-head .hint { color: var(--text-muted); font-size: var(--text-sm); }
.section-head .spacer { flex: 1; }

/* 그리드 */
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack-lg { gap: var(--space-5); }
.row { display: flex; align-items: center; gap: var(--space-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt-1 { margin-top: var(--space-1); } .mt-2 { margin-top: var(--space-2); } .mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); } .mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); } .mb-3 { margin-bottom: var(--space-3); } .mb-4 { margin-bottom: var(--space-4); } .mb-6 { margin-bottom: var(--space-6); }
.hidden { display: none !important; }

/* ── 반응형 ──────────────────────────────── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .topbar .menu-toggle { display: inline-flex; }
  .content { padding-left: var(--space-4); padding-right: var(--space-4); }
  .sidebar-backdrop {
    position: fixed; inset: 0; background: var(--surface-overlay);
    z-index: calc(var(--z-sidebar) - 1); display: none;
  }
  .sidebar-backdrop.is-open { display: block; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .page-header { flex-direction: column; }
  .page-header .actions { margin-left: 0; }
  .topbar-title .page-desc { display: none; }
}

/* 스크롤바 (웹킷) — 테마 톤 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }
