/* CSWN shared theme (admin redesign, phase 1).
   Tokens and generic components, light and dark. Every class starts with cs- and every token with --cs-, so nothing here can change an existing page until that page opts in by using them.
   Dark mode follows the same switch the portals already use: html[data-theme="dark"] (public/js/theme.js).
   Usage guide: docs/design/THEME.md. Linked from admin.html only. */

:root {
  --cs-bg: #eee9e1;
  --cs-side: #e6e0d6;
  --cs-card: #faf8f4;
  --cs-card2: #f2eee7;
  --cs-line: #dcd4c8;
  --cs-line2: #bfb4a5;
  --cs-tx: #231f1b;
  --cs-tx2: #554c43;
  --cs-tx3: #6b6157;
  --cs-acc: #8a4e2f;
  --cs-acc-tx: #82482a;
  --cs-acc-hover: #723d22;
  --cs-acc-soft: #f0e2d7;
  --cs-on-acc: #fbf7f2;
  --cs-dng: #9e3328;
  --cs-dng-bg: #f6e3de;
  --cs-dng-line: #e2b6ac;
  --cs-wrn: #7a5212;
  --cs-wrn-bg: #f5ead2;
  --cs-wrn-line: #dfc797;
  --cs-inf: #335769;
  --cs-inf-bg: #e2e9ec;
  --cs-inf-line: #b6cad3;
  --cs-ok: #42613b;
  --cs-ok-bg: #e3eadc;
  --cs-ok-line: #b9cbae;
  --cs-neu: #554c43;
  --cs-neu-bg: #ece7df;
  --cs-neu-line: #d2c8bb;
  --cs-shadow-pop: 0 10px 28px rgba(20, 15, 10, 0.16);

  --cs-serif: 'Cormorant Garamond', Georgia, serif;
  --cs-sans: 'Jost', system-ui, sans-serif;

  /* type scale */
  --cs-fs-body: 14px;
  --cs-fs-label: 12.5px;
  --cs-fs-eyebrow: 11px;
  --cs-fs-button: 11.5px;
  --cs-fs-title: 40px;
  --cs-fs-heading: 26px;
  --cs-fs-kpi: 46px;

  /* spacing scale */
  --cs-space-1: 4px;
  --cs-space-2: 8px;
  --cs-space-3: 12px;
  --cs-space-4: 16px;
  --cs-space-5: 20px;
  --cs-space-6: 24px;
  --cs-space-7: 36px;
  --cs-space-8: 56px;
  --cs-radius: 3px;
  --cs-control-h: 38px;
}

html[data-theme='dark'] {
  --cs-bg: #121110;
  --cs-side: #181715;
  --cs-card: #1f1d1b;
  --cs-card2: #282522;
  --cs-line: #34302c;
  --cs-line2: #4d4640;
  --cs-tx: #ede7df;
  --cs-tx2: #beb5aa;
  --cs-tx3: #a0968b;
  --cs-acc: #d59b77;
  --cs-acc-tx: #e0ac8a;
  --cs-acc-hover: #e3b091;
  --cs-acc-soft: #33261f;
  --cs-on-acc: #1b1410;
  --cs-dng: #f0a397;
  --cs-dng-bg: #351e1a;
  --cs-dng-line: #61352e;
  --cs-wrn: #e4c07e;
  --cs-wrn-bg: #2e2618;
  --cs-wrn-line: #5a482a;
  --cs-inf: #a0c2d4;
  --cs-inf-bg: #1a252b;
  --cs-inf-line: #314852;
  --cs-ok: #abc89d;
  --cs-ok-bg: #1e281c;
  --cs-ok-line: #384b31;
  --cs-neu: #cbc2b7;
  --cs-neu-bg: #292624;
  --cs-neu-line: #443f39;
  --cs-shadow-pop: 0 10px 28px rgba(0, 0, 0, 0.5);
}

