/* ============================================================
   Combiner Workspace: design tokens & base styles
   Visual system: precise developer-infrastructure SaaS.
   Hanken Grotesk (UI) + JetBrains Mono (code/numbers).
   ============================================================ */

:root {
  /* accent is overridden by Tweaks; default = cobalt */
  --accent: #2563eb;
  --accent-press: color-mix(in oklch, var(--accent) 84%, black);
  --accent-soft: color-mix(in oklch, var(--accent) 12%, white);
  --accent-softer: color-mix(in oklch, var(--accent) 6%, white);
  --accent-ink: #ffffff;
  --accent-ring: color-mix(in oklch, var(--accent) 35%, transparent);
  /* darker accent for small text on --accent-soft; holds WCAG AA on the cobalt soft tint */
  --accent-on-soft: color-mix(in oklch, var(--accent) 85%, black);

  /* credits get their own currency color (warm) */
  --credit: #b06f12;
  --credit-soft: #fbf2e2;

  /* semantic status */
  --ok: #1a7f4b;
  --ok-soft: #e8f5ed;
  --danger: #c5362b;
  --danger-soft: #fcecea;
  --warn: #9c6a09;
  --warn-soft: #fbf2dd;

  /* neutrals: cool */
  --canvas: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f2f4f7;
  --ink: #0c0e15;
  --ink-2: #515a68;
  --ink-3: #828c9b;
  --border: #e8eaef;
  --border-2: #dde0e7;
  --border-strong: #cdd2db;

  /* shape & motion */
  --r-sm: 6px;
  --r: 9px;
  --r-lg: 13px;
  --r-xl: 18px;
  --shadow-sm: 0 1px 2px rgba(12,14,21,.05);
  --shadow: 0 1px 2px rgba(12,14,21,.05), 0 4px 14px -6px rgba(12,14,21,.10);
  --shadow-lg: 0 12px 40px -12px rgba(12,14,21,.22);
  --ease: cubic-bezier(.32,.72,0,1);

  /* density: overridden by Tweaks */
  --pad: 22px;
  --gap: 18px;
  --row-h: 46px;
  --fs: 14.5px;

  --sidebar-w: 248px;
  --font-ui: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  color-scheme: light;
}

[data-density="compact"] {
  --pad: 15px;
  --gap: 12px;
  --row-h: 38px;
  --fs: 13.5px;
}

[data-theme="dark"] {
  --accent-soft: color-mix(in oklch, var(--accent) 26%, #161922);
  --accent-softer: color-mix(in oklch, var(--accent) 15%, #12151d);
  --accent-ring: color-mix(in oklch, var(--accent) 45%, transparent);
  /* dark soft tint is already dark; keep the brighter accent as the foreground */
  --accent-on-soft: var(--accent);

  --credit: #e3a24c;
  --credit-soft: #2a2113;

  --ok: #41c486;
  --ok-soft: #14271e;
  --danger: #f0796d;
  --danger-soft: #2b1816;
  --warn: #e2b25a;
  --warn-soft: #2a2212;

  --canvas: #0a0c11;
  --surface: #12151d;
  --surface-2: #161922;
  --surface-3: #1c2029;
  --ink: #eef0f4;
  --ink-2: #9aa3b2;
  --ink-3: #6b7384;
  --border: #232733;
  --border-2: #2c313e;
  --border-strong: #383e4d;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px -8px rgba(0,0,0,.6);
  --shadow-lg: 0 16px 50px -12px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs);
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv01";
}

::selection { background: var(--accent-ring); }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }

a { color: inherit; }

/* Code, identifiers, monospace and numeric runs are kept LTR and bidi-isolated
   so that in a future RTL context the bidi algorithm never reorders URLs,
   tool ids, request ids, timestamps or numbers. */
code, .mono, pre { font-family: var(--font-mono); font-feature-settings: normal; direction: ltr; unicode-bidi: isolate; }

.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; direction: ltr; unicode-bidi: isolate; }

/* generic LTR-isolation utility for any other identifier/URL not in <code>/.num */
.ltr { direction: ltr; unicode-bidi: isolate; }

/* scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid var(--canvas); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---- reusable atoms ---- */

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }

.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

/* pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-block: 2px;
  padding-inline: 8px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
  border: 1px solid var(--border-2);
  background: var(--surface-3);
  color: var(--ink-2);
}
.pill .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.pill.ok      { color: var(--ok);     background: var(--ok-soft);     border-color: color-mix(in oklch, var(--ok) 30%, transparent); }
.pill.danger  { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in oklch, var(--danger) 30%, transparent); }
.pill.warn    { color: var(--warn);   background: var(--warn-soft);   border-color: color-mix(in oklch, var(--warn) 30%, transparent); }
.pill.accent  { color: var(--accent-on-soft); background: var(--accent-soft); border-color: color-mix(in oklch, var(--accent) 28%, transparent); }
.pill.credit  { color: var(--credit); background: var(--credit-soft); border-color: color-mix(in oklch, var(--credit) 30%, transparent); }

/* button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: var(--r);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .08s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 16px; height: 16px; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(12,14,21,.12), inset 0 1px 0 rgba(255,255,255,.16);
}
.btn.primary:hover { background: var(--accent-press); border-color: var(--accent-press); }

.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }

.btn.danger { color: var(--danger); border-color: color-mix(in oklch, var(--danger) 35%, transparent); background: var(--surface); }
.btn.danger:hover { background: var(--danger-soft); }

.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 30px; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* inputs */
.field {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}
.field::placeholder { color: var(--ink-3); }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
/* DEAD CSS: no rendered <select> carries class="field" (tools.html,
   profile_assignments.html emit bare <select>). Preserved-by-move in CSP PR4
   to keep the change mechanical; whether the selects adopt .field is a
   deferred design call. See TODOS.md "select.field is dead CSS". */
select.field { cursor: pointer; appearance: none;
  background-image: url("/static/select-chevron.svg");
  background-repeat: no-repeat; background-position: right 11px center; padding-inline-end: 34px;
}
/* mirror the chevron side under RTL (background-position has no logical keyword) */
[dir="rtl"] select.field { background-position: left 11px center; }


/* fade/slide in for route changes: transform-only so content is never
   hidden if the animation is paused (e.g. backgrounded tab) */
@keyframes riseIn { from { transform: translateY(7px); } to { transform: none; } }
.rise { animation: riseIn .32s var(--ease) both; }

/* ============================================================
   App shell: direction-agnostic (logical) + responsive.
   A single dir="rtl" on the root mirrors all of this for free.
   ============================================================ */

.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.app-aside {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  position: sticky; inset-block-start: 0; height: 100vh;
  padding-block: 18px; padding-inline: 14px;
  z-index: 80;
}
.app-col { min-width: 0; display: flex; flex-direction: column; }
.app-main { padding-block: 30px 80px; padding-inline: 34px; max-width: 1180px; width: 100%; }

