/* MaintMode Console stylesheet.
   Design tokens are ported verbatim from the finalized C1–C4 snapshots in
   maintmode-docs/design-snapshots-cloud/ (SPEC U11; teal accent, dark default
   + light via [data-theme="light"]). Screen-specific styles are appended by
   the screen tasks; keep the token blocks byte-comparable to the snapshots. */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/InterVariable.woff2") format("woff2-variations");
}

:root {
  --font-sans: "Inter Variable","Inter",ui-sans-serif,system-ui,-apple-system,
               BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Helvetica,Arial,sans-serif;
  --font-mono: ui-monospace,"SFMono-Regular","JetBrains Mono",Menlo,Consolas,monospace;

  --text-2xs:10px; --text-xs:11px; --text-sm:12px; --text-md:13px;
  --text-lg:14px; --text-xl:16px; --text-2xl:20px; --text-3xl:28px;
  --leading-tight:1.2; --leading-snug:1.35; --leading-normal:1.5;

  --space-1:2px; --space-2:4px; --space-3:6px; --space-4:8px;
  --space-5:12px; --space-6:16px; --space-7:20px; --space-8:24px;
  --space-9:32px; --space-10:48px;

  --radius-xs:3px; --radius-sm:4px; --radius-md:6px; --radius-lg:8px; --radius-xl:12px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06), 0 1px 1px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.10);

  /* Dark (default) */
  color-scheme: dark;
  --bg:#0A0A0B;
  --bg-elev-1:#0E0E10;
  --bg-elev-2:#131316;
  --bg-elev-3:#18181C;
  --bg-elev-4:#1F1F23;
  --bg-overlay: rgba(0,0,0,0.65);

  --bg-row-hover:#16161A;
  --bg-row-selected: rgba(45,212,191,0.10);
  --bg-row-selected-strong: rgba(45,212,191,0.18);

  --border-subtle:#1A1A1F;
  --border:#25252B;
  --border-strong:#34343C;

  --fg:#F5F5F7;
  --fg-strong:#FFFFFF;
  --fg-muted:#A1A1AA;
  --fg-dim:#71717A;
  --fg-disabled:#52525B;

  --accent:#2DD4BF;
  --accent-hover:#5EEAD4;
  --accent-pressed:#14B8A6;
  --accent-soft: rgba(45,212,191,0.14);
  --accent-soft-2: rgba(45,212,191,0.06);
  --accent-fg:#99F6E4;
  --focus-ring: 0 0 0 2px var(--bg-elev-1), 0 0 0 4px var(--accent);

  --destructive-fg:#F87171;
  --destructive-bg: rgba(248,113,113,0.10);
  --destructive-border: rgba(248,113,113,0.40);
  --destructive-solid:#DC2626;
  --destructive-solid-hover:#B91C1C;

  --org-status-trialing-fg:#5EB9F6;  --org-status-trialing-bg: rgba(94,185,246,0.12);
  --org-status-active-fg:#4ADE80;    --org-status-active-bg: rgba(74,222,128,0.10);
  --org-status-past_due-fg:#FACC15;  --org-status-past_due-bg: rgba(250,204,21,0.13);
  --org-status-suspended-fg:#F87171; --org-status-suspended-bg: rgba(248,113,113,0.10);
  --org-status-canceled-fg:#71717A;  --org-status-canceled-bg: rgba(113,113,122,0.08);
  --org-status-deleted-fg:#71717A;   --org-status-deleted-bg: rgba(113,113,122,0.06);

  --page-frame-bg:#050507;
}

