/* Roaming Therapy finance dashboard — white-first handoff system, Roaming Therapy palette.
   Token names follow the style handoff (paper/cream/muted/soft-fill/ink/slate/gold→brand/deep/line). */
@font-face { font-family: "Inter"; src: url("/static/fonts/inter-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Lora"; src: url("/static/fonts/lora-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --paper: #ffffff;        /* page background */
  --cream: #fcf8f7;        /* RT site global cream (--e-global-color-1504cac) → cards, sidebar */
  --muted: #f6f0ee;        /* table header, zebra, hover (derived from cream) */
  --soft-fill: #e7f6f9;    /* active nav, icon chips (tint of RT teal) */
  --ink: #111111;          /* RT site text (#111111) */
  --slate: #475569;        /* RT site secondary text */
  --brand: #08a9c9;        /* RT primary teal (logo + --e-global-color-primary) → replaces handoff gold */
  --brand-hover: #0797b4;
  --deep: #06728a;         /* deep teal for accent TEXT on light (5.5:1) → replaces handoff deep gold */
  --accent: #f61867;       /* RT secondary pink (logo + --e-global-color-secondary); rare: wordmark, highlights */
  --navy: #324a6d;         /* RT site heading navy; third chart series */
  --line: #ebe3e0;         /* warm hairline */
  --ok: #0f7a55;  --ok-bg: #e7f5ef;
  --warn: #9a5b0b; --warn-bg: #fdf3e2;
  --bad: #c8134f; --bad-bg: #fde8ef;   /* deep RT pink for attention */
  --info: #06728a; --info-bg: #e7f6f9;
  --radius: 0.75rem;
  --shadow: 0 8px 28px rgb(17 40 56 / 6%);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-lead: "Lora", Georgia, serif;
}
* { box-sizing: border-box; border-color: var(--line); }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgb(8 169 201 / 40%); border-radius: 999px; }
::-webkit-scrollbar-track { background: var(--muted); }

/* shell */
.shell { display: flex; min-height: 100vh; max-width: 1600px; margin: 0 auto; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 256px; flex-shrink: 0; background: var(--cream); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brandbox { padding: 24px 20px 16px; }
.brandbox img { width: 170px; display: block; }
.brandbox .eyebrow { margin-top: 10px; }
.nav { flex: 1; padding: 0 12px; display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--slate); font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: var(--muted); color: var(--ink); }
.nav a.active { background: var(--soft-fill); color: var(--deep); font-weight: 600; box-shadow: inset 0 0 0 1px rgb(8 169 201 / 35%); }
.nav a svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav .hint { margin-left: auto; font-size: 10px; letter-spacing: .04em; color: var(--slate); opacity: .8; }
.sidefoot { border-top: 1px solid var(--line); padding: 16px 20px; font-size: 11px; line-height: 20px; color: var(--slate); }
.sidefoot b { color: var(--ink); font-weight: 500; }
.sidefoot a { display: inline-flex; min-height: 44px; align-items: center; font-size: 12px; color: var(--slate); text-underline-offset: 2px; }
.sidefoot a:hover { color: var(--deep); text-decoration: underline; }
.main { flex: 1; min-width: 0; }
.topbar { display: none; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 12px 16px; }
.content { max-width: 1280px; margin: 0 auto; padding: 32px; display: flex; flex-direction: column; gap: 32px; }
@media (max-width: 1023px) {
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 288px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 16px 48px rgba(17,40,56,.12); }
  .sidebar.open { transform: none; }
  .backdrop { position: fixed; inset: 0; background: rgb(17 17 17 / 40%); z-index: 40; }
  .topbar { display: flex; }
  .content { padding: 24px 16px; gap: 24px; }
}