/* ---- type ---- */
.cs-title {
  font: 600 var(--cs-fs-title) / 1 var(--cs-serif);
  color: var(--cs-tx);
}
.cs-heading {
  font: 600 var(--cs-fs-heading) / 1.1 var(--cs-serif);
  color: var(--cs-tx);
}
.cs-eyebrow {
  font: 600 var(--cs-fs-eyebrow) / 1 var(--cs-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cs-tx2);
}
.cs-label {
  font: 500 var(--cs-fs-label) / 1.2 var(--cs-sans);
  color: var(--cs-tx2);
}
.cs-muted {
  color: var(--cs-tx2);
}
.cs-kpi {
  font: 400 var(--cs-fs-kpi) / 1 var(--cs-sans);
  color: var(--cs-tx);
}

/* ---- buttons ---- */
.cs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--cs-space-2);
  height: 36px;
  padding: 0 var(--cs-space-4);
  border: 1px solid var(--cs-line2);
  border-radius: var(--cs-radius);
  background: transparent;
  color: var(--cs-tx);
  font: 500 var(--cs-fs-button) / 1 var(--cs-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}
.cs-btn:hover {
  background: var(--cs-card2);
}
.cs-btn:focus-visible {
  outline: 2px solid var(--cs-acc);
  outline-offset: 2px;
}
.cs-btn:disabled,
.cs-btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
}
.cs-btn-primary {
  background: var(--cs-acc);
  border-color: var(--cs-acc);
  color: var(--cs-on-acc);
}
.cs-btn-primary:hover {
  background: var(--cs-acc-hover);
  border-color: var(--cs-acc-hover);
}
.cs-btn-quiet {
  border-color: transparent;
  padding: 0 10px;
  color: var(--cs-acc-tx);
}
.cs-btn-quiet:hover {
  background: var(--cs-acc-soft);
}
.cs-btn-danger {
  border-color: var(--cs-dng-line);
  color: var(--cs-dng);
}
.cs-btn-danger:hover {
  background: var(--cs-dng-bg);
  border-color: var(--cs-dng);
}
.cs-btn-icon {
  width: 36px;
  padding: 0;
  border-color: transparent;
  color: var(--cs-tx2);
}
.cs-btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

/* ---- badges: a tinted pill with a dot; tone = dng, wrn, inf, ok, neu or acc ---- */
.cs-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--cs-tone-line, var(--cs-neu-line));
  border-radius: var(--cs-radius);
  background: var(--cs-tone-bg, var(--cs-neu-bg));
  color: var(--cs-tone-fg, var(--cs-neu));
  font: 500 12px / 1 var(--cs-sans);
}
.cs-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cs-tone-fg, var(--cs-neu));
}
.cs-tone-dng {
  --cs-tone-fg: var(--cs-dng);
  --cs-tone-bg: var(--cs-dng-bg);
  --cs-tone-line: var(--cs-dng-line);
}
.cs-tone-wrn {
  --cs-tone-fg: var(--cs-wrn);
  --cs-tone-bg: var(--cs-wrn-bg);
  --cs-tone-line: var(--cs-wrn-line);
}
.cs-tone-inf {
  --cs-tone-fg: var(--cs-inf);
  --cs-tone-bg: var(--cs-inf-bg);
  --cs-tone-line: var(--cs-inf-line);
}
.cs-tone-ok {
  --cs-tone-fg: var(--cs-ok);
  --cs-tone-bg: var(--cs-ok-bg);
  --cs-tone-line: var(--cs-ok-line);
}
.cs-tone-neu {
  --cs-tone-fg: var(--cs-neu);
  --cs-tone-bg: var(--cs-neu-bg);
  --cs-tone-line: var(--cs-neu-line);
}
.cs-tone-acc {
  --cs-tone-fg: var(--cs-acc-tx);
  --cs-tone-bg: var(--cs-acc-soft);
  --cs-tone-line: var(--cs-acc);
}

