/*
 * Palette: midnight navy (structure, headings, masthead) + dusk blue (actions, accents).
 * Semantic colours (ok / danger / due-soon) are kept distinct from the brand blues
 * so warnings never blend into the theme.
 */
:root {
  color-scheme: light;

  /* Midnight navy */
  --navy-950: #070e1c;
  --navy-900: #0b1426;
  --navy-800: #111d36;
  --navy-700: #1a2a4a;
  --navy-600: #2a3c60;

  /* Dusk blue */
  --dusk-700: #34507e;
  --dusk-600: #415f91;
  --dusk-500: #5675a8;
  --dusk-400: #7491c2;
  --dusk-300: #9fb5da;
  --dusk-200: #c6d4ec;
  --dusk-100: #dfe7f5;
  --dusk-50: #eef3fa;

  /* Role tokens */
  --accent: var(--dusk-600);
  --accent-hover: var(--dusk-700);
  --accent-on: #ffffff;
  --accent-ink: var(--dusk-700);
  --accent-soft: var(--dusk-50);
  --accent-line: var(--dusk-200);
  --ring: var(--dusk-500);

  --ink: #121a2b;
  --ink-muted: #46526b;
  --ink-soft: #66728b;
  --surface: #ffffff;
  --page: #f2f5fa;
  --line: #dde3ee;
  --line-strong: #c3ccdc;
  --quiet: #e8edf5;
  --shadow: 0 1px 2px rgb(17 29 54 / 6%), 0 2px 8px rgb(17 29 54 / 5%);

  --ok: #1a7a3d;
  --ok-bg: #e6f4ea;
  --danger: #b0281f;
  --danger-bg: #fcebe9;
  --due-soon: #8a5a00;
  --due-soon-bg: #fdf3dc;

  --offboard: var(--navy-600);

  font-family: Roboto, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --accent: var(--dusk-400);
    --accent-hover: var(--dusk-300);
    --accent-on: var(--navy-950);
    --accent-ink: var(--dusk-300);
    --accent-soft: #18264a;
    --accent-line: #2c4170;
    --ring: var(--dusk-400);

    --ink: #e6ecf7;
    --ink-muted: #aab6cd;
    --ink-soft: #8593ae;
    --surface: #111d36;
    --page: #0b1426;
    --line: #22325a;
    --line-strong: #33466f;
    --quiet: #1a2848;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);

    --ok: #8fd4a1;
    --ok-bg: #14301f;
    --danger: #f2a49d;
    --danger-bg: #3a1c1f;
    --due-soon: #f0c45a;
    --due-soon-bg: #33290f;

    --offboard: #8796b6;
  }
}

* {
  box-sizing: border-box;
}

