/* ============================================================================
   Design system — modern dashboard. Light-first tokens; dark via media + toggle.
   --accent / --accent-2 are injected per-brand in base.html.
   ============================================================================ */
:root {
  color-scheme: light;   /* makes native pickers (time/date), their icons and scrollbars match the theme */
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --sidebar: #ffffff;
  --sidebar-strong: #1a1a24;
  --sidebar-ink: #4a4a58;
  --sidebar-ink-dim: #8a8a9a;
  --sidebar-active: #f0f0f6;
  --ink: #16161d;
  --ink-2: #4a4a58;
  --muted: #74748a;
  --line: #e7e8ee;
  --line-strong: #d9dae2;
  --accent: #5b4bb7;
  --accent-2: #5b4bb7;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --ok: #12855a;
  --ok-soft: color-mix(in srgb, var(--ok) 12%, transparent);
  --warn: #b26a00;
  --warn-soft: color-mix(in srgb, var(--warn) 12%, transparent);
  --danger: #c02b3a;
  --danger-soft: color-mix(in srgb, var(--danger) 12%, transparent);

  --radius: 14px;
  --radius-sm: 9px;
  --tap: 42px;
  --shadow-sm: 0 1px 2px rgba(16,16,29,.05), 0 1px 3px rgba(16,16,29,.05);
  --shadow: 0 2px 4px rgba(16,16,29,.05), 0 6px 20px rgba(16,16,29,.06);
  --sidebar-w: 246px;
  /* Glass surfaces — translucent + blurred for a premium frosted look. */
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.68);
  --glass-border: rgba(255, 255, 255, 0.7);
  --menu-bg: rgba(255, 255, 255, 0.97);   /* dropdowns/menus stay opaque so text doesn't bleed through */
  --blur: saturate(180%) blur(22px);
  --nav-shadow: 0 8px 30px rgba(20, 20, 40, 0.12);
}

:root[data-theme="dark"], :root.__dark {
  color-scheme: dark;
  --bg: #0f0f14; --surface: #17171f; --surface-2: #1c1c25;
  --sidebar: #14141c; --sidebar-strong: #ffffff; --sidebar-ink: #b7b7c6; --sidebar-ink-dim: #6f6f84; --sidebar-active: #23232f;
  --ink: #ececf3; --ink-2: #b9b9c8; --muted: #8b8b9e;
  --line: #262631; --line-strong: #34343f;
  --accent-ink: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 2px 6px rgba(0,0,0,.35);
  --glass: rgba(20, 20, 28, 0.5); --glass-strong: rgba(20, 20, 28, 0.66);
  --glass-border: rgba(255, 255, 255, 0.12); --nav-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); --menu-bg: rgba(26, 26, 34, 0.97);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f14; --surface: #17171f; --surface-2: #1c1c25;
    --sidebar: #14141c; --sidebar-strong: #ffffff; --sidebar-ink: #b7b7c6; --sidebar-ink-dim: #6f6f84; --sidebar-active: #23232f;
    --ink: #ececf3; --ink-2: #b9b9c8; --muted: #8b8b9e;
    --line: #262631; --line-strong: #34343f;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 2px 6px rgba(0,0,0,.35);
    --glass: rgba(20, 20, 28, 0.5); --glass-strong: rgba(20, 20, 28, 0.66);
    --glass-border: rgba(255, 255, 255, 0.12); --nav-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); --menu-bg: rgba(26, 26, 34, 0.97);
  }
}

