/* ============================================================================
   KPN API Platform — design system
   Neutral, product-grade UI: solid surfaces, 1px borders, one accent used
   sparingly, Inter + Noto Sans Khmer. Dark-first; [data-theme="light"] flips.
   ========================================================================== */

:root {
  --bg: #0a0a0a;
  --bg-subtle: #0f0f10;
  --card: #0f0f10;
  --card-hover: #141415;
  --elevated: #1a1a1c;
  --border: #1f1f22;
  --border-strong: #2e2e33;
  --text: #e4e4e7;
  --text-strong: #fafafa;
  --muted: #a1a1aa;
  --faint: #71717a;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.10);
  --accent-border: rgba(129, 140, 248, 0.30);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.10);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.10);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.10);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.10);
  --primary-bg: #fafafa;
  --primary-text: #0a0a0a;
  --code-bg: #0c0c0d;
  --overlay: rgba(0, 0, 0, 0.65);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 3px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.5);
  --ring: 0 0 0 3px rgba(129, 140, 248, 0.30);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --nav-h: 56px;
  --side-w: 232px;
  --font: 'Inter', 'Noto Sans Khmer', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, 'Khmer OS', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  --t: 130ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme='light'] {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --card: #ffffff;
  --card-hover: #fafafa;
  --elevated: #f4f4f5;
  --border: #e8e8ea;
  --border-strong: #d4d4d8;
  --text: #27272a;
  --text-strong: #09090b;
  --muted: #52525b;
  --faint: #8b8b93;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.06);
  --accent-border: rgba(79, 70, 229, 0.25);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.08);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.08);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.06);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.06);
  --primary-bg: #18181b;
  --primary-text: #fafafa;
  --code-bg: #fafafa;
  --overlay: rgba(24, 24, 27, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 3px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.12);
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.20);
}

/* ------------------------------------------------------------------ base -- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html[data-lang='km'] body { line-height: 1.72; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background var(--t), color var(--t);
}
img, svg { display: block; }
svg.ico-svg { flex: none; }
a { color: var(--accent); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { color: var(--text-strong); font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
html[data-lang='km'] h1, html[data-lang='km'] h2, html[data-lang='km'] h3, html[data-lang='km'] h4 {
  letter-spacing: 0; line-height: 1.5;
}
h1 { font-size: clamp(1.9rem, 4.4vw, 2.8rem); font-weight: 650; }
h2 { font-size: clamp(1.25rem, 2.6vw, 1.6rem); }
h3 { font-size: 1.05rem; }
p { color: var(--muted); }
::selection { background: var(--accent-soft); color: var(--text-strong); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
b, strong { color: var(--text); font-weight: 600; }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------- utilities -- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.center { text-align: center; }
.right { text-align: right; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; } .mt-6 { margin-top: 40px; } .mt-8 { margin-top: 64px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- button -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid transparent; background: transparent; color: var(--text);
  font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background var(--t), border-color var(--t), color var(--t), opacity var(--t);
  user-select: none; text-decoration: none;
}
.btn:active { opacity: 0.85; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary-bg); color: var(--primary-text); font-weight: 550; }
.btn-primary:hover:not(:disabled) { opacity: 0.88; }
.btn-accent { background: var(--accent); color: #fff; font-weight: 550; }
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn-outline { border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--card-hover); border-color: var(--faint); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--elevated); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; font-weight: 550; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger-soft:hover:not(:disabled) { background: rgba(248, 113, 113, 0.18); }
.btn-sm { height: 29px; padding: 0 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { height: 42px; padding: 0 22px; font-size: 14px; border-radius: var(--radius); }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 29px; }
.btn .spinner {
  width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- badge -- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 550; letter-spacing: 0.01em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-neutral { background: var(--elevated); color: var(--muted); border-color: var(--border); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-free { background: var(--success-soft); color: var(--success); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.dot-live { animation: pulse 2.2s ease infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.45); }
  50% { box-shadow: 0 0 0 4px rgba(74, 222, 128, 0); }
}

/* ------------------------------------------------------------------ card -- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  transition: border-color var(--t), background var(--t);
}
.card-hover:hover { border-color: var(--border-strong); background: var(--card-hover); }
.card-pad-lg { padding: 26px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.stat-label { font-size: 11px; font-weight: 500; color: var(--faint); }
html[data-lang='km'] .stat-label { font-size: 12px; }
.stat-value { font-size: 22px; font-weight: 600; color: var(--text-strong); margin-top: 5px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ------------------------------------------------------------------ form -- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px;
  background: var(--bg-subtle); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font: 400 13.5px var(--font);
  transition: border-color var(--t), box-shadow var(--t);
  appearance: none;
}
[data-theme='light'] .input, [data-theme='light'] .select, [data-theme='light'] .textarea { background: #fff; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input.err { border-color: var(--danger); }
.textarea { height: auto; min-height: 88px; padding: 9px 11px; resize: vertical; line-height: 1.6; font-family: var(--font); }
.textarea.mono { font-family: var(--mono); font-size: 12.5px; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2371717a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; cursor: pointer;
}
.hint { font-size: 11.5px; color: var(--faint); }
.form-err {
  font-size: 12.5px; color: var(--danger); background: var(--danger-soft);
  border-radius: var(--radius-sm); padding: 8px 12px;
}
.switch { position: relative; width: 36px; height: 20px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background var(--t); }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform var(--t); }
.switch input:checked ~ .track { background: var(--accent); }
.switch input:checked ~ .track .thumb { transform: translateX(16px); }

/* ----------------------------------------------------------------- table -- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 9px 14px; color: var(--faint);
  font-size: 11px; font-weight: 550; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--bg-subtle);
}
html[data-lang='km'] .table th { font-size: 11.5px; letter-spacing: 0; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: var(--card-hover); }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }

/* ------------------------------------------------------------------ nav --- */
.nav {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.nav-inner { max-width: 1320px; margin: 0 auto; padding: 0 24px; height: 100%; display: flex; align-items: center; gap: 20px; }
.nav-logo { display: flex; align-items: center; gap: 9px; font-weight: 600; color: var(--text-strong); font-size: 14px; }
.nav-logo:hover { color: var(--text-strong); }
.logo-mark {
  width: 24px; height: 24px; border-radius: 6px; background: var(--text-strong); color: var(--bg);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none;
}
.nav-links { display: flex; gap: 2px; align-items: center; }
.nav-links a {
  padding: 6px 11px; border-radius: var(--radius-sm); color: var(--muted);
  font-size: 13px; font-weight: 500; transition: color var(--t), background var(--t);
}
.nav-links a:hover { color: var(--text-strong); }
.nav-links a.active { color: var(--text-strong); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.nav-burger { display: none; }

/* lang switcher — plain text buttons, v0-style */
.lang-switch { display: inline-flex; gap: 2px; }
.lang-switch button {
  border: none; background: transparent; color: var(--faint); cursor: pointer;
  font: 500 12px var(--font); padding: 5px 8px; border-radius: var(--radius-sm);
  transition: color var(--t), background var(--t);
}
.lang-switch button:hover { color: var(--text-strong); }
.lang-switch button.active { color: var(--text-strong); background: var(--elevated); }

.theme-toggle {
  width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center;
  transition: color var(--t), background var(--t);
}
.theme-toggle:hover { color: var(--text-strong); background: var(--elevated); }

/* avatar — neutral, no gradient */
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--elevated); color: var(--muted); border: 1px solid var(--border-strong);
  display: grid; place-items: center; font-weight: 600; font-size: 11px; flex: none;
}

