/* ==========================================================================
   스포츠브릿지 design system
   Commeet의 레이아웃·컴포넌트 형태(헤더 72px, 흰 카드, 얕은 그림자, 6~8px 반경)를 따르되
   주색은 파란 계열입니다. 다크 모드는 data-theme 토큰 재정의.
   ========================================================================== */

:root {
  --color-primary: #1d5fd1;
  --color-primary-hover: #1a52b5;
  --color-primary-dark: #143f8f;
  --color-primary-pale: rgba(29, 95, 209, 0.08);
  --color-primary-pale-2: rgba(29, 95, 209, 0.16);
  --color-primary-rgb: 29, 95, 209;
  --color-accent: #1d5fd1;

  --color-navy: #34495e;
  --color-navy-hover: #2c3e50;
  --color-navy-pale: rgba(52, 73, 94, 0.08);
  --color-navy-pale-2: rgba(52, 73, 94, 0.16);
  --color-heading: #24364d;

  --color-warning-bg: #fdf3d9;
  --color-warning-border: #f0dfa8;
  --color-warning-text: #7a5b0a;
  --color-danger: #c62828;
  --color-danger-hover: #a91d1d;
  --color-danger-bg: #ffebee;
  --color-danger-border: #ef9a9a;
  --color-danger-text: #c62828;
  --color-success: #2e7d32;
  --color-success-bg: #e8f5e9;
  --color-success-text: #1b5e20;
  --color-info-bg: #e7f0fd;
  --color-info-text: #143f8f;

  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-surface-2: #eef2f7;
  --color-surface-3: #e3e9f1;
  --color-border: #d9dfe8;
  --color-border-light: #e9edf3;
  --color-input-border: #c5cdd8;

  --color-text: #2b3441;
  --color-text-muted: #5f6b7a;
  --color-text-faint: #8a95a5;
  --color-text-on-primary: #ffffff;
  --color-neutral-text: #495057;

  --color-footer-bg: #1e2a3a;
  --color-footer-text: #b9c3d0;
  --color-footer-link: #d4dce6;
  --color-footer-copy: #7f8b9a;
  --color-footer-border: #2f3d50;

  --shadow-sm: 0 2px 4px rgba(20, 40, 80, 0.06);
  --shadow-md: 0 2px 10px rgba(20, 40, 80, 0.12);
  --shadow-lg: 0 8px 30px rgba(20, 40, 80, 0.22);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 999px;
  --header-height: 72px;
  --container-width: 1400px;
  --font-sans: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary: #3d7ff2;
    --color-primary-hover: #2f6ad6;
    --color-primary-dark: #bcd4ff;
    --color-primary-pale: rgba(122, 170, 255, 0.14);
    --color-primary-pale-2: rgba(122, 170, 255, 0.24);
    --color-primary-rgb: 122, 170, 255;
    --color-accent: #7fb1ff;
    --color-navy: #4a6178;
    --color-navy-hover: #5a7288;
    --color-navy-pale: rgba(148, 178, 204, 0.14);
    --color-navy-pale-2: rgba(148, 178, 204, 0.22);
    --color-heading: #d6e2f0;
    --color-warning-bg: #3d3116; --color-warning-border: #6b551f; --color-warning-text: #f2c675;
    --color-danger-bg: #3a1a1e; --color-danger-border: #5c2328; --color-danger-text: #ff6b6f;
    --color-success-bg: #163a21; --color-success-text: #8fd9a0;
    --color-info-bg: #1b2b46; --color-info-text: #bcd4ff;
    --color-bg: #0f141c; --color-surface: #171d27; --color-surface-2: #202834; --color-surface-3: #2a3341;
    --color-border: #303a48; --color-border-light: #27303d; --color-input-border: #3b4757;
    --color-text: #e8edf4; --color-text-muted: #a4afbd; --color-text-faint: #8590a0; --color-neutral-text: #c7ccd3;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3); --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.42); --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  --color-primary: #3d7ff2;
  --color-primary-hover: #2f6ad6;
  --color-primary-dark: #bcd4ff;
  --color-primary-pale: rgba(122, 170, 255, 0.14);
  --color-primary-pale-2: rgba(122, 170, 255, 0.24);
  --color-primary-rgb: 122, 170, 255;
  --color-accent: #7fb1ff;
  --color-navy: #4a6178;
  --color-navy-hover: #5a7288;
  --color-navy-pale: rgba(148, 178, 204, 0.14);
  --color-navy-pale-2: rgba(148, 178, 204, 0.22);
  --color-heading: #d6e2f0;
  --color-warning-bg: #3d3116; --color-warning-border: #6b551f; --color-warning-text: #f2c675;
  --color-danger-bg: #3a1a1e; --color-danger-border: #5c2328; --color-danger-text: #ff6b6f;
  --color-success-bg: #163a21; --color-success-text: #8fd9a0;
  --color-info-bg: #1b2b46; --color-info-text: #bcd4ff;
  --color-bg: #0f141c; --color-surface: #171d27; --color-surface-2: #202834; --color-surface-3: #2a3341;
  --color-border: #303a48; --color-border-light: #27303d; --color-input-border: #3b4757;
  --color-text: #e8edf4; --color-text-muted: #a4afbd; --color-text-faint: #8590a0; --color-neutral-text: #c7ccd3;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3); --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.42); --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.55);
}

