/* Welfare Pride Metrics — brand: #5A92C9 blue, #D58240 orange, #FFFFFF, #000000, Roboto */
@font-face { font-family: "Roboto"; font-weight: 400; font-style: normal; font-display: swap; src: url("/static/fonts/Roboto-Regular.woff2") format("woff2"), url("/static/fonts/Roboto-Regular.ttf") format("truetype"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-style: normal; font-display: swap; src: url("/static/fonts/Roboto-Medium.woff2") format("woff2"), url("/static/fonts/Roboto-Medium.ttf") format("truetype"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-style: normal; font-display: swap; src: url("/static/fonts/Roboto-Bold.woff2") format("woff2"), url("/static/fonts/Roboto-Bold.ttf") format("truetype"); }
@font-face { font-family: "Roboto"; font-weight: 900; font-style: normal; font-display: swap; src: url("/static/fonts/Roboto-Black.woff2") format("woff2"), url("/static/fonts/Roboto-Black.ttf") format("truetype"); }

:root {
  --blue: #5A92C9;          /* brand primary */
  --blue-700: #2F6BA8;      /* text/buttons on white (5.5:1) */
  --blue-800: #245886;
  --blue-50: #EEF4FA;
  --blue-100: #DCE8F4;
  --orange: #D58240;        /* brand accent */
  --orange-700: #A3561C;    /* orange text on white (5.4:1) */
  --orange-50: #FBEFE4;
  --ink: #000000;
  --text: #14181F;
  --muted: #4B5563;
  --line: #DCE3EC;
  --line-strong: #C3CEDB;
  --bg: #F4F7FB;
  --surface: #FFFFFF;
  --ok: #1F7A4D; --ok-bg: #E5F4EC;
  --warn: #8A5A00; --warn-bg: #FFF4D6;
  --err: #B42318; --err-bg: #FDECEA;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 33, 54, .06), 0 2px 8px rgba(16, 33, 54, .05);
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --wrap: 1240px;
  --gutter: clamp(16px, 3vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; outline: none; padding-bottom: 48px; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-700); text-underline-offset: 2px; }
a:hover { color: var(--blue-800); }
h1, h2, h3 { font-weight: 700; line-height: 1.2; margin: 0; color: var(--ink); }
p { margin: 0 0 .75rem; }
ul { margin: .25rem 0 0; padding-left: 1.2rem; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 100; border-radius: 4px; }
.skip:focus { left: 8px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.narrow { max-width: 560px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; } .mt-lg { margin-top: 2.5rem; }
.lead { font-size: 1.05rem; color: var(--muted); }
.inline { display: inline; margin: 0; }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.25rem; }
.section { margin-top: 1.5rem; }
.num { text-align: right; font-variant-numeric: tabular-nums lining-nums; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header::after { content: ""; display: block; height: 4px; background: linear-gradient(90deg, var(--blue) 0 72%, var(--orange) 72% 100%); }
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); flex: none; }
.brand img { height: 52px; width: auto; }
.brand-sub { font-weight: 700; font-size: 1.05rem; letter-spacing: .02em; padding-left: 14px; border-left: 2px solid var(--line-strong); line-height: 1.6; }
.main-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.main-nav > a { text-decoration: none; color: var(--text); font-weight: 500; padding: 10px 14px; border-radius: var(--radius-sm); position: relative; }
.main-nav > a:hover { background: var(--blue-50); color: var(--ink); }
.main-nav > a.active { color: var(--ink); font-weight: 700; }
.main-nav > a.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 3px; background: var(--orange); border-radius: 2px; }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.who-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-small { font-size: .9rem; font-weight: 500; text-decoration: none; color: var(--blue-700); }
.nav-small.active { text-decoration: underline; }
.nav-toggle { display: none; }
.role-badge { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.role-admin { background: var(--orange-50); color: var(--orange-700); }
.role-viewer { background: var(--blue-50); color: var(--blue-800); }

/* ---------- Page head (brand: bold title + orange underline, blue block, dot grid) ---------- */
.page-head { background: var(--surface); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.page-head::before { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: min(320px, 28vw); background-image: radial-gradient(var(--blue) 1.6px, transparent 1.8px); background-size: 16px 16px; opacity: .35; -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%); mask-image: linear-gradient(90deg, transparent, #000 60%); pointer-events: none; }
.page-head::after { content: ""; position: absolute; right: 0; top: 0; width: 10px; height: 100%; background: var(--orange); }
.page-head-inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-top: 28px; padding-bottom: 26px; position: relative; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); font-weight: 700; letter-spacing: -.01em; }
.page-head h1::after, .title-rule::after { content: ""; display: block; width: 72px; height: 4px; background: var(--orange); margin-top: 10px; border-radius: 2px; }
.page-sub { color: var(--muted); margin: 12px 0 0; }
.eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue-700); margin: 0 0 8px; }
.eyebrow-dark { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--orange-700); margin: 0 0 4px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title-rule { font-size: 1.6rem; margin-bottom: 1rem; }
.title-rule-sm::after { content: ""; display: block; width: 44px; height: 3px; background: var(--orange); margin-top: 8px; border-radius: 2px; }
.h-section { font-size: 1.25rem; margin: 0 0 12px; }
.h-card { font-size: 1.1rem; font-weight: 700; color: var(--ink); }