[data-theme="light"] {
  color-scheme: light;
  --bg:#FFFFFF;
  --bg-elev-1:#FAFAFA;
  --bg-elev-2:#F4F4F5;
  --bg-elev-3:#EEEEF1;
  --bg-elev-4:#E4E4E7;
  --bg-overlay: rgba(0,0,0,0.45);

  --bg-row-hover:#F4F4F5;
  --bg-row-selected: rgba(13,148,136,0.08);
  --bg-row-selected-strong: rgba(13,148,136,0.14);

  --border-subtle:#F0F0F2;
  --border:#E4E4E7;
  --border-strong:#D4D4D8;

  --fg:#18181B;
  --fg-strong:#09090B;
  --fg-muted:#52525B;
  --fg-dim:#71717A;
  --fg-disabled:#A1A1AA;

  --accent:#0D9488;
  --accent-hover:#0B7E73;
  --accent-pressed:#0F766E;
  --accent-soft: rgba(13,148,136,0.10);
  --accent-soft-2: rgba(13,148,136,0.04);
  --accent-fg:#0F766E;
  --focus-ring: 0 0 0 2px var(--bg-elev-1), 0 0 0 4px var(--accent);

  --org-status-trialing-fg:#1E6FB5;  --org-status-trialing-bg: rgba(30,111,181,0.10);
  --org-status-active-fg:#166534;    --org-status-active-bg: rgba(22,101,52,0.08);
  --org-status-past_due-fg:#854D0E;  --org-status-past_due-bg: rgba(133,77,14,0.10);
  --org-status-suspended-fg:#B42318; --org-status-suspended-bg: rgba(180,35,24,0.08);
  --org-status-canceled-fg:#71717A;  --org-status-canceled-bg: rgba(113,113,122,0.06);
  --org-status-deleted-fg:#71717A;   --org-status-deleted-bg: rgba(113,113,122,0.06);

  --destructive-fg:#B42318;
  --destructive-bg: rgba(180,35,24,0.10);
  --destructive-border: rgba(180,35,24,0.35);

  --page-frame-bg:#E4E4E7;
}

/* Base — the app renders full-viewport pages (no snapshot stage frame). */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent-fg); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.mono { font-family: var(--font-mono); }

/* The hidden attribute must always win: several components set display on the
   same elements (.cta-loading, .dropdown), which would otherwise override it. */
[hidden] { display: none !important; }

/* ── Top bar (ported from C1/C2 snapshots) ─────────────────── */
.topbar {
  height: 44px;
  display: flex; align-items: center;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg-elev-1) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 12;
}
.brand-mark { font-size: 13px; font-weight: 500; letter-spacing: -0.005em; }
.brand-mark .b-prod { color: var(--fg-strong); font-weight: 600; }
.brand-mark .b-mod  { color: var(--accent-fg); font-weight: 500; margin-left: 6px; }

.topbar-nav { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 12px; }
.back-link { color: var(--fg-muted); }
.back-link:hover { color: var(--fg); text-decoration: none; }
.crumb-sep { color: var(--fg-dim); }
.breadcrumb { color: var(--fg-dim); white-space: nowrap; overflow: hidden; }
.breadcrumb .crumb-tail {
  color: var(--fg-muted);
  display: inline-block; max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: bottom;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; position: relative; }
.avatar-btn { display: flex; align-items: center; gap: 6px; border-radius: var(--radius-md); padding: 2px; }
.avatar {
  width: 28px; height: 28px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--bg-elev-3) 70%);
  border: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-strong);
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.avatar-chev { color: var(--fg-dim); display: flex; }

/* Account dropdown (U8 — not part of the snapshots, follows their language). */
.dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 220px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 20;
}
.dropdown-email {
  padding: 8px 10px 10px;
  font-size: 12px;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dropdown-item {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--fg);
}
.dropdown-item:hover { background: var(--bg-row-hover); }

/* ── App buttons (ported from C1 snapshot) ─────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 100ms ease, border-color 100ms ease, color 100ms ease;
  white-space: nowrap;
  font-family: inherit;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn.btn-primary {
  width: auto; height: 32px; font-size: 13px;
  background: var(--accent); color: #052E2A; border-color: var(--accent);
}
.btn.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.btn-primary:active { background: var(--accent-pressed); }
.btn.btn-primary svg { stroke-width: 2.25; }
.btn.btn-outline {
  width: auto; height: 32px; font-size: 13px;
  background: var(--bg-elev-2); border-color: var(--border); color: var(--fg);
}
.btn.btn-outline:hover { background: var(--bg-elev-3); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-muted); }
.btn-ghost:hover { color: var(--fg); background: var(--bg-elev-2); }

/* ── Page scaffold (C1/C2) ─────────────────────────────────── */
.page-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}
.page-header {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 24px 0 16px;
}
.page-header-text { flex: 1 1 auto; min-width: 0; }
.h1 {
  font-weight: 600; font-size: var(--text-2xl);
  line-height: var(--leading-tight); letter-spacing: -0.014em;
  color: var(--fg-strong); margin: 0;
}
.page-header-text .caption-row { margin-top: 4px; color: var(--fg-muted); font-size: 12px; }

