:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #5f6b7a;
  --border: #d8dee6;
  --accent: #1f4e79;
  --danger: #b42318;
  --danger-bg: #fef2f0;
  --row-hover: #f0f4f8;
  --success: #15803d;
  --success-soft: #dcfce7;
  --color-success: var(--success);
  --color-accent: var(--accent);
  --color-warning: #b45309;
  --surface-muted: #f1f4f8;
  --text-muted: var(--muted);

  --brand-gold: #c49630;
  --brand-gold-hover: #d4a63e;
  --brand-maroon: #841e3b;
  --login-bg: #f5f7fb;
  --login-paper: #ffffff;
  --login-text: #1f2933;
  --login-muted: #5f6b7a;
  --login-border: rgba(0, 0, 0, 0.23);
  --header-bg: #ffffff;
  --primary: #1f3d5b;
  --primary-hover: #183048;
  --primary-soft: #e8eef4;
  --primary-rgb: 31, 61, 91;
  --radius-sm: 4px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pebble: 18px;
  --radius-pill: 999px;
  --radius-nav: 11px;
  --shell-gap: 16px;
  --sidenav-w: 268px;
  --drawer-w: 440px;
  --topnav-h: 56px;
  --header-h: 64px;
  --elevation-2: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14),
    0 1px 5px 0 rgba(0, 0, 0, 0.12);
  --elevation-8: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14),
    0 3px 14px 2px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 1px 2px rgba(20, 24, 32, 0.06);
  --shadow-float: 0 10px 32px rgba(var(--primary-rgb), 0.12);
  --btn-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --btn-shadow-hover: 0 3px 6px -1px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --btn-shadow-active: 0 1px 2px rgba(16, 24, 40, 0.08);
  --btn-inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  --transition-fast: 150ms ease;
  --transition-btn: all 130ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent);
}

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

html:has(.login-page),
body.login-page {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.login-page :focus-visible {
  outline-color: var(--primary);
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100svh;
  max-height: 100svh;
  overflow: hidden;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--login-bg);
  color: var(--login-text);
}

.login-card,
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  max-height: calc(100svh - 32px);
  background: var(--login-paper);
  border: none;
  border-radius: var(--radius-lg);
  padding: 40px 36px 36px;
  box-shadow: var(--elevation-8);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  display: block;
  width: min(100%, 224px);
  height: auto;
}

.login-portal-title {
  margin: 12px 0 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--login-text);
}

.login-portal-lede {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--login-muted);
}

.login-title {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: left;
}

.login-subtitle {
  margin: 8px 0 24px;
  text-align: left;
}

.login-footer {
  margin: 24px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--login-muted);
}

.login-page .muted {
  color: var(--login-muted);
}

.login-card .field {
  margin-bottom: 20px;
}

.login-card .field span {
  margin-bottom: 8px;
  color: var(--login-muted);
  font-size: 13px;
}

.login-card .input {
  height: 36px;
  padding: 6px 12px;
  color: var(--login-text);
  background: var(--login-paper);
  border: 1px solid var(--login-border);
  border-radius: var(--radius-md);
  font-size: 14px;
}

.login-card .input:hover {
  border-color: rgba(0, 0, 0, 0.6);
}

.login-card .input:focus,
.login-card .input:focus-visible {
  outline: none;
  border-color: var(--primary);
  border-width: 2px;
  padding: 5px 11px;
}

.login-card .password-field {
  position: relative;
}

.login-card .password-field .input {
  padding-right: 40px;
}

.login-card .password-field .input:focus,
.login-card .password-field .input:focus-visible {
  padding-right: 39px;
}

.login-card .password-toggle {
  position: absolute;
  top: 50%;
  right: 2px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-height: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--login-muted);
  box-shadow: none;
  transform: translateY(-50%);
}

.login-card .password-toggle:hover:not(:disabled) {
  color: var(--login-text);
  background: var(--row-hover);
  box-shadow: none;
  transform: translateY(-50%);
}

.login-card .password-toggle:active:not(:disabled) {
  transform: translateY(-50%);
  box-shadow: none;
}

.login-card .password-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 0;
}

.login-card .password-toggle svg {
  width: 18px;
  height: 18px;
}

.login-card .btn-primary {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: var(--elevation-2);
}

.login-card .btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.login-card .btn-primary:focus-visible {
  outline-color: var(--primary);
}

.app-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--shell-gap);
}

.pebble {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pebble);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.app-sidenav {
  position: fixed;
  top: var(--shell-gap);
  left: var(--shell-gap);
  bottom: var(--shell-gap);
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: var(--sidenav-w);
  overflow: hidden;
  transition: transform var(--transition-fast);
}

.app-shell.is-sidenav-collapsed .app-sidenav {
  transform: translateX(calc(-100% - var(--shell-gap)));
}

.sidenav-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 20px 16px 16px;
}

.sidenav-brand img {
  display: block;
  width: 100%;
  height: auto;
}

.brand-product {
  flex-shrink: 0;
  padding: 2px 10px;
  border: 1px solid var(--brand-maroon);
  border-radius: var(--radius-pill);
  color: var(--brand-maroon);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.sidenav-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  padding: 4px 12px 16px;
  overflow-y: auto;
}

.sidenav-nav .pill {
  position: relative;
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: var(--radius-nav);
  color: var(--muted);
  font-weight: 500;
}

/* Operations/Client pages embed both workspace lists. Hide the other list
   before shell JS runs so a refresh does not flash a duplicate sidenav. */
.sidenav-nav [data-workspace="client"] {
  display: none !important;
}

html[data-workspace="client"] .sidenav-nav [data-workspace="client"] {
  display: inline-flex !important;
}

html[data-workspace="operations"] .sidenav-nav [data-workspace="client"],
html[data-workspace="client"] .sidenav-nav [data-workspace="operations"],
html[data-workspace="hq"] .sidenav-nav [data-workspace]:not([data-workspace="hq"]),
html[data-workspace="admin"] .sidenav-nav [data-workspace]:not([data-workspace="admin"]) {
  display: none !important;
}

.sidenav-nav .pill:hover {
  background: var(--row-hover);
  color: var(--text);
}

.sidenav-nav .pill[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.12);
}

.sidenav-nav .pill[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: var(--radius-pill);
  background: var(--primary);
}

.sidenav-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
  opacity: 0.88;
}

.sidenav-nav .pill[aria-current="page"] .sidenav-icon {
  opacity: 1;
}

.sidenav-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  margin-top: auto;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

.sidenav-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 8px 6px;
}

.sidenav-profile .user-chip-avatar {
  width: 36px;
  height: 36px;
  font-size: 12px;
  flex-shrink: 0;
}

.sidenav-profile-meta {
  min-width: 0;
  flex: 1;
}

.sidenav-profile-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}

.sidenav-profile-meta .muted {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  text-transform: capitalize;
}

.sidenav-logout {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  min-height: 36px;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-nav);
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

button.sidenav-logout {
  border: none;
  background: transparent;
  color: var(--muted);
}

.sidenav-logout:hover {
  background: var(--row-hover);
  color: var(--text);
}

.sidenav-logout-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.app-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: calc(100vh - var(--shell-gap) * 2);
  min-height: calc(100dvh - var(--shell-gap) * 2);
  margin-left: calc(var(--sidenav-w) + var(--shell-gap));
  transition: margin-left var(--transition-fast);
}

.app-shell.is-sidenav-collapsed .app-column {
  margin-left: 0;
}

.app-topnav {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--topnav-h);
  padding: 8px 20px;
  overflow: visible;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.topnav-start {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.sidenav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin-left: -8px;
  padding: 0;
  border: none;
  border-radius: var(--radius-nav);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.sidenav-toggle:hover {
  background: var(--row-hover);
  color: var(--text);
}

.sidenav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidenav-toggle svg {
  display: block;
  width: 22px;
  height: 22px;
}

.topnav-title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sidenav-backdrop {
  display: none;
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.menu,
.workspace-switcher {
  position: relative;
  flex-shrink: 0;
}

.workspace-chip,
.menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--brand-maroon);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--brand-maroon);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.menu-trigger {
  min-height: 40px;
  min-width: 148px;
  padding: 8px 14px;
  border-color: var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0;
}

span.workspace-chip {
  cursor: default;
}

.workspace-chip:hover,
.menu-trigger:hover {
  background: var(--row-hover);
}

span.workspace-chip:hover {
  background: var(--card);
}

.menu.is-open .workspace-chip,
.menu.is-open .menu-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.16);
}

.menu-caret {
  flex-shrink: 0;
  transition: transform var(--transition-fast, 150ms ease);
}

.menu.is-open .menu-caret {
  transform: rotate(180deg);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  z-index: 50;
  min-width: max(100%, 12rem);
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
}

.filter-menu .menu-panel {
  left: 0;
}

.workspace-menu {
  right: 0;
}

.menu-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-nav);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-option:hover {
  background: var(--row-hover);
  color: var(--text);
}

.menu-option[aria-current="true"],
.menu-option[aria-selected="true"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.user-chip-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app-main {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  padding: 8px 8px 24px;
}

.page {
  max-width: none;
  margin: 0;
  padding: 0;
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-stack > .panel-outline {
  position: relative;
  z-index: 6;
}

.page-stack > .panel-command {
  position: relative;
  z-index: 6;
  padding: 0;
  overflow: hidden;
}

.page-stack > .panel-table {
  position: relative;
  z-index: 1;
}

.panel-outline {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pebble);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.panel-heading {
  padding: 14px 16px 0;
}

.panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.panel-heading .muted {
  margin: 4px 0 0;
  font-size: 13px;
}

.data-panel {
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.data-panel > .error {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

.insight-banner {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--primary-soft);
}

.page-stack > .error {
  margin-bottom: 0;
}

.count-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

.count-strip-kicker {
  margin: 0;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.count-strip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}

.count-strip-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 5.25rem;
}

.count-strip-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: var(--text);
}

.count-strip-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}

.count-strip-item.is-zero .count-strip-value {
  color: var(--muted);
  font-weight: 600;
}

.overview-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
  align-items: stretch;
}

.overview-split > .data-panel {
  min-width: 0;
}

.overview-filters {
  position: relative;
  z-index: 6;
}

.page-stack > .data-panel > .panel-heading {
  padding-bottom: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 10px;
  padding: 12px 16px 4px;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 88px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-nav);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  box-shadow: none;
}

.kpi-card:hover {
  background: var(--row-hover);
  color: var(--text);
}

.kpi-card-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}

.kpi-card-value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.kpi-card.is-zero .kpi-card-value {
  color: var(--muted);
  font-weight: 600;
}

