/* Home To Do — világos, meleg: krémszínű papír, mélyzöld kiemelés, terrakotta a sürgősnek. */
:root {
  --bg: #F5EFE4;
  --paper: #FFFBF3;
  --ink: #2A251F;
  --ink2: #5E554A;
  --muted: #8C8174;
  --line: #E3D8C6;
  --line2: #EDE5D7;
  --green: #2F6B4F;
  --green-d: #24543E;
  --green-l: #E3EEE6;
  --terra: #B5482A;
  --terra-l: #F7E1D7;
  --amber: #B7791A;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.noscroll { overflow: hidden; }
#app { max-width: 620px; margin: 0 auto; padding: calc(var(--safe-t) + 10px) 18px calc(110px + var(--safe-b)); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
i { font-style: normal; }
[hidden] { display: none !important; }
.small { font-size: 14px; }
.muted { color: var(--muted); }
.err { color: var(--terra); font-weight: 600; }

/* ---- márkanév ---- */
.brand { font: 700 21px/1 var(--serif); letter-spacing: -.01em; font-variation-settings: 'opsz' 40; }
.brand em { font-style: normal; color: var(--green); }
.brand.big { font-size: 40px; font-variation-settings: 'opsz' 120; margin-bottom: 26px; }

/* ---- gombok ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: 12px; font-weight: 600;
  background: var(--paper); border: 1.5px solid var(--line); color: var(--ink);
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:active { background: var(--green-d); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--terra); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; }

input:not([type=date]), textarea {
  width: 100%; border: 1.5px solid var(--line); background: var(--paper); border-radius: 12px;
  padding: 12px 14px; outline: none; font-size: 16px;
}
input:focus, textarea:focus { border-color: var(--green); }
textarea { resize: none; }

/* ---- belépő képernyők ---- */
.gate { padding-top: 12vh; max-width: 420px; }
.gate p { color: var(--ink2); margin: 0 0 14px; }
.gate .gate-lead { font-size: 19px; color: var(--ink); line-height: 1.4; margin-bottom: 22px; }
.gate-h { font: 700 28px/1.1 var(--serif); margin: 0 0 12px; }
.join-form, .name-form { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 16px; }
.who-list { display: flex; flex-direction: column; gap: 8px; margin: 0 0 22px; }
.who { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); font-weight: 600; text-align: left; }
.who:active { border-color: var(--green); }

