:root {
  /* ── LINEA Brand Tokens ─────────────────────────────────────── */
  --blue:        #5dafe2;
  --blue-mid:    #3a8ec7;
  --blue-deep:   #1a5a8a;
  --navy:        #0d2b45;
  --navy-light:  #163652;
  --text:        #0d2237;
  --text-mid:    #4a6478;
  --text-soft:   #8daabf;
  --bg:          #ffffff;
  --bg-off:      #f5f8fb;
  --bg-faint:    #eaf3fa;
  --border:      #dae4ed;
  --serif:       'DM Serif Display', Georgia, serif;
  --sans:        'Inter', system-ui, -apple-system, sans-serif;
  --ease:        cubic-bezier(0.22, 1, 0.36, 1);
  --nav-height:  62px;
  --radius-card: 10px;
  --radius-btn:  5px;

  /* ── Legacy aliases (keep existing component CSS working) ────── */
  --linea-primary: var(--blue-deep);
  --linea-accent:  var(--blue);
  --linea-deep:    var(--navy);
  --ink:           var(--text);
  --ink-soft:      var(--text-mid);
  --surface:       var(--bg-off);
  --panel:         var(--bg);
  --ok:            #1f9d65;
  --warn:          #c47f18;
  --bad:           #b43d4f;
  --shadow:        0 4px 24px rgba(13, 43, 69, 0.10);
}

body[data-font-scale="small"] {
  font-size: 14px;
}

body[data-font-scale="large"] {
  font-size: 17px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background: #0a1e30;
  position: relative;
  /* v1.6.33: hide OS cursor so the custom diamond+dot is the only cursor.
     Touch devices restore the normal cursor via @media (hover: none) below
     where .cursor-d and .cursor-dot are also hidden. */
  cursor: none;
}
@media (hover: none) {
  body { cursor: auto; }
}

body[data-theme="dark"] {
  --ink: #e7f1ff;
  --ink-soft: #a8bed6;
  --surface: #0a1522;
  --panel: #111f30;
  --border: #2a4259;
  --linea-deep: #9ed4ff;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.45);
  background: #081522;
}

@media (prefers-color-scheme: dark) {
  body[data-theme="system"] {
    --ink: #e7f1ff;
    --ink-soft: #a8bed6;
    --surface: #0a1522;
    --panel: #111f30;
    --border: #2a4259;
    --linea-deep: #9ed4ff;
    --shadow: 0 16px 38px rgba(0, 0, 0, 0.45);
    background: #081522;
  }
}

