:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --ink: #17202a;
  --muted: #657386;
  --line: #d9e0e8;
  --border: #d9e0e8;
  --accent: #1f5fbf;
  --accent-dark: #17498f;
  --ok: #16794c;
  --err: #b42332;
  --shadow: 0 14px 34px rgba(21, 34, 52, 0.075);
  --radius: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

body {
  padding-bottom: 10.5rem;
  overflow-x: hidden;
}

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

img,
svg {
  max-width: 100%;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2rem;
}

.hero {
  padding: 2.2rem 0 1.4rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

.hero-kicker {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.65rem;
}

h1 {
  max-width: 920px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.04;
  font-weight: 750;
  letter-spacing: 0;
  margin: 0;
}

.hero-sub {
  max-width: 760px;
  color: #435062;
  font-size: 1.06rem;
  line-height: 1.55;
  margin: 1rem 0 1.1rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.32rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.84rem;
}

.hero-meta strong {
  color: var(--ink);
  margin-left: 0.25rem;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.kpi-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: 0 6px 18px rgba(23, 32, 42, 0.05);
}

.kpi-wide {
  grid-column: 1 / -1;
}

.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.kpi-item strong {
  display: block;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.15;
  font-weight: 750;
}

.kpi-item small {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
}

.kpi-link {
  color: var(--ink);
  text-decoration: none;
}

.kpi-link:hover {
  border-color: #b8c8dc;
  background: #f8fbff;
}

section {
  margin: 1rem 0;
}

.demo-entry,
.technical-panel,
.scope-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.demo-entry,
.technical-panel {
  padding: 1.15rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: end;
  margin-bottom: 1rem;
}

.section-head h2,
.scope-block h2 {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
  margin: 0;
}

.section-head p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.feature-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 250px;
  padding: 1rem;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.feature-card:last-child {
  border-right: 0;
}

.feature-card h3 {
  margin: 0 0 0.55rem;
  font-size: 1.08rem;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.feature-action {
  width: 100%;
  text-align: center;
  margin-top: 1rem;
}

.scope-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.scope-block {
  padding: 1rem 1.15rem;
}

.muted-scope {
  background: #fbfcfd;
}

.plain-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 1rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.plain-list li {
  position: relative;
  padding-left: 1rem;
  color: #425166;
  font-size: 0.92rem;
  line-height: 1.35;
}

.plain-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 999px;
  background: var(--accent);
}

.technical-panel {
  margin-top: 1.2rem;
}

.technical-panel h3 {
  margin: 1.35rem 0 0.65rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.technical-panel h3:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

label {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0.4rem 0 0.2rem;
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: end;
}

.row > div {
  flex: 1 1 150px;
  min-width: 0;
}

.btn {
  display: inline-block;
  padding: 0.52rem 0.75rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
  line-height: 1.2;
  margin: 0.2rem 0.35rem 0.2rem 0;
  transition: background 0.14s ease, border 0.14s ease, transform 0.14s ease;
}

.btn:hover {
  background: #f2f6fb;
  border-color: #b9c7d8;
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn.danger {
  background: #fff4f4;
  border-color: #f0b7bd;
  color: var(--err);
}

.btn.ghost {
  background: transparent;
  border-color: #c6d2df;
  color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.45rem 0.65rem;
}

.muted {
  color: var(--muted);
  font-size: 0.82rem;
}

#log-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 9.5rem;
  min-height: 7.5rem;
  display: flex;
  flex-direction: column;
  background: #111820;
  border-top: 1px solid #2a3644;
  z-index: 50;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

#log-dock .hd {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  background: #182331;
  border-bottom: 1px solid #2a3644;
  color: #e7edf4;
  font-size: 0.85rem;
}

#log-dock h3 {
  margin: 0 0.75rem 0 0;
  font-size: 0.9rem;
  font-weight: 650;
}

#log-dock .job-select {
  flex: 0 0 auto;
  min-width: 8rem;
  width: auto;
  margin-right: 0.5rem;
  background: #101720;
  border-color: #334255;
  color: #e7edf4;
}

#log-dock .status {
  color: var(--ok);
  font-size: 0.8rem;
  margin-left: 0.25rem;
}

#log-dock .status.err {
  color: #ffb4be;
}

#log-out {
  flex: 1 1 0;
  min-height: 0;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 0.5rem 0.75rem;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c8d4e0;
  background: #0b0f15;
  border: none;
  resize: none;
}

#log-dock .resize {
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 8px;
  cursor: row-resize;
  background: transparent;
}

kbd {
  font-size: 0.8em;
  background: #eef2f6;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--line);
}

ul.tasks {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.86rem;
}

ul.tasks li {
  margin: 0.2rem 0;
}

.hint {
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 0.5rem;
  line-height: 1.45;
}

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

  .feature-card {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .feature-card:nth-child(odd) {
    border-right: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 9rem;
  }

  .wrap {
    padding: 0.9rem 0.8rem 1.5rem;
  }

  .hero {
    padding-top: 1.4rem;
  }

  .kpi-strip,
  .scope-grid,
  .feature-grid,
  .plain-list {
    grid-template-columns: 1fr;
  }

  .feature-card,
  .feature-card:nth-child(odd) {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .feature-card:last-child {
    border-bottom: 0;
  }

  .section-head {
    display: block;
  }

  .section-head p {
    margin-top: 0.45rem;
  }

  #log-dock {
    height: 8.5rem;
    min-height: 7rem;
  }
}

body.unified {
  padding-bottom: 0;
}

.app-shell-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.app-shell-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.8rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  color: var(--ink);
  text-decoration: none;
  min-width: 220px;
}

.brand-title {
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.1;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  color: #29425f;
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
  background: #e8f0fe;
  color: var(--accent-dark);
}

.app-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.2rem 1.25rem 3rem;
}

.client-hero,
.page-heading {
  padding: 1.6rem 0 1rem;
}

.client-hero h1,
.page-heading h1 {
  max-width: 980px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
  margin: 0;
}

.page-heading h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead {
  max-width: 760px;
  color: #435062;
  font-size: 1rem;
  line-height: 1.55;
  margin: 0.8rem 0 0;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.08rem;
  margin: 1rem 0;
}

.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.section-title-row h2,
.section-card > h2 {
  margin: 0;
  font-size: 1.08rem;
}

.section-title-row p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.client-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.client-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  padding: 1rem;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  border-right: 1px solid var(--line);
}

.client-card:last-child {
  border-right: 0;
}

.client-card:hover {
  background: #f8fbff;
}

.client-card h3 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
}

.client-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.client-card span {
  margin-top: 1rem;
  color: var(--accent-dark);
  font-weight: 750;
}

.unified-kpis {
  margin: 0.5rem 0 1rem;
}

.unified-scope {
  margin-top: 1rem;
}

.product-hero {
  display: flex;
  align-items: flex-end;
  min-height: 260px;
  padding: 2rem 0 1.2rem;
  border-bottom: 1px solid var(--line);
}

.product-hero h1 {
  max-width: 980px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.2rem;
}

.product-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}

