/* Interim UI stylesheet. No inline styles anywhere (CSP: style-src 'self').
   Look (after the XMO Tracker): a soft canvas with white rounded cards, a floating dark rail with a line icon per
   section and a white pill on the current page, pill buttons and chips, sentence-case labels, and semibold headings
   and numbers in the system UI font. Accent text is a shade darker than the accent fill so it keeps 4.5:1 on the soft
   accent fill. Category, status and chart colours keep their meaning; every state also has a word. */
:root {
  --bg: #f1f3f7;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #e9edf2;
  --border: #e6e9ef;
  --line-2: #d3d9e1;
  --text: #101828;
  --fg-2: #475467;
  --muted: #5f6b7d;
  --title: #101828;
  --accent: #0563b3;
  --accent-fill: #0672cb;
  --accent-fill-hover: #0563b3;
  --accent-ink: #ffffff;
  --accent-soft: #ebf4fd;
  --accent-soft-2: #cfe4f8;
  --ok: #006b4f;
  --ok-soft: #ddf4ec;
  --warn: #8a5200;
  --warn-soft: #fff0d1;
  --bad: #c01a22;
  --bad-soft: #fde3e3;
  --violet: #6b3fb5;
  --violet-soft: #efe8fa;
  --teal: #0d7377;
  --teal-soft: #e0f3f3;
  --rail-bg: #16212c;
  --rail-fg: #e8edf2;
  --rail-muted: #9aabbc;
  --rail-tint: rgba(255, 255, 255, 0.05);
  --rail-hover: rgba(255, 255, 255, 0.07);
  --rail-on: #ffffff;
  --rail-on-fg: #101828;
  --rail-on-ico: #0672cb;
  --rail-role-bg: rgba(98, 173, 242, 0.16);
  --rail-role-fg: #a9d1f7;
  --r-lg: 18px;
  --radius: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 6px 16px -4px rgba(16, 24, 40, 0.10), 0 2px 4px -2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, 0.30);
  --shadow-btn: 0 1px 2px rgba(6, 114, 203, 0.25), 0 4px 12px -3px rgba(6, 114, 203, 0.45);
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d131a;
    --surface: #151c25;
    --surface-2: #1a2330;
    --surface-3: #243041;
    --border: #232e3c;
    --line-2: #334255;
    --text: #edf1f5;
    --fg-2: #c2ccd7;
    --muted: #97a6b6;
    --title: #edf1f5;
    --accent: #62adf2;
    --accent-fill: #0672cb;
    --accent-fill-hover: #1a82d9;
    --accent-ink: #06213b;
    --accent-soft: #11304e;
    --accent-soft-2: #163d63;
    --ok: #5fe0b8;
    --ok-soft: #0f3d33;
    --warn: #ffc861;
    --warn-soft: #47340c;
    --bad: #ff8a8a;
    --bad-soft: #4a1c1f;
    --violet: #b79bf0;
    --violet-soft: #2a2140;
    --teal: #6fd3d6;
    --teal-soft: #12302f;
    --rail-bg: #111821;
    --rail-on: #243245;
    --rail-on-fg: #ffffff;
    --rail-on-ico: #62adf2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.7);
    --shadow-btn: 0 4px 12px -4px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; text-wrap: balance; color: var(--title); }
h1 { font-size: 1.75rem; margin: 0 0 0.3rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.85rem; }
h3 { font-family: var(--font); font-size: 0.92rem; letter-spacing: 0; color: var(--fg-2); margin: 1rem 0 0.5rem; }
code, .mono { font-family: var(--mono); font-size: 0.85em; }
.muted, .sub { color: var(--muted); }
.sub { font-size: 0.84rem; }
.warn { color: var(--warn); }
.wrap { overflow-wrap: anywhere; }

