/* Linkhive design system. No build step: edit this file directly. */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --surface-3: #eef0f6;
  --border: #e3e6ee;
  --border-strong: #cfd4e0;
  --text: #121826;
  --text-2: #4a5468;
  --text-3: #7c869a;

  --brand: #3647d6;
  --brand-600: #2b3bbd;
  --brand-50: #eef0ff;
  --brand-100: #dfe3ff;
  --honey: #f2a516;
  --honey-50: #fff6e3;
  --ink: #0e1430;
  --ink-2: #19214a;

  --green: #16834f;
  --green-50: #e7f6ee;
  --red: #c8352b;
  --red-50: #fdecea;
  --amber: #a86500;
  --amber-50: #fff4de;
  --blue: #1f6fd1;
  --blue-50: #e8f1fd;
  --grey-50: #f0f2f6;

  --chart-1: #3647d6;
  --chart-2: #f2a516;
  --chart-3: #16a37a;
  --chart-4: #d9487a;
  --chart-5: #8a96ab;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 14px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .16);
  --sidebar-w: 248px;
  --topbar-h: 60px;
}

:root[data-theme="dark"] {
  --bg: #0c1020;
  --surface: #141a2e;
  --surface-2: #181f36;
  --surface-3: #1f2742;
  --border: #262f4d;
  --border-strong: #34406a;
  --text: #e8ebf5;
  --text-2: #aab2c8;
  --text-3: #7a849d;
  --brand: #7d8cff;
  --brand-600: #95a1ff;
  --brand-50: #1c2350;
  --brand-100: #27306a;
  --honey-50: #33280f;
  --ink: #090c19;
  --ink-2: #10162b;
  --green: #4ccb8c;
  --green-50: #11301f;
  --red: #ff7a70;
  --red-50: #3a1714;
  --amber: #f3b54a;
  --amber-50: #36290f;
  --blue: #6fa8ff;
  --blue-50: #13284a;
  --grey-50: #1f2742;
  --chart-1: #7d8cff;
  --chart-5: #5d6987;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0c1020; --surface: #141a2e; --surface-2: #181f36; --surface-3: #1f2742; --border: #262f4d;
    --border-strong: #34406a; --text: #e8ebf5; --text-2: #aab2c8; --text-3: #7a849d; --brand: #7d8cff;
    --brand-600: #95a1ff; --brand-50: #1c2350; --brand-100: #27306a; --honey-50: #33280f; --ink: #090c19;
    --ink-2: #10162b; --green: #4ccb8c; --green-50: #11301f; --red: #ff7a70; --red-50: #3a1714;
    --amber: #f3b54a; --amber-50: #36290f; --blue: #6fa8ff; --blue-50: #13284a; --grey-50: #1f2742;
    --chart-1: #7d8cff; --chart-5: #5d6987;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { vertical-align: middle; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--ink); color: #c9cfe6;
  position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; flex-direction: column;
  transition: transform .2s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; color: #fff; font-weight: 700; font-size: 16px; }
.sidebar-brand:hover { text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--honey), #f7c64f); color: var(--ink);
}
.logo-mark svg { width: 20px; height: 20px; }
.sidebar-brand small { display: block; font-size: 11.5px; font-weight: 500; color: #8f98bd; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 10px 18px; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #6f79a3; padding: 16px 10px 6px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: #c9cfe6;
  font-weight: 500; font-size: 13.5px;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--ink-2); color: #fff; box-shadow: inset 3px 0 0 var(--honey); }
.nav-link .icon { opacity: .85; }
.nav-link .count { margin-left: auto; background: var(--honey); color: var(--ink); font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 999px; }
.sidebar-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.07); font-size: 12px; color: #8f98bd; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
}
.topbar .search { flex: 1; max-width: 460px; position: relative; }
.topbar .search input { padding-left: 36px; background: var(--surface-2); }
.topbar .search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; border: 0; background: transparent;
  color: var(--text-2); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--surface); }
.menu-toggle { display: none; }
.content { padding: 24px; width: 100%; max-width: 1440px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text); }
.user-chip:hover { text-decoration: none; background: var(--surface-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--brand-100); color: var(--brand); font-weight: 700; font-size: 12px; text-transform: uppercase;
}
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.backdrop { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumbs { font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--text-2); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; font-size: 14.5px; }
.card-head .muted { font-size: 12.5px; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
:not(.grid):not(.stack):not(.row):not(.screens):not(.demo-grid) > .card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 16px; } .mt-lg { margin-top: 24px; } .mb { margin-bottom: 16px; } .mb-0 { margin-bottom: 0; }

