/* OpenLoop dashboard — design tokens and layout */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --accent-2: #7c6cff;
  --success: #12996b;
  --success-soft: #e7f6ef;
  --warn: #b54708;
  --warn-soft: #fef0c7;
  --danger: #d92d20;
  --danger-soft: #fee4e2;
  --info-soft: #eaf2ff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, 0.18);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --sidebar: 244px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0b0e14;
  --surface: #12161f;
  --surface-2: #171c26;
  --ink: #f2f4f7;
  --ink-2: #d0d5dd;
  --muted: #98a2b3;
  --muted-2: #6b7480;
  --line: #232a36;
  --line-strong: #2f3847;
  --accent: #8b83ff;
  --accent-ink: #0b0e14;
  --accent-soft: #1c1b3a;
  --accent-2: #a79dff;
  --success: #4ad295;
  --success-soft: #10281f;
  --warn: #fdb022;
  --warn-soft: #2a1f08;
  --danger: #ff877d;
  --danger-soft: #2c1210;
  --info-soft: #121b2c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

/* The hidden attribute must beat component display rules (.field uses flex). */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 640; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
svg { display: block; }
svg.ico { width: 16px; height: 16px; flex: 0 0 auto; }

.boot {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--bg); color: var(--muted); gap: 12px; z-index: 50;
}
.boot[hidden] { display: none; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------- app shell -------------------------------- */

.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 10px; color: var(--ink); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; overflow: hidden; box-shadow: var(--shadow-sm); }
.brand .name { font-weight: 680; font-size: 15.5px; letter-spacing: -0.02em; }
.brand .tag { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--ink-2); font-weight: 520; text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a svg { width: 17px; height: 17px; opacity: 0.85; }
.nav .count {
  margin-left: auto; font-size: 11px; font-weight: 650; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px;
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

.usage-card {
  border: 1px solid var(--line); border-radius: var(--r); padding: 12px;
  background: var(--surface-2);
}
.usage-card .row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); }
.usage-card strong { color: var(--ink); font-size: 13px; }
.bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 8px 0 6px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }

.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 10px;
  cursor: pointer; border: 1px solid transparent;
}
.user-chip:hover { background: var(--surface-2); border-color: var(--line); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px;
  flex: 0 0 auto;
}
.user-chip .who { min-width: 0; }
.user-chip .who b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  padding: 26px 34px 18px;
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.topbar h1 { font-size: 23px; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.view { padding: 6px 34px 48px; max-width: 1320px; width: 100%; }

/* -------------------------------- controls -------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 560; cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.12s ease, background 0.12s ease;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); border-color: var(--line-strong); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn svg { width: 15px; height: 15px; }

.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px;
  outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
textarea.input { height: auto; padding: 10px 11px; resize: vertical; min-height: 90px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; color: var(--muted-2); }
.input-icon .input { padding-left: 34px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.seg button {
  height: 28px; padding: 0 11px; border: 0; background: transparent; border-radius: 7px;
  color: var(--muted); font-size: 12.5px; font-weight: 560; cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* --------------------------------- cards ---------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; }
.card-head h3 { font-size: 14px; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-body { padding: 6px 18px 18px; }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.cols-2 { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.kpi { padding: 16px 18px; }
.kpi .label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; font-weight: 560; }
.kpi .label svg { width: 15px; height: 15px; opacity: 0.8; }
.kpi .value { font-size: 28px; font-weight: 680; letter-spacing: -0.03em; margin-top: 8px; line-height: 1.1; }
.kpi .value small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi .delta { margin-top: 6px; font-size: 12px; color: var(--muted); }
.kpi .delta b { color: var(--success); font-weight: 600; }

.chart-wrap { padding: 4px 6px 0; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.chart { width: 100%; height: 190px; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted-2); font-size: 10px; }
.chart .area { fill: url(#areaGrad); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .line-2 { fill: none; stroke: var(--success); stroke-width: 2; stroke-dasharray: 4 3; }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }

/* --------------------------------- table ---------------------------------- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface-2);
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
table.data tbody tr { cursor: pointer; transition: background 0.1s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .subject { font-weight: 580; color: var(--ink); max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.data .to { color: var(--muted); font-size: 12.5px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.data .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.green { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.amber { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.red { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.indigo { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.opens { display: inline-flex; align-items: center; gap: 8px; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.pips i.on { background: var(--accent); }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 46px 20px; text-align: center; color: var(--muted);
}
.empty > svg.ico { width: 24px; height: 24px; opacity: 0.85; }
.empty .art svg { width: 22px; height: 22px; }
.empty .art {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.empty h4 { color: var(--ink); font-size: 14.5px; }
.empty p { font-size: 13px; max-width: 380px; }

/* -------------------------------- activity -------------------------------- */

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-icon {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.feed-icon.click { background: var(--success-soft); color: var(--success); }
.feed-icon svg { width: 15px; height: 15px; }
.feed-body { min-width: 0; flex: 1; }
.feed-body .t { font-size: 13px; font-weight: 540; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-body .m { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.feed-time { font-size: 11px; color: var(--muted-2); white-space: nowrap; }

/* --------------------------------- drawer --------------------------------- */

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, 0.42); z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 94vw);
  background: var(--surface); border-left: 1px solid var(--line); z-index: 61;
  transform: translateX(102%); transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.25, 1);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.drawer.open { transform: none; }
.drawer-head { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 17px; line-height: 1.35; }
.drawer-head .meta { color: var(--muted); font-size: 12.5px; margin-top: 5px; display: flex; gap: 8px; flex-wrap: wrap; }
.drawer-close { position: absolute; top: 16px; right: 16px; }
.drawer-body { padding: 18px 22px 40px; overflow-y: auto; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; background: var(--surface-2); }
.stat b { display: block; font-size: 19px; font-weight: 680; letter-spacing: -0.02em; }
.stat span { font-size: 11.5px; color: var(--muted); }

.timeline { position: relative; margin-left: 6px; padding-left: 18px; border-left: 1px solid var(--line); }
.tl-item { position: relative; padding: 0 0 16px 0; }
.tl-item::before {
  content: ""; position: absolute; left: -24px; top: 4px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--accent);
}
.tl-item.click::before { border-color: var(--success); }
.tl-item.bot::before { border-color: var(--muted-2); }
.tl-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.tl-head b { font-size: 13px; font-weight: 600; }
.tl-head span { font-size: 11.5px; color: var(--muted-2); }
.tl-detail { font-size: 12.5px; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.tl-detail .kv { display: inline-flex; align-items: center; gap: 5px; }
.tl-detail .kv svg { width: 13px; height: 13px; opacity: 0.65; }
.tl-detail .badge { height: 20px; font-size: 11px; }
.mono { font-family: var(--mono); font-size: 11.5px; }

.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; margin: 22px 0 10px; }

