/* ==========================================================================
   FTA prototype — base, shell, components, screens.
   All colors come from tokens.css. Responsive rules use container queries on
   the .frame element, so the device-width switcher simulates real breakpoints.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.num { font-size: .95em; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.cr { color: var(--credit-ink); }
.dr { color: var(--debit-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ico.sm { width: 16px; height: 16px; }
.ico.xs { width: 14px; height: 14px; }
.ico.lg { width: 22px; height: 22px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ---------- Type scale ---------- */
.t-display { font-size: var(--fs-display); line-height: var(--lh-display); font-weight: 600; letter-spacing: -0.025em; }
.t-h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: 600; letter-spacing: -0.02em; }
.t-h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: 600; letter-spacing: -0.015em; }
.t-h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 600; letter-spacing: -0.01em; }
.t-h4 { font-size: var(--fs-h4); line-height: var(--lh-h4); font-weight: 600; }
.t-body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }
.t-body { font-size: var(--fs-body); line-height: var(--lh-body); }
.t-body-sm { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); }
.t-caption { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-3); }
.t-label { font-size: var(--fs-body-sm); line-height: 18px; font-weight: 500; }
.t-overline { font-size: var(--fs-overline); line-height: 16px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }

/* ==========================================================================
   Prototype chrome (outside the simulated app)
   ========================================================================== */
