/* PayCheck styles */
:root {
  --bg: #f6f8f8;
  --surface: #ffffff;
  --surface-2: #f0f4f4;
  --text: #13201f;
  --muted: #5b6b69;
  --border: #dde5e4;
  --accent: #0f766e;
  --accent-strong: #0b5e57;
  --accent-soft: #e0f2ef;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #a16207;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --info-soft: #e0ecff;
  --pay: #15803d;
  --pay-soft: #e8f7ee;
  --ded: #c0262d;
  --ded-soft: #fdecec;
  --seg-take: #0f766e;
  --seg-tax: #6366f1;
  --seg-usc: #8b5cf6;
  --seg-prsi: #ec4899;
  --seg-pension: #f59e0b;
  --seg-other: #94a3b8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1413; --pay: #4ade80; --pay-soft: #10291a; --ded: #f87171; --ded-soft: #331616; --surface: #141d1c; --surface-2: #1b2625; --text: #e6eeed; --muted: #93a3a1; --border: #26332f;
    --accent: #2dd4bf; --accent-strong: #5eead4; --accent-soft: #123532;
    --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf24; --warn-soft: #33270d; --bad: #f87171; --bad-soft: #3a1717; --info-soft: #172544;
    --seg-take: #2dd4bf; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1413; --pay: #4ade80; --pay-soft: #10291a; --ded: #f87171; --ded-soft: #331616; --surface: #141d1c; --surface-2: #1b2625; --text: #e6eeed; --muted: #93a3a1; --border: #26332f;
  --accent: #2dd4bf; --accent-strong: #5eead4; --accent-soft: #123532;
  --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf24; --warn-soft: #33270d; --bad: #f87171; --bad-soft: #3a1717; --info-soft: #172544;
  --seg-take: #2dd4bf; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 .25rem; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .25rem; }
p { margin: .25rem 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.fine { color: var(--muted); font-size: .8rem; margin-top: .75rem; }
.lede { color: var(--muted); max-width: 60ch; margin: 0; }
.ok { color: var(--ok); } .bad { color: var(--bad); }
.warn-text { color: var(--warn); font-weight: 500; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1.5rem;
  padding: .7rem max(16px, calc((100vw - 1120px) / 2)); background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .5rem; font-size: 1.15rem; color: var(--text); font-weight: 500; }
.brand b { color: var(--accent); font-weight: 700; }
.brand:hover { text-decoration: none; }
.logo svg { width: 28px; height: 28px; display: block; }
.logo rect { fill: var(--accent); }
.logo path { stroke: var(--surface); stroke-width: 3.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.nav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: .4rem .7rem; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-strong); }

main { max-width: 1120px; margin: 0 auto; padding: 1.75rem 16px 3rem; outline: none; }
.footer { max-width: 1120px; margin: 0 auto; padding: 1.5rem 16px 3rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .55rem 1rem; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; box-shadow: var(--shadow);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .btn.primary { color: #062421; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #062421; } }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--muted); }
.btn.danger-ghost { background: transparent; color: var(--bad); box-shadow: none; }
.btn.small { padding: .35rem .7rem; font-size: .85rem; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 1.05rem; cursor: pointer; padding: .3rem .5rem; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- layout blocks ---- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.back { display: inline-block; font-size: .85rem; margin-bottom: .35rem; }
.row-actions, .actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions { margin-top: 1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card .pad, .card-head.pad { padding: 1rem 1.25rem 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.hero h1 { font-size: 2rem; }
.hero-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid2 > div { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.grid2 textarea { width: 100%; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat .value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: .78rem; }

.steps ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.steps li { display: flex; align-items: center; gap: .6rem; }
.steps .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: .75rem; color: #fff; flex: none; }
.steps li.done .tick { background: var(--ok); border-color: var(--ok); }
.steps li.done a { color: var(--muted); text-decoration: line-through; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: .6rem .75rem; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: .65rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table.edit td { padding: .35rem .3rem; vertical-align: middle; }
.table.edit input, .table.edit select { width: 100%; min-width: 7rem; }
.table.edit input.narrow { min-width: 4.5rem; }
.table.edit td:first-child input { min-width: 14rem; }
.table.edit tr.line-earning td, .table.edit tr.line-notional td { background: var(--pay-soft); }
.table.edit tr.line-deduction td { background: var(--ded-soft); }
.table.edit tr.line-earning td:first-child { box-shadow: inset 4px 0 0 var(--pay); }
.table.edit tr.line-deduction td:first-child { box-shadow: inset 4px 0 0 var(--ded); }
.table.edit tr.guessed td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
.table.edit tr.guessed td { outline: 1px dashed color-mix(in srgb, var(--warn) 50%, transparent); outline-offset: -1px; }

/* ---- forms ---- */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 500; margin-bottom: .75rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
input, select, textarea {
  font: inherit; font-size: .9rem; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .5rem .6rem; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 1rem; }
form h2 { margin-top: 1.25rem; }
form h2:first-child { margin-top: 0; }
.expected { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; background: var(--accent-soft); border-radius: 10px; padding: .75rem 1rem; margin-top: .5rem; }
.expected:empty { display: none; }
.expected strong { font-size: 1.35rem; color: var(--accent-strong); }

.drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 2.25rem 1rem; text-align: center; align-items: center; cursor: pointer; gap: .35rem; font-weight: 400; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { font-size: 2rem; color: var(--accent); line-height: 1; }
.or { display: flex; align-items: center; gap: 1rem; color: var(--muted); margin: 1.25rem 0; font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.totals-row { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* ---- chips & alerts ---- */
.chip { display: inline-block; font-size: .72rem; font-weight: 600; padding: .12rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.cat { margin-left: .5rem; font-weight: 500; }
.chip.cat-earning { background: var(--accent-soft); color: var(--accent-strong); }
.chip.cat-deduction { background: var(--info-soft); color: var(--text); }
.alerts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.alert { padding: .7rem .9rem; border-radius: 9px; border-left: 4px solid var(--warn); background: var(--warn-soft); }
.alert.bad { border-color: var(--bad); background: var(--bad-soft); }

.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.checks li { display: flex; gap: .75rem; align-items: flex-start; }
.checks li p { margin: .1rem 0 0; color: var(--muted); font-size: .88rem; }
.checks .icon { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.checks .ok .icon { background: var(--ok-soft); color: var(--ok); }
.checks .warn .icon { background: var(--warn-soft); color: var(--warn); }
.checks .info .icon { background: var(--info-soft); color: var(--text); }

/* ---- payslip detail ---- */
.paysum { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: .75rem; box-shadow: var(--shadow); }
.paysum > div:not(.op) { display: flex; flex-direction: column; }
.paysum .label { font-size: .8rem; color: var(--muted); }
.paysum .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.paysum .value.accent { color: var(--accent); }
.paysum .op { font-size: 1.4rem; color: var(--muted); }
.bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; margin: .25rem 0 .5rem; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .8rem; margin-bottom: 1rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.seg-take { background: var(--seg-take); } .seg-incometax { background: var(--seg-tax); } .seg-usc { background: var(--seg-usc); }
.seg-prsi { background: var(--seg-prsi); } .seg-pension { background: var(--seg-pension); } .seg-other { background: var(--seg-other); }

.lines { display: flex; flex-direction: column; }
.line { border-bottom: 1px solid var(--border); }
.line:last-child { border-bottom: 0; }
.line summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 0; cursor: pointer; list-style: none; }
.line summary::-webkit-details-marker { display: none; }
.line summary::before { content: "›"; color: var(--muted); font-size: 1.1rem; transition: transform .15s; width: .8rem; flex: none; }
.line[open] summary::before { transform: rotate(90deg); }
.ldesc { flex: 1; font-weight: 500; }
.lamt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.explain { padding: 0 0 .9rem 1.8rem; color: var(--muted); font-size: .9rem; max-width: 75ch; }
.explain .calc { color: var(--text); background: var(--surface-2); padding: .45rem .7rem; border-radius: 8px; display: inline-block; margin: .2rem 0; }
.alloc { color: var(--text); margin-top: .5rem; }
.alloc ul { margin: .25rem 0; padding-left: 1.2rem; }
.how li { margin-bottom: .4rem; }

.empty { text-align: center; padding: 3rem 1rem; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty p { color: var(--muted); max-width: 46ch; margin: .5rem auto 1.25rem; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--text) 35%, transparent); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; max-width: 26rem; width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.modal .actions { justify-content: flex-end; }
#toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 1rem); background: var(--text); color: var(--bg); padding: .6rem 1.1rem; border-radius: 999px; font-weight: 500; font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- responsive ---- */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: .5rem; }
  .nav { order: 3; flex-basis: 100%; }
  #theme-toggle { margin-left: auto; }
  h1, .hero h1 { font-size: 1.5rem; }
  .stat .value, .paysum .value { font-size: 1.2rem; }
  .paysum { gap: .6rem; }
  .card { padding: 1rem; }
}
@media print {
  .topbar, .footer, .btn, .hero-actions { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .stat { box-shadow: none; break-inside: avoid; }
}

/* ---- timesheet grid ---- */
.ts-grid td { vertical-align: middle; }
.ts-grid tr.day-sunday td, .ts-grid tr.day-publicHoliday td { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.ts-grid tr.day-saturday td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.ts-grid tr.week-sep td { padding: 0; height: 6px; background: var(--border); }
.ts-grid td:first-child { white-space: nowrap; }
.shifts { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; }
.shift { display: inline-flex; align-items: center; gap: .3rem; }
.shift input[type="time"] { width: 7.2rem; padding: .35rem .45rem; }
.ts-hours { font-weight: 600; font-variant-numeric: tabular-nums; }
.ts-summary { background: var(--accent-soft); border-radius: 10px; padding: 1rem 1.1rem; margin: 1rem 0; }
.ts-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.ts-figs > div { display: flex; flex-direction: column; }
.ts-figs .label { font-size: .78rem; color: var(--muted); }
.ts-figs .value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ts-figs .value.accent { color: var(--accent-strong); }
.ts-buckets { margin: .75rem 0 .25rem; padding-left: 1.2rem; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .ts-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- photo reading ---- */
.photo-read { display: flex; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; margin: .25rem 0 1rem; }
.photo-read .btn.busy { opacity: .6; pointer-events: none; }
.photo-read #ts-photo-status { flex: 1 1 18rem; min-width: 0; }
.photo-check { margin-bottom: 1rem; }
.photo-check ul { margin: .25rem 0 .75rem; padding-left: 1.2rem; color: var(--warn); }
.ts-photo { display: block; max-width: 100%; max-height: 28rem; border-radius: 10px; border: 1px solid var(--border); }

/* ---- dismissable alerts ---- */
.alert { display: flex; align-items: flex-start; gap: .75rem; }
.alert-body { flex: 1; min-width: 0; }
.alert .btn.small { flex: none; padding: .2rem .55rem; margin: -.15rem -.3rem -.15rem 0; }
.alert.dismissed { opacity: .6; border-left-color: var(--border); background: var(--surface-2); }
.alert-foot { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .6rem; }
.alert-foot:empty { display: none; }
.alert-foot + .alerts { margin-top: .5rem; }

/* ---- payments green, deductions red ---- */
.pay, .paysum .value.pay { color: var(--pay); }
.ded, .paysum .value.ded { color: var(--ded); }
.line.line-earning, .line.line-notional { background: var(--pay-soft); border-left: 4px solid var(--pay); border-radius: 8px; margin-bottom: 6px; border-bottom: 0; }
.line.line-deduction { background: var(--ded-soft); border-left: 4px solid var(--ded); border-radius: 8px; margin-bottom: 6px; border-bottom: 0; }
.line.line-earning .lamt, .line.line-notional .lamt { color: var(--pay); }
.line.line-deduction .lamt { color: var(--ded); }
.line summary { padding-left: .6rem; padding-right: .8rem; }
.line .explain { padding-left: 2.4rem; padding-right: .8rem; }
.chip.cat-earning { background: color-mix(in srgb, var(--pay) 15%, transparent); color: var(--pay); }
.chip.cat-deduction { background: color-mix(in srgb, var(--ded) 15%, transparent); color: var(--ded); }

.alert.ok { border-left-color: var(--ok); background: var(--ok-soft); }

/* ---- hospitals, leave ---- */
.hospital-group .card-head { flex-wrap: wrap; align-items: flex-start; padding-bottom: .75rem; }
.hospital-group h2 { margin-bottom: .1rem; }
.hospital-group .muted.small { margin: 0; }
.group-totals { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0; font-variant-numeric: tabular-nums; }
.leave-sel { display: block; margin-top: .3rem; font-size: .75rem; padding: .15rem .3rem; max-width: 10.5rem; color: var(--muted); }
.leave-sel.set { color: var(--text); border-color: var(--warn); background: var(--warn-soft); }
.ts-notes p { margin: 0 0 .5rem; }

/* ---- dashboard: years and hospitals ---- */
.year-section { margin-bottom: 1rem; }
.year-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.year-tab { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; padding: .5rem .9rem; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.year-tab:hover { color: var(--text); }
.year-tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.hospital-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: .75rem; }
.hospital-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.hospital-card header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.hospital-card h3 { font-size: 1rem; margin: 0; }
.hc-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.hc-figs > div { display: flex; flex-direction: column; }
.hc-figs .label { font-size: .75rem; color: var(--muted); }
.hc-figs .value { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hc-verdict { display: flex; gap: .5rem; align-items: flex-start; margin: 0; padding: .55rem .7rem; border-radius: 8px; font-size: .88rem; }
.hc-icon { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 700; color: var(--surface); margin-top: 1px; }
.hc-ok .hc-verdict { background: var(--ok-soft); } .hc-ok .hc-icon { background: var(--ok); }
.hc-wait .hc-verdict { background: var(--surface-2); } .hc-wait .hc-icon { background: var(--muted); }
.hc-warn .hc-verdict { background: var(--warn-soft); } .hc-warn .hc-icon { background: var(--warn); }
.hc-bad .hc-verdict { background: var(--bad-soft); } .hc-bad .hc-icon { background: var(--bad); }
.hc-ok { border-top: 3px solid var(--ok); } .hc-wait { border-top: 3px solid var(--muted); } .hc-warn { border-top: 3px solid var(--warn); } .hc-bad { border-top: 3px solid var(--bad); }

/* ---- welcome banner ---- */
.welcome { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem 2rem; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.welcome .eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; color: var(--accent-strong); margin: 0 0 .3rem; }
.welcome h2 { font-size: 1.45rem; margin: 0 0 .5rem; text-wrap: balance; }
.welcome-main > p { max-width: 62ch; }
.welcome-steps { margin: .5rem 0 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .4rem; max-width: 62ch; }
.welcome-privacy { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.1rem; font-size: .88rem; }
.welcome-privacy h3 { margin-bottom: .4rem; }
.welcome-privacy ul { margin: 0 0 .6rem; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .3rem; }
.welcome-actions { grid-column: 1 / -1; display: flex; gap: .5rem; flex-wrap: wrap; }
.prose { max-width: 75ch; }
.prose h3 { margin-top: 1.1rem; }
.prose ul { padding-left: 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
@media (max-width: 760px) { .welcome { grid-template-columns: 1fr; padding: 1.1rem; } }

/* ---- worked vs paid ---- */
:root { --wp-basic: #c9d3d1; --wp-ot: #0f766e; --wp-ot2: #0b4f4a; --wp-paid: #16a34a; --wp-short: #dc2626; --wp-extra: #d97706; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --wp-basic: #3a4a47; --wp-ot: #2dd4bf; --wp-ot2: #14b8a6; --wp-paid: #4ade80; --wp-short: #f87171; --wp-extra: #fbbf24; } }
:root[data-theme="dark"] { --wp-basic: #3a4a47; --wp-ot: #2dd4bf; --wp-ot2: #14b8a6; --wp-paid: #4ade80; --wp-short: #f87171; --wp-extra: #fbbf24; }
.wp-chart { margin: .25rem 0 1rem; display: flex; flex-direction: column; gap: .45rem; }
.wp-row { display: grid; grid-template-columns: 4rem minmax(0, 1fr) 4.5rem; gap: .6rem; align-items: center; }
.wp-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.wp-total { font-size: .8rem; text-align: right; font-variant-numeric: tabular-nums; }
.wp-bar { display: flex; height: 30px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.wp-seg { display: flex; align-items: center; justify-content: center; min-width: 2px; overflow: hidden; border-right: 1px solid var(--surface); }
.wp-seg span { font-size: .7rem; font-weight: 600; white-space: nowrap; padding: 0 .3rem; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.wp-basic { background: var(--wp-basic); } .wp-basic span { color: var(--text); }
.wp-ot { background: var(--wp-ot); } .wp-ot.m2 { background: var(--wp-ot2); }
.wp-paid { background: var(--wp-paid); }
.wp-short { background: repeating-linear-gradient(45deg, var(--wp-short), var(--wp-short) 6px, color-mix(in srgb, var(--wp-short) 70%, transparent) 6px, color-mix(in srgb, var(--wp-short) 70%, transparent) 12px); }
.wp-extra { background: var(--wp-extra); }
.wp-pending { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, var(--border) 6px, var(--border) 12px); }
.wp-pending span { color: var(--muted); }
:root[data-theme="dark"] .wp-ot span, :root[data-theme="dark"] .wp-paid span, :root[data-theme="dark"] .wp-extra span { color: #06201d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wp-ot span, :root:not([data-theme="light"]) .wp-paid span, :root:not([data-theme="light"]) .wp-extra span { color: #06201d; } }
.wp-verdict { margin: .2rem 0 0; font-weight: 600; font-size: .9rem; }
.wp-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; color: var(--muted); }
.wp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }

/* ---- hospital card bar ---- */
.hc-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.hc-bar > span { display: block; height: 100%; }
.hc-paid { background: var(--wp-paid); }
.hc-wait { background: repeating-linear-gradient(45deg, var(--border), var(--border) 4px, var(--surface-2) 4px, var(--surface-2) 8px); }
.hc-overdue { background: var(--wp-short); }
.hc-extra { background: var(--wp-extra); }

/* ---- compare with original ---- */
.compare > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline; list-style: none; }
.compare > summary::-webkit-details-marker { display: none; }
.compare > summary::before { content: "›"; color: var(--muted); transition: transform .15s; display: inline-block; }
.compare[open] > summary::before { transform: rotate(90deg); }
.cmp-body { margin-top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.ov-wrap { position: relative; display: inline-block; max-width: 100%; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); align-self: flex-start; }
.orig-img { display: block; max-width: 100%; height: auto; }
.ov-layer { position: absolute; inset: 0; pointer-events: none; }
.ov-cell, .ov-band, .ov-row-diff { position: absolute; border-radius: 2px; }
.ov-cell { background: rgba(20, 184, 166, .32); box-shadow: inset 0 0 0 1px rgba(13, 148, 136, .55); }
.ov-half, .ov-quarter, .ov-three_quarter { background: rgba(20, 184, 166, .16); }
.ov-oncall { background: transparent; box-shadow: inset 0 0 0 2px rgba(99, 102, 241, .6); }
.ov-band { background: rgba(20, 184, 166, .18); }
.ov-row-diff { box-shadow: 0 0 0 2px rgba(220, 38, 38, .8); }
.cmp-table tr.cmp-diff td, .sheet-orig tr.cmp-diff th { background: var(--warn-soft); }
.cmp-total td { border-top: 2px solid var(--border); }
.sheet-orig { border-collapse: collapse; font-size: .72rem; font-variant-numeric: tabular-nums; }
.sheet-orig th, .sheet-orig td { border: 1px solid var(--border); padding: .2rem .3rem; text-align: center; min-width: 1.6rem; }
.sheet-orig tbody th { text-align: left; white-space: nowrap; font-weight: 600; }
.sheet-orig td.sc-full { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.sheet-orig td.sc-half, .sheet-orig td.sc-quarter, .sheet-orig td.sc-three_quarter { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.sheet-orig td.sc-oncall { box-shadow: inset 0 0 0 2px #6366f1; }

/* ---- guided tour ---- */
.tour { position: relative; background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.25rem; box-shadow: 0 6px 24px color-mix(in srgb, var(--accent) 18%, transparent); display: flex; flex-direction: column; gap: .7rem; }
.tour-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: .4rem 1rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.tour-steps li { display: flex; align-items: center; gap: .35rem; }
.tour-steps li span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 700; border: 1.5px solid var(--border); background: var(--surface); }
.tour-steps li.done span { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.tour-steps li.now { color: var(--text); font-weight: 600; }
.tour-steps li.now span { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.tour-body h2 { margin: 0 0 .3rem; font-size: 1.1rem; }
.tour-body p { margin: 0; max-width: 75ch; }
.tour-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.tour-actions .ghost { margin-left: auto; }

/* ---- tour images and lightbox ---- */
.tour-main { display: grid; gap: 1rem; }
.tour-main.has-fig { grid-template-columns: minmax(0, 1fr) minmax(0, 16rem); align-items: start; }
.tour-fig { margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.tour-fig figcaption { font-size: .78rem; color: var(--muted); }
.zoom-btn { position: relative; display: block; padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; cursor: zoom-in; box-shadow: var(--shadow); }
.zoom-btn img { display: block; width: 100%; height: auto; max-height: 15rem; object-fit: cover; object-position: top; }
.zoom-hint { position: absolute; right: .4rem; bottom: .4rem; font-size: .7rem; font-weight: 600; background: color-mix(in srgb, var(--text) 75%, transparent); color: var(--bg); padding: .15rem .45rem; border-radius: 999px; }
.zoom-btn:hover .zoom-hint, .zoom-btn:focus-visible .zoom-hint { background: var(--accent); color: #fff; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, #000 78%, transparent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; padding: max(16px, env(safe-area-inset-top, 0px)) 16px; cursor: zoom-out; }
.lightbox img { max-width: min(100%, 60rem); max-height: calc(100% - 3.5rem); object-fit: contain; background: #fff; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
@media (max-width: 640px) { .tour-main.has-fig { grid-template-columns: 1fr; } .zoom-btn img { max-height: 11rem; } }

/* ---- first-visit intro (deliberately one dark look in both themes) ---- */
.intro {
  --i-bg: #000; --i-fg: #f5f5f7; --i-dim: #86868b; --i-a1: #2dd4bf; --i-a2: #a3e635;
  position: fixed; inset: 0; z-index: 100; background: radial-gradient(120% 90% at 50% 40%, #0b1413 0%, var(--i-bg) 70%);
  color: var(--i-fg); display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, system-ui, sans-serif;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  animation: intro-in .6s ease both;
}
html.intro-open, html.intro-open body { overflow: hidden; }
.intro.closing { animation: intro-out .7s ease forwards; }
@keyframes intro-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes intro-out { to { opacity: 0; transform: scale(1.03); } }
.intro-stage { position: relative; width: min(100%, 1100px); height: min(70vh, 34rem); }
.intro-line {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 1.2rem;
  opacity: 0; transform: translateY(28px) scale(.985); filter: blur(12px);
  transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform 1.1s cubic-bezier(.2,.7,.2,1), filter .9s ease;
}
.intro-line.in { opacity: 1; transform: none; filter: none; }
.intro-line.out { opacity: 0; transform: translateY(-18px) scale(1.02); filter: blur(10px); transition-duration: .8s; }
.intro-big { margin: 0; font-size: clamp(2.4rem, 7.4vw, 6.6rem); font-weight: 700; line-height: 1.04; letter-spacing: -.035em; text-wrap: balance; max-width: 15ch; }
.intro-big.accent { background: linear-gradient(100deg, var(--i-a1), var(--i-a2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro-small { margin: 0; font-size: clamp(1.05rem, 2.2vw, 1.6rem); font-weight: 500; color: var(--i-dim); letter-spacing: -.01em; }
.intro-line.in .intro-small { animation: intro-sub 1.4s .5s both; }
@keyframes intro-sub { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.intro-brand { display: flex; flex-direction: column; align-items: center; gap: 1rem; cursor: default; }
.intro-logo svg { width: clamp(64px, 9vw, 96px); height: auto; display: block; filter: drop-shadow(0 10px 40px rgba(45, 212, 191, .35)); }
.intro-logo rect { fill: #0f766e; } .intro-logo path { stroke: #fff; stroke-width: 3.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.intro-name { margin: 0; font-size: clamp(3rem, 10vw, 8rem); font-weight: 700; letter-spacing: -.045em; line-height: 1; }
.intro-name b { background: linear-gradient(100deg, var(--i-a1), var(--i-a2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro-tag { margin: 0; font-size: clamp(1.15rem, 2.6vw, 1.9rem); color: var(--i-dim); font-weight: 500; }
.intro-actions { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; margin-top: 1rem; }
.intro-actions .btn { font-size: 1rem; padding: .8rem 1.4rem; border-radius: 999px; }
.intro-actions .btn.primary { background: var(--i-fg); color: #000; box-shadow: none; }
.intro-actions .btn.primary:hover { background: #fff; }
.intro .intro-ghost { background: transparent; color: var(--i-fg); border-color: #424245; box-shadow: none; }
.intro .intro-ghost:hover { background: #1d1d1f; }
.intro-progress { position: absolute; left: 50%; bottom: max(28px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; gap: 6px; }
.intro-progress i { width: 6px; height: 6px; border-radius: 50%; background: #424245; transition: background .4s, width .4s; }
.intro-progress i.on { background: var(--i-fg); }
.intro-skip { position: absolute; right: max(20px, env(safe-area-inset-right, 0px)); bottom: max(20px, env(safe-area-inset-bottom, 0px)); background: rgba(255,255,255,.08); color: var(--i-fg); border: 1px solid #424245; border-radius: 999px; font: inherit; font-size: .85rem; padding: .45rem 1rem; cursor: pointer; }
.intro-skip:hover { background: rgba(255,255,255,.16); }
.intro :focus-visible { outline: 2px solid var(--i-a1); outline-offset: 3px; }
.intro.reduce .intro-line, .intro.reduce .intro-line.out { transform: none; filter: none; transition: opacity .5s linear; }
.intro.reduce .intro-small { animation: none; }
@media (prefers-reduced-motion: reduce) { .intro, .intro.closing { animation-duration: .2s; } }

/* ---- full-screen guided tour (coach marks) ---- */
html.tour-mode .topbar, html.tour-mode .footer, html.tour-mode .hero, html.tour-mode .welcome, html.tour-mode .card.steps, html.tour-mode .back { display: none !important; }
html.tour-mode main { padding-top: 2.25rem; }
.coach { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.coach-shade { position: fixed; background: rgba(3, 10, 9, .72); pointer-events: auto; transition: all .25s ease; }
.coach-ring { position: fixed; border-radius: 10px; box-shadow: 0 0 0 3px var(--accent), 0 0 0 9px color-mix(in srgb, var(--accent) 30%, transparent); pointer-events: none; transition: all .25s ease; animation: coach-pulse 1.8s ease-in-out infinite; }
@keyframes coach-pulse { 50% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 14px color-mix(in srgb, var(--accent) 10%, transparent); } }
.coach-tip { position: fixed; pointer-events: auto; background: var(--surface); color: var(--text); border-radius: 14px; padding: 1rem 1.1rem 1.05rem; box-shadow: 0 18px 50px rgba(0,0,0,.35); border: 1px solid var(--border); transition: top .25s ease, left .25s ease; }
.coach-tip .eyebrow { margin: 0 0 .2rem; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-strong); }
.coach-tip h3 { margin: 0 0 .35rem; font-size: 1.05rem; }
.coach-tip p { margin: 0 0 .5rem; font-size: .92rem; line-height: 1.5; }
.coach-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .4rem; }
.coach-do { font-weight: 700; color: var(--accent-strong); font-size: .85rem !important; margin: .3rem 0 0 !important; animation: coach-nudge 1.2s ease-in-out infinite; }
.coach-tip[data-place="top"] .coach-do { }
@keyframes coach-nudge { 50% { transform: translateY(-3px); } }
/* the arrow: a large triangle on the tip's edge, pointing at the highlighted part */
.coach-arrow { position: absolute; width: 0; height: 0; border: 14px solid transparent; transform: translateX(-50%); }
.coach-tip[data-place="bottom"] .coach-arrow { top: -28px; border-bottom-color: var(--surface); filter: drop-shadow(0 -2px 1px rgba(0,0,0,.08)); }
.coach-tip[data-place="top"] .coach-arrow { bottom: -28px; border-top-color: var(--surface); }
.coach-tip[data-place="left"] .coach-arrow { right: -28px; left: auto !important; transform: translateY(-50%); border-left-color: var(--surface); }
.coach-tip[data-place="inside"] .coach-arrow { display: none; }
.coach-tip[data-place="bottom"] { animation: coach-bob-down 1.6s ease-in-out infinite; }
.coach-tip[data-place="top"] { animation: coach-bob-up 1.6s ease-in-out infinite; }
@keyframes coach-bob-down { 50% { transform: translateY(-5px); } }
@keyframes coach-bob-up { 50% { transform: translateY(5px); } }
.coach-progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; background: rgba(255,255,255,.15); z-index: 2; pointer-events: none; }
.coach-progress span { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }
.coach-screen { position: fixed; inset: 0; pointer-events: auto; background: radial-gradient(120% 90% at 50% 30%, color-mix(in srgb, var(--accent) 22%, var(--bg)) 0%, var(--bg) 65%); display: flex; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); overflow-y: auto; }
.coach-screen-card { width: min(100%, 46rem); animation: coach-card-in .6s cubic-bezier(.2,.7,.2,1) both; }
@keyframes coach-card-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.coach-screen-card .eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--accent-strong); margin: 0 0 .5rem; }
.coach-screen-card h2 { font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.08; letter-spacing: -.025em; margin: 0 0 1rem; text-wrap: balance; }
.coach-screen-card > p { font-size: 1.1rem; line-height: 1.55; max-width: 60ch; }
.coach-screen-card .coach-actions { justify-content: flex-start; margin-top: 1.5rem; }
.coach-screen-card .coach-actions .btn { font-size: 1.05rem; padding: .75rem 1.5rem; border-radius: 999px; }
.explain-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0; }
.explain-grid > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1rem; }
.explain-grid h3 { margin: 0 0 .3rem; font-size: 1rem; }
.explain-grid p { margin: 0; font-size: .95rem; }
.explain-grid .pay-side { border-top: 4px solid var(--pay); } .explain-grid .ded-side { border-top: 4px solid var(--ded); }
.ready-list { font-size: 1.05rem; line-height: 1.6; padding-left: 1.3rem; }
.tour-upload { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.tour-upload-img { width: 11rem; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
@media (max-width: 640px) { .explain-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .coach-ring, .coach-tip, .coach-do { animation: none !important; } }

/* ---- timesheet form sections ---- */
.ts-section { border-top: 1px solid var(--border); padding-top: 1.1rem; margin-top: 1.1rem; }
.ts-form > .ts-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.ts-section h2 { display: flex; align-items: center; gap: .55rem; }
.ts-num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--surface); display: grid; place-items: center; font-size: .85rem; font-weight: 700; flex: none; }
.ts-help { color: var(--muted); font-size: .9rem; max-width: 75ch; margin-top: -.25rem; }
.ts-edit-note { background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 8px; padding: .75rem 1rem; font-size: .9rem; margin-bottom: .75rem; max-width: 80ch; }
.ts-edit-note ul { margin: .35rem 0; padding-left: 1.2rem; }
.th-sub { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }

/* ---- hospital hours log, email ---- */
.hc-log { width: 100%; border-collapse: collapse; font-size: .82rem; font-variant-numeric: tabular-nums; }
.hc-log th { text-align: left; font-weight: 600; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; padding: .25rem 0; border-bottom: 1px solid var(--border); }
.hc-log td { padding: .3rem 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.hc-log .num { text-align: right; padding-left: .6rem; }
.hc-log tfoot td { font-weight: 700; border-bottom: 0; }
.hc-email { align-self: flex-start; }
.email-modal { max-width: 40rem; max-height: calc(100vh - 32px); overflow-y: auto; }
.email-modal label { margin-bottom: .6rem; }
.email-modal textarea { font-family: inherit; line-height: 1.45; }
#ts-status .card-head { flex-wrap: wrap; align-items: center; }

/* ---- leave colours (one per leave type; light and dark) ---- */
:root {
  --lv-annual: #2563eb; --lv-study: #7c3aed; --lv-sprDay: #4f46e5; --lv-sick: #dc2626; --lv-maternity: #db2777; --lv-paternity: #0891b2;
  --lv-adoptive: #c026d3; --lv-parental: #ea580c; --lv-parents: #d97706; --lv-compassionate: #64748b; --lv-forceMajeure: #a16207;
  --lv-otherPaid: #0d9488; --lv-unpaid: #6b7280; --lv-dayOff: #a8a29e; --lv-publicHoliday: #059669; --cal-ot15: #0f766e; --cal-ot2: #115e59; --cal-oncall: #6366f1;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --lv-annual: #60a5fa; --lv-study: #a78bfa; --lv-sprDay: #818cf8; --lv-sick: #f87171; --lv-maternity: #f472b6; --lv-paternity: #22d3ee;
  --lv-adoptive: #e879f9; --lv-parental: #fb923c; --lv-parents: #fbbf24; --lv-compassionate: #94a3b8; --lv-forceMajeure: #facc15;
  --lv-otherPaid: #2dd4bf; --lv-unpaid: #9ca3af; --lv-dayOff: #78716c; --lv-publicHoliday: #34d399; --cal-ot15: #2dd4bf; --cal-ot2: #5eead4; --cal-oncall: #a5b4fc; } }
:root[data-theme="dark"] {
  --lv-annual: #60a5fa; --lv-study: #a78bfa; --lv-sprDay: #818cf8; --lv-sick: #f87171; --lv-maternity: #f472b6; --lv-paternity: #22d3ee;
  --lv-adoptive: #e879f9; --lv-parental: #fb923c; --lv-parents: #fbbf24; --lv-compassionate: #94a3b8; --lv-forceMajeure: #facc15;
  --lv-otherPaid: #2dd4bf; --lv-unpaid: #9ca3af; --lv-dayOff: #78716c; --lv-publicHoliday: #34d399; --cal-ot15: #2dd4bf; --cal-ot2: #5eead4; --cal-oncall: #a5b4fc; }
.lv-annual { --lv: var(--lv-annual); } .lv-study { --lv: var(--lv-study); } .lv-sprDay { --lv: var(--lv-sprDay); } .lv-sick { --lv: var(--lv-sick); }
.lv-maternity { --lv: var(--lv-maternity); } .lv-paternity { --lv: var(--lv-paternity); } .lv-adoptive { --lv: var(--lv-adoptive); } .lv-parental { --lv: var(--lv-parental); }
.lv-parents { --lv: var(--lv-parents); } .lv-compassionate { --lv: var(--lv-compassionate); } .lv-forceMajeure { --lv: var(--lv-forceMajeure); }
.lv-otherPaid { --lv: var(--lv-otherPaid); } .lv-unpaid { --lv: var(--lv-unpaid); } .lv-dayOff { --lv: var(--lv-dayOff); } .lv-publicHoliday { --lv: var(--lv-publicHoliday); }
.lv-chip { display: inline-block; font-size: .75rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; background: color-mix(in srgb, var(--lv, var(--muted)) 16%, transparent); color: var(--lv, var(--muted)); border: 1px solid color-mix(in srgb, var(--lv, var(--muted)) 35%, transparent); white-space: nowrap; }

/* balances */
.lv-nav { display: flex; align-items: center; gap: .35rem; }
.lv-bals { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: .75rem; margin: .75rem 0; }
.lv-bal { border: 1px solid var(--border); border-top: 4px solid var(--lv, var(--accent)); border-radius: 10px; padding: .8rem .9rem; background: var(--surface); }
.lv-bal h3 { margin: 0 0 .2rem; font-size: .9rem; }
.lv-big { margin: 0 0 .35rem; display: flex; align-items: baseline; gap: .35rem; flex-wrap: wrap; }
.lv-big strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; color: var(--lv, var(--text)); }
.lv-big span { color: var(--muted); font-size: .85rem; }
.lv-meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.lv-meter span { display: block; height: 100%; background: var(--lv, var(--accent)); }
.lv-meter span.over { background: var(--bad); }
.lv-bal .fine { margin-top: .4rem; }
.lv-sub { font-size: .95rem; margin: 1rem 0 .4rem; }
.lv-phs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.lv-phs li { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; align-items: center; font-size: .9rem; border-bottom: 1px solid var(--border); padding-bottom: .35rem; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(4.6rem, 1fr)); gap: 3px; min-width: 34rem; }
.cal-head { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .25rem .35rem; }
.cal-day { position: relative; min-height: 5.6rem; border: 1px solid var(--border); border-radius: 8px; padding: .3rem .35rem; display: flex; flex-direction: column; gap: 2px; background: var(--surface); font-size: .72rem; overflow: hidden; }
.cal-day.out { opacity: .4; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day[class*=" lv-"] { background: color-mix(in srgb, var(--lv) 14%, var(--surface)); border-color: color-mix(in srgb, var(--lv) 45%, var(--border)); }
.cal-day.ph:not([class*=" lv-"]) { background: color-mix(in srgb, var(--lv-publicHoliday) 8%, var(--surface)); border-style: dashed; border-color: var(--lv-publicHoliday); }
.cal-num { font-weight: 700; font-size: .8rem; }
.cal-ph { color: var(--lv-publicHoliday); font-weight: 600; line-height: 1.15; }
.cal-leave { align-self: flex-start; background: var(--lv); color: #fff; font-weight: 700; border-radius: 4px; padding: 0 .3rem; }
:root[data-theme="dark"] .cal-leave { color: #0b0f0e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cal-leave { color: #0b0f0e; } }
.cal-hours { font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-hours::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--wp-basic, #c9d3d1); margin-right: 3px; }
.cal-ot { align-self: flex-start; font-weight: 700; color: #fff; background: var(--cal-ot15); border-radius: 4px; padding: 0 .3rem; font-variant-numeric: tabular-nums; }
.cal-ot.m2 { background: var(--cal-ot2); }
:root[data-theme="dark"] .cal-ot { color: #04201d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cal-ot { color: #04201d; } }
.cal-oncall { color: var(--cal-oncall); font-weight: 600; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-top: .75rem; color: var(--muted); }
.cal-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; background: var(--lv, var(--muted)); }
.cal-legend .lg-hours { background: var(--wp-basic, #c9d3d1); } .cal-legend .lg-ot15 { background: var(--cal-ot15); } .cal-legend .lg-ot2 { background: var(--cal-ot2); }
.cal-legend .lg-oncall { background: var(--cal-oncall); } .cal-legend .lg-ph { background: transparent; border: 1.5px dashed var(--lv-publicHoliday); }
.contract-terms > summary { cursor: pointer; }
.contract-terms ul { margin: .75rem 0 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .4rem; max-width: 80ch; }
.lv-form { border: 2px solid var(--accent); }

/* setup */
.setup { max-width: 52rem; margin: 0 auto; }
.setup-steps { list-style: none; padding: 0; margin: 0 0 1.25rem; display: flex; gap: .5rem 1.25rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.setup-steps li { display: flex; align-items: center; gap: .4rem; }
.setup-steps span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .75rem; border: 1.5px solid var(--border); }
.setup-steps .now { color: var(--text); font-weight: 600; } .setup-steps .now span { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.setup-steps .done span { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.setup-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.setup-card h2 { font-size: 1.5rem; margin-bottom: .35rem; }
.setup-card .lede { margin-bottom: 1.1rem; }
.ph-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: .75rem; }
.ph-opt { display: block; border: 2px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem; cursor: pointer; font-weight: 400; margin: 0; }
.ph-opt:has(input:checked), .ph-opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.ph-opt input { margin-right: .4rem; }
.ph-title { font-weight: 700; font-size: 1rem; }
.ph-opt ul { margin: .5rem 0 0; padding-left: 1.2rem; font-size: .9rem; display: flex; flex-direction: column; gap: .3rem; }
.setup-leave-row { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)) auto; gap: .6rem; align-items: end; }
.setup-leave-row label { margin: 0; }
.setup-leave-list { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: .4rem; }
.setup-leave-list li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 640px) { .setup-leave-row { grid-template-columns: 1fr 1fr; } }
.move-data { background: var(--surface-2); border-radius: 10px; padding: .8rem 1rem; margin: .75rem 0 1rem; font-size: .9rem; }
.move-data h3 { margin: 0 0 .3rem; }
.move-data ol { margin: .3rem 0; padding-left: 1.2rem; }
.ts-oncall { background: color-mix(in srgb, var(--cal-oncall) 10%, transparent); border-left: 3px solid var(--cal-oncall); padding: .5rem .75rem; border-radius: 6px; }

/* ---- tour additions, grouped payslip editor ---- */
.ov-layer.ov-off { opacity: 0; }
.ov-layer { transition: opacity .6s ease; }
.owed-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0 1.25rem; }
.owed-summary > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1rem; display: flex; flex-direction: column; gap: .2rem; }
.owed-summary .label { font-size: .8rem; color: var(--muted); }
.owed-summary strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.owed-summary .tot { border: 2px solid var(--bad); background: var(--bad-soft); }
.owed-summary .tot strong { color: var(--bad); }
@media (max-width: 640px) { .owed-summary { grid-template-columns: 1fr; } }
.table.edit .group-head th { background: transparent; font-size: .8rem; letter-spacing: .03em; padding-top: 1rem; border-bottom: 2px solid var(--border); }
.table.edit .pg-earning .group-head th { color: var(--pay); border-bottom-color: var(--pay); }
.table.edit .pg-deduction .group-head th { color: var(--ded); border-bottom-color: var(--ded); }
.table.edit .subtotal-row td { background: var(--surface-2); padding: .45rem .5rem; }
.table.edit .pg-earning .subtotal-row td:nth-last-child(2) { color: var(--pay); }
.table.edit .pg-deduction .subtotal-row td:nth-last-child(2) { color: var(--ded); }
.table.edit .net-row td { border-top: 3px double var(--border); padding: .7rem .5rem; font-size: 1rem; background: var(--accent-soft); }
.table.edit .net-row td span { margin-left: .5rem; }

/* ---- left-hand menu (sidebar) ---- */
@media (min-width: 861px) {
  body { padding-left: 15rem; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 15rem; flex-direction: column; align-items: stretch; gap: 1.25rem;
    padding: max(1.25rem, env(safe-area-inset-top, 0px)) .9rem 1rem max(.9rem, env(safe-area-inset-left, 0px)); border-bottom: 0; border-right: 1px solid var(--border);
    background: var(--surface); backdrop-filter: none; overflow-y: auto; z-index: 20; }
  .sidebar .brand { padding: 0 .5rem; font-size: 1.25rem; }
  .sidebar .nav { flex-direction: column; flex: 1; gap: .15rem; overflow: visible; }
  .sidebar .nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; font-size: .95rem; }
  .sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem .5rem 0; border-top: 1px solid var(--border); }
  main, .footer { max-width: 1080px; }
}
.sidebar .nav svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .nav a.active svg { stroke: var(--accent-strong); }
@media (max-width: 860px) {
  .sidebar .nav svg { display: none; }
  .sidebar-foot a { display: none; }
  .sidebar-foot { margin-left: auto; }
}
html.tour-mode body { padding-left: 0; }
html.tour-mode .sidebar { display: none !important; }

/* ---- originals, payslip editor tidy, tour upload image ---- */
.tour-upload { flex-direction: column; align-items: flex-start; }
.tour-upload-fig { margin: 0; display: flex; flex-direction: column; gap: .4rem; width: 100%; }
.tour-upload-fig figcaption { font-weight: 600; font-size: .9rem; }
.tour-upload .tour-upload-img { width: min(100%, 36rem); height: auto; }
.orig-panel { margin-bottom: 1rem; }
.orig-panel > summary { cursor: pointer; padding: .3rem 0; }
.orig-view { margin-top: .6rem; max-height: 34rem; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.orig-view img, .orig-view canvas { display: block; width: 100%; height: auto; }
.orig-view canvas + canvas { border-top: 1px solid #ddd; }
.orig-view .muted { padding: .75rem; }
.orig-view .sheet-html { padding: .5rem; color: #111; font-size: .78rem; }
.orig-view .sheet-html table { border-collapse: collapse; }
.orig-view .sheet-html td { border: 1px solid #ddd; padding: .15rem .35rem; white-space: nowrap; }
.orig-view .doc-text { padding: .75rem 1rem; color: #111; font-size: .85rem; }
.orig-view .doc-text p { margin: 0 0 .3rem; }
.orig-view.thumb { margin: 0; max-height: 11rem; overflow: hidden; border: 0; border-radius: 0; }
.orig-icon { display: grid; place-items: center; height: 9rem; font-weight: 800; font-size: 1.6rem; color: #0f766e; letter-spacing: .05em; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: .9rem; }
.file-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.file-thumb { padding: 0; border: 0; border-bottom: 1px solid var(--border); background: #fff; cursor: zoom-in; display: block; text-align: left; }
.file-meta { padding: .75rem .9rem .9rem; display: flex; flex-direction: column; gap: .2rem; }
.file-meta h3 { margin: .3rem 0 0; font-size: .95rem; }
.file-meta p { margin: 0; }
.file-meta .actions { margin-top: .5rem; }
.orig-modal { max-width: min(64rem, 100%); width: 100%; max-height: calc(100vh - 32px); overflow: auto; }
.orig-modal .orig-view { max-height: none; }
.table.edit .net-row td:first-child { font-size: 1rem; }
.net-eq { font-variant-numeric: tabular-nums; font-size: 1rem; }
.net-eq strong { font-size: 1.1rem; }

/* ---- simplified dashboard: three answers ---- */
.greeting { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.greeting h1 { font-size: 2rem; margin: 0 0 .2rem; }
.answers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.answer { --ans: var(--muted); display: flex; flex-direction: column; gap: .45rem; padding: 1.4rem 1.3rem 1.2rem; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--border); border-top: 5px solid var(--ans); box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; min-width: 0; }
.answer:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.ans-ok { --ans: var(--ok); } .ans-check { --ans: var(--warn); } .ans-wait { --ans: var(--accent); } .ans-empty { --ans: var(--muted); }
.ans-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; font-weight: 800; color: var(--surface); background: var(--ans); }
.ans-q { font-size: .85rem; font-weight: 600; color: var(--muted); }
.ans-title { font-size: 1.45rem; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
.ans-ok .ans-title { color: var(--ok); }
.ans-text { font-size: .92rem; color: var(--text); line-height: 1.5; }
.ans-more { margin-top: auto; padding-top: .4rem; font-size: .85rem; font-weight: 600; color: var(--accent); }
.details-heading { font-size: 1.1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: .5rem 0 .9rem; padding-top: 1rem; border-top: 1px solid var(--border); }
@media (max-width: 960px) { .answers { grid-template-columns: 1fr; } .ans-title { font-size: 1.3rem; } }
/* gentler colours for "still to come" and "taking longer" */
.hc-overdue { background: var(--wp-extra); }
.owed-summary .tot { border: 2px solid var(--accent); background: var(--accent-soft); }
.owed-summary .tot strong { color: var(--accent-strong); }
.wp-short { background: repeating-linear-gradient(45deg, var(--wp-extra), var(--wp-extra) 6px, color-mix(in srgb, var(--wp-extra) 55%, transparent) 6px, color-mix(in srgb, var(--wp-extra) 55%, transparent) 12px); }
.wp-extra { background: var(--seg-tax, #6366f1); }

/* ---- tour: the page doesn't scroll by hand (the tour moves it) ---- */
html.tour-mode, html.tour-mode body { overflow: hidden; overscroll-behavior: none; }
html.tour-mode .coach-screen { touch-action: pan-y; }

/* ---- tour: email window sits low so the tour box fits above it ---- */
html.tour-mode .email-backdrop { place-items: end center; padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
html.tour-mode .email-modal { max-height: min(58vh, 34rem); }
html.tour-mode .email-modal textarea { min-height: 6rem; }

/* ---- Accounts: log in / sign up ---------------------------------------------------- */
.auth-wrap { display: grid; place-items: start center; padding: 2rem 0 3rem; }
.auth-card { width: 100%; max-width: 26rem; }
.auth-card form { display: grid; gap: .8rem; }
.auth-card label { display: grid; gap: .3rem; }
.auth-card label.check { display: flex; gap: .5rem; align-items: center; }
.auth-brand { display: flex; align-items: center; gap: .5rem; font-size: 1.4rem; font-weight: 600; margin-bottom: .25rem; }
.auth-brand .logo { width: 2rem; height: 2rem; }
.auth-tabs { display: flex; gap: .25rem; background: var(--surface-2); border-radius: 10px; padding: .25rem; margin: 1rem 0; }
.auth-tab { flex: 1; border: 0; background: transparent; color: var(--muted); padding: .55rem; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; }
.auth-tab.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.linklike { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.alert.info { border-color: var(--accent); background: var(--accent-soft); }
html.signed-out .nav a:not(#nav-account):not(#nav-privacy) { display: none; }
.nav a[hidden] { display: none; }

/* ---- Data protection page ------------------------------------------------------------- */
.dp-short { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1rem; }
.dp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.dp-card h3 { margin: .35rem 0 .25rem; font-size: 1rem; }
.dp-card p { margin: 0; color: var(--muted); font-size: .9rem; }
.dp-icon { font-size: 1.4rem; }
.dp-body h2 { margin-top: 1.4rem; }
.dp-body h2:first-child { margin-top: 0; }
.dp-q { border-bottom: 1px solid var(--border); }
.dp-q summary { cursor: pointer; padding: .7rem 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.dp-q summary::-webkit-details-marker { display: none; }
.dp-q summary::after { content: '+'; color: var(--accent); font-weight: 700; }
.dp-q[open] summary::after { content: '−'; }
.dp-a { padding: 0 0 .9rem; }
.dp-a p { margin: .3rem 0 .6rem; }
.dp-table-wrap { overflow-x: auto; }
.dp-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dp-table th, .dp-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.dp-table th { color: var(--muted); font-weight: 600; }
@media (min-width: 1200px) { .dp-short { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 520px) { .dp-short { grid-template-columns: 1fr; } }
.dp-short, .dp-body { max-width: 60rem; }

/* ---- "Saved. Add another?" bar ------------------------------------------------------ */
.saved-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; padding: .75rem 1rem; margin-bottom: 1rem;
  border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.saved-bar > span:first-child { font-weight: 600; }
.saved-bar-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