.kpi-card-warn {
  background: #fffbeb;
  border-color: #fde68a;
}

.kpi-card-danger {
  background: var(--danger-bg);
  border-color: #fecaca;
}

.kpi-card-neutral {
  background: var(--bg);
}

.mix-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 16px 16px;
}

.mix-list > .muted {
  margin: 4px 8px 8px;
}

.mix-row {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr) 2.5rem;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: var(--radius-nav);
  color: var(--text);
  text-decoration: none;
}

.mix-row:hover {
  background: var(--row-hover);
  color: var(--text);
}

.mix-label {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mix-bar {
  display: block;
  height: 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--primary-soft) 70%, var(--border));
  overflow: hidden;
}

.mix-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.mix-count {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.table-overview-sites,
.table-overview-attention {
  min-width: 36rem;
}

.table-overview-sites tbody tr[data-href],
.table-overview-attention tbody tr[data-href] {
  cursor: pointer;
}

.table-overview-attention .taxonomy-sub {
  display: block;
  color: var(--muted);
  font-weight: 500;
}

.insight-guide {
  margin: 0 16px 14px;
  color: var(--muted);
  font-size: 12px;
}

.insight-guide > summary {
  width: fit-content;
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
}

.insight-guide-inline {
  margin: 0 0 0 auto;
  flex: 0 0 auto;
  position: relative;
}

.insight-guide-inline > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  list-style: none;
}

.insight-guide-inline > summary::-webkit-details-marker {
  display: none;
}

.insight-guide-inline > summary:hover {
  color: var(--text);
  background: var(--row-hover);
}

.insight-guide-inline[open] > summary {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: var(--primary-soft);
}

.insight-guide-inline .insight-guide-grid {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 8;
  width: min(36rem, calc(100vw - 48px));
  max-width: 36rem;
  margin-top: 0;
  background: var(--card);
  box-shadow: var(--shadow-float);
}

.insight-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
  max-width: 760px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-nav);
  background: var(--bg);
}

.insight-guide-grid p {
  margin: 0;
  line-height: 1.45;
}

.data-panel-toolbar {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.data-panel-toolbar.is-project-picker-open {
  z-index: 10;
}

.panel-outline .data-panel-toolbar {
  border-bottom: none;
  padding-bottom: 8px;
}

.toolbar,
.toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.toolbar {
  margin-bottom: 16px;
}

.toolbar-filters {
  flex: 1;
}

.page-stack .toolbar-filters {
  align-items: flex-end;
}

.page-stack .toolbar-actions {
  align-self: flex-end;
}

.page-stack .toolbar-actions .btn {
  height: 40px;
  min-height: 40px;
  box-sizing: border-box;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.search-field,
.filter-field {
  position: relative;
  display: block;
  margin: 0;
}

.search-field {
  flex: 1;
  min-width: 200px;
}

.search-field .search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-field .input {
  width: 100%;
  height: 40px;
  padding: 8px 14px 8px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
}

.search-field .input:hover {
  border-color: #c5cad4;
}

.search-field .input:focus,
.search-field .input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.16);
}

.filter-field .input {
  width: 9.5rem;
  height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
}

.filter-field .input:hover {
  border-color: #c5cad4;
}

.filter-field .input:focus,
.filter-field .input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.16);
}

.filter-field .file-field-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: min(22rem, 100%);
  min-width: 12rem;
  height: 40px;
  min-height: 40px;
  margin-bottom: 0;
  line-height: 1.2;
  cursor: pointer;
}

.filter-field .file-field-control svg {
  flex-shrink: 0;
  color: var(--muted);
}

.filter-field .file-field-control:has(.file-field-name.is-chosen) svg {
  color: var(--text);
}

.filter-field .file-field-name {
  display: block;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0;
  color: var(--muted);
}

.filter-field .file-field-name.is-chosen {
  color: var(--text);
}

.filter-field .file-field-control:has(:focus-visible) {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.16);
}

.filter-field:has(> span:not(.visually-hidden)) {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.filter-field > span:not(.visually-hidden) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.filter-range {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.filter-range .filter-field {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.filter-range .filter-field .input[type="date"] {
  width: 8.75rem;
}

.filter-field-taxonomy .menu-trigger {
  min-width: 13.5rem;
}

/* ── Project multi-select picker ──────────────────────────── */
.project-picker {
  position: relative;
  flex: 0 0 auto;
}

.project-picker-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 11rem;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.project-picker-display {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.project-picker-trigger[aria-expanded="true"] .project-picker-chevron {
  transform: rotate(180deg);
}

.project-picker-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.project-picker-list {
  position: fixed;
  z-index: 9999;
  min-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--elevation-8);
  padding: 4px 0;
  list-style: none;
  margin: 0;
}

.project-picker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}

.project-picker-option:hover {
  background: var(--row-hover);
}

.project-picker-option[aria-selected="true"] .project-picker-check::after {
  content: "✓";
}

.project-picker-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.project-picker-all {
  font-weight: 600;
}

.project-picker-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
/* ── end project picker ─────────────────────────────────────── */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 0 16px 12px;
  position: relative;
}

.filter-row-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  flex: 1 1 12rem;
  min-width: 0;
}

.filter-links button {
  margin: 0;
  padding: 5px 8px;
  border: none;
  border-radius: var(--radius-nav);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
}

.filter-links button:hover {
  color: var(--text);
  background: var(--row-hover);
}

.filter-links button[aria-current="page"] {
  color: var(--primary);
  font-weight: 650;
  background: var(--primary-soft);
  box-shadow: none;
}

.filter-links button[aria-current="page"]:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.filter-links .filter-count {
  margin-left: 5px;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.panel-outline .search-field .input,
.panel-outline .filter-field .input,
.panel-outline .filter-field button.menu-trigger,
.pebble .filter-field .input,
.pebble .filter-field .file-field-control,
.pebble .filter-field button.menu-trigger,
.pebble .project-picker-trigger {
  background: var(--card);
}

.page-stack > .pebble > .data-panel-toolbar,
.panel-collapsible .data-panel-toolbar,
.panel-command .data-panel-toolbar {
  border-bottom: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pill-track {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  padding: 5px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}

.pill-track .pill {
  justify-content: center;
  min-height: 34px;
  padding: 6px 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition-btn);
}

.pill-track .pill:hover {
  color: var(--text);
  background: var(--row-hover);
}

.pill-track .pill[aria-current="page"],
.pill-track .pill.is-active {
  color: var(--primary);
  background: #ffffff;
  border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border) 75%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
}

label span {
  display: block;
  margin-bottom: 4px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: var(--btn-shadow);
  transition: var(--transition-btn);
  user-select: none;
}

button:active:not(:disabled),
.btn:active:not(:disabled) {
  transform: scale(0.985);
  box-shadow: var(--btn-shadow-active);
}

.btn svg,
button svg {
  flex-shrink: 0;
}

.btn-primary {
  min-height: 38px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--primary) 82%, #fff) 0%,
    var(--primary) 100%
  );
  border-color: var(--primary-hover);
  color: #fff;
  box-shadow: var(--btn-shadow), var(--btn-inset-highlight);
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
  border-color: var(--primary-hover);
  box-shadow: var(--btn-shadow-hover), var(--btn-inset-highlight);
  transform: translateY(-0.5px);
}

.btn-secondary,
button.secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--btn-shadow);
}

.btn-secondary:hover:not(:disabled),
button.secondary:hover:not(:disabled) {
  background: var(--row-hover);
  border-color: color-mix(in srgb, var(--border) 80%, var(--accent) 20%);
  color: var(--accent);
  box-shadow: var(--btn-shadow-hover);
  transform: translateY(-0.5px);
}

button.danger {
  background: var(--danger-bg);
  border-color: color-mix(in srgb, var(--danger-bg) 70%, var(--danger) 30%);
  color: var(--danger);
  box-shadow: var(--btn-shadow);
}

button.danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger-bg) 60%, var(--danger) 40%);
  border-color: var(--danger);
  box-shadow: var(--btn-shadow-hover);
  transform: translateY(-0.5px);
}

button.workspace-chip {
  padding: 6px 12px;
  border: 1px solid var(--brand-maroon);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--brand-maroon);
}

button.workspace-chip:hover {
  background: var(--row-hover);
  color: var(--brand-maroon);
}

button.menu-trigger {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text);
  font-weight: 650;
  box-shadow: var(--btn-shadow);
  transition: var(--transition-btn);
}

button.menu-trigger:hover {
  background: var(--row-hover);
  border-color: color-mix(in srgb, var(--border) 80%, var(--accent) 20%);
  color: var(--text);
  box-shadow: var(--btn-shadow-hover);
}

.menu-trigger:disabled,
button.menu-trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

button.menu-option {
  border: none;
  border-radius: var(--radius-nav);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  box-shadow: none;
  min-height: 32px;
  padding: 6px 12px;
}

button.menu-option:hover {
  background: var(--row-hover);
  color: var(--text);
  transform: none;
  box-shadow: none;
}

button:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

a.pill {
  color: var(--text);
}

button.pill {
  border: none;
  background: transparent;
  color: var(--text);
}

.pill:hover {
  background: var(--row-hover);
}

.pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pill[aria-current="page"],
.pill.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.pill-quiet {
  cursor: default;
  color: var(--muted);
}

.pill-quiet:hover {
  background: transparent;
}

.pill:empty {
  display: none;
}

.pill-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pill-nav-row,
.app-topnav .pill-nav {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f5c2c0;
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 12px;
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.table-wrap {
  min-width: 0;
  overflow-x: auto;
}

.data-panel .table-wrap {
  max-height: min(60vh, 640px);
  overflow: auto;
}

table,
.table {
  width: 100%;
  min-width: 48rem;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--card);
}

.data-panel table,
.data-panel .table {
  border: none;
}

/* Clip table rows to the panel's rounded corners */
.panel-table {
  overflow: hidden;
}

/* ── Bulk action bar ──────────────────────────────────────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--primary-soft);
  border-bottom: 1px solid #bfdbfe;
  flex-wrap: wrap;
}

.bulk-count {
  font-size: 13px;
  font-weight: 650;
  color: var(--primary);
  flex: 0 0 auto;
}

.bulk-dup-keep {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--primary);
}

.bulk-dup-keep.hidden {
  display: none;
}

.bulk-dup-keep .select {
  min-width: 220px;
  max-width: 360px;
}

.bulk-clear-btn {
  font-size: 13px;
  padding: 4px 10px;
  min-height: 30px;
  background: transparent;
  border: 1px solid #93c5fd;
  color: var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.bulk-clear-btn:hover {
  background: #dbeafe;
}

/* Checkbox column */
.col-check {
  width: 2.5rem;
  text-align: center;
  padding-left: 12px;
  padding-right: 4px;
}