/* ── Filter bar (C1) ───────────────────────────────────────── */
.filterbar {
  position: sticky; top: 44px; z-index: 9;
  background: color-mix(in srgb, var(--bg-elev-1) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}
.filterbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.search-row { position: relative; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--fg-dim); display: flex;
  pointer-events: none;
}
.search-input {
  width: 100%; height: 36px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 36px 0 36px;
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
.search-input::placeholder { color: var(--fg-dim); }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  padding: 6px;
  color: var(--fg-dim); display: none;
  border-radius: var(--radius-sm);
}
.search-clear:hover { color: var(--fg); background: var(--bg-elev-3); text-decoration: none; }
.search-row.has-value .search-clear { display: flex; }

.filter-row { display: flex; align-items: center; gap: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elev-2);
  color: var(--fg-muted);
  border: 1px solid var(--border-subtle);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease, border-color 100ms ease;
  white-space: nowrap;
  text-decoration: none;
}
.chip:hover { background: var(--bg-elev-3); color: var(--fg); text-decoration: none; }
.chip .chip-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-fg);
  border-color: rgba(45,212,191,0.35);
}
.chip[aria-pressed="true"] .chip-count { color: var(--accent-fg); opacity: 0.9; }
[data-theme="light"] .chip[aria-pressed="true"] { border-color: rgba(13,148,136,0.4); }

.deleted-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; }
.switch {
  position: relative;
  width: 32px; height: 18px;
  border-radius: 999px;
  background: var(--bg-elev-3);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  padding: 0;
  flex: 0 0 auto;
}
.switch::after {
  content: ""; position: absolute;
  left: 2px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px;
  background: var(--fg-muted);
  border-radius: 999px;
  transition: left 120ms ease, background 120ms ease;
}
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { left: 16px; background: #052E2A; }
.deleted-toggle-label { font-size: 12px; color: var(--fg-muted); }

/* ── Organizations table (C1) ──────────────────────────────── */
.table-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}
.thead, .trow {
  display: grid;
  grid-template-columns: 1.6fr 100px 110px 1.2fr 110px 130px 40px;
  align-items: center;
  gap: 12px;
}
.thead {
  position: sticky; top: 121px;
  background: var(--bg-elev-2);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 6;
  height: 36px;
  padding: 0 12px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}
.th-sort { color: var(--fg-muted); text-decoration: none; white-space: nowrap; }
.th-sort:hover { color: var(--fg); text-decoration: none; }
.trow {
  height: 52px;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 12px;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition: background 80ms ease;
}
.trow:hover { background: var(--bg-row-hover); text-decoration: none; }
.trow:focus-visible { background: var(--bg-row-hover); }
.trow.is-suspended { opacity: 0.7; }
.trow.is-deleted { opacity: 0.55; }
.trow.is-deleted .col-name .name-line,
.trow.is-deleted .col-name .slug-line { text-decoration: line-through; }

