:root {
  --bg: #f6f1ea;
  --card: #fffdf9;
  --ink: #26323a;
  --muted: #7b8088;
  --line: #e6ddd1;
  --accent: #2f6f6a;
  --accent-ink: #fff;
  --danger: #b84a4a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 14px rgba(60, 40, 20, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer; border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  padding: .45rem .8rem; min-height: 38px; -webkit-tap-highlight-color: transparent;
}
button:hover { border-color: #cfc3b3; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--danger); }
button.icon { width: 38px; padding: 0; font-size: 1.3rem; line-height: 1; }
button.icon.sm { width: 30px; min-height: 30px; font-size: .95rem; border-color: transparent; background: transparent; color: var(--muted); }
button.link { border: 0; background: none; color: var(--accent); min-height: 0; padding: 0 .3rem; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .65rem; background: #fff; min-height: 40px;
}
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
input[type=color] { width: 44px; height: 40px; padding: 2px; }
h2 { font-size: 1.3rem; margin: 0; }
h3 { font-size: 1.1rem; margin: 0; }
h4 { margin: 1rem 0 .4rem; font-size: .95rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pad { padding: 1rem; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; background: rgba(246, 241, 234, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: .7rem; }
.clock { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; }
.clockdate { color: var(--muted); }
.nav { display: flex; gap: .3rem; margin-left: auto; }
.nav button { border: 0; background: transparent; display: flex; align-items: center; gap: .35rem; color: var(--muted); font-weight: 600; }
.nav button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
select.lang { width: auto; flex: none; padding: .3rem .5rem; font-size: .85rem; background: var(--card); color: var(--muted); }
.demo { background: #fdf0d8; color: #7a5a1c; padding: .45rem 1rem; font-size: .85rem; text-align: center; }
main { padding: 1rem; max-width: 1500px; margin: 0 auto; }

/* chips */
.chip {
  --c: #888; display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .3rem .75rem;
  border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 14%, white); font-weight: 600; min-height: 34px; cursor: pointer;
}
.chip.off { background: transparent; opacity: .45; text-decoration: line-through; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
label.chip:has(input:not(:checked)) { background: transparent; opacity: .55; }
label.chip { position: relative; }
.pick, .days { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.days .chip { --c: var(--accent); }
.dot { --c: #888; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.dots { display: inline-flex; gap: 3px; margin-left: auto; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; }

/* toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.toolbar h2 { margin-left: .3rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--card); }
.seg button.on { background: var(--ink); color: #fff; }
.filters { display: flex; gap: .35rem; flex-wrap: wrap; }

/* month */
.month { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.wd, .grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.wd span { padding: .45rem; font-size: .8rem; color: var(--muted); font-weight: 600; text-align: center; border-bottom: 1px solid var(--line); }
.cell {
  min-height: 112px; padding: .3rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; cursor: pointer; overflow: hidden; min-width: 0;
}
.cell:nth-child(7n) { border-right: 0; }
.cell.other { background: #faf6f0; color: #b2aaa0; }
.cell.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.num { font-size: .85rem; font-weight: 600; width: 1.8em; height: 1.8em; display: grid; place-items: center; border-radius: 50%; }
.cell.today .num { background: var(--accent); color: #fff; }
.ev {
  --c: #888; text-align: left; border: 0; min-height: 0; padding: 1px 6px; border-radius: 6px; font-size: .78rem;
  background: color-mix(in srgb, var(--c) 18%, white); border-left: 3px solid var(--c);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;
}
.more { font-size: .72rem; color: var(--muted); padding-left: 4px; }
.mdots { display: none; gap: 2px; flex-wrap: wrap; }

/* week */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; }
.wcol { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .5rem; min-height: 320px; display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.wcol.today { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }
.whead { display: flex; align-items: baseline; gap: .35rem; border: 0; background: none; padding: .2rem; font-weight: 600; color: var(--muted); }
.whead b { font-size: 1.4rem; color: var(--ink); }
.whead .add { margin-left: auto; opacity: .5; }
.wev, .wmeal {
  --c: #888; text-align: left; display: flex; flex-direction: column; gap: 2px; border: 0; border-left: 4px solid var(--c);
  background: color-mix(in srgb, var(--c) 14%, white); border-radius: 8px; padding: .35rem .5rem; font-weight: 600; font-size: .9rem; position: relative;
}
.wev small { font-weight: 500; color: var(--muted); }
.wev .dots { position: absolute; right: 6px; top: 6px; }
.wmeal { --c: #f0a35e; margin-top: auto; font-weight: 500; }

/* agenda + day panel */
.agenda, .daypanel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .6rem 1rem 1rem; }
.daypanel { margin-top: 1rem; }
.daypanel > .row { justify-content: space-between; margin-bottom: .5rem; }
.aday h4 { color: var(--muted); }
.aday.today h4 { color: var(--accent); }
.arow {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: none; padding: .55rem .2rem;
}
.arow .t { width: 92px; flex: none; color: var(--muted); font-size: .85rem; }
.arow .bar { --c: #888; width: 4px; align-self: stretch; border-radius: 2px; background: var(--c); }
.arow .ti { font-weight: 600; display: flex; flex-direction: column; }
.arow .ti small { font-weight: 400; color: var(--muted); }

/* chores */
.pcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .8rem; }
.pcol { --c: #888; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem; border-top: 5px solid var(--c); }
.phead { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.phead small { display: block; color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; }
.bal { margin-left: auto; font-weight: 700; font-size: 1.1rem; }
.chore { display: flex; align-items: center; gap: .55rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.chore .ct { flex: 1; font-weight: 600; }
.chore.done .ct { text-decoration: line-through; color: var(--muted); }
.check {
  width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid var(--c, var(--accent));
  background: #fff; color: #fff; font-weight: 700; flex: none;
}
.done > .check, .chore.done .check { background: var(--c, var(--accent)); }
.stars { color: #b07d1e; font-size: .85rem; }
.rewards { margin-top: 1.2rem; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem; }
.rewards > .row { justify-content: space-between; }
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; margin-top: .5rem; }
.reward { border: 1px solid var(--line); border-radius: 12px; padding: .6rem; position: relative; }
.reward .icon { position: absolute; right: 4px; top: 4px; }
.rt { font-weight: 700; padding-right: 26px; }
.rc { color: #b07d1e; font-weight: 600; margin: .2rem 0 .5rem; }
.rbtns { display: flex; gap: .3rem; flex-wrap: wrap; }
.rbtns .chip { font-size: .8rem; padding: .15rem .6rem; min-height: 30px; }
.redrow { display: flex; justify-content: space-between; gap: .5rem; padding: .3rem 0; font-size: .9rem; border-bottom: 1px solid var(--line); }

/* lists */
.tabs { gap: .35rem; }
.tab { border-radius: 999px; font-weight: 600; }
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab.on .badge { background: #fff; color: var(--ink); }
.tab.add { border-style: dashed; color: var(--muted); }
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; max-width: 760px; }
.additem { display: flex; gap: .5rem; margin: .8rem 0; }
.items { list-style: none; padding: 0; margin: 0; }
.items li { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.items .it { flex: 1; cursor: pointer; font-size: 1.05rem; }
.items li.done .it { text-decoration: line-through; color: var(--muted); }
.items .check { --c: var(--accent); }

/* meals */
.meals { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .5rem; }
.mhead, .mday { display: grid; grid-template-columns: 90px repeat(3, 1fr); gap: .4rem; align-items: stretch; }
.mhead span { font-size: .8rem; color: var(--muted); font-weight: 600; padding: .3rem; }
.mday { padding: .3rem 0; border-top: 1px solid var(--line); }
.mday.today .mdate { color: var(--accent); }
.mdate { padding: .4rem; align-self: center; }
.mslot { text-align: left; min-height: 56px; display: flex; flex-direction: column; gap: 2px; border-style: dashed; font-weight: 600; }
.mslot small { display: none; font-weight: 500; color: var(--muted); }
.mslot.has { border-style: solid; background: color-mix(in srgb, #f0a35e 12%, white); }

/* settings */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; max-width: 700px; }
.card h2 { margin-bottom: .5rem; }
.prow { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.login { margin: 2rem auto; max-width: 400px; }
.login form { display: grid; gap: .7rem; }

/* modal */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); background: var(--card); }
dialog::backdrop { background: rgba(30, 25, 20, .35); }
#mform { padding: 1.1rem; display: grid; gap: .6rem; max-height: 88vh; overflow: auto; }
#mform label { display: grid; gap: .25rem; font-size: .85rem; font-weight: 600; color: #4d555c; }
#mform label.inline { display: flex; align-items: center; gap: .45rem; }
#mform label.chip { display: inline-flex; color: var(--ink); }
.lbl { font-size: .85rem; font-weight: 600; color: #4d555c; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.two:has(.narrow) { grid-template-columns: 1fr 90px; }
.mbtns { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 12px; box-shadow: var(--shadow); max-width: 90vw;
}

/* phones */
@media (max-width: 899px) {
  .top { padding: .5rem .8rem; backdrop-filter: none; background: var(--bg); } /* a blur would trap the fixed nav inside the header */
  .clock { font-size: 1.4rem; }
  select.lang { margin-left: auto; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; margin: 0; justify-content: space-around; z-index: 10;
    background: var(--card); border-top: 1px solid var(--line); padding: .3rem .3rem calc(.3rem + env(safe-area-inset-bottom));
  }
  .nav button { flex-direction: column; gap: 0; font-size: .7rem; padding: .25rem .4rem; }
  .nav button .ico { font-size: 1.25rem; }
  .nav button.on { box-shadow: none; background: transparent; color: var(--accent); }
  main { padding: .7rem .7rem 90px; }
  .cell { min-height: 58px; align-items: center; }
  .cell .ev, .cell .more { display: none; }
  .mdots { display: flex; justify-content: center; }
  .week { grid-template-columns: 1fr; }
  .wcol { min-height: 0; }
  .wmeal { margin-top: 0; }
  .arow .t { width: 70px; }
  .mhead { display: none; }
  .mday { grid-template-columns: 1fr 1fr 1fr; }
  .mdate { grid-column: 1 / -1; padding: .3rem 0 0; }
  .mslot small { display: block; }
  .two { grid-template-columns: 1fr; }
  .two:has(.narrow) { grid-template-columns: 1fr 80px; }
}

/* added: countdowns, day view chores, shared chores, recipes */
[hidden] { display: none !important; }
.countdowns { display: flex; gap: .5rem; overflow-x: auto; margin-bottom: .8rem; padding-bottom: 2px; }
.cd {
  --c: #888; flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left;
  border: 0; border-left: 4px solid var(--c); background: var(--card); box-shadow: var(--shadow); padding: .45rem .8rem;
}
.cd b { font-size: 1.15rem; }
.cd span { font-size: .85rem; color: var(--muted); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcols.compact { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; }
.pcols.compact .pcol { box-shadow: none; border: 1px solid var(--line); border-top: 4px solid var(--c); padding: .5rem .7rem; }
.chore .ct small { display: block; font-weight: 400; font-size: .78rem; color: var(--muted); }
button.bal { border: 0; background: color-mix(in srgb, #f0c14b 22%, white); border-radius: 999px; padding: .2rem .7rem; }
.chip.big { font-size: 1.1rem; padding: .6rem 1.2rem; }
input.search { width: min(320px, 70vw); }
/* meals: what we have / what to buy */
.stock { max-width: 760px; }
.stock .counts { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .8rem; }
.stock .counts div { background: var(--bg); border-radius: 12px; padding: .5rem .8rem; display: flex; flex-direction: column; }
.stock .counts b { font-size: 1.6rem; }
.stock .ok { color: var(--accent); }
.stock .need { color: #a4501c; }
.ings { margin-top: .6rem; }
.ings li { gap: .8rem; }
.ings li div.grow { display: flex; flex-direction: column; min-width: 0; }
.ings .onlist { font-size: .8rem; font-weight: 600; color: var(--accent); background: #e3efec; border-radius: 999px; padding: .25rem .7rem; white-space: nowrap; }
.seg.hb { border-radius: 999px; flex: none; }
.seg.hb button { min-height: 34px; padding: .3rem .8rem; font-weight: 600; font-size: .9rem; }
.seg.hb button.on.have { background: var(--accent); }
.seg.hb button.on.buy { background: #a4501c; }
.recipes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.recipe {
  display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; text-align: left; padding: .8rem;
  background: var(--card); box-shadow: var(--shadow); border: 0; border-top: 4px solid #f0a35e; border-radius: var(--radius); min-height: 76px;
}
.recipe small { color: var(--muted); }
.methodtext { white-space: pre-wrap; background: #faf6f0; border: 1px solid var(--line); border-radius: 10px; padding: .6rem; font-size: .9rem; max-height: 220px; overflow: auto; }

/* Google Calendar */
.gnote { background: #eef4fb; border: 1px solid #d3e2f3; border-radius: 10px; padding: .5rem .7rem; margin: 0; font-size: .9rem; }
.warn { color: #9a5a12; }
code { background: #f1ebe2; padding: .15rem .4rem; border-radius: 6px; word-break: break-all; }
.gform { display: grid; gap: .6rem; max-width: 460px; }
.gform label { display: grid; gap: .25rem; font-size: .85rem; font-weight: 600; }
.gacct { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; margin: .6rem 0; }
.gcals { width: 100%; border-collapse: collapse; margin-top: .4rem; font-size: .9rem; }
.gcals th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; padding: .3rem; }
.gcals td { padding: .3rem; border-top: 1px solid var(--line); }
.gcals select { min-height: 34px; padding: .2rem .4rem; }
a.button { display: inline-flex; align-items: center; text-decoration: none; border-radius: 10px; padding: .45rem .8rem; min-height: 38px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
a.button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

/* notifications */
.notify .nset { display: grid; gap: .6rem; margin: .4rem 0 .6rem; max-width: 420px; }
.notify .nset label { display: grid; gap: .25rem; font-size: .9rem; }
.notify label.inline { display: flex; align-items: center; gap: .5rem; }
.notify label.inline select { width: auto; }
