@import url("ticket-share.css");
@import url("home.css");
@import url("grouping.css");
@import url("group-updates.css");
@import url("portal-groups.css");
@import url("known-issues.css");
@import url("client-digest.css");
/* SATRIA layer on top of the Demo v2 system. Load order matches Demo v2 (tokens, base, shell, components,
   forms, tables, views, app, ticket-workspace, demo-v2, requests) with this file last.
   Shared vocabulary: cases/*, automation/* and reporting/* templates use the classes below; keep names stable
   and add new ones additively. Motion is short, uses transform/opacity/colour only and stops for reduced motion. */

/* ===== Foundations ===== */
[hidden] { display: none !important; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 200; padding: 10px 14px; border: var(--focus-ring); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-weight: 600; transition: top var(--dur-2) var(--ease); }
.skip-link:focus { top: 1rem; }
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num, .kpi-value, .panel-count, .rq-number, .home-count, time { font-variant-numeric: tabular-nums; }
.kpi-value { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
h1, h2, .empty-title { text-wrap: balance; }
.page-description, .empty-body, .panel-description { text-wrap: pretty; }
/* Elevation and tint tokens shared with reports.css and older templates. */
:root {
  --elev-1: 0 1px 2px rgb(16 24 40 / 0.05), 0 1px 3px rgb(16 24 40 / 0.07);
  --elev-2: 0 1px 2px rgb(16 24 40 / 0.05), 0 8px 20px -6px rgb(16 24 40 / 0.14);
  --tint: color-mix(in srgb, var(--cobalt-soft) 45%, var(--surface));
  --tint-strong: color-mix(in srgb, var(--cobalt-soft) 80%, var(--surface));
  --glow: var(--header-glow);
}
:root[data-theme='dark'] {
  --elev-1: 0 1px 2px rgb(0 0 0 / 0.45), inset 0 1px 0 rgb(255 255 255 / 0.03);
  --elev-2: 0 10px 24px -8px rgb(0 0 0 / 0.65), inset 0 1px 0 rgb(255 255 255 / 0.04);
}

/* ===== Shell: ink rail, translucent top bar, content column ===== */
.satria-column { display: flex; flex-direction: column; min-width: 0; }
@media (min-width: 761px) {
  .satria-shell { --rail-fill: #141d3d; background: linear-gradient(90deg, var(--rail-fill) var(--rail-w), transparent var(--rail-w)) no-repeat; }
  :root[data-theme='dark'] .satria-shell { --rail-fill: #101839; }
  :root[data-nav='collapsed'] .satria-shell { background-image: linear-gradient(90deg, var(--rail-fill) var(--rail-w-collapsed), transparent var(--rail-w-collapsed)); }
}
.satria-main { flex: 1; width: 100%; max-width: 1480px; margin-inline: auto; padding: 24px var(--gutter) 48px; }
.satria-shell .wordmark { align-items: center; gap: 10px; }
.satria-shell .brand-logo { height: 26px; }
.wordmark-stack { display: grid; line-height: 1.15; min-width: 0; }
.satria-shell .wordmark-text { font-size: 1rem; letter-spacing: 0.08em; }
.satria-shell .wordmark-sub { font-size: 0.6875rem; }
:root[data-nav='collapsed'] .satria-shell .wordmark-stack { display: none; }
:root[data-nav='collapsed'] .satria-shell .brand-logo { height: 20px; }
.satria-shell .rail-close { display: none; margin-left: auto; }
:root:not([data-js='on']) :is(.nav-toggle, .rail-close) { display: none !important; }
:root:not([data-js='on']) .rail-collapse { display: none; }
.rail-link .ico { width: 18px; height: 18px; stroke-width: 1.75; opacity: 0.78; transition: opacity var(--dur-1) var(--ease), transform var(--dur-2) var(--ease); }
.rail-link:hover .ico, .rail-link.is-active .ico { opacity: 1; }
.rail-link:active { background: var(--rail-active); }
.rail-pilot { min-width: 0; }
.rail-pilot .ico { color: #7fe3d5; }
.rail-pilot > span { display: grid; min-width: 0; }
.rail-pilot small { overflow: hidden; text-overflow: ellipsis; }
.rail-collapse { width: 100%; }
.rail-collapse .collapse-icon { display: inline-flex; }
.rail-collapse .collapse-icon-open, :root[data-nav='collapsed'] .rail-collapse .collapse-icon-close { display: none; }
:root[data-nav='collapsed'] .rail-collapse .collapse-icon-open { display: inline-flex; }

.satria-topbar { position: sticky; top: 0; gap: 12px; }
.topbar-crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-3); font-size: 0.8125rem; }
.topbar-crumbs > .ico { width: 15px; height: 15px; color: var(--text-3); }
.crumb-section { display: inline-flex; align-items: center; gap: 7px; flex: none; height: 30px; margin-left: -8px; padding: 0 8px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; text-decoration: none; transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.crumb-section .ico { width: 15px; height: 15px; color: var(--text-3); }
.crumb-section:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.satria-breadcrumb { min-width: 0; overflow: hidden; color: var(--text); font-size: 0.8125rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.topbar-end { gap: 8px; }
/* Environment marker: quiet, always present in synthetic mode, explained on hover. */
.data-mode { height: 26px; gap: 6px; padding: 0 10px 0 8px; border-color: var(--border); background: var(--surface-2); color: var(--text-2); font-size: 0.6875rem; letter-spacing: 0.01em; cursor: default; }
.data-mode .ico { width: 13px; height: 13px; color: var(--amber-text); }
.theme-toggle .ico { width: 17px; height: 17px; }
.theme-icon-dark, .theme-icon-light { display: inline-flex; }
.theme-icon-light, :root[data-theme='dark'] .theme-icon-dark { display: none; }
:root[data-theme='dark'] .theme-icon-light { display: inline-flex; }
.icon-btn:active:not(:disabled) { transform: scale(0.96); }

/* Account menu: native disclosure, closed by outside click or Escape when JS runs. */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-trigger { transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease); }
.user-trigger:active { background: var(--surface-2); }
.user-trigger > .ico { width: 14px; height: 14px; color: var(--text-3); transition: transform var(--dur-2) var(--ease); }
.user-menu[open] > .user-trigger { border-color: var(--cobalt-line); }
.user-menu[open] > .user-trigger > .ico { transform: rotate(180deg); }
.user-menu-panel { position: absolute; top: calc(100% + 6px); right: 0; min-width: 232px; transform-origin: top right; }
.user-menu-panel form { margin: 0; }
.menu-label strong { color: var(--text); font-weight: 600; }
.menu-item { width: 100%; align-items: center; border: 0; background: none; font: inherit; font-size: 0.8125rem; text-align: left; text-decoration: none; transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.menu-item .ico { color: var(--text-3); }
.menu-item:hover, .menu-item:focus-visible { background: var(--cobalt-soft); color: var(--cobalt-text); text-decoration: none; }
.menu-item:hover .ico, .menu-item:focus-visible .ico { color: inherit; }

/* Toasts: confirmations hide after a few seconds, errors stay until dismissed. */
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 150; display: grid; justify-items: end; gap: 8px; pointer-events: none; }
.toast-region .toast { position: relative; align-items: center; pointer-events: auto; animation: toast-in var(--dur-3) var(--ease) both; }
.toast-region .toast-title { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.inline-info { border-color: var(--cobalt-line); background: var(--cobalt-soft); color: var(--cobalt-text); }

/* ===== Page structure ===== */
.page-header h1 { font-size: 1.375rem; }
.page-header + .panel, .page-header + .admin-layout, .page-header + .home-grid { margin-top: 0; }
.page-context .ico { width: 13px; height: 13px; }
.scope-chip .ico { width: 12px; height: 12px; }
.panel { min-width: 0; }
.panel > h2 { padding: 14px 16px 0; }
.panel-pad { padding: 16px; }
.panel-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; border-top: 1px solid var(--border); border-radius: 0 0 var(--r-md) var(--r-md); background: var(--surface-2); }
.panel > .table-scroll { border: 0; border-radius: 0 0 var(--r-md) var(--r-md); }
.panel-count { font-variant-numeric: tabular-nums; }
.empty-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 4px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); color: var(--text-3); }
.empty-icon .ico { width: 20px; height: 20px; }
.form-stack { display: grid; gap: 14px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.check-row { display: inline-flex; align-items: center; gap: 8px; width: fit-content; font-size: 0.8125rem; font-weight: 500; cursor: pointer; }
.check-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--cobalt); }
.tag-muted { color: var(--text-3); }
.data-table.is-static tbody tr, .users-table tbody tr, .activity-table tbody tr, .admin-layout .data-table tbody tr { cursor: default; }