.col-name { min-width: 0; }
.name-line {
  font-size: 13px; font-weight: 500; color: var(--fg-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.25;
}
.slug-line {
  font-family: var(--font-mono);
  font-size: 11.5px; color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.col-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 4px; }
.status-dot { width: 8px; height: 8px; border-radius: 999px; flex: 0 0 auto; }
.status-label { font-size: 12px; font-weight: 500; color: var(--fg); white-space: nowrap; }
.status-trialing .status-dot { background: var(--org-status-trialing-fg); }
.status-active   .status-dot { background: var(--org-status-active-fg); }
.status-past_due .status-dot { background: var(--org-status-past_due-fg); }
.status-suspended .status-dot { background: var(--org-status-suspended-fg); }
.status-canceled .status-dot { background: var(--org-status-canceled-fg); }
.status-deleted  .status-dot { background: var(--org-status-deleted-fg); }
.col-seats {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--fg);
}
.col-seats.is-warn { color: var(--org-status-past_due-fg); }
.col-seats.is-over { color: var(--destructive-fg); }
.col-owner {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.col-created, .col-activity {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.col-activity.is-null { color: var(--fg-dim); }
.col-activity.is-deleted-info { color: var(--fg-dim); }
.seen-line { font-size: 11.5px; color: var(--fg-dim); margin-top: 1px; }
.seen-line.is-stale { color: var(--org-status-past_due-fg); }
.col-chev { color: var(--fg-dim); display: flex; justify-content: flex-end; }
.status-chip-deleted {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 8px;
  border-radius: var(--radius-sm);
  background: var(--org-status-deleted-bg);
  color: var(--org-status-deleted-fg);
  font-size: 11px; font-weight: 500;
}
.list-footer { display: flex; justify-content: center; padding: 24px 0 32px; }
.list-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 64px 0 48px;
}

/* ── Create sheet (C3) ─────────────────────────────────────── */
.sheet-overlay { position: fixed; inset: 0; z-index: 40; }
.scrim {
  position: absolute; inset: 0;
  background: var(--bg-overlay);
}
.sheet {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 560px;
  max-width: 100vw;
  background: var(--bg-elev-1);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: sheet-in 240ms ease;
}
@keyframes sheet-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.sheet-form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.sheet-header {
  flex: 0 0 auto;
  height: 56px;
  display: flex; align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.sh-tile {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.sh-title { font-size: 15px; font-weight: 600; color: var(--fg-strong); letter-spacing: -0.005em; }
.sh-close {
  margin-left: auto;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-muted);
  border-radius: var(--radius-sm);
}
.sh-close:hover { color: var(--fg); background: var(--bg-elev-3); }

.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px;
  display: flex; flex-direction: column;
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label-row { display: flex; align-items: center; gap: 4px; }
.label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--fg-muted);
}
.field-label-row .req { color: var(--accent); font-size: 12px; font-weight: 600; line-height: 1; }
.field-helper { font-size: 12px; color: var(--fg-dim); line-height: 1.4; }

.input {
  width: 100%;
  height: 36px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-strong);
  font-size: 13px;
  padding: 0 12px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.input::placeholder { color: var(--fg-dim); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.is-mono { font-family: var(--font-mono); font-size: 12.5px; }
.input.is-invalid { border-color: var(--destructive-border); box-shadow: 0 0 0 3px var(--destructive-bg); }

.stepper {
  display: inline-flex;
  width: 140px;
  height: 36px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  align-items: stretch;
}
.stepper.is-invalid { border-color: var(--destructive-border); box-shadow: 0 0 0 3px var(--destructive-bg); }
.stepper-btn {
  width: 36px;
  color: var(--fg-muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.stepper-btn:hover { color: var(--fg-strong); background: var(--bg-elev-3); }
.stepper-btn:disabled { color: var(--fg-disabled); cursor: not-allowed; }
.stepper-value {
  flex: 1 1 auto;
  background: transparent;
  border: 0;
  color: var(--fg-strong);
  font-family: var(--font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
  padding: 0;
  min-width: 0;
}
.stepper-value::-webkit-outer-spin-button,
.stepper-value::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.field-error {
  margin-top: 4px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--destructive-bg);
  border: 1px solid var(--destructive-border);
  border-radius: var(--radius-sm);
  color: var(--destructive-fg);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
}

.sheet-footer {
  flex: 0 0 auto;
  height: 64px;
  display: flex; align-items: center;
  padding: 0 24px;
  border-top: 1px solid var(--border-subtle);
  gap: 12px;
}
.footer-hint { font-size: 12px; color: var(--fg-muted); flex: 1 1 auto; }
.footer-hint.is-destructive { color: var(--destructive-fg); }
.footer-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.btn[disabled], .btn[aria-disabled="true"] {
  background: var(--bg-elev-3); border-color: var(--border);
  color: var(--fg-disabled); cursor: not-allowed;
}
.btn .cta-label, .btn .cta-loading { display: inline-flex; align-items: center; gap: 6px; }

.sheet-form.is-submitting .input,
.sheet-form.is-submitting .stepper { opacity: 0.85; cursor: wait; }
.sheet-form.is-submitting [data-sheet-dismiss] { pointer-events: none; color: var(--fg-disabled); }

/* Token panel (U5) */
.token-panel {
  padding: 24px;
  display: flex; flex-direction: column;
  gap: 16px;
}
.token-panel .stack-title { margin-bottom: 0; }
.token-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.token-value {
  flex: 1 1 auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg-strong);
  word-break: break-all;
  user-select: all;
}
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--fg-muted);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 12px;
}
.copy-btn:hover { color: var(--fg); background: var(--bg-elev-3); }
.copy-btn.is-copied { color: var(--accent-fg); }
.token-warning {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  background: var(--org-status-past_due-bg);
  border: 1px solid rgba(250,204,21,0.35);
  border-radius: var(--radius-sm);
  color: var(--org-status-past_due-fg);
  font-size: 12.5px;
  line-height: 1.4;
}

