﻿:root {
  --primary: #17917f;
  --primary-600: #127a6b;
  --primary-700: #0d5f53;
  --primary-50: #e8f5f2;
  --primary-100: #cce9e2;
  --bg: #f7fbfa;
  --card: #ffffff;
  --text: #1d2b29;
  --muted: #6b7f7b;
  --border: #e2ece9;
  --soft-warn: #f6efe3;
  --soft-warn-text: #8a6a35;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 60, 52, .04), 0 2px 10px rgba(16, 60, 52, .04);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Lora", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
h1, h2 { font-family: var(--font-serif); letter-spacing: -.005em; }
h1 { font-size: 1.6rem; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 1.15rem; margin: 0; font-weight: 600; }
h3 { font-size: .95rem; margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.container { max-width: 760px; margin: 0 auto; padding: 20px 16px 80px; }

/* ── шапка ── */
.topbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 760px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { font: 500 1.35rem/1 var(--font-serif); letter-spacing: .02em; color: var(--primary-600); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { height: 30px; width: auto; display: block; }
#nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
#nav a, #nav button { padding: 6px 10px; border-radius: 8px; color: var(--muted); font: inherit; background: none; border: 0; cursor: pointer; }
#nav a.active { background: var(--primary-50); color: var(--primary-700); }
#nav a:hover, #nav button:hover { color: var(--text); text-decoration: none; }

/* ── карточки ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.card.fard { border-color: var(--primary); background: linear-gradient(180deg, var(--primary-50), #fff 70%); }
.tag { display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 99px; background: var(--primary-50); color: var(--primary-700); font-weight: 560; white-space: nowrap; }
.tag.gray { background: #f0f3f2; color: var(--muted); }
.tag.warm { background: var(--soft-warn); color: var(--soft-warn-text); }
.tag.solid { background: var(--primary); color: #fff; }

/* ── сворачиваемые группы ── */
.group { padding: 0; }
.group-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px 16px; margin: 0;
  background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; list-style: none;
}
.group-head::-webkit-details-marker { display: none; }
.group-head h2 { flex: 1; min-width: 0; }
h2.with-ico { display: flex; align-items: center; gap: 10px; }
.cat-ico { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--primary-50); color: var(--primary-700); }
.cat-ico svg { display: block; }
.cat-title .cat-ico { width: 22px; height: 22px; border-radius: 7px; background: none; margin-right: 4px; }
.cat-title .cat-ico svg { width: 16px; height: 16px; }
.cat-title { display: flex; align-items: center; }
.group-body { padding: 0 16px 12px; }
.group-sum { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.count { font-size: .8rem; font-weight: 600; color: var(--muted); background: #f0f3f2; border-radius: 99px; padding: 1px 9px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.count.full { background: var(--primary-50); color: var(--primary-700); }
.chev { flex: none; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.group.closed .chev, details.group:not([open]) .chev { transform: rotate(-45deg); }
.group.closed { box-shadow: none; }
details.group:not([open]) { box-shadow: none; }

/* ── кнопки и поля ── */
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 560; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--primary); background: var(--primary); color: #fff; cursor: pointer; }
.btn:hover { background: var(--primary-600); }
.btn.ghost { background: #fff; color: var(--primary-700); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--primary); }
.btn.sm { padding: 4px 10px; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 1px solid var(--border); background: #fff; border-radius: 8px; width: 30px; height: 30px; cursor: pointer; color: var(--muted); font-size: 14px; }
.icon-btn:hover { color: var(--text); border-color: var(--primary); }
input[type=text], input[type=password], input[type=number], input[type=time], select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-100); border-color: var(--primary); }
textarea { resize: vertical; min-height: 70px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.error { color: #b4533a; font-size: .9rem; min-height: 1.2em; }

/* ── вход ── */
body.auth-page { background: #e9efed; }
body.auth-page .container { max-width: 980px; }
.auth { min-height: calc(100vh - 100px); display: grid; place-items: center; padding: 40px 0; }
.auth-card {
  display: grid; grid-template-columns: 1fr 1.05fr; width: 100%; max-width: 900px;
  background: #fff; border-radius: 30px; box-shadow: 0 20px 60px rgba(13, 60, 52, .12);
}
.auth-art {
  position: relative; overflow: hidden; margin: -28px 0 -28px 0; min-height: 560px; border-radius: 30px;
  padding: 34px 34px 0; color: #fff; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0f5249 0%, #2b7d6f 38%, #9fcabe 70%, #d5ebe4 100%);
  box-shadow: 0 24px 50px rgba(13, 60, 52, .28);
}
.auth-brand { display: flex; align-items: center; gap: 10px; font: 500 1.3rem/1 var(--font-serif); letter-spacing: .03em; opacity: .95; }
.logo-mask {
  display: inline-block; height: 34px; aspect-ratio: 128 / 160; background: currentColor;
  -webkit-mask: url(/img/logo-mark.png) center / contain no-repeat; mask: url(/img/logo-mark.png) center / contain no-repeat;
}
.auth-art h1 { font-size: 2.3rem; line-height: 1.12; font-weight: 600; letter-spacing: -.01em; margin: 44px 0 10px; position: relative; z-index: 1; }
.auth-art p { margin: 0; color: rgba(255, 255, 255, .78); font-size: 1rem; max-width: 300px; position: relative; z-index: 1; }
.auth-scene { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 68%; display: block; }

.auth-form { padding: 52px 52px 40px; display: flex; flex-direction: column; min-height: 504px; }
.auth-switch { margin: 0 0 26px; color: var(--muted); font-size: 1rem; }
.auth-switch button { border: 0; background: none; padding: 0; font: inherit; font-weight: 650; color: var(--primary-700); cursor: pointer; }
.auth-switch button:hover { text-decoration: underline; }
.auth-field { display: block; margin-bottom: 18px; }
.auth-field > span:first-child { display: block; font-weight: 560; margin-bottom: 8px; }
.auth-input { position: relative; display: block; }
.auth-input input { height: 54px; border: 1.5px solid transparent; border-radius: 16px; background: #f1f4f3; padding: 0 50px 0 18px; font-size: 1rem; }
.auth-input input::placeholder { color: #9aa9a6; }
.auth-input input:focus { outline: none; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.auth-input > svg, .auth-eye { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: #7d8e8a; }
.auth-input > svg { pointer-events: none; }
.auth-eye { right: 8px; width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: none; border-radius: 10px; cursor: pointer; }
.auth-eye:hover, .auth-eye.on { color: var(--primary-700); background: var(--primary-50); }
.auth-form .error { margin-bottom: 8px; }
.auth-submit { margin-top: auto; width: 100%; justify-content: center; height: 56px; border-radius: 16px; font-size: 1.05rem; background: var(--primary-700); border-color: var(--primary-700); }
.auth-submit:hover { background: #0a4c42; }
.auth-note { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: .85rem; }

/* ── день ── */

/* лента дней */
.week-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 6 * 8px) / 7); gap: 8px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; margin: 0 0 14px; padding: 4px 2px 8px;
}
.week-strip::-webkit-scrollbar { display: none; }
.wday { scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; }
.wday:disabled { cursor: default; opacity: .4; }
.wday .wd { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.wcircle {
  --p: 0; position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--primary-100) 0);
  box-shadow: 0 3px 10px rgba(13, 60, 52, .12); transition: transform .15s;
}
.wcircle::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }
.wcircle b { position: relative; font-size: .95rem; font-weight: 650; color: var(--text); }
.wday:not(:disabled):hover .wcircle { transform: translateY(-2px); }
.wday.today .wd { color: var(--primary-700); }
.wday.sel .wcircle { box-shadow: 0 6px 16px rgba(13, 95, 83, .32); }
.wday.sel .wcircle::before { background: var(--primary-700); }
.wday.sel .wcircle b { color: #fff; }
.wday.sel .wd { color: var(--primary-700); }

/* карточка дня с кольцом */
.hero { display: flex; align-items: center; gap: 18px; padding: 18px; }
.ring { position: relative; flex: none; width: 112px; height: 112px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-bg { stroke: var(--primary-50); }
.ring-fg { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.3, .8, .3, 1), stroke .3s; }
.ring.full .ring-fg { stroke: var(--primary-700); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; }
.ring-label b { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: .75rem; color: var(--muted); }
.hero-text { min-width: 0; }
.hero-greet { font-size: .88rem; color: var(--primary-700); font-weight: 560; margin-bottom: 2px; }
.hero-text h1 { font-size: 1.35rem; margin: 0 0 4px; }
.hero-sub { font-size: .9rem; color: var(--muted); }
.badge { display: inline-block; background: var(--primary-50); color: var(--primary-700); font-weight: 600; font-size: .82rem; padding: 3px 10px; border-radius: 99px; }

/* плитки молитв */
.prayers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 2px 0 6px; }
.prayer { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.prayer-btn {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 2px 10px;
  border: 1.5px solid var(--border); border-radius: 16px; background: #fff; font: inherit; color: var(--muted); cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, transform .1s;
}
.prayer-btn:hover { border-color: var(--primary); color: var(--primary-700); }
.prayer-btn:active { transform: scale(.96); }
.prayer-name { font-size: .82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.prayer.done .prayer-btn { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(13, 95, 83, .25); }
.prayer.done .prayer-name { color: #fff; }
input.prayer-time, .prayer-time {
  width: 100%; border: 0; background: none; padding: 0; text-align: center; font: inherit; font-size: .8rem;
  color: var(--primary-700); font-variant-numeric: tabular-nums; min-height: 1.4em;
}
.prayer-time::-webkit-calendar-picker-indicator { display: none; }
.prayer-time.empty { color: #c3cfcc; }
input.prayer-time:focus { outline: 2px solid var(--primary-100); border-radius: 6px; }

/* реакция на отметку */
.pop .check, .pop .prayer-btn { animation: pop .42s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.pop .check { box-shadow: 0 0 0 0 rgba(23, 145, 127, .5); animation: pop .42s cubic-bezier(.3, 1.6, .5, 1), ripple .6s ease-out; }
@keyframes ripple { from { box-shadow: 0 0 0 0 rgba(23, 145, 127, .45); } to { box-shadow: 0 0 0 14px rgba(23, 145, 127, 0); } }

.celebrate { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(10, 40, 35, .28); animation: fade .2s; padding: 20px; }
.celebrate.out { opacity: 0; transition: opacity .25s; }
@keyframes fade { from { opacity: 0; } }
.celebrate-card {
  position: relative; background: #fff; border-radius: 26px; padding: 30px 30px 26px; width: min(320px, 100%); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 24px 60px rgba(10, 40, 35, .3);
  animation: rise .45s cubic-bezier(.3, 1.4, .5, 1);
}
@keyframes rise { from { transform: translateY(24px) scale(.9); opacity: 0; } }
.celebrate-card b { font: 600 1.5rem/1.2 var(--font-serif); margin-top: 8px; }
.celebrate-card span { color: var(--muted); }
.celebrate-check {
  width: 76px; height: 76px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 38px; font-weight: 700;
  display: grid; place-items: center; box-shadow: 0 0 0 10px var(--primary-50); animation: pop .5s .1s cubic-bezier(.3, 1.6, .5, 1) both;
}
.celebrate-burst { position: absolute; left: 50%; top: 68px; width: 0; height: 0; }
.celebrate-burst i {
  position: absolute; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--primary); opacity: 0;
  animation: burst .9s .15s ease-out forwards;
}
.celebrate-burst i:nth-child(3n) { background: #e2c98f; }
.celebrate-burst i:nth-child(3n+1) { background: var(--primary-100); width: 6px; height: 6px; }
@keyframes burst {
  0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(.6); }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .pop .check, .pop .prayer-btn, .celebrate, .celebrate-card, .celebrate-check { animation: none; }
  .celebrate-burst { display: none; }
  .ring-fg { transition: none; }
}

.reminder { background: var(--primary-50); color: var(--primary-700); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: .92rem; }

.habit { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); }
.habit .time-input { width: auto; flex: none; padding: 3px 8px; font-size: .85rem; color: var(--primary-700); border-color: transparent; background: var(--primary-50); }
.side-note { flex: none; font-size: .8rem; color: var(--muted); }
.habit:first-of-type { border-top: 0; }
.check {
  flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #c6d9d4; background: #fff; cursor: pointer;
  display: grid; place-items: center; color: transparent; font-size: 15px; font-weight: 700; transition: all .15s; margin-top: 1px;
}
.check:hover { border-color: var(--primary); }
.habit.done .check { background: var(--primary); border-color: var(--primary); color: #fff; }
.habit .title { font-weight: 560; }
.habit.done .title { color: var(--primary-700); }
.habit .desc { font-size: .85rem; color: var(--muted); }
.habit .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 99px; padding: 3px 10px; font: inherit; font-size: .82rem; cursor: pointer; color: var(--muted); }
.chip:hover { border-color: var(--primary); color: var(--text); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-input { width: 70px !important; padding: 3px 8px !important; font-size: .82rem; border-radius: 99px !important; }


.question { display: block; margin-bottom: 12px; }
.question .q { display: block; font-size: .92rem; font-weight: 540; margin-bottom: 4px; }
.yn-list { margin: 8px 0 4px; }
.yn { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.yn:first-child { border-top: 0; }
.yn .q { flex: 1; font-size: .92rem; }
.seg { flex: none; gap: 0; background: #f0f3f2; border-radius: 99px; padding: 2px; }
.seg .chip { border: 0; background: none; padding: 3px 10px; }
.seg .chip.on { background: var(--primary); color: #fff; }
h3.sub { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin: 14px 0 8px; }

/* ── прогресс ── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat .v { font-size: 1.35rem; font-weight: 650; }
.stat .l { font-size: .82rem; color: var(--muted); }

.stats { grid-template-columns: repeat(3, 1fr); }
.stat .v { font-family: var(--font-serif); font-weight: 600; }

/* итог по молитвам */
.prayer-sum .card-head { margin-bottom: 12px; }
.ps-total { font: 600 1.6rem/1 var(--font-serif); color: var(--primary-700); }
.ps-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ps-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 4px 10px; border-radius: 14px; background: var(--bg); min-width: 0; }
.ps-ico { color: var(--primary-700); }
.ps-item b { font-size: 1.05rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.ps-name { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ps-bar { width: 70%; height: 4px; border-radius: 99px; background: var(--primary-100); overflow: hidden; margin-top: 4px; }
.ps-bar i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.ps-item.full { background: var(--primary-50); }
.ps-note { margin: 12px 0 0; font-size: .9rem; color: var(--muted); }
.ps-note b { color: var(--text); }

/* серии и тепловая карта */
.streaks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.streak { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--bg); }
.streak b { font: 600 1.7rem/1 var(--font-serif); color: var(--text); }
.streak span { font-size: .8rem; line-height: 1.25; color: var(--text); }
.streak i { font-style: normal; color: var(--muted); }
.streak.main { background: var(--primary-50); }
.streak.main b { color: var(--primary-700); }

.heat { --cell: minmax(0, 30px); overflow: hidden; }
.heat-months { display: grid; grid-template-columns: repeat(13, var(--cell)); gap: 4px; margin-left: 26px; font-size: .72rem; color: var(--muted); margin-bottom: 4px; }
.heat-months span { white-space: nowrap; overflow: visible; }
.heat-body { display: flex; gap: 4px; }
.heat-wd { flex: none; width: 22px; display: grid; grid-template-rows: repeat(7, 1fr); gap: 4px; font-size: .68rem; color: var(--muted); }
.heat-wd span { display: flex; align-items: center; }
.heat-grid { flex: 1; display: grid; grid-template-rows: repeat(7, auto); grid-auto-flow: column; grid-template-columns: repeat(13, var(--cell)); gap: 4px; }
.hc { display: block; aspect-ratio: 1; border-radius: 6px; border: 0; padding: 0; background: #edf2f1; }
button.hc { cursor: pointer; transition: transform .1s; }
button.hc:hover { transform: scale(1.15); }
.hc.off { background: #f5f8f7; }
.hc.future { background: none; }
.hc.l1 { background: #d9efe9; }
.hc.l2 { background: #acdacf; }
.hc.l3 { background: #6dbfae; }
.hc.l4 { background: var(--primary); }
.hc.today { box-shadow: inset 0 0 0 2px var(--primary-700); }
.hc.sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary-700); }
.legend { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: .75rem; color: var(--muted); margin-top: 12px; }
.legend i.hc { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend-hint { margin-left: auto; }

.day-detail ul { list-style: none; padding: 0; margin: 6px 0 12px; }
.day-detail li { padding: 3px 0; font-size: .92rem; }
.day-detail li.ok::before { content: "✓"; color: var(--primary); font-weight: 700; margin-right: 8px; }
.day-detail li.no { color: var(--muted); }
.day-detail li.no::before { content: "○"; margin-right: 8px; }

/* ── мои привычки ── */
.hrow { border-top: 1px solid var(--border); padding: 10px 0; }
.hrow:first-of-type { border-top: 0; }
.hrow.off .title { color: var(--muted); }
.hrow-main { display: flex; gap: 10px; align-items: center; }
.hrow .title { font-weight: 540; }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d5dfdd; border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:disabled + span { cursor: default; opacity: .6; }
.hrow-settings { margin: 10px 0 0; padding: 12px; background: var(--bg); border-radius: 10px; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.icon-btn.on { color: var(--primary-700); border-color: var(--primary); background: var(--primary-50); }
.more { display: block; width: 100%; margin-top: 4px; padding: 10px 0 2px; border: 0; border-top: 1px dashed var(--border); background: none; font: inherit; font-size: .9rem; color: var(--primary-600); text-align: left; cursor: pointer; }
.more:hover { color: var(--primary-700); }
.add-btn { width: 100%; justify-content: center; border-style: dashed; margin-bottom: 14px; }

/* ── статистика по привычкам ── */
.hs-row { display: flex; align-items: center; gap: 6px 12px; padding: 7px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.cat-title + .hs-row { border-top: 0; }
.hs-title { flex: 1; min-width: 45%; font-size: .92rem; }
.hs-row select { width: auto; padding: 3px 8px; font-size: .82rem; }
.hs-row select.override { border-color: var(--soft-warn-text); background: var(--soft-warn); }
.hs-val { white-space: nowrap; font-variant-numeric: tabular-nums; }
.off-block { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.off-block > summary { cursor: pointer; color: var(--primary-600); font-size: .9rem; }
.off-block .hs-title { color: var(--muted); }

/* ── набор привычек (админ) ── */
.legend-list { margin: 4px 0 6px; padding-left: 18px; }
.ah-row { display: flex; align-items: center; gap: 6px 8px; padding: 9px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.ah-row:first-child { border-top: 0; }
.ah-title { flex: 1 1 220px; min-width: 0; }
.ah-row select { width: auto; padding: 4px 8px; font-size: .85rem; }

/* ── админ ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-weight: 560; color: var(--muted); font-size: .8rem; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--primary-50); }
.mini-bar { width: 80px; height: 6px; background: var(--primary-50); border-radius: 99px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.mini-bar > div { height: 100%; background: var(--primary); }
td select { padding: 4px 8px; font-size: .85rem; width: auto; }
.cat-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 14px 0 2px; }
.cat-title:first-of-type { padding-top: 2px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; max-width: calc(100% - 32px); z-index: 20; }

/* ── нижнее меню (телефон) ── */
.tabbar { display: none; }
.topbar { padding-top: env(safe-area-inset-top, 0px); }

@media (max-width: 640px) {
  .week-strip { gap: 6px; grid-auto-columns: calc((100% - 6 * 6px) / 7); margin-bottom: 12px; }
  .wcircle { width: 40px; height: 40px; }
  .hero { gap: 14px; padding: 14px; }
  .ring { width: 92px; height: 92px; }
  .ring-label b { font-size: 1.25rem; }
  .hero-text h1 { font-size: 1.15rem; }
  .prayers { gap: 6px; }
  .prayer-btn { padding: 10px 0 8px; border-radius: 14px; }
  .prayer-name { font-size: .74rem; }
  body { -webkit-tap-highlight-color: transparent; }
  .container { padding: 14px 12px 24px; }
  body.has-tabbar .container { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  h1 { font-size: 1.25rem; }
  .card { padding: 14px 12px; border-radius: 12px; margin-bottom: 12px; }
  .card.group { padding: 0; }
  .group-head { padding: 13px 12px; }
  .group-body { padding: 0 12px 10px; }

  /* Верх — только логотип и «Выйти», навигация — снизу */
  .topbar-inner { padding: 8px 12px; }
  .desktop-only { display: none; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    background: rgba(255, 255, 255, .97); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  }
  .tabbar[hidden] { display: none; }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--muted); font-size: .7rem; font-weight: 560; border-radius: 10px; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--primary-600); }
  .tabbar a.active svg { background: var(--primary-50); border-radius: 99px; padding: 0 12px; width: 48px; box-sizing: content-box; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

  /* Поля 16px — iOS не увеличивает страницу при фокусе */
  input[type=text], input[type=password], input[type=number], input[type=time], select, textarea { font-size: 16px; }
  .habit .time-input, .chip-input { font-size: 16px !important; }

  /* Крупнее зоны нажатия */
  .habit { padding: 12px 0; gap: 12px; }
  .check { width: 34px; height: 34px; font-size: 17px; margin-top: 0; }
  .chip { padding: 6px 12px; font-size: .85rem; }
  .icon-btn { width: 36px; height: 36px; font-size: 16px; }
  .btn { padding: 10px 16px; }
  .btn.sm { padding: 7px 12px; }


  .stat { padding: 10px 12px; }
  .stats { gap: 8px; }
  .stat .v { font-size: 1.15rem; }
  .ps-grid { gap: 5px; }
  .ps-item { padding: 10px 2px 8px; border-radius: 12px; }
  .ps-item b { font-size: .92rem; }
  .ps-name { font-size: .7rem; }
  .streaks { gap: 6px; }
  .streak { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; }
  .streak b { font-size: 1.45rem; }
  .streak span { font-size: .74rem; }
  .heat-grid, .heat-months { gap: 3px; }
  .heat-grid { grid-template-columns: repeat(13, minmax(0, 1fr)); }
  .heat-months { grid-template-columns: repeat(13, minmax(0, 1fr)); }
  .hc { border-radius: 4px; }
  .legend-hint { margin-left: 0; width: 100%; }


  /* Таблицы → карточки */
  .users-table thead { display: none; }
  .users-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .users-table td { border: 0; padding: 0; }
  .users-table td:first-child { flex-basis: 100%; }
  .users-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .8rem; }

  body.auth-page .container { padding: 0; }
  .auth { padding: 0; min-height: 100vh; place-items: stretch; }
  .auth-card { grid-template-columns: 1fr; border-radius: 0; box-shadow: none; }
  .auth-art { margin: 0; min-height: 470px; border-radius: 0 0 28px 28px; padding: calc(22px + env(safe-area-inset-top, 0px)) 22px 0; }
  .auth-art h1 { font-size: 1.85rem; margin-top: 26px; }
  .auth-art p { font-size: .95rem; }
  .auth-scene { height: auto; aspect-ratio: 400 / 460; bottom: -22px; }
  .auth-form { padding: 26px 20px 28px; min-height: 0; }
  .auth-switch { margin-bottom: 20px; font-size: .95rem; }
  .auth-submit { margin-top: 8px; }
}
