/* SparkAccounts — tokens and components from the design canvas (docs/screens.md). */
:root {
  --bg: #F5F5F2;
  --surface: #FFFFFF;
  --surface-2: #FAFAF8;
  --line: #E2E2DC;
  --line-soft: #EEEEE9;
  --control: #C9C9C2;
  --ink: #16191D;
  --ink-2: #3A4250;
  --muted: #5B636E;
  --accent: #0E6E66;
  --accent-ink: #0A524C;
  --accent-soft: #E6F2EF;
  --blue: #1F4FB0;
  --blue-soft: #E8EFFC;
  --orange: #9A4300;
  --orange-soft: #FBEBDD;
  --danger: #A3261B;
  --danger-soft: #FBE4E1;
  --radius: 12px;
  --display: 'Space Grotesk', Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 Inter, system-ui, sans-serif; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.2px; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
p { margin: 0; }
input, select, button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.stack > * { min-width: 0; max-width: 100%; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 12px); }
.spacer { flex: 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 10px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.who { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 10px; margin-left: auto; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; min-height: 44px; }

/* Layout */
.page { max-width: 1200px; margin: 0 auto; padding: 28px 20px 56px; }
.narrow { max-width: 560px; margin: 0 auto; padding: 40px 16px 56px; }
.medium { max-width: 880px; margin: 0 auto; padding: 28px 16px 56px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
/* position: relative keeps visually-hidden labels inside a scrolling table from widening the page. */
.card.flush { padding: 0; overflow: hidden; position: relative; }

/* Controls */
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 8px; border: 1px solid #D3D3CC; background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.btn.primary:hover { background: var(--accent-ink); color: #FFFFFF; }
.btn.big { min-height: 50px; font-size: 16px; padding: 0 22px; }
.btn.block { width: 100%; }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); font-weight: 500; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid #7FB8B2; outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field input, .field select { min-height: 48px; padding: 0 12px; border: 1px solid var(--control); border-radius: 8px; background: var(--surface); font-size: 16px; font-weight: 400; color: var(--ink); width: 100%; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Bits */
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; background: var(--accent-soft); color: var(--accent-ink); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--orange-soft); color: #7A3500; font-weight: 500; font-size: 14px; }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.good { background: var(--accent-soft); color: var(--accent-ink); }
.logo { flex: none; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.logo img { width: 100%; height: 100%; object-fit: contain; background: #FFFFFF; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Choice cards (welcome, picker) */
.choice { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; min-height: 72px; width: 100%; text-align: left; cursor: pointer; }
.choice:hover { border-color: var(--accent); color: var(--ink); }
.choice.featured { border: 2px solid var(--accent); }
.choice strong { display: block; font-size: 17px; }

/* Business switcher */
.switcher { position: relative; }
.switcher > button { min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 6px; border: 1px solid transparent; background: none; border-radius: 10px; cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 18px; }
.switcher > button[aria-expanded="true"], .switcher > button:hover { background: #F0F0EB; }
.menu { position: absolute; top: 56px; left: 0; width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid #D3D3CC; border-radius: 12px; box-shadow: 0 12px 32px rgba(22,25,29,.14); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.menu-label { padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.menu a { min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.menu a:hover, .menu a[aria-current="true"] { background: var(--bg); }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 0; width: 100%; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a { min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.nav a[aria-current="page"] { background: #F0F0EB; color: var(--ink); font-weight: 600; }

/* Wizard */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.steps li { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.steps li::before { content: ''; height: 5px; border-radius: 999px; background: var(--line); }
.steps li.done::before, .steps li[aria-current="step"]::before { background: var(--accent); }
.steps li[aria-current="step"] { color: var(--ink); font-weight: 700; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.option:has(input:checked) { border-color: var(--accent); }
.option input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.person { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 10px; }
.person .field { flex: 1 1 140px; font-size: 12px; }
.person .field.email { flex: 2 1 220px; }
.person .field input, .person .field select { min-height: 44px; font-size: 15px; }
.listrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.listrow:first-child { border-top: 0; }
.listrow > .spacer { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.rules-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; color: var(--ink-2); }
.rules-grid span:nth-child(odd) { color: var(--muted); }

/* Getting started checklist */
.progress { height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.progress > div { height: 6px; background: var(--accent); }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.tick { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--control); display: flex; align-items: center; justify-content: center; color: #FFFFFF; margin-top: 1px; }
.task.done .tick { background: var(--accent); border-color: var(--accent); }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-title { font-weight: 600; }

/* Tables (admin overview) */
.table { width: 100%; min-width: 760px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 14px 16px; vertical-align: top; }
.table thead th { background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.table tbody tr { border-top: 1px solid var(--line-soft); }
.table tbody th { font-weight: 600; }
.table tfoot tr { border-top: 2px solid var(--line); background: var(--surface-2); font-weight: 700; }
.table .n { text-align: right; }
.table .linklike { min-height: 0; white-space: nowrap; }
.table tr.detail td { background: var(--surface-2); padding-top: 10px; padding-bottom: 12px; }
.c-blue { color: var(--blue) !important; }
.c-orange { color: var(--orange) !important; }
.pill.grey { background: #EEEEE9; color: var(--muted); }
.daychip { font-size: 13px; padding: 4px 9px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); }
.daychip.off { color: var(--muted); }

/* My week */
.week-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.week-layout > section { flex: 999 1 560px; min-width: 0; }
.week-layout > aside { flex: 1 1 320px; min-width: 0; position: sticky; top: 16px; }
.day { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.day-name { width: 92px; display: flex; flex-direction: column; align-self: center; }
.small-field { font-size: 12px; font-weight: 500; color: var(--muted); }
.small-field input, .small-field select { min-height: 44px; font-size: 15px; padding: 0 8px; }
.small-field select { min-width: 165px; }
.day-times .small-field select { min-width: 0; }
.day-note { align-self: center; padding-top: 18px; flex: 1 1 200px; }
.day-status { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 0; }
.day-total .pill { white-space: nowrap; }
.day-total { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-variant-numeric: tabular-nums; }
.day-problem { padding: 6px 10px; }
input[aria-invalid] { border-color: var(--danger) !important; }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.num { font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.tile { border-radius: 10px; padding: 14px; }
.tile.blue { background: var(--blue-soft); }
.tile.orange { background: var(--orange-soft); }
.tile-label { font-size: 13px; font-weight: 600; }
.tile.blue .tile-label { color: var(--blue); }
.tile.orange .tile-label { color: var(--orange); }
.tile-value { font-family: var(--display); font-size: 28px; font-weight: 700; }
.intro { background: var(--accent); color: #FFFFFF; border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.intro ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: #E6F2EF; }
.intro .btn { align-self: flex-start; color: var(--accent-ink); border-color: #FFFFFF; }

@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .card { padding: 18px; }
  .who .email { display: none; }
  .day { padding: 14px 16px; }
  .day-name { width: 100%; flex-direction: row; gap: 8px; align-items: baseline; }
  .small-field select { min-width: 0; }
  .day > .small-field { flex: 1 1 100%; }
  .day-times { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .day-times .small-field input, .day-times .small-field select { width: 100%; }
  .day-times .small-field:last-child { grid-column: span 2; }
  .day-note { padding-top: 0; }
  .day-status { margin-left: 0; width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
  .day-total { flex-direction: row; align-items: center; gap: 8px; }
  .week-layout > aside { position: static; }
}

/* Pay rules */
fieldset.card { margin: 0; min-width: 0; }
fieldset.card legend { font-family: var(--display); font-weight: 700; font-size: 18px; padding: 0 6px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; align-items: start; }
.fields .wide, .fields .check { grid-column: 1 / -1; }
.bands { display: flex; height: 14px; border-radius: 999px; overflow: hidden; }
.bands .teal, .dot.teal { background: var(--accent); }
.bands .blue, .dot.blue { background: var(--blue); }
.bands .orange, .dot.orange { background: #C7691F; }
.band-key { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
.changes { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.result { margin: 0; display: flex; flex-direction: column; }
.result > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.result dt { color: var(--ink-2); }
.result dd { margin: 0; font-weight: 700; text-align: right; }
.was { font-weight: 500; color: var(--orange); font-size: 13px; }

/* Team */
.listrow .small-field select { min-width: 130px; }
.listrow .check { font-size: 14px; }

/* Bank holiday tag under the day name in My week */
.day-name .bh { align-self: flex-start; margin-top: 4px; white-space: normal; }