/* KPI tiles that open the list behind the number. */
a.kpi-button { display: flex; color: inherit; text-decoration: none; }
a.kpi-button:hover { text-decoration: none; }
a.kpi-button:active { background: var(--surface-3); }
.kpi-button .kpi-label { display: flex; align-items: center; gap: 6px; }
.kpi-red .kpi-value { color: var(--red-text); }

/* ===== Home ===== */
.home-header { margin-bottom: 16px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 16px; align-items: start; }
.home-main, .home-side { display: grid; gap: 16px; min-width: 0; }
.home-grid .panel + .panel { margin-top: 0; }
.home-table { table-layout: auto; }
.home-table th { position: static; }
.home-table tbody tr { position: relative; }
.home-table .col-prio { width: 84px; }
.home-table .col-state { width: 150px; }
.home-table .col-updated { width: 180px; color: var(--text-2); white-space: nowrap; }
.home-table tbody tr:last-child td { border-bottom: 0; }
.row-link { text-decoration: none; }
.row-link::after { content: ''; position: absolute; inset: 0; }
.row-link:focus-visible { outline: none; }
.row-link:focus-visible::after { border-radius: 4px; outline: var(--focus-ring); outline-offset: -2px; }
.home-list { margin: 0; padding: 0; list-style: none; }
.home-list li + li { border-top: 1px solid var(--border); }
.home-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; color: var(--text); text-decoration: none; transition: background-color var(--dur-1) var(--ease); }
.home-row:hover { background: var(--surface-2); text-decoration: none; }
.home-row:active { background: var(--surface-3); }
.home-row:focus-visible { outline-offset: -2px; }
.home-list li:last-child .home-row { border-radius: 0 0 var(--r-md) var(--r-md); }
.home-row-text { display: grid; flex: 1; gap: 2px; min-width: 0; }
.home-row-text strong { font-size: 0.8125rem; font-weight: 600; }
.home-row-text small { color: var(--text-3); font-size: 0.75rem; }
.home-row-text > .status { justify-self: start; }
.home-count { min-width: 28px; margin-left: auto; color: var(--text); font-size: 0.9375rem; font-weight: 600; text-align: right; }
.home-row.is-zero .home-count { color: var(--text-3); font-weight: 500; }
.home-bars { display: grid; gap: 4px; margin: 0; padding: 10px 10px 6px; list-style: none; }
.home-bars a { display: grid; grid-template-columns: 40px minmax(0, 1fr) 30px; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; transition: background-color var(--dur-1) var(--ease); }
.home-bars a:hover { background: var(--surface-2); text-decoration: none; }
.home-bars .home-count { font-size: 0.8125rem; }
.bar { --bar: var(--cobalt); display: block; width: 100%; height: 8px; border: 0; border-radius: 4px; background: var(--surface-3); overflow: hidden; -webkit-appearance: none; appearance: none; }
.bar::-webkit-progress-bar { border-radius: 4px; background: var(--surface-3); }
.bar::-webkit-progress-value { border-radius: 4px; background: var(--bar); }
.bar::-moz-progress-bar { border-radius: 4px; background: var(--bar); }
.bar-p1 { --bar: var(--red); }
.bar-p2 { --bar: #e8912d; }
.bar-p3 { --bar: var(--cobalt); }
.bar-p4 { --bar: color-mix(in srgb, var(--text-3) 70%, transparent); }
.home-states { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 6px 0 0; border-top: 1px solid var(--border); }
.home-states > div { display: grid; gap: 2px; padding: 10px 16px 12px; }
.home-states > div + div { border-left: 1px solid var(--border); }
.home-states dt { color: var(--text-3); font-size: 0.6875rem; font-weight: 500; }
.home-states dd { margin: 0; font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Incident priority and status chips (text always present, colour reinforces it). */
.prio { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px; padding: 0 7px; border: 1px solid transparent; border-radius: 5px; font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.prio-p1 { border-color: var(--red-line); background: var(--red-soft); color: var(--red-text); }
.prio-p2 { border-color: var(--amber-line); background: var(--amber-soft); color: var(--amber-text); }
.prio-p3 { border-color: var(--cobalt-line); background: var(--cobalt-soft); color: var(--cobalt-text); }
.prio-p4 { background: var(--surface-3); color: var(--text-2); }

/* ===== Sign-in, MFA and first-run screens ===== */
.auth-screen { position: relative; background: radial-gradient(900px 480px at 50% -10%, rgb(91 116 255 / 0.22), transparent 70%), var(--rail-bg); }
.auth-tools { position: absolute; top: 16px; right: 16px; }
.auth-tools .btn-ghost { --btn-fg: var(--rail-text); }
.auth-tools .btn-ghost:hover { --btn-bg: var(--rail-hover); --btn-fg: #fff; }
.auth-tools :focus-visible { outline-color: var(--focus-on-ink); }
.auth-card { width: min(420px, 100%); gap: 18px; padding: 28px 28px 22px; animation: rise-in var(--dur-3) var(--ease) both; }
.auth-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-card .startup-brand { margin-top: -6px; }
.auth-card .startup-brand .wordmark-text { letter-spacing: 0.08em; }
.auth-heading { display: grid; gap: 4px; }
.auth-heading .error-code { margin-bottom: 6px; }
.auth-form { gap: 14px; }
.auth-submit { width: 100%; margin-top: 2px; }
.auth-alt { display: flex; justify-content: center; margin: -8px 0 0; }
.auth-foot { padding-top: 14px; border-top: 1px solid var(--border); line-height: 1.4; text-wrap: pretty; }
.auth-foot .ico, .auth-warning .ico { width: 13px; height: 13px; flex: none; }
.auth-warning { display: flex; align-items: flex-start; gap: 6px; }
.otp-input { font-size: 1.125rem; letter-spacing: 0.4em; text-align: center; }
.qr-frame { display: grid; place-items: center; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: #fff; }
.qr-code { display: block; width: 200px; max-width: 100%; height: auto; }

/* ===== Error pages ===== */
.error-panel { max-width: 640px; margin: 48px auto 0; }
.error-body { display: grid; justify-items: start; gap: 10px; padding: 32px; }
.error-code { display: inline-flex; align-items: center; gap: 6px; width: fit-content; height: 24px; padding: 0 9px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; }
.error-code .ico { width: 13px; height: 13px; }
.error-detail { max-width: 60ch; color: var(--text-2); }
.error-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ===== Administration ===== */
.admin-layout { display: grid; gap: 16px; align-items: start; }
.admin-layout.has-side { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
.admin-layout > .panel + .panel { margin-top: 0; }
.admin-layout .data-table { table-layout: auto; }
.admin-layout .data-table th, .activity-table th { position: static; }
.admin-layout .data-table tbody tr:last-child td, .activity-table tbody tr:last-child td { border-bottom: 0; }
.form-panel .panel-header { align-items: flex-start; }
.form-panel .field-row { grid-template-columns: minmax(0, 1fr); }
.person-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-cell > span:last-child { display: grid; min-width: 0; }
.person-cell .user-initials { width: 30px; height: 30px; background: var(--cobalt-soft); color: var(--cobalt-text); }
.person-cell .row-sub { margin-top: 1px; font-family: var(--font-mono); }
.role-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.role-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.grant-role { font-weight: 500; }
.cell-email { color: var(--text-2); }
.col-code { width: 120px; }
.activity-table { table-layout: auto; }
.activity-table .col-when { width: 190px; color: var(--text-2); white-space: nowrap; }
.activity-table .row-sub { font-family: var(--font-mono); font-size: 0.6875rem; }
.event-facts { display: grid; gap: 2px; margin: 0; font-size: 0.75rem; }
.event-facts > div { display: flex; flex-wrap: wrap; gap: 0 6px; min-width: 0; }
.event-facts dt { color: var(--text-2); font-weight: 600; }
.event-facts dt::after { content: ":"; }
.event-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.event-detail > summary { width: fit-content; color: var(--cobalt-text); font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.event-detail pre { max-width: 52ch; max-height: 240px; margin: 6px 0 0; padding: 8px 10px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); font-size: 0.6875rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ===== Older vocabulary still used by incident, intake and report templates ===== */
.eyebrow { color: var(--cobalt-text); font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.1em; }
.page-heading { display: grid; gap: 8px; margin-bottom: 24px; }
.page-heading h1 { font-size: 1.5rem; }
.stack { display: grid; gap: 16px; margin-top: 20px; }
.field > label { font-size: 0.78rem; font-weight: 600; }
.field :is(input:not([type='checkbox'], [type='radio'], [type='hidden']), select):not(.input, .select, .textarea) { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); }
.field :is(input, select):not(.input, .select, .textarea):focus-visible { border-color: var(--cobalt); }
.notice { margin-bottom: 20px; padding: 12px 14px; border: 1px solid var(--cobalt-line); border-radius: var(--r-sm); background: var(--cobalt-soft); color: var(--text-2); font-size: 0.8125rem; }
.notice-error { border-color: var(--red-line); background: var(--red-soft); color: var(--red-text); }
.narrow-panel { max-width: 560px; }
.two-columns { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric { display: grid; gap: 8px; }
.metric strong { font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric span { color: var(--text-3); font-size: 0.78rem; }
.status-list { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.status-list li { padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.status-label { display: inline-flex; padding: 3px 8px; border-radius: var(--r-xs); background: var(--teal-soft); color: var(--teal-text); font-size: 0.7rem; font-weight: 600; }
.status-pending { background: var(--amber-soft); color: var(--amber-text); }
.satria-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; text-align: left; }
.satria-table th { background: var(--surface-2); color: var(--text-3); font-weight: 600; }
.satria-table th, .satria-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.satria-table pre { max-width: 40rem; margin: 0; font-size: 0.72rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.satria-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.satria-main > .satria-actions { margin: 0 0 16px; }
.page-head { display: grid; gap: 6px; margin-bottom: 22px; }
.page-head h1 { font-size: 1.375rem; }
.page-head p { max-width: 75ch; color: var(--text-2); }
.card { min-width: 0; margin-bottom: 16px; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); }
.card > h2 { margin-bottom: 12px; }
.card h3 { margin: 14px 0 4px; color: var(--text-3); font-size: 0.8125rem; font-weight: 600; }
.card dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: 0.8125rem; }
.card dt { color: var(--text-3); }
.card dd { margin: 0; overflow-wrap: anywhere; }
.card article { padding: 12px 0; border-bottom: 1px solid var(--border); }
.card article:last-of-type { border-bottom: 0; }
.card ul { display: grid; gap: 6px; margin: 0; padding-left: 18px; }
.card .field { margin-bottom: 14px; }
.card textarea:not(.textarea) { width: 100%; min-height: 88px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; }
.table-wrap { padding: 0; overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.table-wrap th, .table-wrap td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table-wrap th { background: var(--surface-2); color: var(--text-3); font-weight: 600; white-space: nowrap; }
.table-wrap tbody tr:hover { background: var(--tint); }
.satria-pre { max-width: 75ch; margin: 4px 0 0; font-family: var(--font-sans); font-size: 0.875rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Grid siblings must align: components.css stacks consecutive panels with a top margin. */
:is(.metrics, .two-columns) > .panel + .panel { margin-top: 0; }

/* Status and urgency: text always present, colour reinforces it. */
.status { display: inline-flex; align-items: center; gap: 7px; padding: 1px 10px 1px 8px; border: 1px solid transparent; border-radius: var(--r-pill); font-size: 0.75rem; font-weight: 600; line-height: 20px; white-space: nowrap; }
.status::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-submitted, .status-open { border-color: var(--cobalt-line); background: var(--surface); color: var(--cobalt-text); }
.status-submitted::before, .status-open::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.status-acknowledged { background: var(--cobalt-soft); color: var(--cobalt-text); }
.status-in_progress { background: var(--cobalt); color: #fff; }
.status-waiting_client, .status-awaiting_client { border-color: var(--amber-line); background: var(--amber-soft); color: var(--amber-text); }
.status-resolved { border-color: color-mix(in srgb, var(--teal) 35%, transparent); background: var(--teal-soft); color: var(--teal-text); }
.status-closed, .status-cancelled { background: var(--surface-3); color: var(--text-2); }
/* Queue and Home: two chips per incident. The work state (what a person must do next) is the primary chip;
   the lifecycle (open, in progress, waiting, resolved, closed) is secondary, so it is muted and keeps its colour
   only in the dot. Classes: .chip-work on .readiness-badge, .chip-lifecycle on .status (or on a wrapper);
   macros work_chip() and lifecycle_chip() in _ui.html. The Status cells of the current queue/Home markup get
   the same muted look until they carry the class. */
.status.chip-lifecycle, .chip-lifecycle .status, .queue-row td[data-label='Status'] .status, .home-table .col-state .status { border-color: var(--border); background: var(--surface); color: var(--text-2); font-weight: 500; }
.status-open.chip-lifecycle::before, .chip-lifecycle .status-open::before, .queue-row td[data-label='Status'] .status-open::before, .home-table .col-state .status-open::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--cobalt); }
.status-in_progress.chip-lifecycle::before, .chip-lifecycle .status-in_progress::before, .queue-row td[data-label='Status'] .status-in_progress::before, .home-table .col-state .status-in_progress::before { background: var(--cobalt); }
.status-awaiting_client.chip-lifecycle::before, .chip-lifecycle .status-awaiting_client::before, .queue-row td[data-label='Status'] .status-awaiting_client::before, .home-table .col-state .status-awaiting_client::before { background: var(--amber-text); }
.status-resolved.chip-lifecycle::before, .chip-lifecycle .status-resolved::before, .queue-row td[data-label='Status'] .status-resolved::before, .home-table .col-state .status-resolved::before { background: var(--teal); }
.status-closed.chip-lifecycle::before, .chip-lifecycle .status-closed::before, .queue-row td[data-label='Status'] .status-closed::before, .home-table .col-state .status-closed::before { background: var(--text-3); }
.readiness-badge.chip-work, .chip-work .readiness-badge, .queue-row td[data-label='Work state'] .readiness-badge { font-weight: 600; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 28%, transparent); }
.urg { display: inline-flex; align-items: center; padding: 0 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 500; line-height: 22px; white-space: nowrap; }
.urg-normal { color: var(--text-2); }
.urg-high { background: var(--amber-soft); color: var(--amber-text); font-weight: 600; }
.urg-critical { background: var(--red-soft); color: var(--red-text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--red-line); }

/* ===== Service requests ===== */
.rq-page { display: grid; gap: 16px; }
.rq-page > .page-header { margin-bottom: 0; }
.rq-narrow { max-width: 920px; }
.rq-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.rq-header h1 { font-size: 1.375rem; }
.rq-lede { max-width: 75ch; margin-top: 6px; color: var(--text-2); }
.rq-ledger { min-width: 0; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); }
.rq-views { display: flex; gap: 2px; padding: 0 12px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.rq-views a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-bottom: 2px solid transparent; color: var(--text-2); font-size: 0.8125rem; font-weight: 500; text-decoration: none; white-space: nowrap; transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
.rq-views a:hover { color: var(--text); text-decoration: none; }
.rq-views a[aria-current='page'] { border-bottom-color: var(--ax-pink, var(--cobalt)); color: var(--text); font-weight: 600; }
.rq-views a:focus-visible { outline-offset: -2px; }
.rq-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rq-control { display: grid; gap: 5px; }
.rq-control label { color: var(--text-2); font-size: 0.75rem; font-weight: 600; }
.rq-control select { min-width: 230px; }
.rq-filter-actions { display: flex; gap: 6px; }
.rq-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.rq-table th { padding: 9px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); font-size: 0.72rem; font-weight: 600; text-align: left; white-space: nowrap; }
.rq-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.rq-table tbody tr:last-child td { border-bottom: 0; }
.rq-row { position: relative; transition: background-color var(--dur-1) var(--ease); }
.rq-row:hover { background: var(--surface-2); }
.rq-row.is-unread { background: color-mix(in srgb, var(--cobalt-soft) 30%, var(--surface)); }
.rq-row.is-unread:hover { background: var(--tint-strong); }
.rq-main { width: 40%; }
.rq-title-cell { display: flex; align-items: flex-start; padding-left: 18px; }
.rq-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--cobalt); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cobalt) 18%, transparent); }
.rq-title-cell > .rq-dot { margin: 6px 10px 0 -18px; }
.rq-link { color: var(--text); font-size: 0.875rem; font-weight: 500; text-decoration: none; }
.rq-link::after { content: ''; position: absolute; inset: 0; }
.rq-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.rq-link:focus-visible { outline: none; }
.rq-link:focus-visible::after { border-radius: 6px; outline: var(--focus-ring); outline-offset: -3px; }
.is-unread .rq-link { font-weight: 700; }
.rq-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 3px; color: var(--text-3); font-size: 0.75rem; }
.rq-number { color: var(--text-2); font-family: var(--font-mono); font-size: 0.75rem; }
.rq-code { display: inline-flex; align-items: center; padding: 0 6px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500; line-height: 20px; white-space: nowrap; }
.rq-org { min-width: 180px; }
.rq-org-name { color: var(--text-2); }
.rq-sub { display: block; margin-top: 3px; color: var(--text-3); font-size: 0.75rem; }
.rq-updated { color: var(--text-2); white-space: nowrap; }
.rq-cell-label { display: none; }
.rq-muted { color: var(--text-3); }
.rq-empty { display: grid; justify-items: center; gap: 8px; padding: 48px 24px; color: var(--text-2); text-align: center; }
.rq-empty > .ico { width: 40px; height: 40px; padding: 10px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); color: var(--text-3); }
.rq-empty-title { color: var(--text); font-size: 0.9375rem; font-weight: 600; }
.rq-empty .btn { margin-top: 6px; }
.rq-cap { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 11px 16px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 0.75rem; }
.rq-cap .rq-dot { margin-right: 6px; vertical-align: 1px; }
.rq-group { overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); }
.rq-group-head { padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rq-revisions .rq-group-head { background: var(--tint); }
.rq-group-head h2 { font-size: 0.9375rem; }
.rq-group-head p { margin-top: 3px; color: var(--text-2); font-size: 0.8125rem; }
.rq-options { margin: 0; padding: 0; list-style: none; }
.rq-options li + li { border-top: 1px solid var(--border); }
.rq-option { display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 12px 20px; color: var(--text); text-decoration: none; transition: background-color var(--dur-1) var(--ease); }
.rq-option:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.rq-option:active { background: var(--surface-3); }
.rq-option:focus-visible { outline: var(--focus-ring); outline-offset: -2px; }
.rq-option-text { display: grid; gap: 2px; min-width: 0; }
.rq-option-title { font-size: 0.875rem; font-weight: 600; }
.rq-option-help { color: var(--text-2); font-size: 0.8125rem; }
.rq-option > .ico { margin-left: auto; color: var(--text-3); transition: transform var(--dur-2) var(--ease), color var(--dur-1) var(--ease); }
.rq-option:hover > .ico { color: var(--cobalt-text); transform: translateX(2px); }
.rq-none { padding: 16px 20px; color: var(--text-2); font-size: 0.8125rem; }
/* Request detail and form */
.rq-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: -4px 0 16px; }
.rq-audience { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--text-3); font-size: 0.75rem; }
.rq-audience .ico { width: 13px; height: 13px; }
.req-layout .panel + .panel { margin-top: 0; }
.panel > .req-details th, .panel > .req-details td { padding: 10px 16px; }
.req-details tr:last-child :is(th, td) { border-bottom: 0; }
.req-details .satria-pre { margin: 0; font-size: 0.8125rem; }
.req-thread .muted { font-size: 0.8125rem; }
.req-msg header time { color: var(--text-3); }
.req-msg .satria-pre { margin: 0; font-size: 0.8125rem; }
.req-compose { gap: 12px; margin-top: 4px; padding-top: 14px; }
.rq-facts { display: grid; margin: 0; padding: 4px 16px 8px; }
.rq-facts > div { display: grid; grid-template-columns: minmax(104px, 40%) minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.8125rem; }
.rq-facts > div:last-child { border-bottom: 0; }
.rq-facts dt { color: var(--text-3); }
.rq-facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.req-history { counter-reset: none; }
.req-history li > span { color: var(--text); }
.rq-withdraw { display: grid; justify-items: start; gap: 6px; }
.req-form-panel .req-form { padding: 20px; }
.req-form .req-note { margin: 0; }
.req-form .req-h { margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 0.9375rem; }
.req-form-type span { color: var(--text-3); font-size: 0.72rem; font-weight: 600; }
.req-error { display: flex; align-items: center; gap: 5px; }
.req-error .ico { width: 13px; height: 13px; }
.inline-error ul { margin: 6px 0 0; padding-left: 18px; }