.proto {
  display: flex; flex-direction: column; height: 100%;
}
.proto-bar {
  flex: none; display: flex; align-items: center; gap: var(--s-3);
  padding: 8px 16px; background: var(--n-950); color: #C9D1DE;
  font-size: 12.5px; overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.proto-bar::-webkit-scrollbar { display: none; }
.proto-bar .pb-brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; margin-right: 4px; }
.proto-bar .pb-tag { font-family: var(--font-mono); font-size: 10.5px; padding: 2px 6px; border-radius: var(--r-full); background: rgba(142,168,255,.16); color: #AFC2FF; }
.proto-bar .pb-sep { width: 1px; height: 18px; background: rgba(255,255,255,.12); flex: none; }
.proto-bar .pb-group { display: flex; align-items: center; gap: 2px; background: rgba(255,255,255,.06); border-radius: 8px; padding: 2px; }
.proto-bar .pb-lbl { color: #7F8A9D; margin: 0 4px 0 2px; }
.proto-bar button, .proto-bar a.pb-link {
  border: 0; background: transparent; color: #C9D1DE; padding: 4px 9px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; text-decoration: none;
}
.proto-bar button:hover, .proto-bar a.pb-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.proto-bar .on { background: #fff !important; color: var(--n-900) !important; }
.proto-bar .pb-spacer { flex: 1; }
.proto-stage { flex: 1; min-height: 0; display: flex; justify-content: center; background: var(--bg); }
.proto-stage[data-device]:not([data-device="auto"]) { background: repeating-linear-gradient(45deg, var(--surface-3) 0 1px, transparent 1px 12px), var(--bg); padding: 16px; }

.frame {
  container-type: inline-size; container-name: frame;
  position: relative; width: 100%; height: 100%; overflow: hidden;
  background: var(--bg);
}
.proto-stage:not([data-device="auto"]) .frame {
  border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.proto-stage[data-device="390"] .frame { max-width: 390px; max-height: 844px; border-radius: 28px; }
.proto-stage[data-device="768"] .frame { max-width: 768px; }
.proto-stage[data-device="1024"] .frame { max-width: 1024px; }
.proto-stage[data-device="1280"] .frame { max-width: 1280px; }
.proto-stage[data-device="1440"] .frame { max-width: 1440px; }
.frame-scroll { height: 100%; overflow: auto; }

/* ==========================================================================
   Application shell
   ========================================================================== */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); height: 100%; }
.app.collapsed { grid-template-columns: 68px minmax(0, 1fr); }
.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
}
.sb-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; height: 60px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: var(--n-900); color: #fff;
}
.logo-mark svg { width: 20px; height: 20px; }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.logo-text b { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.logo-text span { font-size: 11px; color: var(--text-3); }
.sb-logo { display: flex; align-items: center; min-width: 0; border-radius: 8px; }
.sb-logo img { display: block; height: 40px; width: auto; max-width: 160px; object-fit: contain; object-position: left center; }
.app.collapsed .sb-logo { padding: 0; }
.app.collapsed .sb-logo img { width: 32px; height: 32px; object-fit: cover; object-position: left center; }
.sb-collapse { margin-left: auto; }
.sb-scroll { flex: 1; overflow-y: auto; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 18px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group > .t-overline { padding: 6px 10px 4px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border-radius: var(--r-md); color: var(--text-2); font-weight: 500; font-size: 13.5px; text-decoration: none !important;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--border); }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav-item.active .ico { color: var(--primary-ink); }
.nav-item .nav-meta { margin-left: auto; font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.nav-item.locked { color: var(--text-disabled); }
.nav-item.locked .nav-meta { color: var(--warning); }
.sb-foot { border-top: 1px solid var(--border); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.quota-card { padding: 10px 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.quota-card .row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-md); border: 0; background: transparent; width: 100%; text-align: left; cursor: pointer; }
.user-chip:hover { background: var(--surface-3); }
.user-chip .uc-text { min-width: 0; flex: 1; line-height: 1.2; }
.user-chip .uc-text b { display: block; font-size: 13px; font-weight: 500; }
.user-chip .uc-text span { font-size: 11.5px; color: var(--text-3); }
.sb-version { font-size: 11px; color: var(--text-3); padding: 0 6px; display: flex; justify-content: space-between; }

/* collapsed rail */
.app.collapsed .logo-text, .app.collapsed .nav-item span, .app.collapsed .nav-meta,
.app.collapsed .nav-group > .t-overline, .app.collapsed .quota-card, .app.collapsed .uc-text,
.app.collapsed .sb-version, .app.collapsed .uc-caret { display: none; }
.app.collapsed .sb-head { padding: 16px 18px; flex-direction: column; height: auto; gap: 12px; }
.app.collapsed .sb-collapse { margin-left: 0; }
.app.collapsed .nav-item { justify-content: center; padding: 0; }
.app.collapsed .nav-group { border-top: 1px solid var(--border); padding-top: 12px; }
.app.collapsed .nav-group:first-child { border-top: 0; padding-top: 0; }
.app.collapsed .user-chip { justify-content: center; }
.app.collapsed .nav-item:hover::after {
  content: attr(data-label); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--surface-inverse); color: var(--text-inverse); font-size: 12px; padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; z-index: 30; pointer-events: none; box-shadow: var(--shadow-md);
}

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  flex: none; height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 24px;
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); position: relative; z-index: 5;
}
.topbar .tb-menu { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .cur { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.crumbs .ico { width: 14px; height: 14px; color: var(--text-disabled); }
.tb-search {
  margin-left: auto; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; width: 300px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); color: var(--text-3); cursor: text; font-size: 13px;
}
.tb-search:hover { border-color: var(--border-strong); }
.tb-search .kbd { margin-left: auto; }
.tb-actions { display: flex; align-items: center; gap: 4px; }
.dot-badge { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--error); box-shadow: 0 0 0 2px var(--surface); }
.content { flex: 1; overflow-y: auto; min-height: 0; scroll-behavior: smooth; }
.page { max-width: 1360px; margin: 0 auto; padding: 28px 32px 56px; display: flex; flex-direction: column; gap: 24px; }
.page.narrow { max-width: 880px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .ph-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.page-head .ph-text p { color: var(--text-2); max-width: 68ch; }
.page-head .ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bottom-nav { display: none; }
.license-banner {
  display: flex; align-items: center; gap: 12px; padding: 10px 24px; font-size: 13px;
  background: var(--warning-soft); color: var(--warning-ink); border-bottom: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
}
.license-banner b { font-weight: 600; }
.license-banner .btn { margin-left: auto; }

/* ==========================================================================
   Components
   ========================================================================== */
/* Buttons */
.btn {
  --btn-h: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--btn-h); padding: 0 14px;
  border-radius: var(--r-md); border: 1px solid transparent; font-size: 14px; font-weight: 500; line-height: 1;
  cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
  position: relative; user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn .ico { width: 16px; height: 16px; }
.btn-sm { --btn-h: 30px; padding: 0 10px; font-size: 13px; gap: 6px; border-radius: 7px; }
.btn-lg { --btn-h: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-outline { background: transparent; color: var(--primary-ink); border-color: color-mix(in srgb, var(--primary-ink) 45%, transparent); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--error) 88%, #000); }
.btn-danger-ghost { background: transparent; color: var(--error-ink); }
.btn-danger-ghost:hover { background: var(--error-soft); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--on-primary) var(--on-primary) transparent transparent;
  animation: spin .7s linear infinite;
}
.btn-secondary.loading::after, .btn-ghost.loading::after { border-color: var(--text-2) var(--text-2) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.split { display: inline-flex; }
.split .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid rgba(255,255,255,.2); padding: 0 8px; }

/* Kbd */
.kbd { font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface); color: var(--text-3); box-shadow: 0 1px 0 var(--border); }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .field-label { font-size: 13px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 6px; }
.field .req { color: var(--error-ink); font-weight: 600; }
.field .hint { font-size: 12px; color: var(--text-3); line-height: 16px; }
.field .err { font-size: 12px; color: var(--error-ink); display: flex; align-items: center; gap: 6px; line-height: 16px; }
.field .err .ico { width: 14px; height: 14px; }
.input, .select, .textarea {
  height: 38px; width: 100%; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 20px; }
