/* FormHelper admin: dark-tech SaaS look (Fira Sans / Fira Code, green accent).
   Light + dark via tokens. Motion is transform/opacity only and respects reduced-motion. */

:root {
  --font: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 14px; --r-sm: 9px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --side-w: 248px;

  /* light */
  --bg: #f1f5f9; --bg-2: #e8eef5; --card: #ffffff; --muted: #f1f5f9; --line: #e2e8f0;
  --fg: #0f172a; --fg-2: #475569; --fg-3: #64748b;
  --accent: #15803d; --on-accent: #ffffff; --accent-ink: #15803d; --accent-soft: rgba(21, 128, 61, .10);
  --ok: #15803d; --warn: #b45309; --bad: #dc2626; --info: #0369a1;
  --ok-soft: rgba(21, 128, 61, .12); --warn-soft: rgba(180, 83, 9, .12); --bad-soft: rgba(220, 38, 38, .10); --mute-soft: rgba(100, 116, 139, .14);
  --side-bg: #0f172a; --side-fg: #cbd5e1; --side-on: #ffffff; --side-hover: rgba(255, 255, 255, .07);
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
  --glow: rgba(21, 128, 61, .0);
  color-scheme: light;
}
/* dark tokens (applied for explicit dark, and for auto + dark system) */
:root[data-theme="dark"] {
  --bg: #0b1120; --bg-2: #0f172a; --card: #151e32; --muted: #1b2740; --line: #263552;
  --fg: #f8fafc; --fg-2: #cbd5e1; --fg-3: #94a3b8;
  --accent: #22c55e; --on-accent: #0b1120; --accent-ink: #4ade80; --accent-soft: rgba(34, 197, 94, .14);
  --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --info: #38bdf8;
  --ok-soft: rgba(74, 222, 128, .14); --warn-soft: rgba(251, 191, 36, .14); --bad-soft: rgba(248, 113, 113, .14); --mute-soft: rgba(148, 163, 184, .16);
  --side-bg: #0a0f1d; --side-fg: #94a3b8; --side-on: #f8fafc; --side-hover: rgba(255, 255, 255, .06);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .28);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  --glow: rgba(34, 197, 94, .10);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0b1120; --bg-2: #0f172a; --card: #151e32; --muted: #1b2740; --line: #263552;
    --fg: #f8fafc; --fg-2: #cbd5e1; --fg-3: #94a3b8;
    --accent: #22c55e; --on-accent: #0b1120; --accent-ink: #4ade80; --accent-soft: rgba(34, 197, 94, .14);
    --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --info: #38bdf8;
    --ok-soft: rgba(74, 222, 128, .14); --warn-soft: rgba(251, 191, 36, .14); --bad-soft: rgba(248, 113, 113, .14); --mute-soft: rgba(148, 163, 184, .16);
    --side-bg: #0a0f1d; --side-fg: #94a3b8; --side-on: #f8fafc; --side-hover: rgba(255, 255, 255, .06);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .28);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
    --glow: rgba(34, 197, 94, .10);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 400 15px/1.55 var(--font); color: var(--fg); background: var(--bg);
  background-image: radial-gradient(900px 420px at 85% -10%, var(--glow), transparent 60%);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--muted); padding: 2px 6px; border-radius: 6px; }
small { font-size: 12.5px; }
.mute { color: var(--fg-3); }
.grow { flex: 1; min-width: 0; }
.r { text-align: right; }
.clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--accent-ink); font-weight: 500; }
.link:hover { text-decoration: underline; }
.ic { flex: none; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px;
  background: var(--side-bg); color: var(--side-fg); border-right: 1px solid rgba(255, 255, 255, .05);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--on-accent);
  background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 6px 18px rgba(34, 197, 94, .35); }
