
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #e9decf; color: var(--text); font-family: var(--font); }
body { -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
img[hidden], [hidden] { display: none !important; }
svg { display: block; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 18px; height: 18px; }
.icon--lg { width: 28px; height: 28px; }

.app-stage { min-height: 100dvh; display: grid; place-items: start center; padding: 0; }
.app-shell { width: min(100%, 430px); min-height: 100dvh; background: var(--bg); position: relative; overflow: hidden; box-shadow: 0 18px 60px rgba(55, 38, 22, .12); }
.app-shell::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .34; background: radial-gradient(circle at 12% 7%, rgba(255,255,255,.74), transparent 22%), radial-gradient(circle at 88% 18%, rgba(255,255,255,.38), transparent 26%), repeating-linear-gradient(0deg, rgba(107,80,52,.018) 0 1px, transparent 1px 4px); }
.app-screen { position: relative; z-index: 1; width: 100%; min-width: 0; min-height: 100dvh; padding: calc(16px + var(--safe-top)) 16px calc(92px + var(--safe-bottom)); display: none; overflow-x: hidden; }
.app-screen.is-active { display: block; }
.screen-stack { display: grid; gap: 12px; min-width: 0; max-width: 100%; }
.screen-stack > * { min-width: 0; max-width: 100%; }