body[data-theme="dark"] .status-panel,
body[data-theme="dark"] .panel,
body[data-theme="dark"] .auth-card,
body[data-theme="dark"] .card,
body[data-theme="dark"] .status-grid > div,
body[data-theme="dark"] .mode-panel,
body[data-theme="dark"] .subset-advanced,
body[data-theme="dark"] .job-box,
body[data-theme="dark"] .table-wrap,
body[data-theme="dark"] .logs,
body[data-theme="dark"] .artifacts,
body[data-theme="dark"] .artifact,
body[data-theme="dark"] .status-box {
  background: rgba(15, 30, 46, 0.92) !important;
  border-color: var(--border) !important;
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  body[data-theme="system"] .status-panel,
  body[data-theme="system"] .panel,
  body[data-theme="system"] .auth-card,
  body[data-theme="system"] .card,
  body[data-theme="system"] .status-grid > div,
  body[data-theme="system"] .mode-panel,
  body[data-theme="system"] .subset-advanced,
  body[data-theme="system"] .job-box,
  body[data-theme="system"] .table-wrap,
  body[data-theme="system"] .logs,
  body[data-theme="system"] .artifacts,
  body[data-theme="system"] .artifact,
  body[data-theme="system"] .status-box {
    background: rgba(15, 30, 46, 0.92) !important;
    border-color: var(--border) !important;
    color: var(--ink);
  }
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .btn {
  border-color: #3b5873 !important;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
  background: #0c1a2a !important;
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  body[data-theme="system"] input,
  body[data-theme="system"] select,
  body[data-theme="system"] textarea,
  body[data-theme="system"] .btn {
    border-color: #3b5873 !important;
  }

  body[data-theme="system"] input,
  body[data-theme="system"] select,
  body[data-theme="system"] textarea {
    background: #0c1a2a !important;
    color: var(--ink);
  }
}

/* Dark mode refinement: improve contrast and keep visual hierarchy sponsor-grade. */
body[data-theme="dark"] a {
  color: #8ecbff;
}

body[data-theme="dark"] .muted,
body[data-theme="dark"] .hint,
body[data-theme="dark"] .kicker,
body[data-theme="dark"] label > span,
body[data-theme="dark"] .input-field > span,
body[data-theme="dark"] .compact-field-inline > span {
  color: #a9c2db;
}

body[data-theme="dark"] .auth-chip {
  border-color: #3a5f7e;
  background: linear-gradient(180deg, rgba(26, 52, 74, 0.92), rgba(15, 34, 52, 0.92));
  color: #c4def6;
}

body[data-theme="dark"] .auth-chip strong {
  color: #f1f8ff;
}

body[data-theme="dark"] .status-chip {
  background: rgba(18, 38, 58, 0.94);
  border-color: #3b5d7c;
  color: #d7eafc;
}

body[data-theme="dark"] .btn {
  background: linear-gradient(180deg, #1a334c, #162b42);
  color: #d9ecff;
  border-color: #3f617f !important;
}

body[data-theme="dark"] .btn:hover {
  background: linear-gradient(180deg, #1f3b57, #1a324b);
  border-color: #5c86aa !important;
}

body[data-theme="dark"] .btn.primary {
  background: linear-gradient(160deg, #3f85bf, #2f6ea5);
  border-color: #69aee0 !important;
  color: #f5fbff;
}

body[data-theme="dark"] .tab {
  background: linear-gradient(180deg, #1c3650, #172d44);
  border-color: #436786;
  color: #d2e8fc;
}

body[data-theme="dark"] .tab.active {
  background: linear-gradient(160deg, #4a92ca, #3777ad);
  border-color: #78b8e8;
  color: #fff;
}

body[data-theme="dark"] .pagination-bar {
  border-color: #34526e;
  background: linear-gradient(180deg, #13263a, #0f1f31);
}

body[data-theme="dark"] .loading-indicator,
body[data-theme="dark"] .profile-loading-card {
  border-color: #395b79;
  background: rgba(16, 35, 53, 0.95);
  color: #d1e8fb;
}

body[data-theme="dark"] .subset-advanced {
  border-color: #375875;
  background: linear-gradient(180deg, #162b40, #122336);
}

body[data-theme="dark"] .subset-advanced > summary {
  color: #c7e2f8;
}

body[data-theme="dark"] #results-table th,
body[data-theme="dark"] #trial-table th,
body[data-theme="dark"] .simple-table th,
body[data-theme="dark"] .admin-table th {
  background: linear-gradient(180deg, #1f3b57, #183149);
  color: #d8ecff;
  border-bottom-color: #3e617f;
}

body[data-theme="dark"] #results-table td,
body[data-theme="dark"] #trial-table td,
body[data-theme="dark"] .simple-table td,
body[data-theme="dark"] .admin-table td {
  border-bottom-color: #2d4963;
  color: #d6e9fb;
}

body[data-theme="dark"] #results-table tr:nth-child(even) td,
body[data-theme="dark"] #trial-table tr:nth-child(even) td,
body[data-theme="dark"] .admin-table tr:nth-child(even) td {
  background: rgba(17, 34, 52, 0.92);
}

body[data-theme="dark"] #results-table tr.results-row-link:hover td,
body[data-theme="dark"] #results-table tr.results-row-link:focus-visible td,
body[data-theme="dark"] .admin-table tr.admin-user-row:hover td,
body[data-theme="dark"] .admin-table tr.admin-user-row:focus-visible td {
  background: rgba(33, 62, 88, 0.9);
}

body[data-theme="dark"] .investigator-link,
body[data-theme="dark"] .artifact-link {
  color: #8fcfff;
}

body[data-theme="dark"] .trends-frame-wrap,
body[data-theme="dark"] .world-map-canvas,
body[data-theme="dark"] .trends-panel #trends-loading-indicator {
  border-color: #365674;
  background: linear-gradient(180deg, #122638, #0f1f30);
}

body[data-theme="dark"] .trends-frame-head {
  border-bottom-color: #355575;
  background: linear-gradient(180deg, #1a314a, #14273b);
}

body[data-theme="dark"] .viz-card {
  border-color: #375876;
  background: linear-gradient(180deg, rgba(19, 36, 54, 0.96), rgba(13, 27, 43, 0.96));
}

body[data-theme="dark"] .bar-label,
body[data-theme="dark"] .bar-value {
  color: #c9dff3;
}

body[data-theme="dark"] .bar-track {
  border-color: #3d607f;
  background: #163049;
}

@media (prefers-color-scheme: dark) {
  body[data-theme="system"] .viz-card {
    border-color: #375876;
    background: linear-gradient(180deg, rgba(19, 36, 54, 0.96), rgba(13, 27, 43, 0.96));
  }

  body[data-theme="system"] .bar-label,
  body[data-theme="system"] .bar-value {
    color: #c9dff3;
  }

  body[data-theme="system"] .bar-track {
    border-color: #3d607f;
    background: #163049;
  }
}

body[data-density="compact"] .panel,
body[data-density="compact"] .status-panel {
  padding: 0.72rem;
}

body[data-density="compact"] .workflow-form {
  gap: 0.55rem;
}

body[data-density="compact"] .grid-4,
body[data-density="compact"] .grid-3 {
  gap: 0.52rem;
}

body[data-density="compact"] input[type="text"],
body[data-density="compact"] input[type="number"],
body[data-density="compact"] input[type="email"],
body[data-density="compact"] input[type="password"],
body[data-density="compact"] select,
body[data-density="compact"] input[type="file"] {
  padding: 0.34rem 0.48rem;
  font-size: 0.8rem;
}

body[data-density="compact"] .btn {
  padding-top: 0.34rem;
  padding-bottom: 0.34rem;
}

body[data-reduce-motion="1"] *,
body[data-reduce-motion="1"] *::before,
body[data-reduce-motion="1"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

body[data-high-contrast="1"] {
  --border: #3a5f85;
}

body[data-high-contrast="1"] .panel,
body[data-high-contrast="1"] .status-panel,
body[data-high-contrast="1"] .card,
body[data-high-contrast="1"] .btn,
body[data-high-contrast="1"] input,
body[data-high-contrast="1"] select {
  border-width: 2px !important;
}

.bg-layer {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.24;
  z-index: -2;
}

.bg-one {
  width: 360px;
  height: 360px;
  right: -120px;
  top: -90px;
  background: var(--linea-accent);
}

.bg-two {
  width: 300px;
  height: 300px;
  left: -90px;
  bottom: -110px;
  background: var(--linea-primary);
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(105, 177, 226, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(105, 177, 226, 0.07) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(circle at 50% 50%, #000 40%, transparent 92%);
  z-index: -1;
}

/* ── Nav wrapper: full-width fixed dark bar ───────────────────── */
.app-header-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: rgba(13,43,69,0.97);
  border-bottom: 1px solid rgba(93,175,226,0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  height: var(--nav-height);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
  width: min(1260px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 0;
}

.shell {
  width: min(1260px, calc(100vw - 2rem));
  margin: 0 auto;
  padding-top: calc(var(--nav-height) + 1.5rem);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 152px;
  max-width: 38vw;
  object-fit: contain;
  filter: brightness(2.2) saturate(0.95) drop-shadow(0 0 8px rgba(93,175,226,0.22));
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--blue);
  box-shadow: 0 4px 12px rgba(93,175,226,0.32);
}

.brand h1 {
  margin: 0;
  font-size: 1.0rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255,255,255,0.95);
}

.brand p {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.42);
  letter-spacing: 0.02em;
}

.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

/* Global language support and UI spacing safeguards for translated labels. */
body[data-lang="zh"],
body[data-lang="ja"],
body[data-lang="ko"] {
  font-family: "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", "Noto Sans Bengali", "Noto Sans Thai", "Inter", "Segoe UI", sans-serif;
}

body[data-lang="ar"] {
  direction: rtl;
}

body[data-lang="ar"] .app-header,
body[data-lang="ar"] .status-top,
body[data-lang="ar"] .panel-head,
body[data-lang="ar"] .card-head,
body[data-lang="ar"] .modal-head,
body[data-lang="ar"] .status-row {
  direction: rtl;
}

body[data-lang]:not([data-lang="en"]) .tab {
  padding: 0.45rem 0.72rem;
  font-size: 0.77rem;
}

body[data-lang]:not([data-lang="en"]) .btn.tiny,
body[data-lang]:not([data-lang="en"]) .app-header .actions .btn.tiny,
body[data-lang]:not([data-lang="en"]) .run-page .hero-actions .btn.tiny {
  padding: 0 0.5rem;
  font-size: 0.68rem;
  min-height: 31px;
}

body[data-lang]:not([data-lang="en"]) .mode-btn {
  font-size: 0.77rem;
  padding-inline: 0.54rem;
}

body[data-lang]:not([data-lang="en"]) .kicker {
  letter-spacing: 0.04em;
}

.app-header .actions .btn.tiny {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  padding: 0 0.56rem;
  font-size: 0.72rem;
  line-height: 1;
  white-space: nowrap;
}

.app-header .actions .auth-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  padding: 0 0.62rem;
  line-height: 1;
  white-space: nowrap;
}

.app-header .actions .auth-chip strong {
  margin: 0 0.18rem;
}

.app-header .actions a[href="/my-account"],
.app-header .actions a[href="/settings"],
.app-header .actions a[href="/admin/accounts"],
.app-header .actions a[href="/"] {
  min-height: 30px;
  padding: 0 0.56rem;
  font-size: 0.72rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.app-header .header-actions {
  gap: 0.4rem;
}

.auth-chip {
  border: 1px solid rgba(93,175,226,0.25);
  background: rgba(255,255,255,0.07);
  border-radius: 999px;
  padding: 0.34rem 0.72rem;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.70);
  font-weight: 500;
}

.auth-chip strong {
  color: rgba(255,255,255,0.90);
  font-weight: 700;
}

.status-chip {
  border: 1px solid var(--border);
  background: #ffffffcc;
  border-radius: 999px;
  padding: 0.45rem 0.78rem;
  font-weight: 800;
  font-size: 0.8rem;
}

.status-chip.ready {
  color: var(--ok);
  border-color: rgba(31, 157, 101, 0.35);
}

.status-chip.building {
  color: var(--warn);
  border-color: rgba(196, 127, 24, 0.35);
  animation: rsi-pulse 2s ease-in-out infinite;
}

.status-chip.failed {
  color: var(--bad);
  border-color: rgba(180, 61, 79, 0.4);
}

.shell {
  display: grid;
  gap: 1.5rem;
  padding-bottom: 1.6rem;
}

.hero {
  background: var(--navy-light);
  color: rgba(255,255,255,0.90);
  border: 1px solid rgba(93,175,226,0.15);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 0 rgba(93,175,226,0.08);
  padding: 1.15rem 1.4rem;
  display: block;
}

.hero-copy {
  display: grid;
  gap: 0.34rem;
}

.hero h2 {
  margin: 0;
  font-size: 1.22rem;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.hero p {
  margin: 0;
  color: rgba(233, 247, 255, 0.92);
  line-height: 1.42;
  max-width: 960px;
}

.hero .muted {
  color: rgba(224, 242, 253, 0.86);
}

.demo-mode-panel {
  padding: 0.74rem 0.9rem;
}

.demo-mode-head {
  display: flex;
  align-items: center;
  gap: 0.58rem;
  flex-wrap: wrap;
}

.demo-mode-panel-warn .status-chip {
  color: var(--bad);
  border-color: rgba(180, 61, 79, 0.35);
}

.status-panel,
.panel {
  background: #ffffff;
  border: 1px solid rgba(218,228,237,0.8);
  border-radius: var(--radius-card);
  padding: 0.9rem;
  box-shadow: 0 4px 32px rgba(0,0,0,0.28), 0 1px 0 rgba(255,255,255,0.06);
  overflow: hidden;
  transition: box-shadow 0.2s var(--ease);
}

.status-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.8rem;
}

.kicker {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--blue);
  font-weight: 700;
}

.status-stage {
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

.status-right {
  text-align: right;
  color: var(--ink-soft);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.52rem 0.72rem;
}

.status-right > div {
  white-space: nowrap;
}

.progress-wrap {
  margin-top: 0.62rem;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f0f7ff;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
  transition: width 0.28s var(--ease);
}

.tabs {
  display: flex;
  gap: 0.52rem;
}

.tab {
  border: 1px solid rgba(93,175,226,0.20);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.55);
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
              color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.tab:hover:not(.active) {
  background: rgba(93,175,226,0.10);
  border-color: rgba(93,175,226,0.45);
  color: rgba(255,255,255,0.85);
}

.tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(93,175,226,0.30);
}

.tab-panel {
  display: none;
  gap: 1.5rem;
}

.tab-panel.active {
  display: grid;
  animation: rsi-fade-up 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.workflow-form {
  display: grid;
  gap: 0.72rem;
  margin-top: 0.5rem;
}

.settings-form {
  display: block;
}

.settings-form > .settings-group {
  margin: 0 0 1.5rem;
}

.settings-group {
  border: 1px solid #d2e6f6;
  border-radius: 14px;
  background: var(--bg-faint);
  padding: 0.84rem 0.92rem 0.94rem;
  box-shadow: 0 10px 24px rgba(121, 167, 204, 0.1);
}

.settings-group h4 {
  margin: 0;
  font-size: 0.9rem;
  color: #1d4a68;
}

.settings-group > .muted {
  margin: 0.3rem 0 0.62rem;
  font-size: 0.79rem;
}

.settings-group .filter-row {
  margin-top: 0;
}

.settings-inline-note {
  display: block;
  margin-top: 0.3rem;
}

.settings-stack {
  display: grid;
  gap: 0.78rem;
  margin-top: 0.58rem;
}

.refresh-status-cards {
  margin-top: 0;
}

.refresh-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.72rem;
  align-items: start;
}

.refresh-actions .workflow-form {
  margin-top: 0;
}

.refresh-actions .filter-actions {
  justify-content: flex-start;
}

.settings-form > .actions.filter-actions {
  margin-top: 1.35rem;
  padding-top: 0.08rem;
}

.settings-form + .subset-advanced {
  margin-top: 1.3rem;
}

.subset-advanced + .workflow-form {
  margin-top: 1.2rem;
}

body[data-theme="dark"] .settings-group {
  border-color: #365775;
  background: linear-gradient(180deg, rgba(20, 38, 56, 0.96), rgba(14, 29, 45, 0.96));
}

body[data-theme="dark"] .settings-group h4 {
  color: #e0f0ff;
}

body[data-theme="dark"] .settings-group > .muted {
  color: #adc6de;
}

@media (prefers-color-scheme: dark) {
  body[data-theme="system"] .settings-group {
    border-color: #365775;
    background: linear-gradient(180deg, rgba(20, 38, 56, 0.96), rgba(14, 29, 45, 0.96));
  }

  body[data-theme="system"] .settings-group h4 {
    color: #e0f0ff;
  }

  body[data-theme="system"] .settings-group > .muted {
    color: #adc6de;
  }
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.mode-btn {
  border: 1px solid #b8d4e9;
  background: #f4f9ff;
  color: #234a68;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.mode-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.mode-panel {
  display: none;
  gap: 0.62rem;
  padding: 0.55rem;
  border: 1px solid #d5e7f6;
  border-radius: 10px;
  background: #fafdff;
}

.mode-panel.active {
  display: grid;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-size: 0.84rem;
}

.check-row input {
  width: auto;
}

.selected-pills {
  margin-top: 0.22rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.26rem;
  min-height: 1.25rem;
}

.selected-pills .pill-item {
  border: 1px solid #b9d9ee;
  background: #edf7ff;
  color: #1f4a68;
  border-radius: 999px;
  padding: 0.14rem 0.3rem 0.14rem 0.48rem;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.selected-pills .pill-label {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-pills .pill-remove {
  border: 1px solid #91bddc;
  background: #f9fcff;
  color: #255172;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 800;
  width: 16px;
  height: 16px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.selected-pills .pill-remove:hover {
  background: #e9f4ff;
}

.selected-pills .pill-empty {
  border: 1px dashed #c4ddee;
  background: #f8fcff;
  color: #63809a;
  border-radius: 999px;
  padding: 0.14rem 0.48rem;
  font-size: 0.69rem;
  line-height: 1.2;
}

.job-box {
  margin-top: 0.75rem;
  border: 1px solid #cbe1f1;
  border-radius: 12px;
  background: var(--bg-faint);
  padding: 0.72rem;
  display: grid;
  gap: 0.52rem;
}

.job-head {
  font-size: 0.92rem;
  font-weight: 800;
  color: #184867;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.52rem;
}

.status-grid > div {
  border: 1px solid #d3e6f4;
  border-radius: 9px;
  background: #fff;
  padding: 0.42rem 0.48rem;
  display: grid;
  gap: 0.16rem;
}

.status-grid .k {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #3a6180;
  font-weight: 700;
}

.job-logs {
  margin-top: 0.12rem;
  border: 1px solid #d5e8f6;
  border-radius: 9px;
  background: #fbfdff;
  font-family: "Inter", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: #1e4664;
  min-height: 120px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.52rem;
}

.job-artifacts {
  border: 1px dashed #c1daec;
  border-radius: 9px;
  background: #fff;
  min-height: 44px;
  padding: 0.45rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #42647f;
}

.artifact-link {
  text-decoration: none;
  color: var(--blue-deep);
  font-weight: 700;
}

.artifact-link:hover {
  text-decoration: underline;
}

.artifact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.artifact-row .meta {
  color: #5a7892;
  font-size: 0.74rem;
}

h3 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--linea-deep);
}

h4 {
  margin: 0 0 0.5rem;
  color: var(--linea-deep);
}

.panel > h3 + .cards,
.panel > h3 + .detail-grid,
.panel > h3 + .split,
.panel > h3 + .workflow-form,
.panel > h3 + .table-wrap,
.panel > h3 + .subset-advanced,
.panel > h3 + .actions {
  margin-top: 0.62rem;
}

.panel > h3 + .muted {
  margin: 0.28rem 0 0;
}

.panel > .muted + .workflow-form,
.panel > .muted + .table-wrap,
.panel > .muted + .subset-advanced,
.panel > .workflow-form + .subset-advanced {
  margin-top: 0.56rem;
}

.panel > h3 + .panel-head {
  margin-top: 0.44rem;
}

.muted {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.mono {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}

.grid-4,
.grid-3 {
  display: grid;
  gap: 0.7rem;
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: 1.2fr 1fr 0.8fr;
}

.dedupe-grid {
  grid-template-columns: 1.2fr 1fr 1fr;
  align-items: end;
  padding: 0.58rem;
  border: 1px solid #d8e8f6;
  border-radius: 12px;
  background: var(--bg-faint);
}

.dedupe-grid > label,
.dedupe-grid > .input-field {
  border: 1px solid #d5e6f5;
  border-radius: 10px;
  background: #fff;
  padding: 0.42rem 0.48rem 0.5rem;
  min-height: 100%;
}

label {
  display: grid;
  gap: 0.28rem;
}

label > span {
  color: #2a5376;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.input-field {
  display: grid;
  gap: 0.28rem;
}

.input-field > span {
  color: #2a5376;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

input,
select,
button {
  font: inherit;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
input[type="file"] {
  width: 100%;
  border: 1px solid #bdd7ea;
  border-radius: 10px;
  background: #fff;
  padding: 0.44rem 0.52rem;
  font-size: 0.86rem;
  color: var(--ink);
}

input[type="file"].file-input-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
}

.file-picker-btn {
  flex: 0 0 auto;
}

.file-picker-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.76rem;
}

input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
  font-size: 0.86rem;
}

select[multiple] {
  min-height: 130px;
}

.actions,
.inline-actions {
  display: flex;
  gap: 0.48rem;
  align-items: center;
  flex-wrap: wrap;
}

.dedupe-actions-field {
  min-height: 100%;
  align-content: start;
}

.dedupe-actions {
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  margin-top: 0.04rem;
}

.dedupe-actions .btn {
  height: 36px;
}

.dedupe-help {
  margin: 0.08rem 0 0;
}

.cards.dedupe-summary-cards {
  display: none;
  margin-top: 0.34rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cards.dedupe-summary-cards.active {
  display: grid;
}

.dedupe-summary-cards .card {
  background: linear-gradient(180deg, #fbfdff, #f4f9ff);
}

.dedupe-breakdown {
  display: none;
  margin-top: 0.32rem;
  border: 1px solid #cfe3f3;
  border-radius: 12px;
  background: linear-gradient(180deg, #fcfeff, #f6fbff);
  padding: 0.55rem 0.62rem;
  gap: 0.34rem;
}

.dedupe-breakdown.active {
  display: grid;
}

.dedupe-breakdown h4 {
  margin: 0;
  font-size: 0.82rem;
  color: #1f4665;
}

.dedupe-breakdown .muted {
  margin: 0;
  font-size: 0.75rem;
}

.dedupe-breakdown .mono {
  font-size: 0.75rem;
}

.actions .compact-field {
  display: grid;
  gap: 0.2rem;
  width: auto;
  min-width: 110px;
}

.actions .compact-field > span {
  font-size: 0.68rem;
}

.actions .compact-field select {
  min-width: 100px;
}

.filters-panel {
  display: block;
  padding: 1rem 1rem 0.95rem;
}

.filters-panel > * + * {
  margin-top: 0.62rem;
}

.filters-panel > .muted {
  margin-top: 0.24rem;
}

.preset-toolbar {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.75fr auto;
  gap: 0.52rem;
  padding: 0.56rem;
  border: 1px solid #d6e8f6;
  border-radius: 12px;
  background: var(--bg-faint);
}

.preset-toolbar .preset-field {
  border: 1px solid #d5e6f5;
  border-radius: 10px;
  background: #fff;
  padding: 0.38rem 0.46rem 0.5rem;
  min-height: 100%;
}

.preset-toolbar .preset-actions {
  align-self: end;
  justify-content: flex-end;
  gap: 0.44rem;
  flex-wrap: nowrap;
}

#preset-msg {
  min-height: 1.1rem;
  margin: 0.18rem 0 0;
}

.muted.success {
  color: var(--ok);
}

.muted.warn {
  color: var(--warn);
}

.muted.error {
  color: var(--bad);
}

.filter-row {
  padding: 0.58rem;
  border: 1px solid #d8e8f6;
  border-radius: 12px;
  background: var(--bg-faint);
}

.filter-row > label {
  border: 1px solid #d5e6f5;
  border-radius: 10px;
  background: #fff;
  padding: 0.42rem 0.48rem 0.5rem;
  min-height: 100%;
}

.filter-row-multiselect > label {
  grid-template-rows: auto 34px minmax(130px, 1fr) auto;
  align-items: start;
}

.filter-row-multiselect > label > input[type="text"] {
  height: 34px;
}

.option-search-spacer {
  width: 100%;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
}

.filter-actions {
  border-top: 1px solid #dcecf9;
  margin-top: 0.05rem;
  padding-top: 0.55rem;
  align-items: flex-end;
}

.filter-actions .btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-actions .compact-field-toolbar {
  min-width: 120px;
}

.filter-actions .compact-field-toolbar select {
  min-width: 106px;
  height: 36px;
  padding-top: 0.34rem;
  padding-bottom: 0.34rem;
}

.btn {
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--blue-mid);
  border-radius: var(--radius-btn);
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
              opacity 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.btn:hover:not(:disabled):not(.disabled) {
  border-color: var(--blue);
  background: var(--bg-faint);
  color: var(--blue-deep);
}

.btn:active:not(:disabled):not(.disabled) {
  opacity: 0.88;
}

.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(93,175,226,0.28);
}

.btn.primary:hover:not(:disabled):not(.disabled) {
  opacity: 0.90;
  box-shadow: 0 4px 14px rgba(93,175,226,0.36);
  background: var(--blue);
  border-color: var(--blue);
}

.btn.ghost:hover,
.btn.tiny:hover {
  border-color: var(--blue);
  background: var(--bg-faint);
}

.btn.tiny {
  padding: 0.28rem 0.62rem;
  font-size: 0.70rem;
  border-radius: var(--radius-btn);
  letter-spacing: 0.05em;
}

/* Sign-out / tiny buttons on dark nav get white ghost treatment */
.app-header .btn.tiny {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.72);
}

.app-header .btn.tiny:hover {
  border-color: rgba(255,255,255,0.50);
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.investigator-link {
  color: var(--blue-deep);
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.investigator-link:hover {
  border-bottom-color: var(--blue-deep);
}

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

.btn.disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.error {
  color: var(--bad);
  font-size: 0.84rem;
  font-weight: 700;
  min-height: 0;
  margin: 0;
  line-height: 1.35;
}

.error:empty {
  display: none;
}

.hint {
  margin: 0.12rem 0 0;
  color: #5a6f89;
  font-size: 0.74rem;
}

.subset-advanced {
  border: 1px solid #d0e3f4;
  border-radius: 12px;
  background: var(--bg-faint);
  padding: 0.52rem 0.58rem;
}

.subset-advanced > summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
  color: #1f4a68;
  list-style: none;
}

.subset-advanced > summary::-webkit-details-marker {
  display: none;
}

.subset-advanced > summary::before {
  content: "▸";
  margin-right: 0.32rem;
  color: #2c6ea0;
}

.subset-advanced[open] > summary::before {
  content: "▾";
}

.subset-advanced .subset-filter-row {
  margin-top: 0.55rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.results-panel {
  display: block;
  padding: 1rem 1rem 0.95rem;
}

.results-panel > * + * {
  margin-top: 0.34rem;
}

.results-panel .panel-head {
  border-bottom: 1px solid #dcecf9;
  padding-bottom: 0.3rem;
}

.loading-indicator {
  display: none;
  align-items: center;
  gap: 0.44rem;
  width: fit-content;
  border: 1px solid #d7e8f6;
  border-radius: 999px;
  background: #f6fbff;
  color: #204866;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.26rem 0.55rem;
}

.loading-indicator.active {
  display: inline-flex;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #c2deef;
  border-top-color: var(--blue-deep);
  animation: spin 0.8s linear infinite;
}

.profile-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 24, 40, 0.32);
  backdrop-filter: blur(1.5px);
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.profile-loading-overlay.active {
  display: flex;
}

.profile-loading-card {
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
  border: 1px solid #c7dff0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 20px 45px rgba(17, 53, 96, 0.22);
  padding: 0.7rem 0.85rem;
  color: #1f4665;
  min-width: 280px;
}

.profile-loading-card .spinner {
  width: 16px;
  height: 16px;
}

.profile-loading-text {
  display: grid;
  gap: 0.1rem;
}

#profile-loading-title {
  font-size: 0.84rem;
  font-weight: 800;
}

#profile-loading-subtitle {
  font-size: 0.76rem;
}

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

.pagination-bar {
  display: flex;
  align-items: center;
  gap: 0.46rem;
  flex-wrap: wrap;
  border: 1px solid #dcecf9;
  border-radius: 10px;
  background: #f8fcff;
  padding: 0.38rem 0.44rem;
}

.compact-field-inline {
  display: flex;
  align-items: center;
  gap: 0.34rem;
  width: auto;
}

.compact-field-inline > span {
  font-size: 0.72rem;
  margin: 0;
  white-space: nowrap;
}

#page-number-input {
  width: 84px;
}

.results-panel .table-wrap {
  margin-top: 0.18rem;
}

.table-wrap {
  border: 1px solid #c8deef;
  border-radius: 14px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 560px;
  margin-top: 0.7rem;
}

#results-table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 2550px;
  min-width: 2550px;
  font-size: 0.74rem;
}

#results-table th,
#results-table td {
  padding: 0.42rem 0.5rem;
  border-bottom: 1px solid #e2eff9;
  vertical-align: middle;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}

.results-cell-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

#results-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e9f4ff;
  color: #1f4665;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

#results-table th:nth-child(1),
#results-table td:nth-child(1) { width: 120px; }
#results-table th:nth-child(2),
#results-table td:nth-child(2) { width: 120px; }
#results-table th:nth-child(3),
#results-table td:nth-child(3) { width: 120px; }
#results-table th:nth-child(4),
#results-table td:nth-child(4) { width: 145px; }
#results-table th:nth-child(5),
#results-table td:nth-child(5) { width: 190px; }
#results-table th:nth-child(6),
#results-table td:nth-child(6) { width: 110px; }
#results-table th:nth-child(7),
#results-table td:nth-child(7) { width: 70px; }
#results-table th:nth-child(8),
#results-table td:nth-child(8) { width: 90px; }
#results-table th:nth-child(9),
#results-table td:nth-child(9) { width: 125px; }
#results-table th:nth-child(10),
#results-table td:nth-child(10) { width: 190px; }
#results-table th:nth-child(11),
#results-table td:nth-child(11) { width: 190px; }
#results-table th:nth-child(12),
#results-table td:nth-child(12) { width: 76px; }
#results-table th:nth-child(13),
#results-table td:nth-child(13) { width: 76px; }
#results-table th:nth-child(14),
#results-table td:nth-child(14) { width: 110px; }
#results-table th:nth-child(15),
#results-table td:nth-child(15) { width: 200px; }
#results-table th:nth-child(16),
#results-table td:nth-child(16) { width: 200px; }
#results-table th:nth-child(17),
#results-table td:nth-child(17) { width: 130px; }
#results-table th:nth-child(18),
#results-table td:nth-child(18) { width: 200px; }
#results-table th:nth-child(19),
#results-table td:nth-child(19) { width: 130px; }
#results-table th:nth-child(20),
#results-table td:nth-child(20) { width: 120px; }
#results-table th:nth-child(21),
#results-table td:nth-child(21) { width: 130px; }

#results-table tr:nth-child(even) td {
  background: #fcfeff;
}

#results-table tr.results-row-link {
  cursor: pointer;
}

#results-table tr.results-row-link:hover td {
  background: #eef7ff;
}

#results-table tr.results-row-link:focus-visible td {
  background: #e7f3ff;
  outline: 2px solid #7fb8de;
  outline-offset: -2px;
}

#trial-count-meta {
  margin-top: 0.2rem;
}

#trial-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 0.78rem;
}

#trial-table th,
#trial-table td {
  padding: 0.42rem 0.5rem;
  border-bottom: 1px solid #e2eff9;
  vertical-align: top;
  text-align: left;
  max-width: 320px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#trial-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #eaf5ff, #e4f1ff);
  color: #1f4665;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

#trial-table tr:nth-child(even) td {
  background: #fcfeff;
}