.brand-text { color: var(--side-on); font-weight: 700; font-size: 16px; line-height: 1.15; display: flex; flex-direction: column; }
.brand-text small { color: var(--side-fg); font-weight: 400; font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--side-fg); font-weight: 500;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
  animation: slide-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
}
.nav-item:hover { background: var(--side-hover); color: var(--side-on); transform: translateX(2px); }
.nav-item.on { background: rgba(34, 197, 94, .14); color: #4ade80; box-shadow: inset 3px 0 0 #22c55e; }
.side .avatar { background: rgba(34, 197, 94, .14); color: #4ade80; border-color: rgba(34, 197, 94, .35); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; min-width: 0; }
.me-text { display: flex; flex-direction: column; color: var(--side-on); font-size: 13px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--side-fg); font-weight: 400; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: 14px;
  background: var(--accent-soft); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.col { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--fg-3); font-size: 14px; flex: 1; min-width: 0; }
.crumbs strong { color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page { padding: 28px; max-width: 1280px; width: 100%; margin: 0 auto; outline: none; }
.menu-btn { display: none; }
.scrim { display: none; }

/* ---------- primitives ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head.pad { padding: 18px 20px 4px; margin: 0; align-items: center; }
.card-head p { margin-top: 4px; font-size: 13.5px; max-width: 60ch; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 16px; min-width: 0; }
.who h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; word-break: break-all; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px;
  font: 600 14px/1 var(--font); border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), opacity .2s;
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.lg { min-height: 46px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 38%, transparent); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.ghost:hover { background: var(--muted); border-color: var(--fg-3); }
.btn.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.btn.warn:hover { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger:hover { transform: translateY(-1px); box-shadow: 0 10px 22px color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.ghost-danger { background: transparent; color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.ghost-danger:hover { background: var(--bad-soft); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.side .btn.ghost { color: var(--side-fg); border-color: rgba(255, 255, 255, .12); }
.side .btn.ghost:hover { color: var(--side-on); background: var(--side-hover); }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg-2); display: inline-grid; place-items: center; cursor: pointer; transition: all .18s var(--ease); flex: none; }
.icon-btn:hover { color: var(--fg); background: var(--muted); transform: translateY(-1px); }
.icon-btn.danger-ic { width: 34px; height: 34px; border-color: transparent; background: transparent; }
.icon-btn.danger-ic:hover { color: var(--bad); background: var(--bad-soft); }
.when-light { display: none; }
:root[data-theme="light"] .when-dark { display: none; }
:root[data-theme="light"] .when-light { display: inline-flex; }
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] .when-dark { display: none; }
  :root[data-theme="auto"] .when-light { display: inline-flex; }
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, label.lbl { font-size: 13px; font-weight: 600; color: var(--fg-2); }
input, select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; font: 400 15px/1.4 var(--font); color: var(--fg); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 10px; transition: border-color .18s, box-shadow .18s, background .18s;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--fg-3); }
input:hover, select:hover, textarea:hover { border-color: var(--fg-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type="checkbox"] { width: auto; min-height: 0; }
.pw { position: relative; }
.pw input { padding-right: 48px; }
.pw .icon-btn { position: absolute; right: 3px; top: 3px; width: 36px; height: 36px; border: 0; background: transparent; }
.pw.inline { margin-top: 8px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; line-height: 1.6; background: var(--mute-soft); color: var(--fg-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { position: relative; display: grid; grid-template-columns: 1fr auto; row-gap: 2px; padding: 18px 20px; overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--accent-soft); opacity: .7; }
.kpi.warn::after { background: var(--warn-soft); } .kpi.ok::after { background: var(--ok-soft); }
.kpi-label { grid-column: 1; color: var(--fg-3); font-size: 13px; font-weight: 500; }
.kpi-ic { grid-column: 2; grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; z-index: 1;
  background: var(--accent-soft); color: var(--accent-ink); }
.kpi.warn .kpi-ic { background: var(--warn-soft); color: var(--warn); }
.kpi-val { grid-column: 1 / -1; font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-sub { grid-column: 1 / -1; font-size: 12.5px; color: var(--fg-3); }
.minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin-bottom: 18px; }
.mini { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: var(--fg-3); transition: border-color .2s, transform .2s var(--ease); }
.mini:hover { border-color: var(--fg-3); transform: translateY(-1px); }
.mini strong { display: block; color: var(--fg); font-size: 18px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.mini span { font-size: 12.5px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .axis { fill: var(--fg-3); font: 400 11px var(--font); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.3s var(--ease) .15s forwards; }
.chart .area { opacity: 0; animation: fade .9s ease .6s forwards; }
.chart .hit { fill: transparent; }
.chart .dot { fill: var(--card); stroke: var(--accent); stroke-width: 2; opacity: 0; transition: opacity .15s, r .15s; }
.chart .pt:hover .dot, .chart .pt:focus .dot { opacity: 1; }

.funnel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.funnel-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; margin-bottom: 6px; }
.funnel-top strong { font-variant-numeric: tabular-nums; }
.bar { height: 10px; background: var(--muted); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--w); border-radius: 99px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #38bdf8));
  transform-origin: left; animation: grow 1s var(--ease) both; animation-delay: var(--d, 0ms); }
.bar.alt i { background: linear-gradient(90deg, #38bdf8, #818cf8); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li > a, .list li { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 10px; font-size: 14px; transition: background .15s; min-width: 0; }
.list li > a { width: 100%; }
.list li a:hover { background: var(--muted); }
.list .grow { display: flex; flex-direction: column; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .grow small { font-size: 12px; }
.list .grow code { align-self: flex-start; }
.ic-chip { width: 28px; height: 28px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--muted); color: var(--fg-2); flex: none; margin-right: 2px; }
.empty-inline { padding: 18px 4px; font-size: 14px; }

/* ---------- tables / toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 16px; }
.search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 240px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px 4px 4px 12px; color: var(--fg-3); transition: border-color .18s, box-shadow .18s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input { border: 0; background: transparent; min-height: 34px; padding: 0; box-shadow: none !important; }
.search select { width: auto; min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 13px; border-radius: 99px; font-size: 13px; font-weight: 500; color: var(--fg-2); border: 1px solid var(--line); transition: all .18s var(--ease); }
.chip:hover { border-color: var(--fg-3); color: var(--fg); }
.chip.on { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-3); padding: 12px 16px; background: color-mix(in srgb, var(--muted) 60%, transparent); white-space: nowrap; border-bottom: 1px solid var(--line); }
table.data th.r { text-align: right; }
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr { animation: row-in .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms); transition: background .15s; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--muted) 70%, transparent); }
table.data tbody tr:last-child td { border-bottom: 0; }
.th-link { color: inherit; } .th-link:hover { color: var(--fg); }
.row-link { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
a.row-link:hover { color: var(--accent-ink); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: 13.5px; }
.pager-links { display: flex; gap: 6px; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 56px 20px; color: var(--fg-3); }
.empty .ic { color: var(--fg-3); opacity: .8; margin-bottom: 4px; }
.empty h3 { color: var(--fg); }

/* ---------- detail pages ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; font-weight: 500; color: var(--fg-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .18s, border-color .18s; }
.tab:hover { color: var(--fg); }
.tab.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.action-row p { font-size: 13px; margin-top: 2px; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: color-mix(in srgb, var(--bad) 5%, transparent); }
.kv { margin: 0; display: grid; gap: 0; }
.kv > div { display: grid; grid-template-columns: 200px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.kv.cols > div { grid-template-columns: 1fr auto; }
.kv dt { color: var(--fg-3); font-size: 13.5px; }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; font-variant-numeric: tabular-nums; transition: opacity .25s; }
.kv dd.revealed { color: var(--accent-ink); animation: pop .35s var(--ease); }
.note { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding: 12px 14px; font-size: 13px; color: var(--fg-2); background: var(--muted); border-radius: 10px; }
.note .ic { margin-top: 2px; color: var(--accent-ink); }
.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.notes li { padding: 12px 14px; background: var(--muted); border-radius: 12px; }
.notes footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.checks li:last-child { border-bottom: 0; }
.check-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.checks .ok .check-ic { background: var(--ok-soft); color: var(--ok); }
.checks .bad .check-ic { background: var(--bad-soft); color: var(--bad); }
.checks li > .mute { font-size: 12.5px; text-align: right; }
.tools { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.tools li { display: flex; align-items: center; gap: 12px; }
.tools p { font-size: 12.5px; }
.form-card { max-width: 520px; }

/* ---------- auth ---------- */
.auth-body { min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.auth-card.center { align-items: center; text-align: center; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.auth-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand small { color: var(--fg-3); }
.hint { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--fg-3); }
.hint a { color: var(--accent-ink); font-weight: 600; }
.err-code { font: 700 72px/1 var(--mono); color: var(--accent-ink); letter-spacing: -.04em; }

/* ---------- toasts + dialog ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .45s var(--ease) both; }
.toast.ok { border-left: 4px solid var(--ok); } .toast.ok .ic:first-child { color: var(--ok); }
.toast.err { border-left: 4px solid var(--bad); } .toast.err .ic:first-child { color: var(--bad); }
.toast span { flex: 1; }
.toast.out { animation: toast-out .3s var(--ease) forwards; }
.toast-x { border: 0; background: transparent; color: var(--fg-3); cursor: pointer; padding: 4px; border-radius: 6px; display: grid; }
.toast-x:hover { color: var(--fg); background: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--fg); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog[open] { animation: dlg-in .28s var(--ease); }
dialog::backdrop { background: rgba(2, 6, 23, .6); backdrop-filter: blur(3px); animation: fade .25s ease; }
.dlg { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.dlg p { color: var(--fg-2); }
.dlg label { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--fg-2); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pop { from { transform: scale(.96); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
@keyframes dlg-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.rise { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
  .chart .line { stroke-dashoffset: 0; } .chart .area { opacity: 1; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .side { position: fixed; z-index: 60; inset: 0 auto 0 0; width: min(280px, 84vw); transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
  body.menu-open .side { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(2, 6, 23, .55); animation: fade .25s ease; }
  .menu-btn { display: inline-grid; }
  .top { padding: 10px 16px; } .page { padding: 18px 16px 40px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .kv > div { grid-template-columns: 1fr; gap: 2px; }
  h1 { font-size: 22px; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .kpi-val { font-size: 30px; }
  .action-row { flex-direction: column; align-items: stretch; }
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .head-actions { width: 100%; } .head-actions .btn { flex: 1; }
}