.col-check input[type="checkbox"] {
  cursor: pointer;
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

/* Dim routine rows that are already marked */
tr.row-is-routine td {
  opacity: 0.55;
}
/* ── end bulk bar ─────────────────────────────────────────── */

th,
td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: 16px;
  padding-bottom: 16px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f7f8fa;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--row-hover);
}

.table-message-row td {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.col-code {
  width: 7.5rem;
}

.col-nric {
  width: 8.5rem;
}

.col-code,
.col-nric {
  font-variant-numeric: tabular-nums;
}

.col-status {
  width: 6.5rem;
}

.col-role {
  width: 8rem;
}

.col-when {
  width: 10.5rem;
  font-variant-numeric: tabular-nums;
}

.col-project {
  width: 6.5rem;
}

.col-subject {
  width: auto;
}

.col-category {
  width: 11rem;
  min-width: 9rem;
  white-space: normal;
  vertical-align: top;
}

.col-importance {
  width: 5rem;
  white-space: nowrap;
}

.table-eoccurrences {
  table-layout: fixed;
  min-width: 64rem;
}

.table-eoccurrences col {
  min-width: 0;
}

.table-eoccurrences col.col-check {
  width: 2.25rem;
}

.table-eoccurrences col.col-when {
  width: 7rem;
}

.table-eoccurrences col.col-project-subject {
  width: 5.25rem;
}

.table-eoccurrences col.col-description {
  width: 26%;
}

.table-eoccurrences col.col-category {
  width: 9rem;
}

.table-eoccurrences col.col-importance-reason {
  width: 34%;
}

.table-eoccurrences col.col-importance {
  width: 5.75rem;
}

.table-eoccurrences col.col-case-status {
  width: 6.25rem;
}

.table-eoccurrences col.col-actions {
  width: 7.75rem;
}

.table-eoccurrences .col-check {
  width: 2.25rem;
  vertical-align: middle;
}

body[data-workspace="client"] .col-check {
  display: none;
}

.table-eoccurrences .col-when,
.table-eoccurrences .col-project-subject,
.table-eoccurrences .col-importance,
.table-eoccurrences .col-case-status {
  padding-left: 6px;
  padding-right: 6px;
}

.table-eoccurrences thead .table-group-row th {
  top: 0;
  z-index: 2;
  height: 2rem;
  box-sizing: border-box;
  padding-top: 8px;
  padding-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
  border-bottom: none;
}

.table-eoccurrences thead tr:nth-child(2) th {
  top: 2rem;
  z-index: 1;
  padding-top: 4px;
}

.table-eoccurrences thead .table-group-row .col-check,
.table-eoccurrences thead .table-group-row .col-actions {
  z-index: 2;
  vertical-align: middle;
}

.table-eoccurrences .col-group {
  text-align: left;
  font-weight: 650;
}

.table-eoccurrences .col-group-class,
.table-eoccurrences thead tr:nth-child(2) .col-category,
.table-eoccurrences tbody .col-category {
  border-left: 1px solid var(--border);
}

.table-eoccurrences thead .col-actions,
.table-eoccurrences tbody .col-actions {
  border-left: 1px solid var(--border);
}

.table-eoccurrences .col-category,
.table-eoccurrences .col-project-subject,
.table-eoccurrences .col-description,
.table-eoccurrences .col-importance-reason {
  white-space: normal;
}

.table-eoccurrences .col-when {
  width: 7rem;
  overflow: hidden;
  white-space: normal;
}

.cell-when {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.cell-when-date {
  font-weight: 650;
}

.cell-when-time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.table-eoccurrences .col-project-subject {
  width: 5.25rem;
  min-width: 0;
  overflow: hidden;
}

.table-eoccurrences .col-description {
  width: 26%;
  min-width: 0;
}

.dup-pair-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  white-space: normal;
}

.dup-pair-kicker {
  margin: 6px 0 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.dup-pair-cell .dup-pair-kicker:first-child {
  margin-top: 0;
}

.dup-pair-meta {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.dup-pair-snippet {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dup-compare {
  display: grid;
  gap: 12px;
}

.dup-compare-pane {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7f8fa;
}

.dup-compare-pane.is-removed {
  background: #faf6f4;
}

.dup-compare-pane.is-kept {
  background: #f3f8f4;
}

.dup-compare-title {
  margin: 2px 0 4px;
  font-size: 15px;
  font-weight: 650;
}

.dup-compare-pane .drawer-prose {
  margin: 8px 0 0;
  max-height: 16rem;
  overflow: auto;
}

.table-eoccurrences .col-category {
  width: 9rem;
  min-width: 0;
}

.table-eoccurrences .col-importance-reason {
  width: 34%;
  min-width: 0;
}

.table-eoccurrences .col-importance {
  width: 5.75rem;
  min-width: 0;
  white-space: nowrap;
}

.cell-importance-reason {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.table-eoccurrences .col-case-status {
  width: 6.25rem;
  white-space: nowrap;
}

.table-eoccurrences .col-actions {
  width: 7.75rem;
  text-align: right;
  overflow: visible;
}

.table-eoccurrences thead .col-actions {
  text-align: center;
}

.table-eoccurrences thead .col-importance,
.table-eoccurrences thead .col-case-status {
  white-space: nowrap;
}

.table-occurrence-record .cell-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.badge-case {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-case-closed {
  background: color-mix(in srgb, var(--color-success) 14%, transparent);
  color: var(--color-success);
}

.badge-case-informed {
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
  color: var(--color-accent);
}

.badge-case-open {
  background: color-mix(in srgb, var(--color-warning) 16%, transparent);
  color: var(--color-warning);
}

.badge-insight-ok {
  background: color-mix(in srgb, var(--color-success) 14%, transparent);
  color: var(--color-success);
}

.badge-insight-warn {
  background: color-mix(in srgb, var(--color-warning) 16%, transparent);
  color: var(--color-warning);
}

.badge-insight-info {
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
  color: var(--color-accent);
}

.badge-insight-neutral {
  background: var(--surface-muted);
  color: var(--text-muted);
}

.panel-heading-table {
  padding: 1rem 1.25rem 12px;
}

.taxonomy-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.35;
}

.taxonomy-main {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.taxonomy-sub {
  font-size: 11.5px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.taxonomy-empty {
  color: var(--muted);
}

.col-name,
.col-username,
.col-subject {
  width: auto;
  font-weight: 500;
}

.col-code,
.col-nric,
.col-name,
.col-username,
.col-role,
.col-status,
.col-when,
.col-project,
.col-subject {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-actions {
  width: 16.5rem;
  white-space: nowrap;
  text-align: right;
}

.table-users {
  min-width: 56rem;
}

.table-users .col-actions {
  width: 22.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  line-height: 1.2;
  border: 1px solid transparent;
}

.badge-active {
  background: var(--success-soft);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success-soft) 60%, var(--success) 40%);
}

.badge-inactive {
  background: #f1f4f8;
  color: var(--muted);
  border-color: var(--border);
}

.badge-review {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.badge-failed {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}

.badge-high {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
  font-weight: 700;
}

.badge-mid {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.badge-low {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #bfdbfe;
}

.badge-importance {
  text-transform: none;
}

.drawer-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-nav);
  background: var(--bg);
}

.drawer-card-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.drawer-card-list div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 8px;
  align-items: start;
}

.drawer-card-list dt {
  margin: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.drawer-card-list dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}

.drawer-card-note {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}

.drawer-card-label {
  display: inline-block;
  margin-right: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.drawer-card-empty {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.drawer-card .drawer-prose {
  font-size: 13px;
}

.drawer-action-list {
  margin: 0;
  padding-left: 1.1rem;
}

.drawer-action-list li + li {
  margin-top: 10px;
}

.row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  max-width: 100%;
}

.row-action-menu {
  position: static;
  display: inline-flex;
  justify-content: flex-end;
}

.table-eoccurrences .row-action-menu .menu-trigger {
  min-width: 0;
  width: 100%;
  min-height: 28px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 650;
}

.row-action-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  z-index: 40;
  min-width: 12.5rem;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: #f7f8fa;
  border-radius: 0 0 var(--radius-pebble) var(--radius-pebble);
}

.pagination-meta {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

button.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-nav);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}

button.page-btn:hover:not(:disabled) {
  background: var(--row-hover);
  border-color: var(--border);
}

button.page-btn.is-active,
button.page-btn.is-active:hover:not(:disabled) {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  color: var(--muted);
  font-weight: 600;
}

.page-size-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.page-size-field .menu-trigger {
  min-height: 32px;
  min-width: 4.5rem;
}

.page-size-field .menu-panel {
  top: auto;
  bottom: calc(100% + 8px);
}

.row-actions button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.row-actions button.secondary {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--btn-shadow);
}

.row-actions button.secondary:hover:not(:disabled) {
  background: var(--row-hover);
  border-color: color-mix(in srgb, var(--border) 80%, var(--accent) 20%);
  color: var(--accent);
  box-shadow: var(--btn-shadow-hover);
  transform: translateY(-0.5px);
}

.row-actions button.btn-review,
.row-actions .btn-review {
  min-height: 28px;
  padding: 2px 12px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  box-shadow: var(--btn-shadow);
}

.row-actions button.btn-review:hover:not(:disabled),
.row-actions .btn-review:hover:not(:disabled) {
  background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 30%);
  border-color: #93c5fd;
  color: #0c4a6e;
  box-shadow: var(--btn-shadow-hover);
  transform: translateY(-0.5px);
}

/* Inline routine-toggle book button */
.btn-book {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.btn-book:hover:not(:disabled) {
  background: var(--row-hover);
  color: var(--text);
  border-color: color-mix(in srgb, var(--border) 60%, var(--accent) 40%);
}

.btn-book.btn-book-active {
  background: #f0fdf4;
  border-color: #86efac;
  color: var(--success);
}

.btn-book.btn-book-active:hover:not(:disabled) {
  background: #dcfce7;
  border-color: #4ade80;
  color: #15803d;
}

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

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-actions .btn {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }
}

.row-actions button.danger {
  background: var(--danger-bg);
  border-color: transparent;
  color: var(--danger);
}

.row-actions button.danger:hover:not(:disabled) {
  background: #f8d7d4;
}

.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(20, 24, 31, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  background: var(--card);
  border-radius: var(--radius-pebble);
  box-shadow: var(--shadow-float);
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.modal h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.form-fieldset {
  margin: 12px 0 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.form-fieldset legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-fieldset .muted {
  margin: 0 0 10px;
  font-size: 12px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 6px 12px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
}

.checkbox-option input {
  width: auto;
  margin: 0;
}

.modal-progress {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.modal-progress h2 {
  margin: 0 0 8px;
}

.modal-progress .muted {
  margin: 0;
}

.modal-backdrop.modal-wide-backdrop {
  z-index: 180;
  align-items: stretch;
  justify-content: center;
  padding: 20px;
}

.modal.modal-wide {
  display: flex;
  flex-direction: column;
  max-width: min(96rem, 100%);
  max-height: 100%;
  padding: 0;
  overflow: hidden;
}

.modal-wide h2 {
  margin: 0;
}

.modal-wide .cc-overline {
  color: var(--muted);
}

.modal-wide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 12px;
  flex-shrink: 0;
}

.modal-wide-head .muted {
  margin: 4px 0 0;
  font-size: 13px;
}

.modal-wide-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-wide .btn-sm {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 12.5px;
}

.modal-wide .error {
  margin: 0 20px 8px;
}

.modal-wide .table-wrap {
  flex: 1;
  min-height: 12rem;
  max-height: none;
  overflow: auto;
}

.modal-wide .pagination {
  flex-shrink: 0;
}

.modal-wide .table-eoccurrences {
  border-radius: 0;
}

body:has(#list-modal:not(.hidden)) {
  overflow: hidden;
}

.spinner {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.hidden {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.detail-list {
  margin: 0;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(20, 24, 32, 0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--transition-fast),
    visibility var(--transition-fast);
}

.drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: var(--shell-gap);
  right: var(--shell-gap);
  bottom: var(--shell-gap);
  z-index: 210;
  display: flex;
  flex-direction: column;
  width: min(var(--drawer-w), calc(100vw - var(--shell-gap) * 2));
  overflow: hidden;
  transform: translateX(calc(100% + var(--shell-gap)));
  transition: transform var(--transition-fast);
}

.drawer-backdrop.is-open .drawer {
  transform: none;
}

.drawer-backdrop.record-modal {
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.drawer-backdrop.record-modal .drawer {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  width: min(42rem, calc(100vw - 32px));
  max-height: min(52rem, calc(100vh - 48px));
  transform: translateY(14px) scale(0.98);
  opacity: 0;
  transition:
    transform var(--transition-fast),
    opacity var(--transition-fast);
}

.drawer-backdrop.record-modal.is-open .drawer {
  transform: none;
  opacity: 1;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.drawer-heading {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.drawer-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: none;
}

.drawer-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.drawer-title-row h2 {
  flex: 1 1 12rem;
  min-width: 0;
}

.drawer-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

button.drawer-tag {
  min-height: 0;
  min-width: 0;
  padding: 3px 9px;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: none;
  box-shadow: none;
}

button.drawer-tag:hover:not(:disabled),
button.drawer-tag:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}

button.drawer-tag[data-drawer-tag-trigger]:hover:not(:disabled) {
  filter: brightness(0.97);
}

button.drawer-tag:disabled {
  opacity: 1;
  cursor: default;
}

button.drawer-tag.badge-insight-ok {
  background: color-mix(in srgb, var(--color-success) 14%, var(--card));
  color: var(--color-success);
  border-color: color-mix(in srgb, var(--color-success) 35%, var(--border));
}

button.drawer-tag.badge-insight-warn {
  background: color-mix(in srgb, var(--color-warning) 16%, var(--card));
  color: var(--color-warning);
  border-color: color-mix(in srgb, var(--color-warning) 40%, var(--border));
}

button.drawer-tag.badge-insight-info {
  background: color-mix(in srgb, var(--color-accent) 14%, var(--card));
  color: var(--color-accent);
  border-color: color-mix(in srgb, var(--color-accent) 35%, var(--border));
}

button.drawer-tag.badge-insight-neutral,
button.drawer-tag.badge-importance-unset,
button.drawer-tag.badge-case-unset {
  background: var(--surface-muted);
  color: var(--text-muted);
  border-color: var(--border);
}

button.drawer-tag.badge-high {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

button.drawer-tag.badge-mid {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

button.drawer-tag.badge-low {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #bfdbfe;
}

button.drawer-tag.badge-case-closed {
  background: color-mix(in srgb, var(--color-success) 14%, var(--card));
  color: var(--color-success);
  border-color: color-mix(in srgb, var(--color-success) 35%, var(--border));
}

button.drawer-tag.badge-case-informed {
  background: color-mix(in srgb, var(--color-accent) 14%, var(--card));
  color: var(--color-accent);
  border-color: color-mix(in srgb, var(--color-accent) 35%, var(--border));
}

button.drawer-tag.badge-case-open {
  background: color-mix(in srgb, var(--color-warning) 16%, var(--card));
  color: var(--color-warning);
  border-color: color-mix(in srgb, var(--color-warning) 40%, var(--border));
}

.drawer-tag .menu-caret {
  width: 10px;
  height: 10px;
}

.drawer-tag-panel {
  position: fixed;
  z-index: 230;
  min-width: 10rem;
}

.drawer.is-wide {
  width: min(40rem, calc(100vw - var(--shell-gap) * 2));
}

.drawer-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin: -6px -6px 0 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-nav);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.drawer-close:hover {
  background: var(--row-hover);
  color: var(--text);
}

.drawer-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.drawer-close svg {
  display: block;
  width: 18px;
  height: 18px;
}

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 18px 20px;
}

.drawer-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.drawer-section:last-child {
  border-bottom: none;
  padding-bottom: 8px;
}

.drawer-section .detail-list div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.drawer-section-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.drawer-disclosure {
  margin: 0;
}

.drawer-disclosure > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}

.drawer-disclosure > summary::-webkit-details-marker {
  display: none;
}

.drawer-disclosure > summary::after {
  content: "▸";
  float: right;
  color: var(--muted);
  transition: transform var(--transition-fast);
}

.drawer-disclosure[open] > summary::after {
  transform: rotate(90deg);
}

.drawer-disclosure > .drawer-card {
  margin-top: 10px;
}

.drawer-prose {
  margin: 0;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}

.drawer-dup-keep {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted, #64748b);
}

.drawer-dup-keep .input {
  width: 100%;
}

.drawer-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--card);
  backdrop-filter: blur(8px);
}

.drawer-footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.drawer-footer[hidden] {
  display: none !important;
}

.drawer-footer .btn {
  min-height: 36px;
  padding: 6px 14px;
}

.drawer-footer .btn-secondary {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--btn-shadow);
}

.drawer-footer .btn-secondary:hover:not(:disabled) {
  background: var(--row-hover);
  border-color: color-mix(in srgb, var(--border) 80%, var(--accent) 20%);
  color: var(--accent);
  box-shadow: var(--btn-shadow-hover);
}

.drawer-footer .btn-primary {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--primary) 82%, #fff) 0%,
    var(--primary) 100%
  );
  color: #fff;
  border-color: var(--primary-hover);
  box-shadow: var(--btn-shadow), var(--btn-inset-highlight);
}

