/* GoLine1 — admin console
   Light/dark via prefers-color-scheme + custom properties. */

/* ---------- tokens ---------- */
:root {
  --bg:            #f6f7f9;
  --bg-elevated:   #ffffff;
  --bg-sunken:     #eceef2;
  --surface:       #ffffff;
  --surface-hover: #f2f4f7;
  --sidebar-bg:    #101828;
  --sidebar-fg:    #cbd3e1;
  --sidebar-fg-mut:#8794ac;
  --sidebar-active:#1c2740;

  --fg:            #101828;
  --fg-muted:      #5a6579;
  --fg-subtle:     #8794ac;

  --border:        #dfe3ea;
  --border-strong: #c6ccd8;

  /* Chart: one accented series for what the assistant handled, and a neutral for the remainder -
     an absence of handling is not a rival category. Validated for contrast and colour-vision
     separation against this surface; both segments also carry a legend and a hover figure. */
  --chart-contained: #3f62e8;
  --chart-rest:      #5a6579;

  --accent:        #3f62e8;
  --accent-hover:  #3453d4;
  --accent-soft:   rgba(63, 98, 232, .10);
  --accent-fg:     #ffffff;

  --ok:            #0f7a48;
  --ok-soft:       rgba(15, 122, 72, .12);
  --danger:        #b42318;
  --danger-soft:   rgba(180, 35, 24, .10);
  --warn:          #a15c07;
  --warn-soft:     rgba(161, 92, 7, .12);

  --skeleton-a:    #e6e9ef;
  --skeleton-b:    #f2f4f7;

  --radius:        10px;
  --radius-sm:     7px;
  --shadow-sm:     0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md:     0 4px 14px rgba(16, 24, 40, .10);
  --shadow-lg:     0 24px 60px rgba(16, 24, 40, .22);

  --sidebar-w:     236px;
  --banner-h:      44px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0b111f;
    --bg-elevated:   #121a2b;
    --bg-sunken:     #0a0f1a;
    --surface:       #121a2b;
    --surface-hover: #182238;
    --sidebar-bg:    #080d18;
    --sidebar-fg:    #c3cddf;
    --sidebar-fg-mut:#77859e;
    --sidebar-active:#1a2540;

    --fg:            #e8edf6;
    --fg-muted:      #9aa7bd;
    --fg-subtle:     #74819a;

    --border:        #22304b;
    --border-strong: #33445f;

    --chart-contained: #6c8dff;
    --chart-rest:      #5d6b86;

    --accent:        #6c8dff;
    --accent-hover:  #85a0ff;
    --accent-soft:   rgba(108, 141, 255, .14);
    --accent-fg:     #0a1020;

    --ok:            #4ade9a;
    --ok-soft:       rgba(74, 222, 154, .13);
    --danger:        #ff8b80;
    --danger-soft:   rgba(255, 139, 128, .13);
    --warn:          #f0b866;
    --warn-soft:     rgba(240, 184, 102, .13);

    --skeleton-a:    #1a2338;
    --skeleton-b:    #223050;

    --shadow-sm:     0 1px 2px rgba(0, 0, 0, .5);
    --shadow-md:     0 4px 14px rgba(0, 0, 0, .45);
    --shadow-lg:     0 24px 60px rgba(0, 0, 0, .65);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- proof of concept banner (permanent) ---------- */
.poc-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 18px;
  background: #7a1d12;
  color: #ffe9e6;
  border-bottom: 1px solid #a3291a;
  font-size: 13px;
}
@media (prefers-color-scheme: dark) {
  .poc-banner { background: #59150d; color: #ffdcd7; border-bottom-color: #7d2317; }
}
.poc-banner__icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.poc-banner strong { color: #fff; }

/* ---------- shell ---------- */
.shell[hidden] { display: none; }

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--banner-h));
}

.topbar { display: none; }