/* ---- alert: a one-line tinted bar; same tones as badges ---- */
.cs-alert {
  display: flex;
  align-items: center;
  gap: var(--cs-space-3);
  padding: 11px var(--cs-space-4);
  border: 1px solid var(--cs-tone-line, var(--cs-neu-line));
  border-radius: var(--cs-radius);
  background: var(--cs-tone-bg, var(--cs-neu-bg));
  color: var(--cs-tx);
  font: 400 13.5px / 1.4 var(--cs-sans);
}
.cs-alert::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cs-tone-fg, var(--cs-neu));
}
.cs-alert-title {
  font-weight: 500;
  font-size: 14px;
}
.cs-alert-action {
  margin-left: auto;
}

/* ---- card: 1px border, 3px radius, no shadow; a tone tints the border only when action is needed ---- */
.cs-card {
  background: var(--cs-card);
  border: 1px solid var(--cs-tone-line, var(--cs-line));
  border-radius: var(--cs-radius);
  color: var(--cs-tx);
}
.cs-card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--cs-line);
  font: 600 var(--cs-fs-eyebrow) / 1 var(--cs-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cs-tx2);
}
.cs-card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
}

/* ---- tabs ---- */
.cs-tabs {
  display: flex;
  border-bottom: 1px solid var(--cs-line);
}
.cs-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 13px 14px 12px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--cs-tx2);
  font: 500 12px / 1 var(--cs-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.cs-tab:hover {
  color: var(--cs-tx);
}
.cs-tab:focus-visible {
  outline: 2px solid var(--cs-acc);
  outline-offset: -2px;
}
.cs-tab.is-active,
.cs-tab[aria-selected='true'] {
  color: var(--cs-acc-tx);
  border-bottom-color: var(--cs-acc);
}
.cs-tab.is-locked {
  color: var(--cs-tx3);
}

/* ---- forms ---- */
.cs-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cs-input,
.cs-select {
  height: var(--cs-control-h);
  padding: 0 12px;
  background: var(--cs-card);
  border: 1px solid var(--cs-line2);
  border-radius: var(--cs-radius);
  color: var(--cs-tx);
  font: 400 var(--cs-fs-body) var(--cs-sans);
}
.cs-input::placeholder {
  color: var(--cs-tx3);
  opacity: 1;
}
.cs-input:focus,
.cs-select:focus {
  outline: none;
  border-color: var(--cs-acc);
  box-shadow: 0 0 0 2px var(--cs-acc-soft);
}
.cs-input.is-error {
  border-color: var(--cs-dng);
}
.cs-field-error {
  font: 400 var(--cs-fs-label) var(--cs-sans);
  color: var(--cs-dng);
}
.cs-input:disabled,
.cs-select:disabled {
  opacity: 0.45;
}

/* ---- table: header on the alt surface, row rules, hover tint ---- */
.cs-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--cs-card);
  color: var(--cs-tx);
  font: 400 var(--cs-fs-body) var(--cs-sans);
}
.cs-table th {
  padding: 10px 14px;
  background: var(--cs-card2);
  border-bottom: 1px solid var(--cs-line);
  text-align: left;
  font: 600 var(--cs-fs-eyebrow) / 1.2 var(--cs-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cs-tx2);
}
.cs-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--cs-line);
}
.cs-table tbody tr:hover td {
  background: var(--cs-card2);
}

/* ---- popup menu ---- */
.cs-menu {
  padding: 4px;
  background: var(--cs-card);
  border: 1px solid var(--cs-line2);
  border-radius: var(--cs-radius);
  box-shadow: var(--cs-shadow-pop);
}
.cs-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 10px;
  border-radius: 2px;
  color: var(--cs-tx);
  cursor: pointer;
}
.cs-menu-item:hover {
  background: var(--cs-card2);
}
.cs-menu-item.is-selected {
  background: var(--cs-acc-soft);
}