.drawer-footer .btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
  border-color: var(--primary-hover);
  box-shadow: var(--btn-shadow-hover), var(--btn-inset-highlight);
}

.drawer-footer .btn-review,
.drawer-footer .btn-text {
  flex-shrink: 0;
}

.drawer-footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: var(--transition-btn);
}

.btn-text:hover:not(:disabled) {
  color: var(--text);
  background: var(--row-hover);
  border-color: var(--border);
}

.btn-text:active:not(:disabled) {
  transform: scale(0.985);
}

.drawer-more {
  position: relative;
}

.drawer-more > summary {
  list-style: none;
  cursor: pointer;
}

.drawer-more > summary::-webkit-details-marker {
  display: none;
}

.drawer-more-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.drawer-more-panel button {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius-nav);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.drawer-more-panel button:hover:not(:disabled) {
  background: var(--row-hover);
}

.drawer-callout {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-nav);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .insight-guide-grid {
    grid-template-columns: 1fr;
  }

  .drawer-footer-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .drawer-footer-actions {
    width: 100%;
    margin-left: 0;
  }

  .drawer-footer-actions .btn-primary {
    flex: 1 1 100%;
    width: 100%;
    justify-content: center;
  }
}

.drawer mark {
  background: #fff3bf;
  color: inherit;
  padding: 0 1px;
}

.drawer-section label {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.drawer-section label .input {
  display: block;
  width: 100%;
  margin-top: 4px;
}

.table tbody tr[data-open] {
  cursor: pointer;
}

body:has(.drawer-backdrop.is-open) {
  overflow: hidden;
}

@media (max-width: 720px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    gap: var(--shell-gap);
  }

  .app-sidenav {
    z-index: 120;
    transform: translateX(calc(-100% - var(--shell-gap)));
  }

  .app-shell.is-sidenav-expanded .app-sidenav {
    transform: none;
  }

  .app-column {
    margin-left: 0;
    min-height: 0;
  }

  .app-topnav {
    z-index: 130;
    padding: 8px 16px;
  }

  .sidenav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(20, 24, 32, 0.36);
  }

  .sidenav-backdrop.hidden {
    display: none;
  }

  body:has(.app-shell.is-sidenav-expanded) {
    overflow: hidden;
  }

  .pill-track {
    width: 100%;
    border-radius: var(--radius-lg);
  }

  .pill-track .pill {
    flex: 1 1 auto;
  }

  .data-panel-toolbar {
    align-items: stretch;
  }

  .overview-split {
    grid-template-columns: 1fr;
  }

  .table-filter-top {
    align-items: stretch;
  }

  .table-filter-top .toolbar-filters,
  .more-filters-body,
  .command-bar-start,
  .command-bar-end {
    width: 100%;
  }

  .command-btn {
    justify-content: space-between;
  }

  .filter-more-btn {
    width: auto;
  }

  .toolbar-filters,
  .search-field,
  .filter-field .select,
  .filter-field .input,
  .filter-field .file-field-control,
  .filter-range,
  .data-panel-toolbar .btn-primary {
    width: 100%;
  }

  .filter-range .filter-field {
    flex: 1 1 auto;
    min-width: 0;
  }

  .filter-range .filter-field .input[type="date"] {
    width: 100%;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .pagination {
    justify-content: center;
  }

  .pagination-controls {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .login-card {
    max-width: 320px;
    padding: 24px 20px 20px;
  }

  .login-logo {
    width: min(100%, 157px);
  }

  .login-brand {
    margin-bottom: 16px;
  }

  .login-portal-title {
    margin-top: 8px;
    font-size: 13px;
  }

  .login-portal-lede {
    font-size: 12px;
  }

  .login-title {
    font-size: 20px;
  }

  .login-subtitle {
    margin: 4px 0 18px;
    font-size: 13px;
  }

  .login-footer {
    margin-top: 18px;
    font-size: 11px;
  }

  .login-card .field {
    margin-bottom: 14px;
  }

  .login-card .btn-primary {
    height: 44px;
  }

  .login-card .input {
    height: 36px;
    padding: 6px 12px;
  }

  .login-card .password-field .input {
    padding-right: 40px;
  }

  .login-card .input:focus,
  .login-card .input:focus-visible {
    padding: 5px 11px;
  }

  .login-card .password-field .input:focus,
  .login-card .password-field .input:focus-visible {
    padding-right: 39px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidenav,
  .app-column,
  .drawer,
  .drawer-backdrop {
    transition: none;
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  .login-logo {
    width: min(100%, 128px);
  }

  .login-card {
    padding: 20px 18px 16px;
  }

  .login-brand {
    margin-bottom: 12px;
  }

  .login-footer {
    margin-top: 14px;
  }
}

@media (max-height: 520px) {
  .login-page {
    overflow-y: auto;
  }
}

/* ── Collapsible panels (Fetch, Import, AI Spend) ───────── */
.panel-collapsible {
  padding: 0;
  overflow: hidden;
}

.panel-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  gap: 8px;
}

.panel-toggle-btn:hover {
  background: var(--row-hover);
}

.panel-toggle-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.panel-toggle-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.panel-toggle-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}

.panel-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s;
}