body {
  min-width: 300px;
  margin: 0;
  padding: 0 16px 16px;
  background: var(--page);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

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

.topbar,
.section-heading,
.signed-in,
.form-actions,
.case-heading,
.case-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Masthead (midnight navy band) ---------- */

.masthead {
  margin: 0 -16px 16px;
  padding: 16px 16px 12px;
  color: #e6ecf7;
  background:
    radial-gradient(120% 140% at 100% 0%, rgb(86 117 168 / 38%) 0%, transparent 60%),
    linear-gradient(160deg, var(--navy-800) 0%, var(--navy-900) 100%);
  border-bottom: 1px solid var(--navy-700);
}

.topbar {
  margin: 0;
}

.masthead .eyebrow {
  color: var(--dusk-300);
}

.masthead h1 {
  color: #ffffff;
}

.masthead .button-primary {
  color: var(--navy-950);
  background: var(--dusk-300);
}

.masthead .button-primary:hover:not(:disabled) {
  background: var(--dusk-200);
}

.masthead :focus-visible {
  outline-color: var(--dusk-300);
}

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

.eyebrow {
  margin: 0 0 3px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  font-family: Ubuntu, Roboto, "Segoe UI", system-ui, sans-serif;
}

h1 {
  font-size: 19px;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 17px;
  letter-spacing: -0.01em;
}

h3 {
  margin-bottom: 12px;
  font-size: 15px;
}

/* ---------- Buttons ---------- */

.button,
.text-button,
.segment {
  cursor: pointer;
}

.button {
  min-height: 34px;
  padding: 8px 14px;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.button:disabled {
  cursor: progress;
  opacity: 0.6;
}

.button-primary {
  color: var(--accent-on);
  background: var(--accent);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.button-secondary {
  color: var(--accent-ink);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.button-secondary:hover:not(:disabled) {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.button-quiet {
  color: var(--ink-muted);
  background: var(--quiet);
}

.button-quiet:hover:not(:disabled) {
  background: var(--line);
}

.text-button {
  padding: 4px 0;
  border: 0;
  color: var(--accent-ink);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Signed-in strip lives inside the masthead */
.signed-in {
  margin: 12px 0 0;
  padding: 7px 10px;
  border: 1px solid rgb(159 181 218 / 18%);
  border-radius: 7px;
  color: var(--dusk-200);
  background: rgb(255 255 255 / 5%);
  font-size: 11px;
}

.signed-in #user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signed-in .text-button {
  color: var(--dusk-300);
}

.signed-in .text-button:hover {
  color: #ffffff;
}

.signed-in-actions {
  display: flex;
  flex-shrink: 0;
  gap: 12px;
}

/* ---------- Notices ---------- */

.notice {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-muted);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.5;
}

.privacy-note {
  margin: 0 0 14px;
  padding: 9px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 4px 6px 6px 4px;
  color: var(--ink-muted);
  background: var(--accent-soft);
  font-size: 11px;
  line-height: 1.45;
}

/* ---------- Summary ---------- */

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

@media (max-width: 360px) {
  .summary-row {
    grid-template-columns: 1fr 1fr;
  }
}

.summary-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 10px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent);
  content: "";
}

.summary-card:nth-child(3)::before {
  background: var(--offboard);
}

.summary-card:nth-child(4)::before {
  background: var(--line-strong);
}

.summary-card:has(.is-alert)::before {
  background: var(--danger);
}

.summary-number {
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.summary-number.is-alert {
  color: var(--danger);
}

.summary-label {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.3;
}

.section-heading {
  margin-bottom: 12px;
}

/* ---------- New-case form ---------- */

.case-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.case-form label {
  display: grid;
  gap: 5px;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
}

.case-form input,
.case-form select,
.filters input[type="search"],
.filters select {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.case-form input:focus,
.case-form select:focus,
.filters input[type="search"]:focus,
.filters select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.45;
}

.form-actions {
  justify-content: flex-end;
}

/* ---------- Filters ---------- */

.filters {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  border-radius: 8px;
  background: var(--quiet);
}

.segment {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  color: var(--ink-muted);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  transition: background-color 120ms ease, color 120ms ease;
}

.segment:hover:not(.is-active) {
  color: var(--ink);
}

.segment.is-active {
  color: var(--accent-on);
  background: var(--accent);
  box-shadow: 0 1px 2px rgb(11 20 38 / 20%);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  color: var(--ink-muted);
  font-size: 11px;
}

.inline-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inline-label select {
  width: auto;
  min-height: 28px;
  padding: 3px 6px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.checkbox-label input,
.task-row input {
  accent-color: var(--accent);
}

/* ---------- Case cards ---------- */

.case-list {
  display: grid;
  gap: 10px;
  padding-bottom: 16px;
}

.case-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 120ms ease;
}

.case-card:has(.badge-offboarding) {
  border-left-color: var(--offboard);
}

.case-card:hover,
.case-card[open] {
  border-top-color: var(--line-strong);
  border-right-color: var(--line-strong);
  border-bottom-color: var(--line-strong);
}

.case-summary {
  display: block;
  padding: 12px 13px;
  cursor: pointer;
  list-style: none;
}

.case-summary::-webkit-details-marker {
  display: none;
}

.case-heading {
  align-items: flex-start;
}

.case-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.case-heading h3::before {
  display: inline-block;
  width: 12px;
  color: var(--accent);
  content: "▸";
  transition: transform 120ms ease;
}

.case-card[open] .case-heading h3::before {
  transform: rotate(90deg);
}

.badges {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
}

.badge {
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--ink-muted);
  background: var(--quiet);
  font-size: 10px;
  font-weight: 700;
  text-transform: capitalize;
}

.badge-onboarding {
  color: var(--accent-ink);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.badge-offboarding {
  color: #ffffff;
  background: var(--navy-700);
}

@media (prefers-color-scheme: dark) {
  .badge-offboarding {
    color: var(--ink);
    background: var(--navy-600);
  }
}

.case-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 6px;
  padding-left: 12px;
  color: var(--ink-soft);
  font-size: 11px;
}

.case-meta strong {
  color: var(--ink-muted);
  font-weight: 700;
}

.progress-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  padding-left: 12px;
  color: var(--ink-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  flex: 1;
  height: 6px;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--quiet);
}

.progress-track::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--quiet);
}