/* ---- Frame: the rail floats on the canvas beside the page ---------------------------------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 22px; padding: 14px; min-height: 100vh; }
.app > main { min-width: 0; padding: 10px 14px 56px 0; max-width: 1440px; width: 100%; }
.bare { max-width: 760px; margin: 0 auto; padding: 32px 16px 56px; }
.bare-head { display: flex; justify-content: center; margin-bottom: 18px; }
.bare-head .brand { padding: 0; color: var(--title); }

.rail { background: var(--rail-bg); color: var(--rail-fg); padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 14px; height: calc(100vh - 28px); overflow: auto; border-radius: 22px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), var(--shadow-md); scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 10px; font-family: var(--font-display); font-weight: 600; font-size: 1rem; line-height: 1.2; }
.brand-mark { flex: none; background: var(--accent-fill); color: #ffffff; border-radius: 8px; padding: 4px 7px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; }
.tenant { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 0 2px 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--rail-tint); }
.tenant-name { font-weight: 600; font-size: 0.9rem; line-height: 1.3; }
.role { font-size: 0.77rem; font-weight: 600; padding: 1px 9px; border-radius: 999px; background: var(--rail-role-bg); color: var(--rail-role-fg); }
.nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.navg { display: flex; flex-direction: column; gap: 1px; }
.navh { padding: 12px 12px 4px; font-size: 0.77rem; font-weight: 600; line-height: 1.2; color: var(--rail-muted); }
.nav a, .account-links a { display: flex; align-items: center; gap: 11px; padding: 6px 12px; border-radius: 12px; color: var(--rail-fg); font-size: 0.93rem; line-height: 1.3; transition: background 0.15s, color 0.15s; }
.nav a::before, .account-links a::before { content: ""; flex: none; width: 18px; height: 18px; background: currentColor; opacity: 0.72; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.nav a:hover, .account-links a:hover { background: var(--rail-hover); text-decoration: none; }
.nav a.active { background: var(--rail-on); color: var(--rail-on-fg); font-weight: 600; box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.35); }
.nav a.active::before { background: var(--rail-on-ico); opacity: 1; }
.nav a:focus-visible, .account-links a:focus-visible, .signout button:focus-visible { outline: 2px solid #62adf2; outline-offset: 1px; }
.account { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius); background: var(--rail-tint); font-size: 0.83rem; color: var(--rail-muted); }
.account-name { color: var(--rail-fg); font-weight: 600; overflow-wrap: anywhere; }
.account-links { display: flex; flex-direction: column; gap: 1px; margin: 0 -8px; }
.account-links a { padding: 5px 8px; font-size: 0.87rem; }
.account-links a::before { width: 16px; height: 16px; }
.signout { margin: 2px 0 0; }
.signout button.link { color: var(--rail-muted); font-size: 0.85rem; }
.signout button.link:hover { color: var(--rail-fg); text-decoration: underline; filter: none; }

/* Rail icons: line icons drawn as masks, so they take the link's colour; keyed by data-v. */
.nav a, .account-links a { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3C/svg%3E"); }
.nav a[data-v="overview"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='9' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1.5'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1.5'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1.5'/%3E%3C/svg%3E"); }
.nav a[data-v="monitoring"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 12h4l3-7 5 14 3-7h4'/%3E%3C/svg%3E"); }
.nav a[data-v="fleet"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='11' rx='1.5'/%3E%3Cpath d='M2 19h20'/%3E%3C/svg%3E"); }
.nav a[data-v="models"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2.5 2.5 7.5 12 12.5l9.5-5z'/%3E%3Cpath d='M2.5 12 12 17l9.5-5M2.5 16.5 12 21.5l9.5-5'/%3E%3C/svg%3E"); }
.nav a[data-v="data-quality"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='m8 12.5 3 3 5-6'/%3E%3C/svg%3E"); }
.nav a[data-v="studio"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1.5 14h5M9.5 8h5M17.5 16h5'/%3E%3C/svg%3E"); }
.nav a[data-v="scenarios"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='5' r='2.5'/%3E%3Ccircle cx='6' cy='19' r='2.5'/%3E%3Ccircle cx='18' cy='9' r='2.5'/%3E%3Cpath d='M6 7.5v9M18 11.5c0 4-6 3-12 5'/%3E%3C/svg%3E"); }
.nav a[data-v="exports"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M4 17v2.5A1.5 1.5 0 0 0 5.5 21h13a1.5 1.5 0 0 0 1.5-1.5V17'/%3E%3C/svg%3E"); }
.nav a[data-v="approvals"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8' y='2' width='8' height='4' rx='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2M8.5 14l2.5 2.5 4.5-5'/%3E%3C/svg%3E"); }
.nav a[data-v="waves"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 7c2.5 0 2.5 2 5 2s2.5-2 5-2 2.5 2 5 2 2.5-2 5-2M2 12c2.5 0 2.5 2 5 2s2.5-2 5-2 2.5 2 5 2 2.5-2 5-2M2 17c2.5 0 2.5 2 5 2s2.5-2 5-2 2.5 2 5 2 2.5-2 5-2'/%3E%3C/svg%3E"); }
.nav a[data-v="actions"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.5 2.5 11 13M21.5 2.5 15 21.5l-4-8.5-8.5-4z'/%3E%3C/svg%3E"); }
.nav a[data-v="lch"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5h12v11H2zM14 9h4l3 3.5V16h-7'/%3E%3Ccircle cx='6' cy='18.5' r='2'/%3E%3Ccircle cx='17.5' cy='18.5' r='2'/%3E%3C/svg%3E"); }
.nav a[data-v="automation"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2 4 14h7l-1 8 9-12h-7z'/%3E%3C/svg%3E"); }
.nav a[data-v="ranges"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12h18M3 12l4-4M3 12l4 4M21 12l-4-4M21 12l-4 4'/%3E%3C/svg%3E"); }
.nav a[data-v="data-sources"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='5' rx='8' ry='3'/%3E%3Cpath d='M4 5v14c0 1.7 3.6 3 8 3s8-1.3 8-3V5M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3'/%3E%3C/svg%3E"); }
.account-links a[data-v="tenants"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 21.5V4.5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v17zM6 12H4a1.5 1.5 0 0 0-1.5 1.5v8H6M18 9h2a1.5 1.5 0 0 1 1.5 1.5v11H18M10 6.5h4M10 10.5h4M10 14.5h4M10 18.5h4'/%3E%3C/svg%3E"); }
.account-links a[data-v="admin"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 13c0 5-3.5 7.5-7.7 9a1 1 0 0 1-.6 0C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.2-2.7a1.2 1.2 0 0 1 1.6 0C14.5 3.8 17 5 19 5a1 1 0 0 1 1 1z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E"); }

.interim { display: inline-flex; align-items: center; gap: 0.4rem; max-width: 100%; margin: 0 0 1rem; padding: 3px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent); background: var(--warn-soft); color: var(--warn); font-size: 0.8rem; font-weight: 600; }

/* ---- Controls ------------------------------------------------------------------------------- */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; font: inherit; font-size: 0.87rem; font-weight: 600; line-height: 1.2; border: 1px solid var(--accent-fill); background: var(--accent-fill); color: #ffffff; border-radius: 999px; padding: 0.5rem 1.05rem; cursor: pointer; box-shadow: var(--shadow-btn); transition: background 0.15s, border-color 0.15s, box-shadow 0.15s; }
button:hover, .btn:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); text-decoration: none; }
button[disabled], .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
button.link { display: inline; background: none; border: none; color: var(--accent); padding: 0; box-shadow: none; font-weight: 500; }
button.link:hover { background: none; text-decoration: underline; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0.4rem 0.65rem; min-width: 0; max-width: 100%; transition: border-color 0.15s; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--fg-2) 45%, var(--line-2)); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-fill); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.page-head { margin-bottom: 1.35rem; }
.page-head > p { margin: 0.25rem 0 0; max-width: 90ch; }
.device-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.decision-box { text-align: right; }
.decision-box .badge { font-size: 1rem; padding: 0.35rem 0.9rem; }
.decision-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; margin-top: 0.5rem; }
.crumbs { font-size: 0.87rem; font-weight: 600; color: var(--muted); margin: 0 0 0.4rem; }

/* ---- Cards ---------------------------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel.narrow { max-width: 640px; margin: 1.5rem auto; }
.panel.consultant { border-color: color-mix(in srgb, var(--violet) 45%, var(--border)); box-shadow: var(--shadow), inset 0 3px 0 var(--violet-soft); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 0 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; margin-top: 0.35rem; }
.card-label { color: var(--fg-2); font-size: 0.83rem; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.9rem; }
.chip { display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.86rem; font-weight: 600; box-shadow: var(--shadow); }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip span { color: var(--muted); font-weight: 500; margin-left: 0.15rem; font-variant-numeric: tabular-nums; }
.chip.active { background: var(--accent-fill); border-color: var(--accent-fill); color: #ffffff; }
.chip.active span { color: rgba(255, 255, 255, 0.85); }

.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.83rem; font-weight: 600; color: var(--fg-2); }
.field.grow { flex: 1 1 220px; }
.field select, .field input, .field textarea { color: var(--text); font-size: 0.92rem; font-weight: 400; }
.actions { display: flex; align-items: center; gap: 0.6rem; }
.result-count { color: var(--muted); margin: 0.25rem 0 0.6rem; font-size: 0.9rem; }

/* ---- Tables --------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.panel .table-wrap, section.card .table-wrap, .tile .table-wrap, details .table-wrap { border: 0; border-radius: 12px; box-shadow: none; background: transparent; }
.table-wrap.scroll { max-height: 360px; overflow-y: auto; }
.table-wrap.scroll.short { max-height: 200px; }
table.grid { width: 100%; border-collapse: collapse; background: transparent; font-size: 0.93rem; }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.grid thead th { font-size: 0.83rem; font-weight: 600; color: var(--fg-2); background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
table.grid tbody tr:last-child > * { border-bottom: 0; }
table.grid.compact th, table.grid.compact td { padding: 0.4rem 0.6rem; font-size: 0.88rem; }
table.grid tbody tr:hover { background: var(--surface-2); }
table.grid tr.low td { color: var(--warn); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap, table.grid td:first-child > a { white-space: nowrap; }
td.why ul { margin: 0; padding-left: 1rem; font-size: 0.86rem; }
td.empty { text-align: center; color: var(--muted); padding: 2rem; }
.consultant-col { background: var(--violet-soft); }
table.evidence tr.counted th { box-shadow: inset 3px 0 0 var(--accent-fill); }
table.kv { width: 100%; border-collapse: collapse; }
table.kv th, table.kv td { padding: 0.45rem 0; border-bottom: 1px solid var(--border); text-align: left; font-weight: normal; }
table.kv tr.total th, table.kv tr.total td { font-weight: 600; border-top: 2px solid var(--line-2); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0; font-size: 0.92rem; }
.facts dt { color: var(--fg-2); font-weight: 600; font-size: 0.86rem; }
.facts dd { margin: 0; }

/* ---- Badges, tags and statuses (colour plus a word, never colour alone) --------------------- */
.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.18rem 0.65rem; border-radius: 999px; font-size: 0.82rem; font-weight: 600; white-space: nowrap; border: 1px solid color-mix(in srgb, currentColor 26%, transparent); }
.badge-flag { font-size: 0.7rem; font-weight: 600; border: 1px solid currentColor; border-radius: 999px; padding: 0 0.4rem; }
.cat-now { background: var(--bad-soft); color: var(--bad); }
.cat-next { background: var(--warn-soft); color: var(--warn); }
.cat-remediate { background: var(--teal-soft); color: var(--teal); }
.cat-redeploy { background: var(--violet-soft); color: var(--violet); }
.cat-retain { background: var(--ok-soft); color: var(--ok); }
.cat-investigate { background: var(--surface-2); color: var(--muted); border-color: var(--line-2); }
.band { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 0.06rem 0.55rem; border-radius: 999px; border: 1px solid var(--line-2); white-space: nowrap; }
.band-critical { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); background: var(--bad-soft); }
.band-high { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: var(--warn-soft); }
.band-elevated { color: var(--warn); }
.band-low, .band-minimal { color: var(--muted); }
.attr { font-size: 0.72rem; font-weight: 600; padding: 0.02rem 0.45rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.attr-hardware_device, .attr-hardware_model, .attr-hardware_spec { background: var(--bad-soft); color: var(--bad); }
.attr-software { background: var(--teal-soft); color: var(--teal); }
.attr-systemic { background: var(--warn-soft); color: var(--warn); }
.tag { display: inline-block; font-size: 0.77rem; font-weight: 600; padding: 0.06rem 0.55rem; border-radius: 999px; background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--line-2); }
.tag-counted { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.tag-consultant { background: var(--violet-soft); color: var(--violet); border-color: color-mix(in srgb, var(--violet) 30%, transparent); }
.status { font-size: 0.8rem; font-weight: 600; padding: 0.06rem 0.55rem; border-radius: 999px; white-space: nowrap; }
.status-underperforming { background: var(--bad-soft); color: var(--bad); }
.status-watch { background: var(--warn-soft); color: var(--warn); }
.status-healthy { background: var(--ok-soft); color: var(--ok); }

.reasons { margin: 0 0 0.6rem; padding-left: 1.1rem; }
.reasons li { margin-bottom: 0.35rem; }
.trace { font-size: 0.85rem; }
.cols { columns: 3 220px; font-size: 0.85rem; }
details summary { cursor: pointer; color: var(--accent); margin: 0.5rem 0; }

.flash { padding: 0.65rem 0.95rem; border-radius: 12px; margin-bottom: 0.9rem; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.flash.error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 28%, transparent); }
.override { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.override textarea { min-width: min(320px, 100%); }

.pager { display: flex; justify-content: space-between; align-items: center; margin: 0.9rem 0; }
.recompute { padding: 0.6rem 0.85rem; border-radius: 12px; margin-bottom: 0.75rem; }
.recompute.match { background: var(--ok-soft); }
.recompute.nomatch { background: var(--bad-soft); }

svg.chart { width: 100%; height: auto; max-height: 260px; }
svg.chart .axis { stroke: var(--border); }
svg.chart .axis-label { fill: var(--muted); font-size: 11px; }
svg.chart .bar { fill: var(--accent-fill); }
svg.chart .dot { fill: var(--accent-fill); }
svg.chart .masked { fill: var(--warn); opacity: 0.55; }
svg.chart .series-a { fill: var(--muted); }
svg.chart .series-b { fill: var(--accent-fill); }
.legend { font-size: 0.85rem; color: var(--muted); display: flex; gap: 0.5rem; align-items: center; }
.swatch { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 3px; }
.swatch.series-a { background: var(--muted); }
.swatch.series-b { background: var(--accent-fill); }
meter { width: 140px; vertical-align: middle; }

.user-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.user-btn { width: 100%; text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; padding: 0.7rem 0.95rem; font-weight: 400; }
.user-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---- Phase 3: charts, tiles, studio, scenarios ------------------------------------------- */
/* Chart tokens: validated categorical slots (light on #ffffff, dark on #151c25), a de-emphasis
   gray for comparison baselines, hairline grid. Text never uses series colors. */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-base: #b3b1ab; --grid: #e7e6e1; --baseline: #c3c2b7; --tick: #6f6d68;
  --status-warning: #fab219; --delta-up: #006300; --delta-down: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-base: #5f5e59; --grid: #2c2c2a; --baseline: #44443f; --tick: #9a988f;
    --delta-up: #0ca30c; --delta-down: #ff8a80;
  }
}
figure.viz { margin: 0 0 0.5rem; }
svg.chart { max-height: none; overflow: visible; }
svg.chart .grid { stroke: var(--grid); stroke-width: 1; }
svg.chart .baseline { stroke: var(--baseline); stroke-width: 1; }
svg.chart .tick { fill: var(--tick); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.chart .row-label { fill: var(--text); font-size: 12px; }
svg.chart .row-label.link { fill: var(--accent); }
svg.chart .value { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.chart .muted-text { fill: var(--muted); font-style: italic; }
svg .mark.s1, svg .dot.s1 { fill: var(--series-1); }
svg .mark.s2, svg .dot.s2 { fill: var(--series-2); }
svg .mark.s3, svg .dot.s3 { fill: var(--series-3); }
svg .mark.s4, svg .dot.s4 { fill: var(--series-4); }
svg .mark.base { fill: var(--series-base); }
svg .mark.warnfill { fill: var(--status-warning); }
svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg .line.s1 { stroke: var(--series-1); } svg .line.s2 { stroke: var(--series-2); }
svg .line.s3 { stroke: var(--series-3); } svg .line.s4 { stroke: var(--series-4); }
svg .dot { stroke: var(--surface); stroke-width: 2; }
svg .hit-area { fill: transparent; }
svg .hit:hover .mark { opacity: 0.85; }
svg .hit:hover .hit-area { fill: var(--surface-2); opacity: 0.5; }
.legend { flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.25rem 0 0.5rem; }
.legend .key { display: inline-flex; align-items: center; gap: 0.35rem; }
.swatch.s1 { background: var(--series-1); } .swatch.s2 { background: var(--series-2); }
.swatch.s3 { background: var(--series-3); } .swatch.s4 { background: var(--series-4); }
.swatch.base { background: var(--series-base); }
svg.meter-bar { width: 100%; max-width: 320px; height: 14px; margin-top: 0.45rem; }
svg.meter-bar .track { fill: var(--accent-soft); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px 18px 15px; min-width: 0; }
.tile-label { color: var(--fg-2); font-size: 0.83rem; font-weight: 600; }
.tile-value { font-family: var(--font-display); font-size: 1.95rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.05; margin: 0.5rem 0 0.35rem; font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--muted); font-size: 0.83rem; }
.hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px 24px; margin-bottom: 18px; }
.hero-label { color: var(--fg-2); font-weight: 600; }
.hero-value { font-family: var(--font-display); font-size: 3.1rem; font-weight: 650; letter-spacing: -0.025em; line-height: 1.05; margin: 0.35rem 0; font-variant-numeric: tabular-nums; color: var(--title); }
.delta-up { color: var(--delta-up); font-weight: 600; }
.delta-down { color: var(--delta-down); font-weight: 600; }
.weights { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.25rem; max-width: 360px; }
.weights li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); padding: 0.3rem 0; }
.flash.warnbox { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.flash.note { background: var(--surface-2); color: var(--fg-2); font-size: 0.88rem; border-color: var(--border); }
.flash ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.badge.cat-plan { background: var(--accent-soft); color: var(--accent); }
.badge-flag.review { border-color: var(--warn); color: var(--warn); }
.panel.review { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.panel.tight { padding: 14px 16px; border-radius: var(--radius); }
.panel.tight h3 { margin-top: 0; }
.btn.secondary, a.btn.secondary, button.secondary { background: var(--surface); border-color: var(--line-2); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06); }
.btn.secondary:hover, a.btn.secondary:hover, button.secondary:hover { background: var(--surface-2); border-color: var(--line-2); }
a.btn { text-decoration: none; }
.check { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; color: var(--text); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Studio: levers on the left, the server-computed preview on the right. */
.studio { display: grid; grid-template-columns: minmax(340px, 1fr) minmax(380px, 1.15fr); gap: 18px; align-items: start; }
.studio fieldset.panel { margin: 0 0 16px; }
/* The group title sits inside the card (floated out of the fieldset border) */
.studio legend { float: left; width: 100%; padding: 0; margin: 0 0 0.35rem; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--title); }
.studio legend + * { clear: both; }
.lever { padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
.lever:last-child { border-bottom: 0; padding-bottom: 0.2rem; }
.lever-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 0.75rem; }
.lever-label { font-weight: 600; display: block; }
.lever-out { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--accent); white-space: nowrap; }
.lever-input { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.4rem; }
.lever-input input[type="number"] { width: 12rem; }
.lever.readonly .lever-value { font-weight: 600; margin-top: 0.2rem; }
.lever .sub { margin: 0.35rem 0 0; }
.money-in { display: inline-flex; align-items: center; gap: 0.35rem; }
.money-in .cur { color: var(--muted); font-weight: 600; }

/* Sliders: the filled part of the track runs to the thumb (--fill, set by studio.js); for the XMO Consultant the
   customer's allowed range shows as a lighter band (--lo/--hi). Without the script the track is plain. */
.slider { margin-top: 0.45rem; }
input[type="range"] { --fill: 0%; --lo: 0%; --hi: 0%; -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 22px; padding: 0; margin: 0; border: 0; background: transparent; cursor: pointer; }
input[type="range"]:hover { border: 0; }
input[type="range"]:focus { outline: none; }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 999px; }
input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: linear-gradient(to right, var(--accent-fill) 0 var(--fill), transparent var(--fill)), linear-gradient(to right, transparent 0 var(--lo), var(--accent-soft-2) var(--lo) var(--hi), transparent var(--hi)), var(--surface-3); }
input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: linear-gradient(to right, transparent 0 var(--lo), var(--accent-soft-2) var(--lo) var(--hi), transparent var(--hi)), var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--accent-fill); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin-top: -6px; border-radius: 50%; background: #ffffff; border: 2px solid var(--accent-fill); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.3); transition: transform 0.1s; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #ffffff; border: 2px solid var(--accent-fill); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.3); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]:disabled { cursor: not-allowed; opacity: 0.45; }
.scale { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.15rem; font-size: 0.76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.scale .plan { color: var(--fg-2); }
.exact { margin-top: 0.35rem; }
.exact summary { display: inline-block; margin: 0; font-size: 0.78rem; font-weight: 500; color: var(--muted); }
.exact summary:hover { color: var(--accent); }
.exact input { width: 10rem; margin-top: 0.35rem; }
.exact .sub { display: block; margin-top: 0.25rem; }

/* Segmented choice (analysis window) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin-top: 0.45rem; border-radius: 999px; background: var(--surface-3); border: 0; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-block; padding: 0.35rem 0.95rem; border-radius: 999px; font-size: 0.87rem; font-weight: 600; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.seg input:checked + span { background: var(--surface); color: var(--title); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.18); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* On/off switch: a checkbox drawn as a toggle */
input[type="checkbox"].switch { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 38px; height: 22px; margin: 0; padding: 0; border: 0; border-radius: 999px; background: var(--line-2); cursor: pointer; transition: background 0.15s; }
input[type="checkbox"].switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.3); transition: transform 0.15s; }
input[type="checkbox"].switch:checked { background: var(--accent-fill); }
input[type="checkbox"].switch:checked::after { transform: translateX(16px); }
input[type="checkbox"].switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check.toggle { gap: 0.6rem; font-weight: 600; }
.lever .check.toggle + .sub { margin-top: 0.3rem; }
.nocap { margin-top: 0.45rem; font-size: 0.86rem; font-weight: 500; }

table.persona input[type="range"] { display: inline-block; width: 60%; vertical-align: middle; }
.preview-col { position: sticky; top: 14px; }
.preview-actions { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.9rem; }
.studio .busy { display: none; color: var(--muted); font-size: 0.85rem; }
.studio.is-busy .busy { display: inline; }
.studio.is-busy #preview { opacity: 0.6; transition: opacity 0.15s; }
.panel.save .field { margin-bottom: 0.6rem; }
.panel.adopt { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.panel.adopt form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
table.compare td.diff { background: var(--accent-soft); font-weight: 600; }
table.compare tr.section th { background: var(--surface-2); font-size: 0.83rem; font-weight: 600; color: var(--fg-2); }
table.ranges input[type="number"] { width: 7.5rem; }
@media (max-width: 1100px) {
  .studio { grid-template-columns: 1fr; }
  .preview-col { position: static; }
}
/* Charts keep a readable text size: they do not scale past this width in wide panels. */
figure.viz svg.chart { max-width: 900px; display: block; }
.status { white-space: nowrap; }

/* Exports */
.export-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 0.5rem 0 1rem; }
.export-option { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface-2); }
.export-option .sub { margin: 0.5rem 0 0; }

/* Actioning (Phase 5) */
.flash.info { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.level-banner a { margin-left: 0.5rem; }
.status-pending, .status-proposed, .status-draft, .status-retry_scheduled, .status-dispatching { background: var(--surface-2); color: var(--muted); }
.status-dispatched, .status-approved, .status-in_progress, .status-sent, .status-file_only, .status-acknowledged { background: var(--accent-soft); color: var(--accent); }
.status-succeeded, .status-actioned, .status-completed { background: var(--ok-soft); color: var(--ok); }
.status-failed, .status-rejected { background: var(--bad-soft); color: var(--bad); }
.status-cancelled, .status-refused, .status-reversed { background: var(--warn-soft); color: var(--warn); }
.chips.secondary .chip { font-size: 0.82rem; box-shadow: none; }
.bulk { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; margin: 0.9rem 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.bulk .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.actions-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
pre.payload { background: var(--surface-2); padding: 0.7rem 0.9rem; border-radius: 12px; border: 1px solid var(--border); overflow-x: auto; font-size: 0.82rem; white-space: pre-wrap; word-break: break-word; max-height: 24rem; }
ul.plain ul { margin: 0.2rem 0 0; padding-left: 1rem; }
fieldset.levels { border: 0; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.5rem; }
.check.level { display: grid; grid-template-columns: auto 1fr; column-gap: 0.5rem; align-items: start; }
.check.level .sub { grid-column: 2; }
button.danger { background: var(--bad); border-color: var(--bad); color: #ffffff; box-shadow: none; }
button.danger:hover { background: color-mix(in srgb, var(--bad) 85%, #000000); border-color: color-mix(in srgb, var(--bad) 85%, #000000); }
fieldset.field { border: 0; padding: 0; margin: 0; display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
fieldset.field legend { font-size: 0.83rem; font-weight: 600; color: var(--fg-2); padding: 0; margin-bottom: 0.25rem; }
fieldset.options { border: 0; padding: 0; margin: 0.25rem 0 0.75rem; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; align-items: center; }
fieldset.options legend { font-size: 0.83rem; font-weight: 600; color: var(--fg-2); padding: 0; margin-bottom: 0.3rem; width: 100%; }
.request { white-space: nowrap; font-size: 0.85rem; margin-right: 0.4rem; }

/* ---- Phase 6: data sources ---- */
section.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px 20px; margin: 0 0 16px; }
section.card h2 { margin-top: 0; }
ol.readiness { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.55rem; }
ol.readiness li { display: grid; grid-template-columns: 9rem 1fr; column-gap: 0.75rem; align-items: baseline; }
ol.readiness li .sub { grid-column: 2; }
/* Readiness and run states (class "check check-…"); plain .check labels around checkboxes are left alone. */
.check:is(.check-done, .check-ok, .check-todo, .check-info, .check-warn, .check-manual, .check-blocked, .check-fail) { display: inline-block; min-width: 6.5rem; text-align: center; font-size: 0.8rem; font-weight: 600; padding: 0.06rem 0.55rem; border-radius: 999px; border: 1px solid transparent; }
.check-done, .check-ok { background: var(--ok-soft); color: var(--ok); }
.check-todo, .check-info { background: var(--accent-soft); color: var(--accent); }
.check-warn, .check-manual { background: var(--warn-soft); color: var(--warn); }
.check-blocked, .check-fail { background: var(--bad-soft); color: var(--bad); }
form.stack { display: grid; gap: 0.75rem; margin: 0.75rem 0; }
form.stack textarea { width: 100%; font-family: var(--mono); }
.check-label { display: inline-flex; gap: 0.4rem; align-items: center; }
.kpis { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0.25rem 0 0.75rem; }
.kpis .kpi { font-family: var(--font-display); font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; display: block; line-height: 1.1; }
a.button { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1.05rem; border-radius: 999px; background: var(--accent-fill); border: 1px solid var(--accent-fill); color: #ffffff; text-decoration: none; font-weight: 600; font-size: 0.87rem; box-shadow: var(--shadow-btn); }
a.button:hover { background: var(--accent-fill-hover); text-decoration: none; }
a.button.secondary { background: var(--surface); color: var(--text); border-color: var(--line-2); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06); }
a.button.secondary:hover { background: var(--surface-2); }
ul.notes { margin: 0.25rem 0 0.5rem; padding-left: 1.2rem; color: var(--warn); }
section.nql pre.payload { white-space: pre-wrap; }
details > summary { cursor: pointer; font-weight: 600; margin: 0.25rem 0; }

/* ---- Phase 7: monitoring, alerts, outcomes, schedule ---- */
.status-open { background: var(--warn-soft); color: var(--warn); }
.status-resolved, .status-skipped { background: var(--surface-2); color: var(--muted); }
.status-running { background: var(--accent-soft); color: var(--accent); }
.level { font-size: 0.78rem; font-weight: 600; padding: 0.06rem 0.55rem; border-radius: 999px; white-space: nowrap; }
.level-critical { background: var(--bad-soft); color: var(--bad); }
.level-warning { background: var(--warn-soft); color: var(--warn); }
.level-info { background: var(--surface-2); color: var(--muted); }
.step { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.02rem 0.5rem; border-radius: 999px; margin: 0.1rem 0; }
.step-ok { background: var(--ok-soft); color: var(--ok); }
.step-failed { background: var(--bad-soft); color: var(--bad); }
.step-skipped { background: var(--surface-2); color: var(--muted); }
.chip.review { border-color: var(--warn); color: var(--warn); }
.chip.review.active { background: var(--warn-soft); color: var(--warn); }
.tile-value.small { font-size: 1.1rem; }
td.good { color: var(--ok); }
td.warn { color: var(--warn); }
form.inline input[type="text"] { min-width: 10rem; }
table.rules td.params { display: flex; flex-wrap: wrap; gap: 0.5rem; }
table.rules td.params .field { min-width: 9rem; }

/* ---- Security module: sign-in and Admin & access ------------------------------------------ */
.signin .stack, .stack { display: flex; flex-direction: column; gap: 0.75rem; }
.stack label, .grid-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.88rem; font-weight: 600; color: var(--fg-2); }
.stack label input, .grid-form label input, .grid-form label select, .grid-form label textarea { font-weight: 400; }
button.primary, a.button.primary { background: var(--accent-fill); color: #ffffff; }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.small, .small-form { font-size: 0.85rem; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem 1rem; }
.page-head > h1 { flex: 1 1 auto; }
section.page-head { display: block; }
.add-person { margin: 0.75rem 0 1rem; }
.add-person summary, .actions summary { cursor: pointer; color: var(--accent); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; align-items: end; margin-top: 0.75rem; }
.grid-form .wide { grid-column: 1 / -1; }
td.actions { display: table-cell; min-width: 15rem; } /* .actions is a flex row elsewhere; a table cell must stay a cell */
.actions details[open] { background: var(--surface-2); border-radius: 12px; padding: 0.55rem 0.7rem; }
.small-form { margin: 0.5rem 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
form.inline { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { margin: 0.1rem 0; }
ul.plain > li { margin-bottom: 0.5rem; }
.muted-row td { opacity: 0.6; }
.st-owner { background: var(--violet-soft); color: var(--violet); }
.st-active { background: var(--ok-soft); color: var(--ok); }
.st-invited { background: var(--accent-soft); color: var(--accent); }
.st-toinvite { background: var(--surface-2); color: var(--muted); }
.st-removed { background: var(--bad-soft); color: var(--bad); }
.copy-box { width: 100%; font-family: var(--mono); font-size: 0.85rem; }
.tenant-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.tenant-list a { display: block; padding: 0.75rem 0.95rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tenant-list a:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); text-decoration: none; }

/* ---- Phone and tablet (≤ 900px): the rail becomes a band above the page with its links as pills ---- */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 10px; }
  .app > main { padding: 0 4px 40px; }
  .rail { position: static; height: auto; overflow: visible; border-radius: var(--r-lg); padding: 12px; gap: 8px; }
  .brand { padding: 0 4px 2px; }
  .tenant { flex-direction: row; flex-wrap: wrap; align-items: center; margin: 0; padding: 8px 10px; }
  .nav { flex-direction: row; gap: 6px; overflow-x: auto; margin: 0 -12px; padding: 2px 12px 6px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .navg { flex-direction: row; gap: 6px; }
  .navh { display: none; }
  .nav a { white-space: nowrap; border-radius: 999px; padding: 6px 12px; background: var(--rail-tint); }
  .account { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 10px; }
  .account-links { flex-direction: row; flex-wrap: wrap; margin: 0; }
  .signout { margin: 0 0 0 auto; }
}
@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .decision-box { text-align: left; }
  .decision-meta { justify-content: flex-start; }
  .hero-value { font-size: 2.3rem; }
  .lever-input input[type="number"] { width: 100%; }
  .panel, section.card { padding: 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