.panel-toggle-btn[aria-expanded="true"] .panel-chevron,
.command-btn[aria-expanded="true"] .panel-chevron {
  transform: rotate(180deg);
}

.panel-collapse-body {
  border-top: 1px solid var(--border);
}

.panel-collapse-lead {
  margin: 0;
  padding: 10px 16px 0;
  font-size: 13px;
}

/* ── Command bar (Fetch, Import, AI spend) ──────────────── */
.command-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  min-height: 48px;
  padding: 6px 10px;
}

.command-bar-start,
.command-bar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.command-btn {
  width: auto;
  min-height: 36px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius-nav);
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-size: 13px;
  font-weight: 600;
  gap: 8px;
}

.command-btn:hover {
  background: var(--row-hover);
}

.command-btn:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}

.command-btn[aria-expanded="true"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.command-btn-label {
  white-space: nowrap;
}

.command-btn .panel-toggle-badge {
  max-width: 12rem;
}

.command-btn[aria-expanded="true"] .panel-toggle-badge {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  background: color-mix(in srgb, var(--card) 70%, var(--primary-soft));
}

.command-kpi-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.command-kpi-value {
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.command-btn[aria-expanded="true"] .command-kpi-label,
.command-btn[aria-expanded="true"] .command-kpi-value {
  color: var(--primary);
}

.filter-more-btn {
  height: 40px;
  min-height: 40px;
  flex: 0 0 auto;
}

.table-filter {
  position: relative;
  z-index: 6;
  border-bottom: 1px solid var(--border);
}

.table-filter .panel-heading-table {
  padding: 16px 16px 0;
}

.table-filter-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  padding: 12px 16px 8px;
}

.table-filter-top .toolbar-filters {
  flex: 1 1 100%;
  min-width: 0;
}

.table-filter-top .search-field {
  flex: 1 1 14rem;
  min-width: 12rem;
}

.table-filter-top .project-picker {
  flex: 0 0 auto;
}

.table-filter.is-project-picker-open {
  z-index: 12;
}

.more-filters-body {
  padding: 0 16px 12px;
  align-items: flex-end;
}

.filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
}

.filter-chip {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text);
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
}

.filter-chip:hover {
  background: var(--row-hover);
}

.filter-chip:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}

.filter-chip-x {
  color: var(--muted);
  font-weight: 700;
}

.spend-body {
  border-top: 1px solid var(--border);
  padding: 16px 20px 20px;
}
.spend-state-msg {
  font-size: 0.875rem;
  color: var(--muted);
}
.spend-summary {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.spend-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.spend-summary-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.spend-summary-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}
.spend-summary-value.ok {
  color: var(--success);
}
.spend-summary-value.warn {
  color: #b45309;
}
.table-spend {
  font-size: 0.8125rem;
}
.table-spend th,
.table-spend td {
  padding: 8px 12px;
}

/* Operations Overview — Command Centre layout (HQ tokens, not v0 navy/gold) */
.cc-page {
  --cc-primary: var(--primary);
  --cc-primary-hover: var(--primary-hover);
  --cc-primary-soft: var(--primary-soft);
  --cc-green: var(--success);
  --cc-amber: #d97706;
  --cc-danger: var(--danger);
  --cc-ink: var(--text);
  --cc-muted: var(--muted);
  --cc-line: var(--border);
  --cc-canvas: var(--bg);
  --cc-surface: var(--card);
  --cc-radius: 14px;
  --cc-radius-sm: 10px;
  --cc-radius-lg: var(--radius-pebble);
  --cc-radius-pill: var(--radius-pill);
  --cc-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 14px rgba(16, 24, 40, 0.05);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  color: var(--cc-ink);
}

.cc-page .btn {
  border-radius: var(--cc-radius-sm);
}

.cc-page .btn-sm {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 12.5px;
}

.cc-page .btn-primary {
  background: var(--cc-primary);
  border-color: var(--cc-primary);
  box-shadow: var(--btn-shadow);
}

.cc-page .btn-primary:hover:not(:disabled) {
  background: var(--cc-primary-hover);
  border-color: var(--cc-primary-hover);
}

.cc-page .input,
.cc-page .select {
  width: 100%;
  min-height: 38px;
  border-radius: var(--cc-radius-sm);
}

.cc-briefing {
  padding: 18px 24px 16px;
  background: var(--cc-surface);
  border: 1px solid var(--cc-line);
  border-left: 6px solid var(--cc-primary);
  border-radius: var(--cc-radius-lg);
  color: var(--cc-ink);
  box-shadow: var(--cc-shadow);
}