/* ---------- Subnav ---------- */
.subnav { display: flex; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.subnav a { text-decoration: none; padding: 8px 16px; border-radius: 999px; font-weight: 500; color: var(--text); background: var(--surface); border: 1px solid var(--line); }
.subnav a:hover { border-color: var(--blue); }
.subnav a.active { background: var(--blue-700); border-color: var(--blue-700); color: #fff; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer; background: var(--surface); color: var(--text); white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .875rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--blue-700); color: #fff; }
.btn-primary:hover { background: var(--blue-800); color: #fff; }
.btn-orange { background: var(--orange); color: #000; }
.btn-orange:hover { background: #C4722F; color: #000; }
.btn-light { background: var(--blue-50); color: var(--blue-800); border-color: var(--blue-100); }
.btn-light:hover { background: var(--blue-100); color: var(--ink); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--blue-700); color: var(--blue-800); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { background: #8F1C13; color: #fff; }
.btn-danger-ghost { background: var(--surface); border-color: #E8B4AE; color: var(--err); }
.btn[disabled], .btn.is-busy { opacity: .65; cursor: progress; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue-700); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: clamp(18px, 2.4vw, 28px); }
.card-pad-sm { padding: 12px 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head .muted { margin: 4px 0 0; }

/* ---------- Flash ---------- */
.flash-wrap { margin-top: 16px; }
.flash { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 10px; border-left: 4px solid; font-weight: 500; }
.flash ul { font-weight: 400; }
.flash-success { background: var(--ok-bg); border-color: var(--ok); color: #124D31; }
.flash-error { background: var(--err-bg); border-color: var(--err); color: #7A1810; }
.flash-info { background: var(--blue-50); border-color: var(--blue-700); color: #183F63; }

/* ---------- Not reported / no data markers ---------- */
.nr { display: inline-block; font-size: .78rem; font-weight: 500; color: #505A69; background: #F1F3F6; border: 1px dashed #A9B3C1; border-radius: 4px; padding: 0 6px; line-height: 1.6; white-space: nowrap; }
.nodata { display: inline-block; font-size: .78rem; font-weight: 700; color: #874411; background: var(--orange-50); border-radius: 4px; padding: 1px 8px; letter-spacing: .02em; white-space: nowrap; }
.note { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .9rem; color: var(--muted); margin: 14px 0 0; }
.note strong { color: var(--text); }
.note-icon { flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--blue-700); color: #fff; font-weight: 700; font-size: .75rem; display: grid; place-items: center; margin-top: 1px; }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; min-width: 0; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--blue); }
.kpi-feature { grid-row: span 2; background: var(--blue); border-color: var(--blue); color: #fff; display: flex; flex-direction: column; justify-content: flex-end; }
.kpi-feature::before { background: var(--orange); width: 100%; height: 6px; bottom: auto; }
.kpi-feature::after { content: ""; position: absolute; right: -10px; top: 18px; width: 140px; height: 90px; background-image: radial-gradient(rgba(255,255,255,.55) 1.6px, transparent 1.8px); background-size: 14px 14px; }
.kpi-label { font-size: .9rem; font-weight: 500; color: var(--muted); }
.kpi-value { font-size: clamp(1.6rem, 1.2rem + 1vw, 2rem); font-weight: 700; color: var(--ink); margin: 6px 0 4px; font-variant-numeric: tabular-nums lining-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi-meta { font-size: .8rem; color: var(--muted); margin: 0; }
.kpi-extra { font-size: .85rem; font-weight: 700; color: var(--orange-700); margin: 6px 0 0; }
.kpi-feature .kpi-label, .kpi-feature .kpi-meta { color: #fff; font-weight: 700; font-size: 1.2rem; }
.kpi-feature .kpi-meta { font-size: 1.2rem; font-weight: 700; }
.kpi-feature .kpi-value { color: #fff; font-size: clamp(2.4rem, 1.6rem + 2vw, 3.2rem); font-weight: 900; }
.kpi-feature .kpi-label { font-size: 1.25rem; }

/* ---------- Month report card ---------- */
.month-chips { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; padding: 16px 22px 0; }
.chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 10px; font-weight: 500; font-size: .9rem; min-height: 36px; }
.chip:hover { border-color: var(--blue-700); color: var(--ink); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); flex: none; }
.chip.no-data { color: var(--muted); border-style: dashed; }
.chip.no-data .chip-dot { background: transparent; border: 1.5px solid #9AA5B4; }
.chip.is-active { background: var(--blue-700); border-color: var(--blue-700); color: #fff; font-weight: 700; }
.chip.is-active .chip-dot { background: var(--orange); border-color: var(--orange); }
.report-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 16px 22px 22px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.rg-item { padding: 14px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0; min-width: 0; }
.rg-item:nth-child(4n) { border-right: 0; }
.rg-item:nth-last-child(-n+4) { border-bottom: 0; }
.rg-item dt { font-size: .85rem; color: var(--muted); font-weight: 500; }
.rg-item dd { margin: 4px 0 0; font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums lining-nums; color: var(--ink); }
.rg-accent { background: var(--orange-50); }
.rg-accent dd { color: #7F3F0E; }
.empty { text-align: center; padding: 34px 20px 38px; margin: 16px 22px 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: repeating-linear-gradient(135deg, #fff 0 10px, #F8FAFC 10px 20px); }
.empty-title { font-size: 1.3rem; font-weight: 700; color: var(--ink); margin-bottom: 4px; }

/* ---------- Charts ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-card { margin: 0; padding: 18px 18px 12px; min-width: 0; }
.chart-card figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.chart-box { position: relative; height: 280px; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.table-scroll:focus-visible { outline-offset: -3px; }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th, .data-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table thead th { background: #F7F9FC; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; position: sticky; top: 0; }
.data-table .num, .data-table thead th.num { text-align: right; }
.data-table tbody th { font-weight: 500; white-space: nowrap; }
.data-table tbody tr:hover { background: #FAFCFE; }
.data-table tfoot th, .data-table tfoot td { font-weight: 700; background: var(--blue-50); border-top: 2px solid var(--blue); border-bottom: 0; }
.data-table .unit { font-weight: 400; color: var(--muted); font-size: .8rem; }
.row-empty th { color: var(--muted); }
.nodata-cell { text-align: left; }
.row-accent th, .row-accent td { background: var(--orange-50); font-weight: 700; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; }
fieldset.field { margin: 0; }
.field.mt { margin-top: 1.25rem; }
.field > label, .field > legend { font-weight: 500; font-size: .92rem; color: var(--text); padding: 0; }
fieldset.field > legend { margin-bottom: 6px; }
input:not([type]), input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  font: inherit; font-size: 1rem; color: var(--text); background: #fff; border: 1px solid #A9B5C4; border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-700); box-shadow: 0 0 0 3px rgba(90, 146, 201, .35); }
input::placeholder, textarea::placeholder { color: #6B7480; }
.hint { font-size: .82rem; color: var(--muted); margin: 0; }
.hint.warn { color: var(--warn); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--blue-700); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.span-2 { grid-column: 1 / -1; }
.field-check { justify-content: flex-end; padding-bottom: 10px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; flex: 1 1 220px; max-width: 360px; }
.yearpick { display: flex; align-items: center; gap: 8px; margin: 0; }
.yearpick label { font-size: .9rem; font-weight: 500; color: var(--muted); }
.yearpick select { width: auto; min-height: 42px; padding: 6px 30px 6px 10px; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; background: #FAFCFE; border-radius: 0 0 var(--radius) var(--radius); position: sticky; bottom: 0; }
.form-footer p { margin: 0; }

/* ---------- Metrics editor ---------- */
.metrics-form { margin-top: 18px; overflow: hidden; }
.mgrid { display: grid; grid-template-columns: 120px repeat(7, minmax(0, 1fr)) 56px; gap: 8px; align-items: center; padding: 10px 18px; margin: 0; border: 0; min-width: 0; }
.mgrid-head { background: #F7F9FC; border-bottom: 1px solid var(--line); font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; line-height: 1.25; padding-top: 12px; padding-bottom: 12px; }
.mrow { border-bottom: 1px solid var(--line); position: relative; }
.mrow:nth-of-type(even) { background: #FBFCFE; }
.mname { font-weight: 700; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; grid-column: 1; }
.mlabel { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mcell input { min-height: 40px; padding: 8px 10px; text-align: right; font-variant-numeric: tabular-nums; }
.mcell input:placeholder-shown { background: #FAFAFB; border-style: dashed; }
.mcell input::placeholder { font-size: .78rem; text-align: right; }
.mactions { text-align: center; font-size: .85rem; }
.mmeta { grid-column: 2 / -1; font-size: .76rem; color: var(--muted); margin: -2px 0 0; }
.mrow.is-empty .mname > span:first-child { color: var(--muted); }

/* ---------- Users ---------- */
.u-name { display: block; font-weight: 700; }
.u-sub { display: block; font-size: .82rem; color: var(--muted); font-weight: 400; }
.users-table td, .users-table th { vertical-align: top; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
details.action { position: relative; }
details.action > summary { list-style: none; }
details.action > summary::-webkit-details-marker { display: none; }
details.action[open] > summary { border-color: var(--blue-700); background: var(--blue-50); }
.pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 15; width: 300px; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(16, 33, 54, .18); padding: 16px; }
.reveal { border-left: 5px solid var(--orange); margin-top: 18px; }
.secret code { font-size: 1.25rem; background: var(--blue-50); padding: 8px 14px; border-radius: 6px; display: inline-block; letter-spacing: .04em; user-select: all; word-break: break-all; }
.status { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.status-on { background: var(--ok-bg); color: #145C39; }
.status-off { background: #EEF0F3; color: #48515E; }
.status-warn { background: var(--warn-bg); color: #6E4700; }
.status-err { background: var(--err-bg); color: #8F1C13; }

/* ---------- Email ---------- */
.status-line { display: flex; gap: 14px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.provider-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.pcard { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; }
.pcard input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--blue-700); flex: none; }
.pcard-body { display: flex; flex-direction: column; gap: 2px; }
.pcard:has(input:checked) { border-color: var(--blue-700); background: var(--blue-50); box-shadow: inset 0 0 0 1px var(--blue-700); }
.js .provider-panel.is-hidden { display: none; }

/* ---------- Audit ---------- */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.action-tag { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; background: #F1F4F8; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.changes { list-style: none; padding: 0; margin: 0; }
.c-field { color: var(--muted); }
.c-old { text-decoration: line-through; color: #6B7480; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 18px; }
.audit-table td { vertical-align: top; }

/* ---------- Reports ---------- */
.report-controls { display: flex; gap: 10px; align-items: center; padding: 14px 18px; margin-top: 20px; flex-wrap: wrap; }
.report-controls label { font-weight: 500; }
.report-controls select { width: auto; min-width: 240px; flex: 0 1 320px; }
.report { margin-top: 16px; padding: clamp(18px, 3vw, 36px); }
.report-head { display: flex; gap: 24px; align-items: center; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 3px solid var(--blue); position: relative; }
.report-head::after { content: ""; position: absolute; right: 0; bottom: -3px; width: 22%; height: 3px; background: var(--orange); }
.report-logo { height: 64px; width: auto; flex: none; }
.report-title { font-size: 1.6rem; }
.report-table th[scope=row] { font-weight: 500; }
.report-table { font-size: 1rem; }
.report-table thead th { white-space: normal; }
.report-table td { font-size: 1.05rem; font-weight: 500; }
.report-foot { margin-top: 18px; }
.ytd-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 20px; overflow: hidden; }
.ytd-strip > div { padding: 14px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ytd-strip > div:last-child { border-right: 0; }
.ys-label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.ys-val { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------- Login ---------- */
.login-body { background: #fff; }
.login-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; padding: 0; }
.login-panel { background: var(--blue); color: #fff; position: relative; overflow: hidden; display: flex; align-items: center; }
.login-panel::before { content: ""; position: absolute; left: 8%; top: 8%; width: 220px; height: 150px; background-image: radial-gradient(rgba(255,255,255,.6) 1.8px, transparent 2px); background-size: 18px 18px; }
.login-panel::after { content: ""; position: absolute; right: 0; top: 0; width: 22px; height: 100%; background: var(--orange); }
.login-panel-inner { position: relative; padding: 48px 12%; max-width: 640px; }
.login-kicker { font-size: 1.25rem; font-weight: 700; margin: 0 0 18px; letter-spacing: .02em; }
.login-big { font-size: clamp(2.6rem, 1.6rem + 3.2vw, 4.6rem); font-weight: 900; line-height: 1.02; margin: 0; letter-spacing: -.02em; }
.bar-orange { display: block; width: 120px; height: 6px; background: var(--orange); margin: 26px 0 22px; }
.login-copy { font-size: 1.2rem; font-weight: 700; max-width: 26ch; line-height: 1.45; margin: 0; }
.login-card-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 400px; }
.login-logo { width: 220px; height: auto; margin: 0 0 28px; }
.login-card h1 { font-size: 1.75rem; }
.login-card .muted { margin-top: 18px; }

.error-card .eyebrow { color: var(--orange-700); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); flex: none; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; padding-top: 16px; padding-bottom: 16px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }

@media (min-width: 961px) { .users-scroll { overflow: visible; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-feature { grid-row: auto; grid-column: 1 / -1; }
  .mgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mgrid-head { display: none; }
  .mrow > .mname { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 10px; font-size: 1.05rem; }
  .mlabel { position: static !important; width: auto; height: auto; clip: auto; white-space: normal; font-size: .8rem; color: var(--muted); font-weight: 500; display: block; margin-bottom: 4px; }
  .mrow { padding-top: 14px; padding-bottom: 14px; }
  .mactions { grid-column: 1 / -1; text-align: left; }
  .mmeta { grid-column: 1 / -1; }
  .ytd-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ytd-strip > div:nth-child(3n) { border-right: 0; }
  .ytd-strip > div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 960px) {
  .header-inner { flex-wrap: wrap; gap: 12px; min-height: 64px; }
  .brand img { height: 44px; }
  .js .nav-toggle { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); min-height: 42px; padding: 0 14px; font: inherit; font-weight: 700; color: var(--text); cursor: pointer; }
  .burger, .burger::before, .burger::after { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; position: relative; }
  .burger::before, .burger::after { content: ""; position: absolute; left: 0; }
  .burger::before { top: -6px; } .burger::after { top: 6px; }
  .main-nav { flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 2px; padding: 4px 0 14px; }
  .js .main-nav { display: none; }
  .js .site-header.nav-open .main-nav { display: flex; }
  .main-nav > a { padding: 12px 10px; }
  .main-nav > a.active { background: var(--blue-50); }
  .main-nav > a.active::after { left: 0; right: auto; top: 8px; bottom: 8px; width: 4px; height: auto; }
  .nav-user { margin: 8px 0 0; padding: 12px 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
  .who { flex-basis: 100%; }
  .chart-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rg-item:nth-child(4n) { border-right: 1px solid var(--line); }
  .rg-item:nth-child(2n) { border-right: 0; }
  .rg-item:nth-last-child(-n+4) { border-bottom: 1px solid var(--line); }
  .rg-item:nth-last-child(-n+2) { border-bottom: 0; }
  .month-chips { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .provider-pick { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-panel-inner { padding: 36px 24px 32px; }
  .login-panel::before { left: auto; right: 40px; top: 20px; width: 140px; height: 100px; }
  .login-panel::after { width: 100%; height: 8px; top: auto; bottom: 0; }
  .login-big { font-size: 2.6rem; }
  .bar-orange { margin: 16px 0 14px; width: 80px; height: 5px; }
  .login-kicker { margin-bottom: 10px; font-size: 1.1rem; }
  .login-copy { font-size: 1.15rem; }
  .login-card-wrap { padding: 32px 20px 48px; align-items: flex-start; }
  .login-logo { width: 180px; margin-bottom: 20px; }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px 14px; }
  .kpi-value { font-size: 1.4rem; }
  .kpi-label { font-size: .82rem; }
  .page-head::before { width: 120px; opacity: .25; }
  .page-head::after { width: 6px; }
  .page-head-inner { padding-top: 22px; padding-bottom: 20px; align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .brand-sub { font-size: .95rem; padding-left: 10px; }
  .brand { gap: 10px; }
  .mgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 14px; padding-right: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .card-head { padding: 14px 16px; }
  .month-chips { padding: 14px 16px 0; gap: 5px; }
  .chip { padding: 6px 4px; font-size: .85rem; }
  .chip-dot { display: none; }
  .report-grid, .empty { margin: 14px 16px 16px; }
  .rg-item dd { font-size: 1.2rem; }
  .chart-box { height: 240px; }
  .report-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .report-logo { height: 52px; }
  .report-title { font-size: 1.3rem; }
  .ytd-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ytd-strip > div { border-right: 1px solid var(--line) !important; border-bottom: 1px solid var(--line); }
  .ytd-strip > div:nth-child(2n) { border-right: 0 !important; }
  .ytd-strip > div:nth-last-child(-n+2) { border-bottom: 0; }
  .report-controls select { min-width: 0; flex: 1 1 100%; }
  .pop { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
  .actions-cell { min-width: 260px; }
  .data-table th, .data-table td { padding: 9px 10px; }
  .report-table tbody th { white-space: normal; }
  .report-table td { font-size: .95rem; }
  .inline-form input { max-width: none; }
  .footer-inner { flex-direction: column; gap: 2px; }
  .users-table thead { display: none; }
  .users-table, .users-table tbody, .users-table tr, .users-table th, .users-table td { display: block; width: 100%; }
  .users-table tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .users-table tbody th, .users-table td { border: 0; padding: 3px 0; white-space: normal; }
  .users-table td[data-label] { display: flex; gap: 10px; align-items: center; }
  .users-table td[data-label]::before { content: attr(data-label); font-size: .8rem; color: var(--muted); min-width: 84px; }
  .users-table .actions-cell { min-width: 0; padding-top: 8px; }
  .users-table details.action { flex: 1 1 100%; }
  .users-table details.action > summary { width: 100%; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .site-header, .site-footer, .page-head, .no-print, .page-actions, .subnav, .skip, .flash-wrap { display: none !important; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; }
  .report { padding: 0; margin: 0; }
  .table-scroll { overflow: visible; }
  .data-table { font-size: 10pt; }
  .data-table thead th { position: static; }
  .data-table th, .data-table td { padding: 6px 8px; }
  .data-table tfoot th, .data-table tfoot td, .row-accent th, .row-accent td, .ytd-strip, .nodata, .nr { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report-head, .report-head::after { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
