:root {
  --bg: #14213d; --panel: #1f3158; --text: #f4f6fb; --muted: #9fb0d0;
  --accent: #fca311; --done: #2a9d8f; --danger: #e5484d;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 18px/1.3 system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); min-height: 100vh; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--panel); border: 0; border-radius: 12px; padding: 12px 18px; min-height: 48px; cursor: pointer; }
button.primary { background: var(--accent); color: #14213d; font-weight: 600; }
button.on { background: var(--accent); color: #14213d; }

header { position: sticky; top: 0; background: var(--bg); padding: 12px 16px 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.date { display: flex; align-items: center; gap: 8px; }
.date button { padding: 8px 14px; font-size: 28px; line-height: 1; }
/* Fixed width so the ‹ › buttons never move when the date text changes. */
.dateText { width: 10em; font-size: clamp(1rem, 3vw, 1.6rem); text-align: center; flex: none; }
h1 { margin: 0; font-size: 1.5em; white-space: nowrap; }
#sub { color: var(--muted); font-size: .75em; white-space: nowrap; }
#tabs { flex-basis: 100%; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
#tabs button { flex: none; border-radius: 20px; padding: 8px 20px; min-height: 44px; }
#tabs button.on { background: var(--accent); color: #14213d; font-weight: 600; }
.calHead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.calGrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.calGrid .dow { color: var(--muted); font-size: .8rem; padding: 4px 0; }
.calGrid button { padding: 0; min-height: 44px; border-radius: 10px; background: transparent; }
.calGrid button.today { border: 2px solid var(--accent); }
.calGrid button.sel { background: var(--accent); color: #14213d; font-weight: 700; }
.calGrid button.other { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
#clock { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
#weather { margin-left: auto; display: flex; align-items: center; gap: 10px; text-align: right; }
#weather .icon { font-size: 2.2rem; line-height: 1; }
#weather .temp { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
#weather .desc { color: var(--muted); font-size: .8rem; }
.progress { flex-basis: 100%; height: 8px; background: var(--panel); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
#bar { height: 100%; width: 0; background: var(--done); transition: width .3s; }

main { padding: 8px 16px 40px; }
h2.group { margin: 20px 0 8px; font-size: .9rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tile { display: flex; align-items: center; gap: 14px; background: var(--panel); border-radius: 16px; padding: 18px; min-height: 76px; font-size: 1.25rem; text-align: left; width: 100%; user-select: none; }
.tile .box { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 3px solid var(--muted); display: grid; place-items: center; font-size: 22px; }
.tile .text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile .meta { font-size: .8rem; color: var(--muted); }
/* "Anyone" tasks: one shared tick for the household, so they get their own color. */
.tile.anyone { background: #3a2f6b; }
.tile.done { background: #1b3a47; color: var(--muted); }
.tile.anyone.done { background: #2b2850; }
/* One-off tasks (an exception for a single day) win over the "anyone" color. */
.tile.oneoff { background: #6b4e12; }
.tile.oneoff.done { background: #3f3420; }
.tile.overdue { background: #6b1218; box-shadow: inset 6px 0 0 #ff6b6b; }
.tile.overdue .meta { color: #ffc2c2; font-weight: 600; }
.due { display: block; color: var(--muted); font-size: .9rem; margin: 6px 0; }
.due input { margin-top: 4px; }
.tile.done .label { text-decoration: line-through; }
.tile.done .box { background: var(--done); border-color: var(--done); color: #fff; }
.tile.skipped { opacity: .45; }
.tile .label { overflow-wrap: anywhere; }
.row { display: flex; gap: 6px; align-items: stretch; }
.row .tile { flex: 1; }
.row .side { padding: 8px 12px; font-size: .9rem; }
.empty { text-align: center; color: var(--muted); margin-top: 15vh; font-size: 1.4rem; }
.allDone { text-align: center; color: var(--done); margin: 24px; font-size: 1.4rem; }

#offline { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); background: var(--danger); padding: 8px 16px; border-radius: 20px; }

dialog { background: var(--bg); color: var(--text); border: 1px solid var(--panel); border-radius: 16px; width: min(560px, 94vw); max-height: 90vh; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog input, dialog select { width: 100%; background: var(--panel); border: 1px solid #3b4f7d; border-radius: 10px; padding: 12px; margin: 6px 0; }
menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 12px 0 0; }
.days { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.days button { padding: 8px 12px; min-height: 42px; }
.rItem { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--panel); }
.rItem small { display: block; color: var(--muted); }
.rItem.off { opacity: .5; }
.rItem .btns { display: flex; gap: 6px; flex: none; }
.rItem button { padding: 6px 12px; min-height: 38px; }