.cc-briefing[data-tone="attention"] {
  border-left-color: var(--cc-amber);
  background: linear-gradient(90deg, #fff7ed 0%, var(--cc-surface) 12%);
}

.cc-briefing[data-tone="positive"] {
  border-left-color: var(--cc-green);
  background: linear-gradient(90deg, #ecfdf3 0%, var(--cc-surface) 12%);
}

.cc-briefing__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}

.cc-briefing__signal {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  color: var(--cc-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cc-briefing__pulse {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--cc-primary);
}

.cc-briefing[data-tone="attention"] .cc-briefing__pulse {
  background: var(--cc-amber);
}

.cc-briefing[data-tone="positive"] .cc-briefing__pulse {
  background: var(--cc-green);
}

.cc-briefing__meta {
  color: var(--cc-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.cc-briefing__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.cc-briefing__headline {
  margin: 0.7rem 0 0;
  color: var(--cc-ink);
  font-size: clamp(1.35rem, 2.3vw, 1.85rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.cc-briefing__details {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px 32px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--cc-line);
}

.cc-briefing__details p {
  margin: 0;
  color: var(--cc-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.cc-briefing__details p:first-child {
  max-width: 40rem;
}

.cc-briefing__details p:last-child {
  max-width: 22rem;
  text-align: right;
}

.cc-workflow-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0.75rem 16px;
  background: var(--cc-surface);
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius);
  color: var(--cc-muted);
  font-size: 0.78rem;
  box-shadow: var(--cc-shadow);
}

.cc-workflow-note__mark {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--cc-green);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--success-soft);
}

.cc-workflow-note[data-tone="attention"] .cc-workflow-note__mark {
  background: var(--cc-amber);
  box-shadow: 0 0 0 3px #fef3c7;
}

.cc-workflow-note[data-tone="alert"] .cc-workflow-note__mark {
  background: var(--cc-danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}

.cc-shell {
  display: grid;
  grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.cc-shell.filters-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.cc-filter-rail {
  position: sticky;
  top: 8px;
  background: var(--cc-surface);
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius-lg);
  box-shadow: var(--cc-shadow);
  overflow: hidden;
}

.cc-filter-rail.is-collapsed {
  display: none;
}

.cc-filter-rail__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--cc-line);
  background: #fafbfc;
}

.cc-overline {
  margin: 0;
  color: var(--cc-muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cc-filter-rail__head .cc-overline,
.cc-panel__head .cc-overline {
  color: var(--cc-primary);
}

.cc-filter-rail__head h2,
.cc-panel__head h2 {
  margin: 0.25rem 0 0;
  color: var(--cc-ink);
  font-size: 1rem;
  letter-spacing: -0.015em;
}

.cc-filter-close {
  display: none;
}

.cc-filter-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.cc-filter-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--cc-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.cc-filter-form-label {
  color: var(--cc-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.cc-period-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cc-period-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 3px;
  padding: 3px;
  background: #f3f4f6;
  border-radius: 10px;
}

.cc-period-toggle button {
  min-height: 30px;
  padding: 6px 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--cc-muted);
  box-shadow: none;
  font-size: 0.72rem;
  font-weight: 650;
}

.cc-period-toggle button:hover,
.cc-period-toggle button:focus-visible {
  background: #eceff3;
  color: var(--cc-ink);
  box-shadow: none;
  transform: none;
}

.cc-period-toggle button:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}

.cc-period-toggle button[aria-pressed="true"] {
  background: var(--cc-surface);
  color: var(--cc-ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.cc-week-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cc-week-stepper {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.cc-week-stepper p {
  margin: 0;
  color: var(--cc-ink);
  font-size: 0.8rem;
  font-weight: 650;
  text-align: center;
  line-height: 1.3;
}

.cc-week-shortcuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cc-custom-range {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cc-filter-form__actions {
  display: flex;
  padding-top: 4px;
}

.cc-filter-footnote {
  margin: 0;
  padding: 0 16px 16px;
  color: var(--cc-muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

.cc-filter-toasts {
  margin: 0;
  padding: 16px 16px 20px;
  border-top: 1px solid var(--cc-line);
  background: #fafbfc;
  gap: 8px 12px;
}

.cc-filter-toasts:empty,
.cc-filter-toast-bar:empty {
  display: none;
}

.cc-filter-toast-bar {
  padding: 6px 0 10px;
  min-height: 2.25rem;
  gap: 8px 12px;
}

.cc-filter-toasts .filter-chip,
.cc-filter-toast-bar .filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--brand-maroon);
  box-shadow: none;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.45;
  gap: 4px;
}

.cc-filter-toasts .filter-chip-x,
.cc-filter-toast-bar .filter-chip-x {
  color: var(--brand-maroon);
}

.cc-filter-toasts .filter-chip:hover,
.cc-filter-toast-bar .filter-chip:hover {
  background: transparent;
  color: var(--brand-maroon);
  box-shadow: none;
}

.cc-filter-toasts .filter-chip:active:not(:disabled),
.cc-filter-toast-bar .filter-chip:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}

.filter-chip.is-static {
  cursor: default;
}

.cc-canvas {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 16px;
}

.cc-scorecard {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.cc-score {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  background: var(--cc-surface);
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  color: var(--cc-ink);
  font: inherit;
  font-weight: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.cc-score:hover {
  background: var(--row-hover);
  color: var(--cc-ink);
}

.cc-score:active:not(:disabled) {
  transform: none;
  box-shadow: var(--cc-shadow);
}

.cc-score__label {
  margin: 0;
  color: var(--cc-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.cc-score__value {
  margin-top: 0.35rem;
  color: var(--cc-ink);
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
}

.cc-score--danger .cc-score__value {
  color: var(--cc-danger);
}

.cc-score--good .cc-score__value {
  color: var(--cc-green);
}

.cc-score__compare {
  display: grid;
  grid-template-rows: 3px 3px;
  gap: 2px;
  width: 100%;
  margin-top: 0.6rem;
  background: #f3f4f6;
  border-radius: var(--cc-radius-pill);
  overflow: hidden;
}

.cc-score__bar {
  display: block;
  min-width: 2px;
  height: 3px;
}

.cc-score__bar--current {
  background: var(--cc-primary);
  border-radius: var(--cc-radius-pill);
}

.cc-score__bar--previous {
  background: #cbd5e1;
  border-radius: var(--cc-radius-pill);
}

.cc-score__context {
  min-height: 2.2em;
  margin: 0.55rem 0 0;
  color: var(--cc-muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

.cc-primary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.85fr);
  gap: 16px;
}

.cc-concentration-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.cc-panel--subs .cc-empty {
  margin: 0;
}

.cc-volume-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 16px;
}

.cc-panel--trend {
  min-width: 0;
}

.cc-panel--trend .cc-panel__tools {
  align-items: flex-end;
  text-align: right;
}

.cc-trend-body {
  width: 100%;
  padding: 8px 8px 12px 4px;
}

.cc-trend-plot {
  position: relative;
  width: 100%;
}

.cc-trend-svg {
  display: block;
  width: 100%;
  height: auto;
}

.cc-trend-grid {
  stroke: var(--cc-line);
  stroke-width: 1;
  stroke-dasharray: 2 7;
}

.cc-trend-axis {
  fill: var(--cc-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.cc-trend-area {
  fill: url(#ccTrendFill);
}

.cc-trend-line {
  fill: none;
  stroke: var(--cc-primary);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cc-trend-line--high {
  stroke: var(--cc-danger);
  stroke-width: 1.8;
}

.cc-trend-guide {
  stroke: var(--cc-primary);
  stroke-opacity: 0.18;
  stroke-width: 1;
}

.cc-trend-dot {
  fill: var(--cc-surface);
  stroke: var(--cc-primary);
  stroke-width: 2;
}

.cc-trend-dot--high {
  stroke: var(--cc-danger);
}

.cc-trend-dot.is-active {
  fill: var(--cc-primary);
}

.cc-trend-dot--high.is-active {
  fill: var(--cc-danger);
}

.cc-trend-hit {
  cursor: pointer;
}

.cc-trend-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  color: var(--cc-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cc-trend-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.28rem;
  margin-right: 0.35rem;
  border-radius: 99px;
  vertical-align: middle;
}

.cc-trend-swatch--volume {
  background: var(--cc-primary);
}

.cc-trend-swatch--high {
  background: var(--cc-danger);
}

.cc-trend-peak {
  margin: 8px 0 0;
  color: var(--cc-ink);
  font-size: 0.72rem;
  font-weight: 650;
}

.cc-trend-tip {
  position: absolute;
  z-index: 2;
  min-width: 8.5rem;
  padding: 8px 10px;
  background: var(--cc-surface);
  border: 1px solid var(--cc-line);
  border-radius: 12px;
  box-shadow: var(--cc-shadow), 0 10px 24px rgba(15, 23, 42, 0.08);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  transition: opacity 0.12s ease;
}

.cc-trend-tip.is-on {
  opacity: 1;
}

.cc-trend-tip strong {
  display: block;
  color: var(--cc-ink);
  font-size: 0.78rem;
}

.cc-trend-tip span {
  display: block;
  margin-top: 2px;
  color: var(--cc-muted);
  font-size: 0.68rem;
}

.cc-mix-body {
  display: grid;
  grid-template-columns: minmax(8.5rem, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 8px 16px;
  min-height: 13.5rem;
  padding: 12px 16px 16px;
}

.cc-mix-plot {
  position: relative;
  width: min(100%, 11.5rem);
  margin: 0 auto;
}

.cc-mix-svg {
  display: block;
  width: 100%;
  height: auto;
}

.cc-mix-center {
  position: absolute;
  inset: 22% 18%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.cc-mix-center strong {
  color: var(--cc-ink);
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.cc-mix-center span {
  margin-top: 0.25rem;
  color: var(--cc-muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cc-mix-slice {
  fill: none;
  stroke-linecap: butt;
  stroke-linejoin: round;
  cursor: pointer;
  transition: opacity 0.12s ease, stroke-width 0.12s ease;
}

.cc-mix-slice:hover,
.cc-mix-slice:focus-visible {
  opacity: 0.82;
}

.cc-mix-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.cc-mix-row {
  display: grid;
  grid-template-columns: 0.55rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  color: var(--cc-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cc-mix-row:hover,
.cc-mix-row:focus-visible {
  background: var(--row-hover);
  color: var(--cc-ink);
}

.cc-mix-row:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}

.cc-mix-swatch {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 99px;
}

.cc-mix-row strong {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-mix-row span {
  color: var(--cc-muted);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cc-mix-body > .cc-empty {
  grid-column: 1 / -1;
}

.cc-panel {
  min-width: 0;
  background: var(--cc-surface);
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius-lg);
  box-shadow: var(--cc-shadow);
  overflow: hidden;
}

.cc-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--cc-line);
  background: #fafbfc;
}

.cc-panel__head p:not(.cc-overline) {
  margin: 0.35rem 0 0;
  max-width: 44rem;
  color: var(--cc-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.cc-panel__tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.cc-panel__body {
  padding: 16px 20px;
}

.cc-matrix-legend {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--cc-muted);
  font-size: 0.65rem;
  white-space: nowrap;
}

.cc-matrix-legend i {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 4px;
  background: var(--cc-primary);
}

.cc-matrix-legend i:nth-of-type(1) {
  opacity: 0.18;
}
.cc-matrix-legend i:nth-of-type(2) {
  opacity: 0.38;
}
.cc-matrix-legend i:nth-of-type(3) {
  opacity: 0.62;
}
.cc-matrix-legend i:nth-of-type(4) {
  opacity: 0.9;
}

.cc-matrix-wrap {
  overflow: auto;
  max-height: 34rem;
  padding: 12px;
}

.cc-matrix-wrap.is-single-site {
  max-height: none;
}

.cc-matrix-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.875rem, 1fr));
  gap: 5px;
}

.cc-matrix-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.15rem;
  width: 100%;
  min-height: 3.75rem;
  padding: 6px 7px;
  border: 1px solid var(--cc-line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--cc-primary) var(--cell-intensity, 0%), #fff);
  color: var(--cc-ink);
  box-shadow: var(--cc-shadow);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cc-matrix-card:hover,
.cc-matrix-card:focus-visible {
  border-color: var(--cc-primary);
  color: var(--cc-ink);
  box-shadow: 0 0 0 3px var(--cc-primary-soft);
  outline: none;
  transform: translateY(-1px);
}

.cc-matrix-card:active:not(:disabled) {
  transform: none;
  box-shadow: var(--cc-shadow);
}

.cc-matrix-card.is-selected {
  border-color: var(--cc-primary);
  box-shadow: 0 0 0 3px var(--cc-primary-soft);
}

.cc-matrix-card.is-dark {
  color: #fff;
}

.cc-matrix-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
  min-height: 1.2em;
}

.cc-matrix-card__kicker {
  display: -webkit-box;
  overflow: hidden;
  min-width: 0;
  color: inherit;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.25;
  text-transform: uppercase;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cc-matrix-card__alert {
  flex: 0 0 auto;
  width: 0.35rem;
  height: 0.35rem;
  margin-top: 0.15rem;
  background: var(--cc-danger);
  border: 1px solid #fff;
  border-radius: 50%;
}

.cc-matrix-card__value {
  margin-top: auto;
  color: inherit;
  font-size: 0.85rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
}

.cc-matrix-card__meta {
  color: color-mix(in srgb, var(--cc-ink) 62%, #fff);
  font-size: 0.55rem;
  font-weight: 650;
}

.cc-matrix-card.is-dark .cc-matrix-card__meta {
  color: #dbe4ee;
}

.cc-page table.cc-matrix {
  width: 100%;
  min-width: 640px;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 6px;
  background: transparent;
  font-size: 0.68rem;
}

.cc-page table.cc-matrix th {
  position: static;
  max-width: none;
  padding: 0 0.15rem 0.45rem;
  overflow: visible;
  color: var(--cc-muted);
  font-size: inherit;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
  text-align: center;
  text-transform: none;
  white-space: nowrap;
  background: transparent;
}

.cc-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  vertical-align: bottom;
  background: var(--cc-surface);
}

.cc-matrix-colhead {
  display: inline-block;
  max-width: 100%;
  padding: 0 0.1rem 0.28rem;
  border-bottom: 1px solid color-mix(in srgb, var(--cc-primary) 28%, var(--cc-line));
  color: var(--cc-muted);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.cc-matrix-corner .cc-matrix-colhead {
  border-bottom-color: transparent;
  color: var(--cc-primary);
  letter-spacing: 0.14em;
}

.cc-matrix tbody th {
  position: sticky;
  left: 0;
  top: auto;
  z-index: 1;
  min-width: 4.25rem;
  padding: 0 0.55rem 0 0;
  background: var(--cc-surface);
  color: var(--cc-ink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}

.cc-matrix td {
  min-width: 4.1rem;
  height: 3.35rem;
  padding: 0;
}

.cc-matrix-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  min-height: 3.35rem;
  padding: 0.25rem;
  border: 1px solid transparent;
  border-radius: var(--cc-radius-sm);
  background: color-mix(in srgb, var(--cc-primary) var(--cell-intensity, 0%), #fff);
  color: var(--cc-ink);
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.cc-matrix-cell:hover,
.cc-matrix-cell:focus-visible {
  border-color: var(--cc-primary);
  box-shadow: 0 0 0 3px var(--cc-primary-soft);
  outline: none;
  transform: translateY(-1px);
}

.cc-matrix-cell.has-critical::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 0.45rem;
  height: 0.45rem;
  background: var(--cc-danger);
  border: 1px solid #fff;
  border-radius: 50%;
}

.cc-matrix-cell.is-dark {
  color: #fff;
}

.cc-matrix-cell.is-dark span {
  color: #e3eaf0;
}

.cc-matrix-cell.is-selected {
  border-color: var(--cc-primary);
  box-shadow: 0 0 0 3px var(--cc-primary-soft);
}

.cc-matrix-cell strong,
.cc-matrix-cell span {
  display: block;
}

.cc-matrix-cell strong {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.cc-matrix-cell span {
  margin-top: 0.1rem;
  font-size: 0.58rem;
  color: color-mix(in srgb, var(--cc-ink) 72%, #fff);
}

.cc-matrix-cell__zero {
  color: #bfc7ce !important;
}

.cc-matrix__total {
  color: var(--cc-ink);
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.cc-action-list {
  max-height: 34rem;
  overflow-y: auto;
}

.cc-action-item {
  display: grid;
  grid-template-columns: 3.1rem minmax(0, 1fr) 4.5rem;
  align-items: start;
  gap: 12px;
  width: 100%;
  min-height: 0;
  padding: 12px 16px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--cc-line);
  background: var(--cc-surface);
  color: var(--cc-ink);
  box-shadow: none;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.cc-action-item:hover,
.cc-action-item:focus-visible {
  background: #f8fafc;
  color: var(--cc-ink);
  outline: none;
}

.cc-action-item--high {
  box-shadow: inset 4px 0 0 var(--cc-danger);
}

.cc-action-item__flag {
  display: inline-flex;
  justify-content: center;
  padding: 0.25rem 0.4rem;
  border-radius: var(--cc-radius-pill);
  background: var(--cc-primary-soft);
  color: var(--cc-primary);
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
}

.cc-action-item--high .cc-action-item__flag {
  background: #fee2e2;
  color: var(--cc-danger);
}

.cc-action-item__main,
.cc-action-item__meta {
  min-width: 0;
}

.cc-action-item__main strong,
.cc-action-item__main span,
.cc-action-item__meta strong,
.cc-action-item__meta span {
  display: block;
}

.cc-action-item__main strong {
  font-size: 0.76rem;
}

.cc-action-item__main span {
  margin-top: 0.25rem;
  overflow: hidden;
  color: var(--cc-muted);
  font-size: 0.68rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-action-item__meta {
  color: var(--cc-muted);
  text-align: right;
}

.cc-action-item__meta strong {
  color: var(--cc-ink);
  font-size: 0.82rem;
}

.cc-action-item__meta span {
  margin-top: 0.2rem;
  font-size: 0.58rem;
}

.cc-action-empty,
.cc-empty {
  padding: 24px;
  color: var(--cc-muted);
  text-align: center;
}

.cc-action-empty > span {
  display: block;
  color: var(--cc-green);
  font-size: 1.6rem;
}

.cc-action-empty strong {
  display: block;
  margin-top: 8px;
  color: var(--cc-ink);
}

.cc-action-empty p {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
}

.cc-hbar-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cc-hbar-row {
  display: grid;
  grid-template-columns: minmax(8rem, 16rem) 1fr 2.6rem;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--cc-ink);
  box-shadow: none;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.cc-hbar-row:hover {
  color: var(--cc-ink);
}

.cc-hbar-row:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}

.cc-hbar-row:hover .cc-hbar-fill {
  filter: brightness(0.96);
}

.cc-hbar-label {
  overflow: hidden;
  color: var(--cc-ink);
  font-size: 0.72rem;
  font-weight: 600;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cc-hbar-track {
  height: 1.35rem;
  border-radius: var(--cc-radius-pill);
  background: #f3f4f6;
  overflow: hidden;
}

.cc-hbar-fill {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: var(--cc-radius-pill);
  background: var(--cc-primary);
}

.cc-hbar-fill--high {
  background: var(--cc-danger);
}

.cc-hbar-fill--mid {
  background: var(--cc-amber);
}

.cc-hbar-fill--low {
  background: #94a3b8;
}

.cc-hbar-value {
  color: var(--cc-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1200px) {
  .cc-scorecard {
    grid-template-columns: repeat(3, 1fr);
  }

  .cc-primary-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  }
}

@media (max-width: 960px) {
  .cc-shell {
    grid-template-columns: 1fr;
  }

  .cc-filter-rail {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 140;
    width: min(320px, 92vw);
    overflow-y: auto;
    box-shadow: -12px 0 30px rgba(20, 40, 61, 0.18);
  }

  .cc-shell:not(.filters-ready) .cc-filter-rail {
    display: none;
  }

  .cc-filter-close {
    display: inline-flex;
  }

  .cc-primary-grid,
  .cc-volume-row {
    grid-template-columns: 1fr;
  }

  .cc-briefing__details {
    flex-direction: column;
    gap: 8px;
  }

  .cc-briefing__details p:last-child {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 700px) {
  .cc-briefing__top {
    align-items: flex-start;
  }

  .cc-briefing__actions {
    justify-content: flex-start;
  }

  .cc-scorecard {
    grid-template-columns: 1fr 1fr;
  }

  .cc-briefing,
  .cc-panel__head,
  .cc-panel__body {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Handling guides — master-detail library (Operations + Client) */
.guides-page {
  --cc-primary: var(--primary);
  --cc-primary-hover: var(--primary-hover);
  --cc-primary-soft: var(--primary-soft);
  --cc-ink: var(--text);
  --cc-muted: var(--muted);
  --cc-line: var(--border);
  --cc-surface: var(--card);
  --cc-radius: 14px;
  --cc-radius-sm: 10px;
  --cc-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 14px rgba(16, 24, 40, 0.05);
  --guides-hero-gold: #b48324;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  color: var(--cc-ink);
}

.guides-page .guides-hero {
  margin: 0;
  padding: 24px 24px 20px;
  background: linear-gradient(
    135deg,
    #e8f2fd 0%,
    #f7fbff 38%,
    var(--primary-soft) 100%
  );
  box-shadow: var(--shadow-sm);
}

.guides-page .guides-hero__eyebrow {
  margin: 0 0 8px;
  color: #b48324;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.guides-hero__title {
  margin: 0 0 12px;
  color: var(--text);
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.guides-hero__lede {
  margin: 0;
  max-width: 46rem;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.cc-guides-v2 {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-height: 32rem;
}

.cc-guides-v2__nav {
  position: sticky;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100dvh - var(--topnav-h) - 40px);
  padding: 20px;
  overflow: hidden;
}

.cc-guides-v2__stats {
  margin: 0.2rem 0 0;
  color: var(--cc-muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.cc-guides-v2__search .input {
  width: 100%;
  height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
}

.cc-guides-v2__search .input::placeholder {
  color: var(--muted);
}

.cc-guides-v2__search .input:hover {
  border-color: #c5cad4;
}

.cc-guides-v2__search .input:focus,
.cc-guides-v2__search .input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.16);
}

.guides-page input[type="checkbox"] {
  appearance: none;
  width: 0.9rem;
  height: 0.9rem;
  margin: 0;
  flex-shrink: 0;
  border: 1.5px solid #c5cad4;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}

.guides-page input[type="checkbox"]:checked {
  border-color: var(--primary);
  background-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 6.2 5 8.7 9.5 3.5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 10px;
}

.guides-page input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.cc-guides-v2__filter-panel {
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.cc-guides-v2__filter-all {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
  padding: 0.35rem 0.4rem;
  border-radius: var(--cc-radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
}

.cc-guides-v2__filter-checks {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 9rem;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.cc-guides-v2__filter-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0.28rem 0.4rem;
  border-radius: var(--cc-radius-sm);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--cc-muted);
  cursor: pointer;
}

.cc-guides-v2__filter-row:hover {
  background: rgba(16, 24, 40, 0.04);
}

.cc-guides-v2__filter-row input[type="checkbox"] {
  margin-top: 0.15rem;
}

.cc-guides-v2__filter-label {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: break-word;
}

.cc-guides-v2__filter-count {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  min-width: 1.1rem;
  margin-top: 0.05rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: rgba(16, 24, 40, 0.06);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.cc-guides-v2__index-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.cc-guides-v2__index-empty {
  padding: 12px 4px;
  font-size: 0.78rem;
}

.cc-guides-v2__group + .cc-guides-v2__group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--cc-line);
}

.cc-guides-v2__group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 0.45rem;
  color: var(--cc-muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cc-guides-v2__group-count {
  color: var(--cc-primary);
  font-variant-numeric: tabular-nums;
}

.cc-guides-v2__group-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cc-guide-index-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--cc-radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease;
}

.cc-guide-index-item:hover {
  background: #f8fafc;
  border-color: var(--cc-line);
}

.cc-guide-index-item.is-active {
  border-color: color-mix(in srgb, var(--cc-primary) 35%, var(--cc-line));
  background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.1) 0%, #fff 100%);
}

.cc-guide-index-item__icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-top: 0.05rem;
  border-radius: 0.45rem;
  background: var(--cc-primary-soft);
  color: var(--cc-primary);
}

.cc-guide-index-item__icon svg {
  width: 0.95rem;
  height: 0.95rem;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cc-guide-index-item__text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.cc-guide-index-item__sub {
  color: var(--cc-primary);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cc-guide-index-item__title {
  color: var(--cc-ink);
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cc-guides-v2__reader {
  min-width: 0;
}

.cc-guides-v2__back {
  margin-bottom: 12px;
}

.cc-guides-v2__placeholder {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
}

.cc-guides-v2__placeholder[hidden],
.cc-guides-v2__article[hidden] {
  display: none !important;
}

.cc-guides-v2__placeholder-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.55rem;
  background: var(--cc-primary-soft);
  color: var(--cc-primary);
}

.cc-guides-v2__placeholder-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.cc-guides-v2__placeholder-copy strong {
  display: block;
  color: var(--cc-ink);
  font-size: 0.86rem;
  line-height: 1.3;
}

.cc-guides-v2__placeholder-copy p {
  margin: 0.15rem 0 0;
  color: var(--cc-muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.cc-guides-v2__article-head {
  margin-bottom: 16px;
  padding: 24px;
}

.cc-guides-v2__article-head .cc-overline {
  color: var(--cc-muted);
}

.cc-guide-article__title {
  margin: 0.4rem 0 0;
  color: var(--cc-ink);
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.cc-guide-article__teaser {
  margin: 0.7rem 0 0;
  color: var(--cc-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.cc-guides-v2__article .cc-guide-infographic {
  margin-bottom: 16px;
}

.cc-guide-infographic {
  display: grid;
  gap: 16px;
}

.cc-guide-infographic__block {
  padding: 24px;
}

.cc-guide-infographic__head {
  margin-bottom: 18px;
}

.cc-guide-infographic__head h3 {
  margin: 0.3rem 0 0;
  color: var(--cc-ink);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cc-guide-infographic__lead {
  margin: 0.5rem 0 0;
  color: var(--cc-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.cc-guide-pillars {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 12px;
}

.cc-guide-pillar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 100%;
  padding: 14px 12px 16px;
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius-sm);
  background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
}

.cc-guide-pillar__icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: var(--cc-primary-soft);
  color: var(--cc-primary);
}

.cc-guide-pillar__icon svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cc-guide-pillar__title {
  color: var(--cc-ink);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.3;
}

.cc-guide-pillar__subtitle {
  color: var(--cc-muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.cc-guide-flow {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cc-guide-flow__step {
  display: flex;
  gap: 8px;
  min-height: 100%;
  padding: 12px;
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius-sm);
  background: #fff;
}

.cc-guide-flow__num {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--cc-primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.cc-guide-flow__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.cc-guide-flow__body strong {
  color: var(--cc-ink);
  font-size: 0.8rem;
  line-height: 1.3;
}

.cc-guide-flow__body span {
  color: var(--cc-muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.cc-guides-v2__article-body {
  padding: 24px;
}

.ifm-guide-shell .ifm-guide {
  color: var(--cc-ink);
  font-size: 0.92rem;
  line-height: 1.65;
}

.ifm-guide-shell .cc-guide-section-card {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius-sm);
  background: #fafbfc;
}

.ifm-guide-shell .cc-guide-section-card:first-child {
  margin-top: 0;
}

.ifm-guide-shell .cc-guide-section-card h2 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.cc-guide-section-card__icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 0.45rem;
  background: var(--cc-primary-soft);
  color: var(--cc-primary);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ifm-guide-shell .cc-guide-section-card h3 {
  margin: 1rem 0 0.45rem;
  font-size: 0.88rem;
  line-height: 1.35;
}

.ifm-guide-shell .cc-guide-section-card p {
  margin: 0 0 0.75rem;
}

.ifm-guide-shell .cc-guide-section-card ul,
.ifm-guide-shell .cc-guide-section-card ol {
  margin: 0 0 0.85rem;
  padding-left: 1.25rem;
}

.ifm-guide-shell .cc-guide-section-card li + li {
  margin-top: 0.35rem;
}

.ifm-guide-shell .ifm-guide__section--summary {
  border-color: color-mix(in srgb, var(--cc-primary) 28%, var(--cc-line));
  background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.08) 0%, #fff 55%);
}

.ifm-guide-shell .ifm-guide__footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--cc-line);
  color: var(--cc-muted);
  font-size: 0.78rem;
}

@media (max-width: 960px) {
  .guides-page .guides-hero {
    padding: 20px;
  }

  .guides-hero__title {
    font-size: clamp(1.45rem, 6vw, 1.85rem);
  }

  .cc-guides-v2 {
    grid-template-columns: 1fr;
  }

  .cc-guides-v2__nav {
    position: static;
    max-height: none;
  }

  .cc-guides-v2__index-wrap {
    max-height: 20rem;
  }

  .cc-guides-v2.is-reading .cc-guides-v2__nav {
    display: none;
  }

  .cc-guides-v2.is-reading .cc-guides-v2__back {
    display: inline-flex;
  }

  .cc-guide-flow {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 961px) {
  .cc-guides-v2__back {
    display: none !important;
  }
}

/* ── UI/UX catalog (/design) — page-specific; do not reuse on modules ── */
html:has(.ui-guide) {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html:has(.ui-guide) {
    scroll-behavior: auto;
  }
}

.ui-guide-section,
.ui-guide-hero {
  padding: 22px 24px 24px;
  scroll-margin-top: 12px;
}

.ui-guide-kicker {
  margin: 0 0 6px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-maroon);
}

.ui-guide-hero h2,
.ui-guide-section > h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.ui-guide-lede {
  margin: 8px 0 0;
  max-width: 46rem;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.ui-guide-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-nav);
  background: var(--bg);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}

.ui-guide-note code,
.ui-guide-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
}

.ui-guide-code {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--primary);
}

.ui-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.ui-guide-token {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-nav);
  background: var(--card);
  color: var(--text);
  box-shadow: none;
  text-align: left;
  font-weight: 500;
}

.ui-guide-token:hover:not(:disabled) {
  background: var(--row-hover);
  color: var(--text);
  transform: none;
}

.ui-guide-token:active:not(:disabled) {
  transform: none;
}

.ui-guide-swatch {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid color-mix(in srgb, var(--border) 70%, #000 8%);
  border-radius: var(--radius-nav);
}

.ui-guide-token-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ui-guide-token-meta strong {
  font-size: 13px;
  font-weight: 650;
}

.ui-guide-token-meta span {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ui-guide-swatch[data-swatch="bg"] { background: var(--bg); }
.ui-guide-swatch[data-swatch="card"] { background: var(--card); }
.ui-guide-swatch[data-swatch="text"] { background: var(--text); }
.ui-guide-swatch[data-swatch="muted"] { background: var(--muted); }
.ui-guide-swatch[data-swatch="border"] { background: var(--border); }
.ui-guide-swatch[data-swatch="accent"] { background: var(--accent); }
.ui-guide-swatch[data-swatch="danger"] { background: var(--danger); }
.ui-guide-swatch[data-swatch="danger-bg"] { background: var(--danger-bg); }
.ui-guide-swatch[data-swatch="row-hover"] { background: var(--row-hover); }
.ui-guide-swatch[data-swatch="success"] { background: var(--success); }
.ui-guide-swatch[data-swatch="success-soft"] { background: var(--success-soft); }
.ui-guide-swatch[data-swatch="color-warning"] { background: var(--color-warning); }
.ui-guide-swatch[data-swatch="surface-muted"] { background: var(--surface-muted); }
.ui-guide-swatch[data-swatch="brand-gold"] { background: var(--brand-gold); }
.ui-guide-swatch[data-swatch="brand-maroon"] { background: var(--brand-maroon); }
.ui-guide-swatch[data-swatch="login-bg"] { background: var(--login-bg); }
.ui-guide-swatch[data-swatch="login-paper"] { background: var(--login-paper); }
.ui-guide-swatch[data-swatch="primary"] { background: var(--primary); }
.ui-guide-swatch[data-swatch="primary-hover"] { background: var(--primary-hover); }
.ui-guide-swatch[data-swatch="primary-soft"] { background: var(--primary-soft); }

.ui-guide-type {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.ui-guide-type-row {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.ui-guide-type-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.ui-guide-type-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.ui-guide-type-row .topnav-title {
  font-size: 17px;
}

.ui-guide-type-row .login-title {
  text-align: left;
}

.ui-guide-specimens {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.ui-guide-specimen {
  flex: 1 1 12rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-nav);
  background: var(--bg);
}

.ui-guide-specimen > .muted {
  margin: 0;
  font-size: 12px;
}

.ui-guide-radius,
.ui-guide-elev {
  width: 112px;
  height: 56px;
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
}

.ui-guide-radius[data-radius="sm"] { border-radius: var(--radius-sm); }
.ui-guide-radius[data-radius="md"] { border-radius: var(--radius-md); }
.ui-guide-radius[data-radius="lg"] { border-radius: var(--radius-lg); }
.ui-guide-radius[data-radius="pebble"] { border-radius: var(--radius-pebble); }
.ui-guide-radius[data-radius="nav"] { border-radius: var(--radius-nav); }
.ui-guide-radius[data-radius="pill"] { border-radius: var(--radius-pill); }

.ui-guide-elev {
  background: var(--card);
  border-color: var(--border);
}

.ui-guide-elev[data-elev="sm"] { box-shadow: var(--shadow-sm); }
.ui-guide-elev[data-elev="float"] { box-shadow: var(--shadow-float); }
.ui-guide-elev[data-elev="btn"] { box-shadow: var(--btn-shadow); }
.ui-guide-elev[data-elev="8"] { box-shadow: var(--elevation-8); }

.ui-guide-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.ui-guide-row > .field,
.ui-guide-row > .filter-field {
  flex: 1 1 12rem;
  margin-bottom: 0;
}

.ui-guide .table {
  min-width: 36rem;
}

.ui-guide .data-panel .table-wrap {
  max-height: none;
}

.ui-guide-rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.ui-guide-rule {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius-nav);
  border: 1px solid var(--border);
}

.ui-guide-rule dt {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ui-guide-rule dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.ui-guide-rule dd + dd {
  margin-top: 6px;
}

.ui-guide-rule--do {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success-soft) 55%, var(--success) 45%);
}

.ui-guide-rule--do dt {
  color: var(--success);
}

.ui-guide-rule--dont {
  background: var(--danger-bg);
  border-color: #f5c2c0;
}

.ui-guide-rule--dont dt {
  color: var(--danger);
}

.ui-guide-login-frame {
  margin-top: 16px;
  padding: 24px 16px;
  border-radius: var(--radius-pebble);
  background: var(--login-bg);
}

.ui-guide-login-frame .login-card {
  margin: 0 auto;
}

.ui-guide [data-mix="18"] { width: 18%; }
.ui-guide [data-mix="42"] { width: 42%; }
.ui-guide [data-mix="70"] { width: 70%; }

.ui-guide-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 400;
  padding: 8px 14px;
  border-radius: var(--radius-nav);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  box-shadow: var(--shadow-float);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.ui-guide-toast.is-visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 720px) {
  .ui-guide-section,
  .ui-guide-hero {
    padding: 18px 16px 20px;
  }
}
