/* Grace Mindcare Payroll — "Evergreen ledger"
 * Calm, precise surfaces with one strong element: the deep evergreen rail.
 * Spruce = base pay and actions, iris = CPT incentives, amber = adjustments/attention.
 */
:root {
  --paper: #f5f6f4;
  --surface: #ffffff;
  --sunk: #f0f2ef;
  --raised: #fafbfa;
  --ink: #16211e;
  --ink-2: #3a4643;
  --muted: #66726e;
  --faint: #8d9894;
  --line: #e3e7e3;
  --line-strong: #cfd6d2;

  --spruce: #1f5248;
  --spruce-hover: #193f38;
  --spruce-ink: #ffffff;
  --spruce-soft: #e7f0ec;

  --rail: #102824;
  --rail-ink: #dbe7e3;
  --rail-muted: #8ea9a2;
  --rail-hover: rgba(255, 255, 255, 0.06);
  --rail-active: rgba(255, 255, 255, 0.1);
  --rail-mark: #8fd3bf;

  --iris: #5b43b5;
  --iris-soft: #eeeafa;
  --warn: #8a4d0a;
  --warn-soft: #fcf3e4;
  --bad: #a3332b;
  --bad-soft: #fbeceb;
  --good: #23683a;
  --good-soft: #e6f3ea;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --ring: 0 0 0 3px rgba(31, 82, 72, 0.18);
  --lift-1: 0 1px 2px rgba(16, 33, 30, 0.04);
  --lift-2: 0 1px 2px rgba(16, 33, 30, 0.04), 0 4px 16px -6px rgba(16, 33, 30, 0.08);
  --lift-3: 0 24px 64px -16px rgba(10, 24, 21, 0.35);
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1513;
    --surface: #131d1b;
    --sunk: #18241f;
    --raised: #16211e;
    --ink: #e4ece9;
    --ink-2: #c2cfcb;
    --muted: #94a5a0;
    --faint: #73847f;
    --line: #23322e;
    --line-strong: #31443f;
    --spruce: #7cc4b3;
    --spruce-hover: #96d3c4;
    --spruce-ink: #0b1513;
    --spruce-soft: #18302a;
    --rail: #09110f;
    --rail-ink: #d5e3df;
    --rail-muted: #7f9891;
    --iris: #b9a6ef;
    --iris-soft: #262040;
    --warn: #e9b46f;
    --warn-soft: #33260f;
    --bad: #f0978e;
    --bad-soft: #391c19;
    --good: #8fd1a2;
    --good-soft: #15301f;
    --ring: 0 0 0 3px rgba(124, 196, 179, 0.25);
    --lift-1: none;
    --lift-2: 0 0 0 1px rgba(255, 255, 255, 0.02);
    --lift-3: 0 24px 64px -16px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { line-height: 1.2; margin: 0; color: var(--ink); }
h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.025em; }
h2 { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 0.94rem; font-weight: 600; }
p { margin: 0; }
b, strong { font-weight: 600; }
a { color: var(--spruce); text-underline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--spruce); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--spruce-soft); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- buttons & inputs ---------- */
button, .btn {
  font: inherit; font-weight: 550; font-size: 0.875rem; line-height: 1.2;
  min-height: 36px; padding: 0.5rem 0.9rem;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-sm); cursor: pointer; box-shadow: var(--lift-1);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; text-decoration: none;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
button:hover, .btn:hover { background: var(--raised); border-color: var(--faint); }
button:active { transform: translateY(0.5px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--spruce); border-color: var(--spruce); color: var(--spruce-ink); }
.btn-primary:hover { background: var(--spruce-hover); border-color: var(--spruce-hover); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--sunk); border-color: transparent; }
.btn-sm { min-height: 30px; padding: 0.32rem 0.65rem; font-size: 0.8rem; border-radius: var(--radius-xs); }
input, select, textarea {
  font: inherit; font-size: 0.9rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem; min-height: 36px; min-width: 0;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--spruce); box-shadow: var(--ring); }