/* ==========================================================================
   이용자용 테마 — 청록(teal) 계열. 담당자용(파랑)과 한눈에 구분됩니다.
   ========================================================================== */
:root[data-app="user"] {
  --color-primary: #0e8f7e;
  --color-primary-hover: #0b7a6b;
  --color-primary-dark: #075e53;
  --color-primary-pale: rgba(14, 143, 126, 0.10);
  --color-primary-pale-2: rgba(14, 143, 126, 0.20);
  --color-primary-rgb: 14, 143, 126;
  --color-accent: #0b7a6b;
  --color-navy: #2f5d59;
  --color-navy-hover: #244a47;
  --color-navy-pale: rgba(47, 93, 89, 0.10);
  --color-navy-pale-2: rgba(47, 93, 89, 0.18);
  --color-heading: #1f3d3a;
  --color-bg: #f3faf8;
  --color-surface: #ffffff;
  --color-surface-2: #e9f4f1;
  --color-surface-3: #d9ebe6;
  --color-border: #cfe3de;
  --color-border-light: #e2efeb;
  --color-input-border: #b9d6cf;
  --color-info-bg: #e3f4f0;
  --color-info-text: #075e53;
  --color-footer-bg: #173634;
  --color-footer-text: #b7d3ce;
  --color-footer-link: #d6ebe6;
  --color-footer-copy: #7fa39d;
  --color-footer-border: #2a4d49;
  --color-warm: #e0663f;
  --color-warm-pale: rgba(224, 102, 63, 0.12);
  --shadow-sm: 0 2px 4px rgba(10, 60, 50, 0.06);
  --shadow-md: 0 2px 10px rgba(10, 60, 50, 0.12);
  --radius-md: 10px;
  --radius-lg: 14px;
}
@media (prefers-color-scheme: dark) {
  :root[data-app="user"]:not([data-theme="light"]) {
    --color-primary: #22b39d; --color-primary-hover: #1c9a87; --color-primary-dark: #9fe6d8;
    --color-primary-pale: rgba(63, 214, 190, 0.14); --color-primary-pale-2: rgba(63, 214, 190, 0.24); --color-primary-rgb: 63, 214, 190;
    --color-accent: #5fe0c9; --color-navy: #3d6d68; --color-navy-hover: #4a807a; --color-navy-pale: rgba(120, 190, 180, 0.14); --color-navy-pale-2: rgba(120, 190, 180, 0.22);
    --color-heading: #d3ece7; --color-bg: #0c1614; --color-surface: #13211e; --color-surface-2: #1b2c29; --color-surface-3: #243834;
    --color-border: #2c443f; --color-border-light: #243a36; --color-input-border: #3a5650; --color-info-bg: #16302c; --color-info-text: #9fe6d8;
    --color-warm: #ff8a5c; --color-warm-pale: rgba(255, 138, 92, 0.16);
  }
}
:root[data-app="user"][data-theme="dark"] {
  --color-primary: #22b39d; --color-primary-hover: #1c9a87; --color-primary-dark: #9fe6d8;
  --color-primary-pale: rgba(63, 214, 190, 0.14); --color-primary-pale-2: rgba(63, 214, 190, 0.24); --color-primary-rgb: 63, 214, 190;
  --color-accent: #5fe0c9; --color-navy: #3d6d68; --color-navy-hover: #4a807a; --color-navy-pale: rgba(120, 190, 180, 0.14); --color-navy-pale-2: rgba(120, 190, 180, 0.22);
  --color-heading: #d3ece7; --color-bg: #0c1614; --color-surface: #13211e; --color-surface-2: #1b2c29; --color-surface-3: #243834;
  --color-border: #2c443f; --color-border-light: #243a36; --color-input-border: #3a5650; --color-info-bg: #16302c; --color-info-text: #9fe6d8;
  --color-warm: #ff8a5c; --color-warm-pale: rgba(255, 138, 92, 0.16);
}
:root[data-app="user"] .site-header { border-bottom: 3px solid var(--color-primary); }
:root[data-app="user"] .brand-sub { color: var(--color-accent); font-weight: 700; }
:root[data-app="user"] .btn-primary { border-radius: var(--radius-pill); }
:root[data-app="user"] .btn-secondary { border-radius: var(--radius-pill); }
:root[data-app="user"] .btn-outline { border-radius: var(--radius-pill); }
:root[data-app="user"] .hero { background: linear-gradient(160deg, var(--color-primary-pale-2), var(--color-warm-pale) 60%, transparent); }
.nav-switch { margin-left: 6px; font-size: 12px !important; color: var(--color-text-faint) !important; border: 1px dashed var(--color-border); }
.nav-switch:hover { color: var(--color-accent) !important; background: transparent !important; }
.u-hero { padding: 26px 0 8px; }
.u-hero h1 { font-size: 26px; margin-bottom: 6px; }
.u-hero p { font-size: 15px; }
.fav-btn { border: 1px solid var(--color-border); background: var(--color-surface); border-radius: var(--radius-pill); padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--color-text-muted); }
.fav-btn.on { background: var(--color-warm-pale); color: var(--color-warm); border-color: var(--color-warm); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tile { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.tile .t { font-weight: 700; font-size: 15px; color: var(--color-heading); }
.tile .m { font-size: 13px; color: var(--color-text-muted); }
.big-num { font-size: 34px; font-weight: 800; color: var(--color-heading); line-height: 1; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
* { scrollbar-width: thin; scrollbar-color: var(--color-border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
[hidden] { display: none !important; }

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  font-size: 15px;
}
main { flex: 1; width: 100%; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-primary-dark); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 10px; font-weight: 700; line-height: 1.3; color: var(--color-heading); }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0 0 12px; line-height: 1.6; color: var(--color-text-muted); }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }
img { max-width: 100%; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 20px; width: 100%; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--color-text-muted); }
.faint { color: var(--color-text-faint); font-size: 13px; }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: var(--radius-md); padding: 11px 18px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: background-color 0.2s, color 0.2s; white-space: nowrap; line-height: 1.2; text-decoration: none;
  min-height: 42px;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background-color: var(--color-primary); color: var(--color-text-on-primary); }