/* ------------------------------------------------------------------ hero -- */
.hero { padding: 84px 0 56px; text-align: center; position: relative; }
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 60% 55% at 50% 0%, #000 20%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 0%, #000 20%, transparent 72%);
  opacity: 0.55;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px;
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); font-size: 12px; font-weight: 500; color: var(--muted);
  position: relative;
}
.hero h1 { max-width: 760px; margin: 0 auto 16px; position: relative; }
.hero h1 .accent { color: var(--accent); }
.hero-sub { max-width: 580px; margin: 0 auto 30px; font-size: 15.5px; color: var(--muted); position: relative; }
.hero-cta { display: flex; gap: 10px; justify-content: center; position: relative; flex-wrap: wrap; }

/* code window — flat, no traffic-light dots */
.code-window {
  text-align: left; background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; position: relative;
  font-family: var(--mono); font-size: 12.5px;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 7px;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
}
.code-head .lang-label { font: 500 11px var(--font); color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; }
.code-body { padding: 14px 16px; overflow-x: auto; line-height: 1.7; color: var(--text); }
.code-body .k { color: var(--accent); }
.code-body .s { color: var(--success); }
.code-body .n { color: var(--warn); }
.code-body .c { color: var(--faint); }
[data-theme='light'] .code-body .k { color: #4f46e5; }
[data-theme='light'] .code-body .s { color: #15803d; }
[data-theme='light'] .code-body .n { color: #b45309; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border-strong); background: var(--card); color: var(--muted);
  font: 500 11px var(--font); padding: 4px 8px; border-radius: var(--radius-sm); cursor: pointer;
  transition: color var(--t), border-color var(--t);
}
.copy-btn:hover { color: var(--text-strong); border-color: var(--faint); }

/* grid sections */
.section { padding: 60px 0; position: relative; }
.section-head { max-width: 600px; margin: 0 auto 40px; }
.section-head.center { text-align: center; }
.section-head p { margin-top: 8px; font-size: 14.5px; }
.section-eyebrow { font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 8px; }
html[data-lang='km'] .section-eyebrow { letter-spacing: 0; text-transform: none; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.feature-card { padding: 20px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; }
.feature-icon {
  width: 32px; height: 32px; border-radius: var(--radius); display: grid; place-items: center;
  background: var(--elevated); border: 1px solid var(--border);
  color: var(--muted); margin-bottom: 4px;
}
.feature-card:hover .feature-icon { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.feature-card h3 { font-size: 14px; font-weight: 600; }
.feature-card p { font-size: 12.5px; line-height: 1.65; }
.feature-slug { font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* pricing */
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; align-items: stretch; }
.price-card { display: flex; flex-direction: column; padding: 22px; }
.price-card.featured { border-color: var(--accent-border); }
.price-amount { font-size: 30px; font-weight: 650; color: var(--text-strong); letter-spacing: -0.03em; }
.price-amount span { font-size: 13px; color: var(--muted); font-weight: 450; }
.price-list { list-style: none; margin: 16px 0 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.price-list li { font-size: 13px; color: var(--muted); display: flex; gap: 9px; align-items: flex-start; }
.price-list li svg { color: var(--success); margin-top: 3px; }

/* ------------------------------------------------------------- panel UI --- */
.panel-body { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar {
  width: var(--side-w); flex: none; border-right: 1px solid var(--border);
  background: var(--bg); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 14px 10px; gap: 1px; z-index: 40;
  overflow-y: auto;
}
.side-logo { padding: 4px 8px 16px; }
.side-item {
  display: flex; align-items: center; gap: 10px; padding: 7.5px 10px;
  border-radius: var(--radius-sm); color: var(--muted); font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; background: transparent; width: 100%; text-align: left;
  font-family: var(--font); transition: color var(--t), background var(--t);
}
.side-item .si { display: grid; place-items: center; width: 18px; color: var(--faint); transition: color var(--t); }
.side-item:hover { color: var(--text-strong); background: var(--bg-subtle); }
.side-item:hover .si { color: var(--muted); }
.side-item.active { color: var(--text-strong); background: var(--bg-subtle); }
.side-item.active .si { color: var(--accent); }
.side-sep { height: 1px; background: var(--border); margin: 8px 4px; }
.side-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); padding: 8px 10px 4px; }
html[data-lang='km'] .side-label { letter-spacing: 0; text-transform: none; font-size: 11.5px; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 1px; }
.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-subtle); cursor: pointer;
  transition: border-color var(--t); width: 100%; font-family: var(--font);
}
.user-chip:hover { border-color: var(--border-strong); }
.uc-name { font-size: 12.5px; font-weight: 600; color: var(--text-strong); text-align: left; }
.uc-role { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; }
.main { flex: 1; min-width: 0; padding: 24px 28px 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 650; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel-grid .span-2 { grid-column: span 2; }
.chart-box { position: relative; height: 250px; }

/* tabs — underline style */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 8px 12px; font-size: 13px; font-weight: 500; color: var(--muted);
  cursor: pointer; border: none; background: transparent; font-family: var(--font);
  border-bottom: 1.5px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color var(--t), border-color var(--t);
}
.tab:hover { color: var(--text-strong); }
.tab.active { color: var(--text-strong); border-bottom-color: var(--accent); }

/* --------------------------------------------------------------- modal --- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay); z-index: 100;
  display: grid; place-items: center; padding: 20px;
  animation: fadeIn 110ms ease;
}
.modal {
  background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  width: 100%; max-width: 440px; max-height: 86vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: slideUp 160ms cubic-bezier(0.16, 1, 0.3, 1);
  padding: 22px;
}
.modal-lg { max-width: 620px; }
.modal h3 { font-size: 16px; margin-bottom: 5px; }
.modal .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; word-break: break-all; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px) scale(0.985); } }

/* --------------------------------------------------------------- toast --- */
.toast-wrap { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 11px 14px; box-shadow: var(--shadow-lg);
  font-size: 13px; color: var(--text); animation: toastIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.out { animation: toastOut 160ms ease forwards; }
.toast .t-ico { flex: none; margin-top: 1px; color: var(--faint); }
.toast-success .t-ico { color: var(--success); }
.toast-error .t-ico { color: var(--danger); }
.toast-warn .t-ico { color: var(--warn); }
.toast-info .t-ico { color: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }

/* ------------------------------------------------------------ skeleton --- */
.skeleton {
  background: var(--elevated); border-radius: 5px; opacity: 0.6;
  animation: skelPulse 1.6s ease infinite;
}
@keyframes skelPulse { 50% { opacity: 0.3; } }

/* ----------------------------------------------------------------- auth --- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; padding: 28px; }
.auth-card h1 { font-size: 19px; text-align: center; font-weight: 650; }
.auth-card .sub { text-align: center; margin: 6px 0 22px; font-size: 13px; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 13px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--muted); }
.strength { height: 3px; border-radius: 3px; background: var(--elevated); overflow: hidden; }
.strength > div { height: 100%; width: 0; border-radius: 3px; transition: width 220ms ease, background 220ms ease; }
.auth-top { position: fixed; top: 16px; right: 20px; }

/* ----------------------------------------------------------------- docs --- */
.docs-layout { display: flex; gap: 0; max-width: 1320px; margin: 0 auto; }
.docs-side {
  width: 240px; flex: none; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; padding: 22px 12px 40px 20px; border-right: 1px solid var(--border);
}
.docs-side .nav-logo { padding-bottom: 14px; }
.docs-side a {
  display: block; padding: 5px 10px; border-radius: var(--radius-sm); color: var(--muted);
  font-size: 12.5px; font-weight: 500; transition: color var(--t), background var(--t);
}
.docs-side a:hover { color: var(--text-strong); background: var(--bg-subtle); }
.docs-side a.active { color: var(--text-strong); background: var(--bg-subtle); }
.docs-side .side-label { padding-left: 10px; }
.docs-main { flex: 1; min-width: 0; padding: 32px 44px 90px; max-width: 840px; }
.docs-main h2 { margin: 42px 0 12px; font-size: 19px; font-weight: 650; }
.docs-main h2:first-child { margin-top: 0; }
.docs-main h3 { margin: 26px 0 8px; font-size: 14.5px; font-weight: 600; }
.docs-main p { margin: 9px 0; font-size: 14px; line-height: 1.75; }
.docs-main ul, .docs-main ol { margin: 9px 0 9px 20px; color: var(--muted); font-size: 13.5px; }
.docs-main li { margin: 4px 0; }
.docs-main .table-wrap { margin: 14px 0; }
.endpoint-chip {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px;
  background: var(--bg-subtle); border: 1px solid var(--border);
  padding: 5px 10px; border-radius: var(--radius-sm); margin: 5px 0;
}
.method { font-weight: 700; font-size: 10px; padding: 2px 6px; border-radius: 4px; letter-spacing: 0.04em; }
.method-post { background: var(--success-soft); color: var(--success); }
.method-get { background: var(--info-soft); color: var(--info); }
.callout {
  border: 1px solid var(--border); border-left: 2px solid var(--accent);
  background: var(--bg-subtle); border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 13px; color: var(--muted); margin: 14px 0;
}
.callout.warn { border-left-color: var(--warn); }
.callout b { color: var(--text); }

/* ------------------------------------------------------------- playground - */
.pg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
.pg-pane { min-height: 320px; display: flex; flex-direction: column; }
.pg-pane .code-window { flex: 1; display: flex; flex-direction: column; }
.pg-pane .code-body { flex: 1; }
.pg-toolbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }

/* --------------------------------------------------------------- status -- */
.status-hero { text-align: center; padding: 48px 0 28px; }
.status-big {
  display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600;
  padding: 10px 22px; border-radius: 999px; border: 1px solid;
}
.status-ok { color: var(--success); border-color: var(--success); background: var(--success-soft); }
.status-bad { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.uptime-bars { display: flex; gap: 2px; height: 32px; align-items: flex-end; }
.uptime-bars span { flex: 1; background: var(--success); border-radius: 2px; min-height: 26%; }
.uptime-bars span.partial { background: var(--warn); }
.uptime-bars span.down { background: var(--danger); }

/* --------------------------------------------------------------- footer -- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.footer a { color: var(--muted); font-size: 12.5px; }
.footer a:hover { color: var(--text-strong); }

/* ------------------------------------------------------------ empty state */
.empty { text-align: center; padding: 36px 18px; color: var(--faint); }
.empty .ico { color: var(--faint); display: grid; place-items: center; margin: 0 auto 10px; width: fit-content; opacity: 0.7; }
.empty p { font-size: 13px; }

/* ------------------------------------------------------------- paginator -- */
.pager { display: flex; gap: 7px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 1020px) {
  .panel-grid { grid-template-columns: 1fr; }
  .panel-grid .span-2 { grid-column: span 1; }
  .pg-grid { grid-template-columns: 1fr; }
  .docs-side { display: none; }
  .docs-main { padding: 24px 20px 70px; }
}
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-burger { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh;
    transform: translateX(-105%); transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg); width: 248px;
  }
  .sidebar.open { transform: translateX(0); }
  .side-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 35; }
  .main { padding: 18px 14px 60px; }
  .hero { padding: 52px 0 36px; }
  .auth-top { top: 12px; right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