input[type=number] { text-align: right; }
input[type=checkbox] { min-height: 0; width: 16px; height: 16px; accent-color: var(--spruce); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366726e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.7rem center;
}
.hours-input { width: 4.6rem; min-height: 32px; padding: 0.3rem 0.5rem; }
label.field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.82rem; font-weight: 550; color: var(--ink-2); }
label.field span.hint { font-weight: 400; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 0.55rem; font-weight: 550; font-size: 0.9rem; }
.row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.75rem; }

/* ---------- sign-in ---------- */
.signin {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(143, 211, 191, 0.14), transparent 60%),
    var(--rail);
}
.signin-card {
  width: min(440px, 100%); background: var(--surface); border-radius: 18px;
  padding: 2.4rem 2.2rem 2.2rem; box-shadow: var(--lift-3);
}
.signin-mark {
  width: 44px; height: 44px; border-radius: 12px; background: var(--rail); color: var(--rail-mark);
  display: grid; place-items: center; font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em; margin-bottom: 1.75rem;
}
.signin h1 { font-size: 1.85rem; margin-bottom: 0.6rem; }
.signin p { color: var(--muted); margin-bottom: 1.75rem; max-width: 36ch; }
.signin button:not(.google-btn) { margin-top: 0.25rem; }
.google-btn { width: 100%; padding: 0.75rem 1rem; min-height: 46px; font-size: 0.95rem; }
.signin-error { margin-top: 1rem; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--rail); color: var(--rail-ink);
  padding: 1.35rem 0.85rem 1rem; display: flex; flex-direction: column; gap: 1.6rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 0.7rem; padding: 0 0.55rem; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: rgba(143, 211, 191, 0.14); color: var(--rail-mark);
  display: grid; place-items: center; font-weight: 700; font-size: 0.74rem; letter-spacing: 0.03em; flex: none;
  box-shadow: inset 0 0 0 1px rgba(143, 211, 191, 0.22);
}
.brand-name { font-weight: 600; line-height: 1.2; color: #ffffff; letter-spacing: -0.01em; }
.brand-name small { display: block; font-weight: 400; color: var(--rail-muted); font-size: 0.78rem; letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-group { font-size: 0.75rem; color: var(--rail-muted); font-weight: 500; padding: 1.1rem 0.6rem 0.35rem; }
.nav-group:first-child { padding-top: 0; }
.nav a {
  position: relative; text-decoration: none; color: var(--rail-ink); opacity: 0.86;
  padding: 0.5rem 0.65rem; border-radius: var(--radius-sm); font-weight: 450; font-size: 0.9rem;
  transition: background-color 0.12s, opacity 0.12s;
}
.nav a:hover { background: var(--rail-hover); opacity: 1; }
.nav a[aria-current=page] { background: var(--rail-active); color: #ffffff; opacity: 1; font-weight: 550; }
.nav a[aria-current=page]::before {
  content: ""; position: absolute; left: -0.85rem; top: 0.5rem; bottom: 0.5rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--rail-mark);
}
.nav a:focus-visible { outline-color: var(--rail-mark); }
.who {
  margin-top: auto; padding: 0.85rem 0.6rem 0.2rem; border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem; display: flex; flex-direction: column; gap: 0.55rem;
}
.who .email { color: var(--rail-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.who button {
  align-self: flex-start; background: transparent; color: var(--rail-ink); border-color: rgba(255, 255, 255, 0.16); box-shadow: none;
}
.who button:hover { background: var(--rail-hover); border-color: rgba(255, 255, 255, 0.3); }
.main { padding: 2.25rem clamp(1rem, 3.2vw, 2.75rem) 4.5rem; min-width: 0; max-width: 1360px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.page-head p { color: var(--muted); margin-top: 0.45rem; max-width: 68ch; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center;
    padding: 0.55rem 0.75rem; gap: 0.75rem; overflow-x: auto; scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--rail); }
  .sidebar { top: env(safe-area-inset-top, 0px); }
  .brand { padding: 0; }
  .brand-name { display: none; }
  .nav { flex-direction: row; }
  .nav-group { display: none; }
  .nav a { white-space: nowrap; }
  .nav a[aria-current=page]::before { left: 0.65rem; right: 0.65rem; top: auto; bottom: -0.55rem; width: auto; height: 2px; border-radius: 2px; }
  .who { margin: 0 0 0 auto; padding: 0; border: 0; }
  .who .email { display: none; }
  .who button { white-space: nowrap; }
  .main { padding-top: 1.5rem; }
  h1 { font-size: 1.5rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .stub-top { grid-template-columns: minmax(0, 1fr); }
  .stub-meta { text-align: left; }
  .stub-line { grid-template-columns: minmax(0, 1fr) auto; padding: 0.7rem 1.1rem; }
  .stub-line .how { grid-column: 1; grid-row: 2; }
  .stub-line .amt { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .compose { margin: 0 1.1rem; }
  .legend, .stub-top { padding-left: 1.1rem; padding-right: 1.1rem; }
}

/* ---------- panels & tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--lift-2); }
.panel-pad { padding: 1.35rem 1.5rem; }
.panel-head {
  padding: 0.95rem 1.5rem; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem 1rem; flex-wrap: wrap;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 0.78rem;
  padding: 0.7rem 0.85rem; background: var(--raised); border-bottom: 1px solid var(--line); white-space: nowrap;
}
th:first-child, td:first-child { padding-left: 1.5rem; }
th:last-child, td:last-child { padding-right: 1.5rem; }
td { padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background-color 0.1s; }
tbody tr:hover td { background: var(--raised); }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; background: var(--raised); }
th.num, td.num { text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--sunk); }
.link-btn { background: none; border: 0; padding: 0; min-height: 0; box-shadow: none; color: var(--ink); font-weight: 600; text-align: left; justify-content: flex-start; }
.link-btn:hover { background: none; color: var(--spruce); text-decoration: underline; }
td .sub { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 400; margin-top: 0.1rem; }
.incentive-val { color: var(--iris); font-weight: 600; }
.panel .table-wrap:last-child table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-lg); }

.chip {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.14rem 0.55rem;
  border-radius: 999px; font-size: 0.74rem; font-weight: 550; white-space: nowrap; line-height: 1.45;
}
.chip-open, .chip-final, .chip-iris { padding-left: 0.5rem; }
.chip-open::before, .chip-final::before, .chip-iris::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-open { background: var(--warn-soft); color: var(--warn); }
.chip-final { background: var(--good-soft); color: var(--good); }
.chip-plain { background: var(--sunk); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.chip-iris { background: var(--iris-soft); color: var(--iris); }

.notice {
  border-radius: var(--radius-sm); padding: 0.8rem 1rem 0.8rem 1.05rem; font-size: 0.875rem;
  border: 1px solid transparent; color: var(--ink-2); background: var(--surface);
  box-shadow: inset 3px 0 0 var(--accent, var(--line-strong));
}
.notice + .notice { margin-top: 0.6rem; }
.notice strong { display: block; margin-bottom: 0.15rem; color: var(--ink); font-weight: 600; }
.notice-warn { --accent: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 18%, transparent); }
.notice-warn strong { color: var(--warn); }
.notice-bad { --accent: var(--bad); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 18%, transparent); }
.notice-bad strong { color: var(--bad); }
.notice-good { --accent: var(--good); background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 18%, transparent); }
.notice-good strong { color: var(--good); }
.notice-info { --accent: var(--spruce); background: var(--spruce-soft); border-color: color-mix(in srgb, var(--spruce) 16%, transparent); }
.notice-info strong { color: var(--spruce); }
.notice ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }

.empty { padding: 3rem 1.5rem; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 0.35rem; font-size: 1rem; }

/* ---------- period switcher ---------- */
.period-switch {
  display: inline-flex; align-items: center; gap: 0.15rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 0.2rem; box-shadow: var(--lift-1);
}
.period-switch button { border: 0; box-shadow: none; border-radius: 7px; min-height: 32px; width: 32px; padding: 0; background: transparent; color: var(--muted); font-size: 1rem; }
.period-switch button:hover { background: var(--sunk); color: var(--ink); }
.period-label { padding: 0 0.7rem; font-weight: 600; white-space: nowrap; }
.period-label small { font-weight: 400; color: var(--muted); margin-left: 0.45rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.75rem; margin-bottom: 1.35rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 0.95rem 1.1rem 1rem; box-shadow: var(--lift-2);
}
.stat .label { color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.stat .value { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.02em; margin-top: 0.3rem; line-height: 1.15; }

/* ---------- pay stub (employee view) ---------- */
.stub { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--lift-2); }
.stub-top { padding: 1.7rem 1.7rem 1.35rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: end; }
.stub-gross { font-size: clamp(2.5rem, 7vw, 3.75rem); font-weight: 600; letter-spacing: -0.045em; line-height: 1; }
.stub-gross-label { color: var(--muted); font-weight: 500; margin-bottom: 0.6rem; }
.stub-meta { text-align: right; color: var(--muted); font-size: 0.86rem; }
.stub-meta strong { color: var(--ink); display: block; font-size: 1rem; font-weight: 600; }
.compose { display: flex; height: 10px; margin: 0 1.7rem; border-radius: 999px; overflow: hidden; background: var(--sunk); gap: 2px; }
.compose span { display: block; height: 100%; min-width: 3px; }
.compose .seg-base { background: var(--spruce); }
.compose .seg-adj { background: var(--warn); }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.15rem; padding: 0.85rem 1.7rem 1.35rem; font-size: 0.8rem; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 0.4rem; vertical-align: 0; }
.stub-lines { border-top: 1px solid var(--line); }
.stub-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 1rem; padding: 0.75rem 1.7rem; border-bottom: 1px solid var(--line); align-items: baseline; }
.stub-line .how { color: var(--muted); font-size: 0.84rem; }
.stub-line.total { font-weight: 600; font-size: 1.05rem; border-bottom: 0; background: var(--raised); padding-top: 1rem; padding-bottom: 1rem; }
.stub-line.incentive .amt { color: var(--iris); font-weight: 600; }
.code-bar { height: 4px; border-radius: 999px; background: var(--iris-soft); margin-top: 0.4rem; overflow: hidden; }
.code-bar span { display: block; height: 100%; background: var(--iris); border-radius: 999px; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
details summary { cursor: pointer; font-weight: 600; padding: 1rem 1.5rem; list-style-position: inside; }
details summary:hover { color: var(--spruce); }
details[open] summary { border-bottom: 1px solid var(--line); }

/* ---------- dialogs ---------- */
dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink);
  width: min(640px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: var(--lift-3);
}
dialog[open] { animation: dlg-in 0.16s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px) scale(0.99); } }
dialog::backdrop { background: rgba(9, 20, 18, 0.42); backdrop-filter: blur(2px); }
.dlg-head {
  padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.dlg-head h2 { font-size: 1.1rem; }
.dlg-head .btn-ghost { width: 34px; min-height: 34px; padding: 0; color: var(--muted); }
.dlg-body { padding: 1.35rem 1.5rem; }
.dlg-body table th:first-child, .dlg-body table td:first-child { padding-left: 0.85rem; }
.dlg-body table th:last-child, .dlg-body table td:last-child { padding-right: 0.85rem; }
.dlg-foot {
  padding: 0.9rem 1.5rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 0.6rem;
  position: sticky; bottom: 0; background: var(--raised);
}
dialog.wide { width: min(920px, calc(100vw - 2rem)); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 0.15rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; overflow-x: auto; }
.tabs button {
  border: 0; box-shadow: none; border-bottom: 2px solid transparent; border-radius: 0; background: none;
  padding: 0.6rem 0.85rem; color: var(--muted); margin-bottom: -1px;
}
.tabs button:hover { background: none; color: var(--ink); }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--spruce); }

