/* Familienkalender – one deep ink colour for structure, one marker colour per person. */
:root {
  --paper: #f2f4f7;
  --card: #ffffff;
  --ink: #1d2b45;
  --ink-2: #46536b;
  --muted: #76829a;
  --line: #dde2ea;
  --line-2: #edf0f4;
  --now: #e5484d;
  --danger: #c8333a;
  --focus: #3b6fe0;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", Inter, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "SF Pro Display", Roboto, Inter, sans-serif;
  --hour: 52px;
  --r-s: 10px;
  --r: 14px;
  --r-l: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

.m-blue { --c: #3b7bf6; --cs: #e3ecff; --ci: #173a86; }
.m-green { --c: #1f9d68; --cs: #dbf3e7; --ci: #0c5537; }
.m-pink { --c: #df4589; --cs: #fce3ee; --ci: #85194a; }
.m-amber { --c: #e39a0b; --cs: #fff0d0; --ci: #6d4300; }
.m-purple { --c: #8a5cf5; --cs: #ece5fe; --ci: #46259a; }
.m-teal { --c: #0e9ca4; --cs: #d8f2f3; --ci: #094f53; }
.m-orange { --c: #ec6a2c; --cs: #ffe6d8; --ci: #84320d; }
.m-red { --c: #d93b41; --cs: #fce2e3; --ci: #85191e; }
.m-slate { --c: #5e6b80; --cs: #e7ebf1; --ci: #2c3546; }
.m-family { --c: #1d2b45; --cs: #e4e8f0; --ci: #1d2b45; }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
#app { height: 100%; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.sr, .chip input, .swatch input, .radio-seg input {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; opacity: 0;
}
.wide-only { display: none; }

.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100dvh; }
.rail { display: none; }
.main { min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.tabbar {
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 7px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.tabbar a .i { width: 23px; height: 23px; }
.tabbar a.on { color: var(--ink); }
.tabbar a.on .i { stroke-width: 2.4; }

.view { display: flex; flex-direction: column; min-height: 100%; }
.view-body { flex: 1; padding: 4px 16px 32px; }

.page-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.page-title { flex: 1; min-width: 0; }
.page-title h1 { font-size: 22px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-title p { color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 8px; }
.day-nav { display: flex; gap: 6px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font: 600 15px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { color: var(--danger); }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.small .i { width: 18px; height: 18px; }
.btn.block { width: 100%; height: 50px; font-size: 16px; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
}
.icon-btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.icon-btn.ghost:hover { background: var(--line-2); }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 10px; }
.icon-btn.sm .i { width: 18px; height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.seg { display: inline-flex; background: var(--line-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 0 14px; height: 38px; border-radius: 9px;
  font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(29, 43, 69, .12), 0 0 0 1px rgba(29, 43, 69, .04); }

/* avatars */
.av {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--cs); color: var(--ci); box-shadow: inset 0 0 0 2px var(--c);
  font-weight: 700; font-size: 13px; line-height: 1; letter-spacing: 0;
}
.av .i { width: 55%; height: 55%; }
.av.xxs { width: 18px; height: 18px; font-size: 9px; box-shadow: inset 0 0 0 1.5px var(--c); }
.av.xs { width: 24px; height: 24px; font-size: 11px; }
.av.sm { width: 30px; height: 30px; font-size: 13px; }
.av.lg { width: 48px; height: 48px; font-size: 21px; box-shadow: inset 0 0 0 3px var(--c); }
.avs { display: inline-flex; flex: none; }
.avs .av + .av { margin-left: -5px; }
.avs .av { outline: 2px solid var(--card); }

/* forms */
input, select, textarea {
  font: 16px/1.3 var(--font); color: var(--ink);
  width: 100%; min-width: 0; height: 46px; padding: 0 12px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2346536b' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 18px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(59, 111, 224, .18); }
input[type=checkbox], input[type=radio] { width: auto; height: auto; }
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; }
input[type=search]::-webkit-search-decoration { display: none; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.row2, .row3 { display: grid; gap: 12px; }
.dt { display: flex; gap: 8px; }
.dt input[type=date] { flex: 1.5; }
.dt input[type=time] { flex: 1; min-width: 7.2em; }
.title-input {
  height: 54px; border: 0; border-bottom: 2px solid var(--line); border-radius: 0; padding: 0 2px;
  font: 600 22px/1.2 var(--font-display);
}
.title-input:focus { box-shadow: none; border-color: var(--ink); }
.title-row { display: flex; gap: 10px; align-items: flex-end; }
.emoji-input { width: 54px; flex: none; height: 54px; text-align: center; font-size: 24px; padding: 0; }
.num { width: 90px; flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip-note { width: 100%; font-size: 12.5px; color: var(--muted); }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 5px 14px 5px 6px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; font-size: 14px;
  user-select: none;
}
button.chip, .chip.day, .chips:not(.days) > .chip:not([class*="m-"]) { padding: 5px 14px; }
.chip:has(input:checked) { background: var(--cs, var(--ink)); border-color: var(--c, var(--ink)); color: var(--ci, #fff); }
.chip:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.chips.days { gap: 6px; }
.chip.day { min-width: 46px; justify-content: center; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.switch input {
  -webkit-appearance: none; appearance: none; position: relative; flex: none;
  width: 46px; height: 28px; border-radius: 14px; border: 0; padding: 0; background: var(--line); cursor: pointer;
  transition: background-color .2s;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s;
}
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(18px); }
.switch.big span { display: flex; flex-direction: column; gap: 2px; }
.switch.big small { font-weight: 400; color: var(--muted); font-size: 13px; }

.radio-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-seg label { position: relative; cursor: pointer; }
.radio-seg span {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px;
  border-radius: 12px; border: 1.5px solid var(--line); font-weight: 600; background: var(--card);
}
.radio-seg input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.radio-seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; cursor: pointer; }
.swatch span { display: block; width: 38px; height: 38px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .0); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--c); }
.swatch input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 4px; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input:not(.emoji-input):not(.num), .inline-form select { flex: 1 1 160px; }
.inline-form .emoji-input { height: 46px; width: 50px; font-size: 20px; }
.inline-form .btn { flex: none; }

details.help { background: var(--line-2); border-radius: 12px; padding: 0 14px; }
details.help summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--ink-2); }
details.help p { padding-bottom: 12px; font-size: 14px; color: var(--ink-2); }

.loading { display: flex; justify-content: center; gap: 6px; padding: 48px 0; }
.loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: dot 1s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .15s; }
.loading span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.empty { max-width: 460px; margin: 48px auto; padding: 0 16px; text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.empty p { font-size: 16px; color: var(--ink-2); line-height: 1.55; }

.splash { height: 100dvh; display: grid; place-items: center; color: var(--muted); }
.splash .i { width: 40px; height: 40px; }

/* ---------- modal & dialogs ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(16, 24, 40, .45); animation: fade .18s ease-out;
}
.backdrop.top { z-index: 60; align-items: center; padding: 16px; }
.modal {
  display: flex; flex-direction: column; width: 100%; max-height: 94dvh;
  background: var(--card); border-radius: 22px 22px 0 0; box-shadow: 0 20px 60px rgba(16, 24, 40, .25);
  animation: rise .22s cubic-bezier(.2, .8, .3, 1);
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 16px 6px 20px; }
.modal-head > div { flex: 1; min-width: 0; }
.modal-head h2 { font-size: 20px; font-weight: 700; padding-top: 8px; }
.modal-body { overflow: auto; padding: 8px 20px 20px; display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain; }
.modal-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line-2);
}
.modal-foot select { flex: 1 1 140px; width: auto; }
.dialog {
  width: min(420px, 100%); background: var(--card); border-radius: 20px; padding: 22px;
  display: flex; flex-direction: column; gap: 10px; box-shadow: 0 20px 60px rgba(16, 24, 40, .3); animation: pop .18s ease-out;
}
.dialog h2 { font-size: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.dialog-actions.stack { flex-direction: column; align-items: stretch; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

.sec { font-size: 15px; font-weight: 700; margin-top: 6px; }
fieldset.scope { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
fieldset.scope legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
fieldset.scope label { display: flex; gap: 10px; align-items: center; }
.ev-form:has([name=allDay]:checked) .dt input[type=time] { display: none; }
.ev-form:not(:has(select[name=freq] option[value=weekly]:checked)):not(:has(select[name=freq] option[value=biweekly]:checked)) .weekly-only { display: none; }
.ev-form:has(select[name=freq] option[value=none]:checked) .repeat-only { display: none; }
.task-form:has(input[name=kind][value=todo]:checked) .routine-only { display: none; }
.task-form:has(input[name=kind][value=routine]:checked) .todo-only { display: none; }
.routine-only { display: flex; flex-direction: column; gap: 16px; }
.member-form:not(:has(input[name=login]:checked)) .login-fields:not(.always) { display: none; }
.points-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.points-row input { width: 84px; }

.detail { display: flex; flex-direction: column; gap: 10px; }
.detail p { display: flex; gap: 8px; align-items: center; }
.detail .notes { white-space: pre-wrap; display: block; background: var(--line-2); padding: 12px; border-radius: 12px; }
.detail-when { font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%); z-index: 70;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 10px 30px rgba(16, 24, 40, .25);
  animation: rise .2s ease-out;
}
.toast.error { background: var(--danger); }
.offline {
  position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 65;
  display: flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 999px;
  background: #fff3d6; color: #6d4300; font-size: 13px; font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}
.offline .i { width: 16px; height: 16px; }

/* ---------- calendar ---------- */
.view.cal { height: 100%; }
.cal-head {
  display: grid; gap: 10px 16px; align-items: center;
  grid-template-columns: 1fr; grid-template-areas: "nav" "tools" "filter";
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px;
}
.cal-nav { grid-area: nav; display: flex; align-items: center; gap: 6px; min-width: 0; }
.cal-title { font-size: 19px; font-weight: 700; margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-title small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.cal-tools { grid-area: tools; display: flex; gap: 8px; justify-content: space-between; }
.cal-tools .seg { flex: 1; }
.cal-tools .seg button { flex: 1; padding: 0 6px; }
.cal-filter { grid-area: filter; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.cal-filter::-webkit-scrollbar { display: none; }
.pf {
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 34px; padding: 0 12px 0 5px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.pf.off { opacity: .45; background: transparent; }
.pf.off span { text-decoration: line-through; }
.cal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view-agenda .cal-body, .view-month .cal-body { overflow: auto; }

.tg { --gut: 50px; flex: 1; min-height: 0; overflow: auto; background: var(--card); border-top: 1px solid var(--line); overscroll-behavior: contain; }
.tg-row { display: grid; grid-template-columns: var(--gut) repeat(var(--cols), minmax(0, 1fr)); }
.tg-top { position: sticky; top: 0; z-index: 4; background: var(--card); box-shadow: 0 1px 0 var(--line); }
.tg-heads:has(.tg-colhead:empty) { display: none; }
.tg-colhead {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0;
  padding: 10px 6px 12px; font-weight: 700; font-size: 14px; border-left: 1px solid var(--line-2);
}
.tg-colhead > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-colhead[class*="m-"]::after {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: 0; height: 5px; border-radius: 5px 5px 0 0; background: var(--c);
}
.tg-colhead .wd { font-weight: 600; color: var(--muted); font-size: 13px; }
.tg-colhead .dn { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: 15px; font-size: 16px; }
.tg-colhead.is-today .dn { background: var(--ink); color: #fff; }
.tg-allday { border-top: 1px solid var(--line-2); }
.tg-allday .tg-gutter { display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; font-size: 10.5px; color: var(--muted); }
.tg-adcell { display: flex; flex-direction: column; gap: 3px; padding: 4px; border-left: 1px solid var(--line-2); min-width: 0; }
.chip-ev {
  border: 0; text-align: left; background: var(--c); color: #fff; border-radius: 7px; padding: 3px 8px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.chip-ev.ext { background: var(--cs); color: var(--ci); box-shadow: inset 0 0 0 1.5px var(--c); }
.tg-body { position: relative; }
.tg-hour { height: var(--hour); position: relative; }
.tg-hour span {
  position: absolute; top: -8px; right: 7px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tg-hour:first-child span { top: 3px; }
.tg-col {
  position: relative; height: calc(var(--hour) * var(--rows)); border-left: 1px solid var(--line-2); cursor: copy;
  background-image: repeating-linear-gradient(to bottom, var(--line-2) 0 1px, transparent 1px var(--hour));
}
.view-week .tg-col.is-today { background-color: #f7f9fc; }
.ev {
  position: absolute; display: flex; flex-direction: column; gap: 1px; overflow: hidden; cursor: pointer;
  border: 0; text-align: left; padding: 4px 6px 4px 8px; border-radius: 8px;
  background: var(--cs); color: var(--ci); box-shadow: inset 4px 0 0 var(--c), 0 0 0 1px var(--card);
  font-size: 13px; line-height: 1.25;
}
.ev > * { flex: none; }
.ev b { font-weight: 650; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.ev .ev-time { font-size: 12px; opacity: .82; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev .ev-loc { font-size: 12px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .avs { margin-top: 2px; }
.ev.short { flex-direction: row; align-items: baseline; gap: 6px; padding-top: 2px; padding-bottom: 0; }
.ev.short b { -webkit-line-clamp: 1; white-space: nowrap; text-overflow: ellipsis; display: block; }
.ev.ext { background: repeating-linear-gradient(135deg, var(--cs) 0 7px, color-mix(in srgb, var(--cs) 55%, #fff) 7px 14px); }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--now); z-index: 2; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }
.tg-col:not(:nth-child(2)) .now::before { display: none; }

.month { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--card); border-top: 1px solid var(--line); }
.mo-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.mo-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(78px, 1fr); }
.mo-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 3px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); cursor: pointer; }
.mo-cell:nth-child(7n) { border-right: 0; }
.mo-cell.out { background: #f8f9fb; }
.mo-cell.out .mo-num { color: var(--muted); }
.mo-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 13px; font-size: 13px; font-weight: 700; }
.mo-cell.is-today .mo-num { background: var(--ink); color: #fff; }
.mo-ev {
  display: flex; gap: 4px; min-width: 0; border: 0; padding: 1px 5px; border-radius: 5px; cursor: pointer;
  background: var(--cs); color: var(--ci); font-size: 11.5px; font-weight: 600; text-align: left; line-height: 1.35;
}
.mo-ev span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-ev i { font-style: normal; font-weight: 500; opacity: .75; font-variant-numeric: tabular-nums; }
.mo-more { font-size: 11px; color: var(--muted); padding-left: 4px; }

.agenda { width: 100%; max-width: 780px; margin: 0 auto; padding: 4px 16px 40px; }
.ag-day h3 { font-size: 16px; font-weight: 700; margin: 20px 0 8px; }
.ag-day h3 small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.ag-item {
  display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  width: 100%; margin-bottom: 6px; padding: 12px 14px; border: 0; border-radius: var(--r);
  background: var(--card); text-align: left; cursor: pointer; box-shadow: inset 5px 0 0 var(--c);
}
.ag-time { display: flex; flex-direction: column; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.ag-time small { font-weight: 500; color: var(--muted); }
.ag-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ag-main b { font-weight: 650; font-size: 15.5px; }
.ag-main small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.ag-main small .i { width: 14px; height: 14px; }
.ag-none { padding: 4px 2px 8px; }

/* ---------- tasks ---------- */
.pcards { display: grid; gap: 14px; grid-template-columns: 1fr; }
.pcard { background: var(--card); border-radius: var(--r-l); padding: 16px 14px 12px; box-shadow: inset 0 6px 0 var(--c); display: flex; flex-direction: column; gap: 6px; }
.pc-head { display: flex; align-items: center; gap: 12px; padding: 4px 2px; }
.pc-name { flex: 1; min-width: 0; }
.pc-name h2 { font-size: 19px; }
.pts { display: inline-flex; align-items: center; gap: 4px; color: var(--ci); font-weight: 700; font-size: 14px; }
.pts .i { width: 16px; height: 16px; fill: var(--c); stroke: var(--c); }
.pc-count { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); background: var(--line-2); padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.pc-count.complete { background: var(--c); color: #fff; }
.prog { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; margin: 2px 2px 4px; }
.prog span { display: block; height: 100%; background: var(--c); border-radius: 3px; transition: width .35s ease; }
.pc-done { font-weight: 700; color: var(--ci); padding: 2px; }
.pc-empty { padding: 8px 2px; }
.tgroup h3 { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 10px 2px 2px; letter-spacing: 0; }
.trow { display: flex; align-items: center; gap: 2px; }
.tcheck {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 6px;
  border: 0; background: transparent; text-align: left; cursor: pointer; border-radius: 12px;
}
.tcheck:hover { background: var(--line-2); }
.box {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%;
  box-shadow: inset 0 0 0 2.5px var(--c); color: transparent; transition: background-color .15s;
}
.box .i { width: 18px; height: 18px; stroke-width: 3; }
.done .box, .checked .box { background: var(--c); color: #fff; animation: pop .25s ease-out; }
.ttl { flex: 1; min-width: 0; font-size: 16px; font-weight: 550; display: flex; align-items: center; gap: 8px; }
.emo { font-size: 20px; line-height: 1; }
.done .ttl { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.tp { font-weight: 700; font-size: 13px; color: var(--ci); background: var(--cs); padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.due { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.due.late { color: var(--danger); font-weight: 700; }

.balances { display: flex; flex-wrap: wrap; gap: 8px; }
.bal { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--cs); color: var(--ci); font-weight: 600; }
.bal b { font-variant-numeric: tabular-nums; }
.rewards, .history, .feeds, .mlist, .install { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rewards li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-weight: 600; }
.rewards .emo { width: 32px; text-align: center; }
.cost { display: inline-flex; gap: 4px; align-items: center; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cost .i { width: 16px; height: 16px; }
.history li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.history b { margin-right: 6px; }
.history .pos { color: #1f9d68; font-weight: 700; }
.history .neg { color: var(--danger); font-weight: 700; }

/* ---------- meals & recipes ---------- */
.subtabs { padding: 0 16px 8px; }
.mplan { display: none; }
.mplan-list { display: flex; flex-direction: column; gap: 14px; }
.ml-day h3 { font-size: 15px; margin-bottom: 6px; display: flex; gap: 6px; }
.ml-day h3 span { color: var(--ink-2); font-weight: 600; }
.ml-day.is-today h3 { color: var(--ink); }
.ml-row { display: grid; grid-template-columns: 104px 1fr; gap: 8px; align-items: center; margin-bottom: 6px; }
.ml-slot { font-size: 13px; font-weight: 600; color: var(--muted); }
.mcell {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 6px;
  min-height: 52px; padding: 10px 12px; border-radius: 14px;
  border: 1.5px dashed var(--line); background: transparent; text-align: left; cursor: pointer; overflow: hidden;
}
.mcell.filled { border: 0; background: var(--card); }
.mcell.has-photo { background: linear-gradient(to top, rgba(10, 16, 30, .75), rgba(10, 16, 30, .05) 70%), var(--img) center / cover; color: #fff; }
.mtitle { font-weight: 650; font-size: 15px; line-height: 1.25; }
.madd { color: var(--muted); display: grid; place-items: center; width: 100%; flex: 1; }
.mrec { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.mrec .i { width: 14px; height: 14px; }
.mcell.has-photo .mrec { color: rgba(255, 255, 255, .85); }
.rsearch { position: relative; margin-bottom: 14px; }
.rsearch > span { position: absolute; left: 12px; top: 13px; color: var(--muted); }
.rsearch input { padding-left: 42px; }
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.rcard { display: flex; flex-direction: column; gap: 4px; border: 0; padding: 0; background: transparent; text-align: left; cursor: pointer; }
.rimg { display: grid; place-items: center; aspect-ratio: 4 / 3; width: 100%; border-radius: 14px; background: var(--line-2) center / cover; font-size: 40px; }
.rimg.sm { width: 48px; height: 48px; aspect-ratio: auto; font-size: 22px; border-radius: 10px; flex: none; }
.rcard b { font-size: 15px; font-weight: 650; margin-top: 4px; }
.rcard small { display: flex; gap: 10px; color: var(--muted); font-size: 12.5px; }
.rcard small span { display: inline-flex; align-items: center; gap: 3px; }
.rcard small .i { width: 13px; height: 13px; }
.rhero { width: 100%; max-height: 300px; object-fit: cover; border-radius: 16px; }
.rmeta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--ink-2); font-size: 14px; }
.rmeta > * { display: inline-flex; align-items: center; gap: 6px; }
.rmeta .i { width: 16px; height: 16px; }
.ing-check { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ing-check label { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.ing-check input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; }
.ing-check small { margin-left: auto; color: var(--muted); font-size: 12px; }
.ing-form { display: flex; flex-direction: column; gap: 12px; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; line-height: 1.55; }
.current-meal { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--line-2); flex-wrap: wrap; }
.current-meal > div { flex: 1; display: flex; flex-direction: column; min-width: 140px; }
.pick-list { display: flex; flex-direction: column; }
.pick { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border: 0; border-bottom: 1px solid var(--line-2); background: transparent; text-align: left; cursor: pointer; font-weight: 600; }
.import-box { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--line-2); }
.photo-edit { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.photo-edit img, .photo-edit .rimg { width: 96px; height: 72px; object-fit: cover; border-radius: 12px; font-size: 28px; aspect-ratio: auto; }

/* ---------- lists ---------- */
.lnav { display: flex; flex-direction: column; gap: 6px; }
.lbtn {
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 14px; border: 0; border-radius: var(--r);
  background: var(--card); text-align: left; font-weight: 650; font-size: 16px; cursor: pointer;
}
.lbtn .emo { font-size: 22px; }
.lbtn .count { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--ink); color: #fff; font-size: 13px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.lbtn .chev { color: var(--muted); display: flex; }
.lbtn.on { box-shadow: inset 0 0 0 2px var(--ink); }
.lpane { background: var(--card); border-radius: var(--r-l); padding: 6px 14px 16px; min-height: 60vh; }
.lists.single { background: var(--card); }
.lists.single .lpane { border-radius: 0; min-height: 100%; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.lpane-head { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.lpane-head h2 { flex: 1; font-size: 21px; display: flex; gap: 8px; align-items: center; }
.add-item { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; padding: 8px 0 12px; background: var(--card); }
.add-item input { height: 50px; font-size: 17px; }
.add-item .btn { height: 50px; }
.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; border-bottom: 1px solid var(--line-2); --c: var(--ink); }
.item-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 6px 2px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.item .txt { font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.item.checked .txt { color: var(--muted); text-decoration: line-through; }
.item.checked { --c: #b7bfcc; }
.items-empty { padding: 20px 2px; }
.done-head { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; }
.done-head h3 { font-size: 15px; }

/* ---------- photos & slideshow ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.ph { aspect-ratio: 1; border: 0; border-radius: 10px; background: var(--line-2) center / cover; cursor: pointer; }
.photo-full { width: 100%; max-height: 70dvh; object-fit: contain; border-radius: 12px; background: #000; }
.saver { position: fixed; inset: 0; z-index: 100; background: #0b111d; color: #fff; overflow: hidden; cursor: none; }
.saver.no-photos { background: radial-gradient(circle at 30% 20%, #253555, #0b111d 70%); }
.slide { position: absolute; inset: 0; }
.slide.cur { animation: fade 1.6s ease; }
.slide-bg { position: absolute; inset: -60px; background: center / cover; filter: blur(40px) brightness(.45); }
.slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.slide.cur img { animation: drift 30s linear both; }
@keyframes drift { from { transform: scale(1); } to { transform: scale(1.05); } }
.saver-info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 120px 48px 40px;
  background: linear-gradient(to top, rgba(5, 9, 18, .78), transparent);
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 40px; align-items: end;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .4);
}
.saver-clock { font: 700 clamp(64px, 11vw, 150px)/0.9 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; grid-row: 1; }
.saver-date { font-size: clamp(18px, 2.4vw, 30px); font-weight: 600; grid-row: 2; padding-top: 10px; opacity: .92; }
.saver-next { grid-column: 2; grid-row: 1 / span 2; justify-self: end; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.saver-next li { display: flex; align-items: center; gap: 12px; font-size: clamp(16px, 1.8vw, 22px); }
.saver-next i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.saver-next .when { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 64px; }
.saver-next .avs .av { outline-color: transparent; }
.saver.no-photos .saver-info { top: 0; align-content: center; background: none; }
.night { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .5); pointer-events: none; }

/* ---------- settings ---------- */
.set-body { max-width: 860px; width: 100%; display: flex; flex-direction: column; gap: 14px; }
.set-sec { background: var(--card); border-radius: var(--r-l); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.set-sec > header { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.set-sec > header > div { flex: 1 1 260px; }
.set-sec h2 { font-size: 18px; }
.set-sec header p { font-size: 14px; margin-top: 4px; }
.me-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.me-row .grow { display: flex; flex-direction: column; }
.feeds li, .mlist li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.feeds li:last-child, .mlist li:last-child { border-bottom: 0; }
.mlist .grow { display: flex; flex-direction: column; }
.mlist small, .feeds small { font-size: 13px; }
.err { color: var(--danger); }
.prefs { display: flex; flex-direction: column; gap: 14px; }
.install li { display: flex; gap: 12px; padding: 8px 0; align-items: flex-start; }
.install .i { margin-top: 2px; color: var(--ink-2); }
.version { text-align: center; padding: 8px 0 24px; }
.more-link {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; margin-bottom: 8px;
  border: 0; border-radius: var(--r); background: var(--card); text-decoration: none; text-align: left; cursor: pointer;
}
.more-link .grow { display: flex; flex-direction: column; }
.more-link small { color: var(--muted); font-size: 13px; }

/* ---------- login & setup ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: min(420px, 100%); background: var(--card); border-radius: 24px; padding: 30px 24px;
  display: flex; flex-direction: column; gap: 16px; box-shadow: 0 10px 40px rgba(29, 43, 69, .08);
}
.auth-card.wide { width: min(560px, 100%); }
.auth-mark { width: 56px; height: 56px; }
.auth-card h1 { font-size: 26px; }

/* ---------- small screens ---------- */
@media (max-width: 599px) {
  .page-actions .btn > span, .cal-tools .btn > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .page-actions .btn, .cal-tools .btn.primary { width: 44px; padding: 0; }
  .ag-item { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .mo-ev i { display: none; }
  .mo-ev { font-size: 10.5px; padding: 0 3px; }
  .mo-grid { grid-auto-rows: minmax(64px, 1fr); }
  .view-week .tg { --gut: 36px; }
  .view-week .ev { padding: 3px 3px 3px 6px; font-size: 11px; }
  .view-week .ev .ev-time { display: none; }
  .view-week .tg-colhead { flex-direction: column; gap: 0; padding: 6px 0 8px; }
  .modal-foot .btn.danger > span, .feeds .btn.ghost > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .modal-foot .btn.danger, .feeds .btn.ghost { width: 44px; padding: 0; }
}

@media (min-width: 600px) {
  .row2 { grid-template-columns: 1fr 1fr; }
  .row3 { grid-template-columns: 1fr 1fr 1.6fr; }
  .backdrop { align-items: center; padding: 24px; }
  .modal { width: min(580px, 100%); max-height: min(90dvh, 920px); border-radius: 22px; }
  .modal.wide { width: min(780px, 100%); }
  .modal-foot { padding-bottom: 12px; border-radius: 0 0 22px 22px; }
  .pcards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* ---------- wall display / large screens ---------- */
@media (min-width: 900px) {
  :root { --hour: 58px; }
  body { font-size: 16px; }
  .wide-only { display: block; }
  .shell { grid-template-columns: 100px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .tabbar { display: none; }
  .rail {
    display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
    padding: 14px 10px 16px; background: var(--ink); color: #c9d2e3;
  }
  .rail-links { display: flex; flex-direction: column; gap: 6px; }
  .rail a, .rail-saver {
    display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 0 9px; border-radius: 16px;
    color: inherit; text-decoration: none; font-size: 11.5px; font-weight: 600; border: 0; background: transparent; cursor: pointer;
  }
  .rail a .i, .rail-saver .i { width: 26px; height: 26px; }
  .rail a:hover, .rail-saver:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .rail a.on { background: #fff; color: var(--ink); }
  .rail-foot { display: flex; flex-direction: column; gap: 10px; }
  .rail-clock { text-align: center; color: #fff; font: 700 20px/1 var(--font-display); font-variant-numeric: tabular-nums; }
  .page-head { padding: 22px 28px 14px; }
  .page-title h1 { font-size: 28px; }
  .page-title p { font-size: 14px; }
  .view-body { padding: 4px 28px 40px; }
  .subtabs { padding: 0 28px 12px; }
  .toast { bottom: 28px; }

  .cal-head {
    grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "clock nav tools" "filter filter filter";
    padding: 18px 24px 12px; gap: 12px 28px;
  }
  .cal-clock { grid-area: clock; padding-right: 26px; border-right: 2px solid var(--line); }
  .cal-clock b { display: block; font: 700 46px/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .cal-clock span { display: block; margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
  .cal-title { font-size: 24px; margin-left: 10px; }
  .cal-tools .seg { flex: none; }
  .cal-tools .seg button { padding: 0 16px; }
  .cal-filter { margin: 0; padding: 0; flex-wrap: wrap; }
  .pf { height: 38px; font-size: 14.5px; padding-right: 14px; }
  .pf .av.xs { width: 28px; height: 28px; font-size: 12px; }
  .tg { --gut: 58px; margin: 0 24px 20px; border: 1px solid var(--line); border-radius: var(--r-l); }
  /* the wall display shows the whole day without scrolling (but never squeezes hours below 40px) */
  .view-day .tg, .view-week .tg { --hour: max(40px, calc((100dvh - var(--grid-top, 260px) - 24px) / var(--rows))); }
  .mo-grid { grid-auto-rows: minmax(0, 1fr); }
  .mo-cell { overflow: hidden; }
  .month { margin: 0 24px 20px; border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
  .tg-colhead { font-size: 15.5px; padding: 12px 8px 14px; }
  .ev { font-size: 14px; }
  .ev .ev-time { font-size: 12.5px; }
  .mo-ev { font-size: 12.5px; }

  .pcards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; align-items: start; }
  .mplan { display: grid; grid-template-columns: 112px repeat(7, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
  .mplan-list { display: none; }
  .mp-day { display: flex; align-items: baseline; gap: 6px; padding: 4px 4px 0; font-weight: 700; }
  .mp-day .wd { color: var(--muted); }
  .mp-day.is-today .dn { background: var(--ink); color: #fff; padding: 2px 8px; border-radius: 999px; }
  .mp-slot { display: flex; align-items: center; font-weight: 700; color: var(--ink-2); font-size: 14px; }
  .mplan .mcell { min-height: clamp(96px, calc((100dvh - 330px) / var(--slots)), 200px); }
  .mplan .mtitle { font-size: 16px; }
  .lwrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
  .lpane { padding: 8px 22px 20px; }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
  .agenda { padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
