/* Skip artifact shell — fixed styles served beside every artifact.
   Tokens, utilities and components (basecoat 1.0 markup, no CDN); artifacts
   override --accent for their own identity. */
:root {
  color-scheme: light dark;
  --accent: #2563eb;
  --accent-contrast: #ffffff;
  --accent-text: color-mix(in srgb, var(--accent) 72%, #000);
  --bg: #f8f9fb;
  --surface: #ffffff;
  --text: #14171f;
  --text-muted: #5b6472;
  --border: rgba(20, 23, 31, 0.10);
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 23, 31, 0.08);
  --space: 16px;
  --success: #0a7a35;
  --danger: #c0262d;
  --warning: #8a5300;
}
/* Theme resolution. Without data-theme the viewer's system preference decides,
   as it always did. With it, the artifact's own choice wins in BOTH directions:
   a page that hardcodes one palette must not be handed the opposite set of
   tokens by the machine it happens to be opened on. The dark values appear
   twice because a media query cannot be folded into a selector list.
   The attribute sits inside :where() so these blocks keep the specificity of a
   bare :root — the page's own <style> is linked after this file and must go on
   overriding any token it wants, exactly as it could before. */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --accent-text: color-mix(in srgb, var(--accent) 78%, #fff);
    --bg: #101318;
    --surface: #181c23;
    --text: #eef1f6;
    --text-muted: #9aa4b2;
    --border: rgba(238, 241, 246, 0.12);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --success: #4ade80;
    --danger: #f87171;
    --warning: #fbbf24;
  }
}
:root:where([data-theme="dark"]) {
  color-scheme: dark;
  --accent-text: color-mix(in srgb, var(--accent) 78%, #fff);
  --bg: #101318;
  --surface: #181c23;
  --text: #eef1f6;
  --text-muted: #9aa4b2;
  --border: rgba(238, 241, 246, 0.12);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --success: #4ade80;
  --danger: #f87171;
  --warning: #fbbf24;
}
:root:where([data-theme="light"]) { color-scheme: light; }
/* Pages generated before the shell had its own components still link the
   basecoat CDN, which reads its own tokens and switches theme only on a
   .dark class. Bridged to the shell's, whatever of it those pages use takes
   the page's accent and follows the declared theme. Its --accent token is a
   hover tint, renamed in its theme as --color-accent; the shell's --accent is
   the brand colour, so the tint is derived from it here. */
:root {
  --background: var(--bg);
  --foreground: var(--text);
  --card: var(--surface);
  --card-foreground: var(--text);
  --popover: var(--surface);
  --popover-foreground: var(--text);
  --primary: var(--accent);
  --primary-foreground: var(--accent-contrast);
  --secondary: color-mix(in srgb, var(--text) 7%, var(--surface));
  --secondary-foreground: var(--text);
  --muted: color-mix(in srgb, var(--text) 5%, var(--surface));
  --muted-foreground: var(--text-muted);
  --color-accent: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --color-accent-foreground: var(--text);
  --destructive: var(--danger);
  --input: var(--border);
  --ring: var(--accent);
}
* { box-sizing: border-box; }
/* The reset the pages were written against: they all linked basecoat, which
   ships Tailwind's. Its components now live here, so the reset does too. */
*, ::before, ::after, ::backdrop { margin: 0; padding: 0; border: 0 solid; }
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }
a { color: inherit; text-decoration: inherit; }
b, strong { font-weight: bolder; }
ol, ul, menu { list-style: none; }
svg, video, canvas, iframe { display: block; vertical-align: middle; }
button, input, select, textarea { color: inherit; background-color: transparent; border-radius: 0; }
table { border-collapse: collapse; }
hr { height: 0; color: inherit; border-top-width: 1px; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }

.shell-container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.shell-section { padding: calc(var(--space) * 2) 0; }
.shell-grid { display: grid; gap: var(--space); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.shell-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: var(--space); }
.shell-footer { padding: 24px 0 40px; color: var(--text-muted); font-size: 13px; }

