/* 12.11.2026 (v2): демо-PWA. Палитра сайта (кремовый фон, графитовый текст, бирюза, терракота), системные шрифты,
   шаг отступов 8px, шкала шрифта 13/15/17/20/24, тёмная тема, reduced-motion, касания не меньше 44px. */
:root {
  --bg: #fbfaf6; --surface: #ffffff; --surface-2: #f3f1ea; --text: #211d16; --muted: #5c5548; --line: #d8d5cc;
  --teal: #1a8a7a; --teal-ink: #0f5f54; --teal-weak: #e3f3f0; --terra: #b5532f; --terra-ink: #8c3c1f; --terra-weak: #f7e6dd;
  --me: #0f5f54; --on-me: #ffffff; --shadow: 0 1px 2px rgba(33,29,22,.06), 0 4px 16px rgba(33,29,22,.06);
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --r: 14px;
  --f1: 13px; --f2: 15px; --f3: 17px; --f4: 20px; --f5: 24px;
  --bar-h: 56px; --tab-h: 64px; --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171a17; --surface: #212521; --surface-2: #2a2f2a; --text: #f1eee6; --muted: #b9b3a6; --line: #3a403a;
    --teal: #4cc2ad; --teal-ink: #7fd8c7; --teal-weak: #1d3631; --terra: #e58a63; --terra-ink: #f0a585; --terra-weak: #3b2820;
    --me: #2f8f7f; --on-me: #ffffff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font: var(--f2)/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
p { margin: 0 0 var(--s1); }
a { color: var(--teal-ink); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s1); top: -60px; z-index: 50; background: var(--text); color: var(--bg); padding: var(--s1) var(--s2); border-radius: 8px; }
.skip:focus { top: var(--s1); }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* шапка */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s1); min-height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--s2), env(safe-area-inset-right)) 0 max(var(--s2), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.bar__logo { border-radius: 9px; }
.bar__text { min-width: 0; flex: 1; }
.bar__title { margin: 0; font-size: var(--f3); line-height: 1.2; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__sub { margin: 0; font-size: var(--f1); color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--f1); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.pill[data-off]::before { background: var(--terra); }
.chip-install { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px; border: 1px solid var(--teal); border-radius: 999px; background: var(--teal-weak); color: var(--teal-ink); font-size: var(--f1); font-weight: 600; cursor: pointer; }
.chip-install .ic { width: 16px; height: 16px; }
.chip-install[hidden] { display: none; }

/* панели */
main { max-width: 680px; margin: 0 auto; padding: var(--s2) max(var(--s2), env(safe-area-inset-right)) var(--s3) max(var(--s2), env(safe-area-inset-left)); outline: none; }
.panel[hidden] { display: none; }
.panel { animation: enter .28s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.lead { color: var(--muted); font-size: var(--f2); margin-bottom: var(--s2); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s2); margin: 0 0 var(--s2); box-shadow: var(--shadow); }
fieldset.card { min-width: 0; }
legend { font-weight: 700; font-size: var(--f2); padding: 0; float: left; width: 100%; margin-bottom: var(--s1); }
legend + * { clear: both; }
.h2 { font-size: var(--f3); margin: 0 0 var(--s1); }
.h3 { font-size: var(--f2); margin: var(--s2) 0 var(--s1); }
.eyebrow { font-size: var(--f1); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.fine { font-size: var(--f1); color: var(--muted); }
.fine--demo { border-left: 3px solid var(--terra); padding-left: var(--s1); }
.label { display: block; font-weight: 600; margin-bottom: var(--s1); }
.banner { display: flex; gap: var(--s1); align-items: flex-start; padding: 12px var(--s2); border-radius: var(--r); background: var(--terra-weak); color: var(--terra-ink); font-size: var(--f2); margin-bottom: var(--s2); }
.banner[hidden] { display: none; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); min-height: 44px; padding: 0 var(--s2); border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer; transition: transform .12s var(--ease), background-color .2s; }
.btn--primary { background: var(--teal-ink); border-color: var(--teal-ink); color: #fff; }
@media (prefers-color-scheme: dark) { .btn--primary { background: var(--teal); border-color: var(--teal); color: #10201c; } }
.btn--quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn:active, .send:active, .chip:active, .tabbar button:active, .chip-install:active, .iconbtn:active { transform: scale(.96); }
.btn[hidden] { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
.iconbtn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn .ic { width: 18px; height: 18px; }
.linkish { background: none; border: 0; padding: 0; color: var(--teal-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }

/* чат */
.chat { list-style: none; margin: 0 0 var(--s2); padding: 0; display: grid; gap: 12px; }
.msg { max-width: 86%; display: grid; gap: 4px; animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.msg__bubble { padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--bot { justify-self: start; }
.msg--bot .msg__bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg--me { justify-self: end; }
.msg--me .msg__bubble { background: var(--me); color: var(--on-me); border-bottom-right-radius: 6px; }
.msg--sys .msg__bubble { background: var(--terra-weak); color: var(--terra-ink); }
.msg__meta { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.msg--me .msg__meta { justify-content: flex-end; }
.msg__meta .iconbtn { width: 36px; height: 36px; }
.msg__links { display: flex; flex-wrap: wrap; gap: var(--s1); }
.msg__links a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; background: var(--teal-weak); color: var(--teal-ink); font-size: var(--f1); font-weight: 600; text-decoration: none; }
.typing .msg__bubble { display: grid; gap: 8px; min-width: 180px; }
.dotsx { display: inline-flex; gap: 4px; }
.dotsx i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.dotsx i:nth-child(2) { animation-delay: .15s; } .dotsx i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.skel { height: 10px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.skel--s { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.chips { display: flex; gap: var(--s1); overflow-x: auto; padding: 2px 2px var(--s1); margin: 0 calc(-1 * var(--s2)) var(--s1); padding-inline: var(--s2); scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 44px; padding: 0 var(--s2); border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; scroll-snap-align: start; transition: transform .12s var(--ease); }
.chip:hover { border-color: var(--teal); }
.composer { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + var(--s1)); z-index: 5; display: flex; align-items: flex-end; gap: var(--s1); padding: 6px; margin-bottom: var(--s2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.composer textarea { flex: 1; min-height: 44px; max-height: 140px; padding: 10px 12px; border: 0; background: transparent; resize: none; outline: none; line-height: 1.5; }
.composer:focus-within { border-color: var(--teal); }
.send { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--teal-ink); color: #fff; cursor: pointer; flex: none; transition: transform .12s var(--ease); }
@media (prefers-color-scheme: dark) { .send { background: var(--teal); color: #10201c; } }
.send:disabled { opacity: .45; cursor: default; }

/* смета */
.sticky-sum { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top) + var(--s1)); z-index: 6; display: flex; justify-content: space-between; align-items: center; gap: var(--s1);
  padding: 10px var(--s2); margin-bottom: var(--s2); border-radius: 999px; background: var(--text); color: var(--bg); font-size: var(--f2); box-shadow: var(--shadow); }
.sticky-sum strong { font-weight: 700; }
.sticky-sum span { opacity: .85; font-size: var(--f1); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; gap: 4px; border-radius: 12px; background: var(--surface-2); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: grid; place-items: center; min-height: 44px; padding: 0 var(--s1); border-radius: 9px; text-align: center; font-weight: 600; font-size: var(--f2); cursor: pointer; color: var(--muted); transition: background-color .2s, color .2s, box-shadow .2s; }
.seg input:checked + label { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg input:focus-visible + label { outline: 3px solid var(--teal); outline-offset: 1px; }
.toggles { display: grid; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 52px; border-top: 1px solid var(--line); cursor: pointer; }
.toggle:first-child { border-top: 0; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; flex: none; width: 51px; height: 31px; border-radius: 999px; background: var(--line); transition: background-color .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .22s var(--ease); }
.toggle input:checked + .switch { background: var(--teal); }
.toggle input:checked + .switch::after { transform: translateX(20px); }
.toggle input:focus-visible + .switch { outline: 3px solid var(--teal); outline-offset: 2px; }
.result { border-top: 4px solid var(--teal); }
.result__name { font-size: var(--f5); margin: 4px 0; }
.result__price { font-size: var(--f4); font-weight: 700; color: var(--terra-ink); margin: 0; }
.result__time { color: var(--muted); }
.result.bump { animation: bump .3s var(--ease); }
@keyframes bump { 50% { transform: scale(1.015); } }
.ticks, .dots { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.ticks li, .dots li { position: relative; padding-left: 26px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: .35em; width: 14px; height: 8px; border-left: 2.5px solid var(--teal); border-bottom: 2.5px solid var(--teal); transform: rotate(-45deg); }
.dots li::before { content: ""; position: absolute; left: 6px; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--terra); }

/* заметки */
.note-form textarea, .search input, select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.note-form textarea { resize: vertical; }
.search { position: relative; margin-bottom: var(--s2); }
.search .ic { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.search input { padding-left: 42px; background: var(--surface); }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.note { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--s1); padding: 12px 8px 12px var(--s2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); animation: pop .22s var(--ease); }
.note--editing { border-color: var(--teal); }
.note__text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note__time { grid-column: 1; font-size: 12px; color: var(--muted); margin: 0; }
.note__acts { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: flex-start; }
.empty { text-align: center; padding: var(--s3) var(--s2); }
.empty[hidden] { display: none; }
.empty__art { width: 120px; height: 96px; margin-bottom: var(--s1); }
.empty__art .a1 { fill: var(--surface-2); } .empty__art .a2 { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.empty__art .a3 { stroke: var(--line); stroke-width: 4; stroke-linecap: round; } .empty__art .a4 { fill: var(--terra); opacity: .8; }
.empty__title { font-weight: 700; font-size: var(--f3); margin-bottom: 4px; }

/* о приложении */
.app-card { display: flex; align-items: center; gap: var(--s2); }
.app-card img { border-radius: 16px; }
.app-card__name { font-size: var(--f4); font-weight: 700; margin: 0; }
.info { margin: 0; display: grid; }
.info > div { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); min-height: 48px; border-top: 1px solid var(--line); }
.info > div:first-child { border-top: 0; }
.info dt { color: var(--muted); } .info dd { margin: 0; font-weight: 600; }
.info select { width: auto; min-width: 150px; }
.links { list-style: none; margin: 0; padding: 0; display: grid; }
.links li { min-height: 44px; display: flex; align-items: center; border-top: 1px solid var(--line); }
.links li:first-child { border-top: 0; }

/* нижняя навигация */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-top: 1px solid var(--line); }
.tabbar button { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: var(--tab-h); border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; transition: color .2s, transform .12s var(--ease); }
.tabbar button span { max-width: 100%; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabbar button[aria-selected="true"] { color: var(--teal-ink); }
.tabbar button[aria-selected="true"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--teal); }
.tabbar button[aria-selected="true"] .ic { fill: var(--teal-weak); }

/* тост */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + var(--s2)); z-index: 40; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); padding: 12px 20px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 600; font-size: var(--f2); box-shadow: var(--shadow); transition: opacity .2s, transform .25s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast--err { background: var(--terra-ink); color: #fff; }

/* знакомство */
.onb { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-columns: minmax(0, 1fr); align-items: end; background: rgba(20,18,14,.45); }
.onb[hidden] { display: none; }
.onb__sheet { background: var(--surface); border-radius: 24px 24px 0 0; padding: var(--s3) 0 calc(var(--s2) + env(safe-area-inset-bottom)); animation: up .35s var(--ease); max-width: 680px; width: 100%; min-width: 0; margin: 0 auto; overflow: hidden; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.onb__track { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; outline: none; }
.onb__track::-webkit-scrollbar { display: none; }
.onb__card { scroll-snap-align: center; padding: 0 var(--s3); }
.onb__icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--teal-weak); color: var(--teal-ink); margin-bottom: var(--s2); }
.onb__icon .ic { width: 32px; height: 32px; }
.onb__card:nth-child(2) .onb__icon { background: var(--terra-weak); color: var(--terra-ink); }
.onb__card h2 { font-size: var(--f5); margin: 0 0 var(--s1); }
.onb__card p { color: var(--muted); font-size: var(--f3); }
.onb__dots { display: flex; justify-content: center; gap: 6px; margin: var(--s2) 0; }
.onb__dots i { width: 8px; height: 8px; border-radius: 999px; background: var(--line); transition: width .2s, background-color .2s; }
.onb__dots i.on { width: 22px; background: var(--teal); }
.onb__actions { display: flex; justify-content: space-between; padding: 0 var(--s3); }

@media (min-width: 720px) { .chips { margin-inline: 0; padding-inline: 2px; flex-wrap: wrap; overflow: visible; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
