/* Дозор — макет C «Сад»: мятная шапка со сводкой, сферы плитками */
@font-face { font-family: Onest; src: url(/fonts/onest-cyr.woff2) format('woff2'); font-weight: 400 600; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; src: url(/fonts/onest-lat.woff2) format('woff2'); font-weight: 400 600; font-display: swap; 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+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #F7F4EE; --mint: #DCE8DA; --ink: #22261F; --soft: #6B6A64; --line: #F0ECE4; --chip: #F1EEE7; --grey: #EFEDE8;
  --green: #234A2C; --green-2: #1E3A24; --green-3: #3F5E45; --ok: #E3EFE1; --ok-ink: #2E5A37;
  --soon: #F6EBCF; --soon-ink: #6F5310; --soon-text: #4A4535;
  --fire: #F8DCDC; --fire-ink: #93303A; --fire-text: #4A3A3A;
  --ai: #6E56CF;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 Onest, system-ui, sans-serif; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
a { color: var(--ok-ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
main { max-width: 760px; margin: 0 auto; }
.muted { color: var(--soft); }
.small { font-size: 14px; }
.pad { padding: 24px 20px; }
.wrap { padding: 0 20px; }

/* Шапка — мятная, скруглённая снизу */
.hero { background: var(--mint); border-radius: 0 0 32px 32px; padding: 22px 20px 22px; padding-top: calc(22px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bar .grow { flex: 1; }
.logo { font-size: 26px; font-weight: 600; color: var(--green); letter-spacing: -.01em; }
.round { width: 44px; height: 44px; border-radius: 22px; background: rgba(255, 255, 255, .7); border: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--green); text-decoration: none; flex: 0 0 auto; }
.install { height: 44px; border-radius: 22px; background: rgba(255, 255, 255, .7); border: 0; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px 0 12px; color: var(--green); font-size: 14px; font-weight: 600; }
.install svg.i { width: 20px; height: 20px; }
.kicker { font-size: 14px; color: var(--green-3); }
.big { font-size: 22px; font-weight: 600; line-height: 1.25; color: var(--green-2); margin: 2px 0 0; }
.wk { display: flex; flex-direction: column; gap: 8px; }
.wk a { background: #fff; border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 15px; }
.wk a span:last-child { min-width: 0; }
.tag { font-size: 13px; font-weight: 600; border-radius: 10px; padding: 4px 8px; white-space: nowrap; background: var(--ok); color: var(--ok-ink); }
.tag.soon { background: var(--soon); color: var(--soon-ink); }
.tag.fire { background: var(--fire); color: var(--fire-ink); }
.title { margin: 0; font-size: 26px; font-weight: 600; color: var(--green-2); line-height: 1.15; }
.ttl { display: flex; align-items: center; gap: 12px; }
.ttl .emo { width: 48px; height: 48px; border-radius: 16px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; flex: 0 0 auto; }
.owner { font-size: 13px; font-weight: 600; color: var(--green); background: rgba(255, 255, 255, .75); border-radius: 12px; padding: 5px 10px; white-space: nowrap; }
.info { display: flex; gap: 8px; }
.info div { flex: 1; background: rgba(255, 255, 255, .75); border-radius: 14px; padding: 10px 12px; font-size: 14px; white-space: pre-wrap; }
.info small { display: block; font-size: 12px; color: var(--green-3); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: #fff; border-radius: 16px; padding: 12px 14px; font-size: 13px; color: var(--soft); }
.stats b { display: block; font-size: 24px; font-weight: 600; line-height: 1.2; color: var(--ink); }
.stats .fire b { color: var(--fire-ink); } .stats .soon b { color: var(--soon-ink); }

/* Плитки сфер */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 20px; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { border-radius: 22px; padding: 14px; min-height: 168px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); background: var(--ok); }
.card .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.card .emo { width: 40px; height: 40px; border-radius: 13px; background: rgba(255, 255, 255, .7); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.card .lvl { font-size: 12px; font-weight: 600; color: var(--ok-ink); }
.card .name { font-size: 16px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.card .date { font-size: 13px; font-weight: 500; color: var(--ok-ink); }
.card .todo { font-size: 13px; line-height: 1.35; color: var(--soft); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .more { font-size: 12px; color: var(--soft); margin-top: auto; }
.card.soon { background: var(--soon); } .card.soon .lvl, .card.soon .date { color: var(--soon-ink); } .card.soon .todo { color: var(--soon-text); }
.card.fire { background: var(--fire); } .card.fire .lvl, .card.fire .date { color: var(--fire-ink); } .card.fire .todo { color: var(--fire-text); }
.card.empty { background: transparent; border: 1.5px dashed #C9C5BB; } .card.empty .emo { background: var(--grey); } .card.empty .lvl { color: var(--soft); }

/* Экран сферы */
.links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 20px; margin-bottom: 12px; }
.links a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px 4px; border-radius: 16px; background: #fff; font-size: 11px; font-weight: 500; text-align: center; line-height: 1.2; color: var(--ink); text-decoration: none; overflow-wrap: break-word; hyphens: auto; min-height: 72px; }
.links a svg.i { color: var(--ok-ink); }
.list { display: flex; flex-direction: column; gap: 12px; padding: 0 20px; }
.item { background: #fff; border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.item .row { display: flex; gap: 12px; align-items: flex-start; }
.dt { flex: 0 0 auto; width: 52px; min-height: 52px; border-radius: 14px; background: var(--grey); color: var(--soft); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding: 8px 0; font-size: 12px; font-weight: 600; }
.dt b { font-size: 20px; font-weight: 600; }
.dt span { font-size: 11px; margin-top: 3px; font-weight: 500; }
.dt span + span { font-weight: 600; }
.dt.fire { background: var(--fire); color: var(--fire-ink); } .dt.soon { background: var(--soon); color: var(--soon-ink); } .dt.ok { background: var(--ok); color: var(--ok-ink); }
.item .st { font-size: 12px; font-weight: 600; color: var(--soft); }
.item .st.fire { color: var(--fire-ink); } .item .st.soon { color: var(--soon-ink); } .item .st.ok { color: var(--ok-ink); }
.item .t { font-size: 16px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.item .t a { color: var(--ink); text-decoration: none; }
.item .t a svg.i { width: 15px; height: 15px; vertical-align: -1px; color: var(--soft); }
.item .n { font-size: 14px; color: var(--soft); white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.item .grow { flex: 1; min-width: 0; }
.edit { width: 36px; height: 36px; border-radius: 12px; border: 0; background: transparent; color: var(--soft); display: flex; align-items: center; justify-content: center; margin: -6px -6px 0 0; flex: 0 0 auto; }
.edit svg.i { width: 18px; height: 18px; }
.acts { display: flex; gap: 6px; }
.acts > * { flex: 1 1 0; min-width: 0; padding: 0 6px; }
@media (max-width: 380px) { .acts svg.i { display: none; } }
.item.done { opacity: .7; }
.item .hist { font-size: 13px; color: var(--soft); }
.item .hist summary { padding: 0; min-height: 0; font-size: 13px; color: var(--soft); background: none; }
.item .hist div { padding: 3px 0; }

.btn { min-height: 44px; border: 0; border-radius: 14px; background: var(--chip); color: var(--ink); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; text-decoration: none; white-space: nowrap; }
.btn svg.i { width: 18px; height: 18px; }
.btn.ok { background: var(--ok); color: var(--green); font-weight: 600; }
.btn.ai { background: var(--ai); color: #fff; font-weight: 600; }
.btn.main { background: var(--green); color: #fff; font-weight: 600; min-height: 52px; border-radius: 18px; font-size: 16px; }
.btn.danger { background: var(--fire); color: var(--fire-ink); }
.btn.wide { width: 100%; }
.btn.white { background: #fff; }
.btn:disabled { opacity: .5; }

/* Сворачиваемые блоки */
.fold { background: #fff; border-radius: 16px; margin: 12px 20px 0; }
.fold > summary { min-height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 500; cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ''; width: 9px; height: 9px; border: solid var(--ink); border-width: 0 1.7px 1.7px 0; transform: translateY(-3px) rotate(45deg); transition: transform .15s; }
.fold[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.fold .in { padding: 0 16px 12px; }
.fold .list { padding: 0 0 4px; }
.fold .item { background: var(--bg); }
.ev { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.ev time { width: 76px; flex: 0 0 auto; color: var(--soft); font-variant-numeric: tabular-nums; }
.ev div { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.checkinfo { font-size: 13px; color: var(--soft); padding: 0 0 10px; }
.hint { margin: 0 20px; border: 1.5px dashed #C9C5BB; border-radius: 22px; padding: 16px; color: var(--soft); }
.add { margin: 12px 20px 0; width: calc(100% - 40px); }

/* Управление */
.sec { font-size: 18px; font-weight: 600; margin: 24px 20px 10px; }
.sec:first-of-type { margin-top: 4px; }
.rows { display: flex; flex-direction: column; gap: 8px; padding: 0 20px; }
.rows a { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 16px; padding: 12px 16px; color: var(--ink); text-decoration: none; }
.rows a.fire { background: var(--fire); } .rows a.soon { background: var(--soon); }
.rows .d { width: 44px; flex: 0 0 auto; font-size: 14px; font-weight: 600; color: var(--fire-ink); }
.rows a.soon .d { color: var(--soon-ink); }
.rows .w { min-width: 0; font-size: 15px; } .rows .w small { display: block; font-size: 13px; color: var(--soft); }
.rows a.fire small { color: var(--fire-ink); }
.agrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 20px; }
.agrid > div { background: #fff; border-radius: 18px; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 4px; }
.agrid a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.agrid .c { font-size: 12px; color: var(--soft); }
.agrid .tools { display: flex; justify-content: flex-end; gap: 4px; margin-top: auto; }
.agrid .tools button { width: 40px; height: 40px; border: 0; background: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--soft); }
.agrid .tools button.del { color: var(--fire-ink); }
.foot { padding: 0 20px; margin-top: 12px; }
.note-p { margin: 22px 20px 0; font-size: 13px; color: var(--soft); }
.out { margin: 10px 20px 0; }

/* Нижний лист и формы */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(34, 38, 31, .35); display: flex; align-items: flex-end; justify-content: center; }
.sheet .box { background: var(--bg); width: 100%; max-width: 560px; border-radius: 26px 26px 0 0; padding: 20px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; }
@media (min-width: 640px) { .sheet { align-items: center; } .sheet .box { border-radius: 26px; } }
.sheet h3 { margin: 0 0 12px; font-size: 20px; font-weight: 600; color: var(--green-2); }
label { display: block; font-size: 14px; color: var(--soft); margin: 12px 0 4px; }
input, textarea, select { width: 100%; border: 1px solid #E4E0D6; background: #fff; border-radius: 14px; padding: 11px 13px; font-size: 16px; }
input:focus, textarea:focus { outline: 2px solid var(--mint); border-color: #A9C4A7; }
textarea { min-height: 80px; resize: vertical; }
.chk { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; color: var(--ink, #22261F); font-size: 15px; cursor: pointer; }
.chk input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--green-2); }
.chk small { display: block; color: var(--soft); font-size: 13px; margin-top: 2px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row-btns { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.row-btns .btn { flex: 1; }
.row-btns .btn.main { min-height: 44px; font-size: 15px; border-radius: 14px; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick .btn { flex-direction: column; gap: 2px; height: auto; padding: 10px 4px; background: #fff; }
.err { color: var(--fire-ink); font-size: 14px; margin-top: 8px; min-height: 1em; }
.steps { margin: 4px 0 0; padding-left: 20px; } .steps li { margin: 6px 0; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; background: var(--green-2); color: #fff; border-radius: 16px; padding: 12px 16px; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); font-size: 15px; }
.toast span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast button { background: none; border: 0; color: var(--soon); font-weight: 600; }

.login { max-width: 380px; margin: 0 auto; padding: 0 20px; }
.login .hero { margin: 0 -20px 24px; align-items: center; text-align: center; padding-top: calc(48px + env(safe-area-inset-top)); padding-bottom: 32px; }
.login .hero img { width: 64px; height: 64px; }
.login .btn.main { width: 100%; margin-top: 12px; }
