:root {
  color-scheme: dark;
  font: 16px/1.5 system-ui, sans-serif;
  --canvas: #000;
  --panel: #1c1c1e;
  --rail: #101012;
  --line: #38383a;
  --control-line: #737b89;
  --text: #fff;
  --subtle: #cbd5e1;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --selection: #172554;
  --primary: #0062cc;
  --primary-hover: #0057b8;
  --input: #111;
  --green: #86efac;
  --yellow: #fde68a;
  --red: #fca5a5;
  --radius: 12px;
  --card-radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--text); }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
main:focus { outline: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 4vw, 2.38rem); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 1.18rem; line-height: 1.25; letter-spacing: -.018em; }
h3 { font-size: .97rem; line-height: 1.35; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.mono, code, pre { font-family: ui-monospace, Menlo, Consolas, monospace; }
code { font-size: .84em; overflow-wrap: anywhere; }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 10; transform: translateY(-200%); }
.skip-link:focus { transform: none; }

.console-shell { min-height: 100dvh; }
.app-layout { display: grid; min-height: 100dvh; grid-template-columns: 248px minmax(0, 1fr); }
.rail { min-width: 0; background: var(--rail); border-right: 1px solid var(--line); }
.rail-inner { position: sticky; top: 0; height: 100dvh; overflow: auto; display: flex; flex-direction: column; padding: 22px 14px 16px; }
.brand-block { padding: 0 10px 20px; }
.wordmark { color: var(--text); font-size: 1.6rem; font-weight: 750; letter-spacing: -.075em; line-height: 1; }
.wordmark span { color: var(--accent); }
.console-label { display: block; margin-top: 7px; font-size: .83rem; color: var(--muted); }
.site-picker { padding: 0 8px 18px; }
.site-picker select { font-size: .87rem; width: 100%; }
.site-picker label { margin: 0 0 5px; }
.mobile-nav { display: none; }
.rail nav { display: grid; gap: 4px; }
.nav-item { min-height: 44px; width: 100%; padding: 8px 10px; display: flex; align-items: center; gap: 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--subtle); font-size: .89rem; text-align: left; text-decoration: none; white-space: nowrap; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--selection); border-color: #4876bd; color: var(--text); }
.nav-item[aria-current="page"] .icon { color: var(--accent); }
.nav-divider { margin: 10px 8px 4px; border-top: 1px solid var(--line); }
.rail-footer { display: grid; gap: 10px; margin-top: auto; padding: 21px 10px 0; }
.rail-footer button { align-self: start; }
.identity-line { color: var(--subtle); overflow-wrap: anywhere; }
.icon { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; font-size: 1.05rem; line-height: 1; color: currentColor; }

