:root {
  --paper: #f4efe6; --card: #fffdf8; --ink: #24232b; --muted: #65636b; --line: #e2d8c8;
  --accent: #5b4b8a; --accent-dk: #463a6d; --mustard: #d69a3a; --late: #a8492a; --pencil: #4a4850; --hi: #f6e3a6;
  --radius: 14px; --shadow: 0 1px 0 rgba(36,35,43,.04), 0 6px 18px rgba(36,35,43,.06);
  --hand: "Caveat", "Segoe Print", "Bradley Hand", "Comic Neue", "Chalkboard SE", cursive;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink);
  background: var(--paper) radial-gradient(circle at 6% 3%, rgba(214,154,58,.10), transparent 40%), radial-gradient(circle at 96% 28%, rgba(91,75,138,.09), transparent 45%); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.opt { font-weight: 400; color: var(--muted); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1080px; margin: 0 auto; padding: 18px 18px 6px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; font-family: var(--serif); }
.sub { margin: 0; color: var(--muted); font-size: .92rem; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

main { max-width: 1080px; margin: 0 auto; padding: 6px 18px 24px; }
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 10px; padding: 10px 14px; border-radius: 12px; background: #e7e2f0; color: var(--accent-dk); font-size: .93rem; }
.banner.bad { background: #f6e1d8; color: var(--late); }
.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent-dk); text-decoration: underline; font-weight: 600; cursor: pointer; }

button { cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: 9px 14px; min-height: 42px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(91,75,138,.35); outline-offset: 2px; }
.primary { background: var(--accent); color: #fff; font-weight: 600; }
.primary:hover { background: var(--accent-dk); }
.ghost { background: transparent; border-color: var(--line); }
.ghost:hover { background: #efe8da; }
.sm { min-height: 34px; padding: 5px 10px; font-size: .9rem; }
.danger { color: var(--late); }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.row.end { justify-content: flex-end; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px 26px; align-items: start;
  background: linear-gradient(155deg, #fffdf8 0%, #f4eee4 60%, #ede7dc 100%);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px 16px; margin-bottom: 16px; }
.hero:has(#chart-wrap[hidden]) { grid-template-columns: 1fr; }
.hero-kicker { margin: 0 0 4px; font-family: var(--hand); font-size: 1.45rem; color: var(--mustard); line-height: 1.1; filter: saturate(1.2) brightness(.85); }
.hero-title { margin: 0; font-family: var(--serif); font-size: 1.7rem; line-height: 1.22; letter-spacing: -.01em; }
.hero-title .big { background: var(--hi); padding: 0 .22em; border-radius: 4px; box-shadow: 1px 1px 0 rgba(36,35,43,.12); white-space: nowrap; }
.hero-sub { margin: 8px 0 0; color: var(--muted); }
.notes { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.notes li { font-size: .9rem; padding: 6px 10px; border-radius: 10px; background: rgba(255,253,248,.85); border: 1px solid var(--line); border-left: 4px solid var(--accent); }
.notes li.warn { border-left-color: var(--late); background: #fbefe9; }
.chart-wrap { margin: 0; }
.chart { background: #fbf8f1; border: 1px solid #ebe2d2; border-radius: 10px; padding: 10px 12px 2px;
  background-image: linear-gradient(rgba(120,110,160,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(120,110,160,.07) 1px, transparent 1px); background-size: 18px 18px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .track { fill: #eee6d8; }
.chart .tick { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.chart .nm { font: 700 17px "Source Sans 3", system-ui, sans-serif; fill: var(--ink); }
.chart .mini { font: 400 12.5px "Source Sans 3", system-ui, sans-serif; fill: var(--muted); }
.chart .val { font: 700 26px var(--hand); fill: var(--pencil); }
.chart .val.up { fill: var(--accent-dk); }
.chart .val.down { fill: var(--late); }
figcaption { font-size: .82rem; color: var(--muted); margin-top: 6px; }

/* steps */
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.step.manage { padding: 4px 18px 14px; background: transparent; box-shadow: none; border-style: dashed; }
.step-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.step-head h2 { margin: 0; font-size: 1.25rem; font-family: var(--serif); }
.step-aside { margin-left: auto; color: var(--muted); font-size: .88rem; }
.empty { color: var(--muted); font-style: italic; margin: 6px 0; }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 0; min-height: 1.2em; }
.hint.ok { color: var(--accent-dk); }
.hint.warn { color: var(--late); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }

/* rotation */
.rota-bar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.weeks { display: flex; gap: 6px; flex-wrap: wrap; }
.wtab { background: rgba(255,253,248,.7); border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; min-height: 44px; font-weight: 700; color: var(--pencil); display: grid; line-height: 1.15; text-align: left; }
.wtab small { font-weight: 400; font-size: .78rem; color: var(--muted); }
.wtab.on { background: var(--ink); color: #fffdf8; border-color: var(--ink); }
.wtab.on small { color: #d8d4cc; }
.who-pick { font-family: var(--hand); font-size: 1.3rem; color: var(--accent-dk); display: flex; gap: 6px; align-items: center; }
.who-pick select { font-family: "Source Sans 3", system-ui, sans-serif; font-size: .95rem; min-height: 36px; padding: 4px 8px; }
.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: #fbf8f2; border: 1px solid #ece4d5; border-radius: 12px; padding: 6px 6px 8px; min-height: 120px; display: flex; flex-direction: column; gap: 5px; }
.day.past { background: #f4f0e8; }
.day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #fffdf8; }
.dh { margin: 0 2px 2px; font-size: .9rem; color: var(--muted); display: flex; gap: 4px; align-items: baseline; }
.dh b { color: var(--ink); }
.tag { font: 700 .95rem var(--hand); color: #fff; background: var(--accent); border-radius: 6px; padding: 0 6px; margin-left: auto; }
.chip { display: grid; gap: 0; text-align: left; width: 100%; min-height: 0; padding: 5px 7px 5px 9px; border-radius: 8px; background: #fff; border: 1px solid #e6dece; border-left: 5px solid var(--c); line-height: 1.2; }
.chip:hover { border-color: var(--c); }
.cn { font-weight: 600; font-size: .86rem; overflow-wrap: anywhere; }
.cw { font-size: .8rem; color: var(--c); font-weight: 700; display: flex; gap: 4px; filter: brightness(.82); }
.cw i { font-style: normal; font-weight: 400; color: var(--muted); margin-left: auto; filter: none; }
.chip.s-done { background: color-mix(in srgb, var(--c) 10%, #fff); }
.chip.s-skip { opacity: .6; border-left-style: dotted; }
.chip.s-skip .cn { text-decoration: line-through; }
.chip.s-unmarked { border-style: dashed; border-left-style: solid; background: #fffaf0; }
.chip.s-none { border-left-color: var(--late); background: #fbefe9; }
.chip.s-none .cw { color: var(--late); }
.chip.dim { opacity: .28; }
.chip.moved { animation: moved 1.6s ease-out 2; box-shadow: 0 0 0 2px var(--mustard); }
@keyframes moved { 0% { box-shadow: 0 0 0 4px rgba(214,154,58,.8); } 100% { box-shadow: 0 0 0 2px rgba(214,154,58,.5); } }
.none { margin: 4px; color: #b9b2a5; }
.aw { margin: auto 2px 0; font-size: .76rem; color: var(--muted); font-style: italic; }
.week-sum { margin: 10px 0 0; font-size: .92rem; color: var(--muted); display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; }
.ws { color: var(--ink); font-weight: 600; }
.ws::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 5px; }
.rota-settings { border-top: 1px dashed var(--line); padding-top: 12px; }
.inline { display: flex; gap: 6px; align-items: center; font-size: .92rem; color: var(--muted); }
input[type=text], input[type=number], input[type=date], select { border: 1px solid #d9cdb6; background: #fff; border-radius: 10px; padding: 8px 10px; min-height: 40px; }
input[type=number] { -moz-appearance: textfield; }

/* people & chores */
.people, .chores { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.person, .chore { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 4px 12px; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.chore { grid-template-columns: minmax(0, 1fr) auto; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
.pn, .cn2 { margin: 0; font-weight: 700; }
.pm { margin: 0; color: var(--muted); font-size: .88rem; }
.pt { margin: 0; text-align: right; font-family: var(--serif); font-weight: 700; display: grid; line-height: 1.1; }
.pt small { font-family: "Source Sans 3", system-ui, sans-serif; font-weight: 400; font-size: .75rem; color: var(--muted); }
.acts { display: flex; gap: 6px; }
.quick { margin-bottom: 12px; }
.quick-label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .95rem; }
.quick-row { display: flex; gap: 8px; }
.quick-row input { flex: 1; min-width: 0; }
.sub-form { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbf8f1; }
.sub-form h3 { margin: 0 0 10px; font-family: var(--serif); }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.field { display: grid; gap: 4px; }
.field label { font-weight: 600; font-size: .9rem; }
.fs { border: 1px dashed #d9cdb6; border-radius: 10px; margin: 12px 0 0; padding: 8px 12px 12px; }
.fs legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }
.away-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; font-size: .92rem; }
.away-row label { display: flex; gap: 6px; align-items: center; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.check { display: flex; gap: 6px; align-items: center; font-size: .93rem; }
.form-error { color: var(--late); font-weight: 600; margin: 10px 0 0; }
.take { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ics-pick { display: inline-flex; gap: 6px; }

/* dialog */
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; box-shadow: 0 20px 50px rgba(36,35,43,.25); max-width: min(440px, calc(100% - 24px)); width: 100%; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(36,35,43,.35); }
.dlg { padding: 18px 20px 14px; }
.d-when { margin: 0; font-family: var(--hand); font-size: 1.35rem; color: var(--accent-dk); }
.dlg h3 { margin: 0; font-family: var(--serif); font-size: 1.4rem; }
.d-status { margin: 4px 0 12px; color: var(--muted); }
.d-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.d-other { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.d-other label { font-weight: 600; font-size: .92rem; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fffdf8; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: .95rem; z-index: 10; max-width: calc(100% - 32px); }
.foot { max-width: 1080px; margin: 0 auto; padding: 0 18px 28px; color: var(--muted); font-size: .85rem; }

/* fridge sheet: print only */
.sheet { display: none; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; }
  .top, main, .foot { display: none !important; }
  .sheet { display: block; }
  .sheet-week { break-after: page; }
  .sheet-week:last-child { break-after: auto; }
  .sheet h2 { font-family: var(--serif); margin: 0 0 8px; font-size: 18pt; }
  .sheet table { width: 100%; border-collapse: collapse; font-size: 10.5pt; }
  .sheet th, .sheet td { border: 1px solid #999; padding: 5px 6px; text-align: left; vertical-align: top; }
  .sheet thead th { background: #eee; }
  .sheet tbody th small { display: block; font-weight: 400; color: #555; }
  .sheet td.sk { color: #888; font-style: italic; }
  .sheet-foot { margin-top: 8px; font-size: 10pt; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.45rem; }
  .grid { grid-template-columns: 1fr; }
  .day { min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .dh, .aw, .none { grid-column: 1 / -1; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .person { grid-template-columns: auto minmax(0, 1fr) auto; }
  .person .acts, .chore .acts { grid-column: 1 / -1; }
  .chore { grid-template-columns: 1fr; }
  .quick-row { flex-direction: column; }
}