/* top-nav layout variant */
.app-top {
  position: sticky; inset-block-start: 0; z-index: 50;
  background: color-mix(in oklch, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-block-end: 1px solid var(--border);
}
.app-top-inner { max-width: 1180px; margin-inline: auto; padding-inline: 24px; height: 60px; display: flex; align-items: center; gap: 22px; }
.app-main.centered { margin-inline: auto; }

/* mobile-only chrome (hidden on desktop) */
.app-topbar { display: none; }
.app-scrim { display: none; }

/* nav items: class-driven so server templates reuse them verbatim */
.app-nav { display: flex; flex-direction: column; gap: 18px; flex: 1; overflow: auto; }
.app-navgroup > .eyebrow { padding-inline: 8px; padding-block-end: 7px; }
.app-navgroup-items { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  appearance: none; box-sizing: border-box; cursor: pointer; text-align: start;
  display: flex; align-items: center; gap: 10px;
  inline-size: 100%; padding-block: 8px; padding-inline: 11px;
  border: 0; background: transparent; border-radius: 9px;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  text-decoration: none;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.nav-item:hover { background: var(--surface-3); }
.nav-item[aria-current="page"] { background: var(--surface-3); color: var(--ink); }
.nav-item .ic { color: var(--ink-3); }
.nav-item[aria-current="page"] .ic { color: var(--accent); }
.nav-item.h { inline-size: auto; padding-inline: 13px; }
.nav-item.h[aria-current="page"] { background: var(--accent-soft); color: var(--accent-on-soft); }

/* responsive: collapse the sidebar into an off-canvas drawer */
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; inset-block-start: 0; z-index: 70;
    height: 56px; padding-inline: 14px;
    background: color-mix(in oklch, var(--surface) 90%, transparent);
    backdrop-filter: blur(10px);
    border-block-end: 1px solid var(--border);
  }
  .app-aside {
    position: fixed; inset-block: 0; inset-inline-start: 0;
    inline-size: min(86vw, var(--sidebar-w)); height: 100dvh;
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  [dir="rtl"] .app-aside { transform: translateX(100%); }
  .app-shell[data-nav-open="true"] .app-aside { transform: none; }
  .app-scrim {
    display: block; position: fixed; inset: 0; z-index: 75;
    background: color-mix(in oklch, var(--ink) 40%, transparent);
    opacity: 0; pointer-events: none; transition: opacity .28s var(--ease);
  }
  .app-shell[data-nav-open="true"] .app-scrim { opacity: 1; pointer-events: auto; }
  .app-main { padding-block: 18px 64px; padding-inline: 16px; }
  .app-top-inner { padding-inline: 14px; }
}
@media (min-width: 921px) {
  .app-topbar, .app-scrim { display: none !important; }
}

/* ---- responsive layout utilities (replace ad-hoc inline grids) ---- */
.grid { display: grid; gap: var(--gap); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.split  { grid-template-columns: 1.55fr 1fr; align-items: start; }
.grid.start { align-items: start; }

/* wide tables scroll inside their container instead of breaking the page
   (mirrors the server templates' .table-scroll pattern) */
.table-scroll { overflow-x: auto; max-width: 100%; }

@media (max-width: 980px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 920px) {
  .split  { grid-template-columns: 1fr; }
  .cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
}

/* ============================================================
   Server-template appendix.
   Legacy element + component classes used by the Jinja screens,
   restyled onto the token system above. Logical properties only,
   so the shared style layer stays RTL-clean (no physical left/right).
   ============================================================ */

/* No-JS mobile drawer. tokens.css positions the off-canvas aside and
   opens it from [data-nav-open="true"] (set by JS in the React proto).
   This repo ships no JS, so a hidden checkbox drives the same open
   state via :checked, without modifying tokens.css. */
.nav-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
@media (max-width: 920px) {
  .nav-toggle:checked ~ .app-shell .app-aside { transform: none; }
  .nav-toggle:checked ~ .app-shell .app-scrim { opacity: 1; pointer-events: auto; }
}
@media (min-width: 921px) {
  .app-topbar-toggle { display: none; }
}

/* page rhythm for screens still using bare <h2> section headers */
.app-main h2 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; margin-block: 26px 12px; }
.app-main > h2:first-child { margin-block-start: 0; }
.app-main p { margin-block: 0 12px; max-width: 70ch; }

/* tables (bare + .table-scroll) adopt the token table look */
.table-scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--border); border-radius: var(--r-lg); margin-block: 12px 18px; background: var(--surface); }
.table-scroll > table { min-width: max-content; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); padding-block: 10px; padding-inline: 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
td { padding-block: 9px; padding-inline: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--ink); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.row-denied, tr.row-denied:hover { background: color-mix(in oklch, var(--danger) 5%, var(--surface)); }

/* text helpers */
.timestamp { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); direction: ltr; unicode-bidi: isolate; }
.reason-code { color: var(--ink-2); font-size: 12px; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* legacy status pill -> token pill tones */
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding-block: 2px; padding-inline: 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.45; white-space: nowrap; border: 1px solid var(--border-2); background: var(--surface-3); color: var(--ink-2); text-transform: capitalize; }
.status-pill[data-status="allowed"], .status-pill[data-status="active"] { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in oklch, var(--ok) 30%, transparent); }
.status-pill[data-status="denied"], .status-pill[data-status="revoked"] { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in oklch, var(--danger) 30%, transparent); }
.status-pill[data-status="pending"] { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in oklch, var(--warn) 30%, transparent); }
.status-pill[data-status="neutral"] { color: var(--ink-2); background: var(--surface-3); border-color: var(--border-2); }