.app-header { min-height: 46px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.brand-kicker { margin: 0 0 2px; color: var(--terracotta); font-size: 8.5px; line-height: 1; font-weight: 820; letter-spacing: .055em; text-transform: uppercase; }
.app-header__title { margin: 0; font-size: 1.375rem; line-height: 1.08; font-weight: 880; letter-spacing: -.035em; overflow-wrap: break-word; hyphens: auto; }
.app-header__meta { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.app-header__center { align-self: center; text-align: center; flex: 1; }
.app-header__center .app-header__title { font-size: 1rem; }
.header-actions { display: flex; gap: 8px; }
.icon-button { border: 1px solid var(--line); background: rgba(251,246,238,.82); color: var(--text); width: 38px; height: 38px; border-radius: 14px; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 10px rgba(72,50,28,.04); }
.icon-button.is-active { color: var(--terracotta); border-color: rgba(185,112,84,.35); background: #fff7ef; }
.icon-button--ghost { background: transparent; border-color: transparent; box-shadow: none; }

.card { background: rgba(251,246,238,.96); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }
.section-title { margin: 0; font-size: 15px; line-height: 1.2; font-weight: 820; letter-spacing: -.018em; }
.section-copy { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }

.hero-card { display: grid; grid-template-columns: minmax(92px,118px) minmax(0, 1fr); gap: 14px; min-height: 254px; padding: 14px; border-radius: var(--radius-xl); background: linear-gradient(140deg, rgba(251,246,238,.98), rgba(247,234,219,.96)); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; right: -22px; bottom: -35px; width: 120px; height: 120px; border: 1px solid rgba(185,112,84,.09); border-radius: 50%; box-shadow: 0 0 0 18px rgba(185,112,84,.025), 0 0 0 36px rgba(185,112,84,.018); }
.mood-frame { height: 154px; align-self: start; display: grid; place-items: center; border-radius: 20px; background: #efe2d0; padding: 6px; overflow: hidden; transform: rotate(-1.5deg); box-shadow: 0 10px 18px rgba(72,50,28,.09); }
.mood-frame img { width: 100%; height: 100%; object-fit: contain; }
.hero-copy { min-width: 0; position: relative; z-index: 1; }
.state-chip, .chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 9px; font-size: 10px; font-weight: 760; line-height: 1; border: 1px solid rgba(185,112,84,.15); background: #f2dfcd; color: var(--text); }
.hero-title { margin: 10px 0 7px; font-size: 1.25rem; line-height: 1.16; font-weight: 860; letter-spacing: -.035em; overflow-wrap: break-word; hyphens: auto; }
.hero-summary { margin: 0; color: #52627d; font-size: .8125rem; line-height: 1.42; overflow-wrap: break-word; hyphens: auto; }
.hero-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn { border: 0; border-radius: 14px; min-height: 38px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-weight: 800; font-size: 12px; text-decoration: none; }
.btn--primary { background: var(--terracotta); color: white; box-shadow: 0 7px 15px rgba(185,112,84,.24); }
.btn--secondary { background: rgba(255,255,255,.54); border: 1px solid var(--line); color: var(--text); }
.btn--text { background: transparent; color: var(--text); padding-inline: 4px; }

.indicator-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.indicator-card { min-height: 88px; min-width: 0; padding: 12px; display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 10px; align-items: start; }
.indicator-card > div:last-child { min-width: 0; }
.indicator-icon { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; }
.indicator-card[data-tone="sage"] .indicator-icon { color: #6f8664; background: #dbe2d5; }
.indicator-card[data-tone="gold"] .indicator-icon { color: #bd8f43; background: #f2e3c6; }
.indicator-card[data-tone="blush"] .indicator-icon { color: #b9796b; background: #edd6d0; }
.indicator-card[data-tone="blue"] .indicator-icon { color: #6d8797; background: #dce5e9; }
.indicator-label { color: var(--muted); font-size: 10px; line-height: 1.1; font-weight: 700; }
.indicator-state { margin-top: 3px; font-size: 1rem; line-height: 1.12; font-weight: 850; letter-spacing: -.02em; overflow-wrap: break-word; hyphens: auto; }
.indicator-delta { margin-top: 4px; color: #5f6c82; font-size: 9.7px; line-height: 1.25; }

.state-card { padding: 14px; }
.state-wave-layout { display: grid; grid-template-columns: 1.25fr .75fr; gap: 12px; align-items: center; }
.wave-legend { display: flex; flex-wrap: wrap; gap: 7px 10px; margin-bottom: 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 700; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.wave-svg { width: 100%; height: auto; overflow: visible; }
.state-summary { padding-left: 10px; border-left: 1px solid var(--line); color: #52627d; font-size: 10.5px; line-height: 1.42; }
.state-summary strong { display: block; color: var(--text); font-size: 12px; line-height: 1.2; margin-bottom: 4px; }

.bottom-nav { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%,430px); min-height: calc(68px + var(--safe-bottom)); padding: 8px 14px calc(8px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(4,1fr); background: rgba(251,246,238,.96); border-top: 1px solid var(--line); backdrop-filter: blur(18px); z-index: 20; }
.nav-link { border: 0; background: transparent; color: var(--muted); display: grid; justify-items: center; gap: 4px; font-size: 9px; line-height: 1; cursor: pointer; text-decoration: none; }
.nav-link .icon { width: 21px; height: 21px; }
.nav-link.is-active { color: var(--navy); font-weight: 820; }
.nav-link.is-active::after { content: ""; width: 20px; height: 2px; background: var(--navy); border-radius: 4px; margin-top: -1px; }

.summary-card { padding: 14px; }
.summary-row { display: flex; align-items: flex-start; gap: 12px; }
.summary-icon { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: #e4eadf; color: #6f8664; flex: 0 0 auto; }
.summary-title { margin: 0; font-size: 15px; line-height: 1.2; font-weight: 850; }
.summary-text { margin: 5px 0 0; color: #58667d; font-size: 11px; line-height: 1.4; }

.accordion { overflow: hidden; }
.accordion + .accordion { margin-top: 9px; }
.accordion-trigger { width: 100%; min-height: 56px; padding: 12px 14px; border: 0; background: transparent; color: var(--text); display: grid; grid-template-columns: 36px 1fr 20px; gap: 10px; text-align: left; align-items: center; cursor: pointer; }
.accordion-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: #efe5d8; color: var(--terracotta); }
.accordion-title { display: block; font-size: 13px; line-height: 1.1; font-weight: 830; }
.accordion-subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: 9.6px; line-height: 1.25; }
.accordion-chevron { transition: transform .2s ease; }
.accordion.is-open .accordion-chevron { transform: rotate(90deg); }
.accordion-body { display: none; padding: 0 14px 14px 60px; }
.accordion.is-open .accordion-body { display: block; }
.metric-line { display: grid; grid-template-columns: 1fr 74px; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid rgba(228,214,197,.75); }
.metric-line:first-child { border-top: 0; }
.metric-line__label { font-size: 10px; line-height: 1.25; color: #56657d; }
.mini-track { height: 7px; border-radius: 99px; background: #e9dfd2; overflow: hidden; }
.mini-track > span { display: block; height: 100%; border-radius: inherit; background: var(--terracotta); }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { display: inline-flex; min-height: 30px; padding: 0 10px; align-items: center; border-radius: 999px; border: 1px solid var(--line); background: #faf3e9; color: #55657d; font-size: 10px; font-weight: 720; }
.audio-row { display: grid; grid-template-columns: 36px 1fr 32px; gap: 9px; align-items: center; padding: 10px; border-radius: 14px; background: #f4eadf; }
.waveform { height: 30px; display: flex; align-items: center; gap: 2px; }
.waveform i { width: 2px; border-radius: 2px; background: #9a806e; display: block; }
.quality-note { padding: 11px; border-radius: 14px; background: #eef1eb; color: #5c695b; font-size: 10px; line-height: 1.4; }
.disclaimer { color: var(--muted); font-size: 9px; line-height: 1.35; text-align: center; padding: 4px 12px; }

.segmented { width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); padding: 4px; border-radius: 14px; background: #eee3d5; gap: 4px; }
.segmented button { border: 0; min-height: 30px; border-radius: 10px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 750; cursor: pointer; }
.segmented button.is-active { background: var(--card); color: var(--text); box-shadow: 0 3px 8px rgba(68,48,28,.06); }
.chart-card { padding: 14px; }
.chart-card .wave-legend { margin-bottom: 10px; }
.chart-shell { position: relative; padding: 4px 0 0; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; margin-top: 4px; }
.context-row { display: flex; flex-wrap: wrap; width: 100%; min-width: 0; max-width: 100%; gap: 8px; overflow: visible; padding: 0 1px 4px; }
.context-chip { border: 1px solid var(--line); background: #f9f1e7; color: #59677d; min-height: 34px; padding: 0 10px; border-radius: 12px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 9.5px; font-weight: 720; cursor: pointer; }
.context-chip.is-active { background: var(--navy); color: white; border-color: var(--navy); }
.timeline-list { display: grid; gap: 9px; }
.timeline-card { min-width: 0; padding: 10px; display: grid; grid-template-columns: 62px minmax(0,1fr) auto; gap: 10px; align-items: center; }
.timeline-thumb { width: 62px; height: 72px; border-radius: 13px; padding: 3px; background: #eadcc9; overflow: hidden; }
.timeline-thumb img { width: 100%; height: 100%; object-fit: contain; }
.timeline-title { margin: 0; font-size: 12px; line-height: 1.2; font-weight: 820; }
.timeline-meta { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.2; }
.dot-scale { display: flex; gap: 3px; }
.dot-scale i { width: 6px; height: 6px; border-radius: 50%; background: #d7cdc0; }
.dot-scale i.on { background: var(--sage); }

.month-title { margin: 2px 0 9px; font-size: 14px; font-weight: 850; }
.history-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.history-card { padding: 8px; text-decoration: none; min-width: 0; }
.history-image { height: 150px; border-radius: 16px; background: #eadcc9; overflow: hidden; display: grid; place-items: center; padding: 4px; }
.history-image img { width: 100%; height: 100%; object-fit: contain; }
.history-date { color: var(--muted); font-size: 8.6px; margin-top: 8px; }
.history-title { margin-top: 3px; font-size: 11px; line-height: 1.2; font-weight: 820; }
.history-tags { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.history-tags span { font-size: 7.5px; color: #657083; padding: 3px 5px; border-radius: 8px; background: #f0e5d7; }

.baseline-hero { padding: 14px; }
.baseline-title { margin: 0; font-size: 16px; line-height: 1.2; font-weight: 850; }
.baseline-copy { margin: 5px 0 0; color: #59677d; font-size: 10.5px; line-height: 1.4; }
.baseline-wave { margin-top: 12px; padding: 12px; border-radius: 18px; background: linear-gradient(180deg,#f6ebdc,#faf3e9); border: 1px solid var(--line); }
.baseline-row { display: grid; grid-template-columns: 72px 1fr 38px; gap: 9px; align-items: center; padding: 8px 0; border-top: 1px solid rgba(228,214,197,.75); }
.baseline-row:first-child { border-top: 0; }
.baseline-label { font-size: 10px; font-weight: 760; }
.range-track { position: relative; height: 8px; border-radius: 99px; background: #e9dfd2; }
.range-band { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: #cdd7c8; }
.range-dot { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: var(--terracotta); border: 3px solid var(--card); box-shadow: 0 1px 4px rgba(80,50,30,.16); transform: translate(-50%,-50%); }
.baseline-state { font-size: 9px; color: var(--muted); text-align: right; }
.info-card { padding: 13px; display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: start; }
.info-card .info-icon { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; background: #e5ebdf; color: #6e8664; }
.info-title { font-size: 12px; line-height: 1.2; font-weight: 820; }
.info-text { margin-top: 4px; color: #5d697d; font-size: 9.8px; line-height: 1.38; }

.component-board { max-width: 1180px; margin: 0 auto; padding: 28px; }
.board-title { margin: 0; font-size: 28px; font-weight: 860; letter-spacing: -.03em; }
.board-copy { margin: 6px 0 20px; color: var(--muted); }
.board-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: 18px; }
.component-panel { padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-soft); }
.component-panel h2 { margin: 0 0 12px; font-size: 15px; }

.preview-board { min-height: 100vh; background: var(--bg); padding: 28px; }
.preview-header { max-width: 2000px; margin: 0 auto 20px; }
.preview-title { margin: 0; font-size: 28px; font-weight: 860; }
.preview-copy { margin: 5px 0 0; color: var(--muted); }
.preview-grid { max-width: 2100px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 390px); gap: 22px; align-items: start; }
.preview-phone { width: 390px; height: 844px; border-radius: 34px; overflow: hidden; background: var(--bg); box-shadow: 0 18px 44px rgba(60,40,20,.12); position: relative; }
.preview-phone .app-screen { display: block; height: 844px; min-height: 844px; overflow: hidden; }
.preview-phone .bottom-nav { position: absolute; left: 0; bottom: 0; transform: none; width: 100%; }
.preview-label { text-align: center; margin-bottom: 8px; font-size: 13px; font-weight: 820; }

body[data-export="true"] .bottom-nav,
body[data-export="true"] .header-actions,
body[data-export="true"] [data-interactive="true"] { display: none !important; }
body[data-export="true"] .app-screen { padding-bottom: 18px; }
body[data-export="true"] .app-shell { width: 390px; min-height: 844px; height: 844px; }

@media (min-width: 700px) {
  .app-stage { padding: 24px; }
  .app-shell { min-height: calc(100dvh - 48px); border-radius: 34px; }
  .app-screen { min-height: calc(100dvh - 48px); }
  .bottom-nav { bottom: 24px; border-radius: 0 0 34px 34px; }
}
@media (max-width: 350px) {
  .hero-card { grid-template-columns: minmax(0,1fr); gap: 12px; padding: 12px; }
  .mood-frame { width: 140px; height: 160px; justify-self: center; }
  .hero-title { font-size: 1.1875rem; }
  .hero-summary { font-size: .75rem; }
  .indicator-grid { grid-template-columns: minmax(0,1fr); }
  .indicator-card { grid-template-columns: 30px minmax(0,1fr); padding: 10px; }
  .indicator-icon { width: 30px; height: 30px; }
}

/* Честные метрики: нет данных */
.metric-line.is-unavailable { grid-template-columns: 1fr auto; opacity: .7; }
.metric-line__hint { font-size: 10px; color: var(--muted); text-align: right; line-height: 1.25; }
.metric-line.is-unavailable .mini-track { display: none; }

/* Trial / paywall */
.entitlement-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: rgba(255,255,255,.55); border: 1px solid rgba(184,140,98,.28); }
.entitlement-card--paywall { background: rgba(215,167,155,.18); border-color: rgba(199,146,134,.45); }
.entitlement-card--ok { background: rgba(135,153,119,.14); border-color: rgba(135,153,119,.35); }
.entitlement-copy { display: grid; gap: 2px; min-width: 0; }
.entitlement-copy strong { font-size: 12px; font-weight: 820; letter-spacing: -.01em; }
.entitlement-copy span { font-size: 10px; color: var(--muted); line-height: 1.35; }
.entitlement-card .btn { flex: 0 0 auto; white-space: nowrap; padding: 8px 12px; font-size: 11px; }