/* ---- admin shell (phase 2): side menu and top bar; the markup keeps its existing classes and ids, these only restyle it ---- */
.cs-sidebar {
  background: var(--cs-side);
  border-right: 1px solid var(--cs-line);
  font-family: var(--cs-sans);
}
.cs-sidebar .brand {
  border-bottom-color: var(--cs-line) !important;
}
.cs-sidebar .nav-group-toggle {
  margin-top: 6px;
  border-top: 0;
}
.cs-sidebar .nav-group-toggle .nav-section-label {
  padding: 14px 20px 8px;
  font: 600 var(--cs-fs-eyebrow) / 1 var(--cs-sans);
  letter-spacing: 0.16em;
  color: var(--cs-tx2);
}
.cs-sidebar .nav-group-toggle::after {
  color: var(--cs-tx2);
}
.cs-sidebar .nav-group-toggle:hover .nav-section-label,
.cs-sidebar .nav-group-toggle:focus-visible .nav-section-label {
  color: var(--cs-tx);
}
.cs-sidebar .nav-item {
  margin: 1px 8px;
  padding: 8px 10px 8px 14px;
  border-left: 0;
  border-radius: var(--cs-radius);
  font: 400 var(--cs-fs-body) / 1.25 var(--cs-sans);
  letter-spacing: 0;
  color: var(--cs-tx);
}
.cs-sidebar .nav-group-items .nav-item {
  padding-left: 14px;
}
.cs-sidebar .nav-item:hover {
  background: var(--cs-card2);
  color: var(--cs-tx);
}
.cs-sidebar .nav-item.active {
  background: var(--cs-acc-soft);
  color: var(--cs-acc-tx);
  font-weight: 500;
  box-shadow: none;
}
.cs-sidebar .nav-item:focus-visible,
.cs-sidebar .nav-group-toggle:focus-visible {
  outline: 2px solid var(--cs-acc);
  outline-offset: -2px;
}
.cs-sidebar .nav-group-items .nav-sub-label {
  padding: 14px 20px 4px;
  font: 600 var(--cs-fs-eyebrow) / 1 var(--cs-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cs-tx2);
}
.cs-sidebar .nav-badge {
  padding: 1px 6px;
  border: 1px solid var(--cs-dng-line);
  border-radius: var(--cs-radius);
  background: var(--cs-dng-bg);
  color: var(--cs-dng);
  font: 500 11.5px / 1.3 var(--cs-sans);
}
.cs-sidebar .sidebar-footer {
  border-top: 1px solid var(--cs-line);
  color: var(--cs-tx2);
}