.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.62rem;
}

.card {
  border: 1px solid #c8dff0;
  background: #f8fcff;
  border-radius: 12px;
  padding: 0.58rem 0.64rem;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.card:hover {
  box-shadow: 0 6px 18px rgba(19, 58, 97, 0.10);
  transform: translateY(-1px);
}

.big {
  margin-top: 0.25rem;
  font-size: 1.28rem;
  font-weight: 900;
  color: var(--linea-deep);
}

.big.small {
  font-size: 0.92rem;
}

.detail-header {
  display: grid;
  gap: 0.8rem;
}

.mini-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-grid {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.62rem;
}

.detail-grid > div {
  display: grid;
  gap: 0.2rem;
  border: 1px solid #d7e7f5;
  border-radius: 10px;
  background: #fbfdff;
  padding: 0.46rem 0.52rem;
}

.detail-grid .label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #315979;
  letter-spacing: 0.02em;
}

.split {
  margin-top: 0.72rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.viz-grid {
  margin-top: 0.72rem;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 0.9rem;
}

.viz-card {
  border: 1px solid #cde3f2;
  background: linear-gradient(180deg, #fcfeff, #f7fbff);
  border-radius: 12px;
  padding: 0.66rem 0.72rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.viz-card:hover {
  box-shadow: 0 8px 22px rgba(19, 58, 97, 0.11);
  transform: translateY(-1px);
}

.viz-card > .muted {
  margin: 0.34rem 0 0.45rem;
}

.world-map-canvas {
  min-height: 370px;
  height: 370px;
  width: 100%;
  border: 1px solid #c7dff0;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, #fafdff, #f1f8ff);
}

#us-state-map {
  min-height: 370px;
  height: 370px;
}

.map-empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: #3f6482;
  font-size: 0.82rem;
  padding: 0.75rem;
}

.bar-chart-list {
  display: grid;
  gap: 0.4rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 98px 1fr 56px;
  gap: 0.45rem;
  align-items: center;
}

.bar-label {
  font-size: 0.74rem;
  font-weight: 800;
  color: #204866;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  border: 1px solid #c7e0f1;
  background: #eef7ff;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
}

.bar-value {
  text-align: right;
  font-size: 0.72rem;
  color: #2b5679;
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.simple-table th,
.simple-table td {
  border-bottom: 1px solid #e2eff9;
  padding: 0.38rem 0.44rem;
  text-align: left;
}

.simple-table th {
  background: #eef7ff;
  color: #1f4665;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.trends-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.trends-panel {
  display: block;
}

.trends-panel > * + * {
  margin-top: 0.62rem;
}

.trends-summary .card {
  background: linear-gradient(180deg, #fbfdff, #f4f9ff);
}

.trends-meta {
  margin-top: 0.24rem;
  font-size: 0.76rem;
  color: #2c5272;
  word-break: break-word;
  white-space: pre-wrap;
}

.trends-panel #trends-loading-indicator {
  margin-top: 0.62rem;
  border: 1px dashed #cde3f3;
  border-radius: 11px;
  background: #f8fcff;
  padding: 0.42rem 0.54rem;
}

.trends-frame-wrap {
  margin-top: 0.72rem;
  border: 1px solid #c8deef;
  border-radius: 14px;
  background: linear-gradient(180deg, #fcfeff, #f6fbff);
  overflow: hidden;
  min-height: 520px;
}

.trends-frame-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.56rem;
  padding: 0.5rem 0.64rem;
  border-bottom: 1px solid #d2e5f4;
  background: linear-gradient(180deg, #f4faff, #edf6ff);
}

.trends-frame-head .muted {
  margin: 0;
  font-size: 0.74rem;
  text-align: right;
}

.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  display: grid;
  gap: 0.42rem;
  max-width: min(380px, calc(100vw - 24px));
}

.toast-item {
  border: 1px solid #c7ddf0;
  border-radius: 11px;
  background: rgba(248, 253, 255, 0.98);
  color: #194462;
  padding: 0.5rem 0.64rem;
  font-size: 0.79rem;
  box-shadow: 0 8px 22px rgba(18, 53, 92, 0.14);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-item.success {
  border-color: rgba(31, 157, 101, 0.45);
  color: #11693f;
}

.toast-item.warn {
  border-color: rgba(196, 127, 24, 0.45);
  color: #87540f;
}

.toast-item.error {
  border-color: rgba(180, 61, 79, 0.5);
  color: #8c1f2f;
}

.toast-item.fade-out {
  opacity: 0;
  transform: translateY(8px);
}

.management-panel {
  display: block;
}

.management-panel > * + * {
  margin-top: 0.72rem;
}

.management-panel > h3 + .cards {
  margin-top: 0.72rem;
}

#mgmt-cards {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

#mgmt-cards .big {
  margin-top: 0.18rem;
  font-size: 1.14rem;
  line-height: 1.24;
}

.management-panel .split {
  margin-top: 0.72rem;
  gap: 0.76rem;
}

.management-panel .viz-grid {
  margin-top: 0.72rem;
  gap: 0.76rem;
}

.continent-grid {
  align-items: start;
}

#continent-map {
  min-height: 320px;
  height: 320px;
}

.management-panel .split h4 {
  margin: 0 0 0.34rem;
}

.dedupe-panel {
  display: block;
}

.dedupe-panel > * + * {
  margin-top: 0.34rem;
}

.dedupe-panel #dedupe-token-msg {
  margin-top: 0.02rem;
}

.dedupe-panel #dedupe-result:empty {
  display: none;
}

#trends-dashboard-frame {
  width: 100%;
  height: 960px;
  border: 0;
  display: block;
  background: #fff;
}

.workflow-studio {
  padding: 1rem 1.02rem;
}

.workflow-studio-layout {
  display: grid;
  gap: 0.92rem;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.9fr);
}

.workflow-studio-main {
  display: grid;
  gap: 0.6rem;
}

.workflow-studio-main > p.muted {
  margin: 0;
}

.studio-mode-toggle {
  margin-top: 0.12rem;
  grid-template-columns: 1fr 1fr;
}

.workflow-studio .mode-btn {
  border: 1px solid #b7d4ef;
  background: #eef6ff;
  color: #22486a;
  border-radius: 12px;
  padding: 0.58rem 0.54rem;
  font-weight: 700;
}

.workflow-studio .mode-btn.active {
  border-color: #2f76cb;
  background: linear-gradient(135deg, rgba(53, 105, 180, 0.95), rgba(105, 177, 226, 0.95));
  color: #fff;
}

.workflow-studio .mode-panel {
  margin-top: 0.25rem;
  border: 1px solid #d0e4f4;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfeff, #f5faff);
  padding: 0.6rem;
}

.workflow-studio .mode-panel > label {
  border: 1px solid #d8e9f6;
  border-radius: 10px;
  padding: 0.46rem 0.5rem 0.54rem;
  background: #fff;
}

.workflow-studio-aside {
  display: grid;
  gap: 0.7rem;
  align-content: start;
}

.studio-aside-card {
  border: 1px solid #cfe3f3;
  border-radius: 12px;
  background: var(--bg-faint);
  padding: 0.62rem 0.68rem;
}

.studio-aside-card .muted {
  margin: 0.25rem 0 0;
}

.studio-note-list {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.26rem;
}

.studio-note-list li {
  font-size: 0.79rem;
  color: #264f6d;
}

.run-page {
  position: relative;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 16px 34px;
}

.run-page .card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(17, 53, 96, 0.08);
}

.run-page .hero {
  background: linear-gradient(140deg, rgba(22, 46, 77, 0.95), rgba(53, 105, 180, 0.88));
  color: #f4fbff;
  border-color: rgba(255, 255, 255, 0.18);
  padding: 16px 18px 14px;
  display: block;
}

.run-page .hero-brand {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.run-page .hero-logo-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.run-page .hero-logo {
  display: block;
  width: min(56px, 15vw);
  height: auto;
  filter: drop-shadow(0 0 10px rgba(105, 177, 226, 0.3));
}

.run-page .hero-top {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.run-page .chip {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #f2fbff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 5px 10px;
}

.run-page .chip-alt {
  color: #daf7ea;
  border-color: rgba(31, 157, 101, 0.44);
  background: rgba(31, 157, 101, 0.18);
}

.run-page .chip-user {
  color: #e7f4ff;
  border-color: rgba(93, 175, 226, 0.44);
  background: rgba(93, 175, 226, 0.2);
}

.run-page .hero h1 {
  margin: 10px 0 6px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  font-family: "Inter", system-ui, sans-serif;
}

.run-page .hero p {
  margin: 0;
  max-width: 900px;
  color: rgba(242, 251, 255, 0.92);
  font-size: 14px;
  line-height: 1.52;
}

.run-page .hero-meta {
  margin-top: 12px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: rgba(228, 244, 254, 0.9);
  font-size: 12px;
}

.run-page .layout {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(460px, 1.2fr);
  gap: 12px;
}

.run-page .form-card,
.run-page .status-card {
  padding: 14px;
}

.run-page .card-head h2 {
  margin: 0;
  font-size: 19px;
  color: #162e4d;
}

.run-page .card-head p {
  margin: 4px 0 0;
  color: #4f6581;
  font-size: 12.5px;
}

.run-page .actions {
  margin-top: 12px;
}

.run-page .btn {
  text-decoration: none;
}

.run-page .status-box {
  margin-top: 10px;
  border: 1px solid #cfe1f5;
  border-radius: 14px;
  padding: 11px;
  background: #f5fbff;
}

.run-page .status-box.idle {
  background: #f5fbff;
}

.run-page .status-box.running {
  background: #eef6ff;
  border-color: #c2d7ec;
}

.run-page .status-box.completed {
  background: #effcf6;
  border-color: #bfe7d3;
}

.run-page .status-box.failed {
  background: #fff2f3;
  border-color: #f0b6bc;
}

.run-page .status-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 6px;
}

.run-page .status-row .label {
  color: #4f6581;
  white-space: nowrap;
}

.run-page .status-row .value {
  color: #16395e;
  font-weight: 700;
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.run-page #run-stage {
  text-align: left;
}

.run-page .progress-wrap {
  position: relative;
  width: 100%;
  height: 11px;
  border-radius: 999px;
  background: #d5e7f8;
  overflow: hidden;
  margin-top: 0;
}

.run-page .progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3569b4, #5dafe2);
  transition: width 0.25s ease;
}

.run-page .progress-pct {
  margin-top: 6px;
  font-size: 11px;
  color: #4f6581;
}

.run-page .run-status-chip.running {
  border-color: rgba(204, 139, 31, 0.44);
  background: rgba(204, 139, 31, 0.18);
}

.run-page .run-status-chip.completed {
  border-color: rgba(31, 157, 101, 0.44);
  background: rgba(31, 157, 101, 0.18);
}

.run-page .run-status-chip.failed {
  border-color: rgba(190, 63, 75, 0.44);
  background: rgba(190, 63, 75, 0.22);
}

.run-page .logs-wrap {
  margin-top: 12px;
}

.run-page .logs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.run-page .logs-head h3,
.run-page .artifacts-wrap h3 {
  margin: 0;
  font-size: 14px;
  color: #162e4d;
}

.run-page .logs {
  margin-top: 8px;
  height: 260px;
  overflow: auto;
  border: 1px solid #1c3f66;
  border-radius: 12px;
  background: #102741;
  color: #e4f4fe;
  font-family: "Inter", monospace;
  font-size: 11.5px;
  line-height: 1.4;
  padding: 10px;
  white-space: pre-wrap;
}

.run-page .artifacts-wrap {
  margin-top: 12px;
}

