:root { --sps-blue: #06B8E8; --sps-navy: #0B1F3A; --sps-orange: #FF7A1A; --sps-black: #000; --sps-white: #fff; --muted: #5b6770; --line: #e3e8ec; --bg: #f5f8fa;
  --text: #0B1F3A; --card: #fff; --field-bg: #fff; --field-border: #c8d0d6; --link: #0379a0;
  --tint-blue: #e6f8fd; --tint-blue-soft: #f5fcfe; --tint-orange: #fff1e6; --orange-text: #8a3d00;
  --tint-green: #e5f5e9; --green-text: #1d6b33; --tint-grey: #eef0f2; --tint-red: #fdecee; --red-line: #f3b6be; --red-text: #7a0016; --error: #b00020; }
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--link); }
.topbar { background: var(--sps-navy); color: var(--sps-white); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wordmark { font-size: 22px; font-weight: bold; letter-spacing: -0.3px; color: var(--sps-white); text-decoration: none; }
.wordmark span { color: var(--sps-blue); }
.topbar nav a { color: var(--sps-white); margin-left: 16px; text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: var(--sps-blue); }
.topbar nav a.active { border-bottom: 2px solid var(--sps-blue); padding-bottom: 2px; }
main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.narrow { max-width: 420px; margin: 60px auto; }
h1 { font-size: 24px; margin: 0 0 16px; } h2 { font-size: 18px; margin: 0 0 12px; }
label { display: block; font-size: 14px; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password] { width: 100%; padding: 10px; border: 1px solid var(--field-border); border-radius: 6px; font: inherit; background: var(--field-bg); color: var(--text); }
button, .btn { background: var(--sps-blue); color: var(--sps-navy); border: 0; border-radius: 6px; padding: 10px 18px; font: inherit; font-weight: bold; cursor: pointer; margin-top: 16px; text-decoration: none; display: inline-block; }
.muted { color: var(--muted); font-size: 14px; }
.errorlist { color: var(--error); padding-left: 18px; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--sps-blue); border-radius: 8px; padding: 14px; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 28px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: normal; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--tint-blue); }
.table-wrap { overflow-x: auto; }
button:hover, .btn:hover { background: var(--sps-orange); color: var(--sps-white); }
input:focus { outline: 2px solid var(--sps-blue); outline-offset: 1px; border-color: var(--sps-blue); }
.pill-warn { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--sps-orange); color: var(--sps-white); }
.card.alert { border-left: 4px solid var(--sps-orange); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; min-width: 180px; padding: 8px; border: 1px solid var(--field-border); border-radius: 6px; font: inherit; background: var(--field-bg); color: var(--text); }
.inline-form button, td form button { margin-top: 0; padding: 8px 14px; }
.btn-secondary { background: var(--sps-navy); color: var(--sps-white); }
.card.notice { border-left: 4px solid var(--sps-blue); padding: 12px 20px; }
.nav-badge { background: var(--sps-orange); color: var(--sps-white); border-radius: 10px; padding: 1px 7px; font-size: 12px; margin-left: 4px; }
.wordmark em { font-style: normal; font-weight: normal; color: var(--sps-white); margin-left: 6px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.35); }

