/* Jarvis PWA (ADR 0049 P1). iPhone-first: the layout is built around a thumb and
   around the fact that iOS paints under the notch and the home indicator. */

:root {
  --ground: #0f0a17;
  --ground-2: #150e20;
  --surface: #1b1426;
  --surface-2: #231a31;
  --line: rgba(255, 255, 255, .07);
  --line-soft: rgba(255, 255, 255, .045);
  --cyan: #38e2dc;
  --cyan-soft: #5cf0e8;
  --magenta: #f04ab4;
  --text: #f5f5f7;
  --muted: #a09aa9;
  --good: #4ade80;
  --tab-h: 62px;
  --pad: 20px;
  --r-card: 22px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--ground);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  /* The page itself never scrolls sideways; only designated boxes may. */
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

b { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* --- Login ---------------------------------------------------------------- */

.gate {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  padding: calc(env(safe-area-inset-top) + 32px) 24px calc(env(safe-area-inset-bottom) + 32px);
  text-align: center;
}
.gate-mark {
  width: 108px; height: 108px;
  background: url("assets/icon.svg") center/contain no-repeat;
  filter: drop-shadow(0 0 24px rgba(56, 226, 220, .35));
}
.gate-title {
  margin: 4px 0 0; font-size: 30px; font-weight: 800; letter-spacing: .22em;
  background: linear-gradient(100deg, var(--cyan-soft), var(--magenta));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gate-sub { margin: 0; color: var(--muted); max-width: 22em; }
.gate-form { display: flex; flex-direction: column; gap: 10px; width: min(320px, 100%); margin-top: 6px; }
.gate-err { color: var(--magenta); margin: 2px 0 0; }

.field {
  width: 100%; padding: 14px 16px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.field:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }

.btn {
  min-height: 48px; padding: 0 20px; font: inherit; font-weight: 600;
  border-radius: 16px; border: 1px solid transparent; cursor: pointer;
}
.btn.primary { background: var(--cyan); color: #092322; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--text); width: 100%; }
.btn:active { transform: translateY(1px); }

.linkish {
  background: none; border: 0; color: var(--cyan); font: inherit; cursor: pointer;
  padding: 10px; min-height: 44px;
}
.linkish.sm { font-size: 13px; min-height: 32px; padding: 4px 6px; }

/* --- Shell ---------------------------------------------------------------- */

.app { min-height: 100dvh; display: flex; flex-direction: column; }

.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
/* Одна заливка на все иконки: контурные, толщина линии общая. Разнобой в
   иконках читается как небрежность быстрее, чем любая другая мелочь. */
svg use, .ico, .round-btn svg { pointer-events: none; }
.ico, .round-btn svg, .act-ico {
  width: 24px; height: 24px; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) var(--pad) 12px;
  background: rgba(15, 10, 23, .93);
  backdrop-filter: blur(18px);
}
.brand {
  font-weight: 650; letter-spacing: .26em; font-size: 15px; color: var(--text);
}
.top-streak { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.top-actions { margin-left: auto; display: flex; gap: 10px; }
.round-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--cyan-soft); display: grid; place-items: center; cursor: pointer;
}
.round-btn.is-on { color: #06121a; background: var(--cyan); border-color: var(--cyan); }
.round-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.screens {
  flex: 1;
  padding: 14px var(--pad) calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px);
}
.screen { display: flex; flex-direction: column; gap: 12px; }

.section { margin: 10px 2px 0; font-size: 13px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--r-card); padding: 18px;
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }

/* Streak hero */
.hero { display: flex; align-items: center; gap: 14px; }
.hero-flame { font-size: 34px; filter: drop-shadow(0 0 10px rgba(240, 74, 180, .5)); }
.hero-main { flex: 1; }
.hero-num { font-size: 40px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  color: var(--text); letter-spacing: -1.2px; }
.hero-label { color: var(--muted); font-size: 14px; margin-top: 4px; }
.hero-side { color: var(--muted); font-size: 14px; text-align: right; }