* { box-sizing: border-box; }
/* Install buttons are `hidden` until installable; .btn/.icon-btn set display, which
   would otherwise beat the [hidden] attribute and show them permanently. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
/* Soft colour wash behind everything so the frosted-glass surfaces read as glass. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(680px 480px at 12% -5%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    radial-gradient(600px 520px at 100% 8%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 70%),
    radial-gradient(700px 600px at 50% 110%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
}
button, a, label, input, select, summary { touch-action: manipulation; }
a { color: var(--accent); }

/* ------------------------------------------------------------------ app shell */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--glass); color: var(--sidebar-ink);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40;
  padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); border-right: 1px solid var(--glass-border);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 16px; color: var(--sidebar-strong);
  font-weight: 650; font-size: 16px; text-decoration: none;
}
.sidebar-brand img { height: 26px; width: auto; border-radius: 7px; }
.sidebar-brand .dot { width: 28px; height: 28px; border-radius: 8px; background: var(--accent);
  display: grid; place-items: center; color: var(--accent-ink); font-weight: 700; flex: none; }

.nav-section { color: var(--sidebar-ink-dim); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; padding: 16px 12px 6px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--sidebar-ink); text-decoration: none; font-size: 14.5px; font-weight: 500;
  min-height: var(--tap); transition: background .12s, color .12s;
}
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-link:hover { background: var(--sidebar-active); color: var(--sidebar-strong); }
.nav-link.active { background: var(--accent); color: var(--accent-ink); }
.nav-link.active svg { opacity: 1; }
.sidebar-foot { margin-top: auto; padding-top: 10px; }
.sidebar-foot form { margin: 0; }
.sidebar-foot .nav-link { width: 100%; background: none; border: 0; cursor: pointer; font-family: inherit; }

.main-wrap { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 20px;
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border); position: sticky; top: 0; z-index: 30;
  padding-top: env(safe-area-inset-top); box-shadow: var(--nav-shadow);
}
.topbar-brand { display: none; align-items: center; gap: 11px; text-decoration: none; color: var(--ink);
  font-weight: 680; font-size: 18px; min-width: 0; }
.topbar-brand img { height: 38px; width: auto; border-radius: 9px; flex: none; }
.topbar-brand .dot { width: 38px; height: 38px; border-radius: 10px; background: var(--accent);
  display: grid; place-items: center; color: var(--accent-ink); font-weight: 700; font-size: 19px; flex: none; }
.topbar-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* profile menu (account) */
.profile { position: relative; flex: none; }
.profile-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer;
  color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; min-height: 40px; }
.profile-btn:hover { background: var(--surface); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.avatar svg { width: 17px; height: 17px; }
.avatar.lg { width: 42px; height: 42px; }
.avatar.lg svg { width: 22px; height: 22px; }
.profile-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: 244px;
  background: var(--menu-bg); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow), 0 12px 40px rgba(0,0,0,.18); padding: 8px; }
.profile-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px;
  border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.profile-head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 9px;
  text-decoration: none; font: inherit; font-size: 14px; font-weight: 500; min-height: 42px; }
.menu-item svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
/* high specificity so the global submit-button style can't hijack the Sign out button */
.profile-menu a.menu-item { color: var(--ink); }
.profile-menu button.menu-item { background: none; border: 0; cursor: pointer; color: var(--ink); }
.profile-menu button.menu-item.danger, .profile-menu button.menu-item.danger svg { color: var(--danger); }
.profile-menu .menu-item:hover { background: var(--surface-2); filter: none; }
@media (max-width: 560px) { .profile-name { display: none; } .profile-btn { padding: 4px; } }
.topbar-spacer { flex: 1; }
.hamburger { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); place-items: center; cursor: pointer; color: var(--ink); flex: none; }
.hamburger svg { width: 20px; height: 20px; }
.topbar-title { display: none; font-weight: 650; font-size: 15px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

main { padding: 26px; max-width: 1180px; width: 100%; margin: 0 auto; }
main.bare { padding: 0; max-width: none; }   /* auth pages manage their own full-screen layout */
@media (min-width: 1500px) { main { max-width: 1320px; } }

/* mobile drawer via checkbox */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 39; }