/* Automation: readable forms, gate chips, stacked tables and draft preview. */
.page-head:has(> .btn) { grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 20px; }
.page-head > .btn { justify-self: start; }
.auto-lede, .auto-help { max-width: 75ch; margin: 0 0 12px; color: var(--text-2); font-size: 0.8125rem; }
.auto-id { font-family: var(--font-mono); font-size: 0.75rem; overflow-wrap: anywhere; }
.auto-empty { color: var(--text-2); }
.auto-missing { margin: 0 0 10px; color: var(--text-2); font-size: 0.8125rem; }
.auto-version { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 10px; color: var(--text-2); font-size: 0.8125rem; }
.auto-reason { display: inline-block; margin: 0 4px 4px 0; padding: 0 7px; border-radius: 6px; background: var(--amber-soft); color: var(--amber-text); font-family: var(--font-mono); font-size: 0.6875rem; line-height: 20px; }
/* Runtime gates: text states the fact, colour only reinforces it. */
.gates { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.gate { display: inline-flex; align-items: center; gap: 7px; padding: 2px 11px 2px 9px; border-radius: var(--r-pill); font-size: 0.75rem; font-weight: 600; line-height: 20px; }
.gate::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.gate-off { background: var(--surface); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
.gate-on { background: var(--amber-soft); color: var(--amber-text); box-shadow: inset 0 0 0 1px var(--amber-line); }
.auto-gates p { margin: 0 0 4px; }
.auto-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items: end; gap: 12px 16px; min-width: 0; margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
.auto-form-plain { margin-top: 10px; padding: 0; border: 0; background: none; }
.auto-form-title { grid-column: 1 / -1; margin: 0; color: var(--text); font-size: 0.875rem; font-weight: 600; }
.auto-wide, .auto-actions, .auto-form > .auto-help { grid-column: 1 / -1; }
.auto-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.auto-field { display: grid; gap: 6px; min-width: 0; color: var(--text-2); font-size: 0.8125rem; font-weight: 600; }
.auto-field small { color: var(--text-3); font-weight: 500; }
.auto-field :is(input, select, textarea) { width: 100%; min-width: 0; max-width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; font-weight: 400; box-shadow: inset 0 1px 2px rgb(16 24 40 / 0.05); }
.auto-field textarea { min-height: 170px; font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.5; resize: vertical; }
.auto-field :is(input, select, textarea):focus-visible { border-color: var(--cobalt); outline: var(--focus-ring); outline-offset: 1px; }
.auto-inline { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; min-width: 0; }
.auto-inline .auto-field { flex: 1 1 170px; }
.auto-inline .auto-field :is(input, select) { min-height: 36px; padding: 6px 10px; }
.card details { margin-top: 6px; }
.card details > summary { width: fit-content; padding: 6px 0; color: var(--cobalt-text); font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.auto-code, .auto-guide .satria-pre { max-width: 100%; margin: 8px 0; padding: 12px 14px; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: color-mix(in srgb, var(--surface-2) 80%, var(--surface)); color: var(--text); font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.55; white-space: pre; overflow-wrap: normal; }
.auto-usecase-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.auto-usecase-head h2 { margin: 0; }
.auto-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.auto-panel { min-width: 0; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--cobalt-line) 55%, transparent); border-radius: 10px; background: var(--tint); }
.card .auto-panel h3 { margin: 0 0 8px; color: var(--text); font-size: 0.875rem; }
/* Prose fields (email opening/signature) read like the email, not like code. */
.auto-field textarea.auto-prose { font-family: inherit; min-height: 96px; font-size: 0.875rem; line-height: 1.55; }

/* Settings (/admin/automation): Demo v2 configuration layout, sticky section nav, one panel per section. */
.settings-gates { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 18px; }
.settings-gates .gates { margin: 0; }
.settings-gates p { margin: 0; }
.settings-gates a { color: var(--cobalt-text); font-weight: 600; }
.settings-nav { padding: 6px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--elev-1); }
.settings-nav a { position: relative; display: flex; align-items: center; min-height: 36px; }
.settings-nav a:focus-visible { outline: var(--focus-ring); outline-offset: 1px; }
.settings-section { scroll-margin-top: calc(var(--topbar-h) + 16px); overflow: clip; }
.settings-section:target { box-shadow: var(--shadow-1), 0 0 0 2px var(--cobalt-line); }
.settings-section > .panel-header { align-items: flex-start; flex-wrap: wrap; background: linear-gradient(180deg, var(--tint), var(--surface)); }
.settings-section > .panel-header > div:first-child { flex: 1 1 320px; min-width: 0; }
.settings-section .panel-description { max-width: 72ch; margin-top: 4px; color: var(--text-2); font-size: 0.8125rem; line-height: 1.5; text-wrap: pretty; }
.settings-section .panel-actions .btn { white-space: nowrap; }
.settings-body { display: grid; gap: 16px; }
.settings-body > * { min-width: 0; }
.settings-sub { margin: 4px 0 -8px; color: var(--text); font-size: 0.8125rem; font-weight: 600; }
.settings-table { border: 1px solid var(--border); border-radius: var(--r-sm); }
.settings-table table { font-size: 0.8125rem; }
.settings-table th, .settings-table td { padding: 9px 12px; }
.settings-table td { vertical-align: middle; }
@media (min-width: 1101px) { .settings-table .auto-id { white-space: nowrap; } .settings-table td[data-label='Change'] { min-width: 270px; } .settings-table td[data-label='Use case'] { min-width: 170px; } .settings-mappings .auto-id { white-space: normal; } }
.settings-table tbody tr:last-child td { border-bottom: 0; }
.settings-name { color: var(--text); font-weight: 600; }
.auto-id.is-missing { color: var(--amber-text); font-family: var(--font-sans); font-weight: 600; }
.settings-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--border); }
.settings-counts > div { padding: 10px 14px; background: var(--surface-2); }
.settings-counts dt { color: var(--text-3); font-size: 0.72rem; font-weight: 600; }
.settings-counts dd { margin: 2px 0 0; color: var(--text); font-size: 1.125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.settings-form-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 16px; align-items: start; }
.settings-form-pair .auto-form { margin-top: 0; }
.settings-body .auto-form { background: var(--surface-2); }
.settings-body .auto-form-plain { background: none; }
.settings-body .auto-inline { flex-wrap: nowrap; }
.settings-body .auto-inline .auto-field { flex: 1 1 150px; }
.settings-body .auto-inline .auto-field > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.settings-body .auto-inline .auto-field input::placeholder { color: var(--text-3); }
/* Email template cards: one use case at a time (CSS :target, no script), form beside a mail preview.
   Without :has() support every card stays visible, which is still usable. */