/* ── Organization detail (C2, 1040px density) ──────────────── */
.detail-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px 96px;
}
.page-header-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.page-header-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-header-meta {
  margin-top: 8px;
  display: flex; align-items: center;
  flex-wrap: wrap;
  color: var(--fg-muted);
  font-size: 11.5px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}
.page-header-meta .meta-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.page-header-meta .meta-sep { color: var(--fg-dim); padding: 0 8px; user-select: none; }
.page-header-meta .meta-id { color: var(--fg-dim); font-size: 11px; }

.is-deleted-org .page-header-title-row .h1 { text-decoration: line-through; }
.deleted-banner { font-size: 11.5px; font-style: italic; color: var(--fg-dim); padding: 4px 0 10px; }
.is-deleted-org .card-identity { opacity: 0.55; }

.copy-btn {
  padding: 2px;
  color: var(--fg-dim);
  display: inline-flex; align-items: center;
  border-radius: var(--radius-xs);
  transition: color 100ms ease, background 100ms ease;
}
.copy-btn:hover { color: var(--fg); background: var(--bg-elev-3); }
.copy-btn.is-copied { color: var(--accent-fg); }

.status-pill {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px; font-weight: 600;
  background: var(--pill-bg, var(--bg-elev-3));
  color: var(--pill-fg, var(--fg-muted));
  border: 1px solid var(--pill-border, transparent);
  white-space: nowrap;
  letter-spacing: 0.005em;
}
.status-pill.is-sm { height: 20px; padding: 0 7px; font-size: 11px; }
.pill-trialing  { --pill-fg: var(--org-status-trialing-fg);  --pill-bg: var(--org-status-trialing-bg);  --pill-border: rgba(94,185,246,0.30); }
.pill-active    { --pill-fg: var(--org-status-active-fg);    --pill-bg: var(--org-status-active-bg);    --pill-border: rgba(74,222,128,0.30); }
.pill-past_due  { --pill-fg: var(--org-status-past_due-fg);  --pill-bg: var(--org-status-past_due-bg);  --pill-border: rgba(250,204,21,0.30); }
.pill-suspended { --pill-fg: var(--org-status-suspended-fg); --pill-bg: var(--org-status-suspended-bg); --pill-border: rgba(248,113,113,0.30); }
.pill-canceled  { --pill-fg: var(--org-status-canceled-fg);  --pill-bg: var(--org-status-canceled-bg);  --pill-border: rgba(113,113,122,0.30); }
.pill-deleted   { --pill-fg: var(--org-status-deleted-fg);   --pill-bg: var(--org-status-deleted-bg);   --pill-border: rgba(113,113,122,0.25); }
[data-theme="light"] .pill-trialing  { --pill-border: rgba(30,111,181,0.30); }
[data-theme="light"] .pill-active    { --pill-border: rgba(22,101,52,0.30); }
[data-theme="light"] .pill-past_due  { --pill-border: rgba(133,77,14,0.30); }
[data-theme="light"] .pill-suspended { --pill-border: rgba(180,35,24,0.30); }

.card-stack { display: flex; flex-direction: column; gap: 16px; padding-bottom: 16px; }
.card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 24px;
  row-gap: 16px;
}
.field-cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label {
  font-weight: 600; font-size: 10px; line-height: 1;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--fg-muted);
}
.field-value {
  font-size: 13px; font-weight: 500;
  color: var(--fg-strong);
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.field-value .v-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.field-value.mono { font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--fg); }