.progress-track::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--dusk-500), var(--accent));
}

.case-card:has(.badge-offboarding) .progress-track::-webkit-progress-value {
  background: var(--offboard);
}

.next-task {
  margin: 8px 0 0;
  padding-left: 12px;
  color: var(--ink-muted);
  font-size: 11px;
  line-height: 1.4;
}

.next-task.is-overdue {
  color: var(--danger);
}

.case-body {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--page) 55%, var(--surface));
}

.task-group {
  padding: 10px 13px 4px;
}

.task-group h4 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 4px;
  color: var(--accent-ink);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.task-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}

.task-group .task-row:last-child {
  border-bottom: 0;
}

.task-row input {
  grid-row: span 2;
  margin: 2px 0 0;
}

.task-row.is-saving {
  opacity: 0.55;
}

.task-row.is-done .task-title {
  color: var(--ink-soft);
  text-decoration: line-through;
}

.task-info {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--ink-soft);
  font-size: 10px;
}

.owner {
  color: var(--ink-muted);
  font-weight: 700;
}

.due.is-overdue {
  color: var(--danger);
  font-weight: 700;
}

.due.is-soon {
  color: var(--due-soon);
  font-weight: 700;
}

.empty-group {
  margin: 0;
  padding: 10px 13px 12px;
  color: var(--ink-soft);
  font-size: 11px;
}

/* ---------- Status & states ---------- */

.status-message {
  margin: 0 0 12px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--ok);
  background: var(--ok-bg);
  font-size: 12px;
  line-height: 1.4;
}

.status-message.is-error {
  color: var(--danger);
  background: var(--danger-bg);
}

.empty-state {
  padding: 22px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--ink-soft);
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}

.skeleton {
  height: 74px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--quiet), var(--surface), var(--quiet));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }

  * {
    transition: none !important;
  }
}

.hidden {
  display: none !important;
}

/* ---------- New-case form: process toggle, directory match note and preview ---------- */

.form-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.form-title h3 {
  margin: 0;
}

.segmented-2 {
  grid-template-columns: repeat(2, auto);
}

.segmented-2 .segment {
  padding: 0 12px;
}

.match-note {
  margin: -4px 0 0;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--ink-muted);
  background: var(--quiet);
  font-size: 11px;
  line-height: 1.4;
}

.match-note.is-found {
  color: var(--ok);
  background: var(--ok-bg);
}

.match-note.is-warning {
  color: var(--due-soon);
  background: var(--due-soon-bg);
}

.case-form input.is-autofilled,
.case-form select.is-autofilled {
  border-color: var(--ok);
}