/* Daily goal ring */
.goal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ring-row { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
/* The ring is six segments, one per kind of record (ADR 0050 H2). */
.kring-wrap { position: relative; width: 112px; height: 112px; flex: none; }
.kring { width: 100%; height: 100%; transform: rotate(-90deg); }
.kseg { fill: none; stroke: var(--line); stroke-width: 11; stroke-linecap: butt;
  transition: stroke .35s ease; }
.kseg.lit { filter: drop-shadow(0 0 4px rgba(56, 226, 220, .35)); }
.kring-txt { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; }
.kring-txt .ring-num { font-size: 24px; }
.kring-txt .ring-sub { font-size: 12px; }
.ring-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ring-left { font-size: 16px; font-weight: 600; line-height: 1.3; text-wrap: balance; }
.ring-side .goal-state { margin-top: 0; }
/* Chips under the ring: a lit one wears its segment's colour, an empty one is a
   button that asks its question. */
.kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.kind { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px; padding: 0 4px;
  background: var(--ground-2); border: 1px solid var(--line-soft); border-radius: 13px;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.kind.lit { color: var(--text); cursor: default; background: var(--surface); border-color: var(--line); }
.kind:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.kind-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1.5px var(--muted); }
.kind.lit .kind-dot { box-shadow: none; }
.kind-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ring-num { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; }
.ring-sub { color: var(--muted); font-size: 14px; }
.goal-state { margin-top: 10px; font-size: 14px; color: var(--muted); }
.goal-state.done { color: var(--good); }

/* Lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.item-cat { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); }
.item-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item-text { margin-top: 4px; overflow-wrap: anywhere; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.badge { background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; text-align: center; }
.badge.locked { opacity: .38; }
.badge-ico { font-size: 26px; }
.badge-name { margin-top: 6px; font-size: 13px; font-weight: 650; }

.skel { height: 62px; border-radius: 14px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: sweep 1.2s linear infinite; }
@keyframes sweep { to { background-position: -200% 0; } }

/* --- Tabs: the one control that must sit under a thumb ------------------- */

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(15, 10, 23, .94);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line-soft);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: var(--tab-h); padding: 10px 4px 8px;
  background: none; border: 0; color: var(--muted);
  font: inherit; font-size: 11px; cursor: pointer;
}
.tab.is-on { color: var(--cyan); }
/* Центральная «＋» — действие, а не место: она заливная и без состояния
   «выбрано», потому что выбрать её нельзя, можно только нажать. */
.tab-capture { color: var(--cyan); }
.tab-capture .ico {
  width: 46px; height: 46px; padding: 11px; margin-top: -14px;
  border-radius: 50%; background: var(--cyan); color: #092322;
  box-shadow: 0 6px 20px rgba(56, 226, 220, .3);
}
.tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: -4px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
  z-index: 9; max-width: calc(100vw - 32px);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- Activity heatmap ------------------------------------------------------
   Ten weeks of the journal at a glance. A streak number says "12"; this says
   which days were thin and which were full, which is the thing a person
   actually recognises about their own month. */

.heat {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr);
  /* GitHub spacing: cells tight, and the width is filled by showing more weeks —
     not by pushing the days apart. Spreading eleven weeks across the card was the
     first attempt and it read as a dot matrix, not as a year of work.
     Scrolls sideways on its own if the weeks do not fit; the page never does. */
  grid-auto-columns: 11px; gap: 3px; margin-top: 10px;
  overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
}
.heat::-webkit-scrollbar { display: none; }
.hc { width: 11px; height: 11px; border-radius: 2px; background: var(--surface-2); }
.hc.l1 { background: rgba(56, 226, 220, .28); }
.hc.l2 { background: rgba(56, 226, 220, .5); }
.hc.l3 { background: rgba(56, 226, 220, .74); }
.hc.l4 { background: var(--cyan); box-shadow: 0 0 6px rgba(56, 226, 220, .6); }
.hc.future { background: transparent; }
.heat-key { display: flex; align-items: center; gap: 5px; margin-top: 8px; }
.hk { width: 11px; height: 11px; border-radius: 3px; background: var(--surface-2); }
.hk.l1 { background: rgba(56, 226, 220, .28); }
.hk.l2 { background: rgba(56, 226, 220, .5); }
.hk.l3 { background: rgba(56, 226, 220, .74); }
.hk.l4 { background: var(--cyan); }

/* --- Level ---------------------------------------------------------------- */

.level-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.level-num { font-size: 24px; font-weight: 750; }
.bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.bar-fill { display: block; height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta)); transition: width .5s ease; }

.badge-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.badge-bar span { display: block; height: 100%; background: var(--cyan); border-radius: 3px; }

