/* Admin console layer. Loaded after styles.css: shared components for every page (page header, KPI tiles,
   empty states, data toolbars, collapsible filters), the shell (breadcrumb, search trigger, System chip, bell,
   menu badges) and the spacing, radius and elevation tokens. Brand tokens (Poppins, #E20613, light and dark),
   radii, shadows and the glow stay in styles.css. */

:root{
  /* spacing scale */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-7: 32px; --space-8: 40px;
  /* elevation: the shadows from styles.css (none in the dark theme, apart from floating layers) */
  --elev-1: var(--shadow-md);
  --elev-2: var(--shadow-md);
  --elev-3: var(--shadow-lg);
  --tint-neutral: var(--chip);
}
/* ---------- page header ---------- */
.page-head{ display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3) var(--space-6); margin: var(--space-1) 0 var(--space-5); }
.page-head-main{ flex: 1 1 320px; min-width: 0; }
.page-head :is(h1, h2), .view .page-head :is(h1, h2), .view .page-head-main :is(h1, h2){ font-size: 30px; line-height: 36px; font-weight: 300; letter-spacing: -0.03em; margin: 0; }
.page-sub, .view .page-head .lede{ margin: var(--space-1) 0 0; max-width: 70ch; color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.page-actions{ display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-left: auto; }
.page-actions .lede{ margin: 0; }
.quick-actions{ display: contents; }
/* Pages not yet on the .page-head markup: a title, then a sub-line, then optional actions, get the same look. */
.view > h2, .view > .view-head h2{ font-size: 30px; line-height: 36px; font-weight: 300; letter-spacing: -0.03em; margin: var(--space-1) 0 0; }
.view > h2 + .lede{ margin: var(--space-1) 0 var(--space-5); max-width: 70ch; }
.view > h2 + .lede + .btn-row, .view > h2 + .lede + .page-actions{ margin: calc(var(--space-2) * -1) 0 var(--space-5); }
.view > .view-head{ margin: var(--space-1) 0 var(--space-5); align-items: flex-start; }

/* ---------- KPI tiles ---------- */
.kpi-grid{ display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.kpi, .stat-card{ --tone: var(--edge); --tone-ink: var(--ink-muted); }
.kpi{
  position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--space-4);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-md);
  color: inherit; text-decoration: none; overflow: hidden; text-align: left; font: inherit;
}
.kpi[data-tone="good"]{ --tone: var(--good); --tone-ink: var(--good); }
.kpi[data-tone="warn"]{ --tone: var(--warning); --tone-ink: var(--warning); }
.kpi[data-tone="bad"]{ --tone: var(--critical); --tone-ink: var(--critical); }
.kpi-label{ font-size: 13.5px; line-height: 20px; color: var(--ink-muted); }
.kpi-value{ font-size: 26px; line-height: 32px; font-weight: 300; letter-spacing: -0.025em; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-value.kpi-na{ color: var(--ink-faint); }
.kpi-status{ display: inline-flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--tone-ink); }
.kpi-dot{ width: 8px; height: 8px; border-radius: 50%; background: var(--tone); flex: none; }
.kpi-meta{ font-size: 13px; line-height: 18px; color: var(--ink-faint); margin-top: 2px; overflow-wrap: anywhere; }
.kpi-delta{ font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink-muted); }
.kpi-delta.up{ color: var(--good); } .kpi-delta.down{ color: var(--critical); }
a.kpi{ cursor: pointer; transition: background 150ms, box-shadow 150ms, transform 100ms; }
a.kpi:hover{ background: var(--hover); box-shadow: var(--elev-2); }
a.kpi:active{ transform: translateY(1px); }
a.kpi:focus-visible{ outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius); }
.link-btn{ display: inline; padding: 0; border: 0; background: none; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover{ text-decoration-color: var(--brand); }
.skeleton-row{ display: block; height: 14px; margin-top: var(--space-2); border-radius: 999px; background: var(--sunken); animation: pulse 1.4s ease-in-out infinite; }
.skeleton-row.w40{ width: 40%; } .skeleton-row.w60{ width: 60%; } .skeleton-row.w80{ width: 80%; }

/* Six tiles sit as two even rows of three instead of five and an orphan. */

a.stat-card, button.stat-card.clickable{ text-decoration: none; }

/* ---------- empty, loading, error ---------- */
.empty-state{ display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-8) var(--space-6); text-align: center; }
.empty-icon{ display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--chip); color: var(--ink-muted); }
.empty-icon svg{ width: 24px; height: 24px; }
.empty-state[data-icon="check"] .empty-icon{ background: var(--good-bg); color: var(--good); }
.empty-title{ font-size: 16px; line-height: 22px; font-weight: 500; color: var(--ink); margin-top: var(--space-1); }
.empty-text{ max-width: 46ch; margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.empty-action{ margin-top: var(--space-2); }
.popover .empty-state, .attn-card .empty-state{ padding: var(--space-6) var(--space-5); }
.errbox .errdetail{ margin-top: var(--space-2); font-size: 13px; color: var(--ink-muted); }
.errbox .errdetail summary{ cursor: pointer; font-weight: 500; }
.errbox .errdetail pre{ margin: 6px 0 0; padding: 8px 12px; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font: 12px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text); }
.errbox h3{ font-size: 15px; }