/* forms: bare controls adopt the .field / .btn look */
.form-panel { padding-block: var(--pad); border-block: 1px solid var(--border); margin-block: 14px 18px; }
label { display: block; margin-block: 12px 5px; font-weight: 600; font-size: 12px; letter-spacing: 0.01em; color: var(--ink-2); }
input[type=email], input[type=password], input[type=text], input[type=number], input[type=search], select, textarea { width: 100%; max-width: 30rem; min-height: 40px; padding-block: 0; padding-inline: 12px; border-radius: var(--r); border: 1px solid var(--border-2); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
textarea { min-height: 9rem; padding-block: 9px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding-block: 0; padding-inline: 15px; border-radius: var(--r); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
button:hover { background: var(--accent-press); border-color: var(--accent-press); }
button.secondary { background: var(--surface); border-color: var(--border-2); color: var(--ink); }
button.secondary:hover { background: var(--surface-3); border-color: var(--border-strong); }
button.destructive { background: var(--surface); border-color: color-mix(in oklch, var(--danger) 35%, transparent); color: var(--danger); }
button.destructive:hover { background: var(--danger-soft); }

/* notices */
.flash, .alert-error { padding-block: 10px; padding-inline: 13px; margin-block: 8px 16px; border-radius: var(--r); border: 1px solid; font-size: 13.5px; font-weight: 550; }
.flash { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in oklch, var(--ok) 30%, transparent); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in oklch, var(--danger) 30%, transparent); }

/* connect page */
.connect-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 22px 12px; border-bottom: 1px solid var(--border); }
.connect-tabs a { padding-block: 7px; padding-inline: 11px; color: var(--ink-2); text-decoration: none; border: 1px solid transparent; border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; font-weight: 600; font-size: 13px; }
.connect-tabs a[aria-selected="true"] { color: var(--ink); background: var(--surface); border-color: var(--border); margin-block-end: -1px; }
.connect-advanced { margin-block-start: 18px; }
.connect-advanced > summary, .rotate-disclosure > summary { cursor: pointer; padding-block: 6px; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.rotate-disclosure { margin-block-start: 8px; }

/* avatar block used in the sidebar / admin identity chips */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 8px; font-weight: 700; letter-spacing: -0.02em; color: var(--accent-on-soft); background: var(--accent-soft); border: 1px solid color-mix(in oklch, var(--accent) 25%, transparent); }
/* compact avatar chip for table rows (members list) */
.avatar-sm { inline-size: 28px; block-size: 28px; font-size: 11px; }
/* profile-card icon badge */
.avatar-md { inline-size: 34px; block-size: 34px; }

/* profiles: card grid (logical props only; sits after .card so the
   .card.profile-create override below wins on background + shadow) */
.profile-card { display: flex; flex-direction: column; gap: 12px; padding-block: 18px; padding-inline: var(--pad); }
.profile-card-head { display: flex; align-items: center; gap: 10px; }
.profile-card-name { font-weight: 650; font-size: 15px; }
.profile-card-stats { display: flex; gap: 16px; font-size: 12.5px; }
.profile-card-actions { display: flex; gap: 8px; }
.profile-card-actions > .btn { flex: 1; }
.card.profile-create { align-items: center; justify-content: center; gap: 10px; text-align: center; border-style: dashed; border-color: var(--border-2); background: transparent; box-shadow: none; text-decoration: none; color: inherit; block-size: 100%; }
.card.profile-create:hover { border-color: var(--border-strong); background: var(--surface-2); }
.profile-create-title { font-weight: 600; font-size: 14px; }

/* page header + section panels (server-template reskin) */
.page-head { margin-block-end: var(--gap); }
.page-head h1 { font-size: 22px; line-height: 1.15; }
.page-head > p { margin-block: 5px 0; }
.stack > * + * { margin-block-start: var(--gap); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 13px; padding-inline: var(--pad); border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 15px; margin: 0; }
.panel-head .muted { font-size: 13px; font-weight: 500; }
.panel-body { padding-block: var(--pad); padding-inline: var(--pad); }
.panel-body > *:first-child { margin-block-start: 0; }
.panel-body > *:last-child { margin-block-end: 0; }
.panel > .table-scroll { border: 0; border-radius: 0; margin: 0; background: transparent; }
.panel .form-panel { border: 0; padding: 0; margin: 0; }