.sidebar {
  position: sticky;
  top: var(--banner-h);
  align-self: start;
  height: calc(100vh - var(--banner-h));
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  padding: 18px 12px 14px;
  border-right: 1px solid rgba(255,255,255,.06);
}

.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 20px; }
.brand__mark {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand__name { font-weight: 600; color: #fff; font-size: 13.5px; }
.brand__sub { font-size: 11.5px; color: var(--sidebar-fg-mut); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-fg);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
}
.nav__link svg { width: 17px; height: 17px; flex: none; opacity: .75; }
.nav__link:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav__link[aria-current="page"] {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav__link[aria-current="page"] svg { opacity: 1; color: var(--accent); }

.sidebar__foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.07); }
.health { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--sidebar-fg-mut); }
.health__dot { width: 8px; height: 8px; border-radius: 50%; background: #6b7890; flex: none; }
.health__dot[data-state="ok"]   { background: #3ecf8e; box-shadow: 0 0 0 3px rgba(62,207,142,.18); }
.health__dot[data-state="down"] { background: #f97066; box-shadow: 0 0 0 3px rgba(249,112,102,.18); }
.sidebar__note { margin-top: 8px; font-size: 11px; color: var(--sidebar-fg-mut); opacity: .8; }

.main { min-width: 0; padding: 26px 28px 60px; }
.main:focus { outline: none; }

/* ---------- page header ---------- */
.page-head {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: flex-end; justify-content: space-between;
  margin-bottom: 20px;
}
.page-head__text { min-width: 0; }
.page-head h1 { font-size: 21px; }
.page-head__sub { color: var(--fg-muted); font-size: 13px; margin-top: 3px; }
.page-head__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.btn:hover:not(:disabled) { background: var(--surface-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn--primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-fg);
}
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent; color: var(--fg-muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--fg); }
.icon-btn svg { width: 16px; height: 16px; }

.spin { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* ---------- 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: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.card__head h2 { font-size: 14px; }
.card__body { padding: 16px; }

/* ---------- stat grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 15px;
  box-shadow: var(--shadow-sm);
}
.stat__label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--fg-subtle);
}
.stat__value {
  margin-top: 6px;
  font-size: 27px; font-weight: 650; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat__foot { margin-top: 3px; font-size: 12px; color: var(--fg-muted); }
.stat--ok .stat__value { color: var(--ok); }
.stat--danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: var(--danger-soft); }
.stat--danger .stat__value { color: var(--danger); }

/* ---------- alert ---------- */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 16px;
  font-size: 13px;
}
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert__body { min-width: 0; flex: 1; }
.alert__title { font-weight: 600; }
.alert__text { color: var(--fg-muted); margin-top: 2px; word-break: break-word; }
.alert--danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: var(--danger-soft); color: var(--danger); }
.alert--danger .alert__text { color: color-mix(in srgb, var(--danger) 80%, var(--fg)); }
.alert--warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: var(--warn-soft); color: var(--warn); }
.alert--warn .alert__text { color: color-mix(in srgb, var(--warn) 80%, var(--fg)); }