.btn-primary:hover:not(:disabled) { background-color: var(--color-primary-hover); color: #fff; }
.btn-secondary { background-color: var(--color-navy); color: #fff; }
.btn-secondary:hover:not(:disabled) { background-color: var(--color-navy-hover); color: #fff; }
.btn-ghost { background-color: var(--color-surface-2); color: var(--color-neutral-text); }
.btn-ghost:hover:not(:disabled) { background-color: var(--color-surface-3); color: var(--color-neutral-text); }
.btn-ghost.active { background-color: var(--color-primary); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--color-primary); color: var(--color-accent); }
.btn-outline:hover:not(:disabled) { background: var(--color-primary-pale); }
.btn-danger { background-color: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background-color: var(--color-danger-hover); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 34px; }
.btn-icon {
  padding: 7px; min-width: 36px; min-height: 36px; border-radius: var(--radius-md); background: transparent; border: none;
  color: var(--color-text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1;
}
.btn-icon:hover { background-color: var(--color-surface-2); color: var(--color-text); }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--color-heading); }
.field .hint { font-size: 12px; color: var(--color-text-muted); margin-top: 5px; line-height: 1.5; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px; border: 1px solid var(--color-input-border); border-radius: var(--radius-md);
  font-size: 15px; font-family: inherit; color: var(--color-text); background-color: var(--color-surface);
  transition: border-color 0.2s, box-shadow 0.2s; min-height: 42px;
}
.input:focus, select.input:focus, textarea.input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-pale); }
.input:disabled { background-color: var(--color-surface-2); color: var(--color-text-faint); }
textarea.input { resize: vertical; min-height: 72px; }
.input-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.input-row .input { flex: 1; min-width: 140px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; color: var(--color-text); cursor: pointer; margin-bottom: 10px; line-height: 1.5; }
.checkbox-row input[type="checkbox"] { margin-top: 3px; accent-color: var(--color-primary); width: 16px; height: 16px; flex-shrink: 0; }
.toggle-group { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 3px; background-color: var(--color-surface); }
.toggle-group button { border: none; background: transparent; padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; color: var(--color-text-muted); cursor: pointer; }
.toggle-group button.active { background-color: var(--color-primary); color: #fff; }
.dow-toggle-row { display: flex; gap: 6px; flex-wrap: wrap; }
.dow-toggle { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--color-border); background-color: var(--color-surface); color: var(--color-text); font-size: 14px; font-weight: 700; cursor: pointer; }
.dow-toggle.active { background-color: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.form-error { color: var(--color-danger-text); font-size: 13px; margin: -4px 0 12px; min-height: 1em; }

/* ---------------------------------------------------------------- Header */
.site-header { background-color: var(--color-surface); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 40; }
.site-header .container { min-height: var(--header-height); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--color-accent); }
.brand:hover { text-decoration: none; }
.brand-logo { display: inline-flex; color: var(--color-primary); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-mark { font-size: 20px; font-weight: 800; color: var(--color-accent); letter-spacing: -0.02em; line-height: 1.1; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--color-text-muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a { padding: 8px 13px; border-radius: var(--radius-md); color: var(--color-heading); font-weight: 700; font-size: 14px; }
.nav-links a:hover, .nav-links a.active { background-color: var(--color-primary-pale); color: var(--color-accent); text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.nav-toggle { display: none; }
.theme-toggle-btn .theme-icon-sun { display: none; }
.theme-toggle-btn .theme-icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle-btn .theme-icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle-btn .theme-icon-moon { display: none; }
.demo-banner { background: var(--color-warning-bg); color: var(--color-warning-text); border-bottom: 1px solid var(--color-warning-border); text-align: center; font-size: 13px; padding: 7px 16px; font-weight: 700; }

/* ---------------------------------------------------------------- Footer */
.site-footer { background-color: var(--color-footer-bg); color: var(--color-footer-text); width: 100%; padding: 36px 0; margin-top: 40px; border-top: 1px solid var(--color-footer-border); }
.footer-inner { max-width: var(--container-width); margin: 0 auto; padding: 0 20px; }
.footer-title { font-weight: 800; color: #fff; font-size: 16px; margin-bottom: 10px; }
.site-footer p { color: var(--color-footer-text); font-size: 13px; max-width: 820px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0; }
.footer-links a { color: var(--color-footer-link); font-size: 13px; }
.copyright { color: var(--color-footer-copy); font-size: 12px; margin-top: 12px; }

/* ---------------------------------------------------------------- Cards / badges / notices */
.card { background-color: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.notice { background-color: var(--color-info-bg); color: var(--color-info-text); border: 1px solid transparent; border-radius: var(--radius-lg); padding: 12px 16px; margin: 0 0 16px; line-height: 1.6; font-size: 14px; }
.notice.warn { background: var(--color-warning-bg); color: var(--color-warning-text); border-color: var(--color-warning-border); }
.notice.error { background: var(--color-danger-bg); color: var(--color-danger-text); border-color: var(--color-danger-border); }
.notice p { margin: 0; color: inherit; font-size: inherit; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; background-color: var(--color-primary-pale); color: var(--color-primary-dark); white-space: nowrap; }
.badge-muted { background-color: var(--color-surface-2); color: var(--color-text-muted); }
.badge-warn { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-ok { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger-text); }
.prov { display: inline-block; padding: 2px 7px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.prov-public { background: var(--color-info-bg); color: var(--color-info-text); }
.prov-rule { background: var(--color-surface-2); color: var(--color-text-muted); }
.prov-llm_extracted { background: var(--color-warning-bg); color: var(--color-warning-text); }
.prov-llm_reviewed { background: var(--color-success-bg); color: var(--color-success-text); }
.prov-confirmed { background: var(--color-primary); color: #fff; }
.prov-assumed { background: var(--color-danger-bg); color: var(--color-danger-text); border-style: dashed; border-color: var(--color-danger-border); }

/* ---------------------------------------------------------------- Dialog / snackbar */
.dialog-backdrop { position: fixed; inset: 0; background-color: rgba(10, 20, 40, 0.55); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.dialog-backdrop.open { display: flex; }
.dialog { background-color: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 22px; }
.dialog.dialog-lg { max-width: 860px; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.dialog-header h2 { font-size: 18px; margin: 0; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
#snackbar-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 40px); max-width: 420px; pointer-events: none; }
.snackbar { background-color: var(--color-navy); color: #fff; padding: 12px 18px; border-radius: var(--radius-md); font-size: 14px; box-shadow: var(--shadow-md); animation: snackbar-in 0.15s ease-out; text-align: center; line-height: 1.5; }
.snackbar.error { background-color: var(--color-danger); }
.snackbar.success { background-color: var(--color-success); }
@keyframes snackbar-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 40px 16px; color: var(--color-text-muted); }

/* ---------------------------------------------------------------- Page layout */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 26px 0 16px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { margin: 0; }
.page-head .sub { margin: 4px 0 0; font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.layout-side { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.layout-side .side { position: sticky; top: calc(var(--header-height) + 12px); }
.layout-side .side .card { max-height: calc(100vh - var(--header-height) - 24px); overflow-y: auto; }

.stat { padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--color-text-muted); font-weight: 700; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stat .value { font-size: 26px; font-weight: 800; color: var(--color-heading); line-height: 1.1; }
.stat .value small { font-size: 13px; font-weight: 600; color: var(--color-text-muted); margin-left: 4px; }
.stat .desc { font-size: 12px; color: var(--color-text-faint); margin-top: 6px; line-height: 1.4; }
.stat.na .value { color: var(--color-text-faint); font-size: 18px; }

.rank-pill { display: inline-flex; align-items: center; gap: 4px; background: var(--color-primary-pale); color: var(--color-primary-dark); border-radius: var(--radius-pill); padding: 3px 10px; font-size: 12px; font-weight: 700; }
.rank-pill.hot { background: var(--color-danger-bg); color: var(--color-danger-text); }

/* ---------------------------------------------------------------- Tables (mobile → cards) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--color-border-light); text-align: left; vertical-align: top; }
.table th { font-size: 12px; color: var(--color-text-muted); font-weight: 700; background: var(--color-surface-2); position: sticky; top: 0; white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--color-accent); }
.table th.sorted::after { content: ' ▾'; color: var(--color-accent); }
.table th.sorted.asc::after { content: ' ▴'; }
.table tr:hover td { background: var(--color-primary-pale); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .name a { font-weight: 700; }
.table td .sub { display: block; font-size: 12px; color: var(--color-text-faint); margin-top: 2px; }
@media (max-width: 760px) {
  table.table.responsive, .table.responsive thead, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive thead { display: none; }
  .table.responsive tr { border: 1px solid var(--color-border); border-radius: var(--radius-lg); margin-bottom: 10px; padding: 8px 12px; background: var(--color-surface); }
  .table.responsive td { border: none; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; text-align: left; }
  .table.responsive td.num { text-align: right; }
  .table.responsive td::before { content: attr(data-label); font-size: 12px; color: var(--color-text-muted); font-weight: 700; flex-shrink: 0; }
  .table.responsive td.name { flex-direction: column; gap: 2px; }
  .table.responsive td.name::before { display: none; }
  .table.responsive tr:hover td { background: transparent; }
}

/* ---------------------------------------------------------------- Bars / mini charts */
.bar { height: 8px; background: var(--color-surface-3); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--color-primary); border-radius: 4px; }
.bar-list { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 60px; gap: 8px; align-items: center; font-size: 13px; }
.bar-row .k { color: var(--color-text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .v { text-align: right; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 36px; }
.spark span { flex: 1; background: var(--color-primary); opacity: 0.75; border-radius: 2px 2px 0 0; min-width: 3px; }

/* ---------------------------------------------------------------- Landing */
.hero { padding: 56px 0 36px; text-align: center; background: linear-gradient(180deg, var(--color-primary-pale), transparent); }
.hero .badge { margin-bottom: 18px; font-size: 12px; padding: 5px 12px; }
.hero h1 { font-size: 38px; max-width: 760px; margin: 0 auto 16px; line-height: 1.3; }
.hero .subtitle { font-size: 16px; max-width: 620px; margin: 0 auto 26px; }
.hero .cta-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.section { padding: 44px 0; }
.section-title { text-align: center; font-size: 24px; margin-bottom: 8px; }
.section-subtitle { text-align: center; max-width: 620px; margin: 0 auto 30px; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.step-card { background-color: var(--color-surface); border: 1px solid var(--color-border-light); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 22px 18px; }
.step-card h3 { font-size: 16px; }
.step-number { width: 36px; height: 36px; border-radius: 50%; background-color: var(--color-primary); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.region-picker { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 760px; margin: 0 auto; }
.region-picker select { min-width: 160px; }
.error-page { text-align: center; padding: 60px 20px; }
.error-page h1 { font-size: 64px; color: var(--color-primary); }

/* ---------------------------------------------------------------- Scenario editor */
.list-editor { display: flex; flex-direction: column; gap: 10px; }
.list-item { border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 12px; background: var(--color-surface); }
.list-item .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.list-item .head b { font-size: 14px; }
.list-item .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.list-item .field { margin-bottom: 0; }
.list-item .field label { font-size: 12px; }
.list-item .input { min-height: 36px; padding: 6px 8px; font-size: 14px; }
.combo-card { border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 14px; background: var(--color-surface); }
.combo-card.best { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-pale); }
.combo-card .title { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.combo-card .big { font-size: 24px; font-weight: 800; color: var(--color-heading); }
.combo-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background-color: var(--color-primary-pale); color: var(--color-primary-dark); border-radius: var(--radius-sm); padding: 4px 8px; font-size: 12px; font-weight: 700; }
.chip.off { background: var(--color-surface-2); color: var(--color-text-faint); }
.trace { font-size: 13px; }
.trace li { padding: 6px 0; border-bottom: 1px dashed var(--color-border-light); }
.sticky-actions { position: sticky; bottom: 0; background: var(--color-surface); border-top: 1px solid var(--color-border); padding: 10px 0; margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; z-index: 5; }

/* ---------------------------------------------------------------- Agent dashboard */
.agent-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 16px; align-items: start; }
.chat { display: flex; flex-direction: column; gap: 12px; min-height: 320px; }
.msg { max-width: 92%; padding: 12px 14px; border-radius: 12px; line-height: 1.6; font-size: 14px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--color-primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--color-surface-2); color: var(--color-text); border-bottom-left-radius: 4px; }
.msg.assistant .appendix { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--color-border); font-size: 12px; color: var(--color-text-muted); }
.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form textarea { flex: 1; }
.timeline { display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow-y: auto; }
.tl-item { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--color-surface-2); font-size: 13px; }
.tl-item .icon { font-weight: 800; color: var(--color-accent); }
.tl-item.call { background: var(--color-info-bg); }
.tl-item.result { background: var(--color-success-bg); }
.tl-item.guard, .tl-item.warn { background: var(--color-warning-bg); }
.tl-item.error { background: var(--color-danger-bg); }
.tl-item .title { font-weight: 700; }
.tl-item .text { color: var(--color-text-muted); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.tl-item.pending .icon { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.evidence-card { border: 1px solid var(--color-border-light); border-radius: var(--radius-md); padding: 10px; font-size: 13px; background: var(--color-surface); }
.evidence-card .k { font-weight: 700; color: var(--color-heading); }
.sample-qs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.sample-qs button { border: 1px solid var(--color-border); background: var(--color-surface); border-radius: var(--radius-pill); padding: 6px 12px; font-size: 12px; cursor: pointer; color: var(--color-text); }
.sample-qs button:hover { border-color: var(--color-primary); color: var(--color-accent); }

/* ---------------------------------------------------------------- Review queue */
.review-item { border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 14px; background: var(--color-surface); display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.review-item .evidence { background: var(--color-surface-2); border-radius: var(--radius-md); padding: 8px 10px; font-size: 13px; margin-top: 6px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--color-text-muted); font-weight: 700; }
.kv dd { margin: 0; }
details.expandable { border-top: 1px solid var(--color-border-light); padding-top: 12px; margin-top: 8px; }
details.expandable summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--color-heading); }
.doc-preview { white-space: pre-wrap; font-size: 14px; line-height: 1.7; background: var(--color-surface-2); border-radius: var(--radius-md); padding: 16px; }
.watermark { font-size: 12px; color: var(--color-danger-text); font-weight: 700; }

/* ---------------------------------------------------------------- Mode choice (landing) */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 900px; margin: 8px auto 0; text-align: left; }
.mode-card { display: flex; flex-direction: column; gap: 10px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); color: var(--color-text); transition: box-shadow 0.2s, border-color 0.2s; }
.mode-card:hover { text-decoration: none; border-color: var(--color-primary); box-shadow: var(--shadow-md); color: var(--color-text); }
.mode-card h2 { margin: 0; font-size: 20px; }
.mode-card p { margin: 0; font-size: 14px; flex: 1; }
.mode-card .btn { align-self: flex-start; pointer-events: none; }
.mode-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--color-primary-pale); color: var(--color-primary); display: inline-flex; align-items: center; justify-content: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { cursor: pointer; border: none; }
@media (max-width: 760px) { .mode-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Guide */
.guide-layout { grid-template-columns: 260px 1fr; }
.guide-toc ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.guide-toc a { display: block; padding: 6px 8px; border-radius: var(--radius-sm); font-size: 13px; color: var(--color-text); }
.guide-toc a:hover { background: var(--color-primary-pale); color: var(--color-accent); text-decoration: none; }
.guide-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.guide-body section { scroll-margin-top: calc(var(--header-height) + 12px); }
.guide-body h2 { font-size: 20px; padding-bottom: 8px; border-bottom: 1px solid var(--color-border-light); margin-bottom: 12px; }
.guide-body h3 { font-size: 15px; margin-top: 16px; }
.guide-body p { color: var(--color-text); font-size: 14px; }
.guide-list li { padding: 4px 0; font-size: 14px; line-height: 1.6; color: var(--color-text); }
.guide-steps { padding-left: 20px; margin: 0; }
.guide-steps li { margin: 8px 0; line-height: 1.6; font-size: 14px; color: var(--color-text); }
.guide-box { border: 1px solid var(--color-border-light); border-radius: var(--radius-lg); padding: 14px; background: var(--color-surface-2); }
.guide-box h4 { margin: 0 0 8px; font-size: 14px; }
.guide-box li { font-size: 13px; line-height: 1.6; padding: 2px 0; color: var(--color-text); }
.guide-glossary dt { padding-top: 6px; }
.guide-glossary dd { padding-top: 6px; line-height: 1.5; }
.guide-promo { background: linear-gradient(90deg, var(--color-primary-pale), var(--color-surface)); border-color: var(--color-primary-pale-2); }
@media (max-width: 1000px) { .guide-layout { grid-template-columns: 1fr; } .guide-toc ol { display: grid; grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .guide-toc ol { grid-template-columns: 1fr; } .guide-promo .row { flex-direction: column; align-items: stretch; } .guide-promo .btn { width: 100%; } }

/* ---------------------------------------------------------------- Import progress */
.progress { height: 10px; background: var(--color-surface-3); border-radius: 5px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--color-primary); transition: width 0.4s ease; border-radius: 5px; }
.progress-bar.done { background: var(--color-success); }
.progress-bar.failed { background: var(--color-danger); }
.global-import { position: sticky; top: var(--header-height); z-index: 39; background: var(--color-info-bg); color: var(--color-info-text); border-bottom: 1px solid var(--color-border); }
.global-import-inner { max-width: var(--container-width); margin: 0 auto; padding: 8px 20px; display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 700; }
.global-import-inner .progress { flex: 1; min-width: 80px; }
@media (max-width: 640px) { .global-import-inner { flex-wrap: wrap; padding: 8px 16px; } }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .layout-side { grid-template-columns: 1fr; }
  .layout-side .side { position: static; }
  .layout-side .side .card { max-height: none; }
  .agent-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--color-surface); border-bottom: 1px solid var(--color-border); box-shadow: var(--shadow-md); padding: 8px 12px 12px; gap: 2px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; font-size: 15px; }
  .nav-toggle { display: inline-flex; }
  .brand-sub { display: none; }
  .brand-mark { font-size: 18px; }
  :root { --header-height: 60px; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .footer-inner { padding: 0 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding: 36px 0 24px; }
  .hero h1 { font-size: 26px; }
  .hero .subtitle { font-size: 14px; }
  .section { padding: 28px 0; }
  .section-title { font-size: 20px; }
  .page-head { margin: 18px 0 12px; }
  h1 { font-size: 22px; }
  .card-pad { padding: 14px; }
  .stat .value { font-size: 22px; }
  .btn { padding: 11px 14px; }
  .dialog { padding: 16px; max-height: 94vh; }
  .review-item { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 72px 1fr 52px; }
  .msg { max-width: 100%; }
  .region-picker select { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media print {
  .site-header, .site-footer, .sticky-actions, .nav-actions, .demo-banner, .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