.workspace { min-width: 0; }
.topbar { min-height: 69px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; border-bottom: 1px solid var(--line); padding: 12px clamp(18px, 3.5vw, 46px); }
.site-trail { display: flex; gap: 10px; align-items: center; color: var(--subtle); font-size: .91rem; }
.site-trail strong { color: var(--text); overflow-wrap: anywhere; }
.environment { display: inline-flex; align-items: center; gap: 3px; background: var(--input); padding: 3px; border: 1px solid var(--line); border-radius: 11px; }
.environment button { border: 1px solid transparent; border-radius: 8px; background: transparent; padding: 5px 11px; min-height: 34px; color: var(--subtle); font-size: .81rem; font-weight: 650; }
.environment button[aria-pressed="true"] { background: var(--selection); border-color: #4876bd; color: var(--text); }
.content { max-width: 1450px; margin: auto; padding: clamp(22px, 3.5vw, 45px); }
.content > * + * { margin-top: 20px; }
.page-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.page-heading p { max-width: 65ch; margin-top: 8px; color: var(--muted); }
.page-heading .button { flex: none; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; min-height: 44px; border: 1px solid var(--control-line); border-radius: var(--radius); background: transparent; color: var(--text); text-decoration: none; font-size: .87rem; font-weight: 650; }
.button:hover { background: #ffffff0e; }
.button.primary { border-color: transparent; background: var(--primary); }
.button.primary:hover { background: var(--primary-hover); }
.button.danger { color: var(--red); border-color: #a85656; }
.button.compact { min-height: 36px; padding: 5px 10px; font-size: .81rem; }
.text-button { min-height: 36px; padding: 4px 0; border: 0; background: transparent; color: var(--accent); font-size: .87rem; font-weight: 650; text-align: left; }
.text-button:hover { text-decoration: underline; }
.form-actions, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.form-actions { margin-top: 16px; }

.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--card-radius); }
.panel-heading { padding: 18px 20px; }
.panel-heading p { color: var(--muted); margin-top: 5px; font-size: .88rem; }
.padded { padding: 20px; }
.stack > * + * { margin-top: 13px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metrics { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { min-height: 99px; padding: 16px; display: grid; align-content: center; gap: 3px; }
.metric dt { color: var(--muted); font-size: .82rem; }
.metric dd { margin: 0; font-size: 1.62rem; font-weight: 730; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.banner { display: flex; gap: 11px; align-items: flex-start; padding: 12px 15px; color: var(--subtle); border: 1px solid #4876bd; border-radius: var(--radius); background: #101a32; font-size: .88rem; }
.banner .icon { color: var(--accent); }
.banner.warn { border-color: #886827; background: #251e10; }
.banner.warn .icon { color: var(--yellow); }
.error-text { color: var(--red); }
.toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; padding: 0 20px 16px; }
.toolbar .search { flex: 1 1 220px; }
.toolbar .field { margin: 0; }
.field { display: grid; gap: 6px; margin: 0; min-width: 0; }
.field label, .field legend, .site-picker label { color: var(--subtle); font-size: .85rem; font-weight: 620; }
.field small { color: var(--muted); }
input:not([type="checkbox"]), select, textarea { min-height: 44px; min-width: 0; padding: 9px 11px; border: 1px solid var(--control-line); border-radius: var(--radius); background: var(--input); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type="checkbox"] { accent-color: var(--primary); width: 18px; height: 18px; margin: 0; }
textarea { min-height: 82px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-stack { display: grid; gap: 13px; }
.check-label { display: flex; align-items: center; gap: 9px; font-size: .88rem; color: var(--subtle); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }

.table-scroll { overflow: auto; }
.table-scroll:focus-visible { outline-offset: -3px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: #121214; color: var(--muted); }
td, th { padding: 11px 16px; border-top: 1px solid var(--line); font-size: .85rem; overflow-wrap: anywhere; }
th { white-space: nowrap; font-size: .8rem; font-weight: 620; }
td { color: var(--subtle); }
td time { white-space: nowrap; }
td .muted { display: block; }
.cell-label { display: none; }
tbody tr:hover { background: #ffffff05; }
td:first-child, th:first-child { padding-left: 20px; }
td:last-child, th:last-child { padding-right: 20px; }
.row-action { white-space: nowrap; }
.empty { padding: 40px 18px; display: grid; justify-items: center; gap: 8px; text-align: center; border-top: 1px solid var(--line); }
.empty p { max-width: 55ch; font-size: .91rem; }
.empty .button { margin-top: 7px; }
.status { display: inline-flex; gap: 6px; align-items: center; max-width: 100%; min-height: 23px; padding: 2px 8px; color: var(--subtle); background: #0003; border: 1px solid #657183; border-radius: 999px; font-size: .74rem; font-weight: 650; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.status.good { color: var(--green); border-color: #457057; }
.status.pending { color: var(--yellow); border-color: #876f35; }
.status.bad { color: var(--red); border-color: #955b5a; }
.metadata { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0; }
.metadata div { min-width: 0; }
.metadata dt { color: var(--muted); font-size: .81rem; }
.metadata dd { margin: 3px 0 0; font-size: .94rem; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 11px 0 0; padding: 0 0 0 15px; }
.timeline li { position: relative; padding: 0 0 14px 15px; border-left: 1px solid var(--line); }
.timeline li::before { content: ''; position: absolute; top: .38rem; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.timeline li:last-child { padding-bottom: 0; }
.steps { margin: 0; padding-left: 25px; color: var(--subtle); }
.steps li + li { margin-top: 8px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px; background: var(--input); border: 1px solid var(--line); border-radius: var(--radius); font-size: .83rem; }

dialog { width: min(610px, calc(100% - 24px)); max-height: calc(100dvh - 28px); padding: 0; border: 1px solid var(--control-line); border-radius: var(--card-radius); background: var(--panel); color: var(--text); }
dialog::backdrop { background: #000b; }
.dialog-top { position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 1; padding: 11px 16px 11px 20px; display: flex; gap: 16px; justify-content: space-between; align-items: center; }
.dialog-body { padding: 19px 20px 22px; }
.close { min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 1.35rem; cursor: pointer; }
.close:hover { background: #ffffff0e; }
.notice { position: fixed; z-index: 3; bottom: 18px; right: 18px; max-width: min(420px, calc(100% - 36px)); padding: 12px 15px; border: 1px solid var(--control-line); border-radius: var(--radius); background: #202c45; color: var(--text); box-shadow: 0 8px 25px #0008; font-size: .89rem; }
.notice[data-error="true"] { background: #3b2020; }
.welcome { display: grid; justify-items: start; align-content: center; gap: 15px; max-width: 520px; min-height: 100dvh; margin: auto; padding: 32px; }
.welcome > p:not(.wordmark) { color: var(--muted); }
.verification-page { display: grid; align-content: center; gap: 15px; margin: auto; max-width: 520px; min-height: 100dvh; padding: 32px; }
.verification-page > p { color: var(--subtle); }
.qr { display: block; max-width: 100%; width: 208px; height: auto; margin: 10px auto; background: white; padding: 7px; border-radius: 6px; }
.break-long { overflow-wrap: anywhere; }

@media (max-width: 1000px) {
  .app-layout { grid-template-columns: 206px minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 740px) {
  .app-layout { display: block; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-inner { position: static; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 15px 12px 7px; align-items: center; }
  .brand-block { padding: 0 6px 10px; }
  .site-picker { padding: 0 4px 8px; }
  .rail nav { display: none; }
  .mobile-nav { grid-column: 1 / -1; display: flex; align-items: flex-end; gap: 10px; padding: 0 5px 7px; }
  .mobile-nav .field { flex: 1; }
  .mobile-nav select { font-size: .89rem; }
  .mobile-nav .button { min-height: 44px; }
  .rail-footer { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 0; }
  .topbar { min-height: 56px; }
  .content { padding: 21px 16px; }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  table, tbody, tbody tr { display: block; }
  thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  tbody tr { padding: 9px 16px; border-top: 1px solid var(--line); }
  tbody td, tbody td:first-child, tbody td:last-child { display: grid; grid-template-columns: minmax(92px, 2fr) minmax(0, 3fr); gap: 10px; align-items: start; border: 0; padding: 6px 0; }
  tbody td:has(.cell-value:empty) { display: none; }
  .cell-label { display: block; color: var(--muted); font-size: .78rem; }
  td .text-button { min-height: 0; padding: 0; }
  td time { white-space: normal; }
}

@media (max-width: 420px) {
  .metadata, .form-grid { grid-template-columns: 1fr; }
  .topbar { padding-inline: 16px; }
  .site-trail { flex-wrap: wrap; }
  .panel-heading, .padded, .toolbar { padding-inline: 14px; }
  td:first-child, th:first-child { padding-left: 14px; }
  td:last-child, th:last-child { padding-right: 14px; }
}