/* overview tiles + connect card */
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding-block: 16px; padding-inline: 18px; }
.tile .eyebrow { margin-block-end: 10px; }
.tile .metric { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; }
.tile .tile-foot { margin-block-start: 6px; font-size: 12.5px; color: var(--ink-2); }
.copyline { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface-2); padding-block: 9px; padding-inline: 12px; }
.copyline code { flex: 1; min-width: 0; overflow: auto; white-space: nowrap; font-size: 13px; }
.svc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 12px; border-block-start: 1px solid var(--border); }
.svc-row:first-child { border-block-start: 0; }

/* denials metric turns red only when there are blocks to surface */
.tile .metric.danger { color: var(--danger); }

/* overview activity + needs-attention feeds (logical props only, RTL-clean) */
.feed-row { display: flex; align-items: center; gap: 11px; padding-block: 11px; padding-inline: var(--pad); border-block-start: 1px solid var(--border); text-decoration: none; color: inherit; }
.feed-row:first-child { border-block-start: 0; }
a.feed-row:hover { background: var(--surface-2); }
.feed-main { flex: 1; min-width: 0; }
.feed-sub { margin-block-start: 1px; font-size: 12.5px; }
.feed-dot { inline-size: 8px; block-size: 8px; border-radius: 99px; flex: none; background: var(--ink-3); }
.feed-dot.ok { background: var(--ok); }
.feed-dot.danger { background: var(--danger); }
.feed-empty { padding-block: 14px; padding-inline: var(--pad); }

/* connect: numbered setup steps */
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.setup-steps li { display: flex; gap: 12px; }
.step-num { flex: none; inline-size: 24px; block-size: 24px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-on-soft); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.step-title { font-weight: 600; font-size: 13.5px; }

/* members: avatar + email cell */
.member-cell { display: inline-flex; align-items: center; gap: 10px; }

