/* ============================================================
   Operations Console — Executive dark theme
   Dark-first. Inferred palette: deep charcoal + emerald signal.
   ============================================================ */

:root, [data-theme='dark'] {
  /* Surfaces — near-black, subtly layered (Linear/Vercel feel) */
  --color-bg:            #0a0a0b;
  --color-surface:       #101012;
  --color-surface-2:     #16161a;
  --color-surface-3:     #1c1c22;
  --color-surface-hover: #202028;
  --color-border:        #23232b;
  --color-border-strong: #2e2e38;
  --color-divider:       #1a1a20;

  /* Text — warm-neutral off-white */
  --color-text:        #eaeaef;
  --color-text-muted:  #8b8b95;
  --color-text-faint:  #55555e;
  --color-text-inverse:#0a0a0b;

  /* Signal colours — emerald for healthy, amber warn, rose blocked, sky info */
  --color-success:       #34d399;
  --color-success-soft:  rgba(52, 211, 153, 0.12);
  --color-success-line:  rgba(52, 211, 153, 0.28);

  --color-warning:       #fbbf24;
  --color-warning-soft:  rgba(251, 191, 36, 0.12);
  --color-warning-line:  rgba(251, 191, 36, 0.28);

  --color-error:         #f87171;
  --color-error-soft:    rgba(248, 113, 113, 0.12);
  --color-error-line:    rgba(248, 113, 113, 0.28);

  --color-info:          #7dd3fc;
  --color-info-soft:     rgba(125, 211, 252, 0.10);
  --color-info-line:     rgba(125, 211, 252, 0.24);

  --color-primary:       #a5b4fc;   /* indigo-300 for links / accents */

  /* Spacing (4px system) */
  --space-1: 0.25rem;   --space-2: 0.5rem;   --space-3: 0.75rem;
  --space-4: 1rem;      --space-5: 1.25rem;  --space-6: 1.5rem;
  --space-8: 2rem;      --space-10: 2.5rem;  --space-12: 3rem;
  --space-16: 4rem;     --space-20: 5rem;

  /* Type */
  --font-sans: 'Satoshi', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  --text-xs:   clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);   /* 12→13 */
  --text-sm:   clamp(0.8125rem, 0.79rem + 0.15vw, 0.875rem);  /* 13→14 */
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);        /* 15→16 */
  --text-lg:   clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);      /* 17→20 */
  --text-xl:   clamp(1.375rem, 1.2rem + 0.9vw, 1.875rem);     /* 22→30 */
  --text-2xl:  clamp(2rem, 1.6rem + 2vw, 3rem);               /* 32→48 */

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 6px 24px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.3);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-1: 140ms;
  --dur-2: 240ms;
}

/* ================ RESET ================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color-scheme: dark;
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--color-text);
  background:
    radial-gradient(circle at 15% -10%, rgba(52,211,153,0.06), transparent 45%),
    radial-gradient(circle at 90% 0%, rgba(125,211,252,0.05), transparent 40%),
    var(--color-bg);
  font-feature-settings: 'cv11', 'ss01';
}

input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

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

/* ============================================================
   AUTH GATE
   ============================================================ */
/* Global: [hidden] must always win over display rules */
[hidden] { display: none !important; }

/* Safety net: prevent long unbroken strings (URLs, IDs, titles) from busting mobile layouts */
.business-card, .rail-card, .now-block, .item, .route-row, .wf-row { min-width: 0; }
.now-block-title, .next-item-title, .item-title, .wf-name, .business-name, .next-block-title { overflow-wrap: anywhere; word-break: break-word; }

.auth-gate {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: var(--space-6);
  background: var(--color-bg);
  z-index: 100;
}
.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
}
.auth-logo { color: var(--color-success); margin-bottom: var(--space-4); }
.auth-title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}
.auth-sub {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}
.auth-form { display: flex; flex-direction: column; gap: var(--space-4); }
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field input {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.field input:hover { border-color: var(--color-border-strong); }
.field input:focus { border-color: var(--color-primary); outline: none; }
.field-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}
.field-hint code { font-family: var(--font-mono); color: var(--color-text); font-size: 0.9em; }
.btn-primary {
  background: var(--color-success);
  color: var(--color-text-inverse);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  transition: background var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
  margin-top: var(--space-2);
}
.btn-primary:hover { background: #6ee7b7; }
.btn-primary:active { transform: translateY(1px); }
.auth-note {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-align: center;
  margin-top: var(--space-2);
}
.auth-note code { font-family: var(--font-mono); }

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: var(--space-3); }
.topbar-logo { color: var(--color-success); }
.topbar-title { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-name {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}
.topbar-right { display: flex; align-items: center; gap: var(--space-2); }

.refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full, 999px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}
.refresh-indicator.is-error { color: var(--color-error); border-color: var(--color-error-line); background: var(--color-error-soft); }

