:root {
  --bg: #f4f6fa; --card: #ffffff; --text: #111827; --muted: #5b6573; --line: #dde2ea;
  --brand: #003082; --brand-text: #ffffff; --accent: #ffc917;
  --ok: #0b7a3b; --ok-bg: #dff5e6; --warn: #8a5a00; --warn-bg: #fff1cc; --bad: #b42318; --bad-bg: #fde4e1;
  --dis-bg: #e6e9ef; --dis-text: #7d8795; --dis-line: #d5dae3;
  --info-bg: #e3ecfb; --input-bg: #ffffff; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 2px 8px rgba(16,24,40,.05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117; --card: #171c26; --text: #eef1f6; --muted: #9aa5b5; --line: #2a3140;
    --brand: #5b8cff; --brand-text: #08111f; --accent: #ffc917;
    --ok: #5fdc90; --ok-bg: #12301f; --warn: #ffd166; --warn-bg: #3a2d0a; --bad: #ff8f85; --bad-bg: #3b1714;
    --dis-bg: #1d2331; --dis-text: #6f7a8c; --dis-line: #262d3b;
    --info-bg: #182540; --input-bg: #0f131b; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  overflow-x: hidden;
}
/* viewport-fit=cover: in home-screen mode the notch/status bar overlays the page, so the top padding adds the safe area */
#app { max-width: 640px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.5rem; margin: 4px 0 12px; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 22px 0 8px; }
p { margin: 0 0 10px; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.warn-text { color: var(--warn); margin-top: 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); margin: 0 0 12px; }
.card h3 { margin: 0 0 6px; font-size: 1rem; }
.card.info { background: var(--info-bg); border-color: transparent; }
.card.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.card.bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.card.ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.banner-red { background: var(--bad-bg); color: var(--bad); border-radius: 14px; padding: 12px 14px; margin: 0 0 12px; font-weight: 600; }
.banner-red a { color: inherit; }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; min-height: 52px; padding: 12px 18px; border-radius: 14px; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; cursor: pointer; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
/* clearly inactive (not just faded blue): flat muted surface, muted text, no press feedback */
.btn:disabled, .btn.primary:disabled { background: var(--dis-bg); color: var(--dis-text); border-color: var(--dis-line); opacity: 1; cursor: not-allowed; transform: none; }
.btn:disabled small { opacity: 1; }
.btn.danger { color: var(--bad); }
.btn.big { min-height: 76px; font-size: 1.15rem; border-radius: 18px; flex-direction: column; gap: 2px; }
.btn.big small { font-weight: 500; opacity: .85; font-size: .85rem; }
.btn.small { min-height: 44px; padding: 8px 14px; width: auto; font-size: .95rem; }
.btn.link { border: 0; background: transparent; color: var(--brand); min-height: 44px; width: auto; min-width: 44px; padding: 8px 4px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.field { margin: 0 0 14px; position: relative; }
.sign-in-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin: 0 0 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--input-bg); border: 1px solid var(--line); border-radius: 12px; appearance: none; -webkit-appearance: none;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=time].input, input[type=date].input { min-width: 0; max-width: 100%; }
.check { display: flex; gap: 12px; align-items: center; min-height: 50px; padding: 6px 0; font-weight: 500; }
.check input { width: 26px; height: 26px; flex: none; accent-color: var(--brand); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.suggest { position: absolute; z-index: 20; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-height: 280px; overflow: auto; }
.suggest li { padding: 13px 12px; border-radius: 8px; min-height: 48px; }
.suggest li:active, .suggest li:hover { background: var(--info-bg); }

.chip { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--info-bg); color: var(--text); white-space: nowrap; }
.chip-ready { background: var(--ok-bg); color: var(--ok); }
.chip-filed { background: var(--info-bg); color: var(--brand); }
.chip-paid { background: var(--ok-bg); color: var(--ok); }
.chip-rejected, .chip-expired { background: var(--bad-bg); color: var(--bad); }
.chip-check, .chip-profile { background: var(--warn-bg); color: var(--warn); }
.chip-not_eligible, .chip-not_claiming { background: var(--line); color: var(--muted); }

.list { padding: 0; margin: 0; list-style: none; }
.list a.item, .list .item {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; min-height: 64px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; color: inherit; text-decoration: none; box-shadow: var(--shadow);
}
.item .t { font-weight: 600; }
.item .s { color: var(--muted); font-size: .88rem; }
.item .r { text-align: right; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 10px; }
.chips[hidden] { display: none; }
.chips button { flex: 0 1 auto; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; min-height: 44px; padding: 8px 11px; font: inherit; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.chips button[aria-pressed=true] { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
.dep-chips { margin: -4px 0 14px; }
.dep-chips[hidden] { display: none; }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.timechip { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 12px; min-width: 68px; min-height: 44px; padding: 8px 14px; font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent; }
.timechip:active { transform: scale(.97); }
.timechip[aria-pressed=true] { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
.pk-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.pk-name { font-weight: 600; overflow-wrap: anywhere; }
.pk-row .btn { flex: none; }
.login-alt { display: flex; justify-content: center; margin: 6px 0 10px; }
.big-signin { min-height: 64px; font-size: 1.1rem; margin-top: 6px; }
a.small:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; padding-right: 12px; }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.totals div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.totals b { display: block; font-size: 1.1rem; }
.totals span { font-size: .75rem; color: var(--muted); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.copyrow { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.copyrow:first-of-type { border-top: 0; }
.copyrow .lab { font-size: .8rem; color: var(--muted); }
.copyrow .val { font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.copyrow .btn { flex: none; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .82rem; background: var(--input-bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 8px 0 0; }
textarea.code { font: .78rem/1.3 ui-monospace, Menlo, Consolas, monospace; min-height: 120px; }
ol.steps { padding-left: 22px; margin: 6px 0 12px; }
ol.steps li { margin: 6px 0; }
details > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabs[hidden] { display: none; }
#tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; font-size: .72rem; font-weight: 600; text-decoration: none; color: var(--muted); }
#tabs a span { font-size: 1.35rem; line-height: 1; }
#tabs a[aria-current=page] { color: var(--brand); }
#toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50; background: #111827; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; max-width: calc(100vw - 32px); transition: .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: #b42318; }
.login { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; }
.err-text { color: var(--bad); font-weight: 600; margin: 6px 0; }
.spin { text-align: center; padding: 40px 0; color: var(--muted); }