.shell-hero { padding: calc(var(--space) * 3) 0 calc(var(--space) * 2); }
.shell-hero h1 { font-size: clamp(26px, 4vw, 40px); line-height: 1.15; margin: 0 0 10px; text-wrap: balance; }
.shell-hero p { color: var(--text-muted); max-width: 60ch; margin: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space);
}

.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .kpi-value { font-size: 28px; font-weight: 650; line-height: 1.1; }
.kpi .kpi-label { font-size: 13px; color: var(--text-muted); }
.kpi .kpi-delta { font-size: 12.5px; font-weight: 600; }
.kpi .kpi-delta.up { color: var(--success); }
.kpi .kpi-delta.down { color: var(--danger); }

table.shell-table { border-collapse: collapse; width: 100%; font-size: 14px; }
table.shell-table th {
  text-align: left; font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600;
}
table.shell-table th, table.shell-table td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--border); }
table.shell-table td.num, table.shell-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.shell-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }

.chart-box { width: 100%; min-height: 220px; }
.chart-box svg { width: 100%; height: auto; display: block; }

.muted { color: var(--text-muted); }
.accent { color: var(--accent-text); }
.shell-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-text);
}

@media (prefers-reduced-motion: no-preference) {
  .shell-fade { animation: shell-fade 400ms ease both; }
  @keyframes shell-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* Layout and type utilities: what the pages kept spelling in style="".
   Spacing and type sizes follow Tailwind's scale; there is no Tailwind. */
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: var(--space); }
.between { justify-content: space-between; }
.grow { flex: 1 1 0; min-width: 0; }
.cols-2, .cols-3, .cols-4 { display: grid; gap: var(--space); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) {
  .cols-2, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1000px) { .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.m-0 { margin: 0; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.p-2 { padding: 8px; } .p-3 { padding: 12px; } .p-4 { padding: 16px; } .p-6 { padding: 24px; }
.text-xs { font-size: 12px; } .text-sm { font-size: 14px; } .text-base { font-size: 16px; }
.text-lg { font-size: 18px; } .text-xl { font-size: 20px; line-height: 1.35; }
.text-2xl { font-size: 24px; line-height: 1.25; } .text-3xl { font-size: 30px; line-height: 1.2; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.text-right { text-align: right; } .text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.w-full { width: 100%; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }

/* Components, with basecoat 1.0 markup (variants and sizes are data
   attributes) and the shell tokens, so a page needs neither component CSS
   nor a CSS framework. An older page that also links basecoat gets these
   rules after it, over the same properties. */
button, input, select, textarea { font: inherit; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: calc(var(--radius) - 2px);
  background: var(--accent); color: var(--accent-contrast);
  font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.btn:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn[data-variant="secondary"] { background: color-mix(in srgb, var(--text) 8%, var(--surface)); color: var(--text); }
.btn[data-variant="secondary"]:hover { background: color-mix(in srgb, var(--text) 14%, var(--surface)); }
.btn[data-variant="outline"] { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn[data-variant="ghost"] { background: transparent; color: var(--text); }
.btn[data-variant="outline"]:hover, .btn[data-variant="ghost"]:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.btn[data-variant="destructive"] { background: var(--danger); color: var(--bg); }
.btn[data-variant="destructive"]:hover { background: color-mix(in srgb, var(--danger) 86%, var(--text)); }
.btn[data-variant="link"] { height: auto; padding: 0; background: none; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.btn[data-size="sm"] { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[data-size="lg"] { height: 42px; padding: 0 20px; font-size: 15px; }
.btn[data-size="icon"] { width: 36px; padding: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border: 1px solid transparent; border-radius: 999px; background: var(--accent); color: var(--accent-contrast);
  font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.badge[data-variant="secondary"] { background: color-mix(in srgb, var(--text) 8%, var(--surface)); color: var(--text); }
.badge[data-variant="outline"] { background: transparent; color: var(--text); border-color: var(--border); }
.badge[data-variant="destructive"] { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }

.alert {
  display: grid; gap: 4px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 14px;
}
.alert h2, .alert h3 { margin: 0; font-size: 14px; font-weight: 600; }
.alert p, .alert section { margin: 0; color: var(--text-muted); }
.alert[data-variant="destructive"] { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); color: var(--danger); }

.card {
  display: flex; flex-direction: column; gap: 16px; padding: 20px 0;
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.card > header, .card > section, .card > footer { padding: 0 20px; }
.card > header { display: grid; gap: 4px; }
.card > header h2, .card > header h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.card > header p { margin: 0; color: var(--text-muted); font-size: 14px; }
.card > footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.input {
  width: 100%; min-height: 36px; padding: 6px 12px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px);
  background: var(--surface); color: var(--text); font-size: 14px;
}
textarea.input { min-height: 84px; resize: vertical; }
.input::placeholder { color: var(--text-muted); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
.field [role="alert"] { color: var(--danger); font-size: 13px; }

dialog.dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); margin: auto; padding: 0;
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  background: var(--surface); color: var(--text); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
dialog.dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog.dialog > div { display: grid; gap: 16px; padding: 24px; }
dialog.dialog header { display: grid; gap: 4px; }
dialog.dialog header h2 { margin: 0; font-size: 18px; font-weight: 600; }
dialog.dialog header p { margin: 0; color: var(--text-muted); font-size: 14px; }
dialog.dialog footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.tabs { display: grid; gap: 12px; }
.tabs > [role="tablist"] {
  display: inline-flex; gap: 4px; width: fit-content; max-width: 100%; padding: 4px; overflow-x: auto;
  border-radius: var(--radius); background: color-mix(in srgb, var(--text) 6%, var(--surface));
}
.tabs [role="tab"] {
  padding: 6px 12px; border: 0; border-radius: calc(var(--radius) - 4px); background: transparent;
  color: var(--text-muted); font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs [role="tabpanel"][hidden] { display: none; }

.accordion > details { border-bottom: 1px solid var(--border); }
.accordion > details > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; font-weight: 500; list-style: none; cursor: pointer;
}
.accordion > details > summary::-webkit-details-marker { display: none; }
.accordion > details > summary::after { content: "+"; color: var(--text-muted); font-size: 18px; line-height: 1; }
.accordion > details[open] > summary::after { content: "\2212"; }
.accordion > details > :not(summary) { margin: 0 0 14px; color: var(--text-muted); }

.toaster {
  position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column-reverse; gap: 8px;
  width: min(360px, calc(100vw - 32px)); pointer-events: none;
}
.toaster .toast { pointer-events: auto; transition: opacity 200ms ease, transform 200ms ease; }
.toaster .toast[aria-hidden="true"] { opacity: 0; transform: translateY(8px); }
.toaster .toast-content {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); font-size: 13px;
}
.toaster .toast-content h2 { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
.toaster .toast-content p { margin: 0; color: var(--text-muted); }

/* skipUI building blocks. */
.skip-table-search { max-width: 320px; margin-bottom: 12px; }
.skip-table-wrap { overflow-x: auto; }
table.shell-table th[data-sort] { cursor: pointer; user-select: none; }
table.shell-table th[aria-sort="ascending"]::after { content: " \25B2"; font-size: 9px; }
table.shell-table th[aria-sort="descending"]::after { content: " \25BC"; font-size: 9px; }
table.shell-table td.skip-table-empty { color: var(--text-muted); text-align: center; padding: 24px 0; }
.skip-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 13px; color: var(--text-muted); }
.toaster .toast[data-type="success"] .toast-content { border-left: 3px solid var(--success); }
.toaster .toast[data-type="error"] .toast-content { border-left: 3px solid var(--danger); }
