/* Self-hosted brand fonts (GDPR: no third-party font CDN). Latin subset, woff2.
   Sources: @fontsource/instrument-sans, @fontsource/jetbrains-mono (OFL). */
@font-face{font-family:'Instrument Sans';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/instrument-sans-latin-400-normal.woff2') format('woff2');}
@font-face{font-family:'Instrument Sans';font-style:normal;font-weight:500;font-display:swap;src:url('/fonts/instrument-sans-latin-500-normal.woff2') format('woff2');}
@font-face{font-family:'Instrument Sans';font-style:normal;font-weight:600;font-display:swap;src:url('/fonts/instrument-sans-latin-600-normal.woff2') format('woff2');}
@font-face{font-family:'Instrument Sans';font-style:normal;font-weight:700;font-display:swap;src:url('/fonts/instrument-sans-latin-700-normal.woff2') format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:500;font-display:swap;src:url('/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:600;font-display:swap;src:url('/fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:700;font-display:swap;src:url('/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');}


/* Layout: matches the dr connect viewer and admin shell. White 56px top bar (emblem, wordmark, divider, designation, account),
   40px section bar with underline tabs, 1200px content column on the Mist ground, white 12px cards, 8px buttons, soft badges.
   Tokens are the viewer's own (src/public/index.html :root). Production self-hosts Instrument Sans and JetBrains Mono. */
:root {
  --ink: #131B26; --blue: #0A9BF5; --violet: #7A1CFC; --teal: #00A886;
  --bg: #F1F3F6; --surface: #FFFFFF; --surface-2: #FAFBFC; --border: #DDE2E8; --border-strong: #C7CED8;
  --text: #131B26; --text-muted: #4A5464; --text-faint: #8A94A3;
  --ok: #00A886; --warn: #F59E0B; --err: #EF4444;
  --link: #0670B8; --on-accent: #FFFFFF; --hover: rgba(19,27,38,.06);
  --b-pilot-bg: #DBEAFE; --b-pilot-fg: #1E3A8A;
  --b-prod-bg: #D1FAE5;  --b-prod-fg: #065F46;
  --b-warn-bg: #FEF3C7;  --b-warn-fg: #92400E;
  --b-crit-bg: #FEE2E2;  --b-crit-fg: #991B1B;
  --b-none-bg: #F3F4F6;  --b-none-fg: #6B7280;
  --font-sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #080D14; --surface: #131B26; --surface-2: #0E1520; --border: rgba(138,148,163,.22); --border-strong: rgba(138,148,163,.40);
  --text: #FBFBFC; --text-muted: #AEB6C2; --text-faint: #8A94A3; --link: #4DB8F8; --on-accent: #04121C; --hover: rgba(251,251,252,.08);
  --b-pilot-bg: rgba(10,155,245,.18); --b-pilot-fg: #7CCBFA; --b-prod-bg: rgba(0,168,134,.20); --b-prod-fg: #3DDDB9;
  --b-warn-bg: rgba(245,158,11,.18); --b-warn-fg: #F6C25B; --b-crit-bg: rgba(239,68,68,.20); --b-crit-fg: #FF8D8D;
  --b-none-bg: rgba(138,148,163,.18); --b-none-fg: #AEB6C2; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #080D14; --surface: #131B26; --surface-2: #0E1520; --border: rgba(138,148,163,.22); --border-strong: rgba(138,148,163,.40);
  --text: #FBFBFC; --text-muted: #AEB6C2; --text-faint: #8A94A3; --link: #4DB8F8; --on-accent: #04121C; --hover: rgba(251,251,252,.08);
  --b-pilot-bg: rgba(10,155,245,.18); --b-pilot-fg: #7CCBFA; --b-prod-bg: rgba(0,168,134,.20); --b-prod-fg: #3DDDB9;
  --b-warn-bg: rgba(245,158,11,.18); --b-warn-fg: #F6C25B; --b-crit-bg: rgba(239,68,68,.20); --b-crit-fg: #FF8D8D;
  --b-none-bg: rgba(138,148,163,.18); --b-none-fg: #AEB6C2; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 14px; line-height: 1.5; min-height: 100vh; }
h1, h2, h3, p { margin: 0; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.mono { font-family: var(--font-mono); }
.label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.muted { color: var(--text-muted); }
a { color: var(--link); }


/* shell */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 28px; height: 56px; display: flex; align-items: center; gap: 8px; }
.brand-lockup { display: flex; align-items: center; gap: 9px; flex: none; }
.emblem { height: 22px; width: auto; display: block; flex: none; }
.brand-lockup .wm { font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.wordset { display: inline-flex; align-items: baseline; gap: 10px; }
.app-div { width: 1px; height: 14px; background: var(--border); align-self: center; flex: none; }
.app-desig { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.who { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-trigger { display: flex; background: none; border: 0; border-radius: 8px; padding: 8px; color: var(--text-muted); }
.who-trigger:hover { background: var(--hover); color: var(--text); }
.subbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 28px; overflow-x: auto; }
.nav { display: flex; gap: 2px; min-width: max-content; }
.nav a { text-decoration: none; display: flex; align-items: center; height: 40px; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--text-muted); background: none; border: 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--blue); }
.main { padding: 24px 28px 36px; max-width: 1200px; margin: 0 auto; min-width: 0; }
@media (max-width: 700px) { .topbar, .subbar { padding-inline: 14px; } .main { padding: 18px 14px 28px; } .who { display: none; } .app-div, .app-desig { display: none; } }

/* page parts */
.crumbs { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.pagehead { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.pagehead h1 { font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
.pagehead .sub { color: var(--text-muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--blue); color: var(--on-accent); border-color: var(--blue); }
.btn-primary:hover { background: #2BA8F7; border-color: #2BA8F7; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: minmax(0,1.35fr) minmax(0,1fr); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1000px) { .g2 { grid-template-columns: minmax(0,1fr); } .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; min-width: 0; }
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.card .hint { color: var(--text-muted); font-size: 12.5px; margin-bottom: 12px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; }
.stat .num { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -.01em; }
.stat .num small { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; line-height: 1.5; white-space: nowrap; background: var(--b-none-bg); color: var(--b-none-fg); }
.badge.pilot, .badge.draft-b { background: var(--b-pilot-bg); color: var(--b-pilot-fg); }
.badge.prod, .badge.live { background: var(--b-prod-bg); color: var(--b-prod-fg); }
.badge.warn, .badge.draft { background: var(--b-warn-bg); color: var(--b-warn-fg); }
.badge.crit { background: var(--b-crit-bg); color: var(--b-crit-fg); }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th { text-align: left; font-size: 12px; color: var(--text-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border-strong); }
td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rowact { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field label { font-size: 12.5px; color: var(--text-muted); }
.field input[type=text], .field input[type=email], .field select, .field textarea { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; min-width: 0; width: 100%; }
.field input:disabled, .field select:disabled { background: var(--surface-2); color: var(--text-muted); }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 14px; }
@media (max-width: 600px) { .fgrid { grid-template-columns: minmax(0,1fr); } }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; }
.check input { margin-top: 3px; accent-color: var(--blue); }
.check small { display: block; color: var(--text-muted); }
.switch { position: relative; width: 34px; height: 20px; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--b-none-bg); border: 1px solid var(--border-strong); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-faint); transition: transform .15s, background .15s; }
.switch input:checked + span { background: var(--ok); border-color: var(--ok); }
.switch input:checked + span::after { transform: translateX(14px); background: #fff; }
.switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.note { border-left: 3px solid var(--blue); padding: 8px 12px; color: var(--text-muted); font-size: 12.5px; background: var(--surface-2); border-radius: 0 8px 8px 0; }
.code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; white-space: pre; line-height: 1.6; }
.code .k { color: var(--link); } .code .s { color: var(--b-prod-fg); } .code .n { color: var(--b-warn-fg); }
.email { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; font-size: 13px; line-height: 1.55; }
.email p + p { margin-top: 10px; }
.managed { font-size: 12px; color: var(--text-faint); }
.spark { width: 100%; height: 96px; display: block; }
.spark .grid-l { stroke: var(--border); stroke-width: 1; }
.spark .ln { fill: none; stroke: url(#sg); stroke-width: 2; stroke-linejoin: round; }
.spark .ar { fill: url(#sa); }
.spark .dot { fill: var(--blue); }
.spark text { fill: var(--text-faint); font-family: var(--font-mono); font-size: 10px; }

/* sign in */
.signin { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden; padding: 24px 16px; background: var(--bg); }
.signin .motif { position: absolute; left: 0; right: 0; bottom: 14%; width: 100%; height: auto; opacity: .7; pointer-events: none; }
.signin .box { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px 30px; width: min(100%, 400px); display: flex; flex-direction: column; gap: 18px; box-shadow: 0 4px 14px rgba(0,0,0,.04); }
.signin .wm-svg { width: 150px; height: 21px; color: var(--text); }
.signin h1 { font-size: 20px; font-weight: 600; }
.mscta { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--ink); color: #fff; border: 0; border-radius: 8px; padding: 11px 14px; font-weight: 600; font-size: 14px; }
:root[data-theme="dark"] .mscta { background: var(--text); color: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mscta { background: var(--text); color: var(--bg); } }
.mscta i { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 16px; height: 16px; }
.mscta i b { background: currentColor; opacity: .85; }

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* additions for the product */
.flash { max-width: 1200px; margin: 14px auto 0; padding: 10px 14px; border-radius: 8px; background: var(--b-prod-bg); color: var(--b-prod-fg); font-size: 13px; }
.flash.err { background: var(--b-crit-bg); color: var(--b-crit-fg); }
.mainwrap { padding-inline: 28px; } .mainwrap .main { padding-inline: 0; }
@media (max-width: 700px) { .mainwrap { padding-inline: 14px; } }
a.btn { display: inline-block; text-decoration: none; }
.crumbs a { color: var(--text-muted); }
.inline { display: inline; margin: 0; }
.nowrap { white-space: nowrap; }
.field textarea { font-family: var(--font-mono); font-size: 12.5px; min-height: 220px; }
.field input[type=number], .field input[type=date], .field input[type=password] { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; width: 100%; }
.tokenbox { font-family: var(--font-mono); font-size: 13px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 12px 14px; word-break: break-all; user-select: all; }
.issues { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.issues li { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; }
.empty { color: var(--text-muted); padding: 14px 0; }
.menu { position: relative; } .menu summary { list-style: none; cursor: pointer; } .menu summary::-webkit-details-marker { display: none; }
.menu .pop { position: absolute; right: 0; top: 40px; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px; min-width: 190px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.menu .pop button, .menu .pop a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 13px; }
.menu .pop button:hover, .menu .pop a:hover { background: var(--hover); }
.menu .pop .who-line { padding: 8px 10px; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; word-break: break-all; }

/* key/value list */
dl.kv { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 16px; margin: 12px 0 0; }
dl.kv dt { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
dl.kv dd { margin: 0; }
h3 { font-size: 14px; font-weight: 600; }
@media (max-width: 640px) { dl.kv { grid-template-columns: 1fr; } }