.email-cards > .email-card { display: none; }
.email-cards > .email-card:first-child, .email-cards > .email-card:target { display: block; }
.email-cards:has(> .email-card:target) > .email-card:not(:target) { display: none; }
.email-card { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.email-tabs { display: flex; gap: 6px; margin: 0 0 14px; padding-bottom: 12px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.email-tab { display: grid; flex: 0 0 auto; gap: 1px; max-width: 240px; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-2); font-size: 0.78rem; font-weight: 600; text-decoration: none; transition: background-color 120ms ease-out, border-color 120ms ease-out; }
.email-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-tab small { color: var(--text-3); font-size: 0.6875rem; font-weight: 500; }
.email-tab:hover { border-color: var(--border-strong); color: var(--text); }
.email-tab.is-current { border-color: var(--cobalt-line); background: var(--cobalt-soft); color: var(--cobalt-text); box-shadow: inset 0 -2px 0 var(--cobalt); }
.email-tab.is-current small { color: var(--cobalt-text); }
.email-tab:focus-visible { outline: var(--focus-ring); outline-offset: 1px; }
.email-card { padding: 16px 18px 18px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--elev-1); }
.email-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.email-card-head h3 { margin: 0 4px 0 0; color: var(--text); font-size: 0.9375rem; font-weight: 600; }
.email-card-reason { min-width: 0; color: var(--text-3); font-size: 0.75rem; overflow-wrap: anywhere; }
.email-card-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.email-card-form { margin-top: 0; }
.email-card-preview { display: grid; gap: 10px; min-width: 0; position: sticky; top: calc(var(--topbar-h) + 16px); }
.email-card-preview .settings-sub { margin: 0; }
.auto-mail { overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.auto-mail-head { display: grid; gap: 4px; margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 0.75rem; }
.auto-mail-head > div { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
.auto-mail-head dt { color: var(--text-3); font-weight: 600; }
.auto-mail-head dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.auto-mail-body { display: grid; gap: 10px; margin: 10px; padding: 14px 16px; border-radius: 4px; background: #fff; color: #1f2937; font-family: Aptos, Calibri, Arial, sans-serif; font-size: 0.875rem; line-height: 1.5; box-shadow: 0 1px 2px rgb(16 24 40 / 0.08); }
.auto-mail-text { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.auto-mail-slot { margin: 0; padding: 8px 10px; border: 1px dashed #9aa4b2; border-radius: 4px; background: #f5f7fb; color: #4b5563; font-size: 0.8125rem; }
/* Collapsible rows (policies, delivery routes): one line per item, the form opens in place. */
.settings-rows { gap: 0; padding-top: 6px; padding-bottom: 6px; }
.settings-row { border-bottom: 1px solid var(--border); }
.settings-row:last-of-type { border-bottom: 0; }
.settings-row > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 48px; padding: 6px 4px; cursor: pointer; list-style: none; }
.settings-row > summary::-webkit-details-marker { display: none; }
.settings-row > summary:hover { background: var(--tint); }
.settings-row > summary:focus-visible { outline: var(--focus-ring); outline-offset: -2px; }
.settings-row-name { min-width: 0; color: var(--text); font-size: 0.8125rem; font-weight: 600; overflow-wrap: anywhere; }
.settings-row-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
.settings-row-note { color: var(--text-3); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.settings-row-edit { display: inline-flex; align-items: center; gap: 4px; color: var(--cobalt-text); font-size: 0.75rem; font-weight: 600; }
.settings-row-edit::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform var(--dur-1, 120ms) ease-out; }
.settings-row[open] > summary .settings-row-edit::after { transform: translateY(1px) rotate(-135deg); }
.settings-row[open] > summary { background: var(--tint); }
.settings-row-body { padding: 4px 4px 18px; }
.settings-more > summary { width: fit-content; padding: 6px 0; color: var(--cobalt-text); font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.settings-more .auto-field { margin-top: 8px; }
.settings-rows > .auto-guide { margin-top: 12px; }
/* Safety gates: each switch stated in words, colour only reinforces it. */
.gate-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; margin: 0; }
.gate-fact { padding: 12px 14px; border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface-2); }
.gate-fact.is-on { border-left-color: var(--amber-text); background: var(--amber-soft); }
.gate-fact dt { color: var(--text-3); font-size: 0.72rem; font-weight: 600; }
.gate-fact dd { display: grid; gap: 2px; margin: 4px 0 0; }
.gate-fact strong { color: var(--text); font-size: 0.875rem; }
.gate-fact span { color: var(--text-2); font-size: 0.78rem; line-height: 1.45; }
@media (max-width: 1100px) {
  .email-card-body { grid-template-columns: minmax(0, 1fr); }
  .email-card-preview { position: static; }
}
@media (max-width: 900px) {
  .settings-nav { position: sticky; top: var(--topbar-h); z-index: 5; flex-wrap: nowrap; gap: 4px; scrollbar-width: none; }
  .settings-nav a { flex: 0 0 auto; white-space: nowrap; }
}
/* Status chips for automation states (text always present). */
.status-accepted, .status-succeeded, .status-accepted_test, .status-enabled, .status-ready { border-color: color-mix(in srgb, var(--teal) 35%, transparent); background: var(--teal-soft); color: var(--teal-text); }
.status-held, .status-queued, .status-claimed, .status-reserved, .status-shadowed, .status-not_ready, .status-mode-shadow, .status-mode-test { border-color: var(--amber-line); background: var(--amber-soft); color: var(--amber-text); }
.status-blocked, .status-ambiguous, .status-rejected { border-color: var(--red-line); background: var(--red-soft); color: var(--red-text); }
.status-running, .status-mode-manual { background: var(--cobalt-soft); color: var(--cobalt-text); }
.status-disabled, .status-mode-off, .status-duplicate { background: var(--surface-3); color: var(--text-2); }
.status-mode-auto, .status-mode-live { background: var(--cobalt); color: #fff; }
:where(:root[data-theme='dark']) .status-mode-auto, :where(:root[data-theme='dark']) .status-mode-live { background: #3968e3; }  /* W13-P2: white text 4.93:1 (dark --cobalt #3b6ff0 is 4.45:1); dark only, at the chip's own weight */
/* Draft preview: what the analyst reviews, raw JSON stays one click away. */
.draft-preview { display: grid; gap: 14px; margin-top: 12px; padding: 18px 20px; border: 1px solid var(--border); border-left: 4px solid var(--cobalt); border-radius: 10px; background: var(--tint); box-shadow: var(--elev-1); }
.draft-preview.is-ready { border-left-color: var(--teal); }
.draft-preview.is-not-ready { border-left-color: var(--amber-text); }
.draft-head { display: grid; gap: 8px; }
.card .draft-subject { margin: 0; color: var(--text); font-size: 1.0625rem; font-weight: 600; overflow-wrap: anywhere; }
.draft-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.draft-priority { padding: 0 9px; border-radius: 6px; background: var(--surface); color: var(--text); font-size: 0.75rem; font-weight: 600; line-height: 22px; box-shadow: inset 0 0 0 1px var(--border-strong); }
.draft-issues { padding: 10px 14px; border: 1px solid var(--amber-line); border-radius: 8px; background: var(--amber-soft); color: var(--amber-text); font-size: 0.8125rem; }
.draft-issues p { margin: 0 0 6px; font-weight: 600; }
.draft-issues ul { display: grid; gap: 4px; margin: 0; padding-left: 18px; }
.draft-issue code { margin-left: 4px; font-family: var(--font-mono); font-size: 0.6875rem; opacity: 0.8; }
.draft-block h4 { margin: 0 0 4px; color: var(--text-3); font-size: 0.75rem; font-weight: 600; }
.draft-block p { max-width: 75ch; margin: 0; color: var(--text); line-height: 1.6; }
.draft-block ul { margin: 0; padding-left: 18px; }
.draft-table { background: var(--surface); }
.draft-foot { margin: 0; color: var(--text-3); font-size: 0.75rem; }

/* ===== Responsive ===== */
@media (min-width: 1101px) { .form-panel { position: sticky; top: calc(var(--topbar-h) + 16px); } }
@media (max-width: 1100px) {
  .home-grid, .admin-layout.has-side { grid-template-columns: minmax(0, 1fr); }
  .two-columns { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  /* No JS: the rail stays inline above the page. With JS it becomes a drawer opened from the menu button. */
  .satria-shell > .rail { display: flex; position: static; height: auto; overflow: visible; }
  :root[data-js='on'] .satria-shell > .rail { position: fixed; inset: 0 auto 0 0; z-index: 95; width: min(300px, 86vw); height: 100dvh; overflow-y: auto; box-shadow: var(--shadow-3); animation: drawer-left-in var(--dur-3) var(--ease); }
  :root[data-js='on'][data-rail-hidden='false'] body::after { content: ''; position: fixed; inset: 0; z-index: 90; background: var(--overlay); animation: fade-in var(--dur-2) var(--ease); }
  .satria-shell .rail-nav { overflow: visible; padding-bottom: 12px; }
  .satria-shell .rail-close { display: inline-flex; justify-content: center; min-width: 44px; height: 44px; }
  .satria-shell .rail-link { height: 44px; }
  .satria-shell .rail-collapse { display: none; }
  .satria-topbar { gap: 6px; padding: 0 12px; }
  .crumb-section, .topbar-crumbs > .ico:not(:last-child) { display: none; }
  .topbar-crumbs > .ico { display: none; }
  .satria-breadcrumb { flex: 1; }
  .data-mode { width: 28px; padding: 0; justify-content: center; }
  .data-mode > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .user-trigger { padding: 0 6px 0 3px; }
  .user-trigger > .ico { display: none; }
  .satria-main { padding-top: 16px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .page-header-row { align-items: stretch; flex-direction: column; }
  .page-actions { align-self: flex-start; }
  .error-body { padding: 22px; }
  .error-panel { margin-top: 16px; }
  .auth-card { padding: 22px 20px 18px; }
  .toast-region { right: 12px; bottom: 12px; left: 12px; justify-items: stretch; }
  .toast-region .toast { width: auto; }
  .home-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .home-kpis > .kpi { min-width: 0; border-right: 1px solid var(--border); }
  .home-kpis > .kpi:nth-child(2n) { border-right: 0; }
  .home-kpis > .kpi:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .home-kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: 0; }
  .home-table tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 12px 16px; }
  .home-table.data-table td[data-label]:not(.col-name)::before { display: none; }
  .home-table .col-name { flex: 1 0 100%; }
  .home-table .col-prio, .home-table .col-state { width: auto; }
  .home-table .col-updated { width: auto; margin-left: auto; font-size: 0.75rem; }
  .home-states > div { padding: 10px 12px; }
  .admin-layout .data-table td, .activity-table td { width: auto; }
  .activity-table .col-when, .home-table .col-updated { white-space: normal; }
  .rq-summary { margin-top: 0; }
  .rq-audience { flex: 1 0 100%; margin-left: 0; }
  .rq-header { align-items: stretch; flex-direction: column; }
  .rq-header .btn { align-self: flex-start; }
  .rq-views { flex-wrap: nowrap; }
  .rq-filters { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .rq-filters .rq-control:first-of-type { grid-column: 1 / -1; }
  .rq-control select { width: 100%; min-width: 0; min-height: 44px; font-size: 1rem; }
  .rq-table thead { display: none; }
  .rq-table, .rq-table tbody { display: block; }
  .rq-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .rq-table tbody tr:last-child { border-bottom: 0; }
  .rq-table td { display: block; padding: 0; border: 0; }
  .rq-main { flex: 1 0 100%; width: auto; }
  .rq-state { order: 1; margin-left: 18px; }
  .rq-urgency { order: 2; }
  .rq-team { order: 3; }
  .rq-org { order: 4; flex: 1 0 100%; min-width: 0; padding-left: 18px; font-size: 0.75rem; }
  .rq-org .rq-sub { display: inline; margin-left: 8px; }
  .rq-updated { order: 5; flex: 1 0 100%; padding-left: 18px; color: var(--text-3); font-size: 0.75rem; }
  .rq-cell-label { display: inline; margin-right: 4px; color: var(--text-3); font-size: 0.75rem; }
  .rq-option { min-height: 64px; padding: 14px 16px; }
  .rq-group-head { padding: 14px 16px; }
  .req-form-panel .req-form { padding: 16px; }
  .panel-footer { padding: 12px 16px; }
  .panel-footer .btn { flex: 1 1 auto; }
  .card { padding: 16px; }
  .card dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .card dd { margin-bottom: 8px; }
  .page-head:has(> .btn) { grid-template-columns: minmax(0, 1fr); }
  .metrics, .form-grid { grid-template-columns: 1fr; }
  .satria-table { min-width: 520px; }
  .auto-stack thead { display: none; }
  .auto-stack, .auto-stack tbody, .auto-stack tr, .auto-stack td { display: block; width: 100%; }
  .auto-stack tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .auto-stack tbody tr:last-child { border-bottom: 0; }
  .table-wrap .auto-stack td { padding: 4px 0; border: 0; overflow-wrap: anywhere; }
  .auto-stack td::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--text-3); font-size: 0.6875rem; font-weight: 600; }
  .auto-stack td[colspan]::before { content: none; }
  .auto-form { padding: 14px; }
  .auto-field :is(input, select, textarea) { min-height: 44px; font-size: 1rem; }
  .settings-body .auto-inline { flex-wrap: wrap; }
  .settings-body .auto-inline .auto-field { flex: 1 1 160px; }
  .settings-body .auto-inline .btn { flex: none; min-height: 44px; }
  /* Stacked registry rows: name and state on one line, identifiers and the change form below. */
  .settings-table .auto-stack tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
  .settings-table .auto-stack td { width: auto; grid-column: 1 / -1; }
  .settings-table .auto-stack td:first-child { grid-column: 1; }
  .settings-table .auto-stack td[data-label='State'] { grid-column: 2; grid-row: 1; align-self: start; }
  .settings-table .auto-stack td[data-label='State']::before, .settings-table .auto-stack td[data-label='Change']::before { content: none; }
  .settings-table .auto-stack td[data-label='Change'] { padding-top: 8px; }
  .settings-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-table { border: 0; }
  .settings-table th, .settings-table td { padding-left: 0; padding-right: 0; }
  .settings-row > summary { grid-template-columns: minmax(0, 1fr) auto; }
  .settings-row-meta { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .settings-section > .panel-header { padding: 14px; }
  .settings-section .panel-body { padding: 14px; }
  .email-card { padding: 14px; }
  .draft-preview { padding: 14px; }
}
@media (hover: none) { .rail-link:hover svg, .rq-option:hover > .ico { transform: none; } }
/* Reduced motion: the ONE global block lives in base.css (wave 20). */