.run-page #artifact-count,
.run-page .artifacts-wrap .muted {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.run-page .artifacts {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

.run-page .artifacts.empty {
  color: #557795;
  border: 1px dashed #bdd8f4;
  border-radius: 12px;
  padding: 10px;
  font-size: 12px;
}

.run-page .artifact {
  border: 1px solid var(--border);
  background: #fbfdff;
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.run-page .artifact > * {
  min-width: 0;
}

.run-page .artifact h4 {
  margin: 0 0 3px;
  font-size: 12px;
  color: #16395e;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.run-page .artifact .meta {
  margin: 0;
  font-size: 11px;
  color: #5a6f89;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.run-page .artifact .row {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.run-page .artifact .row .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 31px;
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  white-space: nowrap;
  text-align: center;
  max-width: none;
  font-size: 0.67rem;
  padding: 0.26rem 0.42rem;
}

.run-page .run-summary-content {
  display: grid;
  gap: 0.62rem;
  margin-top: 0.6rem;
}

.run-page .run-summary-cards {
  display: grid;
  gap: 0.52rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.run-page .run-summary-card {
  border: 1px solid #cbe1f1;
  border-radius: 10px;
  background: linear-gradient(180deg, #fafdff, #f4faff);
  padding: 0.55rem 0.6rem;
}

.run-page .run-summary-card .kicker {
  color: #2f5674;
}

.run-page .run-summary-card .run-summary-value {
  margin-top: 0.18rem;
  color: #174867;
  font-weight: 900;
  font-size: 1.02rem;
}

.run-page .run-summary-value.risk-low {
  color: #198058;
}

.run-page .run-summary-value.risk-medium {
  color: #a36c15;
}

.run-page .run-summary-value.risk-high {
  color: #ad3447;
}

.run-page .run-brief-grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.run-page .run-brief-grid > div {
  border: 1px solid #d6e8f5;
  border-radius: 10px;
  background: #fbfdff;
  padding: 0.48rem 0.54rem;
}

.run-page .run-brief-grid > div p {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
  color: #244f6f;
  overflow-wrap: anywhere;
}

.run-page .run-warning-box {
  border: 1px solid #e5c89a;
  background: #fff8ea;
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
}

.run-page .run-warning-box ul {
  margin: 0.28rem 0 0;
  padding-left: 1rem;
}

.run-page .run-timeline {
  margin-top: 8px;
  border: 1px dashed #bdd8f4;
  border-radius: 12px;
  background: #fbfdff;
  min-height: 54px;
  padding: 8px 10px;
  color: #44627e;
}

.run-page .run-timeline-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.28rem;
}

.run-page .run-timeline-list li {
  font-size: 0.82rem;
  color: #234c6b;
}

.job-feasibility .run-page {
  max-width: 1180px;
}

.job-feasibility .run-page .layout {
  grid-template-columns: 1fr;
  gap: 14px;
}

.job-feasibility .run-page .form-card,
.job-feasibility .run-page .status-card {
  padding: 16px;
}

.job-feasibility .run-page .hero {
  border-radius: 24px;
}

.job-feasibility .run-page .hero h1 {
  font-size: clamp(1.3rem, 3vw, 2rem);
  letter-spacing: 0.02em;
}

.job-feasibility .run-page .hero p {
  color: rgba(242, 251, 255, 0.92);
}

.job-feasibility .run-page .run-summary-content {
  gap: 0.9rem;
}

.job-feasibility .run-page .run-summary-content * {
  min-width: 0;
}

.job-feasibility .run-page .feas-summary-cards .run-summary-card {
  border-radius: 16px;
  background: linear-gradient(180deg, #fafdff, #f2f8ff);
  padding: 0.72rem 0.82rem;
}

.job-feasibility .run-page .feas-summary-cards {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.job-feasibility .run-page .feas-summary-cards .run-summary-value {
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.job-feasibility .run-page .feas-brief-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem 0.85rem;
}

.job-feasibility .run-page .feas-brief-grid > div p {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: #234765;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.job-feasibility .run-page .feas-brief-grid .full-row {
  grid-column: 1 / -1;
}

.job-feasibility .run-page .feas-section {
  border: 1px solid #d3e5f8;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(17, 53, 96, 0.08);
  padding: 0.86rem;
  display: grid;
  gap: 0.66rem;
}

.job-feasibility .run-page .feas-section h3 {
  margin: 0;
  font-size: 1.02rem;
  color: #162e4d;
}

.job-feasibility .run-page .field-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #284766;
}

.job-feasibility .run-page .feas-indicator-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.job-feasibility .run-page .feas-indicator-card {
  border-radius: 14px;
  border: 1px solid #d3e5f8;
  background: #fff;
  padding: 0.72rem;
}

.job-feasibility .run-page .feas-indicator-card h4 {
  margin: 0;
  font-size: 0.93rem;
  color: #1d3e63;
}

.job-feasibility .run-page .feas-indicator-card .score-stack {
  margin: 0.36rem 0 0.44rem;
  display: grid;
  gap: 0.2rem;
}

.job-feasibility .run-page .feas-indicator-card .score-line {
  margin: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.job-feasibility .run-page .feas-indicator-card .score-line .label {
  color: #4f6581;
  font-weight: 700;
}

.job-feasibility .run-page .feas-indicator-card .score-line .value {
  color: #244f6f;
  font-weight: 800;
  text-align: right;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.job-feasibility .run-page .feas-indicator-card ul {
  margin: 0.32rem 0 0;
  padding-left: 1rem;
}

.job-feasibility .run-page .feas-indicator-card li,
.job-feasibility .run-page .watch-list li {
  font-size: 0.78rem;
  margin-bottom: 0.22rem;
  color: #405973;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.job-feasibility .run-page .watch-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.34rem;
}

.job-feasibility .run-page .watch-list li {
  margin: 0;
  border: 1px solid #d7e7f8;
  background: #f8fcff;
  border-radius: 10px;
  padding: 0.36rem 0.5rem;
  line-height: 1.35;
}

.job-feasibility .run-page .watch-list li.watch-empty {
  border-style: dashed;
  color: #5f738a;
}

.job-feasibility .run-page .feas-watch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.job-feasibility .run-page .feas-watch-card {
  border: 1px solid #d3e5f8;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(17, 53, 96, 0.08);
  padding: 0.74rem;
  display: grid;
  gap: 0.46rem;
}

.job-feasibility .run-page .feas-watch-card h4 {
  margin: 0;
  font-size: 0.9rem;
  color: #1d3e63;
}

.job-feasibility .run-page .feas-watch-card .muted {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.job-feasibility .run-page .run-warning-box {
  border: 1px solid #d7e7f8;
  background: #f7fbff;
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
}

.job-feasibility .run-page .run-warning-box ul {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
}

.job-feasibility .run-page .run-warning-box li {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.job-feasibility .run-page .logs {
  height: 220px;
}

.job-feasibility .run-page .risk-low {
  color: #1f9d65 !important;
}

.job-feasibility .run-page .risk-unknown {
  color: #5f6d81 !important;
}

.job-feasibility .run-page .risk-medium {
  color: #cc8b1f !important;
}

.job-feasibility .run-page .risk-high {
  color: #be3f4b !important;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.auth-shell {
  width: min(560px, calc(100vw - 1rem));
}

.auth-card {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 44px rgba(17, 53, 96, 0.16);
  padding: 1.05rem 1.08rem;
  display: grid;
  gap: 0.75rem;
}

.auth-brand {
  display: grid;
  justify-items: center;
  gap: 0.15rem;
}

.auth-logo {
  width: min(280px, 74vw);
  max-height: 86px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(7, 55, 90, 0.16));
}

.auth-brand p {
  margin: 0;
  color: #2d5575;
  font-size: 0.8rem;
  font-weight: 700;
}

.auth-card h1 {
  margin: 0;
  font-size: 1.4rem;
  color: #10375a;
}

.auth-card h2 {
  margin: 0;
  font-size: 0.9rem;
  color: #1f4d6f;
}

.auth-form {
  display: grid;
  gap: 0.5rem;
}

.auth-form label {
  gap: 0.2rem;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
  border: 1px solid #bdd7ea;
  border-radius: 11px;
  padding: 0.52rem 0.58rem;
  font-size: 0.9rem;
  color: #122d45;
  background: #fff;
}

.auth-form input:focus {
  outline: 2px solid rgba(90, 174, 226, 0.34);
  outline-offset: 1px;
  border-color: #7db9df;
}

.auth-links {
  display: flex;
  justify-content: flex-end;
  margin-top: -0.05rem;
}

.auth-links a {
  color: var(--blue-deep);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.auth-submit {
  margin-top: 0.18rem;
  width: 100%;
  justify-content: center;
  font-size: 0.92rem;
  padding: 0.58rem 0.66rem;
}

.auth-policy {
  border: 1px solid #d5e8f7;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfeff, #f5faff);
  padding: 0.58rem 0.64rem;
}

.auth-policy ul {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.16rem;
}

.auth-policy li {
  font-size: 0.78rem;
  color: #244c6b;
}

.auth-info {
  margin: 0;
  border: 1px solid #bcdff3;
  background: #eef8ff;
  border-radius: 10px;
  padding: 0.48rem 0.56rem;
  color: #1f4a69;
  font-size: 0.8rem;
  font-weight: 700;
}

.auth-note {
  margin: 0;
  border: 1px solid #cadff1;
  background: #f7fbff;
  border-radius: 10px;
  padding: 0.46rem 0.54rem;
  color: #365b79;
  font-size: 0.78rem;
}

.auth-footer {
  display: flex;
  justify-content: flex-start;
  gap: 0.48rem;
  align-items: center;
  flex-wrap: wrap;
}

.admin-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.account-summary-panel .admin-cards .card {
  display: grid;
  gap: 0.24rem;
  padding: 0.56rem 0.62rem;
}

.account-summary-panel .admin-cards .big {
  margin-top: 0;
  font-size: 0.96rem;
  line-height: 1.28;
  font-weight: 800;
  color: #153d5b;
  overflow-wrap: anywhere;
}

.account-summary-panel .admin-cards .big.small {
  font-size: 0.96rem;
}

.account-summary-panel .admin-cards .mono {
  font-size: 0.92rem;
}

.account-summary-panel .admin-detail-grid {
  gap: 0.56rem;
}

.account-summary-panel .admin-detail-grid > div {
  min-height: 66px;
  padding: 0.5rem 0.56rem;
  gap: 0.22rem;
}

.account-summary-panel .admin-detail-grid .label {
  font-size: 0.65rem;
  letter-spacing: 0.03em;
}

.account-summary-panel .admin-detail-grid > div > span:last-child {
  font-size: 0.79rem;
  line-height: 1.34;
  color: #234a68;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.admin-action-card {
  border: 1px solid #d4e7f6;
  background: linear-gradient(180deg, #fbfeff, #f5faff);
  border-radius: 12px;
  padding: 0.62rem 0.7rem;
  display: grid;
  gap: 0.55rem;
}

.admin-action-card h4 {
  margin: 0;
}

.admin-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 0.79rem;
}

.admin-table th,
.admin-table td {
  padding: 0.38rem 0.48rem;
  border-bottom: 1px solid #e2eff9;
  vertical-align: top;
  text-align: left;
  max-width: 320px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e9f4ff;
  color: #1f4665;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.admin-table tr:nth-child(even) td {
  background: #fcfeff;
}

.admin-table tr.admin-user-row {
  cursor: pointer;
}

.admin-table tr.admin-user-row:hover td {
  background: #eef7ff;
}

.admin-table tr.admin-user-row:focus-visible td {
  background: #e7f3ff;
  outline: 2px solid #7fb8de;
  outline-offset: -2px;
}

.admin-table.compact {
  font-size: 0.74rem;
}

.auth-policy-list {
  margin: 0.1rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.34rem;
}

.auth-policy-list li {
  font-size: 0.78rem;
  color: #244c6b;
}

.password-input-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.34rem;
  align-items: center;
}

.password-input-wrap .btn {
  white-space: nowrap;
}

/* Deep dark-mode pass: remove leftover light tiles and improve logo visibility. */
body[data-theme="dark"] .brand-logo,
body[data-theme="dark"] .auth-logo {
  filter: brightness(1.58) contrast(1.24) saturate(1.16) drop-shadow(0 0 16px rgba(107, 191, 244, 0.34));
}

body[data-theme="dark"] .app-header {
  border-bottom: 1px solid rgba(99, 146, 183, 0.26);
}

body[data-theme="dark"] .filter-row,
body[data-theme="dark"] .dedupe-grid,
body[data-theme="dark"] .preset-toolbar,
body[data-theme="dark"] .workflow-studio .mode-panel,
body[data-theme="dark"] .studio-aside-card,
body[data-theme="dark"] .auth-policy,
body[data-theme="dark"] .auth-info,
body[data-theme="dark"] .auth-note,
body[data-theme="dark"] .admin-action-card,
body[data-theme="dark"] .run-page .status-box,
body[data-theme="dark"] .run-page .run-summary-card,
body[data-theme="dark"] .run-page .run-warning-box,
body[data-theme="dark"] .run-page .run-timeline,
body[data-theme="dark"] .job-feasibility .run-page .feas-section,
body[data-theme="dark"] .job-feasibility .run-page .feas-watch-card {
  border-color: #355675 !important;
  background: linear-gradient(180deg, rgba(20, 38, 56, 0.96), rgba(14, 29, 45, 0.96)) !important;
  color: #d8eafc;
}

body[data-theme="dark"] .filter-row > label,
body[data-theme="dark"] .dedupe-grid > label,
body[data-theme="dark"] .dedupe-grid > .input-field,
body[data-theme="dark"] .preset-toolbar .preset-field,
body[data-theme="dark"] .workflow-studio .mode-panel > label,
body[data-theme="dark"] .detail-grid > div,
body[data-theme="dark"] .account-summary-panel .admin-detail-grid > div,
body[data-theme="dark"] .run-page .artifact,
body[data-theme="dark"] .run-page .run-brief-grid > div,
body[data-theme="dark"] .job-feasibility .run-page .feas-indicator-card,
body[data-theme="dark"] .job-feasibility .run-page .watch-list li {
  border-color: #3a5a78 !important;
  background: rgba(14, 29, 45, 0.95) !important;
  color: #d7eafc;
}

body[data-theme="dark"] .auth-form input[type="text"],
body[data-theme="dark"] .auth-form input[type="password"] {
  border-color: #3b5d7c !important;
  background: #0f2133 !important;
  color: #e4f0fc;
}

body[data-theme="dark"] .account-summary-panel .admin-cards .big,
body[data-theme="dark"] .account-summary-panel .admin-detail-grid > div > span:last-child,
body[data-theme="dark"] .run-page .card-head h2,
body[data-theme="dark"] .run-page .artifact h4,
body[data-theme="dark"] .run-page .run-summary-card .run-summary-value,
body[data-theme="dark"] .job-feasibility .run-page .feas-section h3,
body[data-theme="dark"] .job-feasibility .run-page .feas-indicator-card h4,
body[data-theme="dark"] .job-feasibility .run-page .feas-watch-card h4 {
  color: #e5f2ff !important;
}

body[data-theme="dark"] .run-page .card {
  background: rgba(15, 30, 46, 0.94) !important;
  border-color: #345470 !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
}

body[data-theme="dark"] .account-summary-panel .admin-detail-grid .label {
  color: #c8ddf1 !important;
}

body[data-theme="dark"] .toast-item {
  background: rgba(15, 30, 46, 0.97);
  border-color: #385b79;
  color: #d7ebff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .toast-item.success {
  border-color: rgba(86, 190, 136, 0.52);
  color: #9ee4bf;
}

body[data-theme="dark"] .toast-item.warn {
  border-color: rgba(214, 169, 95, 0.54);
  color: #f2d59b;
}

body[data-theme="dark"] .toast-item.error {
  border-color: rgba(199, 103, 120, 0.56);
  color: #f0b8c2;
}

body[data-theme="dark"] .account-summary-panel .admin-detail-grid > div > span:last-child {
  color: #eef6ff !important;
  font-size: 0.84rem;
  line-height: 1.4;
}

body[data-theme="dark"] .run-page .status-box.running,
body[data-theme="dark"] .run-page .status-box.completed,
body[data-theme="dark"] .run-page .status-box.failed,
body[data-theme="dark"] .run-page .status-box.idle {
  border-color: #3a5c7a !important;
  background: linear-gradient(180deg, rgba(18, 36, 54, 0.96), rgba(13, 27, 42, 0.96)) !important;
}

body[data-theme="dark"] .run-page .status-row .label,
body[data-theme="dark"] .run-page .progress-pct,
body[data-theme="dark"] .run-page .card-head p,
body[data-theme="dark"] .run-page .artifact .meta,
body[data-theme="dark"] .run-page .run-timeline-list li,
body[data-theme="dark"] .job-feasibility .run-page .field-label,
body[data-theme="dark"] .job-feasibility .run-page .feas-indicator-card .score-line .label,
body[data-theme="dark"] .job-feasibility .run-page .feas-indicator-card li,
body[data-theme="dark"] .job-feasibility .run-page .watch-list li,
body[data-theme="dark"] .auth-policy-list li {
  color: #b9cee4 !important;
}

body[data-theme="dark"] .run-page .status-row .value,
body[data-theme="dark"] .run-page .feas-brief-grid > div p,
body[data-theme="dark"] .job-feasibility .run-page .feas-indicator-card .score-line .value {
  color: #deeeff !important;
}

body[data-theme="dark"] .run-page .progress-wrap {
  background: #2a455f !important;
}

body[data-theme="dark"] .run-page .artifacts.empty {
  border-color: #3a5b79 !important;
  color: #bfd4e8 !important;
  background: rgba(15, 31, 47, 0.92) !important;
}

body[data-theme="dark"] #trends-dashboard-frame {
  background: #0e2134;
}

body[data-theme="dark"] .job-feasibility .run-page .run-warning-box {
  border-color: #4c6f8f !important;
}

body[data-theme="dark"] .job-feasibility .run-page .watch-list li.watch-empty {
  color: #9db7cf !important;
}

body[data-theme="dark"] #trends-dataset-path {
  color: var(--linea-deep) !important;
}

body[data-theme="dark"] .job-box .job-head {
  color: #e5f2ff !important;
}

body[data-theme="dark"] .job-box .muted {
  color: #c6daee !important;
}

@media (prefers-color-scheme: dark) {
  body[data-theme="system"] .account-summary-panel .admin-detail-grid .label {
    color: #c8ddf1 !important;
  }

  body[data-theme="system"] .account-summary-panel .admin-detail-grid > div > span:last-child {
    color: #eef6ff !important;
    font-size: 0.84rem;
    line-height: 1.4;
  }

  body[data-theme="system"] .job-box .job-head {
    color: #e5f2ff !important;
  }

  body[data-theme="system"] .job-box .muted {
    color: #c6daee !important;
  }

  body[data-theme="system"] #trends-dataset-path {
    color: var(--linea-deep) !important;
  }
}

@media (max-width: 1120px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trends-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viz-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preset-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preset-toolbar .preset-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .run-page .layout,
  .run-page .run-summary-cards,
  .run-page .run-brief-grid {
    grid-template-columns: 1fr;
  }

  .run-page .logs {
    height: 220px;
  }

  .job-feasibility .run-page .feas-watch-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-header,
  .shell {
    width: calc(100vw - 1rem);
  }

  .grid-4,
  .grid-3,
  .cards,
  .admin-cards,
  .trends-cards,
  .split,
  .detail-grid,
  .admin-detail-grid,
  .mini-cards,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .status-top,
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .trends-frame-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .trends-frame-head .muted {
    text-align: left;
  }

  .status-right {
    justify-content: flex-start;
    text-align: left;
  }

  .run-page {
    padding: 16px 8px 22px;
  }

  .run-page .hero-logo {
    width: min(46px, 17vw);
  }

  .preset-toolbar {
    grid-template-columns: 1fr;
  }

  .preset-toolbar .preset-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  #trends-dashboard-frame {
    height: 820px;
  }
}

/* 2026-02-20 incremental polish */
.shell {
  margin-top: 0.9rem;
}

.header-tools .btn.tiny {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 0.56rem;
  line-height: 1;
  white-space: nowrap;
}

.run-page .hero {
  background: linear-gradient(145deg, #1f3f66, #3569b4) !important;
  border-color: #2f5a8a !important;
  color: #eef7ff !important;
}

.run-page .hero-meta-top {
  margin-top: 11px;
}

.run-page .hero-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 0.42rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.run-page .hero-actions .btn.tiny {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.54rem;
  font-size: 0.7rem;
  line-height: 1;
  white-space: nowrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 21, 34, 0.46);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1600;
  padding: 0.8rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  width: min(980px, calc(100vw - 1.2rem));
  max-height: 88vh;
  overflow: hidden;
  border: 1px solid #c5dff2;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 24px 55px rgba(16, 45, 74, 0.28);
  display: grid;
  gap: 0.48rem;
  padding: 0.7rem;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.artifact-preview-content {
  margin: 0;
  border: 1px solid #c8dff0;
  border-radius: 10px;
  min-height: 220px;
  max-height: calc(88vh - 130px);
  overflow: auto;
}

.artifact-preview-content.preview-artifact {
  background: #f7fbff;
  color: #13324c;
  padding: 0.56rem;
  font-family: "Inter", Menlo, Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
}

.artifact-preview-content.preview-questionnaire {
  padding: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  white-space: normal;
  color: #153955;
  background: linear-gradient(180deg, #f7fbff 0%, #f0f8ff 100%);
}

.doc-preview {
  padding: 0.74rem;
  display: grid;
  gap: 0.72rem;
}

.doc-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.72rem;
  align-items: center;
  border: 1px solid #cde4f6;
  border-radius: 10px;
  background: linear-gradient(140deg, #f5fbff 0%, #e8f4ff 100%);
  padding: 0.62rem;
}

.doc-logo {
  height: 34px;
  width: auto;
  display: block;
}

.doc-kicker {
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4e7aa3;
  font-weight: 700;
}

.doc-head-copy h2 {
  margin: 0.16rem 0 0.12rem;
  font-size: 1.03rem;
  color: #0f2f49;
}

.doc-head-copy p {
  margin: 0;
  font-size: 0.74rem;
  color: #2a5579;
  line-height: 1.4;
}

.doc-protocol {
  border: 1px solid #d1e6f7;
  border-radius: 10px;
  background: #fbfeff;
  padding: 0.56rem;
  display: grid;
  gap: 0.45rem;
}

.doc-protocol-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.doc-protocol-head h3 {
  margin: 0;
  font-size: 0.88rem;
  color: #123754;
}

.doc-protocol-head span {
  font-size: 0.68rem;
  color: #5d82a4;
}

.doc-protocol-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.42rem;
}

.doc-protocol-grid > div {
  border: 1px solid #d8ebf9;
  border-radius: 8px;
  background: #f5fbff;
  padding: 0.4rem 0.44rem;
  min-height: 58px;
}

.doc-protocol-grid label {
  display: block;
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5b82a6;
  font-weight: 700;
}

.doc-protocol-grid p {
  margin: 0.18rem 0 0;
  font-size: 0.73rem;
  color: #173d5d;
  line-height: 1.34;
}

.doc-section {
  border: 1px solid #d5e9f8;
  border-radius: 10px;
  background: #ffffff;
  padding: 0.56rem;
  display: grid;
  gap: 0.45rem;
}

.doc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.doc-section-head h4 {
  margin: 0;
  font-size: 0.84rem;
  color: #133a57;
}

.doc-section-head span {
  font-size: 0.68rem;
  color: #577ea1;
}

.doc-helper {
  margin: 0;
  font-size: 0.69rem;
  color: #477096;
}

.doc-question-grid {
  display: grid;
  gap: 0.42rem;
}

.doc-question-item {
  border: 1px solid #deedf9;
  border-radius: 9px;
  background: #fafdff;
  padding: 0.46rem;
  display: grid;
  gap: 0.32rem;
}

.doc-question-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.doc-question-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 22px;
  border-radius: 999px;
  background: #dbecfa;
  color: #16486f;
  font-size: 0.63rem;
  font-weight: 700;
}

.doc-question-type {
  border-radius: 999px;
  border: 1px solid #bfdbf1;
  background: #f0f8ff;
  color: #3a668a;
  padding: 0.14rem 0.4rem;
  font-size: 0.61rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.doc-question-text {
  margin: 0;
  font-size: 0.77rem;
  color: #12344f;
  line-height: 1.42;
  font-weight: 600;
}

.doc-question-note {
  margin: 0;
  font-size: 0.69rem;
  color: #2a5a80;
  line-height: 1.4;
}

.doc-question-note span {
  color: #0f4368;
  font-weight: 700;
}

.doc-empty {
  border: 1px dashed #bed9ef;
  border-radius: 9px;
  background: #f6fbff;
  padding: 0.62rem;
  font-size: 0.74rem;
  color: #3f6890;
}

.trends-chart-grid {
  margin-top: 0.58rem;
  display: grid;
  gap: 0.72rem;
  grid-template-columns: 1fr 1fr;
}

.trends-wide-card {
  grid-column: 1 / -1;
}

.trends-chart {
  min-height: 320px;
  height: 320px;
  width: 100%;
}

.trends-data-panel {
  margin-top: 0.62rem;
}

.trends-filter-row {
  margin-top: 0.5rem;
}

.trends-filter-actions {
  margin-top: 0.46rem;
  justify-content: flex-start;
}

.trends-pagination {
  margin-top: 0.42rem;
}

.trends-table-wrap {
  margin-top: 0.42rem;
  max-height: 420px;
}

.feas-question-input {
  width: 100%;
  min-height: 40px;
  max-height: 140px;
  resize: vertical;
  border: 1px solid #bdd7ea;
  border-radius: 8px;
  padding: 0.28rem 0.34rem;
  font: inherit;
  font-size: 0.73rem;
  line-height: 1.3;
}

.feas-rationale-text,
.feas-priority-text {
  font-size: 0.67rem;
  line-height: 1.28;
  color: #2a5072;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.feas-priority-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.feas-rationale-text {
  border: 1px solid #d0e3f3;
  border-radius: 7px;
  background: #f3f9ff;
  padding: 0.24rem 0.32rem;
}

.feas-rationale-shell {
  display: grid;
  gap: 0.18rem;
}

.feas-rationale-text.is-collapsed {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.feas-inline-toggle {
  justify-self: start;
  border: 0;
  background: transparent;
  color: #2f6f9a;
  padding: 0;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  line-height: 1.1;
}

.feas-inline-toggle:hover {
  color: #194f73;
  text-decoration: underline;
}

#feas-question-table th,
#feas-question-table td {
  padding-top: 0.28rem;
  padding-bottom: 0.28rem;
}

#feas-question-table th:nth-child(1),
#feas-question-table td:nth-child(1) {
  min-width: 54px;
}

#feas-question-table th:nth-child(2),
#feas-question-table td:nth-child(2) {
  min-width: 70px;
}

#feas-question-table th:nth-child(3),
#feas-question-table td:nth-child(3) {
  min-width: 120px;
}

#feas-question-table th:nth-child(4),
#feas-question-table td:nth-child(4) {
  min-width: 92px;
}

#feas-question-table th:nth-child(5),
#feas-question-table td:nth-child(5) {
  min-width: 310px;
}

