@font-face { font-family: "Figtree"; src: url("figtree.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
  --canvas: #ffffff; --surface-subtle: #f5f5f5; --surface-sunken: #ededed; --track: #ebebeb;
  --text-primary: #111111; --text-secondary: #4b5058;
  --data: #e8590c; --accent-solid: #111111; --accent-solid-hover: #000000; --accent-text: #0a3fa0;
  --accent-subtle: #d5e6fb; --accent-subtle-text: #1b4888; --focus-ring: #111111;
  --border: #ededed; --border-strong: #d1d5db; --border-input: #868d9a;
  --success-text: #14572d; --success-bg: #e6f4ea;
  --warning-text: #8a3b0a; --warning-bg: #fff4e5;
  --danger-text: #831c1e; --danger-bg: #ffedea; --danger-fill: #c4242a;
  --neutral-text: #3f3f3f; --neutral-bg: #e7e7e7;
  --font-sans: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius-sm: 8px; --radius-lg: 16px; --radius-pill: 999px;
  --sidebar-w: 220px; --gutter: 40px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; font: 400 15px/1.5 var(--font-sans); color: var(--text-primary); background: var(--canvas); }
a { color: var(--accent-text); text-underline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.phone-only { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--canvas); border-right: 1px solid var(--border); padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 17px; padding: 0 8px; letter-spacing: -0.01em; }
.brand small { display: block; font-weight: 400; font-size: 13px; color: var(--text-secondary); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; font-size: 14px; color: var(--text-primary); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-sunken); }
.nav a[aria-current="page"] { background: var(--surface-sunken); }
.nav a[aria-current="page"] svg { stroke: var(--text-primary); }
.nav svg { width: 18px; height: 18px; flex: none; stroke: var(--text-secondary); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.side .me { margin-top: auto; font-size: 13px; color: var(--text-secondary); padding: 0 8px; overflow-wrap: anywhere; }
.main { min-width: 0; padding: 32px var(--gutter) 64px; max-width: 1240px; }
.topbar { display: none; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
h1 { font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 18px; line-height: 1.3; margin: 0 0 12px; letter-spacing: -0.01em; }
.sub { color: var(--text-secondary); margin: 6px 0 0; font-size: 14px; }
.syncline { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-secondary); }
.syncline form { margin: 0; }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 16px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--canvas); color: var(--text-primary); font: 500 14px var(--font-sans); text-decoration: none; cursor: pointer; transition: background-color 150ms, transform 160ms var(--ease-out); }
.btn:hover { background: var(--surface-sunken); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent-solid); border-color: var(--accent-solid); color: #fff; }
.btn.primary:hover { background: var(--accent-solid-hover); }
.btn.danger { color: var(--danger-text); }
.btn.link { border: 0; background: none; padding: 0 4px; min-height: 32px; color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  font: 400 15px var(--font-sans); color: var(--text-primary); background: var(--canvas); border: 1px solid var(--border-input); border-radius: var(--radius-sm); padding: 8px 12px; min-height: 40px; width: 100%; }
input[type=file] { width: 100%; max-width: 100%; min-height: 40px; font: 400 15px var(--font-sans); }
textarea { min-height: 160px; resize: vertical; line-height: 1.5; }
.field { margin-bottom: 16px; }
.hint { font-size: 13px; color: var(--text-secondary); margin: 6px 0 0; }

/* notices */
.notice { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 20px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 14px; }
.notice.bad { background: var(--danger-bg); color: var(--danger-text); }
.notice.warn { background: var(--warning-bg); color: var(--warning-text); }
.notice.good { background: var(--success-bg); color: var(--success-text); }
.notice.info { background: var(--accent-subtle); color: var(--accent-subtle-text); }
.notice .actions { display: flex; gap: 8px; align-items: center; }
.notice form { margin: 0; }