.input::placeholder, .textarea::placeholder { color: var(--text-disabled); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--n-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input.invalid { border-color: var(--error); }
.input.invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 25%, transparent); }
.input:disabled { background: var(--surface-3); color: var(--text-disabled); cursor: not-allowed; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2399A2B2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .ico { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; width: 16px; height: 16px; }
.input-wrap > .input { padding-left: 34px; }
.input-wrap .suffix { position: absolute; right: 10px; font-size: 12px; color: var(--text-3); }
.input-wrap .suffix-btn { position: absolute; right: 4px; }
.input-sm { height: 32px; font-size: 13px; }
.input-group { display: flex; }
.input-group .input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--surface-2); color: var(--text-3); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Checkbox / radio / switch */
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; cursor: pointer; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-3); gap: 2px; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg a { height: 28px; padding: 0 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.seg a:hover { color: var(--text); }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.radio-card { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-lg); cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.radio-card:hover { border-color: var(--border-strong); }
.radio-card input { accent-color: var(--primary); margin: 3px 0 0; }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.radio-card b { display: block; font-weight: 500; font-size: 14px; }
.radio-card span { font-size: 12px; color: var(--text-3); }
.range { width: 100%; accent-color: var(--primary); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head .ch-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-head .ch-title h3 { font-size: 15px; font-weight: 600; line-height: 22px; display: flex; align-items: center; gap: 8px; }
.card-head .ch-title p { font-size: 13px; color: var(--text-3); }
.card-body { padding: 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card.interactive { transition: border-color .15s, box-shadow .15s, transform .15s; cursor: pointer; }
.card.interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title h2 { font-size: 16px; font-weight: 600; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

/* KPI */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.kpi .kpi-label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.kpi .kpi-label .ico { width: 16px; height: 16px; color: var(--text-3); }
.kpi .kpi-value { font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .kpi-value small { font-size: 14px; color: var(--text-3); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.kpi .kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); }
.kpi .spark { width: 96px; height: 28px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 500; font-size: 12px; }
.delta.up { color: var(--success-ink); }
.delta.down { color: var(--error-ink); }
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.meter.warn > span { background: var(--warning); }
.meter.crit > span { background: var(--error); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-full); font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge .ico { width: 12px; height: 12px; }
.badge.primary { background: var(--primary-soft); color: var(--primary-ink); }
.badge.success { background: var(--success-soft); color: var(--success-ink); }
.badge.warning { background: var(--warning-soft); color: var(--warning-ink); }
.badge.error { background: var(--error-soft); color: var(--error-ink); }
.badge.info { background: var(--info-soft); color: var(--info-ink); }
.badge.teal { background: var(--secondary-soft); color: var(--secondary-ink); }
.badge.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-2); }
.badge.mono { font-family: var(--font-mono); font-size: 11.5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; color: var(--text-2); }
.chip button { border: 0; background: transparent; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--text-3); padding: 0; }
.chip button:hover { background: var(--surface-3); color: var(--text); }
.chip .ico { width: 12px; height: 12px; }

/* Avatar */
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; background: var(--n-600); letter-spacing: .02em; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.c1 { background: #2450D6; } .avatar.c2 { background: #0E7C72; } .avatar.c3 { background: #9A4B16; }
.avatar.c4 { background: #6D3FC0; } .avatar.c5 { background: #B42F5A; } .avatar.c6 { background: #3F4B5E; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 0; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important; border-radius: 6px 6px 0 0; }
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab.on { color: var(--text); }
.tab.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
.tab .count { font-size: 11.5px; font-family: var(--font-mono); padding: 1px 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-3); }
.tab.on .count { background: var(--primary-soft); color: var(--primary-ink); }

/* Alerts */
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-lg); border: 1px solid; font-size: 13.5px; line-height: 20px; align-items: flex-start; }
.alert .ico { margin-top: 1px; }
.alert b { font-weight: 600; display: block; margin-bottom: 2px; }
.alert .alert-actions { margin-left: auto; display: flex; gap: 6px; flex: none; }
.alert.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); color: var(--info-ink); }
.alert.success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); color: var(--success-ink); }
.alert.warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: var(--warning-ink); }
.alert.error { background: var(--error-soft); border-color: color-mix(in srgb, var(--error) 25%, transparent); color: var(--error-ink); }
.alert.neutral { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th .sort-ico { display: inline-flex; vertical-align: middle; margin-left: 2px; opacity: .5; }
.table th.sorted .sort-ico { opacity: 1; color: var(--primary-ink); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { padding: 12px 16px; font-weight: 600; color: var(--text); background: var(--surface-2); border-top: 2px solid var(--border-strong); position: sticky; bottom: 0; white-space: nowrap; }
.table tr.selected { background: var(--primary-soft) !important; }
.table .r { text-align: right; }
.table .c { text-align: center; }
.table .cell-title { font-weight: 500; color: var(--text); }
.table .cell-sub { font-size: 12px; color: var(--text-3); }
.table .row-actions { display: flex; justify-content: flex-end; gap: 2px; opacity: .55; transition: opacity .15s; }
.table tr:hover .row-actions, .table .row-actions:focus-within { opacity: 1; }
.table.compact td { padding: 8px 14px; }
.table.compact th { padding: 8px 14px; }
.table td.w-check, .table th.w-check { width: 40px; padding-right: 0; }
.table a.cell-title { color: var(--text); }
.table a.cell-title:hover { color: var(--primary-ink); }
.table-toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.table-toolbar .input-wrap { width: 280px; max-width: 100%; }
.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--primary-soft); border-bottom: 1px solid var(--border); font-size: 13px; color: var(--primary-ink); font-weight: 500; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 4px; }
.pager button { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; font-size: 13px; font-variant-numeric: tabular-nums; display: grid; place-items: center; }
.pager button:hover:not(:disabled) { background: var(--surface-3); }
.pager button.on { border-color: var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); font-weight: 500; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.mobile-list { display: none; }
.m-item { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); text-decoration: none !important; color: var(--text); }
.m-item:last-child { border-bottom: 0; }
.m-item .m-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.m-item .m-meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.m-item .m-meta b { color: var(--text); font-weight: 500; }