.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-live { background: var(--color-success); box-shadow: 0 0 8px var(--color-success); animation: pulse 2s infinite ease-in-out; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.8); }
}

.btn-ghost {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  border-radius: var(--radius-md);
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-text); }

/* ============================================================
   ERROR BANNER
   ============================================================ */
.error-banner {
  margin: var(--space-4) var(--space-6) 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-error-soft);
  border: 1px solid var(--color-error-line);
  border-radius: var(--radius-md);
  color: var(--color-error);
  font-size: var(--text-sm);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ============================================================
   HEALTH HERO
   ============================================================ */
.health-hero {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: var(--space-8);
  align-items: center;
}
.health-status { display: flex; align-items: center; gap: var(--space-5); }
.health-pulse {
  width: 48px; height: 48px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  background: var(--color-text-faint);
}
.health-pulse::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  background: currentColor;
  opacity: 0.15;
  animation: halo 2.4s infinite ease-in-out;
}
@keyframes halo {
  0%, 100% { transform: scale(1); opacity: 0.15; }
  50%      { transform: scale(1.15); opacity: 0.3; }
}
.health-pulse.is-healthy { background: var(--color-success); color: var(--color-success); }
.health-pulse.is-degraded { background: var(--color-warning); color: var(--color-warning); }
.health-pulse.is-down     { background: var(--color-error); color: var(--color-error); }

.health-copy { min-width: 0; }
.health-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.health-headline {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: var(--space-1);
}
.health-detail {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.health-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
}
.metric { min-width: 0; }
.metric-value {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-sans);
}
.metric-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* ============================================================
   BUSINESS GRID (per-business columns)
   ============================================================ */
.business-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}
.business-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 220px;
}
.business-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4);
}
.business-eyebrow {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.business-name {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: var(--space-1);
}
.business-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full, 999px);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.business-badge.is-active { background: var(--color-success-soft); border-color: var(--color-success-line); color: var(--color-success); }
.business-badge.is-idle   { background: var(--color-surface-2); border-color: var(--color-border); color: var(--color-text-muted); }
.business-badge.is-blocked{ background: var(--color-error-soft); border-color: var(--color-error-line); color: var(--color-error); }

.business-body { display: flex; flex-direction: column; gap: var(--space-4); }

.now-block {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.now-block-eyebrow {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  display: flex; align-items: center; gap: var(--space-2);
}
.now-block-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
}
.now-block-meta {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  align-items: center;
}
.now-block-meta a { color: var(--color-text-muted); text-decoration: none; }
.now-block-meta a:hover { color: var(--color-text); }
.now-block-idle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding: var(--space-4);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
}

.next-block { display: flex; flex-direction: column; gap: var(--space-2); }
.next-block-title {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.next-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--color-text);
  text-decoration: none;
  transition: background var(--dur-1) var(--ease-out);
}
.next-item:hover { background: var(--color-surface-2); }
.next-item-num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 500;
  min-width: 44px;
}
.next-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   RAIL GRID (side-by-side panels)
   ============================================================ */
.rail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

/* ============================================================
   PANEL (list container)
   ============================================================ */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.panel-full { grid-column: 1 / -1; }
.panel-attention.panel[data-empty="false"] .panel-head {
  border-bottom: 1px solid var(--color-border);
}
.panel-head {
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-divider);
}
.panel-title {
  display: flex; align-items: center; gap: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.panel-dot { width: 8px; height: 8px; border-radius: 50%; }
.panel-dot-success { background: var(--color-success); }
.panel-dot-warning { background: var(--color-warning); }
.panel-dot-error   { background: var(--color-error); }
.panel-dot-primary { background: var(--color-info); }

.panel-count {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full, 999px);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: center;
}