#feas-question-table th:nth-child(6),
#feas-question-table td:nth-child(6) {
  min-width: 340px;
}

#feas-question-table th:nth-child(7),
#feas-question-table td:nth-child(7) {
  min-width: 170px;
}

#feas-question-table th:nth-child(8),
#feas-question-table td:nth-child(8) {
  min-width: 82px;
}

#trends-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 0.74rem;
}

#trends-table th,
#trends-table td {
  padding: 0.34rem 0.45rem;
  border-bottom: 1px solid #e2eff9;
  vertical-align: top;
  text-align: left;
  max-width: 340px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#trends-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1d3f65;
  color: #e8f3ff;
  font-size: 0.69rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

#trends-table tr:nth-child(even) td {
  background: #fbfdff;
}

#trends-table td a {
  color: var(--blue-deep);
  font-weight: 700;
  text-decoration: none;
}

#trends-table td a:hover {
  text-decoration: underline;
}

body[data-theme="dark"] .modal-card {
  border-color: #375675;
  background: #142538;
  color: #d9ebff;
}

body[data-theme="dark"] .artifact-preview-content.preview-artifact {
  border-color: #375675;
  background: #0f2032;
  color: #d5e8fb;
}

body[data-theme="dark"] .artifact-preview-content.preview-questionnaire {
  border-color: #365676;
  background: linear-gradient(180deg, #101f31 0%, #122437 100%);
  color: #d6e9fb;
}

body[data-theme="dark"] .doc-header {
  border-color: #355675;
  background: linear-gradient(140deg, #16314a 0%, #1b3e61 100%);
}

body[data-theme="dark"] .doc-kicker {
  color: #9bc4e6;
}

body[data-theme="dark"] .doc-head-copy h2 {
  color: #e2f1ff;
}

body[data-theme="dark"] .doc-head-copy p {
  color: #c0daef;
}

body[data-theme="dark"] .doc-protocol {
  border-color: #355777;
  background: #122639;
}

body[data-theme="dark"] .doc-protocol-head h3 {
  color: #dff0ff;
}

body[data-theme="dark"] .doc-protocol-head span {
  color: #a8c8e5;
}

body[data-theme="dark"] .doc-protocol-grid > div {
  border-color: #335373;
  background: #173047;
}

body[data-theme="dark"] .doc-protocol-grid label {
  color: #a4c7e8;
}

body[data-theme="dark"] .doc-protocol-grid p {
  color: #e0f1ff;
}

body[data-theme="dark"] .doc-section {
  border-color: #335474;
  background: #12283b;
}

body[data-theme="dark"] .doc-section-head h4 {
  color: #deefff;
}

body[data-theme="dark"] .doc-section-head span {
  color: #a5c7e4;
}

body[data-theme="dark"] .doc-helper {
  color: #b1cfeb;
}

body[data-theme="dark"] .doc-question-item {
  border-color: #355677;
  background: #173147;
}

body[data-theme="dark"] .doc-question-index {
  background: #254b6d;
  color: #dcf0ff;
}

body[data-theme="dark"] .doc-question-type {
  border-color: #4a7093;
  background: #203f5d;
  color: #d4eafc;
}

body[data-theme="dark"] .doc-question-text {
  color: #e4f2ff;
}

body[data-theme="dark"] .doc-question-note {
  color: #c7dff4;
}

body[data-theme="dark"] .doc-question-note span {
  color: #9fd1f8;
}

body[data-theme="dark"] .doc-empty {
  border-color: #406485;
  background: #18344d;
  color: #c3def4;
}

body[data-theme="dark"] #trends-table th {
  background: #213c5a !important;
  color: #e6f2ff !important;
  border-bottom-color: #355472 !important;
}

body[data-theme="dark"] #trends-table td {
  border-bottom-color: #2e4862 !important;
  color: #d5e8fb !important;
}

body[data-theme="dark"] #trends-table tr:nth-child(even) td {
  background: #132638 !important;
}

body[data-theme="dark"] #trends-table td a {
  color: #93d1ff;
}

body[data-theme="dark"] .feas-question-input {
  border-color: #3b5f7d !important;
  background: #102133 !important;
  color: #d5e8fb !important;
}

body[data-theme="dark"] .feas-rationale-text {
  border-color: #365575;
  background: #11263a;
  color: #d4e8fa;
}

body[data-theme="dark"] .feas-priority-text {
  color: #d0e5f9;
}

body[data-theme="dark"] .feas-inline-toggle {
  color: #86c6f3;
}

body[data-theme="dark"] .feas-inline-toggle:hover {
  color: #a8dcff;
}