/* ----------------------------------------------------- bottom nav + more sheet */
.bottom-nav, .more-sheet, .sheet-scrim { display: none; }
.more-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@media (max-width: 899px) {
  /* Mobile is bottom-nav + a "More" bottom sheet; the desktop sidebar is hidden. */
  .sidebar { display: none; }
  .main-wrap { margin-left: 0; }
  .topbar-brand { display: flex; }
  main { padding: 18px 16px calc(90px + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 14px; }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; align-items: stretch; gap: 2px;
    height: calc(60px + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
    background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border-top: 1px solid var(--glass-border); box-shadow: var(--nav-shadow);
  }
  .bnav { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border-radius: 12px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600;
    cursor: pointer; background: none; border: 0; font-family: inherit; min-width: 0; }
  .bnav svg { width: 23px; height: 23px; }
  .bnav.active { color: var(--accent); }

  .sheet-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 46;
    opacity: 0; pointer-events: none; transition: opacity .22s; }
  .more-sheet { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 47; transform: translateY(110%);
    transition: transform .26s ease; background: var(--surface); border-top: 1px solid var(--line);
    border-radius: 22px 22px 0 0; padding: 8px 14px calc(18px + env(safe-area-inset-bottom));
    box-shadow: 0 -12px 44px rgba(0,0,0,.32); max-height: 82vh; overflow-y: auto; }
  .more-toggle:checked ~ .more-sheet { transform: translateY(0); }
  .more-toggle:checked ~ .sheet-scrim { opacity: 1; pointer-events: auto; }
  .sheet-handle { width: 40px; height: 4px; border-radius: 999px; background: var(--line-strong); margin: 2px auto 12px; }
  .sheet-nav .nav-link { color: var(--ink-2); min-height: 46px; }
  .sheet-nav .nav-link.active { background: var(--accent-soft); color: var(--accent); }
  .sheet-nav .nav-section { color: var(--muted); }
}

/* --------------------------------------------------------------- typography */
.page-head { margin-bottom: 20px; }
h1 { font-size: clamp(22px, 3.5vw, 26px); font-weight: 680; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; margin: 26px 0 12px; letter-spacing: -.005em; }
p.sub { color: var(--muted); margin: 0; font-size: 14.5px; }

/* ---------------------------------------------------------------- stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.stat .value.accent { color: var(--accent); }
.stat .value.ok { color: var(--ok); }

/* --------------------------------------------------------------------- cards */
.card { background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.card.pad-lg { padding: 22px; }
.card-title { font-weight: 640; margin: 0 0 14px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.guide-card { border-color: color-mix(in srgb, var(--accent) 32%, var(--glass-border)); }
.guide-card .step { align-items: flex-start; }
.grid2 { display: grid; gap: 18px; align-items: start; }
@media (min-width: 960px) { .grid2 { grid-template-columns: 360px 1fr; } .grid2.even { grid-template-columns: 1fr 1fr; } }
/* Both column headers start at the same height (the first heading's top margin
   would otherwise push one column down relative to the other). */
.grid2 > section > :first-child { margin-top: 0; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-main { min-width: 0; }
.row-main strong { display: block; font-weight: 600; }
.row-main .meta { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }

.list-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 10px; background: var(--surface); }
.list-item:last-child { margin-bottom: 0; }

/* Collapsible list rows: a clean summary that expands to reveal the controls. */
details.list-item { padding: 0; overflow: hidden; }
details.list-item > summary { list-style: none; cursor: pointer; padding: 13px 16px;
  display: flex; align-items: center; gap: 10px; }
details.list-item > summary::-webkit-details-marker { display: none; }
details.list-item > summary:hover { background: var(--surface-2); }
details.list-item > summary > .row { flex: 1; min-width: 0; }
details.list-item > summary::after { content: ""; flex: none; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s; margin-left: 2px; }
details.list-item[open] > summary::after { transform: rotate(-135deg); }
details.list-item > .litem-body { padding: 2px 16px 14px; }

/* Grouped sections inside an expanded row (Server / Subscriptions). */
.litem-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.litem-section:first-child { border-top: 0; padding-top: 4px; }
.litem-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; margin-bottom: 9px; }
.bot-row { padding: 12px 0; }
.bot-row + .bot-row { border-top: 1px solid var(--line); }
.bot-row:first-child { padding-top: 2px; }

/* Search + filter toolbar above a list. */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search { flex: 1; min-width: 200px; }
.toolbar select { width: auto; min-width: 150px; }
.list-empty { color: var(--muted); font-size: 14px; padding: 18px 4px; }

/* --------------------------------------------------------------------- forms */
label { display: block; margin: 0 0 6px; font-size: 13.5px; font-weight: 550; color: var(--ink-2); }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 80px; resize: vertical; }
input[type=color] { width: 54px; height: 40px; padding: 3px; }
input[type=file] { font-size: 13.5px; padding: 8px; }
/* Custom select chevron so selects match the inputs instead of the basic native look */
select { appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8a9a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 16px; }
/* Give native time/date pickers breathing room and a themed picker indicator */
input[type=time], input[type=date] { padding-right: 12px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }

.fields { display: grid; gap: 0 18px; }
@media (min-width: 560px) { .fields.two { grid-template-columns: 1fr 1fr; } .fields .full { grid-column: 1 / -1; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { margin: 0; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 15px;
  min-height: 40px; display: inline-flex; align-items: center; cursor: pointer; background: var(--surface);
  font-weight: 500; color: var(--ink-2); user-select: none; font-size: 14px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label:has(input:checked) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 500;
  color: var(--ink-2); cursor: pointer; }
.check input[type=checkbox] { width: 20px; height: 20px; flex: none; accent-color: var(--accent); cursor: pointer; }

/* ------------------------------------------------------------------- buttons */
.btn, button.btn, button[type=submit], .actions button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: var(--tap);
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; text-align: center; white-space: nowrap; transition: filter .12s, background .12s; }
@media (hover: hover) { .btn:hover, button[type=submit]:hover, .actions button:hover { filter: brightness(1.05); } }
.btn:active, button:active { transform: translateY(1px); }
.btn.secondary, button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover, button.secondary:hover { background: var(--surface-2); filter: none; }
.btn.ghost, button.ghost { background: transparent; color: var(--accent); border-color: transparent; }
.btn.danger, button.danger { background: transparent; color: var(--danger); border-color: var(--line-strong); }
.btn.danger:hover, button.danger:hover { background: var(--danger-soft); filter: none; }
.btn.full { width: 100%; }
.btn.sm, button.sm { min-height: 34px; padding: 5px 12px; font-size: 13px; }

.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.actions.mt { margin-top: 16px; }
.actions form { margin: 0; }
@media (max-width: 380px) { .actions.stack { flex-direction: column; align-items: stretch; }
  .actions.stack form, .actions.stack .btn, .actions.stack button { width: 100%; } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* -------------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

/* -------------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------------------ activity */
.log { display: flex; flex-direction: column; }
.log-row { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.log-row:last-child { border-bottom: 0; }
.log-row time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; font-size: 13px; min-width: 118px; }
.log-row.error .msg { color: var(--danger); }

/* ------------------------------------------------------------------- notices */
.notice { padding: 13px 15px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px;
  border: 1px solid var(--line); background: var(--surface); display: flex; gap: 10px; align-items: flex-start; }
.notice.warn { border-color: transparent; background: var(--warn-soft); color: var(--warn); }
.notice.ok { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.notice.info { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.empty { color: var(--muted); padding: 30px; text-align: center; }

/* --------------------------------------------------------------- theme toggle */
.theme-seg { display: flex; width: 100%; gap: 4px; background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 4px; }
.theme-seg button { flex: 1; height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: 0; border-radius: 7px; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; padding: 0; transition: background .12s, color .12s; }
.theme-seg button svg { width: 16px; height: 16px; }
.theme-seg button.on { background: var(--accent); color: var(--accent-ink); }
@media (hover: hover) { .theme-seg button:not(.on):hover { background: var(--surface); color: var(--ink); } }

/* Sidebar <button> nav items (Sign out) — override the global submit-button style,
   which was painting them accent-on-white and hiding the text in light mode. */
.sidebar-nav button.nav-link, .sidebar-foot button.nav-link {
  width: 100%; background: none; border: 0; cursor: pointer; font-family: inherit;
  color: var(--sidebar-ink); font-weight: 500; font-size: 14.5px;
}
.sidebar-nav button.nav-link:hover, .sidebar-foot button.nav-link:hover { background: var(--sidebar-active); color: var(--sidebar-strong); }

/* ------------------------------------------------------------------- callouts */
.callout { display: flex; gap: 12px; align-items: flex-start; background: var(--accent-soft);
  border: 1px solid transparent; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.callout svg { width: 20px; height: 20px; color: var(--accent); flex: none; margin-top: 1px; }
.callout .c-body { font-size: 14px; color: var(--ink-2); }
.callout .c-body strong { color: var(--ink); }
.callout.tip { background: var(--surface-2); border-color: var(--line); }
.callout.tip svg { color: var(--muted); }

/* ------------------------------------------------------------- guide modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(8,8,14,.5); display: none;
  place-items: center; z-index: 100; padding: 20px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-overlay.open { display: grid; }
.modal { position: relative; background: var(--menu-bg); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line-strong); border-radius: 22px; max-width: 440px; width: 100%;
  box-shadow: 0 24px 70px rgba(0,0,0,.4); overflow: hidden; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0;
  background: var(--surface-2); border-radius: 9px; color: var(--muted); cursor: pointer; display: grid; place-items: center; font-size: 18px; line-height: 1; }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 34px 26px 6px; text-align: center; }
.g-illus { width: 60px; height: 60px; border-radius: 16px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; margin: 0 auto 16px; }
.g-illus svg { width: 28px; height: 28px; }
.g-illus.done { background: var(--ok-soft); color: var(--ok); }
.modal-body h3 { margin: 0 0 8px; font-size: 19px; font-weight: 680; }
.modal-body p { margin: 0 auto; color: var(--ink-2); max-width: 320px; font-size: 14.5px; }
.g-step .btn { margin-top: 16px; }
.g-badge { display: inline-block; margin-top: 14px; font-size: 12.5px; font-weight: 600; padding: 4px 12px; border-radius: 999px; }
.g-badge.ok { background: var(--ok-soft); color: var(--ok); }
.g-badge.wait { background: var(--warn-soft); color: var(--warn); }
.dots { display: flex; gap: 6px; justify-content: center; padding: 18px 0 6px; }
.dot2 { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); transition: width .18s, background .18s; }
.dot2.on { background: var(--accent); width: 22px; border-radius: 4px; }
.modal-foot { padding: 14px 22px 20px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.modal-foot .spacer { flex: 1; }

/* ----------------------------------------------------------- getting started */
.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step-n { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-strong); }
.step.done .step-n { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.step strong { font-weight: 600; }
.step .meta { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

/* iPhone-first install steps in the install popup */
.install-steps { text-align: left; margin: 18px 0 6px; padding: 0; list-style: none; counter-reset: s; }
.install-steps li { position: relative; padding: 9px 0 9px 40px; counter-increment: s; color: var(--ink-2); font-size: 14.5px; }
.install-steps li::before { content: counter(s); position: absolute; left: 0; top: 7px; width: 27px; height: 27px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; }
.install-steps strong { color: var(--ink); }

.install-card { display: flex; gap: 14px; align-items: flex-start; }
.install-card .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft);
  display: grid; place-items: center; color: var(--accent); flex: none; }
.install-card .ic svg { width: 22px; height: 22px; }
.ios-steps { display: none; }

/* -------------------------------------------------------------- auth (login) */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1000px 500px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo img { height: 92px; max-width: 100%; border-radius: 20px; object-fit: contain; }
.auth-logo .dot { width: 92px; height: 92px; border-radius: 24px; background: var(--accent); color: var(--accent-ink);
  display: inline-grid; place-items: center; font-weight: 700; font-size: 40px; }
.auth h1 { text-align: center; }
.auth .sub { text-align: center; margin-bottom: 22px; }

@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