/* Dropdown menu */
.menu-anchor { position: relative; display: inline-flex; }
.menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 220px; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px;
  animation: pop .14s ease-out; transform-origin: top right;
}
.menu.left { right: auto; left: 0; transform-origin: top left; }
.menu .mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 7px; font-size: 13.5px; color: var(--text); cursor: pointer; text-align: left; text-decoration: none !important; }
.menu .mi:hover, .menu .mi:focus-visible { background: var(--surface-3); box-shadow: none; }
.menu .mi .ico { width: 16px; height: 16px; color: var(--text-3); }
.menu .mi.danger { color: var(--error-ink); }
.menu .mi.danger .ico { color: var(--error-ink); }
.menu .mi .kbd { margin-left: auto; }
.menu .m-sep { height: 1px; background: var(--border); margin: 6px -6px; }
.menu .m-head { padding: 8px 10px 6px; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }

/* Tooltip (hover data) */
.tip {
  position: absolute; z-index: 90; pointer-events: none; padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 17px;
  background: var(--surface-inverse); color: var(--text-inverse); box-shadow: var(--shadow-md); max-width: 260px; white-space: pre-line;
}
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--surface-inverse); color: var(--text-inverse); font-size: 12px; font-weight: 400; line-height: 16px; padding: 5px 8px; border-radius: 6px;
  white-space: nowrap; z-index: 60; pointer-events: none; box-shadow: var(--shadow-md);
}

