/* Семейный план: телефон в первую очередь, крупные элементы (пользуются и дети 1–4 класса). */
:root {
  --bg: #f5f7fb; --card: #fff; --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --pri: #3b82f6; --ok: #22c55e; --bad: #ef4444; --r: 18px;
  --shadow: 0 2px 0 rgba(15, 23, 42, .06), 0 6px 18px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); overflow-x: hidden; }
body { font: 18px/1.35 "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
.screen { padding: 12px 16px calc(96px + env(safe-area-inset-bottom)); }
.screen.center { text-align: center; padding-top: 48px; }
h1 { margin: .2em 0 .4em; font-size: 28px; }
h2 { margin: 0 0 6px; font-size: 22px; }
h3 { margin: 18px 4px 8px; font-size: 17px; color: var(--muted); display: flex; align-items: baseline; gap: 8px; }
h3 small { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.empty { text-align: center; padding: 10px 0; }
.err { color: var(--bad); font-weight: 700; min-height: 1.3em; margin: 6px 0; font-size: 16px; }
.logo { font-size: 64px; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; padding: 10px 18px;
  border-radius: 14px; background: var(--card); box-shadow: var(--shadow); font-weight: 800; }
.btn:active { transform: translateY(2px); }
.btn.primary { background: var(--pri); color: #fff; }
.btn.danger { background: #fee2e2; color: #b91c1c; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 15px; }
.btn:disabled { opacity: .5; }
.link { color: var(--pri); font-weight: 700; font-size: 15px; padding: 4px 6px; }
.center-link { display: block; margin: -4px auto 4px; }
.round { width: 52px; height: 52px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); font-size: 28px; font-weight: 900; flex: none; }
.big-in { width: 100%; font-size: 20px; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff; margin-top: 4px; }
.big-in:focus { outline: none; border-color: var(--pri); }

/* верх и низ */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(245, 247, 251, .92); backdrop-filter: blur(8px); }
.top-me { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--c) 18%, #fff); box-shadow: 0 0 0 3px var(--c); }
.top b { font-size: 20px; }
.net { margin-left: auto; font-size: 13px; color: #b45309; background: #fef3c7; padding: 4px 8px; border-radius: 999px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr); max-width: 560px; margin: 0 auto;
  background: #fff; box-shadow: 0 -4px 18px rgba(15, 23, 42, .08); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; }
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; font-weight: 700; color: var(--muted); padding: 6px 0; border-radius: 12px; min-width: 0; }
.tabs button span { font-size: 26px; line-height: 1; }
.tabs button.on { color: var(--pri); background: #eff6ff; }

/* выбор человека */
.who-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.who-card { background: var(--card); border-radius: 22px; padding: 22px 8px; box-shadow: var(--shadow), inset 0 -6px 0 var(--c); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 20px; min-width: 0; }
.who-ava { font-size: 56px; line-height: 1; }
.who-strip, .filter { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.ava-btn { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 66px; padding: 6px 4px; border-radius: 16px; font-size: 30px; line-height: 1.1;
  background: var(--card); box-shadow: var(--shadow); opacity: .55; }
.ava-btn small { font-size: 12px; font-weight: 700; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ava-btn.on { opacity: 1; box-shadow: var(--shadow), inset 0 0 0 3px var(--c, var(--pri)); }
.ava { display: inline-grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--c) 20%, #fff); }
.ava.xs { width: 26px; height: 26px; font-size: 16px; }

/* день */
.day-nav { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.day-t { flex: 1; text-align: center; display: flex; flex-direction: column; min-width: 0; }
.day-t b { font-size: 22px; }
.day-t small { color: var(--muted); font-size: 15px; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fef3c7; border-radius: 14px; padding: 8px 8px 8px 14px; font-weight: 700; margin: 8px 0; }
.task { display: flex; align-items: center; gap: 4px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 8px; }
.task-main { flex: 1; display: flex; align-items: center; gap: 12px; padding: 12px 12px; text-align: left; min-height: 60px; min-width: 0; }
.task .box { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 3px solid #cbd5e1; display: grid; place-items: center; font-weight: 900; color: #fff; font-size: 22px; }
.task .tt { overflow-wrap: anywhere; }
.task.done .box { background: var(--ok); border-color: var(--ok); }
.task.done .tt { color: var(--muted); text-decoration: line-through; }
.task .x { width: 48px; height: 48px; font-size: 28px; color: #9ca3af; flex: none; }
.add-row { position: sticky; bottom: calc(80px + env(safe-area-inset-bottom)); display: flex; gap: 8px; margin-top: 12px; background: var(--bg); padding: 6px 0; }
.add-row input { flex: 1; min-width: 0; font-size: 19px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; }
.add-row input:focus { outline: none; border-color: var(--pri); }
.plus { width: 56px; font-size: 30px; padding: 0; }

/* занятие */
.chip { width: 100%; display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 10px 10px 0; margin-bottom: 8px; text-align: left; min-height: 56px; overflow: hidden; }
.stripe { align-self: stretch; display: flex; flex-direction: column; width: 8px; flex: none; margin: -10px 0; }
.stripe i { flex: 1; }
.chip .tm { font-size: 19px; flex: none; }
.chip .tt { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.chip .who { display: flex; gap: 2px; flex: none; }
.chip .bell { font-size: 14px; color: var(--muted); flex: none; }
.chip.skipped .tm, .chip.skipped .tt { text-decoration: line-through; color: var(--muted); }
.tag { font-size: 12px; font-weight: 800; background: #fee2e2; color: #b91c1c; padding: 2px 8px; border-radius: 999px; flex: none; }
.tag.now { background: #dbeafe; color: #1d4ed8; margin-left: 8px; }

/* неделя и месяц */
.seg { display: flex; background: #e5e7eb; border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { flex: 1; padding: 10px 6px; border-radius: 10px; font-weight: 800; font-size: 15px; min-width: 0; }
.seg button.on { background: #fff; box-shadow: var(--shadow); color: var(--pri); }
.seg.big button { font-size: 17px; }
.filter { margin-top: 10px; }
.wday { background: rgba(255, 255, 255, .55); border-radius: 18px; padding: 8px 8px 2px; margin-bottom: 10px; }
.wday.today { background: #eff6ff; box-shadow: inset 0 0 0 2px #bfdbfe; }
.wday-h { padding: 2px 6px 8px; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.wday .chip { margin-bottom: 6px; }
.wday p { margin: 0 6px 8px; }
.tsum { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 8px; }
.tpill { background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 15px; font-weight: 700; box-shadow: inset 0 0 0 2px var(--c); }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mh { text-align: center; font-size: 13px; color: var(--muted); }
.mc { aspect-ratio: 1 / 1.1; background: #fff; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 4px 0; font-weight: 700; font-size: 16px; min-width: 0; }
.mc.other { opacity: .35; }
.mc.today { box-shadow: inset 0 0 0 2px var(--pri); color: var(--pri); }
.dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin-top: 4px; padding: 0 2px; }
.dots b { width: 8px; height: 8px; border-radius: 50%; }
.month-day { margin-top: 12px; }
.mc.sel { background: #dbeafe; }
.mc .tn { font-size: 10px; color: var(--muted); font-weight: 800; margin-top: auto; }
.center-hint { text-align: center; margin-top: 10px; }
.add-task-btn { margin: 0 0 10px; }

/* быстрые дела */
.btn.quick { width: 52px; padding: 0; font-size: 24px; flex: none; }
.add-row.in-sheet { position: static; margin-top: 0; padding: 0; background: none; }
.tgroups button { font-size: 13px; padding: 8px 2px; white-space: nowrap; }
.pick-row { scrollbar-width: none; }
.pick-row::-webkit-scrollbar { display: none; }
.tmpl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.tmpl-btn { background: #f3f4f6; border-radius: 12px; padding: 12px 10px; text-align: left; font-size: 15px; font-weight: 700; min-height: 52px; min-width: 0; overflow-wrap: anywhere; }
.tmpl-btn:active { background: #dbeafe; transform: translateY(2px); }
.added { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; background: #f0fdf4; border-radius: 12px; padding: 10px 12px; }
.added span::before { content: '✓ '; color: var(--ok); font-weight: 900; }

/* нижние окна */
.sheet-bg { position: fixed; inset: 0; z-index: 20; background: rgba(15, 23, 42, .4); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet label { display: flex; align-items: center; justify-content: space-between; font-weight: 800; color: var(--muted); margin: 14px 2px 6px; font-size: 15px; }
.who-line { display: flex; flex-wrap: wrap; gap: 6px; }
.who-pill { background: color-mix(in srgb, var(--c) 15%, #fff); box-shadow: inset 0 0 0 2px var(--c); border-radius: 999px; padding: 4px 10px; font-weight: 700; }
.pick-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px; }
.pick-row.wrap { flex-wrap: wrap; overflow: visible; }
.pick-ava { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 68px; padding: 6px; border-radius: 14px; font-size: 30px; background: #f3f4f6; opacity: .6; }
.pick-ava small { font-size: 12px; font-weight: 700; }
.pick-ava.on { opacity: 1; background: color-mix(in srgb, var(--c) 18%, #fff); box-shadow: inset 0 0 0 3px var(--c); }
.pick-em { width: 52px; height: 52px; font-size: 30px; border-radius: 12px; background: #f3f4f6; }
.ava-grid { margin-top: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.ava-grid .pick-em { width: auto; }
.cur-ava { font-size: 30px; line-height: 1; }
.pick-em.on { box-shadow: inset 0 0 0 3px var(--pri); background: #eff6ff; }
.pick-col { width: 44px; height: 44px; border-radius: 50%; }
.pick-col.on { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink); }
/* «любой цвет»: радужный кружок, по касанию — палитра телефона */
.pick-col.custom { position: relative; overflow: hidden; margin: 0; cursor: pointer;
  background: conic-gradient(#ef4444, #facc15, #22c55e, #06b6d4, #3b82f6, #a855f7, #ec4899, #ef4444); }
.pick-col.custom span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; pointer-events: none; }
.pick-col.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.days button { padding: 12px 0; border-radius: 12px; background: #f3f4f6; font-weight: 800; font-size: 15px; min-width: 0; }
.days button.on { background: var(--pri); color: #fff; }
.time { max-width: 180px; }
.remind-row { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.toggle { align-self: flex-start; padding: 12px 16px; border-radius: 12px; background: #f3f4f6; font-weight: 800; opacity: .6; }
.toggle.on { opacity: 1; background: #fef3c7; }

/* настройки */
.card { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; color: var(--ink); }
.me-card { display: flex; align-items: center; gap: 12px; }
.me-card div { flex: 1; display: flex; flex-direction: column; }
.me-card small, .row-btn small { color: var(--muted); font-size: 14px; }
.who-ava.sm { font-size: 30px; }
.row-btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.row-btn b { flex: 1; }
.row-btn .go { color: var(--muted); font-size: 24px; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; background: #111827; color: #fff;
  padding: 12px 18px; border-radius: 14px; font-weight: 700; max-width: 90vw; text-align: center; }

@media (max-width: 360px) {
  body { font-size: 17px; }
  .ava-btn { min-width: 58px; font-size: 26px; }
  .days button { font-size: 13px; }
}