.rate-input { width: 6.2rem; }
.code-input { width: 6.5rem; }
.desc-input { width: 100%; min-width: 14rem; }
.time-input { width: 7rem; }

.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 2.4rem 1.25rem; text-align: center;
  background: var(--surface); transition: border-color 0.12s, background-color 0.12s;
}
.dropzone.drag { border-color: var(--spruce); background: var(--spruce-soft); }
.dropzone input[type=file] { margin-top: 0.85rem; border-style: dashed; }

.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 0.7rem 1.1rem; border-radius: 10px; font-weight: 500; font-size: 0.88rem;
  z-index: 100; max-width: calc(100vw - 2rem); box-shadow: var(--lift-3); animation: toast-in 0.18s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.toast.bad { background: var(--bad); color: #ffffff; }
.loading { padding: 3rem 1rem; text-align: center; color: var(--muted); }

/* ---------- incentive trends ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--sunk); border-radius: 10px; padding: 3px; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; box-shadow: none; background: transparent; border-radius: 7px; padding: 0.4rem 0.85rem; min-height: 32px; color: var(--muted); font-weight: 500; }
.seg button:hover { background: transparent; color: var(--ink); }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 33, 30, 0.1), 0 0 0 1px var(--line); }
.delta { display: inline-block; font-size: 0.78rem; font-weight: 550; margin-top: 0.3rem; white-space: nowrap; }
.delta.up { color: var(--good); }
.delta.down { color: var(--warn); }
.delta.flat { color: var(--muted); font-weight: 450; }
td .sub .delta { margin-top: 0; font-size: 0.76rem; }
.lift {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--lift-2);
  padding: 1.6rem 1.7rem; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem 2rem; align-items: center;
}
.lift-big { font-size: clamp(2.4rem, 7vw, 3.6rem); font-weight: 600; letter-spacing: -0.045em; line-height: 1.05; color: var(--iris); margin-top: 0.4rem; }
.lift-unit { font-size: 1.05rem; font-weight: 500; letter-spacing: -0.01em; margin-left: 0.25rem; color: var(--muted); }
.lift-num { font-size: 1.55rem; font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; margin-top: 0.15rem; }
.lift-side { display: grid; gap: 1.1rem; border-left: 1px solid var(--line); padding-left: 1.7rem; }
.ladder { display: flex; height: 38px; border-radius: var(--radius-sm); overflow: hidden; margin-top: 1.15rem; gap: 2px; }
.ladder span { display: flex; align-items: center; padding: 0 0.8rem; font-weight: 550; font-size: 0.82rem; white-space: nowrap; overflow: hidden; min-width: 0; }
.ladder .b { background: var(--spruce); color: var(--spruce-ink); }
.ladder .i { background: var(--iris); color: var(--surface); min-width: 4.5rem; }
.amount-bar { display: flex; align-items: center; gap: 0.85rem; }
.amount-bar .code-bar { flex: 1 1 auto; margin-top: 0; }
.bars { display: flex; align-items: flex-end; gap: 0.6rem; height: 210px; padding: 0 0.25rem; border-bottom: 1px solid var(--line-strong); }
.bars .col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 0.35rem; }
.bars .bar { width: 100%; max-width: 52px; background: var(--iris-soft); border-radius: 5px 5px 1px 1px; }
.bars .col.now .bar { background: var(--iris); }
.bars .col.partial .bar { background: repeating-linear-gradient(135deg, var(--iris) 0 5px, color-mix(in srgb, var(--iris) 55%, var(--surface)) 5px 9px); }
.bars .amt { font-size: 0.72rem; font-weight: 550; color: var(--ink-2); white-space: nowrap; }
.bar-labels { display: flex; gap: 0.6rem; padding: 0.5rem 0.25rem 0; }
.bar-labels div { flex: 1 1 0; min-width: 0; text-align: center; font-size: 0.7rem; color: var(--muted); line-height: 1.3; }
.worth { display: grid; gap: 0.4rem; }
.worth-row {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.85rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raised);
}
.worth-row .sub { display: block; color: var(--muted); font-size: 0.78rem; }
.worth-row .r { color: var(--iris); font-weight: 600; font-size: 1.05rem; white-space: nowrap; letter-spacing: -0.01em; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 26px; width: 100px; }
.spark span { flex: 1 1 0; background: var(--iris-soft); border-radius: 2px 2px 0 0; }
.spark span.last { background: var(--iris); }
@media (max-width: 860px) {
  .lift { grid-template-columns: minmax(0, 1fr); padding: 1.3rem 1.1rem; }
  .lift-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) { .bars .amt { display: none; } .bars { gap: 0.3rem; } .bar-labels { gap: 0.3rem; } }

/* rail runs the full height of long pages; cards nested in panels stay flat */
.shell { background: linear-gradient(to right, var(--rail) 244px, var(--paper) 244px); }
.panel .stat { box-shadow: none; background: var(--raised); }
.panel-pad .table-wrap th:first-child, .panel-pad .table-wrap td:first-child { padding-left: 0.85rem; }
.panel-pad .table-wrap th:last-child, .panel-pad .table-wrap td:last-child { padding-right: 0.85rem; }
@media (max-width: 860px) { .shell { background: var(--paper); } }
@media (max-width: 860px) {
  .stub-top { grid-template-columns: minmax(0, 1fr); padding: 1.3rem 1.1rem 1.1rem; }
  .stub-meta { text-align: left; }
  .stub-line { grid-template-columns: minmax(0, 1fr) auto; padding: 0.7rem 1.1rem; }
  .stub-line .how { grid-column: 1; grid-row: 2; }
  .stub-line .amt { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .compose { margin: 0 1.1rem; }
  .legend { padding-left: 1.1rem; padding-right: 1.1rem; }
  th:first-child, td:first-child { padding-left: 1rem; }
  th:last-child, td:last-child { padding-right: 1rem; }
  .panel-head, .panel-pad { padding-left: 1.1rem; padding-right: 1.1rem; }
}

td button, .panel-head button, .page-head button { white-space: nowrap; }

/* ---------- pay summary ---------- */
.summary-table td { padding-top: 0.85rem; padding-bottom: 0.85rem; }
.summary-table tr.is-estimate td { background: color-mix(in srgb, var(--warn-soft) 35%, var(--surface)); }
.summary-table tr.is-estimate:hover td { background: var(--warn-soft); }
.summary-table .mix-col { width: 26%; min-width: 180px; }
.mix { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--sunk); }
.mix span { display: block; height: 100%; }
.mix .m-base { background: var(--spruce); }
.mix .m-inc { background: var(--iris); }
.mix .m-adj { background: var(--warn); }
.mix-pct { display: block; font-size: 0.74rem; color: var(--muted); margin-top: 0.3rem; }
.year-total td { background: var(--raised); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.year-total:last-child td { border-bottom: 0; }
tbody.year-total tr:hover td { background: var(--raised); }
.summary-table td:first-child b { white-space: nowrap; }
tr.is-old td { color: var(--muted); }
tr.is-old td b { font-weight: 500; }
.ledger td { padding-top: 0.6rem; padding-bottom: 0.6rem; }
.ledger .ledger-total td { border-top: 1px solid var(--line-strong); background: var(--raised); }

.period-pick select { border: 0; box-shadow: none; background-color: transparent; font-weight: 600; min-height: 32px; padding: 0.3rem 2rem 0.3rem 0.6rem; max-width: min(78vw, 470px); text-overflow: ellipsis; }
.period-pick select:hover { background-color: var(--sunk); }
.period-pick select:focus { box-shadow: var(--ring); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* adjustment groups */
.mix .m-cpt { background: color-mix(in srgb, var(--iris) 55%, var(--surface)); }
.adj-group { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.adj-group + .adj-group { margin-top: 0.6rem; }
.adj-group-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.85rem; background: var(--raised); border-bottom: 1px solid var(--line); }
.adj-group-head .num { margin-left: auto; font-weight: 600; }
.adj-group table td { padding-left: 0.85rem; padding-right: 0.85rem; }
.adj-cpt .adj-group-head b { color: var(--iris); }
.stub-group { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 1.7rem 0.35rem; font-size: 0.78rem; font-weight: 600; color: var(--muted); background: var(--raised); border-bottom: 1px solid var(--line); }
@media (max-width: 860px) { .stub-group { padding-left: 1.1rem; padding-right: 1.1rem; flex-wrap: wrap; } }
.stats { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.stat .delta { white-space: normal; line-height: 1.35; }

/* year + pay period pickers */
.period-year select { border: 0; box-shadow: none; background-color: transparent; font-weight: 600; min-height: 32px; padding: 0.3rem 1.8rem 0.3rem 0.6rem; border-right: 1px solid var(--line); border-radius: 0; }
.period-year select:hover { background-color: var(--sunk); }
.period-year select:focus { box-shadow: var(--ring); }
.year-pick select { min-width: 6.5rem; }