/* ---------- bar chart ---------- */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar { display: grid; grid-template-columns: minmax(96px, 150px) 1fr auto; gap: 12px; align-items: center; }
.bar__label { font-size: 13px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__track { height: 9px; border-radius: 5px; background: var(--bg-sunken); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 5px; background: var(--accent); min-width: 3px; }
.bar__value { font-size: 12.5px; color: var(--fg-muted); font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }

/* ---------- toolbar / filters ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.search { position: relative; flex: 1 1 240px; min-width: 180px; }
.search svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--fg-subtle); pointer-events: none;
}
.search input { padding-left: 31px; }

input[type="text"], input[type="email"], input[type="search"],
input[type="tel"], input[type="url"], select, textarea {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--fg);
  font: inherit; font-size: 13px;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent);
}
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
input[readonly] { background: var(--bg-sunken); color: var(--fg-muted); cursor: default; }

.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-sm); background: var(--bg-sunken); border: 1px solid var(--border); }
.segmented button {
  padding: 5px 11px; border: 0; border-radius: 5px;
  background: transparent; color: var(--fg-muted);
  font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-sm); }

.result-count { margin-left: auto; font-size: 12.5px; color: var(--fg-subtle); font-variant-numeric: tabular-nums; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 600; font-size: 11.5px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--fg-subtle);
  padding: 9px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  white-space: nowrap;
}
table.data td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--surface-hover); }
table.data tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
table.data tbody tr:last-child td { border-bottom: 0; }
.cell-primary { font-weight: 550; }
.cell-muted { color: var(--fg-muted); }
.cell-time { white-space: nowrap; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--sent   { color: var(--ok);     background: var(--ok-soft);     border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.badge--failed { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.badge--neutral{ color: var(--fg-muted); background: var(--bg-sunken); border-color: var(--border); }
.badge--ai     { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

.chip {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: var(--bg-sunken); border: 1px solid var(--border);
  font-size: 12px; color: var(--fg-muted);
}

/* ---------- states ---------- */
.state { padding: 44px 20px; text-align: center; }
.state__title { font-size: 14.5px; font-weight: 600; }
.state__text { margin-top: 5px; color: var(--fg-muted); font-size: 13px; }
.state__actions { margin-top: 14px; }
.state pre {
  margin: 12px auto 0; max-width: 620px; text-align: left;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-sunken); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 12px;
  white-space: pre-wrap; word-break: break-word; color: var(--fg-muted);
}

/* ---------- skeletons ---------- */
.sk { border-radius: 6px; background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 37%, var(--skeleton-a) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.sk-line { height: 11px; }
.sk-row { display: flex; gap: 14px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.sk-stat { height: 88px; border-radius: var(--radius); }

/* ---------- forms ---------- */
.form { display: grid; gap: 18px; max-width: 680px; }
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; }
.field__hint { font-size: 12px; color: var(--fg-muted); }
.field__error { font-size: 12px; color: var(--danger); font-weight: 500; }
.field__counter { font-size: 11.5px; color: var(--fg-subtle); font-variant-numeric: tabular-nums; text-align: right; }
.field__counter[data-over="true"] { color: var(--warn); }

.switch-row {
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elevated);
}
.switch { position: relative; display: inline-flex; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track {
  width: 40px; height: 22px; border-radius: 999px;
  background: var(--border-strong); transition: background 140ms ease;
  display: block;
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform 140ms ease;
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .switch__track, .switch__track::after { transition: none; } }

.form-actions {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding-top: 4px;
}
.save-msg { font-size: 13px; }
.save-msg[data-tone="ok"] { color: var(--ok); }
.save-msg[data-tone="error"] { color: var(--danger); }
.save-msg[data-tone="pending"] { color: var(--fg-muted); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: flex-end; }
.modal[hidden] { display: none; }
.modal__scrim { position: absolute; inset: 0; background: rgba(9, 14, 24, .55); backdrop-filter: blur(2px); }
.modal__panel {
  position: relative;
  width: min(540px, 100%);
  height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: slide-in 160ms ease;
}
@keyframes slide-in { from { transform: translateX(16px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .modal__panel { animation: none; } }
.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.modal__head h2 { font-size: 15px; }
.modal__body { padding: 16px; overflow-y: auto; flex: 1; }

.detail-head { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.detail-group { margin-bottom: 18px; }
.detail-group__title {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--fg-subtle); margin-bottom: 8px;
}
.detail-list { display: grid; gap: 10px; }
.detail-item { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; align-items: start; }
.detail-item dt { font-size: 12.5px; color: var(--fg-muted); }
.detail-item dd { margin: 0; font-size: 13px; word-break: break-word; }
.detail-item dd.is-empty { color: var(--fg-subtle); font-style: italic; }
.detail-item dd.mono { font-family: var(--mono); font-size: 12px; }
.prose {
  white-space: pre-wrap; word-break: break-word;
  padding: 11px 12px; border-radius: var(--radius-sm);
  background: var(--bg-sunken); border: 1px solid var(--border);
  font-size: 13px; line-height: 1.6;
}
.prose.is-empty { color: var(--fg-subtle); font-style: italic; }

/* ---------- mobile ---------- */
.scrim { position: fixed; inset: 0; background: rgba(9, 14, 24, .5); z-index: 40; }
.scrim[hidden] { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }

  .topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: var(--banner-h); z-index: 30;
    padding: 10px 14px;
    background: var(--sidebar-bg); color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .topbar__menu {
    display: grid; place-items: center;
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,.16); background: transparent; color: #fff; cursor: pointer;
  }
  .topbar__menu svg { width: 18px; height: 18px; }
  .topbar__title { font-weight: 600; font-size: 14px; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100%;
    width: 258px; z-index: 50;
    transform: translateX(-102%);
    transition: transform 170ms ease;
    padding-top: 18px;
  }
  .sidebar[data-open="true"] { transform: translateX(0); }
  @media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

  .main { padding: 18px 14px 56px; }

  /* table collapses to cards */
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tbody tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 10px 12px;
    padding: 4px 0;
    background: var(--bg-elevated);
  }
  table.data td { border-bottom: 0; padding: 6px 14px; display: flex; gap: 12px; align-items: baseline; }
  table.data td::before {
    content: attr(data-label);
    flex: none; width: 96px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
    color: var(--fg-subtle);
  }
  .table-wrap { overflow-x: visible; }

  .detail-item { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .modal__panel { width: 100%; border-left: 0; }
  .result-count { margin-left: 0; }
}

/* ---------- sign-in gate ---------- */
.auth {
  min-height: calc(100vh - var(--banner-h));
  display: grid;
  place-items: center;
  padding: 40px 18px 64px;
}
.auth[hidden] { display: none; }

.auth__card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 26px 24px 22px;
}