.panel-list { list-style: none; }
.panel-list li {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  font-size: var(--text-sm);
  color: var(--color-text);
}
.panel-list li:last-child { border-bottom: none; }
.panel-list-dense li { padding: var(--space-3) var(--space-5); }
.panel-list a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-1) var(--ease-out);
}
.panel-list a:hover { color: var(--color-info); }

.panel-empty {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  justify-content: center;
  padding: var(--space-6) var(--space-5) !important;
}

.item-num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 500;
  min-width: 44px;
  padding-top: 2px;
}
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.item-title { line-height: 1.4; overflow: hidden; text-overflow: ellipsis; }
.item-meta {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  align-items: center;
}
.item-labels { display: inline-flex; gap: var(--space-1); flex-wrap: wrap; }
.chip {
  display: inline-flex;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  height: 18px;
  align-items: center;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.chip.chip-warning { color: var(--color-warning); background: var(--color-warning-soft); border-color: var(--color-warning-line); }
.chip.chip-error   { color: var(--color-error); background: var(--color-error-soft); border-color: var(--color-error-line); }
.chip.chip-success { color: var(--color-success); background: var(--color-success-soft); border-color: var(--color-success-line); }
.chip.chip-info    { color: var(--color-info); background: var(--color-info-soft); border-color: var(--color-info-line); }

/* Route registry rows */
.route-row {
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
}
.route-name { font-family: var(--font-mono); font-size: var(--text-xs); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-state { font-size: 11px; }

/* Workflow rows */
.wf-row {
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
}
.wf-status {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.wf-status.is-ok { background: var(--color-success); }
.wf-status.is-fail { background: var(--color-error); }
.wf-status.is-run { background: var(--color-warning); animation: pulse 1.4s infinite ease-in-out; }
.wf-status.is-skip { background: var(--color-text-faint); }
.wf-name { flex: 1; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-time { font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* ============================================================
   SKELETONS
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-2) 0%, var(--color-surface-3) 50%, var(--color-surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
}
.skeleton-line { height: 16px; margin-bottom: var(--space-2); }
.skeleton-line-short { width: 60%; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: var(--space-6) var(--space-2);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.footer-sep { opacity: 0.5; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .main { padding: var(--space-4); gap: var(--space-4); }
  .health-hero {
    grid-template-columns: 1fr;
    gap: var(--space-5);
    padding: var(--space-5);
  }
  .health-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .business-grid { grid-template-columns: 1fr; }
  .rail-grid { grid-template-columns: 1fr; }
  .business-card { padding: var(--space-5); min-height: 0; }
  .topbar { padding: var(--space-3) var(--space-4); }
  .refresh-indicator { padding: var(--space-1) var(--space-3); }
}

@media (max-width: 480px) {
  .health-status { gap: var(--space-4); }
  .health-pulse { width: 40px; height: 40px; }
  .health-headline { font-size: var(--text-lg); }
  .metric-value { font-size: var(--text-lg); }
  .topbar-name { font-size: var(--text-sm); }
  .topbar-sub { display: none; }
  .auth-card { padding: var(--space-6); }
  /* Route rows wrap: name on top line, chips underneath.
     Prevents mid-word breaks that turned identifiers into vertical stripes. */
  .route-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-2);
  }
  .route-name {
    flex: 1 1 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    font-size: 11px;
    line-height: 1.35;
  }
}

/* ============================================================
   V2: ATTENTION BANNER (top-priority, only visible when populated)
   ============================================================ */
.attention-banner {
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  background:
    linear-gradient(180deg, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0.02) 60%, transparent),
    var(--color-surface);
  border: 1px solid var(--color-warning-line);
  box-shadow: 0 0 0 1px rgba(251,191,36,0.04) inset, var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.attention-banner.is-hot {
  background:
    linear-gradient(180deg, rgba(248, 113, 113, 0.10), rgba(248, 113, 113, 0.02) 60%, transparent),
    var(--color-surface);
  border-color: var(--color-error-line);
}
.attention-banner::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--color-warning);
}
.attention-banner.is-hot::before { background: var(--color-error); }
.attention-body { display: flex; flex-direction: column; gap: var(--space-3); }
.attention-headline {
  display: flex; align-items: center; gap: var(--space-3);
  flex-wrap: wrap;
}
.attention-pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-warning);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.18);
  animation: attentionPulse 1.8s infinite ease-in-out;
  flex-shrink: 0;
}
.attention-banner.is-hot .attention-pulse {
  background: var(--color-error);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.20);
}
@keyframes attentionPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.15); opacity: 0.7; }
}
.attention-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
.attention-count {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px var(--space-2);
  border-radius: 999px;
  background: var(--color-warning-soft);
  color: var(--color-warning);
  border: 1px solid var(--color-warning-line);
  font-variant-numeric: tabular-nums;
}
.attention-banner.is-hot .attention-count {
  background: var(--color-error-soft);
  color: var(--color-error);
  border-color: var(--color-error-line);
}
.attention-list {
  list-style: none;
  display: flex; flex-direction: column;
  gap: var(--space-2);
}
.attention-item {
  border-radius: var(--radius-md);
  transition: background var(--dur-1) var(--ease-out);
}
.attention-item:hover { background: rgba(255,255,255,0.02); }
.attention-link {
  display: flex; flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}