@media (max-width: 1120px) {
  .trends-chart-grid {
    grid-template-columns: 1fr;
  }

  .doc-protocol-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .doc-header {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .doc-protocol-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   RSI 3.0 — Animation & Transition Polish
   ============================================================ */

/* Tab panel fade-up on activation */
@keyframes rsi-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Building / loading pulse for status chips */
@keyframes rsi-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Selected filter pill entry */
@keyframes rsi-pill-in {
  from {
    opacity: 0;
    transform: scale(0.82);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.selected-pill {
  animation: rsi-pill-in 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Progress bar — smoother easing */
.progress-bar {
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* Table row hover — smooth, visible */
#results-table tbody tr,
#trends-table tbody tr {
  transition: background 0.12s ease;
}

#results-table tbody tr:hover,
#trends-table tbody tr:hover {
  background: rgba(209, 237, 255, 0.55);
}

/* Hero section — subtle fade-in on page load */
.hero {
  animation: rsi-fade-up 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tabs {
  animation: rsi-fade-up 0.38s 0.06s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Panel entry — staggered from hero */
.shell > .panel,
.shell > .status-panel,
.shell > .demo-mode-panel {
  animation: rsi-fade-up 0.34s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Results table — smooth row reveal */
.loading-indicator {
  transition: opacity 0.2s ease;
}

/* Investigator link — cleaner hover */
.investigator-link {
  transition: border-color 0.14s ease, color 0.14s ease;
}

/* Filter pill remove button hover */
.pill-remove {
  transition: background 0.14s ease, color 0.14s ease;
}

/* Status chip transition */
.status-chip {
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Management tab — skeleton pulse while data loads */
#mgmt-cards.loading .big {
  color: transparent;
  background: linear-gradient(90deg, #dcedf7 25%, #eef6fc 50%, #dcedf7 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: rsi-skel-shimmer 1.4s ease-in-out infinite;
  min-width: 3rem;
  display: inline-block;
  pointer-events: none;
  user-select: none;
}

@keyframes rsi-skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

body[data-theme="dark"] #mgmt-cards.loading .big {
  background: linear-gradient(90deg, #1e3a55 25%, #2a4f6e 50%, #1e3a55 75%);
  background-size: 200% 100%;
}

/* Respect reduced motion */
body[data-reduce-motion="1"] *,
body[data-reduce-motion="1"] *::before,
body[data-reduce-motion="1"] *::after {
  animation: none !important;
  transition: none !important;
}

/* ═══════════════════════════════════════════════════════════════════
   LINEA BRAND SYSTEM — Phase 2–11 overhaul
   All values sourced from LINEA-BRAND-GUIDELINES.md
   ═══════════════════════════════════════════════════════════════════ */

/* ── Custom diamond cursor (§7 full spec) ──────────────────────── */
/* v1.6.34: position with top/left + auto-center via translate(-50%,-50%)
   so the cursor visually sits AT the click point regardless of border
   width or box dimensions. Matches lineasystem.com pattern exactly. */
.cursor-d {
  position: fixed;
  top: 0; left: 0;
  width: 14px; height: 14px;
  border: 1.5px solid var(--blue);
  border-radius: 2px;
  pointer-events: none;
  /* MAX z-index, not 9999. `body { cursor: none }` above hides the real pointer
     and this element IS the pointer, so anything painting over it leaves the
     user with NO cursor at all, not a plain one. At 9999 it was occluded by
     four separate layers in this product (10000, 100000, and the settings
     drawer at 2147483000), which is what Nathan saw: the cursor vanishing over
     the settings panel. As a direct child of body it sits in the root stacking
     context, so the CSS maximum guarantees it always paints on top.
     AcceleTrial already carried this exact fix and its comment cites RSI's
     "cursor is never occluded" behaviour, which had quietly stopped being true
     here. */
  z-index: 2147483647;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(45deg);
  transition: width .15s var(--ease), height .15s var(--ease), opacity .2s, border-color .15s;
  will-change: top, left;
}
.cursor-d.exp { width: 20px; height: 20px; }
.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 4px; height: 4px;
  background: var(--blue);
  border-radius: 50%;
  pointer-events: none;
  /* MAX z-index, not 9999. `body { cursor: none }` above hides the real pointer
     and this element IS the pointer, so anything painting over it leaves the
     user with NO cursor at all, not a plain one. At 9999 it was occluded by
     four separate layers in this product (10000, 100000, and the settings
     drawer at 2147483000), which is what Nathan saw: the cursor vanishing over
     the settings panel. As a direct child of body it sits in the root stacking
     context, so the CSS maximum guarantees it always paints on top.
     AcceleTrial already carried this exact fix and its comment cites RSI's
     "cursor is never occluded" behaviour, which had quietly stopped being true
     here. */
  z-index: 2147483647;
  opacity: 0;
  transform: translate(-50%, -50%);
  will-change: top, left;
  transition: opacity .15s;
}
.cursor-dot.faded { opacity: .4 !important; }
@media (hover: none) { .cursor-d, .cursor-dot { display: none; } }

/* ── Nav live badge ─────────────────────────────────────────────── */
.live-badge {
  display: flex;
  align-items: center;
  gap: 5px;
}
.live-dot {
  width: 5px; height: 5px;
  background: rgba(93,175,226,.75);
  border-radius: 50%;
  animation: livePulse 2.4s ease infinite;
}
.live-text {
  font: 700 .60rem/1 var(--sans);
  letter-spacing: .25em;
  text-transform: uppercase;
  color: rgba(93,175,226,.70);
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(93,175,226,.5); }
  50%       { box-shadow: 0 0 0 5px rgba(93,175,226,0); }
}

/* Nav scrolled shadow — added via JS */
.app-header-wrap.scrolled {
  box-shadow: 0 2px 24px rgba(13,43,69,.40);
  transition: box-shadow .3s;
}

/* ── Scroll reveal system (§7 verbatim) ──────────────────────────  */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: .08s; }
.reveal-d2 { transition-delay: .16s; }
.reveal-d3 { transition-delay: .24s; }
.reveal-d4 { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { transition: opacity .3s; transform: none !important; }
  /* a11y (H-4): users who reduce motion (often overlapping with vision/motor
     accessibility needs) keep their own OS cursor; the custom diamond follower
     is disabled for them. No change for everyone else. */
  body { cursor: auto !important; }
  .cursor-d, .cursor-dot { display: none !important; }
}

/* ── a11y (M-5): visible keyboard focus ring. Only shows for keyboard
   navigation (:focus-visible), never on mouse click, so no change to normal
   mouse appearance. Uses the brand blue. ─────────────────────────────── */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue, #5dafe2);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── a11y (M-3): skip-to-content link. Hidden off-screen until a keyboard
   user focuses it (first Tab), then slides into view. Invisible to mouse
   users. ─────────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100000;
  background: var(--navy, #0d2b45);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 8px 0;
  font: 600 .85rem 'Inter', system-ui, sans-serif;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
  outline: 2px solid var(--blue, #5dafe2);
  outline-offset: 2px;
}

/* ── Tab switch animation ───────────────────────────────────────── */
@keyframes tabEnter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.tab-panel.active {
  animation: tabEnter .28s var(--ease) both !important;
}

/* ── Tab hero bands (inside each tab) ───────────────────────────── */
.tab-hero {
  background: var(--navy);
  border-radius: 12px;
  padding: 2.4rem 2.4rem 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(93,175,226,.07);
}
.tab-hero .th-eyebrow {
  display: block;
  font: 700 .68rem/1 var(--sans);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: .9rem;
}
.tab-hero h2 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
  font-weight: 400;
  color: #fff;
  letter-spacing: -.01em;
  margin: 0 0 .65rem;
  line-height: 1.15;
}
.tab-hero h2 em { font-style: italic; color: rgba(93,175,226,.80); }
.tab-hero p {
  font-size: .96rem;
  font-weight: 300;
  color: rgba(255,255,255,.52);
  max-width: 560px;
  margin: 0;
  line-height: 1.65;
}

/* ── Panel section labels (§10 verbatim) ────────────────────────── */
.panel-section-label {
  font: 700 .60rem/1 var(--sans);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(93,175,226,.55);
  margin-bottom: 1rem;
}

/* Eyebrow — universal (§3 verbatim) */
.brand-eyebrow {
  display: block;
  font: 700 .68rem/1 var(--sans);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: .9rem;
}

/* ── Dark data panel — wraps tables and KPI areas (§10) ─────────── */
.dark-panel {
  background: var(--navy);
  border-radius: 12px;
  padding: 1.6rem 2rem;
  border: 1px solid rgba(93,175,226,.08);
  color: rgba(255,255,255,.85);
}
.dark-panel + .dark-panel { margin-top: 1rem; }

/* Active panel accent — 2px blue top border */
.dark-panel.active-panel {
  border-top: 2px solid var(--blue);
}

/* ── Dark tables (§10 verbatim) ─────────────────────────────────── */
.dark-tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
}
.dark-tbl th {
  font: 700 .55rem/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.22);
  padding: 0 .9rem .45rem 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
  text-align: left;
  white-space: nowrap;
}
.dark-tbl th:last-child { padding-right: 0; }
.dark-tbl td {
  font-size: .72rem;
  color: rgba(255,255,255,.85);
  font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,.035);
  padding: .55rem .9rem .55rem 0;
  vertical-align: middle;
}
.dark-tbl td:last-child { padding-right: 0; }
.dark-tbl td.cell-secondary {
  font-size: .60rem;
  color: rgba(255,255,255,.28);
  font-weight: 400;
}
.dark-tbl td.cell-muted {
  font-size: .60rem;
  color: rgba(255,255,255,.28);
}
.dark-tbl td.cell-score {
  font-family: var(--serif);
  font-size: 1.4rem;
  color: var(--blue);
  font-weight: 400;
  line-height: 1;
}
/* Score intensity tiers */
.score-high { color: var(--blue) !important; }
.score-mid  { color: rgba(93,175,226,.65) !important; }
.score-low  { color: rgba(93,175,226,.40) !important; }

.dark-tbl tr:hover td { background: rgba(93,175,226,.06); }
.dark-tbl tr:last-child td { border-bottom: none; }

/* ── KPI stat chips — redesigned (§10) ──────────────────────────── */
.kpi-chip {
  background: var(--navy);
  border: 1px solid rgba(93,175,226,.10);
  border-radius: 10px;
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.kpi-chip-label {
  font: 700 .55rem/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.30);
}
.kpi-chip-value {
  font-family: var(--serif);
  font-size: 1.8rem;
  color: var(--blue);
  line-height: 1;
  font-weight: 400;
}
.kpi-chip-sub {
  font-size: .60rem;
  color: rgba(255,255,255,.28);
  font-weight: 400;
}
.kpi-chips-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

/* ── Feasibility scoring hero ────────────────────────────────────── */
.feas-score-hero {
  background: var(--navy);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  border: 1px solid rgba(93,175,226,.08);
  margin-bottom: 1.5rem;
}
.feas-score-hero .fsh-eyebrow {
  font: 700 .68rem/1 var(--sans);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 1.2rem;
  display: block;
}
.feas-score-value {
  font-family: var(--serif);
  font-size: 5rem;
  color: var(--blue);
  letter-spacing: -.02em;
  line-height: 1;
  display: block;
}
.feas-score-value.placeholder { color: rgba(255,255,255,.20); }
.feas-score-subtitle {
  font-size: .88rem;
  font-weight: 300;
  color: rgba(255,255,255,.45);
  margin-top: .6rem;
}
.feas-score-bar-wrap {
  width: min(400px, 80%);
  margin: 1.4rem auto 0;
}
.feas-score-bar {
  height: 5px;
  background: rgba(255,255,255,.07);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.feas-score-bar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 3px;
  width: 0;
  transition: width 1.2s var(--ease) .3s;
}

/* ── Progress bars (§10 verbatim) ────────────────────────────────── */
.brand-bar {
  height: 5px;
  background: rgba(255,255,255,.07);
  border-radius: 3px;
  overflow: hidden;
}
.brand-bar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 3px;
  width: 0;
  transition: width .9s var(--ease);
}
.reveal.in .brand-bar-fill { width: var(--bar-pct, 0%); }
/* Sub-scores */
.brand-bar-fill.sub { background: rgba(93,175,226,.62); }

/* Score breakdown row */
.score-row {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.score-row-item { }
.score-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.score-row-label {
  font: 700 .55rem/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.28);
}
.score-row-val {
  font: 600 .60rem/1 var(--sans);
  color: var(--blue);
}

/* ── 5-dot rating (§10 verbatim) ────────────────────────────────── */
.dot-rating {
  display: flex;
  gap: 3px;
  align-items: center;
}
.dot-rating .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.dot-rating .dot.filled { background: var(--blue); }
.dot-rating .dot.empty  { background: rgba(255,255,255,.10); }

/* ── Status pills (§2 verbatim) ─────────────────────────────────── */
.status-pill {
  font: 700 .56rem/1 var(--sans);
  padding: .18rem .5rem;
  border-radius: 3px;
  display: inline-block;
  white-space: nowrap;
}
.status-pill.done,
.status-pill.active   { background: rgba(93,175,226,.15);  color: #5dafe2; }
.status-pill.progress { background: rgba(80,180,120,.12);  color: rgba(80,200,130,.8); }
.status-pill.pending  { background: rgba(255,200,80,.10);  color: rgba(255,200,80,.8); }
.status-pill.risk     { background: rgba(220,80,60,.10);   color: rgba(220,100,80,.85); }

/* ── Specialty pills (coloured by cluster) ───────────────────────── */
.spec-pill {
  font: 700 .52rem/1 var(--sans);
  padding: .16rem .42rem;
  border-radius: 3px;
  display: inline-block;
  white-space: nowrap;
  background: rgba(93,175,226,.15);
  color: var(--blue);
}
.spec-pill.onco   { background: rgba(220,80,60,.12);  color: rgba(220,110,90,.90); }
.spec-pill.cardio { background: rgba(80,130,220,.15); color: rgba(100,165,240,.90); }
.spec-pill.neuro  { background: rgba(130,80,220,.12); color: rgba(165,120,240,.85); }
.spec-pill.hemato { background: rgba(220,160,60,.10); color: rgba(230,180,80,.85); }

/* ── Upload drag-and-drop area ───────────────────────────────────── */
.upload-drop {
  border: 2px dashed rgba(93,175,226,.25);
  border-radius: 10px;
  padding: 3rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-drop:hover,
.upload-drop.dragging {
  border-color: var(--blue);
  background: rgba(93,175,226,.04);
}
.upload-drop-icon {
  width: 36px; height: 36px;
  margin: 0 auto .9rem;
  background: var(--bg-faint);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.upload-drop-icon svg { stroke: var(--blue-mid); fill: none; stroke-width: 1.6; }
.upload-drop-title {
  font: 700 .78rem/1 var(--sans);
  color: rgba(255,255,255,.75);
  margin-bottom: .4rem;
}
.upload-drop-hint {
  font: .70rem/1.5 var(--sans);
  color: rgba(255,255,255,.35);
}

/* ── Run history pill strip ──────────────────────────────────────── */
.run-history-strip {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding-bottom: .4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(93,175,226,.18) transparent;
}
.run-pill {
  flex-shrink: 0;
  padding: .3rem .8rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 5px;
  font: 500 .68rem/1 var(--sans);
  color: rgba(255,255,255,.50);
  cursor: pointer;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
  background: transparent;
}
.run-pill:hover { border-color: rgba(93,175,226,.40); color: var(--blue); }
.run-pill.active { border-color: var(--blue); color: var(--blue); background: rgba(93,175,226,.08); }

/* ── Geographic region pills ─────────────────────────────────────── */
.geo-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .8rem;
}
.geo-pill {
  font: 700 .56rem/1 var(--sans);
  padding: .18rem .52rem;
  border-radius: 3px;
  background: rgba(93,175,226,.12);
  color: rgba(93,175,226,.80);
  white-space: nowrap;
}

/* ── Loading state — three dots ──────────────────────────────────── */
.brand-loading {
  display: flex;
  align-items: center;
  gap: 5px;
}
.brand-loading span {
  width: 6px; height: 6px;
  background: var(--blue);
  border-radius: 50%;
  animation: dotBounce 1.2s ease infinite;
}
.brand-loading span:nth-child(2) { animation-delay: .15s; }
.brand-loading span:nth-child(3) { animation-delay: .30s; }
@keyframes dotBounce {
  0%, 80%, 100% { opacity: .25; transform: scale(.8); }
  40%           { opacity: 1;   transform: scale(1); }
}

/* ── Empty state panel ────────────────────────────────────────────── */
.empty-state {
  background: var(--navy);
  border-radius: 12px;
  padding: 3.5rem 2rem;
  text-align: center;
  border: 1px solid rgba(93,175,226,.07);
}
.empty-state .es-eyebrow {
  font: 700 .60rem/1 var(--sans);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: rgba(93,175,226,.42);
  margin-bottom: .8rem;
  display: block;
}
.empty-state h3 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: rgba(255,255,255,.70);
  margin-bottom: .6rem;
}
.empty-state p {
  font-size: .82rem;
  font-weight: 300;
  color: rgba(255,255,255,.35);
  max-width: 340px;
  margin: 0 auto 1.4rem;
  line-height: 1.65;
}

/* ── Data freshness label ─────────────────────────────────────────── */
.freshness-label {
  font-size: .60rem;
  color: rgba(255,255,255,.28);
  font-weight: 400;
}

/* ── White panel on dark body ─────────────────────────────────────── */
.panel {
  box-shadow: 0 4px 40px rgba(0,0,0,.32);
}

/* ── Button states (§5 + §7 verbatim) ───────────────────────────── */
.btn.primary {
  background: var(--blue);
  border: 1.5px solid var(--blue);
  border-radius: var(--radius-btn);
  color: #fff;
  font: 700 .78rem/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .8rem 2rem;
  transition: background .2s, transform .15s, box-shadow .15s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.btn.primary:hover {
  background: var(--blue-mid);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(93,175,226,.30);
}

.btn.ghost {
  background: transparent;
  border: 1.5px solid var(--blue);
  color: var(--blue-mid);
  border-radius: var(--radius-btn);
  font: 700 .78rem/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .8rem 2rem;
  transition: background .2s, transform .15s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.btn.ghost:hover {
  background: var(--bg-faint);
  transform: translateY(-2px);
}

.btn.ghost-white {
  background: transparent;
  border: 1.5px solid rgba(93,175,226,.40);
  color: rgba(255,255,255,.75);
  border-radius: var(--radius-btn);
  font: 700 .78rem/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .72rem 2rem;
  transition: border-color .2s, color .2s, transform .15s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.btn.ghost-white:hover {
  border-color: rgba(93,175,226,.80);
  color: #fff;
  transform: translateY(-1px);
}

/* ── Investigator profile hero band ──────────────────────────────── */
.inv-hero {
  background: var(--navy);
  padding: 3rem 2.4rem 2.4rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(93,175,226,.07);
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}
.inv-hero-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 2px solid rgba(93,175,226,.30);
  background: var(--navy-light);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 1.8rem;
  color: var(--blue);
  filter: grayscale(100%) contrast(1.05);
  object-fit: cover;
  object-position: center 20%;
}
.inv-hero-text { flex: 1; }
.inv-hero-eyebrow {
  display: block;
  font: 700 .68rem/1 var(--sans);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: .7rem;
}
.inv-hero-name {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 400;
  color: #fff;
  letter-spacing: -.01em;
  line-height: 1.1;
  margin-bottom: .5rem;
}
.inv-hero-sub {
  font-size: .95rem;
  font-weight: 300;
  color: rgba(255,255,255,.52);
  max-width: 480px;
  line-height: 1.55;
}
.inv-hero-score { text-align: right; flex-shrink: 0; }
.inv-hero-score-val {
  font-family: var(--serif);
  font-size: 3.5rem;
  color: var(--blue);
  line-height: 1;
  display: block;
}
.inv-hero-score-lbl {
  font: 700 .52rem/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.28);
  margin-top: .3rem;
  display: block;
}

/* ── Management stats row ─────────────────────────────────────────── */
.mgmt-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ── Filter sidebar (Targeted List) ──────────────────────────────── */
.tl-filter-sidebar {
  background: var(--navy-light) !important;
  border: 1px solid rgba(93,175,226,.10) !important;
  border-radius: 10px !important;
}

/* ── Icon block (§5 verbatim) ─────────────────────────────────────── */
.icon-block {
  width: 36px; height: 36px;
  background: var(--bg-faint);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.1rem;
}
.icon-block svg { stroke: var(--blue-mid); fill: none; stroke-width: 1.6; width: 20px; height: 20px; }

/* ── Seamless grid card (§5) ─────────────────────────────────────── */
.seamless-grid {
  background: var(--border);
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
}
.seamless-cell {
  background: var(--bg);
  padding: 1.8rem;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .tab-hero { padding: 1.6rem; }
  .tab-hero h2 { font-size: 1.6rem; }
  .kpi-chips-row { grid-template-columns: repeat(2, 1fr); }
  .feas-score-value { font-size: 3.5rem; }
  .inv-hero { flex-direction: column; gap: 1rem; }
  .inv-hero-score { text-align: left; }
}

/* ══════════════════════════════════════════════════════════════════════
   RSI DB TABLE -- white background, overrides dark-theme !important rules
   ══════════════════════════════════════════════════════════════════════ */
#db-results .table-wrap {
  background: #ffffff !important;
}
#results-table thead tr th {
  background: linear-gradient(180deg, #f0f7ff, #e8f2fb) !important;
  color: #1a4d72 !important;
  border-bottom: 2px solid #c8dff0 !important;
}
#results-table tbody tr td {
  background: #ffffff !important;
  color: #1a2e40 !important;
  border-bottom-color: #e4eef8 !important;
}
#results-table tr:nth-child(even) td {
  background: #f4f9ff !important;
  color: #1a2e40 !important;
}
#results-table tr.results-row-link:hover td,
#results-table tr.results-row-link:focus-visible td {
  background: #dbeeff !important;
  color: #0f2035 !important;
  outline: none !important;
}
#results-table .investigator-link {
  color: #1a5a8a !important;
}

/* ══════════════════════════════════════════════════════════════════════
   TRENDS TAB — dark overhaul
   ══════════════════════════════════════════════════════════════════════ */

/* Chart grid + cards */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1rem;
  margin-bottom: 0;
}
.chart-card {
  background: var(--navy);
  border: 1px solid rgba(93,175,226,.08);
  border-radius: 12px;
  padding: 1.3rem 1.5rem .8rem;
  overflow: hidden;
  min-height: 320px;
}
.chart-card h4 {
  font: 700 .55rem/1 var(--sans) !important;
  letter-spacing: .13em !important;
  text-transform: uppercase !important;
  color: rgba(255,255,255,.22) !important;
  margin: 0 0 .9rem !important;
}

/* Intelligence brief panel */
.brief-panel {
  background: var(--navy);
  border: 1px solid rgba(93,175,226,.08);
  border-radius: 12px;
  overflow: hidden;
}

/* Controls panel override for trends context */
#tab-trends .dark-panel .lbl,
#tab-trends .dark-panel .lbl-sm {
  color: rgba(255,255,255,.38) !important;
}
#tab-trends .dark-panel option {
  background: #0d2b45;
  color: rgba(255,255,255,.80);
}