/* ---------- Stats ---------- */
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.stat-label { color: var(--text-2); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-meta { font-size: 12px; color: var(--text-3); }
.stat-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.stat-icon.honey { background: var(--honey-50); color: var(--amber); }
.stat-icon.green { background: var(--green-50); color: var(--green); }
.stat-icon.red { background: var(--red-50); color: var(--red); }
.trend-up { color: var(--green); font-weight: 600; }
.trend-down { color: var(--red); font-weight: 600; }
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.meter.honey > span { background: var(--honey); }
.meter.red > span { background: var(--red); }
.meter.green > span { background: var(--green); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
:root[data-theme="dark"] .btn-primary { color: #0c1020; }
.btn-honey { background: var(--honey); border-color: var(--honey); color: var(--ink); }
.btn-honey:hover { background: #e39a0d; }
.btn-danger { background: var(--surface); border-color: color-mix(in srgb, var(--red) 40%, var(--border)); color: var(--red); }
.btn-danger:hover { background: var(--red-50); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.disabled { opacity: .55; pointer-events: none; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-weight: 550; font-size: 13px; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .error { font-size: 12.5px; color: var(--red); }
.req::after { content: " *"; color: var(--red); }
.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=date],
input[type=datetime-local], input[type=search], input[type=url], input[type=time], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 92px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c869a' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.is-invalid { border-color: var(--red) !important; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
.input-group { display: flex; }
.input-group > :first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > :last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; }
.addon { display: grid; place-items: center; padding: 0 11px; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text-2); font-size: 13px; white-space: nowrap; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-weight: 650; font-size: 14px; margin-bottom: 12px; padding: 0; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 650; margin: 8px 0 12px; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.filters input, .filters select { width: auto; min-width: 150px; height: 34px; font-size: 13px; }
.filters input[type=search] { min-width: 220px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--brand); border-color: var(--brand); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.chip:hover { text-decoration: none; border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand); }
.chip .n { font-weight: 700; color: var(--text); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 650; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; }
.table th.num { text-align: right; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.table-compact td, .table-compact th { padding: 8px 12px; }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-main strong { font-weight: 600; color: var(--text); display: block; }
.cell-main .sub { font-size: 12px; color: var(--text-3); }
a.row-link { color: var(--text); font-weight: 600; }
.dl { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 9px 14px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--text-2); }
.dl dd { margin: 0; font-weight: 500; word-break: break-word; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--grey-50); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge-green { background: var(--green-50); color: var(--green); }
.badge-red { background: var(--red-50); color: var(--red); }
.badge-amber { background: var(--amber-50); color: var(--amber); }
.badge-blue { background: var(--blue-50); color: var(--blue); }
.badge-brand { background: var(--brand-50); color: var(--brand); }
.online-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--text-3); flex: none; }
.online-dot.on { background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 25%, transparent); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 16px; font-size: 13.5px; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--green-50); border-color: color-mix(in srgb, var(--green) 30%, transparent); color: var(--green); }
.alert-error { background: var(--red-50); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); }
.alert-warning { background: var(--amber-50); border-color: color-mix(in srgb, var(--amber) 30%, transparent); color: var(--amber); }
.alert-info { background: var(--blue-50); border-color: color-mix(in srgb, var(--blue) 30%, transparent); color: var(--blue); }
.alert > div { color: var(--text); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.empty { text-align: center; padding: 42px 20px; color: var(--text-2); }
.empty .icon { width: 36px; height: 36px; color: var(--text-3); margin-bottom: 8px; }
.empty h3 { color: var(--text); }

/* ---------- Lists, timeline ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; display: block; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .meta { font-size: 12px; color: var(--text-3); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: -6px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.message { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.message.staff { background: var(--brand-50); border-color: var(--brand-100); }
.message.internal { background: var(--amber-50); border-color: color-mix(in srgb, var(--amber) 25%, transparent); }
.message .who { font-weight: 650; font-size: 13px; display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.message .body { white-space: pre-wrap; word-break: break-word; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--text-3); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-line { stroke: var(--border-strong); }
.chart .bar { transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 70px; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.bar-row .meter { height: 8px; }

/* ---------- Dialog / dropdown ---------- */
dialog.modal { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(10, 14, 30, .5); backdrop-filter: blur(2px); }
dialog.modal .card-head { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; display: none; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--text); background: none; border: 0; font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); text-decoration: none; }
.dropdown-menu .sep { height: 1px; background: var(--border); margin: 5px 0; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.pagination .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination a, .pagination span.page { min-width: 32px; height: 32px; padding: 0 9px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--border); color: var(--text); font-weight: 550; }
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .disabled { opacity: .45; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.auth-side { background: radial-gradient(1200px 600px at -10% -20%, #2c3aa8 0%, transparent 55%), radial-gradient(700px 500px at 110% 120%, #6a4a10 0%, transparent 60%), var(--ink); color: #dfe3f7; padding: 44px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { color: #fff; font-size: 28px; line-height: 1.2; margin: 0 0 12px; max-width: 420px; }
.auth-side p { color: #aab2d6; max-width: 420px; }
.auth-points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: center; color: #dfe3f7; }
.auth-points .icon { color: var(--honey); }
.auth-main { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.auth-card > p { color: var(--text-2); margin-bottom: 24px; }
.demo-box { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 12px 14px; margin-top: 18px; background: var(--surface-2); }
.demo-box button { all: unset; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 6px; font-size: 13px; box-sizing: border-box; }
.demo-box button:hover { background: var(--surface-3); }
.demo-box button span:last-child { color: var(--text-3); font-family: var(--mono); font-size: 12px; }

/* ---------- Portal (customer) ---------- */
.portal-top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.portal-top .inner { max-width: 1120px; margin: 0 auto; height: 62px; display: flex; align-items: center; gap: 18px; padding: 0 20px; }
.portal-nav { display: flex; gap: 4px; }
.portal-nav a { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 550; display: flex; align-items: center; gap: 7px; }
.portal-nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.portal-nav a.active { background: var(--brand-50); color: var(--brand); }
.portal-main { max-width: 1120px; margin: 0 auto; padding: 24px 20px 96px; }
.brand-inline { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand-inline:hover { text-decoration: none; }
.tabbar { display: none; }
.hero-card { background: linear-gradient(135deg, var(--ink) 0%, #232f7a 100%); color: #fff; border: 0; position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(242,165,22,.35), transparent 65%); }
.hero-card .muted, .hero-card .subtle { color: #b8c0e6; }
.hero-card .meter { background: rgba(255,255,255,.15); }
.hero-card .meter > span { background: var(--honey); }
.hero-body { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; }
.hero-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; }
.hero-facts > div { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.hero-facts strong { font-size: 18px; color: #fff; }
.hero-actions { margin-top: auto; padding-top: 24px; }
.big-number { font-size: 34px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.plan-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; background: var(--surface); display: flex; flex-direction: column; gap: 12px; position: relative; }
.plan-card.current { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.plan-card .speed { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.plan-card .price { font-size: 20px; font-weight: 700; }
.plan-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; color: var(--text-2); font-size: 13.5px; }
.plan-card li { display: flex; gap: 8px; align-items: center; }
.plan-card li .icon { color: var(--green); }
.ribbon { position: absolute; top: 14px; right: 14px; }

/* ---------- Field (technician) ---------- */
.tech-top { background: var(--ink); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; }
.tech-top a { color: #fff; }
.tech-main { max-width: 760px; margin: 0 auto; padding: 16px 16px 96px; }
.job { display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); color: var(--text); margin-bottom: 10px; }
.job:hover { text-decoration: none; border-color: var(--border-strong); }
.job .title { font-weight: 650; }

/* The field app keeps its bottom tab bar at every width. */
.tabbar.always {
  display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar.always a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--text-3); padding: 4px 0; font-weight: 550; }
.tabbar.always a.active { color: var(--brand); }
.tabbar.always a:hover { text-decoration: none; color: var(--text); }

/* ---------- Map ---------- */
.map { height: 560px; border-radius: 0 0 var(--radius) var(--radius); background: var(--surface-3); }
.map-sm { height: 280px; border-radius: var(--radius); }
.leaflet-container { font-family: var(--font) !important; }
.map-pin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }

/* ---------- Print ---------- */
.print-page { background: #fff; color: #111; max-width: 820px; margin: 24px auto; padding: 40px; border: 1px solid #e5e7eb; border-radius: 12px; }
.print-page table { width: 100%; border-collapse: collapse; }
.print-page th, .print-page td { padding: 9px 8px; border-bottom: 1px solid #e5e7eb; text-align: left; font-size: 13px; }
.print-page .num { text-align: right; }
.print-toolbar { max-width: 820px; margin: 16px auto 0; display: flex; justify-content: flex-end; gap: 8px; }
.stamp { display: inline-block; border: 3px solid; border-radius: 8px; padding: 4px 14px; font-weight: 800; font-size: 20px; letter-spacing: .1em; transform: rotate(-8deg); }
.stamp.paid { color: #16834f; } .stamp.unpaid { color: #c8352b; }
.voucher-sheet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.voucher-card { border: 1px dashed #9aa3b5; border-radius: 8px; padding: 10px; font-size: 11px; break-inside: avoid; text-align: center; }
.voucher-card .code { font-family: var(--mono); font-size: 16px; font-weight: 800; letter-spacing: .08em; margin: 4px 0; color: #111; }
@media print {
  body { background: #fff; }
  .no-print, .print-toolbar { display: none !important; }
  .print-page { border: 0; margin: 0; padding: 0; max-width: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(10,14,30,.45); z-index: 35; }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px; }
  .grid-3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .portal-nav { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--text-3); padding: 4px 0; font-weight: 550; }
  .tabbar a.active { color: var(--brand); }
  .tabbar a:hover { text-decoration: none; }
  .voucher-sheet { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-4, .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .topbar .search { display: none; }
  .filters input, .filters select, .filters input[type=search] { min-width: 0; width: 100%; flex: 1 1 140px; }
  .stat-value { font-size: 21px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
  .bar-row { grid-template-columns: 90px 1fr 60px; }
  .hide-sm { display: none; }
  .print-page { padding: 18px; margin: 0; border: 0; }
  .map { height: 420px; }
}
