/* GiftClaim app. Brand tokens from the launch site (GiftClaim.html). */
:root {
  --bg: #f5f7fb; --surface: #ffffff; --ink: #0f1a33; --muted: #4a5672; --line: #d6dcea;
  --brand: #1f45b5; --brand-ink: #ffffff; --brand-soft: #e3e9f8; --mark: #ffd84d; --mark-ink: #2a2300;
  --good: #1f7a4d; --good-soft: #e3f3ea; --warn: #9a5b00; --warn-soft: #fbefd9; --bad: #b00020; --bad-soft: #fbe3e7;
  --shadow: 0 1px 2px rgba(15,26,51,.06), 0 8px 24px rgba(15,26,51,.06);
  --f-display: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--f-display); letter-spacing: -.01em; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--f-mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

/* Top bar and navigation */
.topbar { display: flex; align-items: center; gap: 20px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font: 800 18px var(--f-display); }
.org-switch { text-decoration: none; color: var(--ink); font-weight: 600; padding: 4px 10px; border-radius: 8px; background: var(--bg); }
.org-switch .muted { font-weight: 400; font-size: 13px; margin-left: 6px; }
.signout { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 14px; }
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 53px); }
.shell.no-nav { grid-template-columns: minmax(0, 1fr); }
.sidenav { padding: 20px 12px; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.sidenav a { text-decoration: none; color: var(--ink); padding: 8px 12px; border-radius: 8px; }
.sidenav a:hover { background: var(--bg); }
.sidenav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
main { padding: 28px 32px 64px; max-width: 1240px; width: 100%; }
.shell.no-nav main { margin: 0 auto; max-width: 980px; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidenav { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 16px; }
  .sidenav hr { display: none; }
  main { padding: 20px 16px 48px; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
}

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.eyebrow { font: 500 12px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
.tile .k { font-size: 13px; color: var(--muted); }
.tile .v { font: 800 28px var(--f-display); margin: 4px 0; }
.tile .s { font-size: 13px; color: var(--muted); }
.tile.hero { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.tile.hero .k, .tile.hero .s { color: #dfe6fb; }
.tile.warn .v { color: var(--warn); }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); padding: 9px 16px; border-radius: 8px; font: 600 14px var(--f-body); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--surface); color: var(--brand); }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
button.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: 15px var(--f-body); background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 1px; border-color: var(--brand); }
textarea { min-height: 90px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }
.field-validation-error, .validation-summary-errors { color: var(--bad); font-size: 13px; }
.inline-form { display: inline; }

/* Flash messages */
.flash { padding: 12px 16px; border-radius: 8px; background: var(--good-soft); color: var(--good); margin-bottom: 18px; border: 1px solid #b9dfc9; }
.flash-error { background: var(--bad-soft); color: var(--bad); border-color: #f1b8c2; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.flash-row { animation: rowflash 1.6s ease-out; }
@keyframes rowflash { from { background: var(--mark); } to { background: transparent; } }

/* Chips */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip-good { background: var(--good-soft); color: var(--good); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-mark { background: #fff3c2; color: var(--mark-ink); }
.chip-muted { background: #eceff5; color: var(--muted); }
.chip-brand { background: var(--brand-soft); color: var(--brand); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }

/* Tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--brand); border-color: var(--brand); font-weight: 600; }
.tabs .count { font-size: 12px; background: var(--bg); padding: 0 6px; border-radius: 999px; margin-left: 4px; }

/* Checks list */
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; }
.checks .rule { font: 500 12px var(--f-mono); color: var(--muted); min-width: 44px; padding-top: 2px; }

/* HMRC schedule preview: looks like the spreadsheet */
.sheet { font: 12px/1.35 Arial, Helvetica, sans-serif; border: 1px solid #c9ced8; border-radius: 8px; overflow: auto; background: #fff; }
.sheet table { font-size: 12px; min-width: 900px; }
.sheet th { background: #d9d9d9; color: #1a1a1a; text-transform: none; letter-spacing: 0; font-size: 11px; border: 1px solid #c9ced8; padding: 4px 6px; }
.sheet td { border: 1px solid #c9ced8; padding: 3px 6px; white-space: nowrap; background: #fffbe6; }
.sheet td.rn { background: #eef0f4; color: var(--muted); font: 500 11px var(--f-mono); text-align: center; }
.sheet .boxes { display: flex; gap: 24px; padding: 10px 12px; border-bottom: 1px solid #c9ced8; background: #fafbfd; flex-wrap: wrap; }
.sheet .boxes b { font-family: var(--f-mono); background: var(--mark); padding: 1px 6px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; flex-wrap: wrap; }
.timeline li { flex: 1 1 120px; padding: 10px 12px; border-top: 3px solid var(--line); font-size: 13px; color: var(--muted); }
.timeline li.done { border-color: var(--good); color: var(--ink); }
.timeline li.now { border-color: var(--brand); color: var(--ink); font-weight: 600; }

.stack > * + * { margin-top: 12px; }
.empty { text-align: center; padding: 36px; color: var(--muted); }
.platforms { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.platform { border: 1px solid var(--line); border-radius: var(--r); padding: 18px; background: var(--surface); }
.platform h3 { display: flex; justify-content: space-between; align-items: center; }
.auth-card { max-width: 420px; margin: 48px auto; }
details summary { cursor: pointer; color: var(--brand); }
.htmx-request { opacity: .6; transition: opacity .2s; }
.narrow { max-width: 90px; }
.day-month { flex-wrap: nowrap; }
.day-month > .narrow { flex: 0 0 72px; }
.day-month > select { flex: 1 1 auto; width: auto; min-width: 0; }
fieldset.plain { border: 0; padding: 0; margin: 0; }
td select { min-width: 140px; }
.grid + .card, .grid + .flash { margin-top: 20px; }
.timeline.card { margin-bottom: 20px; padding: 0 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