/* ---- avatar ---- */
.av {
  --c: var(--green);
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--c); color: #fff; font-weight: 700; font-size: 15px; line-height: 1;
}
.av.sm { width: 26px; height: 26px; font-size: 12px; }
.av.xs { width: 20px; height: 20px; font-size: 11px; margin-left: -4px; }
.av-any { background: transparent; color: var(--muted); border: 1.5px dashed #C8BBA8; }

/* ---- fejléc ---- */
.top { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.me-btn { position: relative; display: flex; text-decoration: none; }
.me-btn .av { width: 38px; height: 38px; font-size: 16px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.top .dot { position: absolute; right: -1px; top: -1px; border: 2px solid var(--bg); width: 13px; height: 13px; z-index: 1; }
.dot.ok { background: #4E9A6E; }
.dot.busy { background: #D6B25E; }
.dot.off { background: #B8AC9C; }
.dot.bad { background: var(--terra); }
.top.sub { justify-content: flex-start; gap: 6px; }
.top.sub h1 { font: 700 24px/1 var(--serif); margin: 0; }
.back { display: grid; place-items: center; width: 40px; height: 40px; margin-left: -10px; }

.hello { margin: 18px 0 18px; }
.hello h1 { font: 700 32px/1.1 var(--serif); font-variation-settings: 'opsz' 100; margin: 0 0 6px; letter-spacing: -.01em; }
.hello p { margin: 0; color: var(--ink2); }
.hello b { color: var(--ink); }
.hello b.over { color: var(--terra); }
.hello i, .meta i { margin: 0 7px; color: #C3B6A3; }

.banner, .tip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 6px 0 4px; padding: 11px 14px; border-radius: 12px; font-size: 14px;
}
.banner { background: var(--terra-l); color: #6E2A17; }
.banner button { font-weight: 700; text-decoration: underline; }
.tip { background: var(--green-l); color: #234A37; flex-wrap: nowrap; }
.tip button { margin-left: auto; font-size: 22px; line-height: 1; padding: 0 4px; color: #234A37; }

/* ---- szűrők ---- */
.filters { margin: 0 -18px 6px; }
.chips { display: flex; gap: 8px; }
.chips.scroll { overflow-x: auto; padding: 2px 18px 8px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; }
.chip {
  --h: 30;
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper);
  font-weight: 600; font-size: 15px; color: var(--ink2); white-space: nowrap;
}
.chip.sm { height: 32px; font-size: 14px; padding: 0 12px; font-weight: 500; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip .sw, .cat-edit .sw { width: 9px; height: 9px; border-radius: 50%; background: hsl(var(--h) 45% 48%); flex: none; }
.chip.on .sw { box-shadow: 0 0 0 2px var(--paper); }
.chip.date { position: relative; overflow: hidden; }
.chip.date input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* ---- listák ---- */
.group { margin-top: 18px; }
.group h2 {
  display: flex; align-items: baseline; gap: 8px; margin: 0 0 2px;
  font: 600 13px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.group h2 span { font-weight: 500; letter-spacing: 0; }
.g-over h2 { color: var(--terra); }
.g-today h2 { color: var(--ink); }
.group ul { list-style: none; margin: 0; padding: 0; }
.task { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line2); min-height: 62px; }
.task:last-child { border-bottom: 0; }
.check {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #BFB19D; color: transparent; transition: background .2s, border-color .2s, color .2s;
}
.check svg { width: 16px; height: 16px; stroke-width: 3; }
.g-over .check { border-color: #D99A85; }
.task.ticking .check, .task.done .check { background: var(--green); border-color: var(--green); color: #fff; }
.task.ticking .title { text-decoration: line-through; color: var(--muted); }
.task.ticking { animation: fade .38s ease-in forwards; }
@keyframes fade { 60% { opacity: 1 } to { opacity: .25 } }
.body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 12px 0; text-align: left; }
.title { font-size: 17px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; align-items: center; font-size: 13.5px; color: var(--muted); }
.meta .cat { color: hsl(var(--h) 40% 36%); font-weight: 600; }
.meta .due.over { color: var(--terra); font-weight: 700; }
.meta .due.now { color: var(--amber); font-weight: 700; }
.meta .has-note { font-style: italic; }
.task.done .title { color: var(--muted); text-decoration: line-through; text-decoration-color: #C9BCAA; }
.task.done .check { width: 24px; height: 24px; margin: 0 2px; }

.done-toggle { width: 100%; padding: 14px 0; text-align: left; font-weight: 600; color: var(--green); border-top: 1px solid var(--line); }

.empty { padding: 38px 4px; color: var(--ink2); font: 500 20px/1.4 var(--serif); max-width: 26ch; }

.fab {
  position: fixed; right: max(18px, calc(50% - 292px)); bottom: calc(22px + var(--safe-b)); z-index: 20;
  display: inline-flex; align-items: center; gap: 8px; height: 56px; padding: 0 22px 0 18px;
  border-radius: 18px; background: var(--green); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 8px 22px -6px rgba(36, 84, 62, .55), 0 2px 4px rgba(36, 84, 62, .2);
}
.fab:active { transform: scale(.97); background: var(--green-d); }
.fab svg { stroke-width: 2.6; }

/* ---- alsó lap ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(42, 37, 31, .38); opacity: 0; transition: opacity .25s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 620px; max-height: 92vh; overflow-y: auto;
  background: var(--paper); border-radius: 22px 22px 0 0; padding: 8px 18px calc(18px + var(--safe-b));
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column; gap: 14px;
}
.sheet-wrap.in .sheet-bg { opacity: 1; }
.sheet-wrap.in .sheet { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 2px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { font: 700 22px/1 var(--serif); margin: 0; }
.x { font-size: 28px; line-height: 1; width: 40px; height: 40px; margin-right: -10px; color: var(--muted); }
.sheet textarea[name=title] { font-size: 19px; font-weight: 500; border-color: var(--line); background: #fff; }
.field .lbl { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.field .chips { gap: 7px; }
.who-wrote { margin: 0; font-size: 13.5px; color: var(--muted); }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }
.sheet-actions .btn.primary { min-width: 140px; }
.sheet-actions .danger { margin-right: auto; padding-left: 4px; }

.toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 36px); width: max-content;
  padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--paper); font-size: 15px;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .4); animation: up .22s ease-out; transition: opacity .3s;
}
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { color: #9FD3B4; font-weight: 700; flex: none; }
.toast.out { opacity: 0; }
@keyframes up { from { transform: translate(-50%, 12px); opacity: 0 } }

/* ---- család ---- */
.family h2 { font: 700 19px/1.2 var(--serif); margin: 34px 0 10px; }
.members { list-style: none; margin: 8px 0 18px; padding: 0; }
.members li { border-bottom: 1px solid var(--line2); }
.members button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 0; text-align: left; }
.m-name { flex: 1; font-weight: 600; font-size: 17px; }
.m-name small { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 4px; }
.m-count { color: var(--muted); font-size: 14px; }
.invite-help { margin: 8px 0 0; }
.invite-box { display: flex; gap: 8px; margin-top: 10px; }
.invite-box input { font-size: 13px; }
.cat-edit { list-style: none; margin: 0 0 10px; padding: 0; }
.cat-edit li { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line2); }
.cat-edit input { border: 0; background: transparent; padding: 12px 0; border-radius: 0; }
.cat-edit input:focus { box-shadow: inset 0 -2px 0 var(--green); }
.icon-x { flex: none; min-width: 36px; height: 36px; font-size: 22px; color: var(--muted); }
.icon-x.sure { font-size: 14px; font-weight: 700; color: var(--terra); padding: 0 6px; }
.add-cat, .rename { display: flex; gap: 8px; }
.add-cat .btn, .rename .btn { flex: none; }
.sync-line { display: flex; align-items: center; gap: 9px; color: var(--ink2); margin: 0 0 12px; }
.family .btn + .btn { margin-top: 8px; }
.ver { margin-top: 30px; }

@media (min-width: 640px) {
  #app { padding-top: 26px; }
  .sheet { border-radius: 22px; bottom: 5vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