.product-map-card {
  display: flex;
  min-height: 190px;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(23, 32, 42, 0.05);
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.product-map-card:hover {
  border-color: #b8c8dc;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(23, 32, 42, 0.08);
}

.product-map-card span {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.product-map-card h2 {
  margin: auto 0 0.55rem;
  font-size: 1.12rem;
  line-height: 1.16;
}

.product-map-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.product-map-card.primary-card {
  border-left: 4px solid var(--accent);
}

.insurer-focus-section {
  margin: 1rem 0;
}

.insurer-focus-section > .section-title-row {
  margin: 0 0 0.85rem;
}

.insurer-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.insurer-score-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.insurer-score-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.card-action-row {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.insurer-score-card h3 {
  margin: 0.12rem 0 0;
  color: #113c78;
  font-size: 1.18rem;
  line-height: 1.16;
}

.insurer-card-label,
.insurer-volume span,
.metric-tile span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.insurer-volume {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.2rem;
}

.insurer-volume strong {
  color: var(--ink);
  font-size: 1.75rem;
  line-height: 1;
}

.target-progress {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  background: #f8fbff;
}

.target-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.target-progress-head span,
.target-progress small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.25;
}

.target-progress-head span {
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.target-progress-head strong {
  color: #113c78;
  font-size: 1rem;
  font-weight: 900;
}

.target-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf7;
}

.target-track span {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: #188453;
}

.outcome-meter {
  display: flex;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.outcome-meter span {
  display: block;
  min-width: 2px;
  height: 100%;
}

.meter-positive {
  background: #188453;
}

.meter-negative {
  background: #b42332;
}

.meter-waiting {
  background: #d08a00;
}

.meter-review {
  background: #64748b;
}

.insurer-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.metric-tile {
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid #e3e9f0;
  border-radius: 8px;
  background: #f8fafc;
}

.metric-tile strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.metric-tile small {
  display: block;
  margin-top: 0.26rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.2;
}

.metric-tile.positive strong {
  color: #17683a;
}

.metric-tile.negative strong {
  color: #a2312d;
}

.metric-tile.waiting strong {
  color: #9a6500;
}

.metric-tile.review strong {
  color: #475569;
}

.target-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-left: 4px solid #2563c7;
}

.target-summary-card div {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  min-width: 0;
}

.target-summary-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.target-summary-card strong {
  color: #113c78;
  font-size: 1.55rem;
  font-weight: 950;
  line-height: 1;
}

.target-summary-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.35;
  text-align: right;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  color: #3d4b5d;
  font-size: 0.84rem;
  font-weight: 650;
}

.filter-bar input,
.filter-bar select {
  min-height: 2.25rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #1d3b5f;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn.secondary {
  background: #f8fafc;
}

.btn.compact {
  min-height: 1.8rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
}

.clean-table {
  width: 100%;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.clean-table table {
  width: 100%;
  min-width: 760px;
}

.clean-table.compact-table table {
  min-width: 0;
  table-layout: fixed;
}

.table-wrap.compact-table {
  overflow-x: visible;
}

.clean-table.compact-table th:first-child,
.clean-table.compact-table td:first-child {
  width: auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.clean-table.compact-table th:last-child,
.clean-table.compact-table td:last-child {
  width: 7.5rem;
  min-width: 7.5rem;
  max-width: 7.5rem;
  text-align: right;
  white-space: nowrap;
}

.clean-table th,
.clean-table td {
  max-width: 26rem;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.clean-table td {
  line-height: 1.35;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.type-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
}

.type-request {
  background: #e7f0ff;
  color: #174c9a;
}

.type-direction {
  background: #e8f6ed;
  color: #17683a;
}

.type-other {
  background: #f1f2f4;
  color: #555;
}

.status-pill.ok,
.status-pill.in {
  background: #e8f6ed;
  color: #17683a;
}

.status-pill.warn {
  background: #fff4e5;
  color: #8a4b00;
}

.status-pill.out {
  background: #e7f0ff;
  color: #174c9a;
}

.status-pill.excluded {
  background: #eef1f5;
  color: #536173;
  white-space: normal;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.8rem;
  color: var(--muted);
}

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

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

.mini-grid.single-column {
  grid-template-columns: 1fr;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 110px;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.mini-stat strong {
  font-size: 1.5rem;
}

.mini-stat small,
.mini-stat span {
  color: var(--muted);
}

.period-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.period-switcher-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.period-switch {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.32rem 0.8rem;
  border: 1px solid #c9d3df;
  border-radius: 999px;
  background: #fff;
  color: #1d3b5f;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.period-switch.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.bar-row {
  display: grid;
  grid-template-columns: 8.5rem minmax(120px, 1fr) 4rem;
  gap: 0.65rem;
  align-items: center;
}

.bar-label {
  color: #3d4b5d;
  font-size: 0.86rem;
  white-space: nowrap;
}

.bar-track {
  height: 1rem;
  background: #e6edf5;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  min-width: 3px;
  background: var(--accent);
  border-radius: inherit;
}

.empty-state {
  margin: 0;
  padding: 1rem;
  border: 1px dashed #c9d3df;
  border-radius: 8px;
  background: #f8fafc;
  color: #5f6b7a;
  font-size: 0.95rem;
}

.choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.case-id-cell {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 700;
}

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

.snapshot-grid div {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.snapshot-grid span {
  display: block;
  margin-bottom: 0.28rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
  text-transform: uppercase;
}

.snapshot-grid strong {
  display: block;
  word-break: break-word;
  font-size: 0.92rem;
}

.answer-review {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.answer-review > div {
  display: grid;
  grid-template-columns: minmax(8rem, 0.22fr) minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.72rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.answer-review span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.answer-review strong {
  min-width: 0;
  color: #253347;
  font-size: 0.92rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.thread-list {
  display: grid;
  gap: 1rem;
}

.thread-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid #8aa4c3;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.thread-card.incoming {
  border-left-color: #1f7a4d;
}

.thread-card.outgoing {
  border-left-color: var(--accent);
}

.thread-card header,
.thread-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.thread-card h2 {
  margin: 0.8rem 0;
  font-size: 1.05rem;
}

.body-preview {
  margin: 0.9rem 0 0;
  padding: 0.8rem;
  border-radius: var(--radius);
  background: #f8fafc;
  color: #374151;
  white-space: pre-wrap;
}

details {
  margin-top: 0.9rem;
}

summary {
  cursor: pointer;
  font-weight: 750;
}

.form-notice {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 1.1rem;
  padding: 0.8rem 0.9rem;
  border-radius: 8px;
  line-height: 1.45;
}

.form-notice.success {
  border: 1px solid #9bd5b9;
  background: #edf9f2;
  color: #145c3d;
}

.form-notice.warning {
  border: 1px solid #e5c77a;
  background: #fff8e5;
  color: #6f4b00;
}

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

@media (max-width: 1100px) {
  .app-shell-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .main-nav {
    justify-content: flex-start;
  }

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

  .client-card {
    border-bottom: 1px solid var(--line);
  }

  .stats-grid,
  .snapshot-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-main,
  .app-shell-inner {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .client-card-grid,
  .filter-bar,
  .mini-grid,
  .scope-grid {
    grid-template-columns: 1fr;
  }

  .client-card {
    min-height: auto;
    border-right: 0;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

/* Stage 1 unified sidebar layout and safer data surfaces */
body.unified {
  min-height: 100vh;
  padding-bottom: 0;
  background: #eef3f8;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  display: flex;
  flex: 0 0 260px;
  flex-direction: column;
  width: 260px;
  position: sticky;
  top: 0;
  min-height: 100vh;
  height: 100vh;
  overflow-y: auto;
  padding: 1.1rem 1rem;
  background: #ffffff;
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 30px rgba(23, 32, 42, 0.04);
}

.sidebar-brand {
  min-width: 0;
  margin-bottom: 1.4rem;
  padding: 0.3rem 0.25rem 1rem;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand .brand-title {
  font-size: 1.08rem;
}

.sidebar-nav {
  display: grid;
  gap: 0.25rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0.5rem 0.72rem;
  border-radius: 8px;
  color: #263a52;
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease;
}

.sidebar-nav a:hover {
  background: #f2f6fb;
  color: var(--accent-dark);
}

.sidebar-nav a.active {
  background: #e7f0ff;
  color: var(--accent-dark);
  box-shadow: inset 3px 0 0 var(--accent);
}

.app-content {
  flex: 1 1 auto;
  min-width: 0;
}

.app-main {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 1.35rem clamp(1rem, 2.2vw, 2rem) 3rem;
}

.table-scroll,
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.clean-table table {
  width: 100%;
  border-collapse: collapse;
}

.clean-table th,
.clean-table td {
  padding: 0.56rem 0.55rem;
  border-bottom: 1px solid #edf1f5;
}

.clean-table th {
  color: #334155;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: left;
  overflow-wrap: normal;
  white-space: nowrap;
}

.messages-table table,
.cases-table table {
  min-width: 0;
  table-layout: fixed;
}

.messages-table th,
.messages-table td,
.cases-table th,
.cases-table td {
  font-size: 0.86rem;
}

.messages-table th {
  font-size: 0.78rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.messages-table th,
.cases-table th {
  white-space: normal;
}

.messages-table th:nth-child(1),
.messages-table td:nth-child(1) {
  width: 13%;
}

.messages-table th:nth-child(2),
.messages-table td:nth-child(2) {
  width: 11%;
}

.messages-table th:nth-child(3),
.messages-table td:nth-child(3) {
  width: 20%;
}

.messages-table th:nth-child(4),
.messages-table td:nth-child(4) {
  width: 10%;
}

.messages-table th:nth-child(5),
.messages-table td:nth-child(5) {
  width: 13%;
}

.messages-table th:nth-child(6),
.messages-table td:nth-child(6) {
  width: 9%;
}

.messages-table th:nth-child(7),
.messages-table td:nth-child(7) {
  width: 13%;
}

.messages-table th:nth-child(8),
.messages-table td:nth-child(8) {
  width: 11%;
}

.cases-table th:nth-child(1),
.cases-table td:nth-child(1) {
  width: 12%;
}

.cases-table th:nth-child(2),
.cases-table td:nth-child(2) {
  width: 18%;
}

.cases-table th:nth-child(3),
.cases-table td:nth-child(3),
.cases-table th:nth-child(4),
.cases-table td:nth-child(4),
.cases-table th:nth-child(5),
.cases-table td:nth-child(5) {
  width: 7%;
}

.cases-table th:nth-child(6),
.cases-table td:nth-child(6) {
  width: 17%;
}

.cases-table th:nth-child(7),
.cases-table td:nth-child(7) {
  width: 21%;
}

.cases-table th:nth-child(8),
.cases-table td:nth-child(8) {
  width: 11%;
}

.date-cell {
  font-variant-numeric: tabular-nums;
  white-space: normal;
}

.sender-cell,
.subject-cell,
.mono-break {
  min-width: 0;
  overflow-wrap: anywhere;
}

.subject-link {
  color: #14253a;
  font-weight: 700;
  text-decoration: none;
}

.subject-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.table-link {
  color: #143d73;
  font-weight: 700;
  text-decoration: none;
}

.table-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.subject-clamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
  word-break: normal;
}

.actions-cell {
  white-space: normal;
}

.action-btn {
  white-space: nowrap;
}

.messages-table .actions-cell .btn {
  min-height: 1.75rem;
  padding: 0.24rem 0.38rem;
  font-size: 0.76rem;
  white-space: nowrap;
}

.queue-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.queue-card {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(23, 32, 42, 0.05);
}

.queue-card:hover {
  border-color: #b8c8dc;
  background: #f8fbff;
}

.queue-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.queue-card strong {
  font-size: 1.55rem;
  line-height: 1.1;
}

.queue-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
}

.queue-card.total {
  border-left: 4px solid #8aa4c3;
}

.queue-card.positive {
  border-left: 4px solid #1f8a55;
}

.queue-card.negative {
  border-left: 4px solid #c2413c;
}

.queue-card.no-answer {
  border-left: 4px solid #d08a00;
}

.queue-card.warning {
  border-left: 4px solid #64748b;
}

.quick-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.quick-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #29425f;
  font-size: 0.86rem;
  font-weight: 750;
  text-decoration: none;
}

.quick-filter strong {
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.quick-filter.active {
  border-color: var(--accent);
  background: #e7f0ff;
  color: var(--accent-dark);
}

.case-status-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
}

.case-status-badge.status-positive {
  background: #e8f6ed;
  color: #17683a;
}

.case-status-badge.status-negative {
  background: #fff0ef;
  color: #a2312d;
}

.case-status-badge.status-undetermined,
.case-status-badge.status-no-answer {
  background: #fff4e5;
  color: #875000;
}

.case-status-badge.status-waiting {
  background: #fff4e5;
  color: #875000;
}

.case-status-badge.status-overdue {
  background: #fff0ef;
  color: #a2312d;
}

.case-status-badge.status-neutral {
  background: #eef1f5;
  color: #536173;
}

.status-pill {
  max-width: 100%;
}

.status-pill.excluded {
  background: #e8eef7;
  color: #31506f;
}

.detail-heading h1 {
  max-width: 1080px;
  overflow-wrap: anywhere;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.message-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.message-summary > div {
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.meta-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 1rem;
}

.meta-list {
  display: grid;
  gap: 0;
  margin: 0.85rem 0 0;
}

.meta-list div {
  display: grid;
  grid-template-columns: minmax(8rem, 0.36fr) minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.56rem 0;
  border-bottom: 1px solid #edf1f5;
}

.meta-list div:last-child {
  border-bottom: 0;
}

.meta-list dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.meta-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.message-body {
  max-height: 48rem;
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #263342;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.attachment-list {
  display: grid;
  gap: 0.35rem;
  margin: 0.85rem 0 0;
  padding-left: 1.15rem;
}

.classification-note {
  margin: 1rem 0 0;
  padding: 0.85rem;
  border: 1px solid #d9e4f2;
  border-radius: 8px;
  background: #f8fbff;
  color: #334155;
  line-height: 1.5;
}

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

.thread-summary-grid div {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.thread-summary-grid span {
  display: block;
  margin-bottom: 0.28rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.thread-summary-grid strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.timeline-list {
  position: relative;
  padding-left: 1.4rem;
}

.timeline-list::before {
  content: "";
  position: absolute;
  top: 0.25rem;
  bottom: 0.25rem;
  left: 0.45rem;
  width: 2px;
  background: #d7e1ed;
}

.timeline-card {
  position: relative;
}

.timeline-marker {
  position: absolute;
  left: -2rem;
  top: 0.95rem;
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #9fb2c9;
  color: #29425f;
  font-size: 0.72rem;
  font-weight: 900;
}

.thread-card.incoming .timeline-marker {
  border-color: #1f8a55;
}

.thread-card.outgoing .timeline-marker {
  border-color: var(--accent);
}

.thread-actions {
  margin-top: 0.85rem;
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    overflow: visible;
    min-height: 0;
    flex: 0 0 auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(23, 32, 42, 0.04);
  }

  .sidebar-brand {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
  }

  .sidebar-nav a {
    min-height: 2.1rem;
    padding: 0.42rem 0.62rem;
  }

  .app-main {
    padding: 1rem 0.85rem 2.4rem;
  }

  .message-summary,
  .detail-grid,
  .thread-summary-grid,
  .queue-overview {
    grid-template-columns: 1fr;
  }

  .timeline-list {
    padding-left: 0;
  }

  .timeline-list::before,
  .timeline-marker {
    display: none;
  }
}

@media (max-width: 640px) {
  .meta-list div {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .answer-review > div {
    grid-template-columns: 1fr;
    gap: 0.28rem;
  }

  .messages-table table,
  .cases-table table {
    min-width: 760px;
  }
}

/* Stage 1 product additions: branches, insurer outcome KPI, tighter tables */
.fit-table {
  overflow-x: visible;
}

.fit-table table {
  min-width: 0;
  table-layout: fixed;
}

.fit-table th:last-child,
.fit-table td:last-child {
  width: 7rem;
  text-align: right;
  white-space: nowrap;
}

.priority-panel {
  border-left: 4px solid var(--accent);
}

.outcome-kpis .kpi-item:nth-child(1) {
  border-left: 4px solid #1f8a55;
}

.outcome-kpis .kpi-item:nth-child(2) {
  border-left: 4px solid #c2413c;
}

.outcome-kpis .kpi-item:nth-child(3) {
  border-left: 4px solid #d08a00;
}

.outcome-kpis .kpi-item:nth-child(4) {
  border-left: 4px solid #64748b;
}

.outcome-kpis .kpi-item.muted-kpi {
  border-left: 4px solid #8aa4c3;
}

.muted-kpi strong {
  color: #2f4056;
}

.secondary-kpis {
  margin-top: -0.25rem;
}

.mail-activity-panel .secondary-kpis {
  margin-top: 0;
}

.kpi-table table {
  min-width: 980px;
}

.kpi-table tfoot th {
  background: #f8fafc;
  border-top: 1px solid #d9e0e8;
  font-size: 0.86rem;
}

.status-positive-text {
  color: #17683a;
  font-weight: 800;
}

.status-negative-text {
  color: #a2312d;
  font-weight: 800;
}

.metric-cell {
  white-space: normal;
}

.metric-cell strong {
  display: block;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.08;
}

.metric-cell span {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.15;
  background: #eef2f7;
  color: #334155;
}

.score-pill.positive {
  background: #e8f7ee;
  color: #17683a;
}

.score-pill.negative {
  background: #fdecea;
  color: #a2312d;
}

.score-pill.neutral {
  background: #eef2f7;
  color: #475569;
}

.muted-inline {
  display: inline-block;
  margin-left: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.answer-review-wide {
  grid-column: 1 / -1;
}

.kpi-table small {
  color: var(--muted);
  font-weight: 700;
}

.insurer-navigation-panel {
  border-left: 4px solid #1f6ac8;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.insurer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.insurer-tab {
  display: inline-flex;
  align-items: center;
  min-height: 2.15rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid #cbd7e6;
  border-radius: 999px;
  background: #fff;
  color: #18395f;
  font-size: 0.88rem;
  font-weight: 850;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.insurer-tab:hover {
  border-color: #9db9dc;
  background: #f6f9fd;
}

.insurer-tab.active {
  border-color: var(--accent);
  background: #e7f0ff;
  color: var(--accent-dark);
  box-shadow: 0 6px 14px rgba(31, 95, 191, 0.08);
}

.selected-insurer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e2e8f0;
}

.selected-insurer-bar span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.selected-insurer-bar strong {
  color: #12305a;
  font-size: 1rem;
  font-weight: 900;
}

.selected-insurer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-left: auto;
}

.review-control-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-left: 4px solid #d98a14;
  background: #fffaf0;
}

.review-control-panel h2 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.15rem;
}

.review-control-panel p {
  max-width: 820px;
  margin: 0;
  color: #6b5a3c;
}

.panel-kicker {
  color: #9a5b0c;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-control-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.outcome-queue-overview {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.outcome-queue-overview .queue-card strong {
  font-size: 1.7rem;
  font-weight: 900;
}

.history-cell {
  min-width: 0;
}

.history-cell strong,
.history-cell span {
  display: block;
  line-height: 1.2;
}

.history-cell strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.history-cell span {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.case-review-table table {
  min-width: 0;
  table-layout: fixed;
}

.case-review-table th:nth-child(1),
.case-review-table td:nth-child(1) {
  width: 12%;
}

.case-review-table th:nth-child(2),
.case-review-table td:nth-child(2) {
  width: 9%;
}

.case-review-table th:nth-child(3),
.case-review-table td:nth-child(3) {
  width: 22%;
}

.case-review-table th:nth-child(4),
.case-review-table td:nth-child(4) {
  width: 19%;
}

.case-review-table th:nth-child(5),
.case-review-table td:nth-child(5) {
  width: 14%;
}

.case-review-table th:nth-child(6),
.case-review-table td:nth-child(6) {
  width: 14%;
}

.case-review-table th:nth-child(7),
.case-review-table td:nth-child(7) {
  width: 10%;
  text-align: right;
}

.branch-overview-section {
  border-left: 4px solid #1f6ac8;
}

.branch-panel-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.branch-panel {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #fff;
  padding: 1rem;
}

.branch-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.branch-panel-kicker {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.branch-panel h3 {
  margin: 0;
  color: #12305a;
  font-size: 1.25rem;
  line-height: 1.15;
}

.branch-total-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.branch-total-strip > div {
  min-width: 0;
  border-radius: 0.65rem;
  background: #f6f8fb;
  padding: 0.75rem;
}

.branch-total-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.15;
  text-transform: uppercase;
}

.branch-total-strip strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.branch-total-strip small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.branch-insurer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.branch-insurer-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  min-width: 0;
  border: 1px solid #d8e2ee;
  border-radius: 0.7rem;
  background: #fbfdff;
  padding: 0.8rem;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.branch-insurer-card:hover {
  border-color: #9db9dc;
  box-shadow: 0 10px 26px rgba(15, 38, 75, 0.08);
  transform: translateY(-1px);
}

.branch-insurer-name,
.branch-insurer-volume {
  grid-column: 1 / -1;
}

.branch-insurer-name {
  color: #0e3d78;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.branch-insurer-volume {
  margin-top: -0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.branch-card-metric {
  min-width: 0;
  line-height: 1.12;
}

.branch-card-metric strong,
.branch-card-metric small,
.branch-card-metric em {
  display: block;
}

.branch-card-metric strong {
  font-size: 1.1rem;
  font-weight: 900;
}

.branch-card-metric small {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.branch-card-metric em {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
}

.branch-empty-state {
  margin: 0;
  border: 1px dashed #c9d6e6;
  border-radius: 0.7rem;
  background: #f8fafc;
  padding: 0.9rem;
}

.outcome-dynamics-panel {
  border-left: 4px solid #1f8a55;
}

.outcome-timeline {
  display: grid;
  gap: 0.7rem;
}

.outcome-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
  padding: 0.75rem;
  border: 1px solid #dfe7f0;
  border-radius: 0.7rem;
  background: #fbfdff;
}

.outcome-period {
  min-width: 0;
}

.outcome-period strong,
.outcome-period span {
  display: block;
}

.outcome-period strong {
  color: #113c78;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.15;
}

.outcome-period span {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
}

.outcome-row-body {
  min-width: 0;
}

.outcome-stack {
  display: flex;
  width: 100%;
  height: 0.9rem;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.outcome-stack span {
  display: block;
  min-width: 2px;
  height: 100%;
}

.outcome-row-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.55rem;
}

.outcome-row-metrics > span {
  min-width: 0;
}

.outcome-row-metrics strong,
.outcome-row-metrics small {
  display: block;
}

.outcome-row-metrics strong {
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1.05;
}

.outcome-row-metrics small {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.15;
}

.messages-table th:nth-child(1),
.messages-table td:nth-child(1) {
  width: 10%;
}

.messages-table th:nth-child(2),
.messages-table td:nth-child(2) {
  width: 8%;
}

.messages-table th:nth-child(3),
.messages-table td:nth-child(3) {
  width: 15%;
}

.messages-table th:nth-child(4),
.messages-table td:nth-child(4) {
  width: 20%;
}

.messages-table th:nth-child(5),
.messages-table td:nth-child(5) {
  width: 8%;
}

.messages-table th:nth-child(6),
.messages-table td:nth-child(6) {
  width: 13%;
}

.messages-table th:nth-child(7),
.messages-table td:nth-child(7) {
  width: 7%;
}

.messages-table th:nth-child(8),
.messages-table td:nth-child(8) {
  width: 11%;
}

.messages-table th:nth-child(9),
.messages-table td:nth-child(9) {
  width: 8%;
}

.cases-table th:nth-child(1),
.cases-table td:nth-child(1) {
  width: 11%;
}

.cases-table th:nth-child(2),
.cases-table td:nth-child(2) {
  width: 9%;
}

.cases-table th:nth-child(3),
.cases-table td:nth-child(3) {
  width: 17%;
}

.cases-table th:nth-child(4),
.cases-table td:nth-child(4),
.cases-table th:nth-child(5),
.cases-table td:nth-child(5),
.cases-table th:nth-child(6),
.cases-table td:nth-child(6) {
  width: 7%;
}

.cases-table th:nth-child(7),
.cases-table td:nth-child(7) {
  width: 15%;
}

.cases-table th:nth-child(8),
.cases-table td:nth-child(8) {
  width: 17%;
}

.cases-table th:nth-child(9),
.cases-table td:nth-child(9) {
  width: 11%;
}

.cases-table th:nth-child(10),
.cases-table td:nth-child(10) {
  width: 8%;
}

@media (max-width: 1100px) {
  .kpi-table table {
    min-width: 900px;
  }

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

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

  .branch-insurer-grid {
    grid-template-columns: 1fr;
  }

  .outcome-row {
    grid-template-columns: 1fr;
  }

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

}

@media (max-width: 640px) {
  .product-hero {
    min-height: auto;
    padding-top: 1.2rem;
  }

  .product-map {
    grid-template-columns: 1fr;
  }

  .product-map-card {
    min-height: 150px;
  }

  .insurer-score-grid {
    grid-template-columns: 1fr;
  }

  .insurer-score-card header {
    flex-direction: column;
  }

  .card-action-row,
  .selected-insurer-actions {
    justify-content: flex-start;
    width: 100%;
    margin-left: 0;
  }

  .insurer-metrics {
    grid-template-columns: 1fr;
  }

  .branch-panel {
    padding: 0.85rem;
  }

  .branch-panel-header {
    flex-direction: column;
  }

  .branch-total-strip,
  .branch-insurer-card {
    grid-template-columns: 1fr;
  }

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

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

/* Product overview tables should fit the main work area before falling back to scroll. */
.kpi-table table {
  min-width: 0;
  table-layout: fixed;
}

.kpi-table th,
.kpi-table td {
  padding-inline: 0.6rem;
}

.kpi-table th:nth-child(1),
.kpi-table td:nth-child(1) {
  width: 18%;
}

.kpi-table th:nth-child(2),
.kpi-table td:nth-child(2) {
  width: 11%;
}

.kpi-table th:nth-child(3),
.kpi-table td:nth-child(3),
.kpi-table th:nth-child(4),
.kpi-table td:nth-child(4),
.kpi-table th:nth-child(5),
.kpi-table td:nth-child(5) {
  width: 13%;
}

.kpi-table th:nth-child(6),
.kpi-table td:nth-child(6),
.kpi-table th:nth-child(7),
.kpi-table td:nth-child(7),
.kpi-table th:nth-child(8),
.kpi-table td:nth-child(8) {
  width: 10%;
}

.kpi-table .metric-cell strong {
  font-size: 1.08rem;
}

.kpi-table .metric-cell span {
  font-size: 0.7rem;
}

.target-cell {
  color: #113c78;
  font-weight: 900;
}

.cases-table th:nth-child(1),
.cases-table td:nth-child(1) {
  width: 10%;
}

.cases-table th:nth-child(2),
.cases-table td:nth-child(2) {
  width: 8%;
}

.cases-table th:nth-child(3),
.cases-table td:nth-child(3) {
  width: 18%;
}

.cases-table th:nth-child(4),
.cases-table td:nth-child(4) {
  width: 9%;
}

.cases-table th:nth-child(5),
.cases-table td:nth-child(5),
.cases-table th:nth-child(6),
.cases-table td:nth-child(6) {
  width: 6%;
}

.cases-table th:nth-child(7),
.cases-table td:nth-child(7) {
  width: 15%;
}

.cases-table th:nth-child(8),
.cases-table td:nth-child(8) {
  width: 17%;
}

.cases-table th:nth-child(9),
.cases-table td:nth-child(9) {
  width: 10%;
}

.cases-table th,
.cases-table td {
  padding-inline: 0.42rem;
}

.cases-table .action-btn {
  min-width: 0;
  padding-inline: 0.45rem;
}

.cases-table table {
  width: calc(100% - 8px);
}

/* Final Stage 1 UX pass: product navigation and resilient filters. */
.sidebar-nav-caption {
  display: block;
  margin: 0.85rem 0 0.25rem;
  padding: 0 0.72rem;
  color: #7a8798;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav-caption:first-child {
  margin-top: 0;
}

.filter-bar {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.filter-actions {
  display: grid;
  grid-column: span 2;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.55rem;
  align-items: end;
}

.filter-actions .btn,
.selected-insurer-actions .btn {
  white-space: nowrap;
}

.filter-bar .btn {
  width: 100%;
  margin: 0;
}

.filter-bar input:focus,
.filter-bar select:focus,
textarea:focus {
  border-color: #7da4d8;
  outline: 3px solid rgba(31, 95, 191, 0.15);
}

.product-hero {
  min-height: 220px;
}

.product-map-card h2,
.section-title-row h2,
.section-card > h2 {
  letter-spacing: 0;
}

.case-review-table table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.case-review-table th:nth-child(1),
.case-review-table td:nth-child(1) {
  width: 10%;
}

.case-review-table th:nth-child(2),
.case-review-table td:nth-child(2) {
  width: 8%;
}

.case-review-table th:nth-child(3),
.case-review-table td:nth-child(3) {
  width: 14%;
}

.case-review-table th:nth-child(4),
.case-review-table td:nth-child(4) {
  width: 9%;
}

.case-review-table th:nth-child(5),
.case-review-table td:nth-child(5) {
  width: 22%;
}

.case-review-table th:nth-child(6),
.case-review-table td:nth-child(6) {
  width: 8%;
}

.case-review-table th:nth-child(7),
.case-review-table td:nth-child(7) {
  width: 8%;
}

.case-review-table th:nth-child(8),
.case-review-table td:nth-child(8) {
  width: 10%;
}

.case-review-table th:nth-child(9),
.case-review-table td:nth-child(9) {
  width: 7%;
}

.case-review-table th:nth-child(10),
.case-review-table td:nth-child(10) {
  width: 4%;
  text-align: right;
}

.case-review-table .history-cell span {
  white-space: normal;
}

.page-heading {
  padding-bottom: 0.65rem;
}

@media (max-width: 980px) {
  .case-review-table table,
  .messages-table table {
    min-width: 1120px;
  }
}

@media (max-width: 720px) {
  .filter-actions {
    grid-column: 1 / -1;
  }
}

.metric-tile-link,
.metric-cell-link,
.quality-card {
  color: inherit;
  text-decoration: none;
}

.metric-tile-link:hover,
.metric-cell-link:hover,
.quality-card:hover {
  transform: translateY(-1px);
}

.metric-cell-link {
  display: grid;
  gap: 0.12rem;
}

.reason-cell {
  color: #29394f;
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: normal;
}

.evidence-note {
  display: block;
  margin-top: 0.35rem;
  color: #63758c;
  font-size: 0.76rem;
  line-height: 1.35;
}

.summary-evidence {
  margin: 1rem 0 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(31, 95, 191, 0.14);
  border-radius: 14px;
  background: #f6f9fd;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.28rem 0.5rem;
  border: 1px solid rgba(23, 55, 89, 0.12);
  border-radius: 999px;
  background: #f6f8fb;
  color: #30445d;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
}

.source-badge.strong {
  border-color: rgba(18, 126, 83, 0.28);
  background: #ebfbf4;
  color: #116342;
}

/* Final cases registry polish: keep the work queue readable in the sidebar layout. */
.case-review-table {
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.98));
}

.case-review-table table {
  min-width: 980px;
  table-layout: fixed;
}

.case-review-table th,
.case-review-table td {
  padding: 0.78rem 0.72rem;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
}

.case-review-table th {
  color: #344761;
  font-size: 0.76rem;
  line-height: 1.18;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: normal;
}

.case-review-table th:nth-child(1),
.case-review-table td:nth-child(1) {
  width: 15%;
}

.case-review-table th:nth-child(2),
.case-review-table td:nth-child(2) {
  width: 16%;
}

.case-review-table th:nth-child(3),
.case-review-table td:nth-child(3) {
  width: 14%;
}

.case-review-table th:nth-child(4),
.case-review-table td:nth-child(4) {
  width: 29%;
}

.case-review-table th:nth-child(5),
.case-review-table td:nth-child(5) {
  width: 12%;
}

.case-review-table th:nth-child(6),
.case-review-table td:nth-child(6) {
  width: 9%;
}

.case-review-table th:nth-child(7),
.case-review-table td:nth-child(7) {
  width: 5%;
  text-align: right;
}

.insurer-branch-cell {
  display: grid;
  gap: 0.18rem;
}

.insurer-branch-cell strong {
  color: #123e76;
  font-weight: 900;
}

.insurer-branch-cell span {
  color: #60728a;
  font-size: 0.78rem;
  font-weight: 760;
}

.case-review-table .case-id-cell {
  color: #10233a;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.case-review-table .case-status-badge {
  max-width: 100%;
  min-width: 0;
  justify-content: flex-start;
  padding: 0.38rem 0.62rem;
  border-radius: 999px;
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: normal;
}

.case-review-table .reason-cell {
  color: #1f3148;
  font-size: 0.84rem;
  line-height: 1.38;
}

.case-review-table .evidence-note {
  max-width: 31rem;
  color: #60728a;
}

.dates-stack-cell {
  display: grid;
  gap: 0.46rem;
  color: #10233a;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.dates-stack-cell span {
  display: grid;
  gap: 0.08rem;
}

.dates-stack-cell em {
  color: #728299;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 880;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.case-review-table .history-cell strong {
  font-size: 1.1rem;
}

.case-review-table .history-cell span,
.case-review-table .history-cell small {
  display: block;
  color: #60728a;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.25;
}

.case-review-table .history-cell small {
  margin-top: 0.3rem;
  color: #40546d;
}

.case-review-table .action-btn {
  min-width: 0;
  width: auto;
  padding-inline: 0.65rem;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .case-review-table table {
    min-width: 1020px;
  }
}

.case-registry-list {
  display: grid;
  gap: 0.8rem;
}

.case-registry-item {
  display: grid;
  gap: 0.78rem;
  padding: 1rem;
  border: 1px solid rgba(18, 46, 80, 0.1);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(24, 44, 72, 0.06);
}

.case-registry-main {
  display: grid;
  grid-template-columns: minmax(8rem, 1.1fr) minmax(11rem, 1.3fr) minmax(9rem, 0.9fr);
  gap: 0.8rem;
  align-items: start;
}

.case-registry-insurer,
.case-registry-id,
.case-registry-status,
.case-registry-meta > div {
  min-width: 0;
}

.case-registry-insurer,
.case-registry-id {
  display: grid;
  gap: 0.18rem;
}

.case-registry-insurer span {
  color: #123e76;
  font-size: 1rem;
  font-weight: 900;
}

.case-registry-insurer small,
.case-registry-id span,
.case-registry-meta span {
  color: #687a90;
  font-size: 0.72rem;
  font-weight: 860;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.case-registry-id strong {
  color: #10233a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.96rem;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.case-registry-status .case-status-badge {
  max-width: 100%;
  justify-content: center;
  white-space: normal;
}

.case-registry-reason {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: #f6f9fd;
  color: #24364e;
  font-size: 0.9rem;
  line-height: 1.42;
}

.case-registry-reason small {
  display: block;
  margin-top: 0.34rem;
  color: #61738a;
  font-size: 0.8rem;
}

.case-registry-meta {
  display: grid;
  grid-template-columns: minmax(7rem, 1fr) minmax(7rem, 1fr) minmax(8rem, 1fr) minmax(8rem, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.case-registry-meta > div {
  display: grid;
  gap: 0.16rem;
}

.case-registry-meta strong {
  color: #10233a;
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.24;
}

.case-registry-meta small {
  color: #61738a;
  font-size: 0.75rem;
  font-weight: 800;
}

.case-registry-action {
  justify-items: end;
}

.case-registry-action .action-btn {
  min-width: 7rem;
  justify-content: center;
}

@media (max-width: 980px) {
  .case-registry-main,
  .case-registry-meta {
    grid-template-columns: 1fr 1fr;
  }

  .case-registry-status,
  .case-registry-action {
    justify-items: start;
  }
}

@media (max-width: 640px) {
  .case-registry-main,
  .case-registry-meta {
    grid-template-columns: 1fr;
  }

  .case-registry-item {
    padding: 0.9rem;
  }

  .case-registry-action .action-btn {
    width: 100%;
  }
}

.status-source {
  border-color: rgba(18, 126, 83, 0.34) !important;
  box-shadow: 0 20px 42px rgba(18, 126, 83, 0.11);
}

.status-evidence-card.status-source {
  background: linear-gradient(135deg, #ffffff 0%, #f1fbf6 100%);
}

.evidence-list dd {
  white-space: normal;
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.quality-card {
  display: grid;
  gap: 0.35rem;
  min-height: 128px;
  padding: 1rem;
  border: 1px solid rgba(23, 55, 89, 0.1);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 35px rgba(25, 43, 64, 0.07);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.quality-card span {
  color: #62728a;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quality-card strong {
  color: #10233a;
  font-size: 1.8rem;
}

.quality-card .quality-date {
  font-size: 1.05rem;
  line-height: 1.2;
}

.quality-card small {
  color: #63758c;
}

.quality-card.positive strong {
  color: #127e53;
}

.quality-card.negative strong {
  color: #b83b3b;
}

.quality-card.warning strong,
.quality-card.review strong {
  color: #a25d12;
}

.quality-control-panel {
  border-left: 4px solid #d98a14;
}

.quality-control-panel .section-title-row p {
  max-width: 820px;
}

.source-breakdown {
  display: grid;
  gap: 0.55rem;
}

.source-breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 14px;
  background: #f6f8fb;
}

.source-breakdown a {
  display: grid;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  border-radius: 14px;
  background: #f6f8fb;
  color: inherit;
  text-decoration: none;
}

.source-breakdown a strong {
  color: #244e7d;
}

.source-breakdown a small {
  color: #64758a;
}

.inline-review-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.inline-review-form input {
  width: 100%;
  border: 1px solid #ccd6e2;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  background: #fff;
}

.search-result-list {
  display: grid;
  gap: 0.75rem;
}

.search-result {
  padding: 1rem;
  border: 1px solid rgba(23, 55, 89, 0.1);
  border-radius: 18px;
  background: #fff;
}

.search-result header,
.hit-list,
.thread-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.search-result h2 {
  margin: 0.65rem 0 0.35rem;
  font-size: 1rem;
}

.hit-list span {
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
  background: #eaf1fb;
  color: #244c7c;
  font-size: 0.72rem;
  font-weight: 800;
}

.search-start-card {
  max-width: 760px;
}

.notice-card {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(18, 126, 83, 0.22);
  border-radius: 16px;
  background: #eefbf5;
  color: #125d40;
  font-weight: 800;
}

.ai-learning-kpis .quality-card:last-child small {
  word-break: break-word;
}

.ai-review-detail {
  margin-bottom: 1rem;
}

.ai-review-list {
  display: grid;
  gap: 1rem;
}

.ai-review-card {
  border-left: 4px solid rgba(31, 95, 191, 0.38);
}

.ai-review-card.manual-reviewed {
  border-left-color: rgba(18, 126, 83, 0.72);
  background: linear-gradient(135deg, #ffffff 0%, #f4fbf7 100%);
}

.ai-review-card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.ai-review-card-header h2 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.2rem;
}

.ai-review-card-header p {
  margin: 0;
  color: #5f7087;
}

.ai-review-summary {
  margin-bottom: 0.75rem;
}

.ai-review-message {
  margin-top: 0.9rem;
  padding: 0.95rem;
  border: 1px solid rgba(23, 55, 89, 0.1);
  border-radius: 18px;
  background: #f8fafc;
}

.ai-review-message header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  color: #607089;
  font-size: 0.8rem;
}

.ai-review-message h3 {
  margin: 0.6rem 0;
  font-size: 1rem;
}

.compact-review {
  margin: 0.65rem 0;
}

.manual-label-form {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(220px, 1fr) minmax(260px, 1.4fr) auto;
  gap: 0.7rem;
  align-items: end;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(23, 55, 89, 0.1);
}

.manual-label-form label {
  display: grid;
  gap: 0.3rem;
  color: #52647b;
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.manual-label-form input,
.manual-label-form select,
.manual-label-form textarea {
  width: 100%;
  border: 1px solid #ccd6e2;
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: #fff;
  color: #17202a;
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
}

.manual-label-form textarea {
  resize: vertical;
}

.manual-label-form .btn {
  min-height: 2.8rem;
  white-space: nowrap;
}

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

  .manual-label-form {
    grid-template-columns: 1fr 1fr;
  }

  .manual-label-form .btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .quality-grid {
    grid-template-columns: 1fr;
  }

  .ai-review-card-header {
    display: grid;
  }

  .manual-label-form {
    grid-template-columns: 1fr;
  }
}

/* Presentation polish: business-grade operational surface */
:root {
  --bg: #edf2f6;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --ink: #101926;
  --muted: #607084;
  --line: #dfe6ee;
  --border: #dfe6ee;
  --accent: #245a9f;
  --accent-dark: #173b68;
  --accent-soft: #e7effb;
  --ok: #14734b;
  --warn: #b77913;
  --err: #a93335;
  --shadow: 0 18px 50px rgba(25, 38, 55, 0.08);
  --shadow-soft: 0 10px 26px rgba(25, 38, 55, 0.055);
  --radius: 16px;
}

html {
  background: #edf2f6;
}

body.unified {
  background:
    radial-gradient(circle at 18% -10%, rgba(36, 90, 159, 0.18), transparent 32rem),
    radial-gradient(circle at 88% 12%, rgba(20, 115, 75, 0.09), transparent 28rem),
    linear-gradient(180deg, #f6f8fb 0%, #edf2f6 48%, #e9eef4 100%);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.app-shell {
  align-items: stretch;
}

.sidebar {
  background:
    linear-gradient(180deg, #111d2b 0%, #172437 62%, #101926 100%);
  border-right: 0;
  box-shadow: 16px 0 40px rgba(16, 25, 38, 0.18);
  color: #dce7f3;
}

.sidebar-brand {
  position: relative;
  margin-bottom: 1.1rem;
  padding: 0.35rem 0.35rem 1.1rem;
  border-bottom: 1px solid rgba(220, 231, 243, 0.12);
  color: #fff;
}

.sidebar-brand::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: -0.1rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #f2c166 0%, #d58a28 100%);
  box-shadow: 0 12px 24px rgba(213, 138, 40, 0.26);
}

.sidebar-brand .brand-title,
.sidebar-brand .brand-subtitle {
  padding-left: 3rem;
}

.sidebar-brand .brand-title {
  color: #fff;
  font-size: 1.12rem;
  letter-spacing: 0.01em;
}

.sidebar-brand .brand-subtitle {
  color: #9fb3c8;
}

.sidebar-nav-caption {
  margin: 1rem 0 0.35rem;
  padding: 0 0.75rem;
  color: #7890aa;
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-nav a {
  min-height: 2.55rem;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #d9e5f2;
  font-weight: 760;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(242, 193, 102, 0.22), rgba(36, 90, 159, 0.35));
  border-color: rgba(242, 193, 102, 0.24);
  color: #fff;
  box-shadow: inset 3px 0 0 #f2c166, 0 10px 26px rgba(0, 0, 0, 0.16);
}

.sidebar-nav a.nav-secondary {
  min-height: 2.35rem;
  color: #b8c9dc;
  font-size: 0.92rem;
  font-weight: 720;
}

.sidebar-nav a.nav-secondary.active {
  color: #fff;
}

.app-main {
  padding: 1.6rem clamp(1rem, 2.8vw, 2.4rem) 3.5rem;
}

.page-heading,
.client-hero {
  position: relative;
  margin: 0 0 1.15rem;
  padding: 1.6rem clamp(1rem, 2vw, 1.6rem);
  overflow: hidden;
  border: 1px solid rgba(36, 90, 159, 0.12);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(246, 250, 255, 0.86)),
    radial-gradient(circle at 84% 18%, rgba(242, 193, 102, 0.28), transparent 17rem);
  box-shadow: var(--shadow);
}

.page-heading::after,
.client-hero::after {
  content: "";
  position: absolute;
  right: -5rem;
  top: -5rem;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(36, 90, 159, 0.18), transparent 58%),
    conic-gradient(from 140deg, rgba(20, 115, 75, 0.16), rgba(242, 193, 102, 0.16), rgba(36, 90, 159, 0.12), rgba(20, 115, 75, 0.16));
  filter: blur(2px);
  opacity: 0.9;
  pointer-events: none;
}

.page-heading > *,
.client-hero > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  color: #9a6410;
  letter-spacing: 0.115em;
}

.page-heading h1,
.client-hero h1 {
  max-width: 1000px;
  color: #0d1825;
  letter-spacing: -0.035em;
}

.lead {
  max-width: 850px;
  color: #526477;
  font-size: 1.03rem;
}

.section-card {
  border: 1px solid rgba(31, 50, 73, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.section-title-row h2,
.section-card > h2 {
  color: #111f31;
  font-size: 1.12rem;
  letter-spacing: -0.015em;
}

.filter-bar {
  padding: 0.15rem;
}

.filter-bar label {
  color: #4a5c70;
  font-size: 0.78rem;
  font-weight: 880;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.filter-bar input,
.filter-bar select,
.inline-review-form input,
.manual-label-form input,
.manual-label-form select,
.manual-label-form textarea {
  min-height: 2.6rem;
  border-color: #d4dde7;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.filter-bar input:focus,
.filter-bar select:focus,
.inline-review-form input:focus,
.manual-label-form input:focus,
.manual-label-form select:focus,
.manual-label-form textarea:focus {
  outline: none;
  border-color: rgba(36, 90, 159, 0.65);
  box-shadow: 0 0 0 4px rgba(36, 90, 159, 0.12);
}

.btn {
  min-height: 2.45rem;
  border-radius: 12px;
  border-color: #d3dce7;
  color: #173b68;
  font-weight: 820;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(25, 38, 55, 0.09);
}

.btn.primary {
  border-color: #1f4f8d;
  background: linear-gradient(135deg, #245a9f 0%, #173b68 100%);
  box-shadow: 0 12px 26px rgba(36, 90, 159, 0.18);
}

.btn.secondary {
  background: linear-gradient(180deg, #ffffff 0%, #f5f8fb 100%);
}

.btn.compact {
  min-height: 2rem;
  border-radius: 10px;
}

.kpi-strip,
.quality-grid {
  gap: 1rem;
}

.kpi-item,
.quality-card,
.product-map-card,
.insurer-score-card,
.review-card,
.search-result,
.thread-card {
  border: 1px solid rgba(31, 50, 73, 0.08);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 252, 255, 0.92));
  box-shadow: var(--shadow-soft);
}

.kpi-item,
.quality-card {
  position: relative;
  overflow: hidden;
  min-height: 138px;
}

.kpi-item::before,
.quality-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #245a9f, #f2c166);
}

.kpi-label,
.quality-card span,
.insurer-card-label,
.insurer-volume span,
.metric-tile span {
  color: #6b7d91;
  font-size: 0.7rem;
  letter-spacing: 0.075em;
}

.kpi-item strong,
.quality-card strong {
  color: #101926;
  letter-spacing: -0.035em;
}

.quality-card:hover,
.kpi-link:hover,
.product-map-card:hover,
.insurer-score-card:hover,
.review-card:hover {
  border-color: rgba(36, 90, 159, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 22px 54px rgba(25, 38, 55, 0.11);
}

.quality-card.positive::before,
.metric-tile.positive {
  background-image: linear-gradient(180deg, #f6fffa, #ffffff);
}

.quality-card.positive::before {
  background: linear-gradient(90deg, #14734b, #65c995);
}

.quality-card.negative::before {
  background: linear-gradient(90deg, #a93335, #ef8b78);
}

.quality-card.warning::before,
.quality-card.review::before {
  background: linear-gradient(90deg, #b77913, #f2c166);
}

.product-map {
  gap: 1rem;
}

.product-map-card {
  min-height: 210px;
  padding: 1.15rem;
}

.product-map-card.primary-card {
  border-left: 0;
  background:
    linear-gradient(135deg, rgba(23, 59, 104, 0.96), rgba(36, 90, 159, 0.88)),
    radial-gradient(circle at 80% 0%, rgba(242, 193, 102, 0.35), transparent 14rem);
  color: #fff;
}

.product-map-card.primary-card h2,
.product-map-card.primary-card p,
.product-map-card.primary-card span {
  color: #fff;
}

.product-map-card span {
  color: #9a6410;
}

.insurer-score-grid {
  gap: 1rem;
}

.insurer-score-card {
  padding: 1.15rem;
}

.insurer-score-card h3 {
  color: #173b68;
  letter-spacing: -0.02em;
}

.outcome-meter {
  height: 12px;
  background: #e6edf5;
  box-shadow: inset 0 1px 2px rgba(16, 25, 38, 0.08);
}

.metric-tile {
  border-color: rgba(31, 50, 73, 0.07);
  border-radius: 16px;
  background: #f8fafc;
}

.metric-tile strong {
  letter-spacing: -0.04em;
}

.metric-tile-link {
  color: inherit;
  text-decoration: none;
}

.period-switch,
.quick-filter {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.period-switch.is-active,
.quick-filter.active {
  background: linear-gradient(135deg, #245a9f, #173b68);
  border-color: transparent;
  color: #fff;
}

.clean-table {
  border-radius: 18px;
}

.clean-table table {
  border-spacing: 0;
}

.clean-table th {
  background: #f4f7fb;
  color: #44556a;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.clean-table th:first-child {
  border-top-left-radius: 14px;
}

.clean-table th:last-child {
  border-top-right-radius: 14px;
}

.clean-table td {
  background: rgba(255, 255, 255, 0.62);
}

.clean-table tbody tr:hover td {
  background: #f7fbff;
}

.source-breakdown div,
.source-breakdown a,
.meta-list div,
.snapshot-grid div,
.answer-review > div {
  border: 1px solid rgba(31, 50, 73, 0.06);
  background: linear-gradient(180deg, #f8fafc, #ffffff);
}

.review-list,
.ai-review-list {
  display: grid;
  gap: 1rem;
}

.review-card {
  padding: 1.05rem;
}

.review-card header,
.ai-review-card-header {
  align-items: flex-start;
  border-bottom: 1px solid rgba(31, 50, 73, 0.08);
  padding-bottom: 0.85rem;
}

.review-card h2,
.ai-review-card-header h2 {
  color: #111f31;
  letter-spacing: -0.025em;
}

.status-pill {
  border: 1px solid rgba(31, 50, 73, 0.08);
  background: #eef3f8;
  color: #4c5d70;
}

.status-pill.status-pending {
  background: #fff7e8;
  color: #8b5b0f;
  border-color: rgba(184, 126, 28, 0.22);
}

.status-pill.status-applied {
  background: #eaf7ef;
  color: #1f7a43;
  border-color: rgba(31, 122, 67, 0.2);
}

.status-pill.status-rejected {
  background: #fff0ed;
  color: #a33c2f;
  border-color: rgba(163, 60, 47, 0.2);
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.9rem;
}

.ai-review-card {
  border-left: 0;
  position: relative;
}

.ai-review-card::before,
.review-card::before {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  top: 1rem;
  bottom: 1rem;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, #245a9f, #f2c166);
}

.ai-review-card,
.review-card {
  position: relative;
}

.ai-review-message {
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fafc, #ffffff);
}

.notice-card {
  border-color: rgba(20, 115, 75, 0.22);
  border-radius: 18px;
  background: linear-gradient(135deg, #ecfbf4, #ffffff);
}

.rgs-guarantee-panel {
  border-color: rgba(151, 103, 22, 0.18);
  background: linear-gradient(135deg, #fff8eb, #ffffff 62%);
}

.guarantee-kpis .kpi-item {
  border-top-color: #c98915;
}

.guarantee-notice {
  display: grid;
  gap: 0.25rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  color: #47330c;
}

.guarantee-notice strong {
  color: #7a4b05;
  font-weight: 900;
}

.guarantee-notice span {
  color: #5f513a;
  font-weight: 750;
  line-height: 1.35;
}

.empty-state {
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fafc, #ffffff);
}

.case-status-badge,
.source-badge {
  border-radius: 999px;
}

@keyframes servicepark-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-heading,
.client-hero,
.section-card,
.quality-card,
.kpi-item,
.review-card {
  animation: servicepark-rise 0.36s ease both;
}

@media (max-width: 1180px) {
  .insurer-score-grid,
  .product-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0.8rem;
  }

  .sidebar-brand {
    margin-bottom: 0.65rem;
  }

  .sidebar-nav {
    display: flex;
    overflow-x: auto;
    gap: 0.4rem;
    padding-bottom: 0.2rem;
  }

  .sidebar-nav-caption {
    display: none;
  }

  .sidebar-nav a {
    flex: 0 0 auto;
    min-height: 2.2rem;
    white-space: nowrap;
  }

  .app-main {
    padding: 1rem 0.8rem 2.5rem;
  }
}

@media (max-width: 700px) {
  .page-heading,
  .client-hero {
    border-radius: 20px;
    padding: 1.15rem;
  }

  .page-heading h1,
  .client-hero h1 {
    font-size: clamp(1.65rem, 8vw, 2.2rem);
  }

  .product-map,
  .insurer-score-grid,
  .filter-bar,
  .detail-grid,
  .quality-grid,
  .insurer-metrics {
    grid-template-columns: 1fr;
  }

  .section-title-row,
  .review-control-panel,
  .ai-review-card-header,
  .review-card header {
    display: grid;
  }

  .review-control-actions {
    justify-content: stretch;
  }

  .review-control-actions .btn {
    width: 100%;
  }

  .manual-label-form,
  .inline-review-form {
    grid-template-columns: 1fr;
  }
}

.data-freshness {
  display: grid;
  gap: 0.22rem;
  margin-top: auto;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(159, 179, 200, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: #dce7f3;
}

.data-freshness-label {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-freshness strong {
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.25;
}

.data-freshness small {
  color: #9fb3c8;
  font-weight: 750;
}

.data-freshness-fresh {
  border-color: rgba(45, 166, 108, 0.34);
  background: rgba(45, 166, 108, 0.13);
}

.data-freshness-fresh .data-freshness-label {
  color: #9be2bd;
}

.data-freshness-aging {
  border-color: rgba(242, 193, 102, 0.38);
  background: rgba(242, 193, 102, 0.13);
}

.data-freshness-aging .data-freshness-label {
  color: #f8d991;
}

.data-freshness-stale {
  border-color: rgba(218, 92, 80, 0.42);
  background: rgba(218, 92, 80, 0.13);
}

.data-freshness-stale .data-freshness-label {
  color: #ffb5ad;
}

@media (max-width: 900px) {
  .data-freshness {
    margin-top: 0.65rem;
  }
}

.sidebar-auth {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(159, 179, 200, 0.18);
  border-radius: 14px;
  color: #dce7f3;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-auth span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 800;
}

.sidebar-auth a {
  color: #9fc2ff;
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.sidebar-auth a:hover {
  color: #ffffff;
}

.login-page {
  min-height: 100vh;
  padding: 0;
  overflow: hidden;
}

.login-page.dark-login {
  position: relative;
  background:
    radial-gradient(circle at 18% 18%, rgba(43, 122, 255, 0.22), transparent 31rem),
    radial-gradient(circle at 80% 82%, rgba(20, 183, 135, 0.12), transparent 28rem),
    linear-gradient(135deg, #06101d 0%, #081728 42%, #03070e 100%);
  color: #eef6ff;
}

.login-page.dark-login::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 50%, black 0%, transparent 74%);
}

.login-page.dark-login::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(103, 169, 255, 0.05) 48%,
    rgba(103, 169, 255, 0.11) 50%,
    rgba(103, 169, 255, 0.05) 52%,
    transparent 100%
  );
  animation: login-scan 7s linear infinite;
}

.login-ascii-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  color: rgba(139, 191, 255, 0.22);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.login-ascii-layer {
  position: absolute;
  white-space: pre;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(73, 145, 255, 0.32);
  filter: drop-shadow(0 0 16px rgba(40, 112, 220, 0.18));
}

.login-ascii-layer pre {
  margin: 0;
  font: inherit;
  letter-spacing: 0.02em;
}

.login-ascii-layer-a {
  left: clamp(1rem, 7vw, 6rem);
  top: 11vh;
  font-size: clamp(0.72rem, 1.12vw, 1rem);
  line-height: 1.55;
  animation: login-drift-a 18s ease-in-out infinite alternate;
}

.login-ascii-layer-b {
  right: clamp(-3rem, 3vw, 5rem);
  bottom: 10vh;
  color: rgba(105, 231, 185, 0.16);
  font-size: clamp(0.66rem, 0.9vw, 0.86rem);
  line-height: 1.55;
  animation: login-drift-b 22s ease-in-out infinite alternate;
}

.login-scanline {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.035) 0,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 1px,
    transparent 5px
  );
  opacity: 0.28;
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  align-items: center;
  justify-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(1rem, 5vw, 4rem);
}

.login-card {
  position: relative;
  overflow: hidden;
  width: min(100%, 430px);
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: 22px;
  animation: login-card-enter 760ms cubic-bezier(0.2, 0.72, 0.18, 1) both;
}

.login-card.dark {
  border: 1px solid rgba(141, 174, 214, 0.24);
  background:
    linear-gradient(180deg, rgba(15, 31, 52, 0.88), rgba(7, 16, 30, 0.92)),
    rgba(8, 20, 36, 0.9);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(48, 118, 238, 0.08);
  backdrop-filter: blur(18px);
}

.login-card.dark::before,
.login-card.dark::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.login-card.dark::before {
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent, rgba(104, 214, 177, 0.16), transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 34%);
  transform: translateX(-120%);
  animation: login-card-sweep 4.8s ease-in-out 900ms infinite;
}

.login-card.dark::after {
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(104, 214, 177, 0.22);
  opacity: 0;
  animation: login-border-pulse 3.6s ease-in-out 1.2s infinite;
}

.login-brand {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.2rem;
  padding-bottom: 1.2rem;
  margin-bottom: 1.35rem;
  border-bottom: 1px solid rgba(141, 174, 214, 0.2);
  animation: login-rise 520ms ease-out 120ms both;
}

.login-brand-title {
  font-size: 1.18rem;
  font-weight: 900;
  color: #ffffff;
}

.login-brand-subtitle {
  color: #9fb3c8;
  font-size: 0.92rem;
  font-weight: 760;
}

.login-form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.95rem;
}

.login-form label {
  display: grid;
  gap: 0.4rem;
  color: #c8d6e8;
  font-weight: 820;
  animation: login-rise 560ms ease-out both;
}

.login-form label:nth-of-type(1) {
  animation-delay: 330ms;
}

.login-form label:nth-of-type(2) {
  animation-delay: 430ms;
}

.login-form input {
  width: 100%;
  min-height: 3.05rem;
  padding: 0.68rem 0.85rem;
  border: 1px solid rgba(151, 181, 219, 0.34);
  border-radius: 12px;
  background: rgba(2, 9, 18, 0.62);
  color: #f7fbff;
  font: inherit;
  font-weight: 760;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 170ms ease, background 170ms ease, box-shadow 170ms ease, transform 170ms ease;
}

.login-form input::placeholder {
  color: rgba(201, 214, 232, 0.48);
}

.login-form input:focus {
  outline: 3px solid rgba(72, 137, 255, 0.2);
  border-color: #6da2ff;
  background: rgba(5, 15, 30, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(47, 117, 255, 0.42),
    0 0 28px rgba(47, 117, 255, 0.18);
  transform: translateY(-1px);
}

.login-error {
  position: relative;
  z-index: 1;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(255, 120, 120, 0.34);
  border-radius: 12px;
  background: rgba(90, 18, 28, 0.36);
  color: #ffd4d4;
  font-weight: 820;
  animation: login-shake 260ms ease both;
}

.login-submit {
  position: relative;
  z-index: 1;
  overflow: hidden;
  width: 100%;
  min-height: 3.15rem;
  justify-content: center;
  margin-top: 0.15rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #2f75ff, #1e57c7);
  color: #ffffff;
  font-size: 1rem;
  box-shadow: 0 18px 34px rgba(31, 95, 191, 0.28);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  animation: login-rise 560ms ease-out 540ms both;
}

.login-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
  transform: translateX(-120%);
  transition: transform 540ms ease;
}

.login-submit:hover {
  filter: brightness(1.06);
  box-shadow: 0 22px 42px rgba(31, 95, 191, 0.34);
  transform: translateY(-1px);
}

.login-submit:hover::before {
  transform: translateX(120%);
}

.login-submit:active {
  transform: translateY(0);
}

@keyframes login-scan {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}

@keyframes login-drift-a {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(1.1rem, -0.7rem, 0);
  }
}

@keyframes login-drift-b {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-1rem, 0.85rem, 0);
  }
}

@keyframes login-card-enter {
  from {
    opacity: 0;
    transform: translate3d(0, 1.2rem, 0) scale(0.985);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

@keyframes login-rise {
  from {
    opacity: 0;
    transform: translate3d(0, 0.75rem, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes login-card-sweep {
  0%,
  46% {
    transform: translateX(-120%);
  }
  68% {
    transform: translateX(120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes login-border-pulse {
  0%,
  100% {
    opacity: 0;
    box-shadow: 0 0 0 rgba(104, 214, 177, 0);
  }
  45% {
    opacity: 1;
    box-shadow: 0 0 34px rgba(104, 214, 177, 0.12);
  }
}

@keyframes login-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-0.35rem);
  }
  75% {
    transform: translateX(0.35rem);
  }
}

@media (max-width: 720px) {
  .login-shell {
    justify-items: center;
    padding: 1rem;
  }

  .login-card {
    width: min(100%, 25rem);
    padding: 1.25rem;
  }

  .login-ascii-layer-a {
    left: -6rem;
    top: 5vh;
    opacity: 0.64;
  }

  .login-ascii-layer-b {
    right: -12rem;
    bottom: 3vh;
    opacity: 0.7;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-page.dark-login::after,
  .login-ascii-layer-a,
  .login-ascii-layer-b,
  .login-card,
  .login-card.dark::before,
  .login-card.dark::after,
  .login-brand,
  .login-form label,
  .login-error,
  .login-submit {
    animation: none;
  }

  .login-submit::before {
    display: none;
  }
}

/* Keep KPI labels readable when five status cards share a narrow row. */
.kpi-strip,
.queue-overview,
.quality-grid,
.outcome-queue-overview {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr));
}

.kpi-item,
.queue-card,
.quality-card {
  min-width: 0;
  overflow: visible;
}

.kpi-label,
.queue-card span,
.quality-card span,
.metric-tile span {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.25;
  letter-spacing: 0.045em;
}

.kpi-item strong,
.queue-card strong,
.quality-card strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  letter-spacing: 0;
}

.diagnostic-disclosure {
  margin: 1rem 0;
}

.diagnostic-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(31, 50, 73, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(25, 43, 64, 0.06);
}

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

.diagnostic-disclosure > summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: #e8eef6;
  color: #42546c;
  font-weight: 900;
}

.diagnostic-disclosure[open] > summary::after {
  content: "-";
}

.diagnostic-disclosure > summary span {
  color: #17202a;
  font-weight: 850;
}

.diagnostic-disclosure > summary small {
  color: #6b7d91;
  font-size: 0.86rem;
}

.diagnostic-disclosure[open] > summary {
  margin-bottom: 1rem;
}

/* Final table hardening: prevent KPI and registry headers from colliding. */
.table-scroll.clean-table {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.clean-table th {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.15;
}

.clean-table th .th-label {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.15;
}

.kpi-table table {
  min-width: 980px;
  table-layout: fixed;
}

.kpi-table th,
.kpi-table td {
  box-sizing: border-box;
  min-width: 0;
  max-width: none;
}

.kpi-table thead th {
  padding: 0.8rem 0.85rem;
  vertical-align: middle;
  overflow: visible;
  text-overflow: clip;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.kpi-table thead th.num {
  text-align: right;
}

.kpi-table .kpi-col-insurer {
  width: 18%;
}

.kpi-table .kpi-col-count {
  width: 10%;
}

.kpi-table .kpi-col-positive,
.kpi-table .kpi-col-negative {
  width: 13%;
}

.kpi-table .kpi-col-target,
.kpi-table .kpi-col-reply {
  width: 8%;
}

.kpi-table .kpi-col-no-answer {
  width: 13%;
}

.kpi-table .kpi-col-review {
  width: 17%;
}

.kpi-table .metric-cell span,
.kpi-table tfoot .metric-cell span {
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.15;
}

.kpi-table .metric-cell-link {
  min-width: 0;
}

@media (max-width: 1180px) {
  .kpi-table table {
    min-width: 1040px;
  }
}

.filter-actions .btn,
.selected-insurer-actions .btn {
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.15;
  text-align: center;
}

@media (max-width: 700px) {
  .filter-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .filter-bar .btn {
    justify-content: center;
    min-height: 2.55rem;
  }
}
