/* Admin UI. Brand colors come from _palette.css (generated); neutrals and status colors match apps/web. */

@font-face { font-family: "Plus Jakarta Sans"; src: url("/public/fonts/PlusJakartaSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/public/fonts/PlusJakartaSans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/public/fonts/PlusJakartaSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/public/fonts/PlusJakartaSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/public/fonts/PlusJakartaSans-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --ink: #222222;
  --ink-soft: #444444;
  --muted: #6A6A6A;
  --border: #DDDDDD;
  --divider: #EBEBEB;
  --paper: #F7F7F7;
  --surface: #FFFFFF;
  --selected: #F5F3FF;
  --good: #079455;
  --warn: #DC6803;
  --warn-text: #B54708;
  --crit: #D92D20;
  --crit-text: #B42318;
  --neutral: #B0B0B0;
  --header-h: 56px;
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  /* Plus Jakarta's contextual alternates turn "5x" into "5×" ("5xx rate", "2x"). */
  font-feature-settings: "calt" 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--brand-focus); outline-offset: 2px; }
h1, h2, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 auto; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-label { font-size: 12px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }

/* ---------- App shell ---------- */
.app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.hdr { flex: 0 0 var(--header-h); height: var(--header-h); display: flex; align-items: center; gap: 16px; padding: 0 20px; border-bottom: 1px solid var(--divider); }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--brand); }
.logo:hover { color: var(--brand); }
.logo-word { font-size: 20px; font-weight: 800; letter-spacing: -0.8px; }
.admin-tag { font-size: 12px; font-weight: 700; color: var(--brand-dark); background: var(--brand-light); padding: 3px 10px; border-radius: 8px; }
.hdr-search { flex: 1 1 280px; display: flex; justify-content: center; }
.hdr-search .search { max-width: 440px; }
.hdr-search .search input { min-height: 44px; border-radius: 999px; box-shadow: 0 3px 12px rgba(0,0,0,.06); padding-right: 56px; }
.kbd { position: absolute; right: 14px; font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; pointer-events: none; }
.account { position: relative; margin-left: auto; }
.hdr-search + .account { margin-left: 0; }

.body { flex: 1 1 auto; min-height: 0; display: flex; }
.side { flex: 0 0 var(--sidebar-w); width: var(--sidebar-w); overflow-y: auto; padding: 14px 12px; border-right: 1px solid var(--divider); display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap; }
.nav-link:hover { color: var(--ink); background: var(--paper); }
.nav-link[aria-current="page"] { background: var(--brand-light); color: var(--brand-dark); font-weight: 700; }
.nav-link .label { flex: 1 1 auto; }
.badge { font-size: 12px; font-weight: 700; color: #FFFFFF; background: var(--brand); border-radius: 999px; padding: 1px 8px; }
.badge-crit { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--crit-text); }
.side-sep { height: 1px; background: var(--divider); margin: 10px 4px; flex: 0 0 auto; }
.side-label { padding: 4px 12px; }
.facet { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 12px; font-size: 14px; background: transparent; color: var(--ink-soft); font-weight: 500; text-align: left; }
.facet:hover { background: var(--paper); }
.facet[aria-pressed="true"] { background: var(--selected); color: var(--brand-dark); font-weight: 700; }
.facet .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.facet-city { line-height: 1.2; display: flex; flex-direction: column; flex: 1 1 auto; }
.facet-city .sub { font-size: 11px; color: var(--muted); font-weight: 500; }

.tile-city { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; }
.tile-city.supported { background: var(--brand-light); color: var(--brand-dark); }
.tile-city.waitlist { border: 1.5px dashed var(--neutral); color: var(--ink-soft); }

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

/* ---------- Page bar (tabs + actions) ---------- */
.page-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--divider); }
.page-bar .tabs { flex: 1 1 auto; border-bottom: 0; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--divider); overflow-x: auto; scrollbar-width: none; }
.tab { min-height: 44px; padding: 0; border: 0; background: transparent; font-size: 14px; margin-bottom: -1px; color: var(--ink-soft); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; flex: 0 0 auto; }
.page-bar .tab { min-height: 48px; margin-bottom: 0; }
.tab[aria-selected="true"] { color: var(--brand); font-weight: 700; border-bottom-color: var(--brand); }
.segmented { display: flex; gap: 2px; padding: 3px; background: var(--paper); border-radius: 12px; flex: 0 0 auto; }
.segmented button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- Master-detail ---------- */
.md { flex: 1 1 auto; min-height: 0; display: flex; }
.pane { height: 100%; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pane-list-wide { flex: 999 1 420px; }
.pane-detail-narrow { flex: 1 1 340px; max-width: 400px; border-left: 1px solid var(--divider); overflow-y: auto; display: block; }
.pane-list-narrow { flex: 1 1 340px; max-width: 420px; border-right: 1px solid var(--divider); }
.pane-detail-wide { flex: 999 1 420px; }
.scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
.back-btn { display: none; }

.toolbar { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--divider); }
.resultbar { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 16px; font-size: 13px; color: var(--muted); }
.resultbar strong { color: var(--ink); }