/* KPI strip: one divided card */
.kpis { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 12px; margin-bottom: 32px; }
.kpi { padding: 16px 20px; background: var(--surface-subtle); border-radius: var(--radius-lg); }
.kpi .label { font-size: 14px; color: var(--text-secondary); }
.kpi .value { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.kpi .value.dim { color: var(--text-secondary); }
.kpi .note { font-size: 13px; color: var(--text-secondary); }

/* tables */
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 12px; height: 40px; color: var(--text-secondary); padding: 10px 16px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th.num, td.num { text-align: right; }
tbody tr:hover td { background: var(--surface-subtle); }
td a.rowlink { color: var(--text-primary); font-weight: 500; text-decoration: none; display: inline-block; padding: 4px 0; }
td a.rowlink:hover { text-decoration: underline; }
.muted { color: var(--text-secondary); }
.line2 { display: block; font-size: 13px; color: var(--text-secondary); }
tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.good { background: var(--success-bg); color: var(--success-text); }
.pill.warn { background: var(--warning-bg); color: var(--warning-text); }
.pill.bad { background: var(--danger-bg); color: var(--danger-text); }
.pill.neutral { background: var(--neutral-bg); color: var(--neutral-text); }
.pill.info { background: var(--accent-subtle); color: var(--accent-subtle-text); }

/* score bar */
.score { display: inline-flex; align-items: center; gap: 8px; }
.bar { width: 72px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--data); }

/* tabs and filters */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; scrollbar-width: none; }
.tabs a { padding: 6px 12px; border-radius: var(--radius-pill); color: var(--text-primary); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.tabs a:hover { background: var(--surface-sunken); }
.tabs a[aria-current="true"] { background: var(--surface-sunken); color: var(--text-primary); }
.tabs a[aria-current="true"] .count { color: var(--text-primary); }
.tabs .count { color: var(--text-secondary); font-weight: 400; margin-left: 4px; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 200px; }
.filters .grow { flex: 1; }

.empty { background: var(--surface-subtle); border-radius: var(--radius-lg); padding: 32px; text-align: left; }
.empty h2 { margin-bottom: 6px; }
.empty p { margin: 0 0 16px; color: var(--text-secondary); max-width: 60ch; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: 14px; color: var(--text-secondary); }

/* two columns: lead page, settings */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 24px; margin: 0 0 24px; font-size: 14px; }
.facts dt { color: var(--text-secondary); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.panel { background: var(--surface-subtle); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 24px; }
.panel h2 { font-size: 16px; }
.section { margin-bottom: 40px; max-width: 760px; }
.temp { font: 600 18px var(--font-sans); letter-spacing: 0.02em; background: var(--surface-sunken); padding: 4px 10px; border-radius: var(--radius-sm); user-select: all; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--surface-subtle); }
.login .box { width: 100%; max-width: 400px; background: var(--canvas); border: 0; border-radius: var(--radius-lg); padding: 32px; }
.login h1 { font-size: 24px; margin-bottom: 4px; }
.login .btn { width: 100%; margin-top: 8px; min-height: 44px; }

@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .shell { display: block; }
  .side { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--canvas); position: sticky; top: 0; z-index: 5; }
  .topbar .brand { padding: 0; font-size: 16px; }
  .topbar details { position: relative; }
  .topbar summary { list-style: none; min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: var(--radius-pill); font-weight: 500; cursor: pointer; border: 1px solid var(--border-strong); background: var(--canvas); }
  .topbar summary::-webkit-details-marker { display: none; }
  .topbar .sheet { position: fixed; inset: 56px 0 auto 0; background: var(--canvas); border-bottom: 1px solid var(--border); padding: 12px 16px 20px; box-shadow: 0 12px 32px -8px rgb(16 24 40 / .18); }
  .topbar .sheet .nav a { min-height: 44px; font-size: 16px; }
  .topbar .sheet .me { padding: 12px 10px 0; font-size: 13px; color: var(--text-secondary); }
  .main { padding: 20px 16px 48px; }
  h1 { font-size: 24px; }
  .head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 14px 16px; }
  .kpis { gap: 8px; }
  .kpis.odd .kpi:last-child { grid-column: 1 / -1; }
  .kpi .value { font-size: 24px; }
  input[type=text], input[type=email], input[type=password], input[type=search], select, textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  /* tables become two-line rows */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { padding: 0; border: 0; text-align: left; }
  table.stack td.first { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; margin-bottom: 4px; }
  table.stack td.first > span:first-child { min-width: 0; overflow-wrap: anywhere; }
  table.stack td.rest { display: inline; font-size: 13px; color: var(--text-secondary); }
  table.stack td.rest:not(:empty) ~ td.rest:not(:empty)::before { content: " · "; }
  table.stack td.hide-phone { display: none; }
  .phone-only { display: inline !important; }
  .pill.phone-only { display: inline-flex !important; }
  .hide-phone { display: none !important; }
  table.stack tfoot { display: block; }
  .filters .field { min-width: 0; flex: 1 1 100%; }
  .filters .field.grow { flex: 1 1 0; }
  .filters { gap: 8px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts dd { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:active { transform: none; } }
