/* WP-UI-1 (2026-10-23): the token block below matches the cost dashboard's (apps/cost/web/style.css), held identical by apps/cost/tests/test_web_style.py. */
/* tokens:begin (WP-UI-1, 2026-10-23). Identical in apps/cost/web/style.css and
   apps/portal/site/style.css; apps/cost/tests/test_web_style.py holds them identical and
   measures every text pairing at 4.5:1 and every control outline at 3:1 in both themes.
   Dark is the default; light follows the OS, or <html data-theme="light"> forces it. */
:root {
  color-scheme: dark;

  --color-surface-0: #0f1318;
  --color-surface-1: #151a21;
  --color-surface-2: #1c222b;
  --color-bg-subtle: #181d25;
  --color-border: #3d4655;
  --color-border-control: #667085;
  --color-text: #e8ebf0;
  --color-text-muted: #9ba5b4;
  --color-accent: #6f90ff;
  --color-accent-contrast: #0a0f1f;
  --color-accent-subtle: #1c2847;
  --color-danger: #ff7a70;
  --color-danger-bg: #3b1c1d;
  --color-success: #4cc46e;
  --color-success-bg: #14301d;
  --color-warning-text: #f2c44a;
  --color-warning-bg: #3a2f0b;
  --color-warning-border: #a98b1c;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.55);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  --radius: 6px;
  --radius-md: 8px; /* ops: the shell style writes 8px on every control */
  --radius-lg: 10px;

  --topbar-h: 56px;
  --gutter: 24px;
  --gutter-phone: 16px; /* ops name for the shell's --shell-gutter-phone */
  --content-max: 1440px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;

    --color-surface-0: #f3f4f6;
    --color-surface-1: #ffffff;
    --color-surface-2: #f6f7f9;
    --color-bg-subtle: #f6f7f9;
    --color-border: #dde1e6;
    --color-border-control: #7b8493;
    --color-text: #1a1d21;
    --color-text-muted: #5b6270;
    --color-accent: #2452e8;
    --color-accent-contrast: #ffffff;
    --color-accent-subtle: #e8eefd;
    --color-danger: #b3261e;
    --color-danger-bg: #fdecea;
    --color-success: #1a7f37;
    --color-success-bg: #eaf7ec;
    --color-warning-text: #7a5b00;
    --color-warning-bg: #fff6e0;
    --color-warning-border: #a37d00;

    --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    --shadow-2: 0 12px 32px rgba(16, 24, 40, 0.18);
  }
}

:root[data-theme="light"] {
  color-scheme: light;

  --color-surface-0: #f3f4f6;
  --color-surface-1: #ffffff;
  --color-surface-2: #f6f7f9;
  --color-bg-subtle: #f6f7f9;
  --color-border: #dde1e6;
  --color-border-control: #7b8493;
  --color-text: #1a1d21;
  --color-text-muted: #5b6270;
  --color-accent: #2452e8;
  --color-accent-contrast: #ffffff;
  --color-accent-subtle: #e8eefd;
  --color-danger: #b3261e;
  --color-danger-bg: #fdecea;
  --color-success: #1a7f37;
  --color-success-bg: #eaf7ec;
  --color-warning-text: #7a5b00;
  --color-warning-bg: #fff6e0;
  --color-warning-border: #a37d00;

  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-2: 0 12px 32px rgba(16, 24, 40, 0.18);
}
/* tokens:end */

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

html, body {
  margin: 0;
  background: var(--color-surface-0);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--color-accent); }

a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
main:focus { outline: none; }

.skip {
  position: absolute; left: 8px; top: -100px; z-index: 100;
  padding: 8px 12px; border-radius: var(--radius);
  background: var(--color-accent); color: var(--color-accent-contrast);
  font-weight: 600; text-decoration: none;
}
.skip:focus { top: 8px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 var(--gutter);
  background: var(--color-surface-1);
  border-bottom: 1px solid var(--color-border);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--color-text); font-weight: 700; font-size: 15px;
  letter-spacing: -0.01em; text-decoration: none;
}
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: var(--radius-md);
  background: var(--color-accent); color: var(--color-accent-contrast);
  font-size: 15px; font-weight: 800;
}
.crumbs ol {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 0;
  list-style: none; font-size: 13px; white-space: nowrap; overflow: hidden;
}
.crumbs li { color: var(--color-text-muted); }
.crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--color-text-muted); }
.crumbs [aria-current="page"] { color: var(--color-text); font-weight: 600; }

.content {
  max-width: var(--content-max); margin: 0 auto;
  padding: 24px var(--gutter) 48px;
  display: flex; flex-direction: column; gap: 20px;
}
.page-header {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 16px;
}
.page-title { display: flex; flex-direction: column; gap: 8px; min-width: min(320px, 100%); }
.page-title h1 {
  margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.015em;
  line-height: 1.2; overflow-wrap: anywhere;
}
.page-status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  color: var(--color-text-muted); font-size: 13px;
}
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px;
  padding: 0 14px; border: 1px solid var(--color-border-control);
  border-radius: var(--radius-md); background: var(--color-surface-1);
  color: var(--color-text); font: inherit; font-size: 13.5px; font-weight: 600;
  white-space: nowrap; cursor: pointer;
}
.button:hover:not(:disabled) { border-color: var(--color-accent); }
.button:disabled { opacity: 0.5; cursor: not-allowed; }

.empty { margin: 0; padding: 16px; color: var(--color-text-muted); }

@media (max-width: 639.98px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .crumbs li:not(:last-child) { display: none; }
  .crumbs li:last-child::before { content: none; }
  .content { padding: 16px var(--gutter-phone) 32px; }
  .page-title h1 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ---- sections -------------------------------------------------------- */
#sections { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
#sections > section > h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.snote { margin: 0 0 12px; font-size: 13px; color: var(--color-text-muted); }

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  display: flex; flex-direction: column; min-width: 0; padding: 16px;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-surface-1); box-shadow: var(--shadow-1); overflow: clip;
}
.card:hover { border-color: var(--color-border-control); }

.cname { font-size: 14px; font-weight: 650; }
.cname a { color: var(--color-text); text-decoration: none; }
.cname a:hover { color: var(--color-accent); text-decoration: underline; }

.host {
  margin-top: 2px; font-family: var(--font-mono); font-size: 12.5px;
  color: var(--color-text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note {
  margin-top: 8px; font-size: 13px; line-height: 1.45; color: var(--color-text-muted);
}

.foot {
  display: flex; flex-wrap: wrap; gap: 16px; margin: auto -16px -16px;
  padding: 10px 16px; border-top: 1px solid var(--color-border); font-size: 13px;
}
.card > :has(+ .foot) { margin-bottom: 16px; }
.foot a { color: var(--color-accent); font-weight: 600; text-decoration: none; }
.foot a:hover { text-decoration: underline; }

.empty.bad {
  padding: var(--space-3) var(--space-4); border-radius: var(--radius);
  background: var(--color-danger-bg); color: var(--color-danger);
}

.page-foot {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px;
  font-size: 12px; line-height: 1.6; color: var(--color-text-muted);
}
#build { font-family: var(--font-mono); }