.case-preview {
  padding: 10px 12px;
  border: 1px dashed var(--accent-line);
  border-radius: 7px;
  background: var(--accent-soft);
}

.case-preview h4 {
  margin: 0 0 6px;
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.case-preview ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 16px;
  color: var(--ink);
  font-size: 11.5px;
  line-height: 1.45;
}

.case-preview li::marker {
  color: var(--accent);
}

/* ---------- View switch & insights ---------- */

:root {
  /* Chart colours, validated for colour-blind separation and contrast (light surface). */
  --chart-onboarding: #3f72d6;
  --chart-offboarding: #c2577a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --chart-onboarding: #5a86e0;
    --chart-offboarding: #cc6688;
  }
}

.view-switch {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 16px;
}

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

.period-label select {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
}

#insights-content .summary-row {
  grid-template-columns: 1fr 1fr;
}

.insight-tile::before {
  background: var(--accent);
}

.summary-card.insight-tile:nth-child(3)::before,
.summary-card.insight-tile:nth-child(4)::before {
  background: var(--accent);
}

.summary-card.is-alert-tile::before {
  background: var(--danger);
}

.tile-detail {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.3;
}

.insight-card {
  margin-bottom: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.insight-card h3 {
  margin: 0 0 10px;
  font-size: 13px;
}

.card-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 10px;
  margin-bottom: 10px;
}

.card-heading h3 {
  margin: 0;
}

/* Horizontal bars: on-time rate by owner */
.bar-chart {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  cursor: default;
}

.bar-label {
  color: var(--ink-muted);
  font-weight: 700;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--quiet);
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--chart-onboarding);
}

.bar-row:hover .bar-fill {
  filter: brightness(1.12);
}