/* admin operator shell: dark top bar */
.admin-top { position: sticky; inset-block-start: 0; z-index: 50; background: var(--ink); color: var(--canvas); border-block-end: 1px solid color-mix(in oklch, #ffffff 12%, transparent); }
.admin-top-inner { max-width: 1120px; margin-inline: auto; padding-inline: 22px; min-height: 58px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.admin-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.admin-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: color-mix(in oklch, var(--canvas) 62%, transparent); border: 1px solid color-mix(in oklch, #ffffff 20%, transparent); border-radius: 999px; padding-block: 3px; padding-inline: 8px; }
.admin-top nav { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.admin-top nav a, .admin-logout button { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding-block: 0; padding-inline: 11px; border-radius: var(--r-sm); color: color-mix(in oklch, var(--canvas) 78%, transparent); text-decoration: none; font-weight: 600; font-size: 13px; border: 0; background: transparent; cursor: pointer; font-family: inherit; }
.admin-top nav a:hover, .admin-logout button:hover { background: color-mix(in oklch, #ffffff 10%, transparent); color: var(--canvas); }
.admin-top nav a[aria-current="page"] { background: color-mix(in oklch, #ffffff 15%, transparent); color: var(--canvas); }
.admin-spacer { flex: 1; }
.admin-email { font-size: 12.5px; color: color-mix(in oklch, var(--canvas) 70%, transparent); }
.admin-main { max-width: 1120px; margin-inline: auto; padding-block: 28px 64px; padding-inline: 22px; }
.admin-main .page-head h1 { font-size: 22px; }

/* onboarding: centered card */
.onb-top { display: flex; align-items: center; gap: 10px; min-height: 60px; padding-inline: 22px; border-block-end: 1px solid var(--border); }
.onb-wrap { min-height: calc(100dvh - 60px); display: grid; place-items: center; padding: 22px; }
.onb-card { inline-size: min(520px, 100%); padding-block: 28px; padding-inline: var(--pad); }

/* ============================================================
   PR 5 — inline-style de-inlining layer (zero visual change).
   Each former inline-style attribute resolves to ONE of three outcomes,
   decided PER ELEMENT by a computed-style diff (owner + member, LTR +
   forced dir="rtl"), proving the migrated property computes identically:

     DELETE  — a MORE-specific rule already computes the same value, so the
               attribute was redundant. No class is added; the cascade
               already supplies the value. (Used for the .panel-body
               first/last-child margin resets only.)
     CLASS   — no other rule touches the property; a plain semantic/utility
               class reproduces the declaration (it only competes with
               inherited/UA defaults, which a class beats).
     SCOPED  — an equal/less-specific rule computes a DIFFERENT value (the
               inline was OVERRIDING it). A plain class (0,0,1,0) would lose
               to .app-main p / .page-head > p (0,0,1,1), and deleting would
               bring the rule's value back. So out-specify with an
               element-qualified, root-anchored selector (0,0,2,1) that wins
               on specificity, not just source order.

   Placed LAST so source order also favours these at EQUAL specificity.
   Logical box properties only (inline/block); the RTL denylist guards it.

   FUTURE-EDIT OWNERSHIP: the DELETE outcomes now depend on
   `.app-main p`, `.page-head > p`, and `.panel-body > *:first/last-child`.
   Editing those selectors silently regresses a de-inlined element, and
   neither the one-time computed-style harness nor the static "0 inline
   style" gate can catch it. Whoever edits those selectors owns the
   dependent elements below. (Conscious delete-first trade-off; PR 5.)
   ============================================================ */

/* --- workspace shell: sidebar brand header + footer identity (_base.html) --- */
.app-aside-head { padding-block: 4px 16px; padding-inline: 6px; }
.app-brand { display: flex; align-items: center; gap: 11px; }
.app-brand-mark { flex: none; }
.app-brand-text { min-inline-size: 0; }
.app-user { border-block-start: 1px solid var(--border); padding-block-start: 12px; margin-block-start: 12px; }
.app-user-row { display: flex; align-items: center; gap: 10px; }
.app-user-text { flex: 1; min-inline-size: 0; }
.app-user-email { font-weight: 600; font-size: 13px; }
.app-user-signout { margin-block-start: 10px; }

/* brand wordmark type, shared by the sidebar header, mobile top bar, and the
   onboarding brand; `.tight` adds the sidebar's 1.1 line-height (the top bar
   and onboarding keep the inherited 1.5). Off-scale 15px kept verbatim. */
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.brand-name.tight { line-height: 1.1; }

/* 32px avatar variant for the sidebar identity chip — no 32px step existed
   (.avatar-sm 28px, .avatar-md 34px); kept off-scale, logical sizing. */
.avatar-32 { inline-size: 32px; block-size: 32px; font-size: 12px; }

/* small off-scale meta caption (host line + role label); kept at 11.5px */
.text-meta { font-size: 11.5px; }

/* single-line truncation combo (sidebar brand name + footer email) */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* a full-bleed button (sidebar "Sign out"): logical 100% inline-size */
.btn.block { inline-size: 100%; }

/* connect: section sub-headers (<h3>); beats h1..h4{margin:0} by class */
.section-subhead { font-size: 13px; margin-block: 16px 6px; }

/* inline <code> slug shown beside a page-head <h1> (smaller than the title) */
.title-code { font-size: 15px; }

/* home overview: credit/activity metric typography (bare nodes, no rivals) */
.fw-600 { font-weight: 600; }                                /* svc/activity/denial labels */
.svc-id { font-size: 12px; }                                 /* service id caption */
.svc-remaining { font-weight: 650; }                         /* "N" remaining run (.num) */
.svc-remaining-unit { font-weight: 500; font-size: 11px; }   /* "left" unit */

/* eyebrow status tints — component modifiers in the file's idiom
   (.pill.ok / .metric.danger); collision-free, no bare .ok/.danger exist */
.eyebrow.ok { color: var(--ok); }
.eyebrow.danger { color: var(--danger); }
.mbs-12 { margin-block-start: 12px; }   /* spacing above the "Will revoke" eyebrow */

/* table column: the three "Next action" <th> headers (a header width, NOT a
   select width — the filter select is 12rem, the admin search input 14rem) */
.col-action { min-inline-size: 14rem; }

/* filter controls — role-split widths (deliberately separate classes).
   Element-qualified so they out-specify the bare control rule
   `input[type=text],…,select,textarea { width: 100% }` (0,0,1,1); a plain
   class (0,0,1,0) loses to the attribute-qualified input selector and the
   control would snap back to 100% width. */
select.select-filter { inline-size: auto; min-inline-size: 12rem; }   /* tools profile <select> */
input.input-search { inline-size: auto; min-inline-size: 14rem; }     /* admin credits search <input> */

/* CLASS spacing SETs (no competing rule; deletion would lose the value) */
.mbe-gap { margin-block-end: var(--gap); }   /* top metric/card grids */
.m-0 { margin: 0; }                          /* <label> reset (beats the `label` rule); admin logout <form> */
.admin-pagefoot { padding-block: 12px; padding-inline: var(--pad); margin: 0; }  /* credits pager line */

/* onboarding card: type + controls (in .onb-card, only UA <p>/<h1> compete) */
.onb-title { font-size: 23px; margin-block-end: 5px; }
.onb-lead { margin-block: 0 18px; }
.onb-hint { font-size: 12px; margin-block: 5px 0; }
.onb-submit-row { margin-block: 22px 0; }
.onb-submit { inline-size: 100%; block-size: 44px; }

/* SCOPED overrides — out-specify the structural <p> rules (0,0,2,1 > 0,0,1,1) */
.app-main p.flush { margin: 0; }   /* breadcrumb <p class="muted"> + profile-create card note */
.app-main p.flush-end, .admin-main p.flush-end { margin-block-end: 0; }  /* form-final <p><button> */

/* SB-3F Service Bundles overview (/{slug}/services).
   Availability and readiness are NOT allow/deny verdicts, so they use their
   own data-attributed pills rather than reusing .status-pill green/red. */
.bundle-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-block-end: 4px; }
.bundle-tool {
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  background: var(--surface-3);
  color: var(--ink-2);
}
.bundle-tool[data-cost="free"] {
  color: var(--ok);
  border-color: color-mix(in oklch, var(--ok) 30%, transparent);
  background: var(--ok-soft);
}
.bundle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  border: 1px solid var(--border-2);
  background: var(--surface-3);
  color: var(--ink-2);
}
.bundle-pill[data-availability="available"] {
  color: var(--accent-on-soft);
  background: var(--accent-soft);
  border-color: color-mix(in oklch, var(--accent) 28%, transparent);
}
.bundle-pill[data-availability="disabled"],
.bundle-pill[data-availability="locked"] {
  color: var(--ink-2);
  background: var(--surface-3);
  border-color: var(--border-2);
}
.bundle-readiness { font-size: 13px; color: var(--ink-2); }

/* SB-3F Services overview cards. The bundle cards reuse the Profiles card
   shell (.card.profile-card) plus the bundle-* chips/pills above; these two
   helpers add only what the profile card lacks: a right-aligned availability
   badge in the header (title takes the slack) and a bottom-pinned readiness
   footer so cards in a row line up. Logical properties only (RTL-clean). */
.service-card-title { margin-inline-end: auto; }
.service-card-foot { margin-block-start: auto; }
.app-main p.lead-gap { margin-block: 0 var(--gap); }                 /* profiles empty-state lead */

/* ============================================================
   Public landing page (app/templates/site/landing.html).
   Additive marketing layer on the same token system: no new colors,
   no new fonts, logical properties only so the page stays RTL-clean.
   Reuses .card, .tile, .pill, .btn, .eyebrow, .copyline, .setup-steps,
   the bundle-* chips, the table look, and the .grid/.cols-* utilities;
   the rules here add only the marketing-specific scaffolding those
   components do not provide (page width, hero, section rhythm, the
   architecture hub, and the FAQ disclosure).
   ============================================================ */

/* page width + section rhythm */
.site-wrap { max-width: 1080px; margin-inline: auto; padding-inline: 24px; }
.site-section { padding-block: clamp(48px, 7vw, 80px); }
.site-section + .site-section { border-block-start: 1px solid var(--border); }
.site-hero-section { padding-block-start: clamp(40px, 6vw, 64px); }

/* top nav additions (reuses .app-top / .app-top-inner) */
.site-spacer { flex: 1; }
.site-nav-links { display: flex; align-items: center; gap: 4px; }
.site-navlink {
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 13.5px;
  padding-block: 6px; padding-inline: 9px; border-radius: var(--r-sm);
}
.site-navlink:hover { color: var(--ink); background: var(--surface-3); }

/* marketing type scale (the app uses smaller utility headings) */
.site-h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; letter-spacing: -0.02em; margin-block: 14px 0; }
.site-h2 { font-size: clamp(22px, 3vw, 30px); line-height: 1.15; letter-spacing: -0.015em; }
.site-lead { font-size: clamp(15px, 1.6vw, 17.5px); line-height: 1.55; color: var(--ink-2); max-width: 60ch; margin-block: 14px 0; }

/* hero */
.site-hero { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(24px, 4vw, 52px); align-items: center; }
.site-hero-copy { min-inline-size: 0; }
.site-hero-visual { min-inline-size: 0; }
.site-cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 26px; }
.site-hero-endpoint { margin-block-start: 22px; max-inline-size: 30rem; }
.btn.lg { height: 44px; padding-inline: 20px; font-size: 14.5px; border-radius: var(--r); }

/* generic padded card body for marketing cards */
.site-cardpad { padding-block: 18px; padding-inline: 18px; }

/* section heads */
.site-head { max-width: 64ch; margin-block-end: 28px; }
.site-head .eyebrow { margin-block-end: 10px; }

/* text + product-surface split (reuses card/tile on the right) */
.site-split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(22px, 3.5vw, 44px); align-items: start; }
.site-split-text { margin-block-end: 0; }
.site-mcp-line { font-size: 13.5px; margin-block-start: 14px; max-width: 60ch; }
.site-feature-title { font-weight: 650; font-size: 14.5px; margin-block-end: 6px; }
.eyebrow.accent-eyebrow { color: var(--accent-on-soft); }

/* architecture hub: clients -> Combiner -> services (single row, 5 cells) */
.site-hub { display: grid; grid-template-columns: 1fr auto minmax(0, 1.3fr) auto 1fr; gap: 10px; align-items: center; margin-block-start: 14px; }
.site-hub-col { display: flex; flex-direction: column; gap: 8px; min-inline-size: 0; }
.site-hub-col > .text-meta { margin-block-end: 2px; }
.site-hub-node {
  border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface-2);
  padding-block: 8px; padding-inline: 11px; font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.site-hub-arrow { display: flex; align-items: center; justify-content: center; color: var(--ink-3); }
.site-hub-core {
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
  background: var(--accent-softer); border-radius: var(--r-lg);
  padding-block: 14px; padding-inline: 14px; display: flex; flex-direction: column; gap: 9px;
}
.site-hub-core-title { font-weight: 700; font-size: 14px; }
.site-hub-controls { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* built-for-teams: audience pills */
.site-audience { margin-block-start: var(--gap); }
.site-audience-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 10px 0; }
.site-audience-note { margin-block-start: 16px; max-width: 60ch; }

/* credits: owner usage tiles */
.site-tiles { display: flex; flex-direction: column; gap: var(--gap); }
.site-tiles-label { margin-block-end: 0; }
.tile .metric.credit { color: var(--credit); }
.site-usage-feed { padding-block: 6px; }
.site-usage-feed .svc-row:first-child { border-block-start: 0; }

/* security: audit table caption */
.site-table-caption { caption-side: top; text-align: start; padding-block: 0 10px; font-size: 12.5px; }

/* how it works: client config block */
.site-pre {
  margin: 0; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface-2);
  padding-block: 13px; padding-inline: 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.55;
}
.site-pre code { white-space: pre; }

/* FAQ disclosure (CSP-safe, no JS) */
.site-faq-wrap { max-width: 760px; }
.site-faq { border-block-end: 1px solid var(--border); }
.site-faq > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-block: 16px; font-weight: 600; font-size: 15px; color: var(--ink);
}
.site-faq > summary::-webkit-details-marker { display: none; }
.site-faq > p { margin-block: 0 16px; color: var(--ink-2); max-width: 68ch; }
.site-faq-chevron { flex: none; color: var(--ink-3); transition: transform .18s var(--ease); }
.site-faq[open] .site-faq-chevron { transform: rotate(180deg); }

/* closing CTA band */
.site-cta-band { text-align: center; background: var(--surface); }
.site-cta-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.site-cta-inner .site-lead { max-width: 52ch; }
.site-cta-inner .site-cta-row { justify-content: center; }

/* footer */
.site-footer { border-block-start: 1px solid var(--border); padding-block: 26px; }
.site-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* responsive reflow (mirrors the app breakpoints) */
@media (max-width: 920px) {
  .site-hero { grid-template-columns: 1fr; }
  .site-split { grid-template-columns: 1fr; }
  .site-hub { grid-template-columns: 1fr; }
  .site-hub-arrow svg { transform: rotate(90deg); }
}
@media (max-width: 640px) {
  .site-wrap { padding-inline: 16px; }
  .site-nav-links { display: none; }
}

/* honor reduced motion for the shared entrance animation */
@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; }
}