.seats-view { display: flex; flex-direction: column; }
.seats-big {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.seats-caption { margin-top: 8px; font-size: 12px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.seats-bar {
  margin-top: 16px;
  height: 6px;
  width: 100%;
  background: var(--bg-elev-3);
  border-radius: var(--radius-xs);
  overflow: hidden;
  position: relative;
}
.seats-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent);
  border-radius: var(--radius-xs);
  transition: width 240ms ease, background 120ms ease;
}
.seats-bar-fill.is-warn { background: var(--org-status-past_due-fg); }
.seats-bar-fill.is-over { background: var(--destructive-fg); }
.seats-overage-caption { margin-top: 10px; font-size: 12px; font-weight: 500; color: var(--destructive-fg); }

.seats-roles {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.seats-roles-hint { font-size: 12px; color: var(--fg-muted); margin-bottom: 2px; }
.seats-role-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.seats-role-label { color: var(--fg-muted); }
.seats-role-counts {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.seats-role-active { font-family: var(--font-mono); color: var(--fg); }
.seats-role-active.is-zero { color: var(--fg-dim); }
.seats-role-pending { color: var(--fg-dim); }

.seats-edit { display: flex; flex-direction: column; gap: 8px; }
.seats-edit-label {
  font-weight: 600; font-size: 10px; line-height: 1;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--fg-muted);
}
.seats-edit-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }

