* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 400 15px/1.4 Onest, system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
a:hover { color: var(--accent-press); }
img { display: block; }
.num { font-variant-numeric: tabular-nums; }
::-webkit-scrollbar { width: 0; height: 0; }
.chips, .hscroll { scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar, .hscroll::-webkit-scrollbar { display: none; }
.drag-scroll { cursor: grab; }
.drag-scroll img { -webkit-user-drag: none; user-select: none; }
.drag-scroll.dragging { cursor: grabbing; scroll-snap-type: none !important; scroll-behavior: auto; }
.drag-scroll.dragging * { pointer-events: none; user-select: none; }

/* layout */
.app { max-width: 480px; min-height: var(--tg-vh, 100dvh); padding-top: var(--tg-safe-top, 0px); margin: 0 auto; background: var(--bg); position: relative; }
.screen { padding: 16px 18px calc(24px + var(--bottom-space, 0px)); display: flex; flex-direction: column; gap: 18px; animation: fade-in 0.22s ease; }
.screen.flush { padding-left: 0; padding-right: 0; }
.screen.flush .pad { padding-left: 18px; padding-right: 18px; }
.app.has-nav { --bottom-space: 84px; }
.app.has-nav.has-cartbar { --bottom-space: 150px; }
.app.has-mb { --bottom-space: 84px; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@keyframes wave { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }

/* type */
.h1 { margin: 0; font: 600 26px/1.15 Onest, sans-serif; letter-spacing: -0.015em; }
.h2 { margin: 0; font: 600 18px/1.25 Onest, sans-serif; }
.h3 { margin: 0; font: 600 15.5px/1.3 Onest, sans-serif; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.baseline { align-items: baseline; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.tight { gap: 3px; }
.grow { flex: 1; min-width: 0; }

/* logo */
.logo { width: 168px; height: auto; }
.logo.sm { width: 112px; }
[data-theme='dark'] .logo { filter: invert(1) hue-rotate(180deg) brightness(1.1); }
.logo-caption { font: 600 12px/1 Onest; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* buttons */
.btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font-weight: 600; font-size: 15px; transition: transform 0.08s, background 0.15s; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-press); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: none; color: var(--accent); padding: 0 6px; }
.btn-danger { background: var(--surface); border-color: var(--line); color: var(--late); }
.btn-lg { height: 52px; font-size: 16px; border-radius: 14px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
.add-btn { width: 36px; height: 36px; border-radius: 18px; border: 0; background: var(--surface); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(40, 20, 10, 0.16); }
.add-btn.soft { background: var(--accent-soft); box-shadow: none; width: 40px; height: 40px; border-radius: 20px; }

/* telegram fallbacks (outside Telegram only) */
.mb-fallback { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px; padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); z-index: 30; }
.app.has-nav .mb-fallback { bottom: calc(70px + env(safe-area-inset-bottom)); border-top: 0; }
.back-fallback { position: sticky; top: 0; z-index: 25; display: block; width: 100%; height: 44px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line); background: var(--bg); color: var(--accent); text-align: left; font-weight: 500; font-size: 15px; }

/* cards & surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.card.pad { padding: 16px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); min-height: 52px; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.list-item:last-child { border-bottom: 0; }
.summary { background: var(--surface-2); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.summary .total { font-weight: 600; font-size: 18px; }
.divider { height: 1px; background: var(--line); }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; font-weight: 500; font-size: 14px; line-height: 1.35; }
.banner.deadline { background: var(--accent-soft); color: var(--accent); }
.banner.deadline b { font-weight: 700; }
.banner.calm { background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-align: left; width: 100%; }
.banner.warn { background: var(--wait-soft); color: var(--wait); }
.dot { width: 8px; height: 8px; border-radius: 4px; flex: none; }

/* chips & segmented */
.chips { display: flex; gap: 6px; overflow-x: auto; scroll-padding-inline: 16px; }
.chips.wrap { flex-wrap: wrap; }
.chip { flex: none; white-space: nowrap; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 13.5px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 11px; background: var(--surface-2); }
.seg button { height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

.tag { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 7px; font-weight: 600; font-size: 11px; white-space: nowrap; }
.tag.new { background: var(--pink-soft); color: var(--pink-ink); }
.tag.ordered { background: rgba(255, 255, 255, 0.94); color: #1f68c2; }
.tag.outline { border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.ai-badge { display: inline-flex; align-items: center; padding: 3px 5px; border: 1px solid var(--line); border-radius: 5px; font: 600 10px/1 Onest; letter-spacing: 0.04em; color: var(--muted); flex: none; }

.status { display: inline-flex; padding: 4px 10px; border-radius: 8px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.tone-wait { background: var(--wait-soft); color: var(--wait); }
.tone-work { background: var(--work-soft); color: var(--work); }
.tone-done { background: var(--done-soft); color: var(--done); }
.tone-late { background: var(--late-soft); color: var(--late); }
.tone-accent { background: var(--accent-soft); color: var(--accent); }
.tone-neutral { background: var(--surface-2); color: var(--muted); }

/* photos */
.photo { position: relative; border-radius: 16px; overflow: hidden; background: var(--surface-2); aspect-ratio: 1; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 45%, var(--surface) 0 32%, var(--surface-2) 33%); color: var(--muted); font: 600 11px Onest; letter-spacing: 0.06em; text-transform: uppercase; }
.photo .tags { position: absolute; left: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.photo .corner { position: absolute; right: 8px; bottom: 8px; }

/* dessert card */
.dcard { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dcard .photo { cursor: pointer; }
.dcard-name { font-weight: 500; font-size: 14.5px; line-height: 1.25; }
.dcard-meta { font-size: 13px; color: var(--muted); }
.dcard-meta b { color: var(--ink); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
.hscroll { display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; padding: 2px 18px 4px; scroll-snap-type: x mandatory; scroll-padding-inline: 18px; }
.hscroll::after { content: ''; flex: 0 0 8px; }
.hscroll > * { flex: none; scroll-snap-align: start; }
.hscroll .dcard { width: 136px; }
.hscroll.wide .dcard { width: min(64vw, 240px); }
.hscroll.wide .photo { aspect-ratio: 4 / 5; }

.overlay-stepper { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 40px; border-radius: 20px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: space-between; }
.overlay-stepper button { width: 44px; height: 40px; border: 0; background: none; color: inherit; font-size: 20px; }

.stepper { display: inline-flex; align-items: center; height: 40px; border-radius: 12px; background: var(--surface-2); flex: none; }
.stepper button { width: 40px; height: 40px; border: 0; background: none; font-size: 20px; }
.stepper span { min-width: 24px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper.lg { height: 52px; border-radius: 14px; }
.stepper.lg button { width: 46px; height: 52px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { height: 104px; border-radius: 16px; border: 0; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left; font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.tile.t1 { background: var(--tile-1); color: var(--tile-1-ink); }
.tile.t2 { background: var(--tile-2); color: var(--tile-2-ink); }
.tile.t3 { background: var(--tile-3); color: var(--tile-3-ink); }
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px 0; }

/* thumbs */
.thumb { width: 54px; height: 54px; border-radius: 12px; flex: none; }
.thumb.sm { width: 44px; height: 44px; border-radius: 10px; }
.qty-badge { position: absolute; right: -4px; bottom: -4px; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font: 600 11px/18px Onest; text-align: center; }

/* inputs */
.field { width: 100%; height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); padding: 0 16px; font-size: 16px; outline: none; }
.field:focus { border-color: var(--accent); }
.field.error { border-color: var(--late); }
textarea.field { height: 88px; padding: 12px 14px; resize: none; line-height: 1.4; }
.search { display: flex; align-items: center; gap: 8px; height: 44px; border-radius: 12px; background: var(--surface-2); padding: 0 12px; color: var(--muted); }
.search input { flex: 1; border: 0; background: none; outline: none; font-size: 16px; color: var(--ink); }
.label { font-weight: 600; font-size: 15px; }
.error-text { color: var(--late); font-size: 13px; }

/* bottom nav & cart bar */
.bottom-nav { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); z-index: 20; }
.nav-item { height: 54px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-weight: 500; font-size: 11px; }
.nav-item.active { color: var(--accent); }
.cart-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); width: calc(100% - 24px); max-width: 456px; height: 54px; border-radius: 16px; border: 0; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: space-between; padding: 0 18px; font-weight: 600; z-index: 21; box-shadow: 0 10px 24px -10px rgba(20, 70, 140, 0.5); animation: fade-in 0.2s; }

/* sheet */
.sheet-backdrop { position: fixed; inset: 0; background: var(--backdrop); z-index: 40; animation: fade-in 0.2s; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px; max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; z-index: 41; animation: sheet-up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes sheet-up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.sheet-hero { position: relative; height: 280px; background: var(--surface-2); }
.sheet-hero img { width: 100%; height: 100%; object-fit: cover; }
.sheet-close { position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 18px; border: 0; background: rgba(255, 255, 255, 0.92); color: #2b1b17; display: flex; align-items: center; justify-content: center; }
.sheet-body { padding: 18px 18px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.info-row { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: 0; }
.info-row svg { flex: none; color: var(--muted); margin-top: 1px; }

/* swipe row */
.swipe { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.swipe:last-child { border-bottom: 0; }
.swipe-del { position: absolute; top: 0; right: 0; bottom: 0; width: 96px; border: 0; background: var(--late); color: #fff; font-weight: 600; font-size: 14px; }
.swipe-body { position: relative; display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--surface); touch-action: pan-y; transition: transform 0.18s; }
.swipe-body.dragging { transition: none; }

/* timeline */
.timeline { display: flex; flex-direction: column; }
.tl-step { display: flex; gap: 12px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; width: 22px; }
.tl-dot { width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--on-accent); flex: none; }
.tl-step.done .tl-dot { background: var(--accent); border-color: var(--accent); }
.tl-step.current .tl-dot { background: var(--surface); border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--accent); }
.tl-step.canceled .tl-dot { background: var(--late); border-color: var(--late); }
.tl-line { flex: 1; width: 2px; min-height: 18px; background: var(--line); }
.tl-step.done .tl-line { background: var(--accent); }
.tl-step:last-child .tl-line { visibility: hidden; }
.tl-text { display: flex; flex-direction: column; gap: 2px; padding-bottom: 16px; }
.tl-step.todo .tl-text { color: var(--muted); }

/* assistant chat */
.chat { display: flex; flex-direction: column; gap: 10px; padding: 14px 14px calc(24px + var(--composer-h, 120px)); }
.bubble { max-width: 84%; padding: 11px 14px; border-radius: 18px 18px 18px 6px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; line-height: 1.45; align-self: flex-start; animation: fade-in 0.22s; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-color: var(--accent); border-radius: 18px 18px 6px 18px; }
.bubble.media { display: flex; align-items: center; gap: 10px; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 3px; background: currentColor; animation: pulse 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; } .typing i:nth-child(3) { animation-delay: 0.4s; }
.wave { display: flex; align-items: center; gap: 2px; height: 24px; }
.wave i { width: 3px; border-radius: 2px; background: currentColor; }
.wave.live i { height: 26px; animation: wave 0.9s ease-in-out infinite; }
.file-icon { width: 36px; height: 42px; border-radius: 7px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font: 700 9px Onest; flex: none; background: var(--on-accent); color: var(--accent); }
.draft { align-self: stretch; padding: 14px; display: flex; flex-direction: column; gap: 12px; animation: fade-in 0.25s; }
.draft-row { display: flex; align-items: center; gap: 10px; padding: 6px; margin: 0 -6px; border-radius: 12px; }
.draft-row.changed { background: var(--done-soft); }
.draft-row .was { color: var(--done); font-weight: 600; }
.draft-q { padding: 10px 12px; border-radius: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; font-weight: 500; line-height: 1.4; }
.draft-q.amb { background: var(--wait-soft); }
.draft-q.nf { background: var(--surface-2); }
.choice { height: 36px; padding: 0 12px; border-radius: 18px; border: 1.5px solid var(--accent); background: none; color: var(--accent); font-weight: 600; font-size: 13px; }
.choice.active { background: var(--accent); color: var(--on-accent); }
.transcript { font-size: 13.5px; color: var(--muted); font-style: italic; }
.suggest { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); font-size: 13.5px; }
.composer { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; background: var(--bg); border-top: 1px solid var(--line); padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; z-index: 20; }
.composer-input { flex: 1; min-width: 0; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px; font-size: 15px; outline: none; }
.round { width: 44px; height: 44px; border-radius: 22px; border: 0; flex: none; display: flex; align-items: center; justify-content: center; }
.round.primary { background: var(--accent); color: var(--on-accent); }
.round.soft { background: var(--accent-soft); color: var(--accent); }
.round.plain { background: none; color: var(--muted); }
.rec-dot { width: 10px; height: 10px; border-radius: 5px; background: var(--late); animation: pulse 1s infinite; }

/* toggle */
.toggle { width: 48px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; transition: background 0.2s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 11px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: left 0.2s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { left: 23px; }

.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 600; flex: none; }
.radio { width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; flex: none; }
.radio.on { border-color: var(--accent); }
.radio.on::after { content: ''; width: 10px; height: 10px; border-radius: 5px; background: var(--accent); }

.date-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.date-chip { min-height: 62px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); padding: 8px 14px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; text-align: left; }
.date-chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.date-chip.urgent .sub { color: var(--pink-ink); }
.date-chip .sub { font-size: 12.5px; opacity: 0.85; }

.success-mark { width: 96px; height: 96px; border-radius: 48px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 40px 24px; color: var(--muted); }
.empty-icon { width: 88px; height: 88px; border-radius: 44px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.venue-photo { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 0; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(110px + env(safe-area-inset-bottom)); width: calc(100% - 32px); max-width: 448px; padding: 12px 16px; border-radius: 14px; background: rgba(30, 20, 16, 0.94); color: #fff; font-weight: 500; font-size: 14px; text-align: center; z-index: 60; animation: fade-in 0.2s; }

/* presentation mode: no in-page back bar (Telegram shows its own) */
[data-demo] .back-fallback { display: none !important; }
[data-demo] body { overflow-x: hidden; }

/* screenshot frame: 390×844, fixed elements pinned to the frame */
[data-shot], [data-shot] body { margin: 0; overflow: hidden; background: var(--bg); }
[data-shot] #root { width: 390px; height: 844px; overflow: hidden; position: relative; transform: translateY(var(--shot-y, 0px)) scale(var(--shot-s, 1)); transform-origin: 0 0; }
[data-shot] .app { height: 844px; min-height: 0; overflow-y: auto; max-width: none; scrollbar-width: none; }
[data-shot] .app::-webkit-scrollbar { display: none; }
[data-shot] .sheet { max-height: 790px; }
[data-shot] .toast { display: none; }
[data-shot] * { scrollbar-width: none; }
[data-shot] *::-webkit-scrollbar { display: none; }