.cs-topbar {
  background: var(--cs-bg);
  border-bottom: 1px solid var(--cs-line);
  font-family: var(--cs-sans);
}
.cs-topbar .topbar-title {
  font: 600 22px / 1 var(--cs-serif);
  color: var(--cs-tx);
}
.cs-topbar .master-search-wrap input {
  height: var(--cs-control-h);
  padding: 0 12px;
  background: var(--cs-card);
  border: 1px solid var(--cs-line2);
  border-radius: var(--cs-radius);
  color: var(--cs-tx);
  font: 400 var(--cs-fs-body) var(--cs-sans);
}
.cs-topbar .master-search-wrap input::placeholder {
  color: var(--cs-tx3);
  opacity: 1;
}
.cs-topbar .master-search-wrap input:focus {
  border-color: var(--cs-acc);
  box-shadow: 0 0 0 2px var(--cs-acc-soft);
}
.cs-topbar #master-search-results {
  background: var(--cs-card);
  border: 1px solid var(--cs-line2);
  border-radius: var(--cs-radius);
  box-shadow: var(--cs-shadow-pop);
}
.cs-topbar #theme-btn,
.cs-topbar .hamburger {
  height: 34px;
  border: 1px solid var(--cs-line2);
  border-radius: var(--cs-radius);
  background: transparent;
  color: var(--cs-tx);
  font: 500 var(--cs-fs-button) / 1 var(--cs-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.cs-topbar #theme-btn:hover,
.cs-topbar .hamburger:hover,
.cs-topbar .topbar-signout:hover {
  background: var(--cs-card2);
}
.cs-topbar #theme-btn:focus-visible,
.cs-topbar .hamburger:focus-visible,
.cs-topbar .topbar-signout:focus-visible {
  outline: 2px solid var(--cs-acc);
  outline-offset: 2px;
}

/* ---- admin dashboard (phase 3): key numbers, "Needs you today" cards, Claims Health ---- */
.cs-card.card {
  background: var(--cs-card);
  border-color: var(--cs-tone-line, var(--cs-line));
  border-radius: var(--cs-radius);
}
.cs-stat {
  padding: 18px 20px;
  background: var(--cs-card);
  border: 1px solid var(--cs-line);
  border-radius: var(--cs-radius);
}
.cs-stat .stat-label {
  margin-bottom: 8px;
  font: 600 var(--cs-fs-eyebrow) / 1 var(--cs-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cs-tx2);
}
.cs-stat .stat-value {
  font: 400 40px / 1 var(--cs-sans);
  color: var(--cs-tx);
}
.cs-stat .stat-sub {
  margin-top: 6px;
  font: 400 13.5px / 1.4 var(--cs-sans);
  color: var(--cs-tx2);
}
.cs-need-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.cs-need {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 16px;
  text-align: left;
  font: 400 var(--cs-fs-body) / 1.4 var(--cs-sans);
  cursor: pointer;
}
.cs-need:hover {
  background: var(--cs-card2);
}
.cs-need:focus-visible {
  outline: 2px solid var(--cs-acc);
  outline-offset: 2px;
}
.cs-need-kicker {
  font: 600 var(--cs-fs-eyebrow) / 1 var(--cs-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cs-tone-fg, var(--cs-tx2));
}
.cs-need-title {
  font: 500 15.5px / 1.3 var(--cs-sans);
  color: var(--cs-tx);
}
.cs-need-sub {
  font: 400 13.5px / 1.45 var(--cs-sans);
  color: var(--cs-tx2);
}
.cs-health {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cs-health-row {
  display: grid;
  grid-template-columns: 190px 56px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--cs-radius);
  background: transparent;
  color: var(--cs-tx);
  font: 400 var(--cs-fs-body) var(--cs-sans);
  text-align: left;
  cursor: pointer;
}
.cs-health-row .cs-badge {
  justify-self: start;
}
.cs-health-row:hover {
  background: var(--cs-card2);
  border-color: var(--cs-line);
}
.cs-health-row:focus-visible {
  outline: 2px solid var(--cs-acc);
  outline-offset: 2px;
}
.cs-health-count {
  font: 500 15px / 1 var(--cs-sans);
  text-align: right;
}
.cs-health-bar {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--cs-card2);
  overflow: hidden;
}
.cs-health-bar > span {
  display: block;
  height: 100%;
  background: var(--cs-tone-fg, var(--cs-neu));
}
@media (max-width: 640px) {
  .cs-health-row {
    grid-template-columns: 1fr 48px;
  }
  .cs-health-bar {
    grid-column: 1 / -1;
  }
}
/* Content-sized admin tables (owner 11/11): columns take what their content needs, long text (messages, payer names) wraps instead of stretching the table, and action buttons stay compact. Add class "cs-tbl-fit" to a table; give a long-text cell class "cs-tbl-msg". */
.cs-tbl-fit { width: auto; max-width: 100%; table-layout: auto; }
.cs-tbl-fit th { white-space: nowrap; }
.cs-tbl-fit th, .cs-tbl-fit td { vertical-align: top; }
.cs-tbl-fit td { max-width: 26ch; white-space: normal; overflow-wrap: anywhere; }
.cs-tbl-fit td.cs-tbl-msg { max-width: 48ch; white-space: pre-wrap; }
.cs-tbl-fit td.cs-tbl-num, .cs-tbl-fit td.cs-tbl-date { white-space: nowrap; max-width: none; }
.cs-tbl-fit td:last-child { white-space: nowrap; max-width: none; }
.cs-tbl-fit .btn, .cs-tbl-fit button { padding: 4px 8px; font-size: 12px; white-space: nowrap; }