/* ---------- tables: toolbar, sticky header, density ---------- */
.data-toolbar{ display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2) var(--space-4); min-height: 48px; padding: var(--space-2) var(--space-5); border-bottom: 1px solid var(--line); }
.data-toolbar:has(.data-count:empty):not(:has(.data-actions)){ display: none; }
.data-count{ font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-muted); }
.data-actions{ display: flex; flex-wrap: wrap; gap: var(--space-2); margin-left: auto; }
.panel > .data-toolbar{ margin: 0 calc(var(--space-6) * -1); }
.panel > .data-toolbar:first-child{ margin-top: calc(var(--space-6) * -1); }
.panel > .data-toolbar + .table-wrap{ margin-top: 0; border-top: 0; }
.table-card{ background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--elev-1); overflow: clip; }
.table-card.scroll{ max-height: min(70vh, 640px); overflow: auto; }
.table-card .table-wrap{ border: 0; border-radius: 0; }
.table-card thead th, .table-wrap.sticky thead th{ position: sticky; top: 0; z-index: 1; }
td.num, th.num{ text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td{ background: var(--hover); }
/* Compact: a denser table for people who scan long lists. Remembered per browser (user menu). */
html[data-density="compact"] tbody td{ height: 32px; padding-top: 2px; padding-bottom: 2px; font-size: 13px; }
html[data-density="compact"] thead th{ height: 32px; }
html[data-density="compact"] .row-action-btn{ min-height: 26px; }
html[data-density="compact"] .btn.secondary[data-view-id]{ height: 28px; padding: 0 12px; font-size: 13px; }

/* ---------- collapsible filters ---------- */
.filters-collapsible{ margin-bottom: var(--space-4); }
.filters-collapsible > summary{ display: none; list-style: none; }
.filters-collapsible > summary::-webkit-details-marker{ display: none; }
.filters-collapsible > .panel, .filters-collapsible > form{ margin-bottom: 0; }
.filters-count{ color: var(--ink-muted); font-weight: 400; }
@media (min-width: 641px){
  /* Always open on wide screens. (The page also sets [open]; this keeps the body visible if it was closed.) */
  .filters-collapsible::details-content{ content-visibility: visible; display: block; }
}
@media (max-width: 640px){
  .filters-collapsible > summary{
    display: flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-4);
    background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--elev-1);
    font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer;
  }
  .filters-collapsible > summary::after{ content: ""; margin: -3px 2px 0 auto; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform 150ms; }
  .filters-collapsible[open] > summary::after{ transform: rotate(-135deg); margin-top: 3px; }
  .filters-collapsible[open] > summary{ border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: var(--line); }
  .filters-collapsible[open] > .panel, .filters-collapsible[open] > form{ border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
}

