:root {
  --bg: #FBF7F0; --card: #FFFFFF; --navy: #1F2A44; --teal: #1D7870; --teal-soft: #DDF0ED;
  --gold: #E9B949; --gold-soft: #FBF0D0; --muted: #5B6478; --line: #E8E2D6; --danger: #A8261C; --danger-soft: #FBE4E1;
  --radius: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--navy); font-size: 17px; line-height: 1.45; }
h1 { font-size: 26px; margin: 16px 0 8px; } h2 { font-size: 19px; margin: 0 0 10px; } h3 { font-size: 16px; margin: 12px 0 6px; }
p { margin: 6px 0; } .muted { color: var(--muted); font-size: 15px; } .small { font-size: 14px; }
a { color: var(--teal); }
ul, ol { padding-left: 22px; margin: 6px 0; } ul.plain { list-style: none; padding: 0; margin: 0; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); max-width: 760px; margin: 0 auto; }
.brand { font-weight: 800; font-size: 20px; color: var(--navy); text-decoration: none; }
.modes { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.modes a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; text-decoration: none; color: var(--navy); font-weight: 600; }
.modes a[aria-current="page"] { background: var(--navy); color: #fff; }
main { padding: 0 16px 48px; max-width: 760px; margin: 0 auto; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: 0 1px 2px rgba(31,42,68,.05); }
.card.teal { background: var(--teal-soft); border-color: transparent; } .card.gold { background: var(--gold-soft); border-color: transparent; }
.tag { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--teal); background: #fff; border-radius: 999px; padding: 3px 10px; margin-bottom: 8px; }
.badge { display: inline-block; font-size: 13px; font-weight: 600; color: var(--navy); background: var(--gold-soft); border-radius: 999px; padding: 2px 10px; margin-left: 8px; vertical-align: middle; }
.badge.warn { background: var(--danger-soft); color: var(--danger); } .badge.teal { background: var(--teal-soft); color: var(--teal); }

button, .btn { font: inherit; min-height: 44px; min-width: 44px; padding: 8px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--navy); font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.danger { color: var(--danger); } .btn.link { border: none; background: none; color: var(--teal); padding: 8px; text-decoration: underline; }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: 15px; }
.btn.wide { width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.chips { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px; -webkit-overflow-scrolling: touch; }
.chip { min-height: 52px; display: inline-flex; align-items: center; gap: 10px; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 18px 4px 6px; font-size: 18px; font-weight: 700; color: var(--navy); white-space: nowrap; }
.chip[aria-selected="true"] { border-color: var(--c); background: var(--c); color: #fff; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--c); color: #fff; display: inline-grid; place-items: center; flex: none; }
.chip[aria-selected="true"] .avatar { background: #fff; color: var(--c); }
.avatar svg { width: 22px; height: 22px; }

.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.weeknav .iconbtn { width: 48px; font-size: 26px; padding: 0; border-radius: 50%; }
.weeklabel { text-align: center; flex: 1; } .weeklabel strong { display: block; font-size: 15px; color: var(--teal); text-transform: uppercase; letter-spacing: .03em; }
.weeklabel span { font-size: 17px; font-weight: 600; }

.chores { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.chore { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.chore .ico { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; }
.chore .ico svg, .ico svg { width: 22px; height: 22px; }
.chore strong { font-size: 17px; } .chore p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.rotation h2 { font-size: 24px; margin: 4px 0; }
.rotation .ico { background: #fff; }

.deds { list-style: none; padding: 0; margin: 0; }
.deds li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.deds li:first-child { border-top: none; } .deds .amt { font-weight: 700; white-space: nowrap; } .deds .muted { display: block; }
dl.money { margin: 0; } dl.money div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
dl.money div:first-child { border-top: none; } dl.money dt { color: var(--muted); } dl.money dd { margin: 0; font-weight: 600; }
dl.money .total { border-top: 2px solid var(--navy); font-size: 20px; } dl.money .total dt { color: var(--navy); font-weight: 700; }
.neg { color: var(--danger); } .pos { color: var(--teal); }

details { margin: 8px 0; } summary { cursor: pointer; font-weight: 700; padding: 10px 0; min-height: 44px; display: flex; align-items: center; }
details.card summary { margin: -6px 0; }

label { display: block; margin: 12px 0; } .field { margin: 12px 0; } .field > label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 4px; font-weight: 600; }
label.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 4px 0; } label.check input { width: 24px; height: 24px; min-height: 0; margin: 0; }
input, select, textarea { width: 100%; font: inherit; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--navy); }
input[type="color"] { padding: 4px; height: 44px; } textarea { min-height: 88px; resize: vertical; }
.hint { font-size: 14px; color: var(--muted); margin: 4px 0 0; } .err { color: var(--danger); font-weight: 600; min-height: 1.2em; margin: 8px 0 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

dialog { border: none; border-radius: var(--radius); padding: 20px; width: min(94vw, 500px); max-height: 90vh; overflow: auto; color: var(--navy); }
dialog::backdrop { background: rgba(31, 42, 68, .45); } dialog h2 { margin-top: 0; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 10px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.tabs a { white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--navy); text-decoration: none; font-weight: 600; font-size: 15px; }
.tabs a[aria-current="page"] { background: var(--teal); border-color: var(--teal); color: #fff; }

.list { list-style: none; padding: 0; margin: 0; } .list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list li:first-child { border-top: none; } .list li > div:first-child { flex: 1 1 200px; min-width: 0; }
table { width: 100%; border-collapse: collapse; font-size: 15px; } th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; } th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; border-top: none; }
.tablewrap { overflow-x: auto; }
.notice { background: var(--gold-soft); border-radius: 12px; padding: 12px; margin: 8px 0; } .notice.warn { background: var(--danger-soft); }
.login { max-width: 420px; margin: 24px auto; text-align: center; } .login input { text-align: center; font-size: 24px; letter-spacing: .3em; }
.loading { text-align: center; color: var(--muted); padding: 40px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (min-width: 700px) {
  .chores { grid-template-columns: 1fr 1fr; }
  .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
}
@media (prefers-reduced-motion: no-preference) { .chip, .btn { transition: background .15s, border-color .15s; } }