.attention-link:hover { border-color: var(--color-border); }
.attention-item-primary { display: flex; gap: var(--space-3); align-items: baseline; min-width: 0; }
.attention-num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.attention-item-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.attention-item-meta {
  display: flex; gap: var(--space-2); align-items: center;
  flex-wrap: wrap;
  padding-left: calc(var(--text-xs) * 3.5);
}
.attention-chip {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: 999px;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.attention-chip-reason {
  background: var(--color-warning-soft);
  color: var(--color-warning);
  border-color: var(--color-warning-line);
  text-transform: none;
  letter-spacing: 0;
}
.attention-age {
  font-size: 11px;
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
}
.attention-more {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-3);
  list-style: none;
}

/* ============================================================
   V2: BUSINESS IMPACT ROW (inside each business card)
   ============================================================ */
.business-impact {
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
  padding: var(--space-4) 0;
  display: flex; flex-direction: column; gap: var(--space-3);
}
.impact-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}
.impact-cell { min-width: 0; }
.impact-value {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  line-height: 1.1;
}
.impact-label {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.impact-categories {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  min-height: 22px;
}
.impact-cat {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px var(--space-2);
  border-radius: 999px;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  text-transform: none;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.impact-cat-revenue    { color: var(--color-success); background: var(--color-success-soft); border-color: var(--color-success-line); }
.impact-cat-seo        { color: var(--color-info);    background: var(--color-info-soft);    border-color: var(--color-info-line); }
.impact-cat-catalogue  { color: #c4b5fd;              background: rgba(196,181,253,0.08);    border-color: rgba(196,181,253,0.24); }
.impact-cat-research   { color: #fbcfe8;              background: rgba(251,207,232,0.06);    border-color: rgba(251,207,232,0.22); }
.impact-cat-automation { color: var(--color-warning); background: var(--color-warning-soft); border-color: var(--color-warning-line); }

/* ============================================================
   V2: IMPACT HERO (portfolio-wide, 7-day)
   ============================================================ */
.impact-hero {
  background:
    linear-gradient(180deg, rgba(52, 211, 153, 0.05), transparent 60%),
    var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-5);
}
.impact-hero-eyebrow {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.impact-hero-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-6);
}
.impact-hero-cell { min-width: 0; }
.impact-hero-value {
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--color-text);
}
.impact-hero-label {
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-top: var(--space-2);
  font-weight: 600;
}
.impact-hero-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ============================================================
   V2: HEALTH STRIP (compact, replaces .health-hero visually)
   Same DOM class .health-hero is now labelled .health-strip in HTML;
   we override .health-hero styling too, but since the section now uses
   .health-strip, define it here.
   ============================================================ */
.health-strip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr);
  gap: var(--space-6);
  align-items: center;
}
.health-strip .health-pulse {
  width: 32px; height: 32px;
}
.health-strip .health-headline {
  font-size: var(--text-base);
  font-weight: 700;
}
.health-strip .health-detail {
  font-size: 12px;
  color: var(--color-text-muted);
}
.health-strip .metric-value {
  font-size: var(--text-lg);
}
.health-strip .metric-label {
  font-size: 10.5px;
}
.health-strip .health-metrics {
  gap: var(--space-3);
}