/* type */
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--deep); margin: 0; }
h1.title { font-size: 36px; font-weight: 700; letter-spacing: -0.02em; margin: 8px 0 0; line-height: 1.15; }
.lead { font-family: var(--font-lead); color: var(--slate); font-size: 16px; line-height: 1.7; max-width: 48rem; margin: 8px 0 0; }
h2.sec { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.meta { font-size: 12px; color: var(--slate); }
@media (max-width: 767px) { h1.title { font-size: 30px; } .lead { font-size: 14px; } }

/* surfaces */
.card { background: var(--cream); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 20px; }
.card > * + * { margin-top: 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid-kpi { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.grid-2 > * { min-width: 0; }
@media (max-width: 1023px) { .grid-2 { grid-template-columns: 1fr; } }

/* KPI tile */
.kpi { position: relative; overflow: hidden; background: var(--cream); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--brand); }
.kpi.ok::before { background: var(--ok); } .kpi.warn::before { background: var(--warn); } .kpi.bad::before { background: var(--bad); }
.kpi .label { padding-right: 44px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--deep); }
.kpi .value { margin-top: 8px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .hint { margin-top: 4px; font-size: 12px; color: var(--slate); line-height: 1.5; }
.kpi .dot { position: absolute; right: 16px; top: 16px; width: 36px; height: 36px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--soft-fill); color: var(--deep); }
.kpi.ok .dot { background: var(--ok-bg); color: var(--ok); } .kpi.warn .dot { background: var(--warn-bg); color: var(--warn); } .kpi.bad .dot { background: var(--bad-bg); color: var(--bad); }
.kpi .dot svg { width: 16px; height: 16px; }

/* filters */
.filters { position: sticky; top: 0; z-index: 20; background: rgb(255 255 255 / 96%); border-bottom: 1px solid var(--line); padding: 12px 32px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 1023px) { .filters { padding: 12px 16px; position: static; } }
.pill { border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; min-height: 32px; font-size: 12px; font-weight: 500; color: var(--slate); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; transition: background .15s; }
.pill:hover { background: var(--muted); }
.pill.active { background: rgb(8 169 201 / 15%); color: var(--deep); box-shadow: inset 0 0 0 1px rgb(8 169 201 / 40%); }
.field { border: 1px solid var(--line); background: var(--cream); border-radius: 999px; padding: 6px 12px; font-size: 12px; min-height: 32px; outline: none; }
.field:focus { box-shadow: 0 0 0 2px rgb(8 169 201 / 30%); border-color: var(--brand); }
.spacer { flex: 1; }
.updated { font-size: 12px; color: var(--slate); display: flex; align-items: center; gap: 6px; }
.dropdown { position: relative; }
.dropdown .menu { position: absolute; top: 38px; left: 0; z-index: 60; background: var(--cream); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 48px rgba(17,40,56,.12); padding: 8px; width: 280px; max-height: 360px; overflow: auto; }
.dropdown .menu label { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.dropdown .menu label:hover { background: var(--muted); }
.dropdown .menu .sub { color: var(--slate); font-size: 11px; margin-left: auto; }
input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 12px 20px; border-radius: 999px; border: 0; background: var(--brand); color: var(--ink); font-weight: 700; font-size: 15px; cursor: pointer; transition: background .2s, box-shadow .2s; }
.btn:hover { background: var(--brand-hover); box-shadow: 0 8px 24px rgb(6 114 138 / 18%); }
.btn:disabled { opacity: .7; cursor: not-allowed; }

/* tables */
.tablewrap { background: var(--cream); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.tablewrap .scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead tr { background: var(--muted); border-bottom: 1px solid var(--line); }
th { text-align: left; padding: 12px 14px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--deep); white-space: nowrap; }
td { white-space: nowrap; padding: 10px 14px; border-bottom: 1px solid rgb(235 227 224 / 70%); vertical-align: top; color: rgb(17 17 17 / 90%); }
tbody tr:nth-child(even) { background: rgb(246 240 238 / 50%); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; background: var(--muted); }
.empty { padding: 40px 16px; text-align: center; color: var(--slate); font-size: 14px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad, .chip.missing { background: var(--bad-bg); color: var(--bad); } .chip.info, .chip.neutral { background: var(--muted); color: var(--slate); box-shadow: inset 0 0 0 1px var(--line); }
.chip.stale, .chip.degraded { background: var(--warn-bg); color: var(--warn); } .chip.error { background: var(--bad-bg); color: var(--bad); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.callout { display: flex; gap: 12px; background: var(--cream); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow), inset 0 0 0 1px rgb(8 169 201 / 30%); font-size: 12px; color: var(--slate); line-height: 1.6; }
.callout b { color: var(--ink); font-size: 14px; display: block; margin-bottom: 2px; }
.callout.warn { box-shadow: var(--shadow), inset 0 0 0 1px rgb(154 91 11 / 30%); }
.bar { height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.bar.ok > span { background: var(--ok); } .bar.warn > span { background: var(--warn); } .bar.bad > span { background: var(--bad); }
.chartbox { position: relative; height: 280px; }
.pos { color: var(--ok); } .neg { color: var(--bad); }
.health-row { display: flex; align-items: center; gap: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.loading { opacity: .55; transition: opacity .2s; }

/* login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 20px; background: var(--paper); }
.login-card { width: 100%; max-width: 420px; background: var(--cream); border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.login-card img { width: 200px; display: block; margin: 0 auto; }
.login-card h1 { margin: 24px 0 0; text-align: center; font-size: 28px; letter-spacing: -0.02em; }
.login-card h1 span { color: var(--deep); }
.login-card p.tag { text-align: center; color: var(--slate); font-family: var(--font-lead); font-size: 15px; margin: 8px 0 0; }
.login-card form { margin-top: 40px; display: flex; flex-direction: column; gap: 24px; }
.login-card label { display: block; font-size: 14px; font-weight: 500; }
.login-card input { margin-top: 8px; width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 10px 14px; font-size: 15px; outline: none; }
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgb(8 169 201 / 20%); }
.login-card .err { border-radius: 12px; background: var(--bad-bg); color: var(--bad); padding: 8px 12px; font-size: 14px; }
.login-card .foot { margin-top: 40px; text-align: center; font-size: 12px; color: var(--slate); }

/* mapping notice (state / therapy-type filters) */
.mapnote { max-width: 1280px; margin: 12px auto 0; padding: 0 32px; font-size: 12px; color: var(--slate); }
.mapnote details { background: var(--cream); border-radius: 12px; padding: 8px 14px; box-shadow: inset 0 0 0 1px rgb(154 91 11 / 30%); }
.mapnote summary { cursor: pointer; color: var(--warn); font-weight: 600; }
.mapnote ul { margin: 6px 0 2px; padding-left: 18px; line-height: 1.7; }
.mapnote code { background: var(--muted); border-radius: 6px; padding: 1px 5px; }
@media (max-width: 1023px) { .mapnote { padding: 0 16px; } }
tr.provisional td { color: var(--slate); font-style: italic; }

/* client-lifetime pages */
.filters.lt > :not(.spacer):not(.updated) { display: none; }
.navsec { margin: 14px 12px 4px; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); }
table.heat td, table.heat th { padding: 6px 6px; font-size: 11px; }
table.heat td.num { font-variant-numeric: tabular-nums; }
tr.sub td { color: var(--slate); }
.nav { overflow-y: auto; }
.nav a { min-height: 38px; padding: 7px 12px; }
.callout li b { display: inline; font-size: inherit; margin: 0; }
.callout li { margin: 2px 0; }

/* Admin section */
.adm-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.adm-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.adm-tile { text-align: left; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 4px; }
.adm-tile:focus-visible, .adm-link:focus-visible, .adm-cardbtn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.adm-tile .label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--slate); }
.adm-tile .value { font-size: 28px; font-weight: 700; }
.adm-tile.bad { border-left: 4px solid var(--bad); } .adm-tile.warn { border-left: 4px solid var(--warn); } .adm-tile.ok { border-left: 4px solid var(--ok); } .adm-tile.info { border-left: 4px solid var(--brand); }
.adm-link { background: none; border: 0; padding: 0; color: var(--deep); font: inherit; font-weight: 600; cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
.adm-overdue td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
.adm-due-bad { color: var(--bad); font-weight: 600; }
.adm-cards { display: none; list-style: none; margin: 0; padding: 0; gap: 10px; flex-direction: column; }
.adm-card { background: var(--cream); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.adm-card.adm-overdue { border-left: 4px solid var(--bad); }
.adm-cardbtn { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; background: none; border: 0; padding: 14px; font: inherit; cursor: pointer; color: inherit; }
.adm-cardtitle { font-weight: 700; }
@media (max-width: 760px) { .adm-table { display: none; } .adm-cards { display: flex; } }
.adm-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 16px; }
.adm-filters label, .adm-form label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; color: var(--slate); }
.adm-filter-btns { display: flex; gap: 8px; margin-left: auto; }
.adm-notes, .adm-mini, .adm-comments, .adm-timeline, .adm-det { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.adm-notes li.unread { font-weight: 600; }
.adm-mini li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.adm-modal { position: fixed; inset: 0; background: rgb(17 24 39 / 40%); display: flex; align-items: flex-start; justify-content: center; padding: 32px 12px; overflow-y: auto; z-index: 50; }
.adm-modal-card { background: #fff; border-radius: 18px; box-shadow: 0 20px 60px rgb(0 0 0 / 20%); width: min(760px, 100%); padding: 20px 22px; }
.adm-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.adm-form .field { border-radius: 10px; font-size: 14px; }
.adm-form textarea.field { resize: vertical; }
.adm-form select[multiple] { border-radius: 10px; }
.adm-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .adm-row { grid-template-columns: 1fr; } }
.adm-check { flex-direction: row !important; align-items: center; gap: 8px !important; font-size: 13px !important; }
.adm-err { color: var(--bad); font-size: 13px; }
.adm-flash { padding: 10px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; }
.adm-flash.ok { background: var(--ok-bg); color: var(--ok); } .adm-flash.bad { background: var(--bad-bg); color: var(--bad); }
.adm-dl { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; margin: 10px 0; }
.adm-dl dt { color: var(--slate); font-weight: 600; } .adm-dl dd { margin: 0; }
.adm-h3 { font-size: 14px; margin: 18px 0 4px; }
.adm-comment { white-space: pre-wrap; background: var(--cream); border-radius: 10px; padding: 8px 10px; margin-top: 4px; }
.adm-timeline li { border-left: 2px solid var(--line); padding-left: 10px; }

/* sidebar menu: scroll hints + tighter spacing on short screens so every item stays reachable */
.nav { background: linear-gradient(var(--cream) 30%, rgb(252 248 247 / 0)) top, linear-gradient(rgb(252 248 247 / 0), var(--cream) 70%) bottom,
  radial-gradient(farthest-side at 50% 0, rgb(17 40 56 / 14%), transparent) top, radial-gradient(farthest-side at 50% 100%, rgb(17 40 56 / 14%), transparent) bottom;
  background-repeat: no-repeat; background-size: 100% 28px, 100% 28px, 100% 10px, 100% 10px; background-attachment: local, local, scroll, scroll; min-height: 0; overscroll-behavior: contain; }
.adm-navretry { margin: 2px 0; min-height: 38px; padding: 7px 12px; border-radius: 12px; border: 1px dashed var(--line); background: transparent; color: var(--slate); text-align: left; cursor: pointer; font: inherit; }
.adm-navretry:hover, .adm-navretry:focus-visible { background: var(--muted); color: var(--ink); }
@media (min-width: 1024px) and (max-height: 900px) {
  .brandbox { padding: 14px 20px 8px; }
  .brandbox img { width: 140px; }
  .nav { gap: 2px; }
  .nav a { min-height: 32px; padding: 5px 12px; }
  .navsec { margin: 10px 12px 2px; }
  .sidefoot { padding: 6px 20px; line-height: 16px; }
  .sidefoot a { min-height: 28px; }
}

/* reopen / undo */
.adm-reopen { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.adm-rowbtn { margin-left: 6px; min-height: 28px; padding: 3px 10px; font-size: 12px; }
.adm-card .adm-rowbtn { margin: 0 12px 12px; }
.adm-toast { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center;
  padding: 10px 14px; border-radius: 14px; background: var(--ink, #112838); color: #fff; box-shadow: 0 16px 48px rgba(17,40,56,.25); max-width: calc(100vw - 32px); }
.adm-toast .pill:not(.active) { color: #fff; background: transparent; }
.adm-toast .pill.active { background: #fff; color: #112838; }
/* Timesheet (Payroll) — Range "My Timesheet" style, existing palette */
.ts-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ts-head .eyebrow { color: var(--deep); font-weight: 700; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin: 0; }
.ts-head .title { margin: 6px 0 0; }
.ts-month { display: flex; align-items: center; gap: 10px; }
.ts-month b { min-width: 130px; text-align: center; }
.ts-bar, .ts-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ts-bar .spacer, .ts-actions .spacer { flex: 1; }
.ts-table { width: 100%; border-collapse: collapse; }
.ts-table th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--slate); }
.ts-table td, .ts-table th { padding: 6px 12px; border-bottom: 1px solid var(--line); }
.ts-table tr.ts-we td { background: var(--muted); }
.ts-day { white-space: nowrap; font-size: 13px; }
.ts-pair { display: flex; gap: 6px; }
.ts-pair .ts-cat { flex: 1; min-width: 0; min-height: 30px; font-size: 12px; }
.ts-pair .ts-h { width: 64px; min-height: 30px; font-size: 12px; text-align: right; }
.ts-tot, .ts-ft { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--slate); }
.ts-table tfoot td { font-weight: 600; border-bottom: 0; }
#tsMsg.neg { color: var(--bad); }
@media (max-width: 760px) { .ts-wrap { overflow-x: auto; } .ts-table { min-width: 720px; } }
