/* vhsleads panel — calm, clear, task-first.
   One accent (deep teal), warm neutral surfaces, status = color + text. */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f3f2ee;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --ink: #16202a;
  --ink-2: #44505d;
  --muted: #76808c;
  --line: #e4e1d9;
  --line-strong: #d3cfc5;
  --accent: #0d6b67;
  --accent-hover: #0a5753;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ee;
  --ok: #17784a;
  --ok-soft: #e1f3e8;
  --warn: #9a5a00;
  --warn-soft: #faefd9;
  --danger: #bf352b;
  --danger-soft: #fbe6e3;
  --info: #2457a6;
  --info-soft: #e5edf9;
  --gray-soft: #eceae5;
  --shadow: 0 1px 2px rgb(22 32 42 / 0.05), 0 2px 8px rgb(22 32 42 / 0.04);
  --shadow-lift: 0 2px 4px rgb(22 32 42 / 0.06), 0 10px 24px rgb(22 32 42 / 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 248px;
  --font: "Manrope", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  color-scheme: light;
}

/* Dark: when the system asks for it (unless "light" was chosen), or when
   "dark" was chosen in the panel (data-theme set by the server from a cookie). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1215;
    --surface: #151a1f;
    --surface-2: #1a2026;
    --ink: #e7ebee;
    --ink-2: #b6bec6;
    --muted: #8a949e;
    --line: #252c33;
    --line-strong: #323b44;
    --accent: #4fbfb2;
    --accent-hover: #6fd0c4;
    --accent-ink: #062320;
    --accent-soft: rgb(79 191 178 / 0.14);
    --ok: #57c98a;
    --ok-soft: rgb(87 201 138 / 0.14);
    --warn: #e5ad4f;
    --warn-soft: rgb(229 173 79 / 0.14);
    --danger: #f07a6f;
    --danger-soft: rgb(240 122 111 / 0.14);
    --info: #7fa9ec;
    --info-soft: rgb(127 169 236 / 0.14);
    --gray-soft: rgb(255 255 255 / 0.07);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-lift: 0 4px 18px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1215;
  --surface: #151a1f;
  --surface-2: #1a2026;
  --ink: #e7ebee;
  --ink-2: #b6bec6;
  --muted: #8a949e;
  --line: #252c33;
  --line-strong: #323b44;
  --accent: #4fbfb2;
  --accent-hover: #6fd0c4;
  --accent-ink: #062320;
  --accent-soft: rgb(79 191 178 / 0.14);
  --ok: #57c98a;
  --ok-soft: rgb(87 201 138 / 0.14);
  --warn: #e5ad4f;
  --warn-soft: rgb(229 173 79 / 0.14);
  --danger: #f07a6f;
  --danger-soft: rgb(240 122 111 / 0.14);
  --info: #7fa9ec;
  --info-soft: rgb(127 169 236 / 0.14);
  --gray-soft: rgb(255 255 255 / 0.07);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow-lift: 0 4px 18px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

h1 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -0.02em; font-weight: 750; margin: 0 0 16px; }
h2 { font-size: 1.02rem; letter-spacing: -0.01em; font-weight: 700; margin: 0 0 12px; }
h2 a { color: inherit; }
h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
code { font: 0.84em/1.4 var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; word-break: break-all; }
strong { font-weight: 700; }
ul { padding-left: 18px; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

/* ---------- App shell: sidebar + content ---------- */

.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.95rem;
  font-weight: 800;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 600;
  transition: background-color 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav .icon { width: 19px; height: 19px; flex: none; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 12px; }