/* ---------- Inputs ---------- */
.search { position: relative; display: flex; align-items: center; width: 100%; }
.search svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; min-height: 40px; padding: 0 12px 0 36px; border: 1px solid var(--border); border-radius: 12px; font-size: 14px; background: var(--surface); }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; font-size: 14px; background: var(--surface); }
.select { padding: 0 10px; font-weight: 600; width: auto; min-height: 40px; }
.textarea { padding: 10px 12px; resize: none; min-height: 0; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--crit); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 700; }
.field-error { font-size: 12px; color: var(--crit-text); font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; color: var(--ink-soft); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--brand); color: #FFFFFF; }
.btn-primary:hover { background: var(--brand-dark); color: #FFFFFF; }
.btn-primary:disabled { opacity: .6; }
.btn-secondary { background: var(--surface); border: 1px solid var(--ink); color: var(--ink); }
.btn-secondary:hover { color: var(--ink); background: var(--paper); }
.btn-quiet { background: var(--surface); border: 1px solid var(--border); font-weight: 600; }
.btn-danger { background: transparent; color: var(--crit-text); }
.btn-danger-fill { background: var(--crit-text); color: #FFFFFF; }
.btn-danger-fill:disabled { opacity: .45; }
.btn-link { background: transparent; border: 0; color: var(--brand); font-weight: 700; min-height: 44px; padding: 0 4px; }
.icon-btn { width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
.icon-btn:disabled { background: var(--paper); color: var(--neutral); border-color: var(--divider); }
.icon-btn.sm { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }
.avatar-btn { width: 44px; height: 44px; border: 0; border-radius: 999px; background: linear-gradient(135deg, var(--brand-bright), var(--brand-dark)); color: #FFFFFF; font-weight: 800; font-size: 15px; }

/* ---------- Pills, chips, menus ---------- */
.pill-wrap { position: relative; }
.pill { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.active { border-color: var(--brand); color: var(--brand-dark); background: var(--selected); }
.pill.sm { min-height: 36px; }
.chip { display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 6px 0 10px; border: 0; border-radius: 999px; background: var(--brand-light); color: var(--brand-dark); font-size: 12px; font-weight: 700; }
.menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--divider); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }
.menu.right { left: auto; right: 0; }
.menu button, .menu a { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; font-size: 14px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.menu button:hover, .menu a:hover { background: var(--paper); }
.menu button[aria-checked="true"] { font-weight: 700; color: var(--brand-dark); }
.menu .danger { color: var(--crit-text); font-weight: 700; }
.menu-head { padding: 6px 10px 8px; border-bottom: 1px solid var(--divider); margin-bottom: 4px; font-size: 13px; display: flex; flex-direction: column; }
.menu-scrim { position: fixed; inset: 0; z-index: 25; }

/* ---------- Status dots ---------- */
.dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 999px; background: var(--neutral); display: inline-block; }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }
.dot.brand { background: var(--brand); }
.dot.brand-soft { background: var(--brand-focus); }
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.t-crit { color: var(--crit-text); }
.t-warn { color: var(--warn-text); }
.t-info { color: var(--brand-dark); }
.t-good { color: var(--good); }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; padding: 8px 12px; font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--divider); background: var(--surface); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.tbl.flush th:first-child, .tbl.flush td:first-child { padding-left: 0; }
.tbl.flush th:last-child, .tbl.flush td:last-child { padding-right: 0; }
.tbl thead tr { position: sticky; top: 0; z-index: 1; }
.tbl .r { text-align: right; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: var(--paper); }
.tbl tbody tr[aria-selected="true"], .tbl tbody tr[aria-selected="true"]:hover { background: var(--selected); }
.tbl.dense td { padding-top: 8px; padding-bottom: 8px; }
.cust { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cust-text { display: flex; flex-direction: column; min-width: 0; }
.row-name { border: 0; background: transparent; padding: 0; text-align: left; font-weight: 700; font-size: 14px; }
.ini { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 999px; background: var(--brand-light); color: var(--brand-dark); font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.avatar { border-radius: 999px; background: linear-gradient(135deg, var(--brand-bright), var(--brand-dark)); color: #FFFFFF; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }

.pager { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--divider); font-size: 13px; color: var(--muted); }

/* ---------- Lists (support / alerts) ---------- */
.ilist { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.irow { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--divider); text-align: left; background: var(--surface); }
.irow:hover { background: var(--paper); }
.irow[aria-current="true"] { background: var(--selected); }
.irow-top { display: flex; align-items: center; gap: 8px; width: 100%; }
.irow-title { flex: 1 1 auto; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.irow-sub { display: block; padding-left: 16px; font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.irow-meta { display: block; padding-left: 16px; font-size: 12px; color: var(--muted); }

/* ---------- Detail ---------- */
.detail-head { padding: 18px 20px 0; display: flex; flex-direction: column; gap: 14px; }
.detail-id { display: flex; gap: 12px; align-items: center; }
.detail-id h1 { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.detail-body { padding: 14px 20px 20px; display: flex; flex-direction: column; gap: 18px; }
.dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.dl.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dl dt { font-size: 12px; color: var(--muted); }
.dl dd { margin: 0; font-weight: 700; display: flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.kpis.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi { background: var(--paper); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi-value { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.kpi.sm .kpi-value { font-size: 18px; letter-spacing: 0; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-delta { font-size: 12px; color: var(--ink-soft); }
.line-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--divider); color: var(--ink); text-decoration: none; }
a.line-item:hover { color: var(--ink); background: var(--paper); }

/* Support thread */
.thread-head { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--divider); }
.thread-head h1 { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.thread-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-wrap: wrap; align-content: flex-start; }
.msgs { flex: 999 1 320px; min-width: 0; padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 80%; align-self: flex-start; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 10px 14px; border-radius: 16px; white-space: pre-line; overflow-wrap: anywhere; background: var(--paper); }
.msg.me .bubble { background: var(--brand); color: #FFFFFF; }
.msg.system .bubble { background: var(--surface); border: 1px dashed var(--neutral); color: var(--ink-soft); font-size: 13px; }
.cust-card-wrap { flex: 1 1 200px; max-width: 240px; padding: 16px 20px 16px 0; }
.cust-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 16px; text-decoration: none; color: var(--ink); }
.cust-card:hover { color: var(--ink); border-color: var(--brand-focus); }
.reply { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--divider); }

/* Alerts */
.alert-detail { flex: 999 1 420px; min-width: 0; height: 100%; overflow-y: auto; padding: 18px 24px; display: flex; flex-direction: column; gap: 18px; }
.alert-detail > * { max-width: 680px; }
.alert-detail h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.timeline-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--divider); }
.timeline-row .at { flex: 0 0 96px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Monitoring */
.mon { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 20px; }
.svc { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 44px; padding: 6px 0; border-bottom: 1px solid var(--divider); }
.svc .name { flex: 1 1 200px; font-weight: 700; }
.svc .st { flex: 1 1 180px; color: var(--ink-soft); }
.svc .metric { flex: 0 1 160px; color: var(--muted); font-variant-numeric: tabular-nums; }
.svc .when { flex: 0 1 120px; color: var(--muted); text-align: right; }
.bar-row { display: flex; align-items: center; gap: 12px; min-height: 40px; border-bottom: 1px solid var(--divider); }
.bar-row .name { flex: 0 0 160px; font-weight: 700; }
.bar { flex: 1 1 auto; height: 8px; background: var(--paper); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

/* Chart */
.chart { margin: 0; display: flex; flex-direction: column; gap: 6px; position: relative; }
.chart figcaption { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.chart svg { width: 100%; display: block; overflow: visible; }
.chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.chart-tip { position: absolute; top: 28px; transform: translateX(-50%); pointer-events: none; background: var(--ink); color: #FFFFFF; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 8px; white-space: nowrap; }
.chart details summary { font-size: 12px; color: var(--muted); cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.chart details table { font-size: 13px; }

/* Switch */
.switch { position: relative; width: 44px; height: 26px; border: 0; border-radius: 999px; background: var(--neutral); vertical-align: middle; flex: 0 0 auto; }
.switch[aria-checked="true"] { background: var(--brand); }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .15s; }
.switch[aria-checked="true"] .knob { left: 21px; }
.switch-cell { padding-top: 0; padding-bottom: 0; }
.switch-hit { display: inline-flex; align-items: center; justify-content: flex-end; min-width: 44px; min-height: 44px; }

/* Empty / loading */
.empty { padding: 40px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty-fill { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; }
.loading { padding: 24px 16px; color: var(--muted); font-size: 13px; }
.note { font-size: 12px; color: var(--muted); }

/* Dialog */
.dlg-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(34,34,34,.36); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg { width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.24); }
.dlg h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

/* Toasts */
.toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #FFFFFF; font-weight: 600; box-shadow: 0 12px 32px rgba(0,0,0,.2); }
.toast .dot { flex: 0 0 8px; }
.toast button { margin-left: auto; border: 0; background: transparent; color: #FFFFFF; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }

/* Auth pages */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 48px 16px; background: var(--paper); font-size: 15px; }
.auth-card { width: 100%; max-width: 860px; display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--divider); border-radius: 28px; overflow: hidden; box-shadow: 0 16px 40px rgba(76,29,149,.12); }
.auth-card.narrow { max-width: 440px; padding: 36px; flex-direction: column; flex-wrap: nowrap; gap: 20px; }
.auth-hero { flex: 1 1 300px; min-height: 260px; padding: 36px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; color: #FFFFFF;
  background:
    radial-gradient(circle at 88% 8%, rgba(255,255,255,.18), transparent 42%),
    radial-gradient(circle at 0% 100%, color-mix(in srgb, var(--glow) 28%, transparent), transparent 48%),
    linear-gradient(140deg, var(--brand-bright) 0%, var(--brand) 45%, var(--brand-dark) 100%); }
.auth-hero .logo, .auth-hero .logo:hover { color: #FFFFFF; }
.auth-hero .logo-word { font-size: 22px; }
.auth-hero .big { font-size: 30px; font-weight: 800; letter-spacing: -0.8px; line-height: 1.1; }
.auth-hero .lead { font-size: 14px; color: var(--brand-light); }
.auth-form { flex: 1 1 360px; padding: 40px 36px; display: flex; flex-direction: column; gap: 20px; justify-content: center; }
.auth h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px; padding: 0 20px; border: 1px solid #747775; border-radius: 12px; background: #FFFFFF; color: #1F1F1F; font-size: 16px; font-weight: 700; text-decoration: none; }
.google-btn:hover { color: #1F1F1F; background: #F8F8F8; }
.dev-box { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1.5px dashed var(--neutral); border-radius: 16px; }
.dev-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.dev-row .field { flex: 1 1 180px; }
.dev-row .select { width: 100%; min-height: 44px; font-weight: 400; font-size: 15px; }
.ink-link { font-size: 14px; font-weight: 700; color: var(--ink); }
.lock-tile { width: 48px; height: 48px; border-radius: 16px; background: var(--brand-light); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; }
.alert-inline { padding: 10px 12px; border-radius: 12px; background: #FEF3F2; color: var(--crit-text); font-weight: 600; font-size: 14px; }

.narrow-only { display: none; }

/* ---------- Narrow screens: sidebar → top menu, detail replaces list ---------- */
@media (max-width: 860px) {
  .hdr { gap: 10px; padding: 0 12px; }
  .hdr-search { display: none; }
  .body { flex-direction: column; }
  .side { flex: 0 0 auto; width: auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--divider); scrollbar-width: none; }
  .side .facets { display: none; }
  .nav-link { min-height: 44px; }
  .narrow-only { display: flex; }
  .md.has-sel > .md-list { display: none; }
  .md:not(.has-sel) > .md-detail { display: none; }
  .md > .md-detail { max-width: none; border-left: 0; flex: 1 1 auto; }
  .md > .md-list { max-width: none; border-right: 0; flex: 1 1 auto; }
  .back-btn { display: inline-flex; }
  .cust-card-wrap { max-width: none; padding: 0 20px 16px; flex-basis: 100%; }
  .msg { max-width: 92%; }
  .alert-detail { padding: 16px; }
  .dl.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row .name { flex-basis: 110px; }
  .page-bar { flex-wrap: wrap; padding: 0 12px; }
  .page-bar .segmented { margin-bottom: 8px; }
}