.auth__brand { display: flex; gap: 11px; align-items: center; margin-bottom: 18px; }
.auth__brand .brand__mark { width: 34px; height: 34px; font-size: 13px; }
.auth__title { font-size: 16px; }
.auth__sub { font-size: 12.5px; color: var(--fg-muted); margin-top: 1px; }
.auth__intro { font-size: 13px; color: var(--fg-muted); margin-bottom: 18px; line-height: 1.55; }

.auth__form { display: grid; gap: 14px; }

.pw { position: relative; display: block; }
.pw input { padding-right: 68px; font-size: 14px; padding-top: 9px; padding-bottom: 9px; }
.pw__toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  padding: 4px 9px; border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-sunken); color: var(--fg-muted);
  font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.pw__toggle:hover { color: var(--fg); }

.auth__error {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12.5px; color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  word-break: break-word;
}
.auth__error[hidden] { display: none; }
.auth__error svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }

.auth__submit { width: 100%; justify-content: center; padding-top: 9px; padding-bottom: 9px; }

.auth__foot {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--fg-subtle);
}
.auth__foot .health { color: var(--fg-muted); }
.auth__foot .health__dot { background: var(--border-strong); }

/* ---------- sign out ---------- */
.signout {
  display: flex; align-items: center; gap: 9px;
  width: 100%; margin-top: 10px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sidebar-fg);
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.signout:hover { background: rgba(255,255,255,.06); color: #fff; }
.signout svg { width: 16px; height: 16px; flex: none; opacity: .8; }

/* ---------- tenants ---------- */

/* Utilities the tenants screens lean on. */
a.btn { text-decoration: none; }
.alert[hidden], .chip[hidden] { display: none; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.stack-xs { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.cell-empty { color: var(--fg-subtle); font-style: italic; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.badge--off {
  color: var(--fg-subtle);
  background: transparent;
  border-color: var(--border-strong);
  font-weight: 500;
}
.badge--off::before { background: var(--border-strong); }

.btn--ghost {
  background: transparent;
  border-style: dashed;
  border-color: var(--border-strong);
  color: var(--fg-muted);
  box-shadow: none;
}
.btn--ghost:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.btn--danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  background: var(--danger-soft);
  box-shadow: none;
}
.btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 18%, transparent); }

.icon-btn--danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn:disabled:hover { background: transparent; color: var(--fg-muted); }

.backlink {
  display: inline-flex; align-items: center; gap: 4px;
  margin-bottom: 12px;
  font-size: 12.5px; font-weight: 500;
  color: var(--fg-muted); text-decoration: none;
}
.backlink:hover { color: var(--accent); }
.backlink svg { width: 14px; height: 14px; }

/* ---------- grouped editor form ---------- */
.form--wide { max-width: 780px; gap: 16px; }

.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.form-section__head { padding: 14px 16px 12px; border-bottom: 1px solid var(--border); }
.form-section__title { font-size: 14px; }
.form-section__hint { margin-top: 3px; font-size: 12.5px; color: var(--fg-muted); }
.form-section__body { display: grid; gap: 18px; padding: 16px; }
.form-section .alert, .form > .alert { margin-bottom: 0; }

.field__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.input--short { max-width: 140px; }
.input--upper { text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

/* ---------- repeating rows (phone numbers) ---------- */
.row-list { display: grid; gap: 8px; }
.row-list:empty { display: none; }
.row-item { display: flex; gap: 8px; align-items: flex-start; }
.row-item__main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.row-item .icon-btn { flex: none; margin-top: 3px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- FAQ editor ---------- */
.faq-list { display: grid; gap: 10px; }
.faq-list:empty { display: none; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
}
.faq-item__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 8px 7px 14px;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
}
.faq-item__index {
  font-size: 11.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--fg-subtle);
}
.faq-item__tools { display: flex; gap: 2px; }
.faq-item__tools .icon-btn { width: 28px; height: 28px; }
.faq-item__tools .icon-btn svg { width: 14px; height: 14px; }
.faq-item__body { display: grid; gap: 12px; padding: 13px 14px; }
.faq-item__body textarea { min-height: 68px; }

/* ---------- editor footer + delete confirmation ---------- */
.form-actions--footer {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.form-actions--footer .save-msg { flex: 1 1 100%; }
.form-actions--footer .btn--danger { margin-left: auto; }

.confirm { display: grid; gap: 16px; }
.confirm__text { font-size: 13px; color: var(--fg-muted); line-height: 1.6; }

@media (max-width: 860px) {
  .form--wide { max-width: none; }
  .form-actions--footer .btn--danger { margin-left: 0; }
  .form-actions--footer .btn, .form-actions--footer .save-msg { flex: 1 1 100%; justify-content: center; }
  .input--short { max-width: none; }
}


/* ------------------------------------------------------------------- charts */

.chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.chart__grid { stroke: var(--border); stroke-width: 1; }
.chart__axis { fill: var(--fg-subtle); font-size: 11px; }
.chart__contained { fill: var(--chart-contained); }
.chart__rest { fill: var(--chart-rest); }
/* A hit target wider than the column, so a one-call day is still hoverable. */
.chart__hit { fill: transparent; }
.chart__hit:hover { fill: var(--accent-soft); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 12px;
  color: var(--fg-muted);
  font-size: 12px;
}
.legend__item { display: inline-flex; align-items: center; gap: 7px; }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend__swatch--contained { background: var(--chart-contained); }
.legend__swatch--rest { background: var(--chart-rest); }


/* ---------------------------------------------------------------- documents */

.doc-list { display: grid; gap: 10px; }

.doc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.doc__main { flex: 1; min-width: 0; }
.doc__name {
  margin: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc__meta { margin: 2px 0 0; color: var(--fg-muted); font-size: 12px; }
.doc__error { margin: 6px 0 0; color: var(--danger); font-size: 12px; }

@media (max-width: 640px) {
  .doc { flex-wrap: wrap; }
}