.account {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.actor { color: var(--muted); font-size: 0.82rem; }
.logout { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.theme-switch { display: inline-flex; gap: 2px; padding: 3px; margin: 0 0 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; width: max-content; }
.theme-switch button { min-height: 0; padding: 5px 9px; color: var(--muted); background: transparent; border: 0; border-radius: 7px; font-weight: 600; }
.theme-switch button:hover { color: var(--ink); background: var(--surface); }
.theme-switch button[aria-pressed="true"] { color: var(--accent); background: var(--surface); box-shadow: var(--shadow); }
.theme-switch .icon { width: 16px; height: 16px; }
.top-tools { display: flex; align-items: center; gap: 12px; }
.top-tools .theme-switch { margin: 0; }
.top-tools .logout .icon { width: 20px; height: 20px; }
.logout button.link { color: var(--ink-2); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.logout button.link:hover { color: var(--danger); }
.logout .icon { width: 17px; height: 17px; }

.content { margin-left: var(--sidebar); }
main { max-width: 1160px; margin: 0 auto; padding: 32px 32px 64px; }
.public main { max-width: none; padding: 0; }

/* ---------- Page header ---------- */

.crumbs { margin: 0 0 6px; font-size: 0.85rem; font-weight: 600; }
.crumbs a { color: var(--muted); }
.crumbs a::before { content: "‹ "; }
.crumbs a:hover { color: var(--accent); }

.titlebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.titlebar h1 { margin: 0; }
.titlebar > .badge { margin-right: auto; }
.page-sub { color: var(--muted); margin: -10px 0 20px; }

/* ---------- Surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 0 20px;
  box-shadow: var(--shadow);
}
.card > h2:first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 20px; }
.grid .card { margin: 0; }

.narrow { max-width: 420px; margin: 0 auto; }

.hint { color: var(--muted); font-size: 0.87rem; margin: 6px 0 14px; }
.err { color: var(--danger); margin: -6px 0 14px; font-size: 0.87rem; font-weight: 600; }

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  padding: 12px 16px;
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent);
  border-radius: var(--radius-sm);
  font-weight: 650;
  animation: rise 0.3s ease-out both;
}
.notice::before { content: "✓"; font-weight: 800; }

.counts { list-style: none; margin: 0; padding: 0; }
.counts li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}
.counts li:last-child { border-bottom: 0; }
.counts strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Dashboard ---------- */

.kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 28px; }
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  animation: rise 0.35s ease-out both;
}
.kpi:nth-child(2) { animation-delay: 0.04s; }
.kpi:nth-child(3) { animation-delay: 0.08s; }
.kpi:nth-child(4) { animation-delay: 0.12s; }
a.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.83rem; font-weight: 650; }
.kpi-label .icon { width: 16px; height: 16px; }
.kpi-value { font-size: 2.1rem; line-height: 1.15; font-weight: 750; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: 0.83rem; }
.kpi.is-alert { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.kpi.is-alert .kpi-value { color: var(--danger); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.section-title h2 { margin: 0; }
.section-title a { font-size: 0.87rem; font-weight: 650; }

.attention { list-style: none; margin: 0; padding: 0; }
.attention li + li { border-top: 1px solid var(--line); }
.attention a, .attention .item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 4px;
  color: var(--ink);
}
.attention a:hover { text-decoration: none; background: var(--surface-2); }
.attention .what { flex: 1; min-width: 0; }
.attention .what strong { display: block; font-weight: 700; }
.attention .what span { color: var(--muted); font-size: 0.87rem; }
.attention a > .icon { color: var(--muted); width: 18px; height: 18px; }
.attention a:hover > .icon { color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.error { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.dot.info { background: var(--info); box-shadow: 0 0 0 4px var(--info-soft); }
.all-good { display: flex; align-items: center; gap: 12px; color: var(--ok); font-weight: 650; padding: 6px 0; }
.all-good .icon { width: 22px; height: 22px; }

/* ---------- Forms ---------- */

.form label, .filters label { display: block; margin: 0 0 16px; font-size: 0.85rem; font-weight: 650; color: var(--ink-2); }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 12px;
  min-height: 42px;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly], textarea[readonly] { background: var(--surface-2); }
input[type="hidden"] { display: none; }
textarea { resize: vertical; line-height: 1.5; }
textarea[spellcheck="false"] { font: 0.86rem/1.5 var(--mono); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.row { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.form > button[type="submit"], .form > .form-actions { margin-top: 4px; }

.filters {
  display: grid;
  gap: 0 12px;
  grid-template-columns: 1fr;
  align-items: end;
  margin-bottom: 16px;
}
.filters input[type="search"] {
  padding-left: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2376808c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px 50%;
  background-size: 17px;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions form { margin: 0; }

/* ---------- Buttons ---------- */

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
button:active, .button:active { transform: translateY(1px); }
button .icon, .button .icon { width: 17px; height: 17px; }
button.secondary, .button.secondary { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
button.secondary:hover, .button.secondary:hover { background: var(--surface-2); border-color: var(--muted); }
button.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
button.danger:hover { color: #fff; background: var(--danger); }
button.link { min-height: 0; padding: 0; color: var(--accent); background: none; border: 0; font-weight: 600; }
button.link:hover { background: none; text-decoration: underline; }

/* ---------- Status badges: dot + text ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  color: var(--ink-2);
  background: var(--gray-soft);
  vertical-align: middle;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.live, .badge.active, .badge.answered, .badge.health-ok { color: var(--ok); background: var(--ok-soft); }
.badge.trial, .badge.draft, .badge.voicemail, .badge.ringing, .badge.in-progress { color: var(--info); background: var(--info-soft); }
.badge.paused, .badge.health-warn, .badge.missed { color: var(--warn); background: var(--warn-soft); }
.badge.health-error, .badge.blocked, .badge.failed { color: var(--danger); background: var(--danger-soft); }
.badge.archived { color: var(--muted); }

.badge.new, .badge.contacted { color: var(--info); background: var(--info-soft); }
.badge.won { color: var(--ok); background: var(--ok-soft); }
.badge.lost { color: var(--muted); }
.badge.do_not_contact { color: var(--danger); background: var(--danger-soft); }

/* ---------- Tabs and timeline ---------- */

.tabs { display: flex; gap: 4px; margin: -4px 0 18px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 9px 14px; margin-bottom: -1px; color: var(--muted); font-weight: 700; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; min-width: 150px; }

/* ---------- Portfolio review cards ---------- */

.review-list { display: grid; gap: 16px; margin-bottom: 28px; }
.review { margin: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; margin: 4px 0 16px; }
.facts dt { color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.facts dd { margin: 2px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.inline-form input[type="date"] { width: auto; margin: 0; min-height: 40px; }

/* ---------- Charts (server-rendered SVG) ---------- */

.charts { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.chart { margin: 0; }
.chart figcaption { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; color: var(--muted); font-size: 0.85rem; font-weight: 650; }
.chart figcaption strong { color: var(--ink); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.chart svg { display: block; width: 100%; height: 72px; overflow: visible; }
.chart rect { fill: var(--accent); opacity: 0.85; }
.chart rect:hover { opacity: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }

/* ---------- Tables ---------- */

table.list {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
table.list th, table.list td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tbody tr { transition: background-color 0.12s; }
table.list tbody tr:hover { background: var(--surface-2); }
table.list td:first-child a { font-weight: 700; }
table.list td[colspan] { text-align: center; color: var(--muted); padding: 36px 16px; }
.card table.list { border: 0; box-shadow: none; border-radius: 0; background: transparent; }
.card table.list th { background: transparent; }
.card:has(> table.list:only-child) { padding: 4px 4px; }

audio { width: 100%; margin-top: 4px; }

/* ---------- Public pages (login, errors) ---------- */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 15% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, var(--info-soft), transparent 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 400px; padding: 32px; margin: 0; text-align: center; animation: rise 0.4s ease-out both; }
.auth-card .brand { justify-content: center; padding: 0 0 18px; font-size: 1.25rem; }
.auth-card .brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 1.1rem; }
.auth-card h1 { font-size: 1.35rem; margin-bottom: 8px; }
.auth-card p { color: var(--ink-2); }
.auth-card .button, .auth-card button { width: 100%; min-height: 46px; margin-top: 8px; }
.button.google { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.button.google:hover { background: var(--surface-2); border-color: var(--muted); }
.button.google svg { width: 19px; height: 19px; }
.auth-foot { margin: 18px 0 0; font-size: 0.8rem; color: var(--muted); }

/* ---------- Motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Wide screens ---------- */

@media (min-width: 761px) {
  .filters { grid-template-columns: minmax(0, 2fr) repeat(auto-fit, minmax(150px, 1fr)); }
  .filters:has(label:nth-of-type(3)) { grid-template-columns: minmax(0, 2fr) 1fr 1fr auto; }
  .filters:not(:has(label:nth-of-type(3))) { grid-template-columns: minmax(0, 2fr) 1fr auto; }
  .filters label { margin-bottom: 0; }
}

/* ---------- Tablet & phone: top bar + bottom tab bar ---------- */

@media (max-width: 960px) {
  .sidebar {
    inset: auto 0 0 0;
    width: auto;
    height: auto;
    flex-direction: row;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgb(0 0 0 / 0.04);
  }
  .sidebar > .brand, .account, .nav-sep { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; gap: 0; }
  .nav a {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 6px 2px;
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    border-radius: var(--radius-sm);
  }
  .nav a .long, .nav a.desktop-only { display: none; }
  .nav a[aria-current="page"] { background: transparent; }
  .nav .icon { width: 21px; height: 21px; }

  .mobile-top {
    position: sticky;
    top: 0;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .mobile-top .brand { padding: 0; font-size: 1rem; }
  .mobile-top .brand-mark { width: 26px; height: 26px; font-size: 0.85rem; border-radius: 8px; }
  .content { margin-left: 0; }
  main { padding: 20px 16px 96px; }
  h1 { font-size: 1.4rem; }
}
@media (min-width: 961px) {
  .mobile-top { display: none; }
  .nav a .short { display: none; }
}

/* Tables become cards on narrow screens */
@media (max-width: 700px) {
  table.list { background: transparent; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; padding: 8px 0; }
  table.list tbody tr:hover { background: var(--surface); }
  table.list td { border: 0; padding: 5px 16px; }
  table.list td[data-label]::before { content: attr(data-label); display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--muted); }
  .card table.list tr { box-shadow: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 1.7rem; }
  .titlebar .actions { width: 100%; }
  .titlebar .actions .button { flex: 1; }
}