/* --- Journal -------------------------------------------------------------- */

.search { position: sticky; top: 0; z-index: 2; padding-bottom: 8px;
  background: linear-gradient(180deg, var(--ground) 70%, transparent); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; }
.chip {
  flex: none; padding: 8px 14px; min-height: 44px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line-soft); color: var(--muted);
  font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip.is-on { color: var(--cyan-soft); background: rgba(56, 226, 220, .08);
  border-color: rgba(56, 226, 220, .33); }
.day-head { margin: 12px 2px 2px; font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); }

.btn.ghost.sm { width: auto; min-height: 40px; padding: 0 16px; font-size: 14px; flex: none; }
.row span { min-width: 0; }

/* --- Feed ------------------------------------------------------------------
   The content engine's stream, in a form an app can show. In the chat these
   arrived between other messages and scrolled away; here they stay, sorted and
   rateable. */

.fi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.fi-top { display: flex; align-items: center; gap: 8px; }
.fi-kind { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); }
.fi-theme { font-size: 12px; color: var(--muted); }
.fi-at { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fi-text { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.fi-foot { display: flex; align-items: center; gap: 2px; margin-top: 10px; }
.star {
  background: none; border: 0; padding: 6px; min-width: 36px; min-height: 36px;
  font-size: 17px; line-height: 1; cursor: pointer; color: var(--muted); opacity: .5;
}
.star.on { opacity: 1; color: #ffd75e; }
.fi-save { margin-left: auto; background: none; border: 0; font-size: 17px;
  padding: 6px 4px; min-height: 36px; cursor: pointer; opacity: .5; }
.fi-save.on { opacity: 1; }

/* --- Composer --------------------------------------------------------------
   The thing that makes this an assistant rather than a dashboard: write in your
   own words here, the same pipeline the bot uses sorts it. */

.composer { padding: 12px; }
.ta { resize: none; line-height: 1.4; font-family: inherit; }
.composer-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.composer-foot .muted { flex: 1; min-width: 0; }
.btn.primary.sm { min-height: 42px; padding: 0 18px; font-size: 15px; }
.btn:disabled { opacity: .5; }
.cap-done { color: var(--good); }

/* --- Typed quick entry -----------------------------------------------------
   A purchase is a number and a category; calories are a number. Sending those
   through a language model costs money, latency and a chance of being
   misunderstood, for no gain. */

.seg { display: flex; gap: 4px; padding: 4px; margin-bottom: 10px;
  background: var(--ground-2); border: 1px solid var(--line-soft); border-radius: 14px; }
.seg-b { flex: 1; min-height: 44px; border: 0; border-radius: 11px; background: none;
  color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.seg-b.is-on { background: var(--surface-2); color: var(--text); font-weight: 600; }
/* Переключатель «Прогресса» — не фильтр внутри экрана, а сам раздел,
   поэтому он выделен акцентом, а не серым. */
.prog-switch .seg-b.is-on { color: var(--cyan-soft); background: rgba(56, 226, 220, .08); }
.q-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.q-row { display: flex; align-items: center; gap: 10px; }
.q-val { flex: 1; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.q-unit { color: var(--muted); font-size: 16px; min-width: 2.5em; }
select.field { appearance: none; }

/* --- Trackers --------------------------------------------------------------
   One screen per tracked thing, with that thing's own numbers and its own form.
   A universal "pick a category" widget was the first attempt and it was wrong:
   money is looked at as money, not as a row in a generic list. */

.seg.sm { margin: 0; padding: 2px; }
.seg.sm .seg-b { min-height: 30px; font-size: 12px; padding: 0 10px; }
.tr-total { font-size: 34px; font-weight: 750; margin-top: 10px;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.donut { width: 150px; height: 150px; display: block; margin: 0 auto 6px; }
.donut circle { fill: none; stroke-width: 18; }
.legend { display: flex; flex-direction: column; gap: 6px; }
.lg { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.lg-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.lg-pct { color: var(--muted); font-size: 12px; min-width: 3em; text-align: right; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 92px; margin-top: 10px; }
.bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bar-v { background: linear-gradient(180deg, var(--cyan), #2199c4); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-col.empty .bar-v { background: var(--surface-2); }

/* --- Statement import ------------------------------------------------------ */
.hidden-file { display: none; }
.imp-sum { margin: 10px 0 8px; font-size: 15px; }
.composer-foot .btn.ghost.sm { width: auto; }

/* --- statement review ------------------------------------------------------ */

.rv-list { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 4px; }
.rv-card { display: flex; flex-direction: column; gap: 8px; padding: 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.rv-head { display: flex; align-items: baseline; gap: 10px; }
.rv-txt { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.rv-amt { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.rv-q { margin: 0; font-size: 14px; color: var(--muted); }
.rv-refunds { display: flex; flex-direction: column; gap: 6px; }
.rv-refund { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px;
  border-radius: 10px; background: var(--surface); }
.rv-refund input { margin-top: 3px; accent-color: var(--cyan); width: 18px; height: 18px; flex: none; }
.rv-refund:has(input:not(:checked)) { opacity: .55; }
.rv-refund .rv-amt { color: var(--good); }
.rv-acts { display: flex; justify-content: flex-end; gap: 8px; }
.rv-acts .btn { width: auto; }

/* --- Checklist and shopping (ADR 0050 H1) ----------------------------------
   One row shape for both: a big box for the thumb, the title, and a quiet ×
   for what was added by mistake. */

.checks { display: flex; flex-direction: column; }
.card.checks { padding: 4px 16px; }
/* ВНИМАНИЕ. `.check` — это СТРОКА списка покупок и задач, а не карточка.
   Карточка очереди проверки в журнале называлась так же (`card check`) и
   получала этот же `display:flex`: её заголовок, пояснение и список
   выстраивались в ряд, список уезжал за правый край и обрезался. На проде это
   жило незамеченным, потому что сам экран открывается редко.
   Имя класса здесь — часть поведения: не давать строке и контейнеру одно имя. */
.check { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 0;
  border-bottom: 1px solid var(--line); }
.review-queue .list { margin-top: 10px; }
.check:last-child { border-bottom: 0; }
.check-box { flex: none; width: 30px; height: 30px; border-radius: 9px; cursor: pointer;
  border: 2px solid var(--line); background: var(--ground); color: var(--cyan);
  font: inherit; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.check-box:focus-visible, .check-x:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.check.is-done .check-box { background: var(--good); border-color: var(--good); color: #06121a; font-size: 16px; }
.check-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.check-title { overflow-wrap: anywhere; }
.check.is-done .check-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.check-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.check-x { flex: none; width: 36px; height: 36px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 22px; line-height: 1; opacity: .6; }
.check-empty { margin: 10px 0; }
.add-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.card.add-row { margin-top: 0; padding: 10px; }
.add-row .field { flex: 1; min-width: 0; }
.add-row .btn.primary.sm { flex: none; min-width: 48px; }

.peek { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  color: var(--text); font: inherit; cursor: pointer; padding: 12px 16px; }
.peek-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.peek-title { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.peek-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek-go { color: var(--cyan); font-size: 24px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 18px; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.tile-ico { width: 24px; height: 24px; fill: none; stroke: var(--cyan-soft);
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.peek-ico { width: 20px; height: 20px; fill: none; stroke: var(--cyan-soft);
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.page-title { margin: 0 2px 4px; font-size: 32px; font-weight: 600; letter-spacing: -1.1px; }
.tile-name { font-weight: 650; }
.sub-head { display: flex; align-items: center; gap: 4px; margin: -6px 0 0 -10px; }
.sub-title { margin: 0; font-size: 20px; font-weight: 750; }

/* --- Nudge (ADR 0050 H2) ----------------------------------------------------
   One question, answerable where it is asked. */

.nudge { border-color: var(--line-soft); background: var(--surface);
  border-left: 3px solid var(--magenta); }
.nudge-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -6px 0 0; }
.nudge-kind { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.nudge-q { font-size: 18px; font-weight: 650; margin: 2px 0 10px; text-wrap: balance; }
.nudge-form .add-row { margin-top: 0; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale-b { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--ground);
  font-size: 24px; cursor: pointer; }
.scale-b:active { transform: translateY(1px); border-color: var(--cyan); }

/* --- Kind forms (ADR 0050 H3) ----------------------------------------------
   Sleep, a meal, how you feel: shared by the nudge and the tracker. */

.nudge-form { display: flex; flex-direction: column; gap: 10px; }
.nudge-form .composer-foot { margin-top: 0; }
.tr-kind { margin-top: 10px; }
.kf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kf-l { display: flex; flex-direction: column; gap: 4px; font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); }
/* 16px: anything smaller and iOS zooms the page in on focus. */
.kf-l .field, .kf-bp .field { text-transform: none; letter-spacing: 0; font-size: 16px; }
.kf-wide { grid-column: 1 / -1; }
.kf-bp { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 18px; }
.kf-bp .field { flex: 1; min-width: 0; }
.kf-cap { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: -4px; }
.kf-sum { flex: 1; min-width: 0; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kf-row .field { flex: 1; min-width: 0; font-size: 16px; }
.kf-meal { margin-bottom: 0; }
.kf-meal .seg-b { font-size: 13px; }
.kf-more summary { cursor: pointer; color: var(--cyan); font-size: 14px; padding: 4px 0; list-style: none; }
.kf-more summary::-webkit-details-marker { display: none; }
.kf-more summary::before { content: '＋ '; }
.kf-more[open] summary::before { content: '− '; }
.kf-more .kf-grid { margin-top: 8px; }
.scale-b.is-on { border-color: var(--cyan); background: var(--surface-2); box-shadow: 0 0 0 1px var(--cyan) inset; }
input[type=time].field { font-variant-numeric: tabular-nums; }

/* --- Notes (ADR 0050 H4) -----------------------------------------------------
   The editor is a page, not a card: a title line and the text, nothing framed. */

.sub-act { margin-left: auto; }
.note-item { display: block; width: 100%; text-align: left; color: var(--text); font: inherit; cursor: pointer; }
.note-name { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-prev { display: block; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-head { gap: 2px; }
.note-status { flex: 1; min-width: 0; text-align: right; font-size: 12px; color: var(--muted); padding-right: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-b { width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; font-size: 20px;
  cursor: pointer; opacity: .55; }
.icon-b.is-on { opacity: 1; background: var(--surface); }
.icon-b:focus-visible { outline: 2px solid var(--cyan); }
.note-title, .note-body { width: 100%; border: 0; background: none; color: var(--text); font: inherit; padding: 0 2px; }
.note-title { font-size: 24px; font-weight: 750; }
.note-body { font-size: 17px; line-height: 1.55; resize: none; min-height: 50vh; overflow: hidden; }
.note-title:focus, .note-body:focus { outline: none; }
.note-title::placeholder, .note-body::placeholder { color: var(--muted); opacity: .6; }
.note-conflict { border-color: var(--magenta); }
.note-conflict-t { margin: 0; }
.note-theirs { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--ground);
  color: var(--muted); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9em; overflow-y: auto; }

/* --- Live voice (ADR 0049 P4) ------------------------------------------------
   A conversation takes the whole screen: the owner is looking at the phone only
   to see that it heard right, so the words are big and the one control is a
   thumb-sized circle that pulses with the voice it hears. */

.mic-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface-2); font-size: 20px; cursor: pointer; }
.mic-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.voice { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 12px) var(--pad) calc(env(safe-area-inset-bottom) + 20px);
  background: radial-gradient(120% 70% at 50% 100%, rgba(56, 226, 220, .12), transparent 60%), var(--ground); }
.voice-top { display: flex; align-items: center; justify-content: space-between; }
.voice-brand { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.voice-top { gap: 12px; }
.voice-pref { margin-left: auto; color: var(--muted); }
.voice-gear { color: var(--muted); font-size: 18px; }
.voice-settings { margin-top: 10px; display: grid; gap: 8px; }
.voice-settings .row { gap: 12px; }
.voice-settings select { font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.voice-settings p { margin: 0; }
/* A chat: it fills from the top down, and the newest exchange stays in view.
   The opening is a real invitation to talk, not an empty diagnostic screen. */
.voice-say { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 2px; overscroll-behavior: contain;
  display: flex; flex-direction: column; }
.voice-welcome { max-width: 31rem; margin: auto 4px; padding: 20px 18px;
  background: linear-gradient(145deg, rgba(56, 226, 220, .10), rgba(44, 22, 80, .75));
  border: 1px solid rgba(56, 226, 220, .28); border-radius: 20px; }
.voice-welcome-kicker { margin: 0 0 8px; color: var(--cyan); font-size: 12px; font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase; }
.voice-welcome h2 { margin: 0; font-size: 25px; letter-spacing: -.02em; }
.voice-welcome p:last-child { margin: 10px 0 0; color: var(--muted); line-height: 1.5; }
.voice-log { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.voice-turn { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.voice-you { align-self: flex-end; max-width: 87%; margin: 0; padding: 9px 12px;
  font-size: 17px; color: var(--text); background: rgba(56, 226, 220, .12);
  border: 1px solid rgba(56, 226, 220, .23); border-radius: 16px 16px 5px 16px; overflow-wrap: anywhere; }
.voice-you:empty, .voice-jarvis:empty { display: none; }
.voice-you:not(:empty)::before, .voice-jarvis:not(:empty)::before { display: block; margin-bottom: 3px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.voice-you:not(:empty)::before { content: 'Ты'; }
.voice-jarvis { max-width: 94%; margin: 0; padding: 10px 13px; font-size: 19px; line-height: 1.42; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 5px;
  overflow-wrap: anywhere; text-wrap: pretty; }
.voice-jarvis:not(:empty)::before { content: 'Jarvis'; color: var(--cyan); }
.voice-turn.past { gap: 3px; opacity: .72; }
.voice-turn.past .voice-jarvis, .voice-turn.past .voice-you { padding: 0; font-size: 15px; font-weight: 500;
  color: var(--muted); background: transparent; border-color: transparent; border-radius: 0; }
.voice-turn.past .voice-you { font-size: 14px; }
.voice-confirm { margin-bottom: 12px; }
.voice-confirm p { margin: 0; }
.voice-controls { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.voice-talk { position: relative; width: 96px; height: 96px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(140deg, var(--cyan), #2bb8d6); display: grid; place-items: center;
  transition: transform 140ms cubic-bezier(.23, 1, .32, 1), filter 140ms ease-out; }
.voice-talk:active { transform: scale(.97); filter: brightness(.95); }
.voice-talk:focus-visible { outline: 3px solid var(--magenta); outline-offset: 4px; }
.voice-mic { position: relative; font-size: 38px; }
.voice-level { position: absolute; inset: -10px; border-radius: 50%; border: 2px solid var(--cyan);
  opacity: .55; transition: transform .1s linear; }
.voice-status { margin: 0; min-height: 1.4em; color: var(--muted); text-align: center; }
.voice[data-state="thinking"] .voice-talk,
.voice[data-state="connecting"] .voice-talk { background: var(--surface-2); }
.voice[data-state="speaking"] .voice-talk { background: linear-gradient(140deg, var(--magenta), #c0368f); }
.voice[data-state="error"] .voice-status { color: var(--magenta); }
.voice[data-state="thinking"] .voice-level { animation: voice-think 1.2s ease-in-out infinite; }
@keyframes voice-think { 50% { transform: scale(1.25); opacity: .2; } }
@media (prefers-reduced-motion: reduce) {
  .voice-level { transition: none; }
  .voice[data-state="thinking"] .voice-level { animation: none; }
}

/* --- Compact Today (#57) -------------------------------------------------------
   The owner: "много фри спейса". The streak lives in the day card's header line
   instead of a card of its own, the composer is one line that grows, and the
   freed space goes to the one control that starts a conversation. */

.composer .ta { min-height: 44px; }
.voice-btn { width: auto; min-height: 44px; padding: 0 16px; border-radius: 14px; flex: none;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ground-2); border: 1px solid var(--line);
  color: var(--text); font-size: 15px; font-weight: 600; }
.voice-btn .ico { width: 19px; height: 19px; color: var(--cyan-soft); }
.voice-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.streak-line { display: flex; align-items: baseline; gap: 4px; min-width: 0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: 0; font-size: 14px; }
.streak-flame { font-size: 16px; }
.streak-num { font-size: 20px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.streak-freezes { color: var(--muted); }
.goal .ring-row { margin-top: 4px; }

/* --- Wishes (ADR 0051 M1) ---------------------------------------------------
   A queue of things waited for: the price, whether it is a guess, and when it
   comes within reach at the current pace. A wish falling behind its own date
   gets a quiet magenta edge, not an alarm. */

.wish-pace .q-row { margin-top: 6px; }
.wish-pace-hint { margin: 8px 0 0; }
.wish-add { display: flex; flex-direction: column; gap: 10px; }
.wish-add .composer-foot { margin-top: 0; }
.wish { display: flex; flex-direction: column; gap: 6px; }
.wish.is-behind { border-left: 3px solid var(--magenta); }
.wish.is-closed { opacity: .6; }
.wish-title { font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.wish-price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.wish-est { font-size: 12px; color: var(--muted); border: 1px dashed var(--line); border-radius: 999px; padding: 1px 6px; }
.wish-plan { color: var(--cyan); font-variant-numeric: tabular-nums; }
.wish.is-behind .wish-plan { color: var(--magenta); }
.wish-verdict { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text); }
.wish-acts { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.wish-closed summary { cursor: pointer; color: var(--muted); padding: 6px 2px; }
.wish-closed .list { margin-top: 8px; }

/* --- Price research (ADR 0051 M1.1) ------------------------------------------ */

.wish-alert { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  border-color: rgba(240, 74, 180, .6); background: linear-gradient(160deg, rgba(240, 74, 180, .16), var(--surface)); }
.wish-range { color: var(--muted); font-variant-numeric: tabular-nums; margin-top: -2px; }
.wish-question { margin: 0; font-size: 14px; color: var(--magenta); }
.wish-src summary { cursor: pointer; color: var(--cyan); font-size: 13px; padding: 2px 0; }
.wish-src ul { margin: 6px 0 0; padding-left: 16px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.wish-src a { color: var(--cyan); }
.src-name { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

/* Очередь проверки: что Jarvis посчитал сам и ждёт подтверждения. */
.check-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.check-actions .field { flex: 1; min-width: 110px; min-height: 40px; }
.item.busy { opacity: .5; pointer-events: none; }
/* Разговор текстом (MC-08). Своя лента сообщений, а не карточки: переписка
   читается сверху вниз, и каждое сообщение не должно спорить за внимание с
   соседним. Кто отвечает и на каком основании — единственное, что выделено. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.chat-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.chat-advisor { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.chat-advisor-name { font-weight: 700; }
.chat-advisor-acts { display: flex; gap: 14px; }
.chat-log { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.chat-msg { max-width: 92%; padding: 10px 12px; border-radius: 14px; line-height: 1.45; }
.chat-me { align-self: flex-end; background: var(--card2, rgba(255,255,255,.06)); }
.chat-bot { align-self: flex-start; background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.chat-from { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: baseline; }
/* Разговор занимает экран целиком, а поле ввода стоит внизу — там, где его
   ждёт большой палец и где оно не прыгает, когда переписка короткая. Прежде
   поле прилипало к низу ОКНА, то есть пряталось под нижней панелью. */
#screen-chat { min-height: calc(100dvh - 190px); }
#screen-chat .chat-log { flex: 1; }
.chat-log:empty::before {
  content: "Напиши сообщение — отвечу здесь же. Чтобы позвать советника, скажи, кого.";
  display: block; margin: auto; max-width: 20em; text-align: center;
  color: var(--muted); font-size: 14px; line-height: 1.5;
}
.chat-log:empty { display: flex; }
.chat-composer { position: sticky;
  bottom: calc(env(safe-area-inset-bottom) + var(--tab-h) + 8px); }


/* --- Серия и ритм ----------------------------------------------------------
   Пламя — единственное место, где используется розовый акцент: он отмечает
   продолжающуюся серию, и больше ничего. Если покрасить им что-то ещё, он
   перестанет значить «серия». */

.streak-ico, .top-streak .streak-ico {
  width: 17px; height: 17px; fill: none; stroke: var(--magenta);
  stroke-width: 1.6; stroke-linejoin: round; vertical-align: -3px;
}
.top-streak { display: inline-flex; align-items: center; gap: 5px; }
.hero-flame .streak-ico, .streak-flame .streak-ico { width: 22px; height: 22px; }

/* --- Приветствие дня -------------------------------------------------------
   Первое, что видно при открытии: какой сегодня день и обращение. Оно не несёт
   данных и потому не может устареть или соврать — в отличие от сводки, которую
   пришлось бы собирать и проверять. */

.greet { margin: 2px 2px 6px; }
.greet-date {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
}
.greet-line {
  margin: 10px 0 0; font-size: 32px; line-height: 1.12; font-weight: 600;
  letter-spacing: -1.1px;
}
.greet-line span { color: var(--muted); font-weight: 500; }
@media (max-width: 360px) { .greet-line { font-size: 27px; } }
