/* City Tax Refund: a timesheet look. Charcoal bar, warm paper, tabular numbers, colour-coded days with letter codes. */
:root {
  --bg: #f6f5f1; --paper: #ffffff; --ink: #1d2124; --muted: #555d63; --line: #d9d6cd; --line2: #ebe8e0;
  --bar: #23272b; --bar-ink: #f4f1ea; --accent: #8a4b00; --amber: #e8a33d; --focus: #1d6fd1;
  --in: #ffffff; --home: #1f7a63; --other: #2c63a8; --travel: #e8a33d; --hol: #b5405f; --leave: #6c7784; --none: #c9c6bd;
  --good: #1f6b4f; --warn-bg: #fff4dc; --warn-ink: #6b4300; --err: #b3261e;
  --r: 6px; --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141618; --paper: #1c1f22; --ink: #ecebe6; --muted: #a9b0b5; --line: #353a3f; --line2: #2a2e32;
    --bar: #0d0f10; --bar-ink: #ecebe6; --accent: #f0b65a; --focus: #7db3ff;
    --in: #22262a; --home: #2f9a7e; --other: #4a86d1; --travel: #e8a33d; --hol: #d06381; --leave: #7f8a97; --none: #3a3f44;
    --good: #6fd1a6; --warn-bg: #3a2e14; --warn-ink: #f6d79a; --err: #ff8a80;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--accent); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
.num, .money { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.top { background: var(--bar); color: var(--bar-ink); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--bar-ink); text-decoration: none; font-weight: 700; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { color: var(--bar-ink); text-decoration: none; padding: 12px 8px; font-size: 15px; }
.top nav a:hover { text-decoration: underline; }

.hero { padding: 20px 16px 6px; }
.hero h1 { font-size: clamp(24px, 4.2vw, 36px); margin: 0 0 8px; max-width: 30ch; }
.lede { margin: 0; max-width: 70ch; color: var(--muted); font-size: 17px; }

.tool { padding-top: 12px; padding-bottom: 24px; }
.banner, .note { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--r); padding: 10px 12px; margin: 0 0 12px; }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.claimbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.claimbar label { font-weight: 600; }
.claimbar select { flex: 1 1 200px; min-width: 0; max-width: 420px; }

.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid > * { min-width: 0; }
fieldset { min-width: 0; }
@media (min-width: 1000px) { .grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .side { position: sticky; top: 12px; } }

.block { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 0 0 16px; min-width: 0; }
fieldset.block { margin: 0 0 16px; }
.block legend, .block h2 { font-size: 20px; font-weight: 700; margin: 0 0 10px; padding: 0; }
fieldset.block > legend { float: left; width: 100%; }
fieldset.block > legend + * { clear: both; }
.hint { color: var(--muted); font-size: 15px; margin: 6px 0 10px; }

input, select, button { font: inherit; color: inherit; }
input, select { font-size: 16px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); width: 100%; }
input[aria-invalid=true] { border-color: var(--err); }
input::placeholder { color: var(--muted); opacity: .75; font-style: italic; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); gap: 10px 12px; }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f > span:first-child { font-size: 15px; font-weight: 600; }
.f-city { grid-column: span 2; }
@media (max-width: 440px) { .f-city { grid-column: auto; } .fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .f-city, .f-year { grid-column: span 2; } }
.pct { display: flex; align-items: center; gap: 6px; }
.pct b { font-weight: 600; }
.err { color: var(--err); font-style: normal; font-size: 14px; min-height: 0; }
.err:empty { display: none; }
.linkish { background: none; border: 0; padding: 4px 0; color: var(--accent); text-decoration: underline; cursor: pointer; text-align: left; font-size: 15px; min-height: 32px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg label { display: flex; align-items: center; gap: 6px; padding: 0 14px; min-height: 44px; cursor: pointer; font-weight: 600; border-right: 1px solid var(--line); }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg small { font-weight: 400; color: var(--muted); }
.seg label:has(input:checked) { background: var(--bar); color: var(--bar-ink); }
.seg label:has(input:checked) small { color: var(--bar-ink); opacity: .8; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--paper); cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.small { font-size: 15px; padding: 6px 12px; }
.btn.primary { background: var(--bar); color: var(--bar-ink); border-color: var(--bar); }
.btn[aria-pressed=true] { background: var(--bar); color: var(--bar-ink); border-color: var(--bar); }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

details.more { margin-top: 12px; }
details > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.week { border: 0; padding: 0; margin: 12px 0; }
.week legend { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
#f-week, #pat-days { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.wd { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 44px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; font-weight: 600; }
.wd input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wd:has(input:checked) { background: var(--bar); color: var(--bar-ink); border-color: var(--bar); }
.wd:has(input:focus-visible) { outline: 3px solid var(--focus); }

/* calendar */
.cal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.cal-head h2 { margin: 0; }
.quick { margin: 0; font-weight: 600; }
.quick .money { font-size: 18px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.calmsg { margin: 0 0 6px; font-size: 15px; font-weight: 600; min-height: 0; }
.calmsg:empty { display: none; }
.nw { white-space: nowrap; }
.brushes { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 520px) { .brushes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); } .brush { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 13px; text-align: center; line-height: 1.15; } }
.brush { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px 6px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); cursor: pointer; font-weight: 600; font-size: 15px; }
.brush[aria-checked=true] { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.sw { width: 22px; height: 22px; border-radius: 4px; display: inline-grid; place-items: center; font: 700 12px var(--sans); border: 1px solid var(--line); }
.t-in { background: var(--in); color: var(--ink); }
.t-home { background: var(--home); color: #fff; border-color: transparent; }
.t-other { background: var(--other); color: #fff; border-color: transparent; }
.t-travel { background: var(--travel); color: #2a1a00; border-color: transparent; }
.t-hol { background: var(--hol); color: #fff; border-color: transparent; }
.t-leave { background: var(--leave); color: #fff; border-color: transparent; }
.t-none { background: repeating-linear-gradient(135deg, var(--none) 0 3px, transparent 3px 7px); color: var(--muted); }
.place { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.place label { font-weight: 600; }
.place input { flex: 1 1 220px; max-width: 360px; }
.pattern { margin: 4px 0 10px; }
.pat-in { padding: 4px 0 8px; }
.pat-line { margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }

.monthnav { display: none; align-items: center; gap: 6px; margin: 8px 0; }
.mstrip { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: thin; padding: 2px; }
.mchip { flex: 0 0 auto; min-height: 44px; min-width: 44px; padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); cursor: pointer; font-size: 14px; line-height: 1.15; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.mchip b { font-size: 11px; color: var(--home); font-weight: 700; }
.mchip[aria-current=true] { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px 18px; margin-top: 10px; }
.month h3 { font-size: 16px; margin: 0 0 6px; display: flex; justify-content: space-between; gap: 8px; }
.month h3 small { font-weight: 400; color: var(--muted); font-size: 13px; }
.dgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dh { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 2px; }
.day { position: relative; aspect-ratio: 1; min-height: 30px; border: 1px solid var(--line); border-radius: 4px; font: 600 13px var(--sans); padding: 0; cursor: pointer; display: grid; place-items: center; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.day::before, .dh::before { content: attr(data-n); }
.day::after { content: attr(data-code); position: absolute; right: 2px; bottom: 0; font-size: 9px; opacity: .85; }
.day.off { background: transparent; border-color: transparent; color: var(--muted); cursor: default; font-weight: 400; }
.day.anchor { outline: 3px dashed var(--ink); outline-offset: 1px; }
.day.today { text-decoration: underline; }
.blank { aspect-ratio: 1; }
.legend { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 15px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 759px) {
  .monthnav { display: flex; }
  .months { grid-template-columns: 1fr; }
  .month:not(.cur) { display: none; }
  .day { min-height: 42px; font-size: 15px; }
  .day::after { font-size: 10px; }
  .dgrid { gap: 4px; }
}

/* result */
.result { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r); padding: 16px; }
.result h2 { font-size: 18px; margin: 0 0 6px; }
.big { font: 700 40px/1.1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin: 4px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two .big { font-size: 30px; }
.two .sub { font-size: 14px; }
.big.zero { color: var(--muted); }
.sub { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.counts { margin: 10px 0; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 15px; }
.counts dt, .counts dd { margin: 0; }
.counts dd { font-family: var(--mono); text-align: right; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--r); padding: 8px 10px; font-size: 15px; margin: 8px 0; }
.info { color: var(--muted); font-size: 15px; margin: 8px 0; }
.result .btn { width: 100%; margin-top: 8px; }
.todo { margin: 6px 0; padding-left: 20px; }

/* lines */
table { border-collapse: collapse; width: 100%; }
.lt { font-size: 15px; }
.lt th, .lt td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.lt th { font-weight: 600; color: var(--muted); font-size: 14px; }
.lt th.v { text-align: right; }
.lt td.n { width: 3.2em; font-weight: 700; font-family: var(--mono); }
.lt td.v.txt { white-space: normal; overflow-wrap: anywhere; max-width: 12em; }
.lt td.v { text-align: right; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; }
.lt tr.key td { background: var(--warn-bg); color: var(--ink); }
.lines-grid { display: grid; gap: 18px; }
@media (max-width: 520px) { .lt { font-size: 14px; } .lt th, .lt td { padding: 5px 4px; } .lt td.v { font-family: var(--sans); font-variant-numeric: tabular-nums; } }
@media (min-width: 900px) { .lines-grid { grid-template-columns: 1fr 1fr; } }
.lines-grid h3 { font-size: 16px; margin: 0 0 6px; }
.logwrap { overflow-x: auto; }
.logt { font-size: 15px; min-width: 520px; }
.logt th, .logt td { padding: 6px 8px; border-bottom: 1px solid var(--line2); text-align: left; }
.logt td.d { text-align: right; font-family: var(--mono); }
.logt tfoot td { font-weight: 700; border-top: 2px solid var(--ink); }
/* phones: all four columns on screen (wrapping) instead of a sideways scroll that hides Reason and # days */
@media (max-width: 520px) { .logt { min-width: 0; font-size: 14px; } .logt th, .logt td { padding: 5px 4px; vertical-align: top; } }
@media (max-width: 360px) { .logt { font-size: 13px; } .logt th, .logt td { padding: 4px 3px; } }
.kept { list-style: none; padding: 0; }
.kept li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }

/* dialog + toast */
.ask { position: fixed; inset: 0; background: rgb(0 0 0 / .45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.ask-box { background: var(--paper); border-radius: var(--r); padding: 18px; max-width: 460px; width: 100%; }
.ask-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--bar); color: var(--bar-ink); border-radius: var(--r); padding: 8px 8px 8px 14px; display: flex; gap: 12px; align-items: center; z-index: 55; max-width: calc(100vw - 32px); box-shadow: 0 4px 18px rgb(0 0 0 / .25); }
.toast .btn { background: transparent; color: var(--bar-ink); border-color: var(--bar-ink); }

/* prose */
.prose { padding-bottom: 32px; }
.prose section { max-width: 72ch; margin: 0 0 8px; }
.prose h2 { font-size: 22px; margin: 28px 0 8px; }
.prose p { margin: 0 0 12px; }
.aside-note { color: var(--muted); font-size: 15px; border-left: 3px solid var(--amber); padding-left: 12px; }
#faq details { border-bottom: 1px solid var(--line); }
#faq details p { margin: 0 0 12px; }
.sources { color: var(--muted); font-size: 15px; max-width: 72ch; margin-top: 24px; }

.foot { border-top: 1px solid var(--line); padding: 18px 0 28px; font-size: 15px; color: var(--muted); }
.sb-more { line-height: 1.9; }
.sb-more a, .sb-credit a { color: var(--accent); }
.sb-privacy { font-weight: 600; color: var(--ink); }

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

/* print */
.print-root { display: none; }
@page { margin: 0.55in; }
@media print {
  body { background: #fff; color: #000; font: 10.5pt/1.4 var(--sans); }
  body.printing > *:not(.print-root) { display: none !important; }
  body.printing .print-root { display: block; }
  .sheet { break-after: page; }
  .sheet:last-child { break-after: auto; }
  .ph { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #000; padding-bottom: 4pt; margin-bottom: 8pt; gap: 12pt; }
  .ph h1 { font-size: 15pt; margin: 0; }
  .ph .who { text-align: right; font-size: 9.5pt; }
  .pmeta { display: grid; grid-template-columns: 1fr 1fr; gap: 2pt 18pt; margin: 0 0 8pt; font-size: 10pt; }
  .pmeta b { font-weight: 600; }
  .pl { width: 100%; border-collapse: collapse; margin: 0 0 8pt; font-size: 10pt; }
  .pl caption { text-align: left; font-weight: 700; font-size: 11pt; padding: 4pt 0; }
  .pl td, .pl th { border: 0.75pt solid #777; padding: 3pt 5pt; vertical-align: top; text-align: left; }
  .pl td.n { width: 28pt; font-weight: 700; text-align: center; }
  .pl th { font-size: 9pt; } .pl th.v { text-align: right; }
  .pask { font-size: 10pt; }
  .pl td.v { width: 92pt; text-align: right; font-family: var(--mono); white-space: nowrap; }
  .pl tr { break-inside: avoid; }
  .pl tr.key td { font-weight: 700; }
  .pnote { font-size: 9.5pt; margin: 4pt 0; }
  .pbox { border: 0.75pt solid #777; padding: 5pt 7pt; margin: 6pt 0; font-size: 9.5pt; break-inside: avoid; }
  .pbox ul { margin: 2pt 0 0; padding-left: 14pt; }
  .plog { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .plog thead { display: table-header-group; }
  .plog th, .plog td { border: 0.75pt solid #777; padding: 1.5pt 5pt; text-align: left; line-height: 1.25; }
  .plog th.run { background: none; border: 0; font-weight: 400; font-size: 8.5pt; text-align: right; padding: 0 0 2pt; }
  .plog th { background: #eee; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .plog td.d { text-align: right; width: 44pt; font-family: var(--mono); }
  .plog td.dt { width: 150pt; font-family: var(--mono); white-space: nowrap; }
  .plog tr { break-inside: avoid; }
  .plog tfoot { display: table-row-group; }   /* the grand total once, at the end, not on every page */
  .plog tfoot td { font-weight: 700; }
  .sign { display: grid; grid-template-columns: 2fr 1fr; gap: 18pt; margin-top: 16pt; font-size: 9pt; break-inside: avoid; }
  .sign div { border-top: 0.75pt solid #000; padding-top: 2pt; }
  .pcal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8pt 10pt; }
  .pcal .m h3 { font-size: 9.5pt; margin: 0 0 2pt; }
  .pcal .g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1pt; }
  .pcal .c { border: 0.5pt solid #999; height: 15pt; font-size: 6.5pt; line-height: 1; padding: 1pt; position: relative; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .pcal .c b { position: absolute; right: 1.5pt; bottom: 1.5pt; font-size: 7.5pt; }
  .pcal .c.off { border-color: transparent; color: #999; }
  .pcal .c.e { border: 0; }
  .pcal .c.home { background: #cfe8df; } .pcal .c.other { background: #d3e0f2; } .pcal .c.travel { background: #f8e2bd; }
  .pcal .c.hol { background: #f1d0d9; } .pcal .c.leave { background: #e1e4e8; } .pcal .c.none { background: #f2f2f2; color: #888; }
  .pkey { font-size: 9pt; margin-top: 8pt; }
  a { color: #000; text-decoration: none; }
}
@media (max-width: 370px) {
  .block { padding: 12px 10px; }
  .day { min-height: 0; font-size: 14px; }
  .dgrid { gap: 3px; }
}