/* ---- client portal ---- */
.client-head h1 { margin-bottom: 2px; }
.client-head p { margin: 0 0 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--text); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a:hover { color: var(--link); }
.tabs a.active { border-bottom-color: var(--sps-blue); font-weight: bold; }
h2.section { font-size: 18px; margin: 0 0 12px; }
.stats { margin-bottom: 20px; }
.small { font-size: 13px; }
.facts { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; margin: 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.pill-rental { background: var(--tint-orange); }
.placeholder { border-style: dashed; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.choice { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--sps-blue); border-radius: 8px; padding: 16px; text-decoration: none; color: inherit; }
.choice:hover { border-left-color: var(--sps-orange); }
.choice b { display: block; font-size: 17px; margin-bottom: 4px; } .choice span { color: var(--muted); font-size: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.two-col > .card { margin-bottom: 0; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 6px; } }
.stacked .field { margin-bottom: 12px; }
.stacked label { margin: 0 0 4px; font-weight: bold; font-size: 14px; }
.stacked label.check { font-weight: normal; display: flex; gap: 8px; align-items: flex-start; }
.stacked select, .stacked textarea, .stacked input[type=number] { width: 100%; padding: 10px; border: 1px solid var(--field-border); border-radius: 6px; font: inherit; background: var(--field-bg); color: var(--text); }
.stacked ul { list-style: none; padding: 0; margin: 0; } .stacked ul label { font-weight: normal; }
.stacked .has-error input, .stacked .has-error select, .stacked .has-error textarea { border-color: var(--error); }
.req { color: var(--sps-orange); }
.status { font-size: 12px; padding: 3px 9px; border-radius: 10px; background: var(--tint-blue); white-space: nowrap; }
.status-submitted, .status-open, .status-pending { background: var(--tint-blue); }
.status-in_progress, .status-contacted, .status-signed_up, .status-qualifying { background: var(--tint-orange); color: var(--orange-text); }
.status-waiting { background: var(--sps-orange); color: #fff; }
.status-completed, .status-closed, .status-applied, .status-done, .status-reward_sent { background: var(--tint-green); color: var(--green-text); }
.status-cancelled, .status-rejected, .status-not_proceeding { background: var(--tint-grey); color: var(--muted); }
.prio { font-size: 12px; padding: 3px 9px; border-radius: 10px; background: var(--tint-grey); white-space: nowrap; }
.prio-3 { background: var(--tint-orange); color: var(--orange-text); } .prio-4 { background: var(--sps-orange); color: #fff; font-weight: bold; }
.reward { background: var(--tint-orange); border-left: 4px solid var(--sps-orange); padding: 10px 14px; border-radius: 6px; }
.actions-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.actions-row .btn { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.btn-small { padding: 6px 12px; font-size: 14px; margin-top: 0; }
.explainer { background: var(--bg); border-radius: 6px; padding: 4px 16px; margin-bottom: 16px; font-size: 15px; }
.thread { margin: 16px 0; }
.msg { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.msg-staff { border-left: 4px solid var(--sps-blue); background: var(--tint-blue-soft); }
.msg p { margin: 6px 0 0; }
.prewrap { white-space: pre-wrap; }
.narrow-wide { max-width: 640px; }
.article-list { list-style: none; padding: 0; margin: 0; } .article-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.plain { padding-left: 18px; }
.article { max-width: 760px; line-height: 1.6; } .lead { font-size: 18px; color: var(--muted); }
.login-layout { display: grid; grid-template-columns: minmax(300px, 420px) minmax(280px, 1fr); gap: 24px; max-width: 900px; margin: 40px auto; align-items: start; }
.login-layout .card { margin: 0; }
@media (max-width: 760px) { .login-layout { grid-template-columns: 1fr; margin-top: 16px; } }
.stat-alert { border-top-color: var(--sps-orange); }
/* Errors and notices that can't be missed. */
.form-error { background: var(--tint-red); border: 1px solid var(--red-line); border-left: 5px solid var(--error); color: var(--red-text); border-radius: 6px; padding: 12px 14px; margin: 12px 0; font-weight: bold; }
.notice-box { background: var(--tint-blue); border-left: 5px solid var(--sps-blue); border-radius: 6px; padding: 12px 14px; margin: 12px 0; }
/* Two-factor set-up */
.steps { padding-left: 20px; }
.steps > li { margin-bottom: 16px; }
.qr { background: #fff; display: inline-block; padding: 6px; margin: 10px 0 4px; border: 1px solid var(--line); border-radius: 6px; }
.qr svg { display: block; }
.setup-key { font-size: 15px; letter-spacing: .05em; word-break: break-all; }
input[name=code] { max-width: 220px; font-size: 22px; letter-spacing: .2em; text-align: center; display: block; }
.backup-codes { columns: 2; list-style: none; padding: 0; font-size: 18px; }
.backup-codes li { padding: 4px 0; }
@media print { .topbar, .btn, button { display: none !important; } }
.check-line { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 15px; }
.check-line input { width: auto; margin: 0; }

/* ---- Themes: Day (default), Twilight and Night. Auto follows the computer. ---- */
html[data-theme="twilight"] {
  color-scheme: dark;
  --bg: #263142; --card: #2f3b4f; --text: #e6eaf0; --muted: #a9b4c4; --line: #3f4b60;
  --field-bg: #243043; --field-border: #58667c; --link: #8fd8f2;
  --tint-blue: rgba(6,184,232,.18); --tint-blue-soft: rgba(6,184,232,.08); --tint-orange: rgba(255,122,26,.2); --orange-text: #ffc28f;
  --tint-green: rgba(60,180,100,.2); --green-text: #a6e6bb; --tint-grey: rgba(255,255,255,.08);
  --tint-red: rgba(220,60,80,.2); --red-line: #9a4652; --red-text: #ffc0c8; --error: #ff8f9e;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121417; --card: #1d2025; --text: #eceff3; --muted: #a3abb5; --line: #30353d;
  --field-bg: #16191d; --field-border: #4a515b; --link: #81d4fa;
  --tint-blue: rgba(6,184,232,.16); --tint-blue-soft: rgba(6,184,232,.07); --tint-orange: rgba(255,122,26,.18); --orange-text: #ffbd85;
  --tint-green: rgba(60,180,100,.18); --green-text: #9fe0b3; --tint-grey: rgba(255,255,255,.07);
  --tint-red: rgba(220,60,80,.18); --red-line: #8a3f4a; --red-text: #ffbac3; --error: #ff8a99;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #121417; --card: #1d2025; --text: #eceff3; --muted: #a3abb5; --line: #30353d;
    --field-bg: #16191d; --field-border: #4a515b; --link: #81d4fa;
    --tint-blue: rgba(6,184,232,.16); --tint-blue-soft: rgba(6,184,232,.07); --tint-orange: rgba(255,122,26,.18); --orange-text: #ffbd85;
    --tint-green: rgba(60,180,100,.18); --green-text: #9fe0b3; --tint-grey: rgba(255,255,255,.07);
    --tint-red: rgba(220,60,80,.18); --red-line: #8a3f4a; --red-text: #ffbac3; --error: #ff8a99;
  }
}
.btn-secondary { border: 1px solid rgba(255,255,255,.25); }
/* Theme button in the top bar */
.topbar .theme-toggle { background: none; border: 0; padding: 0; margin: 0 0 0 16px; color: var(--sps-white); cursor: pointer; vertical-align: middle; line-height: 0; }
.topbar .theme-toggle:hover { background: none; color: var(--sps-blue); }
.theme-toggle svg { width: 20px; height: 20px; fill: currentColor; display: none; }
html[data-theme="auto"] .theme-icon-when-auto, html[data-theme="light"] .theme-icon-when-light,
html[data-theme="twilight"] .theme-icon-when-twilight, html[data-theme="dark"] .theme-icon-when-dark { display: inline-block; }
.email-preview { background: var(--bg); border-radius: 6px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.holiday-form ul li { margin-bottom: 6px; } .holiday-form ul label { display: flex; gap: 8px; align-items: center; }
.holiday-form input[type=date] { padding: 10px; border: 1px solid var(--field-border); border-radius: 6px; font: inherit; background: var(--field-bg); color: var(--text); width: 100%; }
.holiday-form input[type=text], .holiday-form textarea { width: 100%; }
select { padding: 8px; border: 1px solid var(--field-border); border-radius: 6px; font: inherit; background: var(--field-bg); color: var(--text); }
.view-as-bar { background: var(--sps-orange); color: #fff; padding: 8px 20px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 15px; }
.view-as-bar form { margin: 0 0 0 auto; }
.view-as-bar button { margin: 0; padding: 6px 14px; background: var(--sps-navy); color: #fff; }
.health-section summary { cursor: pointer; display: flex; gap: 10px; align-items: center; font-size: 16px; }
.health-section summary::marker { color: var(--sps-blue); }
.health-list { columns: 2; column-gap: 32px; } .health-list li { break-inside: avoid; padding: 3px 0; }
@media (max-width: 700px) { .health-list { columns: 1; } }
.nav-search { display: inline-block; margin: 0 4px 0 16px; vertical-align: middle; }
.nav-search input { width: 230px; padding: 6px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.12); color: #fff; font: inherit; font-size: 14px; }
.nav-search input::placeholder { color: rgba(255,255,255,.65); }
.nav-search input:focus { background: #fff; color: var(--sps-navy); outline: 2px solid var(--sps-blue); }
/* Callflow */
.callflow-item + .callflow-item { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.callflow-item h3 { margin: 0; font-size: 16px; }
.callflow-item .actions-row { margin: 0; gap: 10px; }
.callflow-frame { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: block; }
.callflow-full-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.callflow-full-head h1 { margin: 0; }
.callflow-full-head .btn { margin: 0 0 0 auto; }
.callflow-frame-full { height: calc(100vh - 210px); min-height: 480px; }
main:has(.callflow-frame-full) { max-width: none; }
@media (max-width: 640px) { .callflow-frame { height: 75vh; } }