/* ---------- shell: top bar ---------- */
.topwrap{ gap: var(--space-2); }
.topbar{ flex: 1 1 auto; min-width: 0; }
.crumbs{ flex: 0 0 auto; min-width: 0; max-width: 36%; margin: 0 var(--space-3) 0 var(--space-3); }
.crumbs ol{ display: flex; align-items: center; margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 20px; white-space: nowrap; }
.crumbs li{ min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.crumb-group{ flex: none; color: var(--ink-faint); }
.crumb-group:not(:empty)::after{ content: "/"; margin: 0 var(--space-2); color: var(--line-2); color: var(--edge); }
.crumb-page{ color: var(--ink); font-weight: 500; }
.jump-trigger{
  display: flex; align-items: center; gap: var(--space-2); flex: 1 1 260px; min-width: 96px; max-width: 380px; height: 36px; margin: 0 auto; padding: 0 var(--space-3);
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface-2); color: var(--ink-muted); font-size: 13px; text-align: left; cursor: pointer; transition: background 150ms, border-color 150ms;
}
.jump-trigger:hover{ background: var(--hover); border-color: var(--edge); color: var(--ink); }
.jump-trigger svg{ width: 16px; height: 16px; flex: none; }
.jump-text{ flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jump-kbd{ flex: none; padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); color: var(--ink-faint); font: inherit; font-size: 12px; line-height: 16px; }
.sys-chip{
  --dot: var(--edge); display: inline-flex; align-items: center; gap: var(--space-2); flex: none; height: 30px; padding: 0 var(--space-3); border-radius: 999px;
  background: var(--chip); color: var(--ink-muted); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.sys-chip:hover{ filter: brightness(.97); }
/* a long verdict is cut with an ellipsis (its full words are in the chip's title) instead of widening the page */
.sys-chip{ min-width: 0; flex-shrink: 1; }
.sys-chip .sys-text{ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sys-chip[data-tone="good"]{ --dot: var(--good); background: var(--good-bg); color: var(--good); }
.sys-chip[data-tone="warn"]{ --dot: var(--warning); background: var(--warning-bg); color: var(--warning); }
.sys-chip[data-tone="bad"]{ --dot: var(--critical); background: var(--critical-bg); color: var(--critical); }
.sys-dot{ width: 8px; height: 8px; border-radius: 50%; background: var(--dot); flex: none; }
.bell-wrap{ position: relative; flex: none; }
.bell-btn{ position: relative; }
.bell-badge{ position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.popover{
  position: absolute; top: calc(100% + var(--space-3)); right: -48px; z-index: 60; width: min(400px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--elev-3);
}
.pop-head{ display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); color: var(--ink); }
.pop-head b{ font-weight: 500; }
.pop-count{ display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--warning-bg); color: var(--warning); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pop-list{ list-style: none; margin: 0; padding: var(--space-1) 0; }
.pop-item{ display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: var(--space-3); align-items: start; width: 100%; padding: var(--space-3) var(--space-4); border: 0; background: none; text-align: left; color: var(--text); cursor: pointer; }
.pop-item:hover, .pop-item:focus-visible{ background: var(--hover); }
.pop-item:focus-visible{ outline-offset: -2px; }
.pop-text{ display: block; min-width: 0; }
.pop-text b{ display: block; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.pop-text .m{ display: block; font-size: 13px; line-height: 18px; color: var(--ink-muted); overflow-wrap: anywhere; }
.ai{ display: grid; place-items: center; width: 24px; color: var(--ink-muted); }
.ai svg{ width: 20px; height: 20px; }
.ai.warn{ color: var(--warning); } .ai.bad{ color: var(--critical); } .ai.good{ color: var(--good); }
.pop-foot{ padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); }
.side-nav-menu{ box-shadow: var(--elev-3); }
.side-nav-menu #densityBtn[aria-pressed="true"]{ color: var(--ink); }
.side-nav-menu #densityBtn[aria-pressed="true"] svg{ color: var(--brand-dark); }

/* ---------- shell: sidebar ---------- */
.nav-group-solo{ margin-top: var(--space-1); }
.nav-group-solo + .nav-group{ margin-top: var(--space-3); }
.nav-badge{ margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--brand-tint); color: var(--brand-dark); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.side-foot{ flex: none; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); font-size: 12px; line-height: 16px; color: var(--ink-faint); text-transform: capitalize; }
html.rail .side-foot{ display: none; }
html.rail .side-nav-top button .nav-badge{ position: absolute; top: 2px; right: 6px; margin: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 10px; line-height: 16px; }

/* ---------- Overview ---------- */
.dash-col{ display: grid; gap: var(--space-4); min-width: 0; align-content: start; }
.dash-col > .panel{ margin-bottom: 0; }
.attn-card .attn-title{ display: flex; align-items: center; gap: var(--space-2); padding: var(--space-5) var(--space-6) var(--space-2); }
.attn-card .attn-title h3{ margin: 0; }
.attn-row{ padding: var(--space-3) var(--space-6); }
.attn-row b{ font-size: 15px; line-height: 20px; }
.attn-row span.m{ font-size: 13px; line-height: 18px; }
.attn-row .ai.bad{ color: var(--critical); }
.feed{ list-style: none; margin: 0; padding: 0; }
.feed-row{ display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.feed-row:first-child{ border-top: 0; padding-top: 0; }
.feed-text{ min-width: 0; font-size: 14px; line-height: 20px; color: var(--text); overflow-wrap: anywhere; }
.feed-text b{ font-weight: 500; color: var(--ink); }
.feed-time{ font-size: 13px; color: var(--ink-faint); white-space: nowrap; }
.feed-row .row-action-btn{ height: auto; min-height: 0; padding: 0 8px; }

/* A person in a table: name with avatar over a muted line (username, email). The line is cut with an ellipsis, never broken mid-word. */
.user-cell{ min-width: 0; max-width: 300px; }
.user-cell .sub-line{ max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 639.98px){
  table.stack td > .user-cell{ flex: 1 1 auto; min-width: 0; max-width: none; text-align: right; }
  table.stack td > .user-cell .name-with-avatar{ justify-content: flex-end; max-width: 100%; }
  table.stack td > .user-cell .sub-line{ display: block; }
}

/* ---------- polish ---------- */
.btn, .icon-btn, .tab-btn, .row-action-btn{ transition: background 150ms, border-color 150ms, color 150ms, transform 100ms; }
.btn:active:not(:disabled){ transform: translateY(1px); }
.btn.sm{ height: 32px; }
.tabs{ scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar{ display: none; }
.tabs.fade-r{ -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.tabs.fade-l{ -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
.tabs.fade-l.fade-r{ -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
.tab-btn:focus-visible{ outline-offset: -2px; }

@media (prefers-reduced-motion: reduce){
  a.kpi, .btn, .icon-btn{ transition: none; }
  a.kpi:active, .btn:active{ transform: none; }
  .skeleton-row{ animation: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px){
  .jump-kbd{ display: none; }
  .side-nav-user-text, .side-nav-user-chevron{ display: none; }
  .side-nav-user{ padding: 0 4px; }
}
@media (max-width: 1179px){
  #dashboardView .dash-grid{ grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px){
  .icon-btn.mobile-nav-toggle{ margin-right: 0; flex: none; }
  .crumbs{ flex: 1 1 auto; max-width: none; margin: 0 var(--space-2); }
  .jump-trigger{ flex: none; margin: 0; }
}
@media (max-width: 760px){
  .jump-trigger{ width: 40px; height: 40px; padding: 0; justify-content: center; border: 0; background: none; border-radius: 50%; }
  .jump-text{ display: none; }
  .jump-trigger svg{ width: 20px; height: 20px; }
}
@media (max-width: 640px){
  .kpi-grid, .stat-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .kpi{ padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4); }
  .kpi-value{ font-size: 22px; line-height: 30px; }
  .crumb-group{ display: none; }
  .sys-chip, .sys-chip[data-tone]{ width: 40px; height: 44px; padding: 0; justify-content: center; background: none; }
  .sys-dot{ width: 11px; height: 11px; }
  .sys-text{ display: none; }
  .bell-wrap{ position: static; }
  .popover{ left: 0; right: 0; top: calc(100% + var(--space-2)); width: auto; }
  .page-head{ margin-bottom: var(--space-4); }
  .page-actions{ width: 100%; margin-left: 0; }
  .page-actions .btn{ flex: 1 1 auto; }
  .data-toolbar{ padding: var(--space-2) var(--space-4); }
  .panel > .data-toolbar{ margin: 0 -18px; }
  .panel > .data-toolbar:first-child{ margin-top: -18px; }
  .attn-row{ padding: var(--space-3) var(--space-4); }
  .attn-card .attn-title{ padding: var(--space-4) var(--space-4) var(--space-2); }
  .topbar{ padding: 0 4px; }
  #themeToggle{ display: none; }
  /* names that are long and unbroken (an email) are cut with an ellipsis instead of breaking mid-word */
  .stat-card .stat-value, .kpi-value{ overflow-wrap: break-word; }
}
@media (max-width: 480px){
  /* the bell badge carries the count at phone width; the chip returns from 481px */
  .sys-chip{ display: none; }
}
@media (pointer: coarse), (max-width: 640px){
  .pop-item{ min-height: 44px; }
  .link-btn{ display: inline-flex; align-items: center; min-height: 44px; }
  .jump-trigger{ min-height: 44px; min-width: 44px; }
  .sys-chip, .sys-chip[data-tone]{ min-height: 44px; min-width: 40px; }
  .filters-collapsible > summary{ min-height: 44px; }
  .feed-row .row-action-btn{ min-height: 44px; }
  .side-nav-menu button{ min-height: 44px; }
}

/* ---------- Overview lenses ---------- */
.lens-bar{ display: flex; gap: 2px; margin: 0 0 var(--space-4); padding: 4px; border-radius: 999px; background: var(--sunken); width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.lens-bar::-webkit-scrollbar{ display: none; }
.lens-tab{ display: inline-flex; align-items: baseline; gap: var(--space-2); flex: none; min-height: 34px; padding: 0 16px; border: 0; border-radius: 999px; background: none; color: var(--ink-muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; align-items: center; }
.lens-tab small{ font-size: 12px; font-weight: 400; color: var(--ink-faint); }
.lens-tab:hover{ color: var(--ink); }
.lens-tab.active{ background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .14); }
.lens-tab.active small{ color: var(--ink-muted); }
.lens-head{ --lens: var(--ink-faint); margin: 0 0 var(--space-4); padding: var(--space-4) var(--space-5); border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
.lens-head[data-tone="good"]{ --lens: var(--good); }
.lens-head[data-tone="warn"]{ --lens: var(--warning); }
.lens-head[data-tone="bad"]{ --lens: var(--critical); }
.lens-head .lens-eyebrow{ color: var(--lens); }
.lens-eyebrow{ display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.lens-title{ margin: 2px 0 var(--space-2); font-size: 20px; line-height: 28px; font-weight: 500; color: var(--ink); }
.lens-headline{ display: flex; align-items: flex-start; gap: var(--space-2); margin: 0; font-size: 15px; line-height: 22px; color: var(--ink-muted); }
.lens-dot{ flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--lens); }
.link-cards{ display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); margin: 0 0 var(--space-5); }
.link-card{ display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) var(--space-4); border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-align: left; text-decoration: none; font: inherit; cursor: pointer; transition: background 150ms, border-color 150ms; }
.link-card:hover{ background: var(--hover); border-color: var(--edge); }
.link-card b{ font-size: 14px; font-weight: 500; }
.link-card span{ font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.noaccess{ max-width: 640px; }
.noaccess h3{ margin: 0 0 var(--space-3); font-size: 20px; line-height: 28px; font-weight: 500; }
.noaccess h3:focus{ outline: none; }
.noaccess p{ margin: 0 0 var(--space-3); color: var(--ink-muted); }
.noaccess-eyebrow{ font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint) !important; margin-bottom: var(--space-1) !important; }
.noaccess .kv{ margin: var(--space-4) 0; }

/* ---------- bell: grouped by area ---------- */
.pop-head-r{ display: inline-flex; align-items: center; gap: var(--space-3); }
.pop-area{ border-bottom: 1px solid var(--line); }
.pop-area:last-of-type{ border-bottom: 0; }
.pop-area h4{ display: flex; align-items: center; gap: var(--space-2); margin: 0; padding: var(--space-3) var(--space-4) 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.pop-area h4 > span:first-child{ flex: 1; }
.pop-area h4 .link-btn{ font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink-muted); }
.pop-area-n{ font-weight: 500; color: var(--ink-muted); text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.new-tag{ display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; line-height: 16px; vertical-align: 1px; }

/* ---------- your access popover ---------- */
.access-pop{ right: 0; width: min(440px, calc(100vw - 24px)); }
.access-pop .pop-head .icon-btn{ width: 32px; height: 32px; }
.access-body{ padding: var(--space-3) var(--space-4) var(--space-4); }
.access-body h4{ margin: var(--space-4) 0 var(--space-1); font-size: 13px; font-weight: 600; color: var(--ink); }
.access-body h4.can{ color: var(--good); }
.access-body h4.cannot{ color: var(--ink-muted); }
.access-body h5{ margin: var(--space-3) 0 2px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); }
.access-body ul{ margin: 0; padding-left: 18px; font-size: 14px; line-height: 20px; color: var(--ink); }
.access-body li{ margin: 2px 0; }
.access-role{ margin: 0; font-size: 14px; color: var(--ink-muted); }
.access-role b{ color: var(--ink); font-weight: 500; }
.access-none{ margin: var(--space-3) 0 0; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--warning-bg); color: var(--ink); font-size: 14px; }
.access-appr{ list-style: none; padding-left: 0 !important; }
.access-appr li{ display: flex; flex-direction: column; margin: 0 0 var(--space-2); }
.access-appr b{ font-weight: 500; }
.access-appr span{ font-size: 13px; color: var(--ink-muted); }
.access-no{ list-style: none; padding-left: 0 !important; color: var(--ink-muted) !important; }
.access-no li{ display: flex; align-items: flex-start; gap: var(--space-2); }
.access-no .no{ flex: none; width: 16px; height: 20px; display: grid; place-items: center; color: var(--ink-faint); }
.access-no .no svg{ width: 14px; height: 14px; }

/* ---------- search ---------- */
.qj-list{ display: block; }
.qj-group + .qj-group{ margin-top: var(--space-2); }
.qj-gh{ padding: var(--space-2) 14px 2px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.qj-opt{ display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 14px; border-radius: 12px; cursor: pointer; color: var(--ink); }
.qj-opt.on, .qj-opt:hover{ background: var(--hover); }
.qj-opt.on{ background: var(--hover); }
.qj-opt .qj-l{ min-width: 0; overflow-wrap: anywhere; }
.qj-opt .g{ flex: none; max-width: 55%; text-align: right; color: var(--ink-faint); font-size: 13px; overflow-wrap: anywhere; }
.qj-note{ padding: 10px 14px; font-size: 14px; color: var(--ink-muted); }
.qj-note.qj-loading::before{ content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; border: 2px solid var(--line-2); border-top-color: var(--brand); border-radius: 50%; animation: qj-spin .8s linear infinite; }
.qj-note.qj-err{ color: var(--critical); }
@keyframes qj-spin{ to{ transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce){ .qj-note.qj-loading::before{ animation: none; } }
@media (pointer: coarse), (max-width: 640px){ .qj-opt{ min-height: 44px; align-items: center; } }

/* ---------- keyboard help ---------- */
.kbd-list{ margin: 0 0 var(--space-3); }
.kbd-list > div{ display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.kbd-list dt{ display: flex; align-items: center; gap: 6px; flex: none; }
.kbd-list dd{ margin: 0; text-align: right; color: var(--ink-muted); font-size: 14px; }
.kbd-list kbd{ min-width: 24px; padding: 2px 7px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 13px; line-height: 18px; text-align: center; }
.kbd-then{ font-size: 12px; color: var(--ink-faint); }

/* ---------- toasts ---------- */
.toast-stack{ gap: var(--space-2); }
.toast .toast-n{ display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: 10px; background: var(--chip); color: var(--ink-muted); font-size: 12px; font-weight: 600; line-height: 20px; }
.toast.bump{ animation: toast-bump 220ms ease; }
.toast.error{ border-color: var(--critical); }
@keyframes toast-bump{ 40%{ transform: scale(1.03); } }
@media (prefers-reduced-motion: reduce){ .toast, .toast.bump, .toast.leaving{ animation: none; } }

/* ---------- Roles: switch and access matrix ---------- */
.seg{ display: inline-flex; gap: 2px; margin: 0 0 var(--space-4); padding: 4px; border-radius: 999px; background: var(--sunken); }
.seg-btn{ min-height: 34px; padding: 0 var(--space-4); border: 0; border-radius: 999px; background: none; color: var(--ink-muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.seg-btn:hover{ color: var(--ink); }
.seg-btn.active{ background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .14); }
.role-says ul{ list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.role-says li{ padding: var(--space-2) 0; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 22px; color: var(--ink-muted); }
.role-says li:last-child{ border-bottom: 0; }
.role-says h3{ margin: 0; }
.mx-panel{ padding: var(--space-4); }
.mx-wrap{ position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.mx-wrap.fade-r{ -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
.matrix{ border-collapse: separate; border-spacing: 0; width: 100%; min-width: max-content; font-size: 14px; }
.matrix th, .matrix td{ padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; white-space: nowrap; background: var(--surface); }
.matrix thead th{ position: sticky; top: 0; z-index: 2; vertical-align: bottom; font-weight: 500; color: var(--ink); }
.matrix .mx-first{ position: sticky; left: 0; z-index: 1; text-align: left; min-width: 190px; max-width: 260px; white-space: normal; font-weight: 400; color: var(--ink); box-shadow: 1px 0 0 var(--line); }
.matrix thead .mx-first{ z-index: 3; }
.matrix tr.mx-group th{ position: static; text-align: left; background: var(--surface-2); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); box-shadow: none; }
.mx-type{ display: block; font-size: 11px; font-weight: 400; color: var(--ink-faint); }
.mx{ display: inline-flex; align-items: center; gap: 4px; color: var(--good); }
.mx .mx-k{ font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--ink-muted); }
.mx-no{ color: var(--ink-faint); }
.matrix tbody tr:hover td, .matrix tbody tr:hover th.mx-first{ background: var(--hover); }
@media (max-width: 640px){
  .mx-panel{ padding: var(--space-3); }
  .matrix .mx-first{ min-width: 140px; max-width: 150px; font-size: 13px; }
  .matrix th, .matrix td{ padding: 8px; }
}

/* ---------- sticky filter bar under the top bar (wide screens, tall enough to be worth it) ---------- */
@media (min-width: 1024px) and (min-height: 760px){
  .view > details.filters-collapsible{ position: sticky; top: 68px; z-index: 20; max-height: 38vh; overflow: auto; background: var(--bg); border-bottom: 1px solid var(--line); margin-bottom: var(--space-3); }
}
.noaccess .kv > div{ display: block; padding: var(--space-2) 0; }
.noaccess .kv dt{ display: block; margin-bottom: 2px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); }
.noaccess .kv dd{ display: block; margin: 0; text-align: left; color: var(--ink); }
/* Insights keeps the order app.js gave it (Platform health, Reports, Business insights, Change request report, then the rest). */
[data-nav-group="insights"] .nav-group-body > button{ order: 0 !important; }
@media (max-width: 640px){
  .access-pop{ position: fixed; left: 12px; right: 12px; top: 72px; width: auto; max-height: calc(100vh - 88px); }
}
.toast .toast-n.hidden{ display: none; }

/* Touch targets for the controls added after the first sweep: filter chips, range and segmented buttons,
   switches and "View all" links reach 44px on phones and touch screens. */
@media (max-width: 640px), (pointer: coarse) {
  .rh-fchip, .pf-seg-btn, .seg-btn { min-height: 44px; height: auto; }
  .panel-head a.view-all, .panel-head button.view-all { min-height: 44px; display: inline-flex; align-items: center; padding: 0 var(--space-2); }
  .toggle::before { content: ""; position: absolute; inset: -10px -4px; }
}
@media (max-width: 640px), (pointer: coarse) {
  .lens-tab { min-height: 44px; }
  .rh-pin { width: 44px; height: 44px; margin: -12px -14px 0 0; }
  .pf-changes li > a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-2); }
}

/* Form controls reach 44px on phones and touch screens (checkboxes, radios, files and the small inline selects keep their own sizing). */
@media (max-width: 640px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]), select:not(.inline-select) { min-height: 44px; }
}

/* ---------- Overview sections: the same card, rows, chips and pill buttons as the rest of the console ---------- */
.attn-card, .chg, .sec{ min-width: 0; margin: 0 0 var(--space-4); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-md); overflow: clip; }
.dash-col > :is(.attn-card, .chg, .sec){ margin-bottom: 0; }
.sec-head{ display: flex; align-items: center; gap: var(--space-2); padding: var(--space-5) var(--space-6) var(--space-3); }
.sec-head h3{ margin: 0; }
.sec-head .view-all{ margin-left: auto; padding: 0; font-size: 13px; font-weight: 500; color: var(--ink); background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.pop-count{ min-width: 22px; }
.plain-empty{ margin: 0; padding: var(--space-1) var(--space-6) var(--space-5); font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.attn-card .skel, .chg .skel, .sec .skel{ padding-top: var(--space-1); }

/* Needs attention and What changed: severity as a chip, the finding, a count, one pill action. */
.attn-card .attn-list, .chg-list{ list-style: none; margin: 0; padding: 0; }
.attn-card .attn-row, .chg-row{ display: grid; align-items: center; gap: 0 var(--space-4); min-height: 56px; padding: var(--space-3) var(--space-6); border-top: 1px solid var(--line); }
.attn-card .attn-row{ grid-template-columns: 76px minmax(0, 1fr) auto 156px; }
.chg-row{ grid-template-columns: 76px minmax(0, 1fr) 156px; }
.sev{ justify-self: start; padding: 0 10px; border-radius: 999px; background: var(--chip); color: var(--ink-muted); font-size: 12px; line-height: 24px; font-weight: 500; white-space: nowrap; }
[data-tone="bad"] > .sev{ background: var(--critical-bg); color: var(--critical); }
[data-tone="warn"] > .sev{ background: var(--warning-bg); color: var(--warning); }
.chg-row[data-tone="good"] > .sev{ background: var(--good-bg); color: var(--good); }
.attn-row .attn-text, .chg-text{ min-width: 0; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.attn-row .attn-text b{ font-size: 15px; }
.attn-row .attn-text span.m{ margin: 2px 0 0; }
.attn-row .attn-n{ min-width: 32px; text-align: right; color: var(--ink-muted); }
.attn-act, .chg-act{ justify-self: end; display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; }
.attn-act:hover, .chg-act:hover{ background: var(--hover); border-color: var(--edge); }
.attn-card .attn-row.attn-more{ grid-template-columns: 76px minmax(0, 1fr); }
.chg-note{ margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; padding: var(--space-1) var(--space-6) var(--space-5); font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.chg-list + .chg-note{ padding-top: var(--space-3); border-top: 1px solid var(--line); }

.qlinks{ display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-5); }
.qlink{ display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; }
.qlink:hover{ background: var(--hover); border-color: var(--edge); }

/* Recent activity and the change-request report: a table running edge to edge inside its card. */
.sec .table-card{ border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.sec table.dense th:first-child, .sec table.dense td:first-child{ padding-left: var(--space-6); }
.sec table.dense th:last-child, .sec table.dense td:last-child{ padding-right: var(--space-6); }
table.dense .who{ font-weight: 500; color: var(--ink); }
.stackbar{ display: flex; height: 10px; gap: 2px; margin: 0 var(--space-6) var(--space-4); background: var(--sunken); border-radius: 999px; overflow: hidden; }
.stackbar > span{ display: block; min-width: 2px; }
.swatch{ display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; vertical-align: -1px; }
.pf-inner-kpis{ margin-bottom: var(--space-4); }
.page-sub .stamp{ display: inline-block; margin-left: 4px; color: var(--ink-faint); white-space: nowrap; }

/* Tile sparklines. */
.kpi-spark{ display: flex; align-items: center; gap: var(--space-2); margin-top: auto; padding-top: 6px; }
.kpi-spark svg{ flex: 1 1 auto; min-width: 0; height: 24px; overflow: visible; }
.spark-line, .spark-end{ fill: none; stroke: var(--ink-muted); stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark-line{ stroke-width: 1.5; }
.spark-end{ stroke-width: 5; stroke: var(--ink); }
.spark-span{ flex: none; font-size: 11px; line-height: 14px; color: var(--ink-faint); white-space: nowrap; }
@media (max-width: 640px){ .kpi-spark{ flex-direction: column; align-items: stretch; gap: 2px; } .kpi-spark svg{ flex: none; width: 100%; } }

/* Sidebar counts: the float one stays red. */
.nav-badge[data-nav-badge="float"]{ background: var(--critical-bg); color: var(--critical); }

/* Row height choice (user menu): standard is the 44px table row, compact is set above, comfortable is roomier. */
html[data-density="comfortable"] tbody td{ height: 52px; }
html[data-density="comfortable"] thead th{ height: 44px; }

@media (max-width: 640px){
  .sec-head{ padding: var(--space-4) var(--space-4) var(--space-3); }
  .plain-empty, .chg-note{ padding-left: var(--space-4); padding-right: var(--space-4); }
  .sec table.dense th:first-child, .sec table.dense td:first-child{ padding-left: var(--space-4); }
  .sec table.dense th:last-child, .sec table.dense td:last-child{ padding-right: var(--space-4); }
  .stackbar{ margin-left: var(--space-4); margin-right: var(--space-4); }
}
@media (pointer: coarse), (max-width: 640px){
  .attn-card .attn-row, .chg-row{ grid-template-columns: 70px minmax(0, 1fr) auto; column-gap: var(--space-3); padding: var(--space-2) var(--space-4); }
  .attn-card .attn-row.attn-more{ grid-template-columns: 70px minmax(0, 1fr); }
  .attn-row .attn-n{ display: none; }
  .attn-act, .chg-act{ grid-column: 3; height: auto; min-height: 44px; }
  .qlink{ height: auto; min-height: 44px; }
  .sec-head .view-all, .chg-note .link-btn{ min-height: 44px; display: inline-flex; align-items: center; }
  html[data-density] table.dense td{ height: 44px; }
  .tab-btn, .lens-tab{ min-height: 44px; }
  summary{ min-height: 44px; box-sizing: border-box; padding-block: 12px; }
}

/* Phones: as the original attention list, the action sits under its finding. */
@media (max-width: 640px){
  .attn-card .attn-row, .chg-row, .attn-card .attn-row.attn-more{ grid-template-columns: auto minmax(0, 1fr); align-items: start; row-gap: var(--space-2); padding: var(--space-3) var(--space-4); }
  .attn-row .attn-act, .chg-row .chg-act{ grid-column: 2; justify-self: start; }
}
@media (max-width: 759px){
  .page-head :is(h1, h2), .view .page-head :is(h1, h2), .view .page-head-main :is(h1, h2), .view > h2, .view > .view-head h2{ font-size: 32px; line-height: 38px; }
}

/* The account button is a full target on phones. */
@media (max-width: 640px), (pointer: coarse) { .side-nav-user, .icon-btn { min-width: 44px; min-height: 44px; } }
@media (max-width: 640px), (pointer: coarse) { [data-rx-reveal] { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); } }

/* Figure strips fill their rows: a card that wraps onto a new line widens instead of leaving a hole beside it. */
body .kpi-grid, body .stat-grid{ display: flex; flex-wrap: wrap; }
body .kpi-grid > *, body .stat-grid > *{ flex: 1 1 200px; min-width: 0; }
body .stat-grid.tight > *, body .stat-grid.tight-grid > *{ flex-basis: 150px; }
body .stat-grid > :is(.errbox, .skel, .empty-note){ flex-basis: 100%; }
body .kpi-grid.hidden, body .stat-grid.hidden, body .kpi-grid > .hidden, body .stat-grid > .hidden{ display: none; }
@media (max-width: 640px){ body .kpi-grid > *, body .stat-grid > *{ flex-basis: calc(50% - var(--space-3)); } }
@media (min-width: 900px){ .dash-grid.ov-even > :last-child:nth-child(odd){ grid-column: 1 / -1; } }

/* Fraud analytics: dates in one short row, no card. The two smaller figures sit under the tiles. */
#faRangeForm{ margin-bottom: var(--space-4); }
#faRangeForm .filter-row > .field{ flex: 0 1 180px; }
#faMinor{ margin: calc(var(--space-2) * -1) 0 var(--space-4); }
@media (max-width: 640px){
  #faRangeForm .filter-row > .field{ flex: 1 1 130px; }
  #approvalsView .data-toolbar .field{ flex: 1 1 100%; }
  #approvalsView .data-toolbar input{ width: 100%; }
}

/* A long reason in a table: two lines until opened. */
.reason-more > summary{ list-style: none; cursor: pointer; }
.reason-more > summary::-webkit-details-marker{ display: none; }
.reason-more > summary > span{ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reason-more[open] > summary > span{ display: block; }

/* Rows held back until "Show all" is pressed. */
.attn-row[hidden] { display: none; }
.attn-all { display: flex; margin: var(--space-3) auto; }

/* Float: one card per shortcode, its accounts as plain rows, the cards filling the width. */
#floatBalanceCards{ margin-bottom: var(--space-4); }
#floatBalanceCards .wallet-grid{ grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
#floatBalanceCards .wallet-card{ padding: var(--space-5); background: var(--surface); border-color: var(--line-2); border-radius: var(--radius); box-shadow: var(--elev-1); min-width: 0; }
#floatBalanceCards .float-accts{ grid-template-columns: minmax(0, 1fr); gap: 0; }
#floatBalanceCards .float-acct{ padding: var(--space-3) 0; background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
#floatBalanceCards .float-thr .btn{ margin-left: auto; }
@media (pointer: coarse), (max-width: 640px){ #floatBalanceCards .float-thr .btn{ min-height: 44px; } }
/* Change request report: six figures in one row on a wide screen. */
@media (min-width: 1024px){ body #reportsStats.stat-grid:not(.hidden){ display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); } }
/* Stage buttons a screen draws itself: no gap before they are filled. */
.tt-stages:empty{ display: none; }

/* Top bar refresh: turns while the page asks for its data again. */
.refresh-btn.spinning svg{ animation: refresh-spin 0.9s linear infinite; }
@keyframes refresh-spin{ to{ transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce){ .refresh-btn.spinning svg{ animation: none; opacity: 0.5; } }
/* Ticket lists: the order picker sits at the end of the count line. */
.data-toolbar .order-field{ flex: 0 0 auto; margin: 0 0 0 auto; }
.data-toolbar .order-field select{ min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