/* Pill row — dark */
#tab-trends .pill {
  background: rgba(255,255,255,.04) !important;
  border: 1px solid rgba(93,175,226,.14) !important;
  color: rgba(255,255,255,.50) !important;
}
#tab-trends .pill.active {
  background: rgba(93,175,226,.16) !important;
  border-color: var(--blue) !important;
  color: var(--blue) !important;
}
#tab-trends .pill:hover:not(.active) {
  background: rgba(93,175,226,.08) !important;
  color: rgba(255,255,255,.70) !important;
}

/* Trends news wrap table */
#trends-news-wrap.dark-panel .table-wrap {
  border-color: rgba(93,175,226,.08) !important;
  background: transparent !important;
}
#trends-news-wrap td {
  color: rgba(255,255,255,.75) !important;
  border-bottom: 1px solid rgba(255,255,255,.045) !important;
  background: transparent !important;
}
#trends-news-wrap tr:nth-child(even) td {
  background: rgba(255,255,255,.025) !important;
}
#trends-news-wrap tr:hover td {
  background: rgba(93,175,226,.07) !important;
}
#trends-news-wrap td a {
  color: var(--blue) !important;
}

/* Pagination bar + label in trends */
#tab-trends .pg-bar,
#tab-trends .muted {
  color: rgba(255,255,255,.38) !important;
}
#tab-trends .pg-label {
  color: rgba(255,255,255,.38) !important;
}
#tab-trends .btn.tiny {
  background: rgba(255,255,255,.05) !important;
  border-color: rgba(93,175,226,.14) !important;
  color: rgba(255,255,255,.55) !important;
}
#tab-trends .btn.tiny:disabled {
  opacity: .3 !important;
}

/* Loading + error states */
#trends-loading { color: rgba(255,255,255,.55); }
#trends-error   { color: #fbbf24 !important; }

/* ══════════════════════════════════════════════════════════════════════
   TRENDS — Immersive visualization components
   ══════════════════════════════════════════════════════════════════════ */

/* Signals row: type bars + state grid side-by-side */
.tld-signals-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 860px) {
  .tld-signals-row { grid-template-columns: 1fr; }
}

/* Signal type bars */
.tld-type-bars {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  margin-top: .6rem;
}
.tld-bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 2.8rem;
  gap: .55rem;
  align-items: center;
}
.tld-bar-label {
  font: 500 .72rem/1.2 var(--sans);
  color: rgba(255,255,255,.62);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tld-bar-track {
  height: 4px;
  background: rgba(255,255,255,.07);
  border-radius: 2px;
  overflow: hidden;
}
.tld-bar-fill {
  height: 100%;
  border-radius: 2px;
  width: 0;
  transition: width 1.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.tld-bar-stat {
  font-family: var(--serif);
  font-size: .88rem;
  color: var(--blue);
  line-height: 1;
  text-align: right;
}
.tld-bar-pct {
  font-family: var(--sans);
  font-size: .58rem;
  color: rgba(255,255,255,.28);
}

/* State grid */
.tld-state-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: .6rem;
}
.tld-state-cell {
  width: 34px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 .52rem/1 var(--sans);
  letter-spacing: .04em;
  cursor: default;
  transition: transform .15s, filter .15s;
}
.tld-state-cell:hover {
  transform: scale(1.18);
  filter: brightness(1.3);
  z-index: 2;
  position: relative;
}

/* Sparkline */
.tld-sparkline-card {
  padding: 1.4rem 2rem 1.2rem;
}
.tld-sparkline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .8rem;
}
.tld-sparkline-wrap {
  position: relative;
  height: 130px;
}
.tld-sparkline-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.tld-spk-line {
  stroke-dasharray: 9999;
  stroke-dashoffset: 9999;
}
.tld-period-labels {
  position: absolute;
  bottom: -1.3rem;
  left: 0; right: 0;
  pointer-events: none;
}
.tld-period-labels span {
  position: absolute;
  font: 400 .60rem/1 var(--sans);
  color: rgba(255,255,255,.28);
  transform: translateX(-50%);
}

/* Sponsor race */
.tld-sponsor-race {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  margin-top: .6rem;
}
.tld-spon-row {
  display: grid;
  grid-template-columns: 1.8rem 1fr 3rem;
  gap: .6rem;
  align-items: center;
}
.tld-spon-rank {
  font-family: var(--serif);
  font-size: 1rem;
  color: rgba(255,255,255,.22);
  line-height: 1;
  text-align: center;
}
.tld-spon-info {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.tld-spon-name {
  font: 500 .73rem/1.2 var(--sans);
  color: rgba(255,255,255,.75);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tld-spon-track {
  height: 3px;
  background: rgba(255,255,255,.06);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.tld-spon-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--blue-mid), var(--blue));
  border-radius: 2px;
  width: 0;
  transition: width 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.tld-spon-count {
  font-family: var(--serif);
  font-size: .85rem;
  color: var(--blue);
  text-align: right;
}

/* ══════════════════════════════════════════════════════════════════════
   READABILITY — Ensure labels, inputs, and text stay legible
   ══════════════════════════════════════════════════════════════════════ */
.lbl { color: var(--text-mid); font-size: .76rem; font-weight: 600; }
.dark-panel .lbl,
#tab-trends .lbl { color: rgba(255,255,255,.45) !important; }

/* Panel headings inside white panels — ensure dark text */
.panel h3, .panel h4 { color: var(--text); }

/* Muted text inside dark panels */
.dark-panel .muted { color: rgba(255,255,255,.40); }

/* Tab navigation links */
.tab { color: var(--text-mid); }
.tab.active { color: var(--text); }

/* ══════════════════════════════════════════════════════════════════════
   LIVE badge tweak — make AI badge fit
   ══════════════════════════════════════════════════════════════════════ */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font: 700 .55rem/1 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--blue);
  border: 1px solid rgba(93,175,226,.24);
  border-radius: 999px;
  padding: .22rem .55rem;
  white-space: nowrap;
}

/* ======================================================================
   RSI DB RESULTS BAR - white text since the tab area uses dark backgrounds
   ====================================================================== */
#db-results .results-bar {
  color: rgba(255,255,255,0.58) !important;
}
#db-results .results-bar strong {
  color: rgba(255,255,255,0.85) !important;
}
#db-results .results-bar .pg-label {
  color: rgba(255,255,255,0.45) !important;
}


/* ══════════════════════════════════════════════════════════════════
   RSI CINEMATIC HEADER  (v5 — 2026-04)
══════════════════════════════════════════════════════════════════ */

@keyframes gradShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Push shell down to clear full header height */
.shell { padding-top: 216px !important; }

/* Remove old header styles when new header is present */
#rsi-header-wrap .app-header { display: none !important; }

/* ── Outer wrapper ── */
.app-header-wrap {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9000;
  overflow: hidden;
  height: 216px;
  display: flex;
  flex-direction: column;
}

/* ── Animated gradient background ── */
.rsi-hdr-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    #071824 0%,
    #0d2b45 30%,
    #0e3358 55%,
    #0a2240 80%,
    #061420 100%
  );
  background-size: 300% 300%;
  animation: gradShift 18s ease infinite;
  z-index: 0;
}

/* ── Canvas layer ── */
.rsi-hdr-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0.88;
  pointer-events: none;
}

/* ── Top bar: logo row ── */
.rsi-topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 28px 0;
}

.rsi-topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rsi-topbar-brand .brand-logo {
  height: 28px;
  width: auto;
  filter: brightness(2.2) saturate(0.95) drop-shadow(0 0 8px rgba(93,175,226,.28));
}

/* ── Hero text block ── */
.rsi-hdr-hero {
  position: relative;
  z-index: 10;
  padding: 6px 28px 0;
  flex: 1;
}

.rsi-hdr-eyebrow {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(93,175,226,.7);
  margin-bottom: 2px;
}

.rsi-hdr-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.55rem, 2.2vw, 2.1rem);
  font-weight: 400;
  color: #ffffff;
  margin: 0 0 6px;
  line-height: 1.1;
}
.rsi-hdr-title em {
  font-style: italic;
  color: rgba(93,175,226,.88);
}

/* ── Live stats row ── */
.rsi-hdr-stats {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 0;
}
.rsi-hdr-stat {
  display: flex;
  flex-direction: column;
  padding-right: 20px;
}
.rsi-hdr-stat-val {
  font-family: 'DM Serif Display', serif;
  font-size: 1.05rem;
  color: #ffffff;
  line-height: 1;
}
.rsi-hdr-stat-lbl {
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.42);
  margin-top: 1px;
}
.rsi-hdr-stat-div {
  width: 1px;
  height: 28px;
  background: rgba(93,175,226,.22);
  margin: 0 20px 0 0;
  flex-shrink: 0;
}

/* ── Navigation bar ── */
.rsi-nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  gap: 0;
  padding: 0 20px;
  background: rgba(7,24,36,.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(93,175,226,.10);
  /* remove old tabs styling */
  border-radius: 0 !important;
  flex-wrap: wrap;
}

/* Override old .tabs styles */
#tab-bar.rsi-nav { background: rgba(7,24,36,.55) !important; padding: 0 20px !important; border-radius: 0 !important; gap: 0 !important; }

.rsi-navitem {
  position: relative;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,.52);
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 8px 16px 10px !important;
  cursor: pointer;
  transition: color 200ms ease;
  white-space: nowrap;
  outline: none;
  box-shadow: none !important;
}
.rsi-navitem:hover { color: rgba(255,255,255,.85); }

/* Active underline indicator */
.rsi-navitem::after {
  content: '';
  position: absolute;
  bottom: 0; left: 16px; right: 16px;
  height: 2px;
  background: rgba(93,175,226,.85);
  border-radius: 1px 1px 0 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 240ms cubic-bezier(0.16,1,0.3,1);
}
.rsi-navitem.active {
  color: #ffffff !important;
}
.rsi-navitem.active::after {
  transform: scaleX(1);
}

/* Admin-only tabs: dimmed but still visible (admin JS will enable them) */
.rsi-navitem-admin {
  opacity: 0.42;
  pointer-events: none;
}
.rsi-navitem-admin.rsi-admin-enabled {
  opacity: 1;
  pointer-events: auto;
}

/* Demo mode banner spacing */
#demo-mode-banner {
  top: 216px !important;
}

/* Make sure old .brand-logo outside header doesn't double-apply */
.rsi-topbar-brand .brand-logo { display: block; }
header.app-header .brand-logo { display: none; }

/* ─────────────────────────────────────── responsive ── */
@media (max-width: 768px) {
  .app-header-wrap { height: auto; min-height: 180px; }
  .shell { padding-top: 180px !important; }
  .rsi-hdr-title { font-size: 1.3rem; }
  .rsi-hdr-stats { gap: 0; }
  .rsi-navitem { padding: 6px 10px 8px !important; font-size: 0.68rem; }
  .rsi-navitem::after { left: 10px; right: 10px; }
  #demo-mode-banner { top: 180px !important; }
}


/* ══════════════════════════════════════════════════════════════════
   HEADER NAV FIX v6: kill old .tab pill style inside new nav
══════════════════════════════════════════════════════════════════ */

/* Nuclear override: any .tab button inside the new header nav */
#rsi-header-wrap .rsi-nav .tab,
#rsi-header-wrap .rsi-nav .tab:link,
#rsi-header-wrap .rsi-nav .tab:visited {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: rgba(255,255,255,.52) !important;
  padding: 8px 16px 10px !important;
  margin: 0 !important;
  font: 500 0.74rem 'Inter', sans-serif !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  min-width: 0 !important;
  outline: none !important;
  transition: color 200ms ease !important;
}
#rsi-header-wrap .rsi-nav .tab:hover {
  background: transparent !important;
  color: rgba(255,255,255,.85) !important;
}
#rsi-header-wrap .rsi-nav .tab.active {
  background: transparent !important;
  background-color: transparent !important;
  color: #ffffff !important;
  box-shadow: none !important;
}
/* Underline indicator (already defined, but ensure ::after shows) */
#rsi-header-wrap .rsi-nav .tab::after {
  content: '' !important;
  position: absolute !important;
  bottom: 0 !important; left: 16px !important; right: 16px !important;
  height: 2px !important;
  background: rgba(93,175,226,.85) !important;
  border-radius: 1px 1px 0 0 !important;
  transform: scaleX(0) !important;
  transform-origin: left center !important;
  transition: transform 240ms cubic-bezier(0.16,1,0.3,1) !important;
}
#rsi-header-wrap .rsi-nav .tab.active::after {
  transform: scaleX(1) !important;
}

/* ══════════════════════════════════════════════════════════════════
   TRENDS v6 — KPI strip, donut, gauge, pulse, sparkline
══════════════════════════════════════════════════════════════════ */

.tld-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
}
@media (max-width: 900px) { .tld-kpi-row { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 580px) { .tld-kpi-row { grid-template-columns: repeat(2,1fr); } }

.tld-kpi-chip {
  background: rgba(93,175,226,.06);
  border: 1px solid rgba(93,175,226,.14);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 200ms, background 200ms;
}
.tld-kpi-chip:hover { border-color: rgba(93,175,226,.32); background: rgba(93,175,226,.09); }

.tld-kpi-val {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.2rem;
  color: #ffffff;
  line-height: 1.1;
}
.tld-kpi-lbl {
  font: 600 0.58rem 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255,255,255,.30);
}

/* signal composition: bars + donut side by side */
.tld-comp-wrap {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
}
.tld-donut-wrap {
  flex-shrink: 0;
  position: relative;
  width: 110px;
  height: 110px;
}
.tld-donut-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  text-align: center;
  pointer-events: none;
}
.tld-donut-big {
  display: block;
  font-family: 'DM Serif Display', serif;
  font-size: 1.0rem;
  color: #fff;
  line-height: 1;
}
.tld-donut-sub {
  display: block;
  font: 600 0.52rem 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,.32);
  margin-top: 3px;
  max-width: 52px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* momentum gauge row */
.tld-gauge-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 680px) { .tld-gauge-row { grid-template-columns: 1fr; } }

.tld-gauge-panel, .tld-pulse-panel { display: flex; flex-direction: column; }
.tld-gauge-wrap { display: flex; flex-direction: column; align-items: center; padding: 0.4rem 0; }

/* signal pulse grid */
.tld-pulse-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  flex: 1;
  padding: 0.4rem 0;
}
@keyframes pulseDot {
  0%,100% { transform: scale(0.82); opacity: 0.55; }
  50%      { transform: scale(1.0);  opacity: 1.0; }
}
.tld-pulse-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  animation: pulseDot 2.2s ease-in-out infinite;
}
.tld-pulse-risk  { background: rgba(248,113,113,.65); }
.tld-pulse-opp   { background: rgba(52,211,153,.60); }
.tld-pulse-other { background: rgba(93,175,226,.38); }

/* consistent spacing */
.dark-panel { padding: 1.1rem 1.2rem; }
.panel-section-label {
  display: block;
  font: 700 0.58rem 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(93,175,226,.7);
  margin-bottom: 0.7rem;
}
.sbar-list { min-height: 100px; }


/* ══════════════════════════════════════════════════════════════════
   HEADER CLEAN v7 — CSS-only, no canvas in header
   52px logo row + 40px nav row = 92px
══════════════════════════════════════════════════════════════════ */

#rsi-header-wrap.app-header-wrap {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important;
  z-index: 9000 !important;
  display: flex !important;
  flex-direction: column !important;
  height: auto !important;
  overflow: visible !important;
  background: linear-gradient(160deg, #07192a 0%, #0d2b45 50%, #071e34 100%) !important;
  border-bottom: 1px solid rgba(93,175,226,.18) !important;
  box-shadow: 0 2px 28px rgba(0,0,0,.40) !important;
}

/* Nuke any old conflicting canvas/hero elements left in the DOM */
#rsi-header-wrap .rsi-hdr-bg,
#rsi-header-wrap .rsi-hdr-canvas,
#rsi-header-wrap .rsi-hdr-hero { display: none !important; }

/* ── Logo row ── */
#rsi-header-wrap .rsi-topbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 24px !important;
  height: 52px !important;
  flex-shrink: 0 !important;
}
#rsi-header-wrap .rsi-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
#rsi-header-wrap .brand-logo {
  height: 22px !important;
  width: auto !important;
  filter: brightness(2.1) saturate(0.9) !important;
  display: block !important;
}
#rsi-header-wrap .rsi-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
#rsi-header-wrap .auth-chip {
  color: rgba(255,255,255,.55) !important;
  font-size: 0.75rem !important;
  background: transparent !important;
}
#rsi-header-wrap .auth-chip strong { color: rgba(255,255,255,.82) !important; }

/* db count chip next to logo */
.rsi-db-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 2px 9px;
  background: rgba(93,175,226,.09);
  border: 1px solid rgba(93,175,226,.18);
  border-radius: 20px;
}
.rsi-db-count {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 0.82rem;
  color: rgba(93,175,226,.92);
  line-height: 1;
}
.rsi-db-label {
  font: 500 0.57rem 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,.30);
}