/* --------------------------------- modal ---------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, 0.45); z-index: 70;
  display: grid; place-items: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.15s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(460px, 100%); background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  transform: translateY(8px) scale(0.99); transition: transform 0.18s ease;
  max-height: 90vh; overflow-y: auto;
}
.modal-backdrop.open .modal { transform: none; }
.modal-head { padding: 20px 22px 6px; }
.modal-head h3 { font-size: 16.5px; }
.modal-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.modal-body { padding: 14px 22px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 12px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 540; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; z-index: 90;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* -------------------------------- mailboxes ------------------------------- */

.mailbox-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.mailbox-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.mailbox-card .top { display: flex; align-items: center; gap: 11px; }
.mailbox-card .top .avatar { width: 38px; height: 38px; border-radius: 11px; font-size: 14px; }
.mailbox-card .addr { font-weight: 600; font-size: 13.5px; word-break: break-all; }
.mailbox-card .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mailbox-card .actions { display: flex; gap: 7px; margin-top: auto; }

/* ---------------------------------- plan ---------------------------------- */

.plan-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.plan-card { padding: 18px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.plan-card.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan-card .price { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.plan-card .price span { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.plan-card ul { margin: 8px 0 4px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.plan-card li { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 7px; align-items: flex-start; }
.plan-card li svg { width: 14px; height: 14px; color: var(--success); flex: 0 0 auto; margin-top: 2px; }

/* ------------------------------ google sign-in ---------------------------- */

.btn.google {
  height: 42px;
  gap: 10px;
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.btn.google:hover { background: #f9fafb; }
.btn.google:active { transform: translateY(1px); }

[data-theme="dark"] .btn.google { background: #171c26; border-color: var(--line-strong); color: var(--ink); }
[data-theme="dark"] .btn.google:hover { background: #1f2531; }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted-2);
  font-size: 11.5px;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* --------------------------------- settings ------------------------------- */

.settings-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .lbl b { display: block; font-size: 13px; font-weight: 580; }
.setting-row .lbl span { font-size: 12.5px; color: var(--muted); }

.switch { position: relative; width: 40px; height: 23px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong);
  transition: background 0.15s; pointer-events: none;
}
.switch i::after {
  content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(17px); }

.key-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.key-row:last-child { border-bottom: 0; }
.key-row .k { font-family: var(--mono); font-size: 12px; }

/* --------------------------------- login ---------------------------------- */

.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-aside {
  position: relative; overflow: hidden; padding: 48px;
  background: #101828; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside::before {
  content: ""; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  right: -220px; top: -260px;
  background: radial-gradient(circle at 30% 30%, rgba(124, 108, 255, 0.65), rgba(79, 70, 229, 0) 62%);
}
.auth-aside::after {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  left: -180px; bottom: -260px;
  background: radial-gradient(circle at 60% 40%, rgba(18, 153, 107, 0.5), rgba(18, 153, 107, 0) 62%);
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside .brand { color: #fff; padding: 0; }
.auth-aside .brand .tag { color: rgba(255, 255, 255, 0.55); }
.auth-copy h2 { font-size: 34px; line-height: 1.15; letter-spacing: -0.03em; max-width: 440px; }
.auth-copy p { color: rgba(255, 255, 255, 0.66); max-width: 400px; margin-top: 14px; font-size: 14.5px; line-height: 1.6; }
.auth-points { display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }
.auth-points .pt { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: rgba(255,255,255,0.85); }
.auth-points .pt svg { width: 17px; height: 17px; color: #6ee7b7; flex: 0 0 auto; margin-top: 2px; }
.auth-quote { font-size: 12px; color: rgba(255,255,255,0.42); }

.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: min(392px, 100%); }
.auth-card h1 { font-size: 24px; letter-spacing: -0.025em; }
.auth-card .lede { color: var(--muted); margin: 6px 0 24px; font-size: 13.5px; }
.auth-switch { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-error {
  display: none; margin-bottom: 14px; padding: 10px 12px; border-radius: 9px;
  background: var(--danger-soft); color: var(--danger); font-size: 12.5px; font-weight: 520;
}
.auth-error.show { display: block; }
.auth-alt { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted-2); line-height: 1.6; }

/* -------------------------------- responsive ------------------------------ */

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-2, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 45; transform: translateX(-102%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .view, .topbar { padding-left: 18px; padding-right: 18px; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .topbar { align-items: center; padding-top: 18px; }
  .topbar h1 { font-size: 19px; }
  .topbar .sub { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .kpis, .cols-3 { grid-template-columns: 1fr; }
  .topbar-actions .btn span { display: none; }
}
