/* ПланерОчка. Основа — prototype/shared.css + стили v5 «Шесть частей». */
@font-face { font-family: Comfortaa; font-weight: 600; font-display: swap; src: url(../fonts/comfortaa-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Comfortaa; font-weight: 700; font-display: swap; src: url(../fonts/comfortaa-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Comfortaa; font-weight: 600; font-display: swap; src: url(../fonts/comfortaa-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: Comfortaa; font-weight: 700; font-display: swap; src: url(../fonts/comfortaa-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }

:root {
  --bg: #F4F2EC; --card: #FFFFFF; --ink: #26251F; --muted: #8C887D; --line: #ECE7DB;
  --beige: #CFC5A8; --track: #ECE6D6; --soft: #FAF8F2;
  --green: #34A853; --green-deep: #1E7E3A; --green-soft: #E3F3E6;
  --red: #B0542F;
  --r: 16px;
  --shadow: 0 1px 2px rgba(38, 37, 31, .05), 0 4px 14px rgba(38, 37, 31, .05);
  --round: Comfortaa, ui-rounded, system-ui, sans-serif;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.38 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
/* меньше 16px — Safari на iPhone зумит страницу при фокусе */
input, textarea { font-size: 16px; }
button { background: none; border: 0; cursor: pointer; text-align: inherit; }
[hidden] { display: none !important; }
.app { max-width: 430px; margin: 0 auto; min-height: 100vh; padding-top: var(--top); }
main { padding: 0 16px calc(92px + var(--bottom)); }
.screen { display: none; }
.screen.active { display: block; }
.brand { font-family: var(--round); font-weight: 700; font-size: 13px; letter-spacing: .02em; color: var(--muted); }
.muted { color: var(--muted); }
.sm { font-size: 13px; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; }
.h-sec { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 22px 4px 8px; }
.arr { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; color: var(--muted); text-align: center; flex: none; }
.arr:disabled { opacity: .25; cursor: default; }
.pill { background: var(--green-soft); color: var(--green-deep); font-weight: 700; font-size: 14px; padding: 5px 12px; border-radius: 99px; white-space: nowrap; }
.link { color: var(--green-deep); font-weight: 600; font-size: 14px; text-transform: none; letter-spacing: 0; padding: 4px 2px; }
.link.danger { color: var(--red); }

/* полоска прогресса */
.bar { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: inherit; transition: width .35s ease; }
.bar.thin { height: 4px; }

/* чекбокс */
.chk { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--beige); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.chk::after { content: ""; width: 10px; height: 5px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: translateY(-1px) rotate(-45deg); opacity: 0; }
.done > .chk { background: var(--green); border-color: var(--green); }
.done > .chk::after { opacity: 1; }
.chk.sm { width: 18px; height: 18px; border-radius: 6px; }
.chk.sm::after { width: 8px; height: 4px; border-width: 0 0 2px 2px; }

/* задачи */
.tasks { display: flex; flex-direction: column; }
.task { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .tt { flex: 1; transition: color .15s; overflow-wrap: anywhere; }
.task.done .tt { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--beige); }
.task.pending { opacity: .55; }
.add { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line); }
.tasks:empty + .add { border-top: 0; }
.add .plus { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px dashed var(--beige); display: grid; place-items: center; color: var(--beige); font-weight: 700; line-height: 1; }
.add input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 4px 0; }
.add input::placeholder { color: var(--muted); }
.notes { margin-top: 10px; background: var(--soft); border-radius: 12px; padding: 10px 12px 6px; }
.notes-h { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.note { position: relative; padding: 4px 0 4px 13px; font-size: 14px; overflow-wrap: anywhere; }
.note::before { content: ""; position: absolute; left: 0; top: 12px; width: 5px; height: 5px; border-radius: 50%; background: var(--beige); }
.note-add { border: 0; padding: 4px 0; }

/* режим правки: строка = поле + удалить */
.erow { display: flex; align-items: center; gap: 8px; min-height: 46px; border-bottom: 1px solid var(--line); }
.erow:last-child { border-bottom: 0; }
.erow input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 10px 2px; }
.erow input:focus { background: var(--soft); border-radius: 8px; }
.notes .erow { min-height: 38px; border-color: var(--track); }
.notes .erow input { padding: 6px 2px; }
.del { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--red); background: #F7E9E2; font-size: 18px; line-height: 1; }

/* цели */
.goals { display: flex; flex-direction: column; }
.goal { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; width: 100%; }
.goal > span:last-child { overflow-wrap: anywhere; }
.goal.done > span:last-child { color: var(--muted); text-decoration: line-through; }
.goals-card { padding: 4px 14px; }
.goals-card .add { padding: 8px 0; }
.goals:empty + .add { border-top: 0; }

/* нижнее меню */
.tabbar {
  position: fixed; z-index: 20; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; display: flex;
  background: rgba(255, 255, 255, .9); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 6px 6px calc(8px + var(--bottom));
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0; font-size: 11px; font-weight: 500; color: var(--muted); text-align: center; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--ink); }
.tab.active svg { stroke: var(--green-deep); }

/* общие экраны */
.scr-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.scr-title { font-family: var(--round); font-size: 24px; font-weight: 700; margin: 22px 4px 2px; }
.scr-sub { color: var(--muted); font-size: 14px; margin: 0 4px 14px; }
.empty-card { text-align: center; color: var(--muted); font-size: 14px; padding: 18px 14px; margin-bottom: 10px; }

.hab { margin-bottom: 10px; }
.hab-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; font-weight: 500; }
.hab-top > span { overflow-wrap: anywhere; }
.hab-top b { font-size: 13px; color: var(--muted); font-weight: 600; }
.hab-top.erow { align-items: center; min-height: 0; border: 0; margin-bottom: 8px; }
.hab-top.erow input { padding: 4px 6px; font-weight: 500; }
.hab-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; margin-bottom: 10px; }
.hdot { aspect-ratio: 1; border-radius: 50%; background: var(--track); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--muted); transition: background .15s; }
.hdot.on { background: var(--green); color: #fff; }
.hdot.today { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--ink); }
.hdot svg { width: 15px; height: 15px; }
.hab-add { padding: 4px 14px; }
.hab-add .add { border: 0; }

.chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 12px 0; }
.chip { display: flex; flex-direction: column; align-items: center; padding: 7px 0; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); font-size: 11px; font-weight: 600; color: var(--muted); }
.chip small { font-size: 16px; color: var(--ink); }
.chip.on { background: var(--ink); color: #bdb8aa; }
.chip.on small { color: #fff; }
.diary { display: flex; flex-direction: column; gap: 14px; }
.drow { display: flex; align-items: center; justify-content: space-between; }
.drow.col { flex-direction: column; align-items: stretch; gap: 8px; }
.dl { font-size: 13px; font-weight: 600; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 99px; padding: 3px; }
.stepper button { width: 32px; height: 32px; border-radius: 50%; background: var(--card); font-size: 18px; display: grid; place-items: center; }
.stepper b { min-width: 50px; text-align: center; }
.bolts { display: flex; gap: 2px; }
.bolt { font-size: 22px; padding: 2px; filter: grayscale(1); opacity: .3; transition: .15s; }
.bolt.on { filter: none; opacity: 1; }
.moods { display: flex; justify-content: space-between; }
.mood { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 28px; filter: grayscale(1); opacity: .45; transition: .15s; }
.mood.on { filter: none; opacity: 1; background: var(--green-soft); }
.dfield { display: flex; flex-direction: column; gap: 6px; }
.dfield textarea { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--soft); resize: none; outline: 0; }
.dfield textarea:focus { border-color: var(--beige); background: #fff; }

.st-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.st-big { font-size: 22px; font-weight: 700; }
.card-h { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 150px; }
.ccol { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cv { font-size: 11px; font-weight: 600; color: var(--muted); }
.ctrack { flex: 1; width: 100%; max-width: 28px; background: var(--track); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.ctrack i { display: block; width: 100%; background: var(--green); border-radius: 8px; transition: height .35s; }
.cl { font-size: 12px; color: var(--muted); }
.ccol.today .cl { color: var(--ink); font-weight: 700; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.tile { background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.tile span { display: block; font-size: 12px; color: var(--muted); }
.tile b { font-size: 20px; }

/* ---------- v5: неделя из шести частей ---------- */
.v5 { display: flex; flex-direction: column; height: calc(100vh - 76px - var(--top) - var(--bottom)); height: calc(100dvh - 76px - var(--top) - var(--bottom)); min-height: 560px; }
.v5-head { flex: none; padding: 10px 2px 8px; }
.v5-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); padding: 2px 0 2px 6px; max-width: 60%; }
.me span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ava { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.v5-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 1px; }
.wnav { display: flex; align-items: center; min-width: 0; margin-left: -8px; }
.wnav .arr { width: 28px; height: 30px; font-size: 22px; }
.v5-title { font-family: var(--round); font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.v5-head .pill { font-size: 13px; padding: 4px 10px; }

.g6 { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 6px; transition: opacity .15s; }
.g6.loading { opacity: .45; }
.wk2 { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 6px; min-height: 0; }

.c5 { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform .12s; }
.c5:active { transform: scale(.98); }
.c5.today { box-shadow: 0 0 0 1.5px var(--ink), var(--shadow); }
.c5bar { flex: none; height: 5px; background: var(--track); }
.c5bar i { display: block; height: 100%; background: var(--green); transition: width .35s; }
.c5h { flex: none; display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 6px 9px 4px; }
.c5d { font-size: 13px; color: var(--muted); white-space: nowrap; }
.c5d b { font-size: 14px; color: var(--ink); margin-right: 3px; }
.c5.today .c5d b { background: var(--ink); color: #fff; padding: 1px 6px; border-radius: 99px; font-size: 12.5px; }
.c5n { font-size: 11.5px; font-weight: 700; color: var(--green-deep); white-space: nowrap; }
.c5.all .c5n::after { content: " ✓"; }

.c5list { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding: 0 9px 6px; }
.c5list > span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; line-height: 1.3; min-width: 0; }
.c5list > span::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 3px; border: 1.5px solid var(--beige); }
.c5list > span.done { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--beige); }
.c5list > span.done::before { background: var(--green); border-color: var(--green); }
.c5list > span em { font-style: normal; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.c5list > span.hid { display: none; }
.c5list > .more, .c5list > .empty { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.c5list > .more::before, .c5list > .empty::before { display: none; }

.v5-hint { flex: none; text-align: center; font-size: 11.5px; color: var(--muted); padding: 7px 0 0; }
.v5-hint button { font-size: 12.5px; font-weight: 600; color: var(--green-deep); padding: 0 6px; }

/* открытый день — раскрывается из ячейки */
.dv5 { position: fixed; z-index: 30; top: 0; bottom: 0; left: 50%; width: 100%; max-width: 430px; margin-left: -215px; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px calc(24px + var(--bottom)); opacity: 0; transform: scale(.35); pointer-events: none; transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .2s; }
@media (max-width: 430px) { .dv5 { left: 0; margin-left: 0; } }
.dv5.show { opacity: 1; transform: none; pointer-events: auto; }
.dv5-top { position: sticky; top: 0; z-index: 2; background: var(--bg); margin: 0 -16px; padding: calc(12px + var(--top)) 10px 10px; }
.dv5-bar { display: flex; align-items: center; justify-content: space-between; }
.back { display: flex; align-items: center; gap: 2px; font-size: 15px; font-weight: 600; color: var(--green-deep); padding: 6px 6px; }
.back span { font-size: 22px; line-height: 1; margin-top: -2px; }
.dv5-bar .link { font-size: 15px; padding: 6px 8px; }
.dv5-head { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.dv5-head .t { flex: 1; min-width: 0; }
.dv5-head .t div { font-family: var(--round); font-size: 21px; font-weight: 700; }
.dv5-head .t small { font-size: 13px; color: var(--muted); }
.dv5-top .bar { margin: 10px 6px 0; }
.dv5 .card { padding: 2px 14px 14px; margin-top: 4px; }
.mini6 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 16px; }
.mini6 button { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); padding-bottom: 3px; border-bottom: 2px solid transparent; }
.mini6 button i { width: 100%; height: 5px; border-radius: 99px; background: var(--track); overflow: hidden; }
.mini6 button i b { display: block; height: 100%; background: var(--green); }
.mini6 button.cur { color: var(--ink); border-color: var(--ink); }

/* ---------- вход / регистрация ---------- */
.auth { max-width: 430px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; padding: calc(48px + var(--top)) 20px calc(32px + var(--bottom)); display: flex; flex-direction: column; }
.auth-logo { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: 56px; height: 56px; padding: 6px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 18px; }
.auth-logo i { border-radius: 4px; background: var(--track); position: relative; overflow: hidden; }
.auth-logo i::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--green); }
.auth h1 { font-family: var(--round); font-size: 30px; font-weight: 700; }
.auth-sub { color: var(--muted); margin: 6px 0 22px; }
.auth form { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input { border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; background: var(--soft); outline: 0; width: 100%; }
.field input:focus { border-color: var(--beige); background: #fff; }
.btn { display: block; width: 100%; text-align: center; background: var(--green-deep); color: #fff; font-weight: 700; border-radius: 12px; padding: 13px; margin-top: 4px; transition: opacity .15s; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.btn.danger { background: #F7E9E2; color: var(--red); }
.form-err { color: var(--red); font-size: 14px; min-height: 0; }
.form-err:empty { display: none; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }
.auth-switch button { color: var(--green-deep); font-weight: 600; }
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 24px; }
.boot .btn { margin-top: 14px; }

/* ---------- профиль: шторка снизу ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(38, 37, 31, .32); opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet-bg.show { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; z-index: 41; left: 50%; bottom: 0; width: 100%; max-width: 430px; transform: translate(-50%, 105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); background: var(--bg); border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + var(--bottom)); max-height: 92vh; overflow-y: auto; }
.sheet.show { transform: translate(-50%, 0); }
.sheet-grip { width: 38px; height: 5px; border-radius: 99px; background: var(--beige); margin: 0 auto 10px; }
.sheet h2 { font-family: var(--round); font-size: 21px; margin: 4px 4px 12px; display: flex; justify-content: space-between; align-items: center; }
.sheet .card { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.sheet .card .btn { margin-top: 0; }
.sheet-mail { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- тост ---------- */
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(86px + var(--bottom)); transform: translate(-50%, 20px); max-width: calc(100% - 32px); background: var(--ink); color: #fff; font-size: 14px; padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