/* ── Nav row ── */
#rsi-header-wrap .rsi-nav {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  height: 40px !important;
  padding: 0 16px !important;
  margin: 0 !important;
  background: rgba(0,0,0,.25) !important;
  border-top: 1px solid rgba(93,175,226,.10) !important;
  border-radius: 0 !important;
  gap: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  flex-wrap: nowrap !important;
  flex-shrink: 0 !important;
}
#rsi-header-wrap .rsi-nav::-webkit-scrollbar { display: none !important; }

/* ── Nav buttons: kill old .tab pill style completely ── */
#rsi-header-wrap .rsi-nav .tab,
#rsi-header-wrap .rsi-nav .rsi-navitem {
  all: unset !important;
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  height: 40px !important;
  padding: 0 14px !important;
  margin: 0 !important;
  color: rgba(255,255,255,.46) !important;
  font: 500 0.72rem 'Inter', sans-serif !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: color 160ms ease !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  flex-shrink: 0 !important;
  -webkit-tap-highlight-color: transparent !important;
}
#rsi-header-wrap .rsi-nav .tab:hover { color: rgba(255,255,255,.82) !important; }
#rsi-header-wrap .rsi-nav .tab.active { color: #ffffff !important; }

/* underline indicator */
#rsi-header-wrap .rsi-nav .tab::after {
  content: '' !important;
  position: absolute !important;
  bottom: 0 !important; left: 14px !important; right: 14px !important;
  height: 2px !important;
  background: rgba(93,175,226,.9) !important;
  border-radius: 1px 1px 0 0 !important;
  transform: scaleX(0) !important;
  transform-origin: left !important;
  transition: transform 220ms cubic-bezier(0.16,1,0.3,1) !important;
}
#rsi-header-wrap .rsi-nav .tab.active::after { transform: scaleX(1) !important; }

/* admin-only tabs */
#rsi-header-wrap .rsi-navitem-admin {
  opacity: 0.35 !important;
  pointer-events: none !important;
}
#rsi-header-wrap .rsi-navitem-admin.rsi-admin-enabled {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* ── Shell + banner offset ── */
.shell { padding-top: 92px !important; }
#demo-mode-banner { top: 92px !important; }

@media (max-width: 768px) {
  #rsi-header-wrap .rsi-topbar { padding: 0 14px !important; }
  .rsi-db-chip { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════
   LINEA WEBSITE-STYLE HEADER  (v8 — 2026-04)
   Matches lineasystem.com: white bg, logo left, nav centre, CTA right
   Single 64px row — no second nav bar
══════════════════════════════════════════════════════════════════ */

/* ── Wrapper ── */
#rsi-header-wrap.app-header-wrap {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important;
  z-index: 9000 !important;
  height: auto !important;
  overflow: visible !important;
  background: #ffffff !important;
  border-bottom: 1px solid rgba(0,0,0,.10) !important;
  box-shadow: 0 1px 16px rgba(0,0,0,.08) !important;
}

/* ── Main navbar row ── */
#rsi-header-wrap .ln-navbar {
  display: flex !important;
  align-items: center !important;
  height: 64px !important;
  padding: 0 28px !important;
  gap: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
}

/* ── Logo group ── */
#rsi-header-wrap .ln-logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-right: 32px;
}
#rsi-header-wrap .brand-logo {
  height: 28px !important;
  width: auto !important;
  display: block !important;
  filter: none !important;
}
#rsi-header-wrap .live-badge {
  background: rgba(93,175,226,.12) !important;
  border: 1px solid rgba(93,175,226,.28) !important;
}
.ln-db-count {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 2px 8px;
  background: rgba(93,175,226,.06);
  border: 1px solid rgba(93,175,226,.15);
  border-radius: 20px;
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 0.82rem;
  color: #0d2b45;
}
.ln-db-label {
  font: 500 0.56rem 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(13,43,69,.45);
}

/* ── Centre nav items ── */
#rsi-header-wrap .ln-nav-items {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0;
  flex: 1;
}

/* Individual nav items — matches website style */
#rsi-header-wrap .ln-navitem,
#rsi-header-wrap .ln-nav-items .tab {
  all: unset !important;
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  height: 64px !important;
  padding: 0 14px !important;
  font: 600 0.72rem 'Inter', sans-serif !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: #1a2e40 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: color 150ms ease !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
}
#rsi-header-wrap .ln-navitem:hover,
#rsi-header-wrap .ln-nav-items .tab:hover {
  color: #5dafe2 !important;
}
#rsi-header-wrap .ln-navitem.active,
#rsi-header-wrap .ln-nav-items .tab.active {
  color: #0d2b45 !important;
}
/* Active underline — same as website */
#rsi-header-wrap .ln-navitem::after,
#rsi-header-wrap .ln-nav-items .tab::after {
  content: '' !important;
  position: absolute !important;
  bottom: 0 !important;
  left: 14px !important; right: 14px !important;
  height: 2px !important;
  background: #5dafe2 !important;
  border-radius: 1px 1px 0 0 !important;
  transform: scaleX(0) !important;
  transform-origin: left !important;
  transition: transform 200ms cubic-bezier(0.16,1,0.3,1) !important;
}
#rsi-header-wrap .ln-navitem.active::after,
#rsi-header-wrap .ln-nav-items .tab.active::after {
  transform: scaleX(1) !important;
}

/* ── Tools dropdown ── */
#rsi-header-wrap .ln-dropdown {
  position: relative;
  height: 64px;
  display: flex;
  align-items: center;
}
#rsi-header-wrap .ln-dropdown-trigger {
  gap: 4px !important;
}
#rsi-header-wrap .ln-caret {
  font-size: 0.65rem;
  transition: transform 180ms ease;
  display: inline-block;
}
#rsi-header-wrap .ln-dropdown.open .ln-caret {
  transform: rotate(180deg);
}
#rsi-header-wrap .ln-dropdown-menu {
  position: absolute !important;
  top: calc(100% + 2px) !important;
  left: 0 !important;
  min-width: 160px !important;
  background: #ffffff !important;
  border: 1px solid rgba(0,0,0,.10) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.12) !important;
  padding: 6px 0 !important;
  z-index: 10000 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-6px) !important;
  transition: opacity 160ms ease, transform 160ms ease !important;
}
#rsi-header-wrap .ln-dropdown.open .ln-dropdown-menu {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(0) !important;
}
#rsi-header-wrap .ln-drop-item {
  all: unset !important;
  display: block !important;
  width: 100% !important;
  padding: 9px 16px !important;
  font: 500 0.78rem 'Inter', sans-serif !important;
  color: #1a2e40 !important;
  cursor: pointer !important;
  transition: background 120ms ease, color 120ms ease !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
}
#rsi-header-wrap .ln-drop-item:hover {
  background: rgba(93,175,226,.08) !important;
  color: #5dafe2 !important;
}
#rsi-header-wrap .ln-drop-item.active {
  color: #5dafe2 !important;
  font-weight: 700 !important;
}
#rsi-header-wrap .ln-navitem-tools-active {
  color: #5dafe2 !important;
}
#rsi-header-wrap .ln-navitem-tools-active::after {
  transform: scaleX(1) !important;
}

/* ── Right tools ── */
#rsi-header-wrap .ln-right-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}
#rsi-header-wrap .ln-user-chip {
  font: 500 0.75rem 'Inter', sans-serif;
  color: rgba(13,43,69,.55);
}
#rsi-header-wrap .ln-user-name {
  font-weight: 700;
  color: #0d2b45;
}
#rsi-header-wrap .ln-demo-btn.btn.tiny {
  background: transparent !important;
  border: 1px solid rgba(13,43,69,.20) !important;
  color: #1a2e40 !important;
  border-radius: 6px !important;
  font: 500 0.72rem 'Inter', sans-serif !important;
  padding: 5px 12px !important;
  cursor: pointer !important;
  transition: border-color 150ms, color 150ms !important;
}
#rsi-header-wrap .ln-demo-btn.btn.tiny:hover {
  border-color: #5dafe2 !important;
  color: #5dafe2 !important;
}

/* CTA button — matches "REQUEST DEMO" on website */
#rsi-header-wrap .ln-cta-btn {
  all: unset !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 8px 18px !important;
  background: #5dafe2 !important;
  color: #ffffff !important;
  font: 700 0.72rem 'Inter', sans-serif !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: background 150ms ease, transform 150ms ease !important;
  white-space: nowrap !important;
}
#rsi-header-wrap .ln-cta-btn:hover {
  background: #4a9fd4 !important;
  transform: translateY(-1px) !important;
}

/* Lang dropdown on light bg */
#rsi-header-wrap .lang-btn {
  color: #1a2e40 !important;
  background: transparent !important;
  border: 1px solid rgba(13,43,69,.15) !important;
  border-radius: 6px !important;
}
#rsi-header-wrap .lang-btn:hover { border-color: #5dafe2 !important; }
#rsi-header-wrap .lang-menu { top: calc(100% + 4px) !important; }

/* ── Shell offset ── */
.shell { padding-top: 64px !important; }
#demo-mode-banner { top: 64px !important; }

/* auth-chip hidden — replaced by ln-user-chip */
#rsi-header-wrap .auth-chip { display: none !important; }

/* old rsi-nav, rsi-hdr-* — nuke any remnants */
#rsi-header-wrap .rsi-nav,
#rsi-header-wrap .rsi-hdr-bg,
#rsi-header-wrap .rsi-hdr-canvas,
#rsi-header-wrap .rsi-hdr-hero { display: none !important; }

@media (max-width: 900px) {
  #rsi-header-wrap .ln-navbar { padding: 0 16px !important; }
  #rsi-header-wrap .ln-db-count { display: none; }
  #rsi-header-wrap .ln-user-chip { display: none; }
}


/* ══════════════════════════════════════════════════════════════════
   MANAGEMENT v2 — Complete Overhaul
   Dark luxury panels · animated KPIs · Leaflet maps · ECharts
══════════════════════════════════════════════════════════════════ */

/* ── Hero ──────────────────────────────────────────────────────── */
.m2-hero {
  padding: 48px 40px 36px;
  background: linear-gradient(135deg, #071929 0%, #0d2b45 55%, #071e34 100%);
  border-radius: 16px;
  border: 1px solid rgba(93,175,226,.14);
  position: relative;
  overflow: hidden;
}
.m2-hero::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 380px; height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(93,175,226,.09) 0%, transparent 65%);
  pointer-events: none;
}
.m2-hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(93,175,226,.05) 0%, transparent 70%);
  pointer-events: none;
}
.m2-hero-eyebrow {
  display: block;
  font: 700 0.66rem 'Inter', sans-serif;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: rgba(93,175,226,.70);
  margin-bottom: 12px;
}
.m2-hero-title {
  font: 400 2.8rem 'DM Serif Display', Georgia, serif;
  color: #ffffff;
  line-height: 1.12;
  margin: 0 0 14px;
}
.m2-hero-sub {
  font: 400 1.05rem 'Inter', sans-serif;
  color: rgba(255,255,255,.50);
  margin: 0;
}
.m2-hero-sub span {
  font-weight: 600;
  color: #5dafe2;
}

/* ── KPI Strip ─────────────────────────────────────────────────── */
.m2-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}
@media (max-width: 1100px) { .m2-kpi-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .m2-kpi-strip { grid-template-columns: repeat(2, 1fr); } }

.m2-kpi-card {
  background: linear-gradient(150deg, #0c2540 0%, #071929 100%);
  border: 1px solid rgba(93,175,226,.16);
  border-radius: 14px;
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  cursor: default;
}
.m2-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(93,175,226,.5), transparent);
  opacity: 0;
  transition: opacity 200ms ease;
}
.m2-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0,0,0,.40);
  border-color: rgba(93,175,226,.32);
}
.m2-kpi-card:hover::before { opacity: 1; }
.m2-kpi-card--accent {
  background: linear-gradient(150deg, #1a2a10 0%, #0f1c0a 100%);
  border-color: rgba(240,180,41,.18);
}
.m2-kpi-card--accent:hover { border-color: rgba(240,180,41,.40); }
.m2-kpi-card--accent::before {
  background: linear-gradient(90deg, transparent, rgba(240,180,41,.5), transparent);
}
.m2-kpi-icon { display: flex; align-items: center; margin-bottom: 2px; }
.m2-kpi-val {
  font: 400 2.2rem 'DM Serif Display', Georgia, serif;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -.01em;
}
.m2-kpi-gold { color: #f0b429 !important; }
.m2-kpi-lbl {
  font: 600 0.70rem 'Inter', sans-serif;
  color: rgba(255,255,255,.72);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.m2-kpi-sub {
  font: 400 0.65rem 'Inter', sans-serif;
  color: rgba(255,255,255,.28);
}

/* ── Section (map wrapper) ─────────────────────────────────────── */
.m2-section {
  background: linear-gradient(150deg, #0c2540 0%, #071929 100%);
  border: 1px solid rgba(93,175,226,.13);
  border-radius: 16px;
  padding: 24px;
}
.m2-section-hdr {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.m2-eyebrow {
  display: block;
  font: 700 0.62rem 'Inter', sans-serif;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: rgba(93,175,226,.62);
  margin-bottom: 4px;
}
.m2-section-title {
  font: 400 1.5rem 'DM Serif Display', Georgia, serif;
  color: #fff;
  margin: 0;
}
.m2-map-hint {
  font: 400 0.70rem 'Inter', sans-serif;
  color: rgba(255,255,255,.30);
  white-space: nowrap;
  padding-bottom: 2px;
}

/* ── Two-column grid ───────────────────────────────────────────── */
.m2-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) { .m2-grid2 { grid-template-columns: 1fr; } }

/* ── Panel card ────────────────────────────────────────────────── */
.m2-panel {
  background: linear-gradient(150deg, #0c2540 0%, #071929 100%);
  border: 1px solid rgba(93,175,226,.13);
  border-radius: 14px;
  padding: 22px;
}
.m2-panel-hdr { margin-bottom: 4px; }
.m2-panel-title {
  font: 400 1.18rem 'DM Serif Display', Georgia, serif;
  color: #fff;
  margin: 0;
}

/* ── Map wrapper ───────────────────────────────────────────────── */
.m2-map-wrap {
  background: #050f1a;
}

/* ── Leaflet tooltip ───────────────────────────────────────────── */
.leaflet-tooltip.m2-tip {
  background: rgba(5,15,26,0.97) !important;
  border: 1px solid rgba(93,175,226,.32) !important;
  border-radius: 8px !important;
  color: rgba(255,255,255,.90) !important;
  font: 600 0.78rem 'Inter', sans-serif !important;
  padding: 7px 13px !important;
  box-shadow: 0 6px 20px rgba(0,0,0,.55) !important;
  white-space: nowrap;
}
.leaflet-tooltip.m2-tip::before { display: none !important; }

/* Leaflet zoom controls */
.m2-map-wrap .leaflet-control-zoom a {
  background: rgba(10,32,53,.95) !important;
  border-color: rgba(93,175,226,.24) !important;
  color: rgba(255,255,255,.78) !important;
  font-weight: 600;
}
.m2-map-wrap .leaflet-control-zoom a:hover {
  background: rgba(93,175,226,.18) !important;
  color: #fff !important;
}
.m2-map-wrap .leaflet-control-attribution {
  background: rgba(5,15,26,.75) !important;
  color: rgba(255,255,255,.35) !important;
  font-size: 9px !important;
}
.m2-map-wrap .leaflet-control-attribution a {
  color: rgba(93,175,226,.70) !important;
}

/* ── Country list ──────────────────────────────────────────────── */
.m2-country-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 14px;
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(93,175,226,.22) transparent;
  padding-right: 4px;
}
.m2-country-list::-webkit-scrollbar { width: 4px; }
.m2-country-list::-webkit-scrollbar-track { background: transparent; }
.m2-country-list::-webkit-scrollbar-thumb { background: rgba(93,175,226,.22); border-radius: 2px; }

.m2-cntry-row {
  display: grid;
  grid-template-columns: 22px 22px 1fr auto auto;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 7px;
  transition: background 120ms;
}
.m2-cntry-row:hover { background: rgba(93,175,226,.07); }
.m2-cntry-rank {
  font: 600 0.66rem 'Inter', monospace;
  color: rgba(255,255,255,.26);
  text-align: right;
}
.m2-cntry-flag { font-size: 0.95rem; line-height: 1; text-align: center; }
.m2-cntry-name {
  font: 600 0.75rem 'Inter', sans-serif;
  color: rgba(255,255,255,.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m2-cntry-track {
  height: 4px;
  background: rgba(93,175,226,.10);
  border-radius: 2px;
  overflow: hidden;
  min-width: 36px;
}
.m2-cntry-fill {
  height: 100%;
  background: linear-gradient(90deg, #1a5a8a, #5dafe2);
  border-radius: 2px;
  transition: width 1s cubic-bezier(0.22,1,0.36,1);
}
.m2-cntry-count {
  font: 600 0.72rem 'Inter', monospace;
  color: rgba(93,175,226,.88);
  white-space: nowrap;
  text-align: right;
  min-width: 56px;
}