.bar-value {
  min-width: 34px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.bar-alert {
  color: var(--danger);
}

/* Grouped columns: joiners and leavers by month */
.legend {
  display: flex;
  gap: 10px;
  color: var(--ink-muted);
  font-size: 11px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.swatch-onboarding,
.col-onboarding {
  background: var(--chart-onboarding);
}

.swatch-offboarding,
.col-offboarding {
  background: var(--chart-offboarding);
}

.col-chart {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px;
}

.col-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 96px;
  color: var(--ink-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.col-plot {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.col-group {
  display: grid;
  gap: 4px;
}

.col-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 96px;
  border-bottom: 1px solid var(--line-strong);
}

.col-bar {
  width: 40%;
  max-width: 14px;
  border-radius: 4px 4px 0 0;
}

.col-bar:hover {
  filter: brightness(1.12);
}

.col-label {
  color: var(--ink-soft);
  font-size: 10px;
  text-align: center;
}

/* Late steps & department table */
.late-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.late-list li {
  font-size: 12px;
  line-height: 1.4;
}

.late-list li::marker {
  color: var(--ink-soft);
  font-weight: 700;
}

.late-title {
  display: block;
}

.late-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10.5px;
}

.insight-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.insight-table th,
.insight-table td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.insight-table th:first-child {
  text-align: left;
}

.insight-table thead th {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
}

.insight-table tbody th {
  font-weight: 400;
  overflow-wrap: anywhere;
}

.insight-table tbody tr:last-child > * {
  border-bottom: 0;
}

.cell-alert {
  color: var(--danger);
  font-weight: 700;
}

.insight-empty {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.insight-footnote {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.45;
}

.case-card.is-new {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* TheHiveWay full-page workspace */
:root {
  color-scheme: light;
  --navy-950: #202a35;
  --navy-900: #293542;
  --navy-800: #344252;
  --navy-700: #405166;
  --navy-600: #526579;
  --dusk-700: #8a5a18;
  --dusk-600: #a76e20;
  --dusk-500: #c58a38;
  --dusk-400: #d7a85e;
  --dusk-300: #e8c98d;
  --dusk-200: #f0dfbd;
  --dusk-100: #f7edd9;
  --dusk-50: #fbf7ef;
  --accent: #b87927;
  --accent-hover: #9c631c;
  --accent-on: #ffffff;
  --accent-ink: #795019;
  --accent-soft: #fbf5e9;
  --accent-line: #ead9b9;
  --ring: #b87927;
  --ink: #28323d;
  --ink-muted: #596573;
  --ink-soft: #7d8791;
  --surface: #ffffff;
  --page: #f8f8f6;
  --line: #e7e8e5;
  --line-strong: #d4d7d2;
  --quiet: #f1f2ef;
  --shadow: 0 2px 6px rgb(34 42 48 / 4%), 0 12px 30px rgb(34 42 48 / 3%);
  --offboard: #627186;
  --chart-onboarding: #b87927;
  --chart-offboarding: #627186;
  font-family: Inter, "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: light;
    --accent: #b87927;
    --accent-hover: #9c631c;
    --accent-on: #ffffff;
    --accent-ink: #795019;
    --accent-soft: #fbf5e9;
    --accent-line: #ead9b9;
    --ring: #b87927;
    --ink: #28323d;
    --ink-muted: #596573;
    --ink-soft: #7d8791;
    --surface: #ffffff;
    --page: #f8f8f6;
    --line: #e7e8e5;
    --line-strong: #d4d7d2;
    --quiet: #f1f2ef;
    --shadow: 0 2px 6px rgb(34 42 48 / 4%), 0 12px 30px rgb(34 42 48 / 3%);
    --ok: #1a7a3d;
    --ok-bg: #e6f4ea;
    --danger: #b0281f;
    --danger-bg: #fcebe9;
    --due-soon: #8a5a00;
    --due-soon-bg: #fdf3dc;
    --offboard: #627186;
    --chart-onboarding: #b87927;
    --chart-offboarding: #627186;
  }
}

body {
  min-width: 320px;
  padding: 0 32px 56px;
  background:
    radial-gradient(ellipse at 92% 18%, rgb(232 201 141 / 12%), transparent 32rem),
    var(--page);
}

.masthead {
  position: relative;
  margin: 0 -32px 34px;
  padding: 0 32px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: rgb(255 255 255 / 96%);
}

.masthead::after {
  position: absolute;
  top: 0;
  right: 0;
  width: min(72vw, 760px);
  height: 100%;
  min-height: 88px;
  pointer-events: none;
  opacity: 0.1;
  background-image:
    linear-gradient(90deg, rgb(255 255 255 / 94%) 0%, rgb(255 255 255 / 64%) 20%, rgb(255 255 255 / 8%) 58%, transparent 100%),
    url("header-map.svg");
  background-repeat: no-repeat;
  background-position: center, right center;
  background-size: 100% 100%, cover;
  content: "";
}

.topbar {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  min-height: 88px;
  margin: 0 auto;
  gap: 24px;
}

.brand {
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-logo-frame {
  position: relative;
  width: 42px;
  height: 42px;
  flex: none;
  overflow: hidden;
}

.brand-mark {
  position: absolute;
  top: -26px;
  left: -41px;
  width: 124px;
  max-width: none;
  height: 124px;
  clip-path: none;
  overflow: visible;
  background: none;
}

.brand .eyebrow {
  margin-bottom: 1px;
  color: #78828c;
  font-size: 10px;
  letter-spacing: 0.15em;
}

.brand h1 {
  color: #293542;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.045em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.masthead .button-primary {
  color: #ffffff;
  background: var(--navy-800);
}

.masthead .button-primary:hover:not(:disabled) {
  background: var(--navy-700);
}

.masthead :focus-visible {
  outline-color: var(--accent);
}

main {
  max-width: 1280px;
  margin: 0 auto;
}

h2 {
  color: #293542;
  font-size: 22px;
  font-weight: 620;
  letter-spacing: -0.035em;
}

h3 {
  color: #344252;
}

.eyebrow {
  letter-spacing: 0.14em;
}

.signed-in {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 0 12px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink-muted);
  background: transparent;
}

.signed-in .text-button {
  color: var(--accent-ink);
}

.notice {
  position: relative;
  max-width: 760px;
  margin: 70px auto;
  padding: 42px 44px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 15px;
  line-height: 1.7;
}

.notice::before {
  display: block;
  width: 36px;
  height: 4px;
  margin-bottom: 20px;
  border-radius: 4px;
  background: var(--accent);
  content: "";
}

.notice h2 {
  max-width: 520px;
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.15;
}

.notice p:last-child {
  max-width: 540px;
  margin: 0;
  color: var(--ink-muted);
}

.site-footer {
  width: fit-content;
  margin: 32px auto 0;
  padding: 10px 18px;
  border: 1px solid rgb(255 255 255 / 82%);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgb(255 255 255 / 58%);
  box-shadow: 0 8px 24px rgb(41 53 66 / 4%), inset 0 1px rgb(255 255 255 / 82%);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-align: center;
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
}

.site-footer p {
  margin: 0;
}

.privacy-note {
  margin-bottom: 22px;
  padding: 12px 16px;
  border: 1px solid var(--accent-line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 12px;
}

.view-switch {
  width: min(100%, 360px);
  margin: 0 0 26px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f0f1ee;
}

.view-switch .segment {
  min-height: 36px;
  font-size: 12px;
}

.view-switch .segment.is-active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 3px rgb(34 42 48 / 10%);
}

.summary-row {
  gap: 14px;
  margin-bottom: 38px;
}

.summary-card {
  min-height: 100px;
  justify-content: center;
  gap: 6px;
  padding: 20px 22px;
  border-color: var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.summary-card::before {
  display: none;
}

.summary-number {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.summary-label {
  font-size: 12px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading .eyebrow {
  margin-bottom: 5px;
}

.button {
  min-height: 40px;
  padding: 10px 17px;
  border-radius: 8px;
  font-size: 13px;
}

.button-primary {
  background: var(--navy-800);
}

.button-primary:hover:not(:disabled) {
  background: var(--navy-700);
}

.button-secondary {
  color: var(--accent-ink);
  background: #fbf5e9;
  box-shadow: inset 0 0 0 1px #ead9b9;
}

.button-secondary:hover:not(:disabled) {
  background: #f7edd9;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.case-form {
  gap: 16px;
  margin-bottom: 22px;
  padding: 24px;
  border-color: var(--line);
  border-radius: 12px;
}

.case-form label {
  gap: 7px;
  font-size: 12px;
}

.case-form input,
.case-form select,
.filters input[type="search"],
.filters select {
  min-height: 40px;
  padding: 8px 11px;
  border-color: var(--line-strong);
  border-radius: 7px;
  font-size: 13px;
}

.form-title {
  margin-bottom: 3px;
}

.form-title h3 {
  font-size: 17px;
}

.segmented {
  padding: 4px;
  border-radius: 8px;
  background: var(--quiet);
}

.segment {
  min-height: 34px;
  font-size: 12px;
}

.segment.is-active {
  color: #ffffff;
  background: var(--navy-800);
  box-shadow: none;
}

.filters {
  gap: 13px;
  margin: 24px 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.filters input[type="search"] {
  max-width: 460px;
}

.filter-row {
  gap: 10px 22px;
  font-size: 12px;
}

.inline-label select {
  min-height: 34px;
  padding: 4px 8px;
}

.case-list {
  gap: 12px;
}

.case-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.case-card:has(.badge-offboarding) {
  border-left-color: var(--line);
}

.case-card:hover,
.case-card[open] {
  border-color: var(--line-strong);
}

.case-summary {
  padding: 19px 21px;
}

.case-heading h3 {
  font-size: 16px;
}

.case-heading h3::before {
  color: var(--accent);
}

.badge {
  padding: 5px 10px;
  font-size: 10px;
  letter-spacing: 0.02em;
}

.badge-offboarding {
  color: #465364;
  background: #edf0f3;
}

.case-meta,
.progress-line {
  padding-left: 15px;
  font-size: 12px;
}

.next-task {
  padding-left: 15px;
  font-size: 12px;
}

.task-group {
  padding: 15px 20px 6px;
}

.task-group h4 {
  margin-bottom: 8px;
  color: var(--accent-ink);
  font-size: 11px;
}

.task-row {
  gap: 4px 10px;
  padding: 11px 0;
  font-size: 13px;
}

.task-info {
  gap: 5px 12px;
  font-size: 11px;
}

.insight-card {
  margin-bottom: 16px;
  padding: 20px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.insight-card h3 {
  font-size: 15px;
}

.insight-tile::before,
.summary-card.insight-tile:nth-child(3)::before,
.summary-card.insight-tile:nth-child(4)::before {
  display: none;
}

.insight-table {
  font-size: 13px;
}

.insight-table th,
.insight-table td {
  padding: 10px 8px;
}

.status-message {
  padding: 12px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
}

.status-message.is-error {
  border-color: #f0d0cc;
}

.empty-state {
  padding: 34px;
  border-radius: 12px;
  font-size: 14px;
}

@media (min-width: 900px) {
  #insights-content .summary-row {
    grid-template-columns: repeat(4, 1fr);
  }

  #insights-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
  }

  #insights-content > .summary-row,
  #insights-content > .insight-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  body {
    padding: 0 16px 36px;
  }

  .masthead {
    margin: 0 -16px 22px;
    padding: 0 16px;
  }

  .topbar {
    min-height: 76px;
  }

  .brand-logo-frame {
    width: 36px;
    height: 36px;
  }

  .brand-mark {
    top: -22.5px;
    left: -36px;
    width: 108px;
    height: 108px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar .button {
    min-height: 36px;
    padding: 8px 11px;
    font-size: 11px;
  }

  .notice {
    margin: 36px auto;
    padding: 26px;
  }

  .notice h2 {
    font-size: 25px;
  }

  .summary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 28px;
  }

  .summary-card {
    min-height: 86px;
    padding: 15px;
  }

  .summary-number {
    font-size: 26px;
  }

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

  .form-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .filters {
    padding: 12px;
  }

  .case-summary {
    padding: 15px;
  }

  .badges {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .case-heading h3 {
    font-size: 14px;
  }
}

@media (max-width: 380px) {
  .brand .eyebrow {
    font-size: 8px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .topbar .button {
    padding: 7px 8px;
  }
}

/* Translucent glass surfaces over soft ambient color */
:root {
  --glass-edge: rgb(255 255 255 / 86%);
  --glass-fill: rgb(255 255 255 / 66%);
  --glass-shadow: 0 18px 48px rgb(41 53 66 / 7%), inset 0 1px 0 rgb(255 255 255 / 82%);
}

body {
  background:
    radial-gradient(780px 420px at 88% 8%, rgb(232 201 141 / 22%), transparent 72%),
    radial-gradient(700px 440px at 8% 34%, rgb(196 213 225 / 22%), transparent 72%),
    radial-gradient(650px 500px at 82% 78%, rgb(232 218 192 / 18%), transparent 74%),
    var(--page);
}

.masthead {
  border-bottom: 1px solid rgb(255 255 255 / 88%);
  background: linear-gradient(115deg, rgb(255 255 255 / 88%), rgb(255 255 255 / 68%));
  box-shadow: 0 8px 28px rgb(41 53 66 / 5%);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

.masthead::after {
  z-index: 0;
}

.topbar {
  z-index: 1;
}

.signed-in {
  margin-bottom: 12px;
  padding: 9px 14px;
  border: 1px solid rgb(255 255 255 / 78%);
  border-radius: 12px;
  background: rgb(255 255 255 / 48%);
  box-shadow: 0 6px 20px rgb(41 53 66 / 4%), inset 0 1px rgb(255 255 255 / 82%);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}

.notice,
.summary-card,
.case-form,
.filters,
.case-card,
.insight-card {
  border: 1px solid var(--glass-edge);
  background: linear-gradient(145deg, rgb(255 255 255 / 82%), rgb(255 255 255 / 58%));
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
}

.notice {
  overflow: hidden;
}

.notice::after {
  position: absolute;
  top: -112px;
  right: -72px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(232 201 141 / 22%), rgb(232 201 141 / 0%) 70%);
  content: "";
  pointer-events: none;
}

.notice > * {
  position: relative;
  z-index: 1;
}

.notice::before {
  position: relative;
  z-index: 1;
}

.summary-card {
  border-radius: 14px;
}

.privacy-note {
  border-color: rgb(234 217 185 / 78%);
  background: rgb(251 245 233 / 62%);
  box-shadow: 0 8px 24px rgb(41 53 66 / 3%), inset 0 1px rgb(255 255 255 / 70%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.view-switch {
  border-color: rgb(255 255 255 / 82%);
  background: rgb(237 239 237 / 54%);
  box-shadow: 0 8px 24px rgb(41 53 66 / 4%), inset 0 1px rgb(255 255 255 / 76%);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.view-switch .segment.is-active {
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 4px 12px rgb(41 53 66 / 8%), inset 0 1px rgb(255 255 255 / 90%);
}

.button-primary,
.masthead .button-primary {
  border: 1px solid rgb(255 255 255 / 20%);
  background: linear-gradient(135deg, #405166, #2c3948);
  box-shadow: 0 8px 20px rgb(41 53 66 / 15%), inset 0 1px rgb(255 255 255 / 16%);
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.button-primary:hover:not(:disabled),
.masthead .button-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #4a5d73, #344252);
  box-shadow: 0 11px 24px rgb(41 53 66 / 18%), inset 0 1px rgb(255 255 255 / 18%);
}

.button-secondary {
  border: 1px solid rgb(255 255 255 / 86%);
  background: linear-gradient(135deg, rgb(255 255 255 / 82%), rgb(251 245 233 / 62%));
  box-shadow: 0 6px 18px rgb(41 53 66 / 5%), inset 0 1px rgb(255 255 255 / 90%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.button-secondary:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(135deg, rgb(255 255 255 / 94%), rgb(251 245 233 / 76%));
  box-shadow: 0 9px 22px rgb(41 53 66 / 8%), inset 0 1px rgb(255 255 255 / 94%);
}

.case-form input,
.case-form select,
.filters input[type="search"],
.filters select,
.period-label select {
  border-color: rgb(212 215 210 / 82%);
  background: rgb(255 255 255 / 72%);
  box-shadow: inset 0 1px 2px rgb(41 53 66 / 3%), 0 1px rgb(255 255 255 / 70%);
}

.case-form input:focus,
.case-form select:focus,
.filters input[type="search"]:focus,
.filters select:focus {
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 0 0 3px rgb(184 121 39 / 12%), inset 0 1px 2px rgb(41 53 66 / 3%);
}

.case-card:hover,
.case-card[open] {
  border-color: rgb(255 255 255 / 96%);
  box-shadow: 0 22px 54px rgb(41 53 66 / 9%), inset 0 1px rgb(255 255 255 / 92%);
}

.case-body {
  background: rgb(255 255 255 / 42%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.insight-card {
  border-radius: 14px;
}

@supports not ((backdrop-filter: blur(1px))) {
  .notice,
  .summary-card,
  .case-form,
  .filters,
  .case-card,
  .insight-card,
  .masthead {
    background-color: rgb(255 255 255 / 94%);
  }
}