/* Overlays */
.overlay-root { position: absolute; inset: 0; pointer-events: none; z-index: 50; }
.overlay-root > * { pointer-events: auto; }
.scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 32px)); max-height: calc(100% - 48px);
  display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: modal-in .2s cubic-bezier(.2,.8,.2,1);
}
.modal.lg { width: min(760px, calc(100% - 32px)); }
.modal.xl { width: min(1040px, calc(100% - 32px)); height: calc(100% - 48px); }
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) scale(.98); } }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 20px 0; }
.modal-head .mh-text { flex: 1; min-width: 0; }
.modal-head h2 { font-size: 17px; font-weight: 600; line-height: 24px; }
.modal-head p { font-size: 13.5px; color: var(--text-2); margin-top: 4px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.icon-bubble { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.icon-bubble.error { background: var(--error-soft); color: var(--error-ink); }
.icon-bubble.warning { background: var(--warning-soft); color: var(--warning-ink); }
.icon-bubble.primary { background: var(--primary-soft); color: var(--primary-ink); }
.icon-bubble.success { background: var(--success-soft); color: var(--success-ink); }
.icon-bubble.neutral { background: var(--surface-3); color: var(--text-2); }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: drawer-in .24s cubic-bezier(.2,.8,.2,1);
}
.drawer.wide { width: min(640px, 100%); }
.drawer.left { right: auto; left: 0; border-left: 0; border-right: 1px solid var(--border); animation-name: drawer-in-left; width: min(300px, 88%); }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes drawer-in-left { from { transform: translateX(-24px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head .dh-text { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 16px; font-weight: 600; }
.drawer-head p { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.drawer-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.toasts { position: absolute; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 95; width: min(380px, calc(100% - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .25s cubic-bezier(.2,.8,.2,1);
}
.toast .t-text { flex: 1; min-width: 0; }
.toast .t-text b { display: block; font-weight: 600; }
.toast .t-text span { color: var(--text-2); font-size: 13px; }
.toast .t-ico { width: 20px; height: 20px; }
.toast.success .t-ico { color: var(--success); }
.toast.error .t-ico { color: var(--error); }
.toast.warning .t-ico { color: var(--warning); }
.toast.info .t-ico { color: var(--info); }
.toast.leaving { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* Empty / loading / error */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 24px; }
.empty .empty-art { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); margin-bottom: 6px; position: relative; }
.empty .empty-art::after { content: ""; position: absolute; inset: -8px; border-radius: 26px; border: 1px dashed var(--border); }
.empty .empty-art .ico { width: 30px; height: 30px; stroke-width: 1.5; }
.empty h3 { font-size: 16px; font-weight: 600; }
.empty p { color: var(--text-2); max-width: 44ch; font-size: 13.5px; }
.empty .btn-group { margin-top: 8px; justify-content: center; }
.empty.error .empty-art { color: var(--error-ink); background: var(--error-soft); border-color: transparent; }
.empty.warning .empty-art { color: var(--warning-ink); background: var(--warning-soft); border-color: transparent; }
.skel { background: var(--surface-3); border-radius: 6px; position: relative; overflow: hidden; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel.line { height: 12px; }
.skel.circle { border-radius: 50%; }

/* Progress / stepper */
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .4s ease; }
.progress.indet > span { width: 35%; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: 14px; position: relative; padding-bottom: 20px; }
.step:last-child { padding-bottom: 0; }
.step:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--border); border-radius: 2px; }
.step.done:not(:last-child)::before { background: var(--success); }
.step .s-dot { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-3); border: 1px solid var(--border); }
.step.done .s-dot { background: var(--success); color: #fff; border-color: transparent; }
.step.active .s-dot { background: var(--primary); color: #fff; border-color: transparent; box-shadow: 0 0 0 4px var(--primary-soft); }
.step.error .s-dot { background: var(--error); color: #fff; border-color: transparent; }
.step .s-text b { display: block; font-weight: 500; font-size: 14px; }
.step .s-text span { font-size: 12.5px; color: var(--text-3); }
.step .s-dot .ico { width: 14px; height: 14px; stroke-width: 2.5; }
.hsteps { display: flex; align-items: center; gap: 0; }
.hstep { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none !important; color: inherit; }
.hstep .s-dot { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-3); }
.hstep.done .s-dot { background: var(--success-soft); color: var(--success-ink); }
.hstep.active .s-dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
.hstep .s-text { min-width: 0; }
.hstep .s-text b { display: block; font-weight: 500; font-size: 13.5px; white-space: nowrap; }
.hstep .s-text span { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hstep-line { flex: 0 0 40px; height: 2px; background: var(--border); margin: 0 12px; border-radius: 2px; }
.hstep-line.done { background: var(--success); }

/* Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 32px 20px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .dz-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--primary-ink); box-shadow: var(--shadow-xs); margin-bottom: 4px; }
.dropzone b { font-weight: 500; }
.dropzone b u { color: var(--primary-ink); text-decoration: none; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.file-row .f-ico { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--error-soft); color: var(--error-ink); font-size: 10px; font-weight: 700; font-family: var(--font-mono); flex: none; }
.file-row .f-ico.xls { background: var(--success-soft); color: var(--success-ink); }
.file-row .f-text { flex: 1; min-width: 0; }
.file-row .f-text b { display: block; font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .f-text span { font-size: 12px; color: var(--text-3); }

/* Description list */
.dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 16px; font-size: 13.5px; }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; color: var(--text); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* Timeline / activity */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 38px; bottom: -4px; width: 1px; background: var(--border); }
.tl-item .tl-ico { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.tl-item .tl-ico .ico { width: 14px; height: 14px; }
.tl-item .tl-text { font-size: 13px; line-height: 19px; min-width: 0; }
.tl-item .tl-text b { font-weight: 500; }
.tl-item .tl-time { font-size: 12px; color: var(--text-3); }

/* ==========================================================================
   Screens
   ========================================================================== */
/* Auth */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); height: 100%; overflow: auto; background: var(--surface); }
.auth-art {
  position: relative; overflow: hidden; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background: #0B1224; color: #E6EBF5;
}
.auth-art .aa-grid { position: absolute; inset: 0; opacity: .55; }
.auth-art .aa-top, .auth-art .aa-bottom { position: relative; }
.auth-art .brand { display: flex; align-items: center; gap: 12px; }
.auth-art .brand .logo-mark { background: #fff; color: #0B1224; }
.auth-art h2 { font-size: 30px; line-height: 38px; font-weight: 600; letter-spacing: -0.02em; max-width: 20ch; color: #fff; }
.auth-art p { color: #9AA7BD; max-width: 46ch; margin-top: 12px; }
.auth-art .aa-stats { display: flex; gap: 32px; margin-top: 28px; flex-wrap: wrap; }
.auth-art .aa-stats b { display: block; font-size: 20px; color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
.auth-art .aa-stats span { font-size: 12px; color: #8391A8; }
.auth-art .aa-foot { font-size: 12px; color: #6C7A93; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(24px, 6cqi, 88px); }
.auth-card { width: 100%; max-width: 400px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.auth-card .ac-head { display: flex; flex-direction: column; gap: 8px; }
.auth-card .ac-head p { color: var(--text-2); }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-card .ac-foot { text-align: center; font-size: 13.5px; color: var(--text-2); }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; }
.otp { display: flex; gap: 8px; }
.otp input { width: 100%; height: 52px; text-align: center; font-size: 22px; font-family: var(--font-mono); border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); }
.otp input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.pw-meter { display: flex; gap: 4px; }
.pw-meter span { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-3); }
.pw-meter.s1 span:nth-child(-n+1) { background: var(--error); }
.pw-meter.s2 span:nth-child(-n+2) { background: var(--warning); }
.pw-meter.s3 span:nth-child(-n+3) { background: var(--success); }
.pw-meter.s4 span { background: var(--success); }
.halt { min-height: 100%; display: grid; place-items: center; padding: 32px 16px; background: var(--bg); }
.halt .card { max-width: 520px; width: 100%; }

/* Case pipeline strip */
.pipeline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pipe-step { display: flex; gap: 14px; padding: 16px 20px; position: relative; text-decoration: none !important; color: inherit; border-right: 1px solid var(--border); transition: background .15s; }
.pipe-step:last-child { border-right: 0; }
.pipe-step:hover { background: var(--surface-2); }
.pipe-step .ps-num { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--success-soft); color: var(--success-ink); }
.pipe-step.next .ps-num { background: var(--primary); color: #fff; }
.pipe-step.todo .ps-num { background: var(--surface-3); color: var(--text-3); }
.pipe-step b, .pipe-step span { display: block; }
.pipe-step b { font-weight: 600; font-size: 14px; }
.pipe-step span { font-size: 12.5px; color: var(--text-3); }
.pipe-step .ps-cta { margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--primary-ink); display: inline-flex; align-items: center; gap: 4px; }

/* Analysis workspace */
.ws { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }
.ws-rail { border-right: 1px solid var(--border); background: var(--surface); padding: 16px 12px; display: flex; flex-direction: column; gap: 18px; align-self: stretch; }
.ws-rail .tool { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-size: 13.5px; font-weight: 500; text-decoration: none !important; }
.ws-rail .tool:hover { background: var(--surface-3); color: var(--text); }
.ws-rail .tool.on { background: var(--primary-soft); color: var(--primary-ink); }
.ws-rail .tool .ico { width: 16px; height: 16px; }
.ws-rail .tool .tcount { margin-left: auto; font-size: 11px; font-family: var(--font-mono); color: var(--text-3); }
.ws-rail .tool.on .tcount { color: var(--primary-ink); }
.ws-main { min-width: 0; padding: 24px 28px 56px; display: flex; flex-direction: column; gap: 20px; }
.ws-tools-select { display: none; }
.ctx-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); font-size: 13px; }
.ctx-bar .ctx-sep { width: 1px; height: 16px; background: var(--border); }
.ctx-bar .ctx-item { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.ctx-bar .ctx-item b { color: var(--text); font-weight: 500; }
.params { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 16px; align-items: end; }
.params-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 16px; margin-top: 16px; border-top: 1px dashed var(--border); }
.graph-card { position: relative; overflow: hidden; }
.graph-canvas { position: relative; height: 520px; background: radial-gradient(circle at 1px 1px, var(--grid) 1px, transparent 0) 0 0 / 20px 20px, var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); overflow: hidden; }
.graph-canvas svg { width: 100%; height: 100%; display: block; cursor: grab; }
.graph-tools { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; box-shadow: var(--shadow-sm); }
.graph-legend { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 12px; flex-wrap: wrap; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 12px; color: var(--text-2); max-width: calc(100% - 24px); }
.graph-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.graph-legend .sw { width: 10px; height: 10px; border-radius: 50%; }
.graph-legend .ln { width: 18px; height: 0; border-top: 2px dashed var(--series-8); }
.node-panel { position: absolute; right: 12px; top: 12px; width: 280px; max-width: calc(100% - 80px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md); animation: pop .15s ease-out; }
.node-panel .np-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.node-panel .np-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.g-node { cursor: pointer; }
.g-node circle.halo { fill: transparent; transition: fill .15s; }
.g-node:hover circle.halo, .g-node.sel circle.halo { fill: var(--primary-soft-2); }
.g-node text { font-family: var(--font-sans); font-size: 12px; fill: var(--text); font-weight: 500; paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; stroke-linejoin: round; }
.g-node text.sub { font-size: 10.5px; fill: var(--text-3); font-weight: 400; font-family: var(--font-mono); }
.g-edge path { fill: none; stroke: var(--edge); stroke-width: 1.5; transition: stroke .15s, stroke-width .15s; }
.g-edge.bi path { stroke: var(--series-8); stroke-dasharray: 6 4; }
.g-edge:hover path, .g-edge.hl path { stroke: var(--primary-ink); stroke-width: 2.5; }
.g-edge text { font-family: var(--font-mono); font-size: 10.5px; fill: var(--text-2); paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; }
.graph-canvas.dim .g-edge:not(.hl) { opacity: .25; }
.graph-canvas.dim .g-node:not(.hl):not(.sel) { opacity: .35; }

/* Heatmap */
.hm { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 12px; }
.hm th { font-weight: 500; color: var(--text-3); padding: 4px 6px; text-align: center; white-space: nowrap; }
.hm th.rowh { text-align: left; color: var(--text); font-weight: 500; padding-right: 10px; }
.hm td { height: 40px; min-width: 56px; border-radius: 6px; text-align: center; font-family: var(--font-mono); font-size: 11.5px; font-variant-numeric: tabular-nums; cursor: default; transition: transform .1s, box-shadow .1s; }
.hm td:hover { box-shadow: 0 0 0 2px var(--text); position: relative; z-index: 1; }
.hm .s0 { background: var(--seq-0); color: var(--text-3); }
.hm .s1 { background: var(--seq-1); } .hm .s2 { background: var(--seq-2); } .hm .s3 { background: var(--seq-3); }
.hm .s4 { background: var(--seq-4); } .hm .s5 { background: var(--seq-5); } .hm .s6 { background: var(--seq-6); } .hm .s7 { background: var(--seq-7); }
.hm .s1, .hm .s2, .hm .s3 { color: var(--seq-ink-light); }
.hm .s4, .hm .s5, .hm .s6, .hm .s7 { color: var(--seq-ink-dark); }
.hm-scale { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.hm-scale .bar { display: flex; gap: 2px; }
.hm-scale .bar span { width: 20px; height: 10px; border-radius: 3px; }

/* Charts */
.chart svg { width: 100%; display: block; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { font-size: 11px; fill: var(--text-3); font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart .bar-hit { fill: transparent; cursor: pointer; }
.chart .bar-hit:hover { fill: var(--surface-3); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* Red flag cards */
.flag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.flag { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); text-decoration: none !important; color: inherit; transition: border-color .15s, box-shadow .15s; cursor: pointer; }
.flag:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.flag.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.flag .f-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.flag .f-count { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.flag .f-title { font-size: 13px; color: var(--text-2); line-height: 18px; }

/* Processor grouping */
.group-card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.group-card .gc-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.group-card .gc-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.group-card .gc-vars { padding: 8px 8px; display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.group-card .gc-var { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px; font-size: 13.5px; }
.group-card .gc-var:hover { background: var(--surface-2); }
.group-card .gc-var .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 12.5px; }
.group-card .gc-rename { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); border-radius: 0 0 var(--r-lg) 0; }

/* Design review */
.review-hero { padding: 40px 32px 8px; max-width: 1360px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.review-hero p { color: var(--text-2); max-width: 72ch; font-size: 15px; line-height: 24px; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.thumb-card { cursor: pointer; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; text-decoration: none !important; color: inherit; transition: border-color .15s, box-shadow .2s, transform .2s; }
.thumb-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg); border-bottom: 1px solid var(--border); container-type: size; }
.thumb-inner { position: absolute; left: 0; top: 0; width: 1280px; height: 800px; transform-origin: 0 0; transform: scale(var(--k, .25)); pointer-events: none; }
.thumb-inner .frame { container-type: inline-size; }
.thumb-meta { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.thumb-meta b { font-weight: 500; font-size: 14px; }
.thumb-meta span { font-size: 12px; color: var(--text-3); }

/* Docs */
.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; max-width: 1240px; margin: 0 auto; padding: 32px 32px 80px; }
.doc-toc { position: sticky; top: 24px; align-self: start; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.doc-toc a { color: var(--text-2); padding: 5px 10px; border-radius: 6px; }
.doc-toc a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.doc-body { display: flex; flex-direction: column; gap: 48px; min-width: 0; }
.doc-sec { display: flex; flex-direction: column; gap: 16px; scroll-margin-top: 24px; }
.doc-sec > p, .doc-sec li { color: var(--text-2); max-width: 75ch; line-height: 24px; }
.doc-sec ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.doc-sec .sec-num { font-family: var(--font-mono); font-size: 12px; color: var(--primary-ink); }
.cmp { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.cmp > div { padding: 14px 16px; font-size: 13.5px; line-height: 20px; border-top: 1px solid var(--border); }
.cmp > .cmp-h { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); border-top: 0; }
.cmp > div:nth-child(odd) { border-right: 1px solid var(--border); }
.cmp .cmp-cur { color: var(--text-2); }
.cmp .cmp-why { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-3); background: var(--surface-2); border-right: 0 !important; padding-top: 8px; padding-bottom: 8px; }
.cmp .cmp-area { grid-column: 1 / -1; font-weight: 600; font-size: 14px; background: var(--surface); border-right: 0 !important; padding-bottom: 0; }
.flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.flow .fs { padding: 5px 10px; border-radius: 7px; background: var(--surface); border: 1px solid var(--border); color: var(--text); white-space: nowrap; }
.flow .fs.key { background: var(--primary-soft); border-color: transparent; color: var(--primary-ink); font-weight: 500; }
.flow .ico { width: 14px; height: 14px; color: var(--text-3); }
.checklist { display: flex; flex-direction: column; gap: 2px; }
.checklist label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.checklist label:hover { background: var(--surface-2); }
.checklist input { width: 16px; height: 16px; accent-color: var(--success); }
.checklist input:checked + span { color: var(--text-3); text-decoration: line-through; }

/* Design system */
.ds-section { display: flex; flex-direction: column; gap: 16px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.swatch { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.swatch .sw-color { height: 64px; border-bottom: 1px solid var(--border); }
.swatch .sw-meta { padding: 10px 12px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.swatch .sw-meta b { font-size: 13px; font-weight: 500; }
.swatch .sw-meta code { font-family: var(--font-mono); color: var(--text-3); font-size: 11.5px; }
.scale-row { display: grid; grid-template-columns: repeat(12, 1fr); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); }
.scale-row div { height: 48px; display: flex; align-items: flex-end; padding: 6px; font-size: 10px; font-family: var(--font-mono); }
.type-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--border); }
.type-row code { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }
.ds-demo { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.space-row { display: flex; align-items: center; gap: 12px; font-size: 12px; font-family: var(--font-mono); color: var(--text-3); }
.space-row span.bar { height: 12px; background: var(--primary); border-radius: 3px; opacity: .8; }

/* Search palette */
.cmdk { position: absolute; left: 50%; top: 12%; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: pop .15s ease-out; overflow: hidden; }
.cmdk .cmdk-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 52px; border-bottom: 1px solid var(--border); }
.cmdk .cmdk-in input { flex: 1; border: 0; background: transparent; font-size: 15px; outline: none; height: 100%; }
.cmdk .cmdk-list { max-height: 360px; overflow-y: auto; padding: 8px; }
.cmdk .cmdk-group { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px 4px; }
.cmdk .cmdk-foot { display: flex; gap: 14px; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); background: var(--surface-2); }

/* Notifications panel */
.notif { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.notif.unread { background: var(--primary-soft); }
.notif .n-text { flex: 1; font-size: 13.5px; line-height: 20px; }
.notif .n-text span { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ==========================================================================
   Responsive — driven by the frame container width
   ========================================================================== */
@container frame (max-width: 1279px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main-side { grid-template-columns: minmax(0, 1fr) 300px; }
  .tb-search { width: 220px; }
  .ws { grid-template-columns: 200px minmax(0, 1fr); }
}
@container frame (max-width: 1100px) {
  .app { grid-template-columns: 68px minmax(0, 1fr); }
  .app .logo-text, .app .nav-item span, .app .nav-meta, .app .nav-group > .t-overline, .app .quota-card, .app .uc-text, .app .sb-version, .app .uc-caret, .app .sb-collapse { display: none; }
  .app .sb-head { padding: 16px 18px; }
  .app .nav-item { justify-content: center; padding: 0; }
  .app .nav-group { border-top: 1px solid var(--border); padding-top: 12px; }
  .app .nav-group:first-child { border-top: 0; padding-top: 0; }
  .app .user-chip { justify-content: center; }
  .app .nav-item:hover::after { content: attr(data-label); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: var(--surface-inverse); color: var(--text-inverse); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 30; pointer-events: none; }
  .g-main-side { grid-template-columns: minmax(0, 1fr); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-card .gc-body { grid-template-columns: minmax(0, 1fr) 260px; }
}
@container frame (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .app > .sidebar { display: none; }
  .topbar { padding: 0 16px; }
  .topbar .tb-menu { display: inline-flex; }
  .tb-search { width: auto; padding: 0; border: 0; background: transparent; margin-left: auto; }
  .tb-search .tbs-text, .tb-search .kbd { display: none; }
  .tb-search { width: 36px; height: 36px; justify-content: center; border-radius: 8px; }
  .tb-search:hover { background: var(--surface-3); }
  .page { padding: 20px 20px 40px; }
  .ws { grid-template-columns: minmax(0, 1fr); }
  .ws-rail { display: none; }
  .ws-tools-select { display: block; }
  .ws-main { padding: 20px 20px 40px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth-mobile-brand { display: flex; }
  .doc { grid-template-columns: minmax(0, 1fr); padding: 24px 20px 64px; }
  .doc-toc { display: none; }
  .pipeline { grid-template-columns: minmax(0, 1fr); }
  .pipe-step { border-right: 0; border-bottom: 1px solid var(--border); }
  .pipe-step:last-child { border-bottom: 0; }
  .graph-canvas { height: 440px; }
  .group-card .gc-body { grid-template-columns: minmax(0, 1fr); }
  .group-card .gc-vars { border-right: 0; border-bottom: 1px solid var(--border); }
  .group-card .gc-rename { border-radius: 0 0 var(--r-lg) var(--r-lg); }
}
@container frame (max-width: 640px) {
  .main { padding-bottom: 0; }
  .content { padding-bottom: 64px; }
  .bottom-nav {
    display: flex; position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--surface); border-top: 1px solid var(--border);
  }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 500; color: var(--text-3); text-decoration: none !important; border: 0; background: transparent; cursor: pointer; }
  .bottom-nav .on { color: var(--primary-ink); }
  .bottom-nav .ico { width: 20px; height: 20px; }
  .page { padding: 16px 16px 32px; gap: 18px; }
  .ws-main { padding: 16px 16px 32px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .ph-actions .btn { flex: 1; }
  .t-h1 { font-size: 22px; line-height: 30px; }
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .g-4.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .table-wrap.responsive { display: none; }
  .mobile-list { display: block; }
  .table-toolbar .input-wrap { width: 100%; }
  .crumbs .crumb-mid { display: none; }
  .kpi .kpi-value { font-size: 22px; }
  .hsteps { flex-direction: column; align-items: stretch; gap: 10px; }
  .hstep-line { display: none; }
  .graph-canvas { height: 380px; }
  .node-panel { left: 12px; right: 12px; width: auto; max-width: none; top: auto; bottom: 12px; }
  .graph-legend { display: none; }
  .modal { top: auto; bottom: 0; left: 0; right: 0; transform: none; width: 100%; max-height: 92%; border-radius: 20px 20px 0 0; animation: sheet-in .25s cubic-bezier(.2,.8,.2,1); }
  .modal-foot { border-radius: 0; flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .drawer { width: 100%; }
  .toasts { left: 16px; right: 16px; bottom: 76px; width: auto; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }
  .cmp { grid-template-columns: minmax(0, 1fr); }
  .cmp > div:nth-child(odd) { border-right: 0; }
  .review-hero { padding: 24px 16px 4px; }
  .type-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .scale-row { grid-template-columns: repeat(6, 1fr); }
  .tabs { margin: 0 -16px; padding: 0 12px; }
  .hide-sm { display: none !important; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