/* ============================================================
   V2: INTERNALS (collapsible, secondary priority)
   ============================================================ */
.internals {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: 0;
}
.internals[open] {
  padding-bottom: var(--space-5);
}
.internals-summary {
  cursor: pointer;
  list-style: none;
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex; align-items: center; gap: var(--space-2);
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.internals-summary:hover { color: var(--color-text); }
.internals[open] .internals-summary {
  border-bottom-color: var(--color-divider);
  margin-bottom: var(--space-4);
}
.internals-summary::-webkit-details-marker { display: none; }
.internals-summary::before {
  content: '›';
  font-size: 20px;
  line-height: 1;
  transition: transform var(--dur-2) var(--ease-out);
  color: var(--color-text-faint);
}
.internals[open] .internals-summary::before {
  transform: rotate(90deg);
}
.internals > * + * { margin-top: var(--space-4); }
.internals .rail-grid,
.internals .panel-full {
  margin-left: var(--space-5);
  margin-right: var(--space-5);
}

/* ============================================================
   V2: AUTH MODE BANNER (proxy fallback warning)
   ============================================================ */
.auth-mode-banner {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  margin-bottom: var(--space-3);
}
.auth-mode-banner.is-warning {
  background: var(--color-warning-soft);
  border-color: var(--color-warning-line);
  color: var(--color-warning);
}
.field-hint code,
.auth-mode-banner code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  color: var(--color-text);
}

/* ============================================================
   V2: RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 900px) {
  .impact-hero-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
  }
  .health-strip {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  .health-strip .health-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .internals .rail-grid,
  .internals .panel-full {
    margin-left: var(--space-4);
    margin-right: var(--space-4);
  }
}
@media (max-width: 640px) {
  .impact-hero { padding: var(--space-5); }
  .impact-hero-grid { gap: var(--space-4); }
  .impact-hero-value { font-size: 1.75rem; }
  .impact-row { gap: var(--space-3); }
  .impact-value { font-size: var(--text-lg); }
  .attention-banner { padding: var(--space-4); }
  .attention-item-meta { padding-left: 0; }
  .attention-item-primary { flex-wrap: wrap; }
  .health-strip .health-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .impact-hero-grid {
    grid-template-columns: 1fr 1fr;
  }
  .impact-hero-value { font-size: 1.5rem; }
  .internals-summary { padding: var(--space-3) var(--space-4); font-size: var(--text-xs); }
  .internals .rail-grid,
  .internals .panel-full {
    margin-left: var(--space-3);
    margin-right: var(--space-3);
  }
}

/* ============================================================
   Multi-repo additions
   ============================================================ */

/* Per-business repo label in card header */
.business-repo {
  margin-top: 2px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
}

/* Per-business degraded banner */
.business-degraded {
  margin: var(--space-3) var(--space-4) 0;
  padding: var(--space-2) var(--space-3);
  background: var(--color-error-soft);
  color: var(--color-error);
  border: 1px solid var(--color-error-line);
  border-radius: var(--radius-sm, 4px);
  font-size: var(--text-xs);
  line-height: 1.4;
}

/* Business badge — data-unavailable state */
.business-badge.is-error {
  background: var(--color-error-soft);
  color: var(--color-error);
  border-color: var(--color-error-line);
}

/* Business-tinted chips (attention banner + panels).
   Neutral by default so we don't over-color the UI; the label is what matters. */
.attention-chip-kartstore,
.attention-chip-infinitel,
.chip-biz-kartstore,
.chip-biz-infinitel {
  font-weight: 500;
}
.attention-chip-kartstore,
.chip-biz-kartstore {
  border-color: var(--color-border);
  color: var(--color-text);
}
.attention-chip-infinitel,
.chip-biz-infinitel {
  border-color: var(--color-primary-line, var(--color-border));
  color: var(--color-primary, var(--color-text));
}

/* Route panel — inline note when a business intentionally has no registry */
.panel-list .panel-note {
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-style: italic;
  border-top: 1px dashed var(--color-border);
  margin-top: var(--space-2);
  list-style: none;
}

@media (max-width: 640px) {
  .business-repo { font-size: 11px; }
  .business-degraded { margin: var(--space-3) var(--space-3) 0; }
}