.detail-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 64px;
  background: color-mix(in srgb, var(--bg-elev-1) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-subtle);
  z-index: 8;
  display: flex; align-items: center;
}
.detail-footer-inner {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.footer__left, .footer__right { display: flex; align-items: center; gap: 8px; }

.btn-destructive-text {
  background: var(--bg-elev-2);
  border-color: var(--destructive-border);
  color: var(--destructive-fg);
}
.btn-destructive-text:hover { background: var(--destructive-bg); }
.btn-accent-text {
  background: var(--bg-elev-2);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.btn-accent-text:hover { background: var(--accent-soft); }
.btn-destructive-solid {
  background: var(--destructive-solid);
  border-color: var(--destructive-solid);
  color: #fff;
}
.btn-destructive-solid:hover { background: var(--destructive-solid-hover); border-color: var(--destructive-solid-hover); }

/* ── Confirm dialogs (C2 modals) ───────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.modal-scrim { position: absolute; inset: 0; }
.modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 24px;
}
.modal-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.modal-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.modal-icon-suspend { background: var(--org-status-suspended-bg); color: var(--org-status-suspended-fg); }
.modal-icon-unsuspend { background: var(--accent-soft); color: var(--accent); }
.modal-icon-delete { background: var(--destructive-bg); color: var(--destructive-fg); }
.modal-title { flex: 1 1 auto; min-width: 0; padding-top: 8px; }
.modal-body {
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.55;
  margin-bottom: 16px;
}
.modal-consequences {
  background: var(--destructive-bg);
  border: 1px solid var(--destructive-border);
  border-left: 3px solid var(--destructive-solid);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--fg);
  line-height: 1.5;
  margin-bottom: 16px;
}
.modal-consequences .mc-strong { color: var(--destructive-fg); font-weight: 600; }
.modal-confirm-block { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.modal-confirm-caption { font-size: 12px; color: var(--fg-muted); }
.modal-confirm-expected { font-family: var(--font-mono); font-size: 12px; color: var(--fg); user-select: text; }
.modal-confirm-input {
  width: 100%;
  height: 36px;
  background: var(--bg-elev-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
.modal-confirm-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Login page (ported from C4 snapshot) ──────────────────── */
.auth-bg {
  position: fixed; inset: 0;
  background: radial-gradient(900px 520px at 50% 28%, var(--accent-soft-2), transparent 62%);
  pointer-events: none;
}
.auth-shell {
  position: relative;
  width: 400px;
  max-width: 100%;
  margin: 0 auto;
  padding-top: 168px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand-block { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.brand-wordmark {
  font-size: 18px; letter-spacing: -0.012em; line-height: 1;
  display: inline-flex; align-items: baseline; gap: 6px;
}
.brand-wordmark .b-prod { color: var(--fg-strong); font-weight: 600; }
.brand-wordmark .b-mod  { color: var(--accent-fg); font-weight: 500; }
.brand-domain { font-family: var(--font-mono); font-size: 11px; color: var(--fg-dim); letter-spacing: 0.01em; }

.card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: var(--shadow-md);
}
.card form { display: flex; flex-direction: column; gap: 16px; }
.card-title {
  font-size: var(--text-2xl); font-weight: 600;
  line-height: var(--leading-tight); letter-spacing: -0.014em;
  color: var(--fg-strong); text-align: center; margin: 0;
}
.card-caption {
  font-size: var(--text-md); color: var(--fg-muted); text-align: center;
  line-height: var(--leading-normal); max-width: 320px; margin: 0 auto;
}
.card-spacer-sm { height: 0; }

.btn-primary {
  appearance: none; width: 100%; height: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--accent); color: #052E2A;
  border: 1px solid var(--accent); border-radius: var(--radius-md);
  font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.004em;
  cursor: pointer; text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn-primary:active { background: var(--accent-pressed); border-color: var(--accent-pressed); }
.btn-primary[disabled], .btn-primary[aria-disabled="true"] { cursor: wait; opacity: 0.85; }
.btn-primary.is-loading { background: var(--bg-elev-3); border-color: var(--border); color: var(--fg-muted); cursor: wait; }
.btn-primary.is-disabled-hard { background: var(--bg-elev-3); border-color: var(--border); color: var(--fg-disabled); cursor: not-allowed; }
.btn-primary .cta-label, .btn-primary .cta-loading { display: inline-flex; align-items: center; gap: 10px; }

.btn-outline {
  appearance: none; width: 100%; height: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bg-elev-2); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: var(--text-lg); font-weight: 500; cursor: pointer; text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.btn-outline:hover { background: var(--bg-elev-3); border-color: var(--border-strong); text-decoration: none; }

.g-logo { width: 16px; height: 16px; }
.spinner { width: 14px; height: 14px; display: inline-block; animation: spin 800ms linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.divider { height: 1px; background: var(--border-subtle); width: 100%; margin: -2px 0; }
.footer-link-row { display: flex; justify-content: center; }
.text-link {
  font-size: var(--text-sm); font-weight: 500; color: var(--accent-fg);
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
  border-radius: var(--radius-xs); padding: 2px 4px; margin: -2px -4px;
}
.text-link:hover { text-decoration: underline; }
.text-link.arrow::after { content: "→"; font-weight: 500; }

.back-link-row { display: flex; justify-content: center; margin-bottom: -4px; }
.back-link {
  font-size: var(--text-sm); font-weight: 500; color: var(--accent-fg);
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
}
.back-link:hover { text-decoration: underline; }

.code-row { display: flex; justify-content: center; gap: 8px; margin: 0 auto; }
.code-cell {
  width: 44px; height: 52px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--fg-strong);
  font-family: var(--font-mono); font-size: 18px; font-weight: 500;
  text-align: center; outline: none; padding: 0;
  caret-color: var(--accent);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.code-cell:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--bg-elev-1), 0 0 0 4px var(--accent); }
.code-cell.is-invalid { border-color: var(--destructive-border); background: color-mix(in srgb, var(--destructive-bg) 60%, var(--bg-elev-2)); }
.code-row.shake { animation: shake 240ms ease-in-out 1; }
@keyframes shake {
  0% { transform: translateX(0); } 15% { transform: translateX(-6px); }
  35% { transform: translateX(5px); } 55% { transform: translateX(-4px); }
  75% { transform: translateX(3px); } 100% { transform: translateX(0); }
}
.mfa-sync-caption { font-size: var(--text-xs); color: var(--fg-dim); text-align: center; margin: 0; line-height: 1.3; }

.inline-error {
  width: 100%;
  background: var(--destructive-bg);
  border: 1px solid var(--destructive-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px; font-weight: 500;
  color: var(--destructive-fg);
  text-align: center;
}

/* ── Stack composition (error/empty/forbidden states) ──────── */
.stack { display: flex; flex-direction: column; align-items: center; padding: 4px 0; }
.stack-icon { color: var(--fg-dim); margin-bottom: 8px; }
.stack-title {
  font-size: 15px; font-weight: 600; color: var(--fg-strong);
  text-align: center; max-width: 320px; margin: 0 0 6px;
  line-height: 1.3; letter-spacing: -0.005em;
}
.stack-caption {
  font-size: var(--text-md); color: var(--fg-muted);
  text-align: center; max-width: 340px; margin: 0 0 16px;
  line-height: var(--leading-normal);
}
