/* ═══════════════════════════════════════════════════════════════════════════
   Travel Chronicle · дизайн-система «Живой прибор»
   Всё, что живо в поездке прямо сейчас, собрано в один тёмный прибор,
   через который идёт время. Остальное — спокойные нативные списки.
   Один файл, один порядок: токены → основа → примитивы → экраны.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. ТОКЕНЫ ─────────────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Нейтрали · холодный графит (тёмная тема — значение по умолчанию) */
  --bg:        #0c0d10;
  --surface:   #17191e;   /* группа списка, лист */
  --surface2:  #202329;   /* поле, вторичная заливка */
  --surface3:  #2a2e36;   /* нажатие */
  --sheet:     #121418;   /* фон листа — темнее групп внутри */
  --sheet-surface:  #1e2127;
  --sheet-surface2: #292d35;
  --sheet-surface3: #333843;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.13);
  --sep:       rgba(255,255,255,0.09);

  --text:  #f0f1f3;
  --text2: #a3a9b2;
  --text3: #8b919b;       /* 6.2:1 на фоне */
  --on-accent: #0c0d10;

  /* Бренд · холодный десатурированный синий (Brand Commitment) */
  --accent:       #7c9cbf;
  --accent-press: #6b8bae;
  --accent-soft:  rgba(124,156,191,0.16);
  --accent-line:  rgba(124,156,191,0.50);

  /* Семантика · роли и характер сохранены */
  --positive: #6fae8f;
  --alert:    #df948b;
  /* --alert — для ТЕКСТА на тёмном. Заливка требует своего тона: белые буквы
     на #df948b дают контраст 2,4:1 и не читаются. */
  --alert-fill: #b3453a;
  --positive-soft: rgba(111,174,143,0.14);
  --alert-soft:    rgba(193,106,96,0.15);

  /* Прибор · остаётся тёмным в обеих темах */
  --inst:        #1c2128;
  --inst-2:      #252b33;
  --inst-ink:    #f2f3f5;
  --inst-ink2:   #aab1bb;
  --inst-line:   rgba(255,255,255,0.11);
  --inst-past:   rgba(255,255,255,0.30);
  --inst-btn:    rgba(255,255,255,0.08);
  --inst-btn-press: rgba(255,255,255,0.14);
  --inst-accent: #7c9cbf;
  --inst-on-accent: #0c0d10;
  --inst-positive: #8cc5a7;
  --inst-alert: #e0968d;
  --inst-shadow: 0 1px 2px rgba(0,0,0,0.20), 0 10px 28px rgba(0,0,0,0.22);

  /* Материал панелей */
  --bar: rgba(12,13,16,0.94);
  --dim: rgba(0,0,0,0.48);

  /* Типографика · шкала текстовых стилей iOS в rem от системного Body.
     На iOS 1rem = выбранный пользователем размер (Dynamic Type). */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Hiragino Sans", "PingFang SC", "Noto Sans", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Hiragino Sans", "PingFang SC", "Noto Sans", sans-serif;
  --font-body: var(--font);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --t-large:    2rem;       /* 34 */
  --t-title1:   1.647rem;   /* 28 */
  --t-title2:   1.294rem;   /* 22 */
  --t-title3:   1.176rem;   /* 20 */
  --t-body:     1rem;       /* 17 */
  --t-callout:  0.941rem;   /* 16 */
  --t-subhead:  0.882rem;   /* 15 */
  --t-footnote: 0.765rem;   /* 13 */
  --t-caption:  0.706rem;   /* 12 */
  --t-caption2: 0.647rem;   /* 11 — нижняя граница */
  --t-count:    2.6rem;     /* 44 — табличные цифры прибора */

  /* Старые имена размеров → новая шкала (JS и inline-разметка) */
  --fs-hero:    var(--t-title1);
  --fs-title:   var(--t-title2);
  --fs-body:    var(--t-body);
  --fs-section: var(--t-subhead);
  --fs-caption: var(--t-footnote);

  /* Отступы · сетка 4 pt */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 44px;
  --gutter: 16px;

  /* Радиусы · четыре ступени */
  --r-sm: 10px;   /* чипы, мелкие элементы */
  --r:    14px;   /* кнопки, поля */
  --r-md: 16px;   /* группы списков */
  --r-lg: 24px;   /* прибор */
  --r-sheet: 18px;

  /* Движение · 150–250 мс, только смена состояния */
  --ease: cubic-bezier(.2,.8,.2,1);
  --dur: .2s;

  --shadow: 0 1px 2px rgba(0,0,0,0.18), 0 6px 18px rgba(0,0,0,0.16);

  /* Старые имена цветов → роли (код и inline-стили продолжают работать) */
  --amber: var(--accent);
  --blue:  var(--accent);
  --green: var(--positive);
  --red:   var(--alert);
  --danger: var(--alert);
  --purple: var(--text2);
  --amber-dim:  var(--accent-soft);
  --blue-dim:   var(--accent-soft);
  --accent-dim: var(--accent-soft);
  --green-dim:  var(--positive-soft);
  --red-dim:    var(--alert-soft);
  --purple-dim: var(--surface2);
  --type-transport: var(--text2);
  --type-food:      var(--text2);
  --type-place:     var(--text2);
  --type-hotel:     var(--text2);
  --type-warning:   var(--text2);
  --wm-unvisited: #636b78;
  --shadow-sm: none;
}

[data-theme="light"] {
  color-scheme: light;
  --bg:        #f1f2f4;
  --surface:   #ffffff;
  --surface2:  #e8eaee;
  --surface3:  #dadde3;
  --sheet:     #f1f2f4;
  --sheet-surface:  #ffffff;
  --sheet-surface2: #e4e6eb;
  --sheet-surface3: #d8dbe1;
  --border:    rgba(21,23,27,0.08);
  --border2:   rgba(21,23,27,0.15);
  --sep:       rgba(21,23,27,0.10);

  --text:  #15171b;
  --text2: #555b65;
  --text3: #666c76;       /* 4.8:1 на фоне */
  --on-accent: #ffffff;

  --accent:       #3f5f80;
  --accent-press: #344f6b;
  --accent-soft:  rgba(63,95,128,0.12);
  --accent-line:  rgba(63,95,128,0.45);

  --positive: #3f8f6a;
  --alert:    #b0473d;
  --alert-fill: #b0473d;
  --positive-soft: rgba(63,143,106,0.12);
  --alert-soft:    rgba(176,71,61,0.11);

  --inst:        #13171c;
  --inst-2:      #1d232a;
  --inst-shadow: 0 1px 2px rgba(20,24,30,0.10), 0 12px 28px rgba(20,24,30,0.14);

  --bar: rgba(241,242,244,0.94);
  --dim: rgba(20,24,30,0.32);
  --wm-unvisited: #cfd3da;
  --shadow: 0 1px 2px rgba(20,24,30,0.06), 0 6px 18px rgba(20,24,30,0.07);
}

/* ── 2. ОСНОВА ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 17px;
  height: 100%; height: -webkit-fill-available;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
/* Dynamic Type: WebKit подставляет системный размер Body */
@supports (font: -apple-system-body) {
  html { font: -apple-system-body; }
}
body {
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.35;
  background: var(--bg);
  color: var(--text);
  display: flex; flex-direction: column;
  height: 100vh;
  height: -webkit-fill-available;
  height: var(--app-height, 100vh);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}
html, body, #app-scroll { background: var(--bg); }
#app-scroll {
  flex: 1 1 auto;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
::selection { background: var(--accent-soft); color: var(--text); }
input, textarea { caret-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button:focus:not(:focus-visible) { outline: none; }
.num, .tabular { font-variant-numeric: tabular-nums; }

/* Нативное поведение (Guideline 4.2): без выделения по долгому тапу,
   без «резинки» документа и зума двойным тапом. Поля ввода не трогаем. */
html, body {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}
input, textarea, select, [contenteditable="true"],
.info-desc, .rep-target, .lead, .impression {
  -webkit-user-select: text; user-select: text;
  -webkit-touch-callout: default;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }

/* Иконки · единая линия 1.8, оптический размер 1.15em */
.ic {
  width: 1.15em; height: 1.15em;
  display: inline-block; vertical-align: -0.18em; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic-fill { fill: currentColor; stroke: none; }

/* ── 3. ОБОЛОЧКА ───────────────────────────────────────────────────────────── */
/* Веб-шапка: только в браузере. В iOS её роль играет large title экрана. */
header {
  position: sticky; top: 0; z-index: 200;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px);
  border-bottom: 1px solid var(--sep);
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  display: flex; justify-content: center; align-items: center;
}
header h1 { font-size: var(--t-body); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.header-actions { display: flex; gap: var(--s2); align-items: center; }
html.is-native header{ display:none; }
html.is-native,html.is-native body{ width:100%; height:100%; min-height:100%; overflow:hidden; }
html.is-native body{ height:100dvh; min-height:100dvh; }
html.is-native #app-scroll{ padding-top:calc(env(safe-area-inset-top) + 6px); }

.screen { display: none; padding: var(--s2) var(--gutter) var(--s6); }
.screen.active { display: block; }
.screen.anim-forward { animation: screenForward .26s var(--ease) both; }
.screen.anim-back    { animation: screenBack .24s var(--ease) both; }
.screen.anim-fade    { animation: screenFade .18s ease both; }
@keyframes screenForward { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes screenBack    { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes screenFade    { from { opacity: 0; } to { opacity: 1; } }
.screen, .modal-sheet, .info-list { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* Large title корневых экранов */
.lt-head { padding: var(--s2) 4px var(--s4); display: flex; flex-direction: column; gap: 2px; }
.lt-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); }
.large-title {
  font-family: var(--font-display);
  font-size: var(--t-large); line-height: 1.2; font-weight: 700; letter-spacing: -0.022em;
  color: var(--text); overflow-wrap: anywhere;
}
.lt-sub { font-size: var(--t-subhead); color: var(--text2); min-height: 1.3em; overflow-wrap: anywhere; }
.lt-sub:empty { display: none; }

/* Заголовок раздела (h2 уровня экрана) */
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3);
  margin: var(--s6) 4px var(--s2);
}
.sec-title { font-size: var(--t-title3); font-weight: 650; letter-spacing: -0.012em; color: var(--text); }
.sec-link {
  background: none; border: 0; color: var(--accent); font-size: var(--t-subhead); font-weight: 500;
  min-height: 44px; padding: 0 4px; margin: -12px -4px; display: inline-flex; align-items: center;
}
.sec-link:active { opacity: .55; }

/* Подпись группы в стиле iOS (над inset-группой) */
.section-label, .settings-sublabel {
  font-size: var(--t-footnote); font-weight: 400; letter-spacing: 0;
  text-transform: none; color: var(--text2);
  margin: var(--s5) var(--s4) var(--s2);
}
.section-label:first-child { margin-top: var(--s2); }
.section-label-inline {
  display: flex; align-items: center; gap: var(--s2);
  font-size: var(--t-footnote); font-weight: 600; color: var(--text2);
  margin: var(--s5) 0 var(--s2);
}
.section-label-inline .ic { color: var(--text3); }

/* Назад — навигационная кнопка слева, как в UINavigationBar */
.back-btn {
  display: inline-flex; align-items: center; gap: 2px;
  min-height: 44px; margin: 0 0 var(--s2) -8px; padding: 0 8px;
  color: var(--accent); font-size: var(--t-body); font-weight: 400;
  cursor: pointer; -webkit-tap-highlight-color: transparent; border-radius: 10px;
  transition: opacity .15s;
}
.back-btn::before {
  content: ''; width: 11px; height: 11px; margin-right: 6px;
  border-left: 2.4px solid currentColor; border-bottom: 2.4px solid currentColor;
  transform: rotate(45deg); border-radius: 1px;
}
.back-btn:active { opacity: .45; }

/* ── 4. ТАБ-БАР · активная вкладка — только цвет иконки и подписи ─────────── */
.tabbar{
  position: relative; flex: 0 0 auto; z-index: 300;
  display: flex;
  background:var(--bg);
  border-top: 1px solid var(--sep);
  padding:6px 8px max(6px,calc(env(safe-area-inset-bottom) - 10px));
}
.tab-item{
  flex: 1; min-height: 44px; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; border-radius: 0; padding: 0 2px;
  color: var(--text3);
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.tab-item .tab-ic { width: 24px; height: 24px; display: block; }
.tab-item .tab-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0; line-height: 1.1;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tab-item.active{ background:transparent; color: var(--accent); }
body.detail-view .tabbar { display: none; }
body.modal-open .tabbar { display: none; }

/* ── 5. КНОПКИ ─────────────────────────────────────────────────────────────── */
.btn-primary, .btn-ghost {
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  width: 100%; min-height: 50px; padding: 12px var(--s4);
  border-radius: var(--r); border: 0;
  font-size: var(--t-body); font-weight: 600; line-height: 1.25; text-align: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur) var(--ease), opacity var(--dur), transform .12s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); margin-top: var(--s3); }
.btn-primary:active { background: var(--accent-press); }
.btn-primary:disabled, .btn-ghost:disabled { opacity: .45; pointer-events: none; }
.btn-ghost { background: var(--surface2); color: var(--text); margin-top: var(--s2); }
.btn-ghost:active { background: var(--surface3); }
/* «Отмена/Закрыть» — текстовая кнопка, не ещё один тяжёлый блок */
.btn-ghost[onclick*="closeModal"], .btn-ghost[onclick*="close"], .btn-ghost[onclick*="Close"],
.btn-ghost#_ov-cancel {
  background: transparent; color: var(--accent); font-weight: 500;
}
.btn-ghost[onclick*="closeModal"]:active, .btn-ghost[onclick*="close"]:active,
.btn-ghost[onclick*="Close"]:active, .btn-ghost#_ov-cancel:active { background: var(--accent-soft); }
.btn-ghost.map-place-delete, .mypub-del, .btn-danger { color: var(--alert) !important; }
.btn-primary .ic, .btn-ghost .ic { width: 1.1em; height: 1.1em; }
.btn-add { margin-top: var(--s4); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 6px 14px;
  font-size: var(--t-subhead); font-weight: 600;
  border: 0; background: var(--surface2); color: var(--text);
  border-radius: 999px; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: background-color .15s;
}
.btn:active { background: var(--surface3); }
.btn.active { background: var(--accent); color: var(--on-accent); }
#template-list { margin-bottom: var(--s2); }
#template-list .btn { width: 100%; min-height: 52px; border-radius: 0; background: var(--surface); justify-content: flex-start; padding: 0 var(--s4); font-weight: 400; font-size: var(--t-body); }
#template-list .btn:active { background: var(--surface3); }

.btn-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 0; background: var(--surface2); color: var(--text);
  font-size: var(--t-body); -webkit-tap-highlight-color: transparent; transition: background-color .15s;
}
.btn-icon:active { background: var(--surface3); }
.btn-icon.active { background: var(--accent); color: var(--on-accent); }

.btn-del, .btn-edit {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 0;
  font-size: var(--t-footnote); font-weight: 600;
}
.btn-del  { background: var(--alert-soft); color: var(--alert); }
.btn-edit { background: var(--surface2); color: var(--text); }
.btn-edit .ic { width: 15px; height: 15px; }
.admin-ctrl { flex-wrap: wrap; }
/* «Бюджет»: приглашение указать курс валюты поездки */
.bud-rate-prompt {
  display: flex; align-items: center; gap: var(--s3); width: 100%; text-align: left;
  margin: var(--s3) 0 0; padding: 12px 16px; min-height: 56px;
  background: var(--surface); border: 0; border-radius: var(--r-md); color: var(--text);
  font: inherit; -webkit-tap-highlight-color: transparent;
}
.bud-rate-prompt:active { background: var(--surface3); }
.bud-rate-ic { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; background: var(--surface2); color: var(--text2); display: inline-flex; align-items: center; justify-content: center; }
.bud-rate-ic .ic { width: 17px; height: 17px; }
.bud-rate-tx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bud-rate-t { font-size: var(--t-body); font-weight: 600; }
.bud-rate-s { font-size: var(--t-footnote); color: var(--text2); line-height: 1.35; }
/* Кнопки у адреса активности: маршрут и копирование */
.av-addr-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.av-addr-actions .av-route-btn { margin-top: 0; width: auto; flex: 0 0 auto; }
/* Шестерёнка на карточке поездки — вход в управление поездкой */
.trip-gear {
  flex: 0 0 auto; width: 44px; height: 44px; margin: -10px -10px -10px 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 50%; color: var(--text2);
  -webkit-tap-highlight-color: transparent;
}
.trip-gear .ic { width: 20px; height: 20px; }
.trip-gear:active { background: var(--surface3); }

/* Чипы */
.chip-btn, .tp-chip, .wm-chip, .tsc, .pkg-imp-city {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 6px 14px; border-radius: 999px;
  background: var(--surface2); color: var(--text); border: 0;
  font-size: var(--t-footnote); font-weight: 500; white-space: nowrap;
}
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--t-caption); font-weight: 600; letter-spacing: 0;
  padding: 3px 8px; border-radius: 6px;
  background: var(--surface2); color: var(--text2); white-space: nowrap;
}
.badge.green { background: var(--positive-soft); color: var(--positive); }
.badge.blue  { background: var(--accent-soft); color: var(--accent); }
.badge.red   { background: var(--alert-soft); color: var(--alert); }
.badge.purple{ background: var(--surface2); color: var(--text2); }

/* Сегментированный переключатель (UISegmentedControl) */
.seg, .theme-seg, .tp-seg {
  display: flex; gap: 2px; padding: 2px;
  background: var(--surface2); border: 0; border-radius: 10px;
  margin-bottom: var(--s4);
}
.seg-item, .theme-seg button, .tp-seg-btn {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 6px 8px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text);
  font-size: var(--t-footnote); font-weight: 500; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background-color .18s var(--ease), box-shadow .18s;
}
.seg-item.active, .theme-seg button.active, .tp-seg-btn.active {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.14), 0 0 0 .5px rgba(0,0,0,.04);
}
[data-theme="light"] .seg-item.active, [data-theme="light"] .theme-seg button.active,
[data-theme="light"] .tp-seg-btn.active { background: #fff; }
:root:not([data-theme="light"]) .seg-item.active,
:root:not([data-theme="light"]) .theme-seg button.active,
:root:not([data-theme="light"]) .tp-seg-btn.active { background: #3a3f48; }

/* ── 6. ПОЛЯ ───────────────────────────────────────────────────────────────── */
.form-label {
  display: block; font-size: var(--t-footnote); font-weight: 400; color: var(--text2);
  text-transform: none; letter-spacing: 0;
  margin: var(--s4) 4px 6px;
}
.form-label:first-child { margin-top: 0; }
.form-hint { font-size: var(--t-footnote); color: var(--text3); line-height: 1.4; margin: 6px 4px 0; }
.form-input, .form-select, .form-textarea,
.wallet-config-row input:not([type="checkbox"]), .wallet-config-row select {
  width: 100%; min-height: 48px; padding: 12px 14px;
  background: var(--surface2); color: var(--text);
  border: 1px solid transparent; border-radius: 12px;
  font-size: var(--t-body); line-height: 1.3;
  appearance: none; -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text3); }
.form-input:focus, .form-select:focus, .form-textarea:focus,
.wallet-config-row input:not([type="checkbox"]):focus, .wallet-config-row select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-textarea, textarea.form-input { resize: none; line-height: 1.45; min-height: 88px; }
select.form-input, .form-select, .more-row select, .wallet-config-row select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text3) 50%), linear-gradient(135deg, var(--text3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 34px;
}
input[type="date"].form-input, input[type="time"].form-input { min-height: 48px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 22px; height: 22px; flex: 0 0 auto; }
.form-row { display: flex; gap: var(--s3); margin-top: var(--s3); }
.form-row > * { flex: 1; min-width: 0; }
.tp-field-error { outline: 2px solid var(--alert); outline-offset: 2px; }
.file-input-wrap {
  position: relative; display: flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 52px; padding: var(--s3) var(--s4); margin-bottom: var(--s3);
  background: transparent; border: 1.5px dashed var(--border2); border-radius: 12px;
  color: var(--accent); font-size: var(--t-subhead); font-weight: 500; cursor: pointer; text-align: center;
}
.file-input-wrap input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* ── 7. СПИСКИ · inset-группы в духе iOS ───────────────────────────────────── */
.group {
  background: var(--surface); border-radius: var(--r-md); overflow: hidden;
  margin-bottom: var(--s2);
}
.group > * + * { border-top: 1px solid var(--sep); }
.more-row, .day-menu-item, .rm-item, .tpl-row, .sheet-opt, .search-result-item, .map-trip-check {
  display: flex; align-items: center; gap: var(--s3); width: 100%;
  min-height: 52px; padding: 10px var(--s4);
  background: var(--surface); border: 0; border-radius: 0; margin: 0;
  color: var(--text); font-size: var(--t-body); font-weight: 400; text-align: left;
  -webkit-tap-highlight-color: transparent; transition: background-color .12s;
}
button.more-row:active, .day-menu-item:active, .rm-item:active, .tpl-row:active,
.sheet-opt:active, .search-result-item:active { background: var(--surface3); }
.more-row-ic {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface2); color: var(--text);
}
.more-row-ic .ic { width: 18px; height: 18px; }
.more-row-arr, .tpl-arr, .start-card-arr, .ex-go, .trip-rate-arrow, .dr-go, .bud-stats-arr {
  margin-left: auto; color: var(--text3); font-size: 0; flex: 0 0 auto;
}
.more-row-arr::after, .tpl-arr::after, .start-card-arr::after, .trip-rate-arrow::after,
.dr-go::after, .bud-stats-arr::after {
  content: ''; display: inline-block; width: 8px; height: 8px;
  border-top: 2px solid currentColor; border-right: 2px solid currentColor;
  transform: rotate(45deg); border-radius: 1px; opacity: .8;
}
.more-row select {
  margin-left: auto; min-height: 36px; max-width: 52%; padding: 6px 30px 6px 10px;
  background-color: var(--surface2) !important; color: var(--text) !important;
  border: 0 !important; border-radius: 9px !important; font-size: var(--t-subhead) !important; font-weight: 500 !important;
  appearance: none; -webkit-appearance: none;
}
.more-row-2l .more-row-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; text-align: left; }
.more-row-2l .more-row-txt small { font-size: var(--t-footnote); font-weight: 400; color: var(--text2); line-height: 1.3; white-space: normal; }
.more-row > span:not([class]) { min-width: 0; }
.day-menu-item .ic, .rm-item .ic { color: var(--text2); }
.rm-item.rm-danger { color: var(--alert); }
.rm-title, #row-menu-sheet .rm-title {
  font-size: var(--t-footnote); color: var(--text2); text-align: center; font-weight: 500;
  text-transform: none; letter-spacing: 0; margin: 0 var(--s4) var(--s3);
}
#row-menu-items, #day-menu-modal .modal-sheet, #template-sheet .modal-sheet { display: block; }
#row-menu-items { background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
#row-menu-items > * + * { border-top: 1px solid var(--sep); }
.day-menu-item { border-radius: 0; }
#day-menu-modal .day-menu-item:first-of-type { border-radius: var(--r-md) var(--r-md) 0 0; }
#day-menu-modal .day-menu-item + .day-menu-item { border-top: 1px solid var(--sep); }
#day-menu-modal .day-menu-item:last-of-type { border-radius: 0 0 var(--r-md) var(--r-md); }
.tpl-row { justify-content: space-between; }
#template-sheet .tpl-row:first-of-type { border-radius: var(--r-md) var(--r-md) 0 0; }
#template-sheet .tpl-row + .tpl-row { border-top: 1px solid var(--sep); }
#template-sheet .tpl-row:last-of-type { border-radius: 0 0 var(--r-md) var(--r-md); }
.tpl-row span:first-child { display: inline-flex; align-items: center; gap: var(--s2); }
.tpl-blank { color: var(--text2); }
.tpl-sub { font-size: var(--t-subhead); color: var(--text2); line-height: 1.45; margin: -6px 0 var(--s4); }

/* Строка «ключ — значение» */
.bud-line, .stats-row-item, .cfg-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  min-height: 48px; padding: 10px var(--s4); background: var(--surface);
  font-size: var(--t-body); color: var(--text); border: 0;
}
.bud-line > span:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bud-line > span:last-child { flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text2); }
.bud-line-empty { color: var(--text3); justify-content: center; }
.wallet-indicator { width: 8px; height: 8px; border-radius: 50%; margin-right: var(--s2); display: inline-block; vertical-align: 1px; }
.wallet-indicator.green  { background: var(--positive); }
.wallet-indicator.yellow { background: var(--accent); }
.wallet-indicator.red    { background: var(--alert); }

/* Разделители */
.divider, .now-divider, .fin-divider { height: 1px; background: var(--sep); margin: var(--s5) 0; }

/* ── 8. ЛИСТЫ И ОКНА ───────────────────────────────────────────────────────── */
.modal {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: var(--dim);
  justify-content: flex-end; align-items: center; flex-direction: column;
}
.modal.open { display: flex; animation: fadeDim .2s ease; }
.modal.modal-top { z-index: 650; }
@keyframes fadeDim { from { opacity: 0; } to { opacity: 1; } }
.modal-sheet {
  position: relative;
  background: var(--sheet);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 0 var(--gutter) calc(var(--s5) + env(safe-area-inset-bottom));
  width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  line-height: 1.4;
  box-shadow: 0 -2px 24px rgba(0,0,0,.18);
  animation: sheetUp .28s var(--ease);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
/* Полоска: видимая линия 36×5, зона захвата 44 */
.modal-handle{
  position: sticky; top: 0; z-index: 3;
  width: 100%; height: 30px; margin: 0 0 2px;
  background: var(--sheet); cursor: grab; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.modal-handle::before{
  content: ''; display: block; width: 36px; height: 5px; border-radius: 3px;
  background: var(--border2);
}
.modal-handle:active{ cursor: grabbing; }
.modal-title {
  display: flex; align-items: center; gap: var(--s2);
  font-family: var(--font-display); font-size: var(--t-title2); font-weight: 700; letter-spacing: -0.015em;
  line-height: 1.2; color: var(--text); margin: 4px 4px var(--s4); overflow-wrap: anywhere;
}
.modal-title .ic { color: var(--text2); }
/* Внутри листа группы и поля светлее/темнее фона листа, как в iOS */
.modal-sheet, .app-ov-sheet, .sheet, .modal-overlay > div {
  --surface: var(--sheet-surface); --surface2: var(--sheet-surface2); --surface3: var(--sheet-surface3);
}
.rs-sheet { max-height: 94vh; max-height: 94dvh; }

/* Лист выбора (валюта остатка) */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 1200; display: flex; align-items: flex-end; justify-content: center;
  background: var(--dim); opacity: 0; transition: opacity .18s;
}
.sheet-overlay.open { opacity: 1; }
.sheet {
  width: 100%; max-width: 480px; padding: var(--s3) var(--gutter) calc(var(--s4) + env(safe-area-inset-bottom));
  background: transparent; transform: translateY(16px); transition: transform .2s var(--ease);
  display: flex; flex-direction: column;
}
.sheet-overlay.open .sheet { transform: none; }
.sheet-title {
  background: var(--surface); border-radius: var(--r-md) var(--r-md) 0 0;
  font-size: var(--t-footnote); color: var(--text2); text-align: center; font-weight: 500;
  text-transform: none; letter-spacing: 0; padding: 14px var(--s4); margin: 0;
  border-bottom: 1px solid var(--sep);
}
.sheet-opt { justify-content: center; color: var(--accent); font-size: var(--t-title3); min-height: 56px; }
.sheet-opt + .sheet-opt { border-top: 1px solid var(--sep); }
.sheet-opt:not(.sheet-cancel):last-of-type, .sheet .sheet-opt:nth-last-child(2) { border-radius: 0 0 var(--r-md) var(--r-md); }
.sheet-cancel {
  margin-top: var(--s2); border-radius: var(--r-md) !important; border-top: 0 !important;
  font-weight: 600; color: var(--accent);
}

/* Внутренние диалоги (confirm / prompt), toast, подсказки */
.app-ov { position: fixed; inset: 0; z-index: 100002; background: var(--dim); display: flex; align-items: flex-end; justify-content: center; }
.app-ov-sheet {
  width: 100%; max-width: 560px;
  background: var(--sheet) !important; border-radius: var(--r-sheet) var(--r-sheet) 0 0 !important;
  padding: var(--s5) var(--gutter) calc(var(--s5) + env(safe-area-inset-bottom)) !important;
  box-shadow: 0 -2px 24px rgba(0,0,0,.2) !important;
  animation: sheetUp .26s var(--ease);
}
.ov-title { font-size: var(--t-title3); font-weight: 650; line-height: 1.3; color: var(--text); margin-bottom: 8px; letter-spacing: -0.01em; }
.ov-text  { font-size: var(--t-subhead); line-height: 1.5; color: var(--text2); margin-bottom: var(--s4); }
.btn-primary.is-danger { background: var(--alert-fill); color: #fff; }
#toast-el.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 9999;
  width: max-content; max-width: calc(100vw - 32px);
  background: var(--inst); color: var(--inst-ink);
  border: 1px solid var(--inst-line); border-radius: 999px;
  padding: 11px 18px; box-shadow: var(--inst-shadow);
  font-size: var(--t-subhead); font-weight: 500; line-height: 1.35; text-align: center;
  overflow-wrap: anywhere; white-space: normal; transition: opacity .25s;
}
#toast-el .ic { color: var(--inst-accent); }
.hint-bar {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 12px);
  transform: translateX(-50%) translateY(-12px); z-index: 120;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  background: var(--inst); color: var(--inst-ink); font-size: var(--t-footnote); font-weight: 500;
  padding: 8px 8px 8px 16px; border-radius: 999px; box-shadow: var(--inst-shadow);
  opacity: 0; transition: opacity .22s ease, transform .22s var(--ease);
}
.hint-bar.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hint-bar button { background: var(--inst-btn); border: 0; color: inherit; width: 28px; height: 28px; border-radius: 50%; font-size: 12px; line-height: 1; }
.offline-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(86px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); text-align: center;
  background: var(--inst); color: var(--inst-ink); border: 1px solid var(--inst-line);
  padding: 9px 16px; border-radius: 999px; box-shadow: var(--inst-shadow);
  font-size: var(--t-footnote); font-weight: 500; line-height: 1.3; z-index: 9998;
}
.offline-bar[hidden] { display: none; }
.offline-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--inst-ink2); flex: 0 0 auto; }

/* ── 9. ПРИБОР · один живой объект экрана ──────────────────────────────────── */
.inst {
  position: relative; overflow: hidden;
  background: var(--inst); color: var(--inst-ink);
  border-radius: var(--r-lg); padding: var(--s4) 18px 18px;
  box-shadow: var(--inst-shadow);
  --text: var(--inst-ink); --text2: var(--inst-ink2); --text3: var(--inst-ink2);
  --sep: var(--inst-line); --border: var(--inst-line); --border2: var(--inst-line);
  --surface2: var(--inst-btn); --surface3: var(--inst-btn-press);
  --accent: var(--inst-accent); --on-accent: var(--inst-on-accent); --accent-soft: rgba(124,156,191,.22);
  -webkit-tap-highlight-color: transparent;
}
.inst-extent { display: flex; align-items: center; gap: 4px; min-height: 16px; }
.inst-extent i { flex: 1 1 0; height: 4px; border-radius: 2px; background: var(--inst-line); min-width: 3px; }
.inst-extent i.past { background: var(--inst-past); }
.inst-extent i.on { background: var(--inst-accent); }
.inst-extent em { font-style: normal; font-size: var(--t-caption); color: var(--inst-ink2); margin-left: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inst-extent:empty { display: none; }
.inst-title {
  font-family: var(--font-display);
  font-size: var(--t-title2); line-height: 1.2; font-weight: 650; letter-spacing: -0.015em;
  margin-top: var(--s4); overflow-wrap: anywhere; hyphens: auto;
}
.inst-extent:empty + .inst-title, .inst-title:first-child { margin-top: 2px; }
.inst-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: var(--t-subhead); color: var(--inst-ink2); margin-top: 6px; line-height: 1.35;
}
.inst-meta .ic { width: 15px; height: 15px; }
.inst-meta:empty { display: none; }
.inst-track { margin-top: 18px; }
.inst-track[hidden] { display: none; }
.inst-bar { position: relative; height: 6px; border-radius: 3px; background: var(--inst-line); }
.inst-bar b { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--inst-accent); transition: width .4s var(--ease); }
.inst-bar u {
  position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  background: var(--inst-ink); box-shadow: 0 0 0 4px var(--inst); transition: left .4s var(--ease);
}
.inst-ticks { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: var(--t-footnote); color: var(--inst-ink2); margin-top: 8px; font-variant-numeric: tabular-nums; }
.inst-ticks .now { color: var(--inst-ink); font-weight: 600; text-align: center; flex: 1 1 auto; }
.inst-next {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: var(--s3);
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--inst-line);
}
.inst-next[hidden] { display: none; }
.inst-count {
  font-family: var(--font-display);
  font-size: var(--t-count); line-height: 1; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; flex: 0 1 auto; overflow-wrap: anywhere; min-width: 0;
}
.inst-count-label { font-size: var(--t-subhead); line-height: 1.35; color: var(--inst-ink2); padding-bottom: 2px; min-width: 0; overflow-wrap: anywhere; }
.inst-count-label strong { display: block; color: var(--inst-ink); font-weight: 600; }
.inst-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--s2); margin-top: 18px; }
.inst-actions.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.inst-actions.one { grid-template-columns: 1fr; }
.inst-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; min-width: 0; padding: 6px 8px;
  border: 0; border-radius: var(--r); background: var(--inst-btn); color: var(--inst-ink);
  font-size: var(--t-callout); font-weight: 600; line-height: 1.15; text-align: center;
  white-space: nowrap; overflow: hidden; transition: background-color .15s;
}
/* Подпись никогда не обрезается и не ужимается: если не помещается, fitInstActions
   перестраивает ряд. Многоточие («Марш…») недопустимо. */
.inst-btn > span { flex: 0 0 auto; }
.inst-actions.stack .inst-btn { white-space: normal; word-break: normal; overflow-wrap: normal; hyphens: manual; }
/* Раскладку выбирает fitInstActions() по фактической ширине подписей:
   wrap — главное действие на всю ширину, stack — все действия столбиком */
.inst-actions.wrap { grid-template-columns: repeat(2, minmax(0,1fr)); }
.inst-actions.wrap .pri { grid-column: 1 / -1; }
.inst-actions.stack { grid-template-columns: 1fr; }
.inst-actions.stack .pri { grid-column: auto; }
.inst-btn:active { background: var(--inst-btn-press); }
.inst-btn.pri { background: var(--inst-accent); color: var(--inst-on-accent); }
.inst-btn.pri:active { background: #6b8bae; }
.inst-btn .ic { width: 18px; height: 18px; flex: 0 0 auto; }
.inst-btn[hidden] { display: none; }
.inst-note { font-size: var(--t-subhead); color: var(--inst-ink2); line-height: 1.45; margin-top: 8px; }
.inst-big {
  font-family: var(--font-display);
  font-size: var(--t-large); font-weight: 650; letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.inst-big small { font-size: var(--t-title3); font-weight: 600; color: var(--inst-ink2); margin-left: 4px; }
.inst-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.inst-label { font-size: var(--t-subhead); color: var(--inst-ink2); }
.inst-state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-footnote); font-weight: 600; color: var(--inst-ink2);
}
.inst-state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.inst-state.ok { color: var(--inst-positive); }
.inst-state.over { color: var(--inst-alert); }
.inst .progress-wrap { background: var(--inst-line); }
.inst .progress-fill { background: var(--inst-ink); }

/* Прогресс-шкала (вне прибора) */
.progress-wrap { background: var(--accent-soft); border-radius: 4px; height: 8px; overflow: hidden; margin-top: var(--s3); }
.progress-fill { height: 100%; border-radius: 4px; background: var(--text); transition: width .5s var(--ease); }

/* ── 10. СЕГОДНЯ ───────────────────────────────────────────────────────────── */
#now-mode { margin-bottom: 0; }
.now-inst { cursor: pointer; }
.now-inst:active { transform: scale(.995); }
.now-inst { transition: transform .15s var(--ease); }
.now-inst .inst-title { transition: opacity .2s; }
.now-inst.is-swapping .inst-title, .now-inst.is-swapping .inst-meta { opacity: 0; }
.today-money { margin-top: var(--s6); padding: 0 4px; }
.today-money .sec-title { margin-bottom: var(--s2); }
.money-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.money-big {
  font-family: var(--font-display);
  font-size: var(--t-large); font-weight: 650; letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.money-big.neg { color: var(--alert); }
.money-conv { font-size: var(--t-subhead); color: var(--text2); font-variant-numeric: tabular-nums; }
.money-conv:empty { display: none; }
.money-legend { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--t-footnote); color: var(--text2); margin-top: var(--s2); font-variant-numeric: tabular-nums; }
.money-legend:empty { display: none; }
.today-money .progress-wrap { height: 8px; }
.today-money.no-limit .progress-wrap { display: none; }
#main-day-timeline-section .sec-head { margin-top: var(--s6); }
.tl-list { background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.tl-row {
  display: flex; align-items: center; gap: var(--s3); width: 100%;
  min-height: 54px; padding: 10px var(--s4);
  background: var(--surface); border: 0; color: var(--text); text-align: left;
  -webkit-tap-highlight-color: transparent; transition: background-color .12s;
}
.tl-row + .tl-row { border-top: 1px solid var(--sep); }
.tl-row:active { background: var(--surface3); }
.tl-time { flex: 0 0 auto; min-width: 3.1em; font-size: var(--t-body); font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-name { flex: 1 1 auto; min-width: 0; font-size: var(--t-body); line-height: 1.3; overflow-wrap: anywhere; display: flex; align-items: center; gap: 8px; }
.tl-name .ic { color: var(--text3); flex: 0 0 auto; }
.tl-amt { flex: 0 0 auto; font-size: var(--t-subhead); color: var(--text2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-flag { flex: 0 0 auto; color: var(--accent); display: inline-flex; }
.tl-row.done .tl-time, .tl-row.done .tl-name { color: var(--text3); font-weight: 400; }
.tl-row.done .tl-name { font-size: var(--t-subhead); }
.tl-name > span { min-width: 0; }
.tl-late { display: block; font-size: var(--t-footnote); color: var(--text2); margin-top: 1px; }
.tl-row.late .tl-time { color: var(--text2); font-weight: 500; }
.tl-empty { padding: 16px; color: var(--text2); font-size: var(--t-subhead); background: var(--surface); }

.today-empty {
  display: none; margin-top: var(--s2);
  padding: var(--s6) var(--s4) var(--s5); text-align: center;
}
.today-empty.inst { text-align: left; padding: var(--s4) 18px 18px; }
.today-empty-icon { display: inline-flex; color: var(--text3); margin-bottom: var(--s3); }
.today-empty-icon .ic { width: 30px; height: 30px; }
.today-empty.inst .today-empty-icon { color: var(--inst-accent); margin-bottom: var(--s2); }
.today-empty-title {
  font-family: var(--font-display); font-size: var(--t-title2); font-weight: 650; letter-spacing: -0.015em;
  line-height: 1.2; margin-bottom: var(--s2); color: var(--text); overflow-wrap: anywhere;
}
.today-empty-sub { font-size: var(--t-subhead); color: var(--text2); line-height: 1.5; max-width: 34em; margin: 0 auto; text-wrap: pretty; }
.today-empty.inst .today-empty-sub { margin: 0; color: var(--inst-ink2); }
#today-empty-btn { margin-top: var(--s5); }
.today-empty.inst #today-empty-btn { background: var(--inst-accent); color: var(--inst-on-accent); }

/* Контекст авто-дня под заголовком */
.now-context-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -6px 4px var(--s3); }
.ncn-t { font-size: var(--t-footnote); color: var(--text2); line-height: 1.4; }
.ncn-btn { background: transparent; border: 0; color: var(--accent); min-height: 36px; padding: 0 2px; font-size: var(--t-footnote); font-weight: 600; }

/* Демо: тихая строка под заголовком вместо плашки */
.demo-banner {
  display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap;
  margin: 0 4px var(--s3); padding: 0; background: none; box-shadow: none; border: 0;
  font-size: var(--t-footnote); color: var(--text2);
  position: static; transform: none; width: auto;
}
.demo-banner > span { flex: 0 1 auto; min-width: 0; }
.demo-banner button {
  flex: 0 0 auto; white-space: nowrap; background: none; border: 0;
  min-height: 36px; padding: 0 2px; font-size: var(--t-footnote); font-weight: 600; color: var(--accent);
}
.demo-banner .demo-del { color: var(--text3); font-weight: 500; }
.screen > .demo-banner { position: static; }
#screen-today > .demo-banner { margin-top: -10px; }

/* ── 11. ТАЙМЛАЙН ДНЯ ──────────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 26px; margin: var(--s2) 0 0; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 12px; bottom: 12px; width: 2px;
  background: var(--sep); border-radius: 1px;
}
.t-node { position: relative; margin-bottom: var(--s2); }
.t-node:last-child { margin-bottom: 0; }
.t-dot {
  position: absolute; left: -24px; top: 18px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 2.5px solid var(--accent); z-index: 2; transition: all .2s;
}
.t-done .t-dot { background: var(--text3); border-color: var(--text3); }
.t-card {
  background: var(--surface); border: 0; border-radius: var(--r-md);
  padding: 12px var(--s4) 14px; cursor: pointer; position: relative; min-width: 0;
  transition: background-color .12s, opacity .25s;
}
.t-card:active { background: var(--surface3); }
.t-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); margin-bottom: 4px; }
.t-time {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--t-subhead); font-weight: 600; color: var(--text2);
  letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums;
}
.t-name { font-size: var(--t-body); font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; color: var(--text); overflow-wrap: anywhere; }
.t-name .ic { color: var(--text3); margin-right: 4px; }
.t-budget { display: none; }
.t-done .t-card { opacity: .62; }
.t-done .t-name { font-weight: 400; }
.check-btn {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 34px; padding: 0 12px; border-radius: 999px; border: 0;
  background: var(--surface2); color: var(--text); font-size: var(--t-footnote); font-weight: 600;
  white-space: nowrap; position: relative; transition: background-color .15s, color .15s;
}
.check-btn::after { content: ''; position: absolute; inset: -6px -4px; }
.check-btn .ic { color: var(--accent); }
.check-btn:active { background: var(--surface3); }
.t-done .check-btn { background: transparent; color: var(--positive); }
.t-route-tag {
  display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px;
  font-size: var(--t-caption); font-weight: 600; color: var(--accent);
}
.t-dot-exp { background: var(--text3); border-color: var(--text3); width: 10px; height: 10px; left: -22px; top: 16px; }
.t-expense-node { margin-bottom: var(--s2); }
.t-expense-card {
  display: flex; align-items: center; gap: var(--s2); min-height: 44px;
  background: transparent; border: 1px solid var(--sep); border-radius: 12px; padding: 6px 12px;
  cursor: pointer; position: relative; flex-wrap: wrap;
}
.t-expense-card:active { background: var(--surface2); }
.t-exp-time { font-size: var(--t-footnote); color: var(--text3); font-weight: 600; min-width: 2.8em; font-variant-numeric: tabular-nums; }
.t-exp-title { flex: 1; min-width: 0; font-size: var(--t-subhead); color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-exp-title .ic { width: 14px; height: 14px; vertical-align: -2px; }
.t-exp-amount { font-size: var(--t-subhead); color: var(--text); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Управление строкой (долгое нажатие) */
.admin-ctrl { display: none !important; gap: var(--s2); justify-content: flex-end; margin-top: var(--s3); width: 100%; }
.t-card.show-ctrl .admin-ctrl, .card.show-ctrl .admin-ctrl, .day-card.show-ctrl .admin-ctrl { display: flex !important; animation: fadeDim .15s ease; }
body.edit-mode .admin-ctrl { display: flex !important; }
.config-panel { display: none; }
body.edit-mode .config-panel { display: block; }

/* Перетаскивание */
.sortable-drag { opacity: .9; }
.sortable-ghost, .timeline-container.sortable-ghost { opacity: .35; }

/* Скелетоны загрузки */
@keyframes skelShimmer { 0% { background-position: -200px 0; } 100% { background-position: calc(200px + 100%) 0; } }
.skeleton-node { position: relative; margin-bottom: var(--s2); }
.skeleton-dot { display: none; }
.skeleton-card, .skeleton-card-full {
  background: var(--surface); border-radius: var(--r-md); padding: var(--s4); margin-bottom: var(--s2);
}
.skeleton-line {
  height: 12px; border-radius: 6px; margin-bottom: var(--s2);
  background: var(--surface2);
  background-image: linear-gradient(90deg, var(--surface2) 0%, var(--surface3) 50%, var(--surface2) 100%);
  background-size: 200px 100%; background-repeat: no-repeat;
  animation: skelShimmer 1.3s ease-in-out infinite;
}
.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line.short  { width: 40%; }
.skeleton-line.medium { width: 65%; }

/* Пустые состояния */
.empty-state, .trip-empty {
  max-width: 440px; margin: 0 auto; padding: var(--s6) var(--s2) var(--s5);
  display: flex; flex-direction: column; align-items: stretch; text-align: center;
  color: var(--text2); font-size: var(--t-subhead); line-height: 1.5; text-wrap: pretty;
}
.empty-state .e-icon, .trip-empty .e-icon { color: var(--text3); margin-bottom: var(--s3); display: flex; justify-content: center; }
.empty-state .e-icon .ic, .trip-empty .e-icon .ic { width: 30px; height: 30px; }
.trip-empty-text {
  font-family: var(--font-display); font-size: var(--t-title3); font-weight: 650; color: var(--text);
  letter-spacing: -0.012em; line-height: 1.3; margin: 0 auto var(--s2); max-width: 22em; text-wrap: balance;
}
.empty-state .es-text { margin: var(--s2) 0 0; }
.empty-state .es-cta { margin-top: var(--s4); align-self: center; width: auto; min-width: 220px; }
.empty-state .btn-primary { align-self: center; width: auto; min-width: 240px; padding: 12px 24px; }

/* ── 12. ЭКРАН ДНЯ ─────────────────────────────────────────────────────────── */
.journey-hero { margin: 0 0 var(--s4); padding: var(--s2) 4px 0; }
.journey-hero h2 {
  font-family: var(--font-display);
  font-size: var(--t-title1); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15;
  color: var(--text); overflow-wrap: anywhere;
}
#current-day-meta { font-size: var(--t-subhead) !important; color: var(--text2) !important; margin-top: 4px !important; }
#daily-budget-info { font-size: var(--t-footnote) !important; color: var(--text2) !important; margin-top: 4px !important; }
#day-emotion-btn { width: 44px; height: 44px; padding: 0 !important; justify-content: center; border-radius: 50% !important; font-size: 22px !important; background: var(--surface2) !important; }
.day-actions { display: flex; gap: var(--s2); margin-bottom: var(--s5); }
.day-actions .btn-primary { flex: 1; margin-top: 0; }
.day-actions .btn-expense { flex: 0 0 auto; margin: 0; width: auto; padding: 0 18px; background: var(--surface2); color: var(--text); }
.day-actions .btn-expense .ic { color: var(--text2); }
.day-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 var(--s3); margin: 0 0 var(--s2); -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-chip {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-width: 44px; min-height: 48px; padding: 4px 8px; border-radius: 12px; border: 0;
  background: var(--surface); -webkit-tap-highlight-color: transparent; transition: background-color .15s;
}
.day-chip-n { font-size: var(--t-subhead); font-weight: 650; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.day-chip-d { font-size: var(--t-caption2); color: var(--text2); font-weight: 500; }
.day-chip.active { background: var(--accent); }
.day-chip.active .day-chip-n, .day-chip.active .day-chip-d { color: var(--on-accent); }

.emotion-bar { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s5); justify-content: center; }
.e-btn { font-size: 24px; line-height: 1; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 14px; border: 2px solid transparent; background: var(--surface); transition: border-color .15s, transform .1s; }
.e-btn.selected { border-color: var(--accent); background: var(--accent-soft); }
.e-btn:active { transform: scale(.94); }
#modal-emotion-picker { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; margin-bottom: var(--s5); }

/* ── 13. АКТИВНОСТЬ ────────────────────────────────────────────────────────── */
.av-hero { background: transparent; border: 0; border-radius: 0; margin: 0 0 var(--s4); overflow: visible; position: relative; }
.av-type-stripe { display: none; }
.av-hero-body { padding: var(--s2) 4px 0; display: flex; flex-direction: column; }
.av-hero-body .av-title { order: 1; }
.av-hero-body .av-meta-row { order: 2; margin: 8px 0 0; }
.av-time .ic { width: 15px; height: 15px; color: var(--text3); }
.av-meta-row { display: flex; align-items: center; gap: var(--s2); margin-bottom: 6px; flex-wrap: wrap; }
.av-time { font-size: var(--t-subhead); font-weight: 600; color: var(--text2); font-variant-numeric: tabular-nums; }
.av-title {
  font-family: var(--font-display);
  font-size: var(--t-title1); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere;
}
.av-hero.av-current { background: var(--inst); color: var(--inst-ink); border-radius: var(--r-lg); padding: var(--s4) 18px 18px; box-shadow: var(--inst-shadow); }
.av-hero.av-current .av-hero-body { padding: 0; }
.av-hero.av-current .av-time { color: var(--inst-ink2); }
.av-hero.av-current .badge { background: var(--inst-btn); color: var(--inst-ink2); }
.av-now-badge {
  display: inline-flex; align-items: center; gap: 6px; background: none; color: var(--inst-accent);
  font-size: var(--t-footnote); font-weight: 600; letter-spacing: 0; text-transform: none;
  padding: 0; margin-left: 2px;
}
.av-now-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.av-open-btn {
  display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 60px;
  background: var(--surface); color: var(--text); border: none;
  border-radius: var(--r-md); padding: 12px var(--s4); margin-bottom: var(--s3);
  text-align: left; -webkit-tap-highlight-color: transparent; transition: background-color .15s;
}
.av-open-btn:active { background: var(--surface3); }
.av-open-ic, .av-open-chev { color: var(--text2); }
.av-open-ic { flex-shrink: 0; display: inline-flex; }
.av-open-ic .ic { width: 22px; height: 22px; }
.av-open-body { display: flex; flex-direction: column; min-width: 0; }
.av-open-tx { font-size: var(--t-body); font-weight: 600; }
.av-open-sub { font-size: var(--t-footnote); font-weight: 400; opacity: .8; margin-top: 1px; }
.av-open-chev { margin-left: auto; opacity: .75; font-size: var(--t-body); }

.av-block {
  background: var(--surface); border: 0; border-radius: var(--r-md);
  padding: 14px var(--s4); margin-bottom: var(--s3);
}
.av-block-label { font-size: var(--t-footnote); font-weight: 400; color: var(--text2); text-transform: none; letter-spacing: 0; margin-bottom: 6px; }
.av-block-text { font-size: var(--t-body); line-height: 1.5; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.av-block-text:empty { display: none; }
.av-block .photo-gallery { margin: 0; padding: 0; background: none; border: none; }
.av-block .av-transport-carousel { margin: var(--s2) 0 0; }
#act-view-address-text .ic { width: 15px; height: 15px; vertical-align: -2px; color: var(--text3); margin-right: 2px; }
.av-route-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: var(--s3);
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--surface2); color: var(--text); font-size: var(--t-subhead); font-weight: 600;
}
.av-route-btn .ic { width: 16px; height: 16px; color: var(--text2); }

.av-budget-row {
  display: flex; align-items: center; gap: 0; flex-wrap: wrap;
  background: var(--surface); border: 0; border-radius: var(--r-md);
  padding: 12px var(--s4); margin-bottom: var(--s3);
}
.av-budget-cell { flex: 1 1 0; min-width: 0; }
.av-budget-label { font-size: var(--t-footnote); color: var(--text2); text-transform: none; letter-spacing: 0; font-weight: 400; margin-bottom: 2px; }
.av-budget-val { font-size: var(--t-title3); font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--text); }
.av-budget-val.amber { color: var(--text); }
.av-budget-val.green { color: var(--positive); }
.av-budget-divider { width: 1px; align-self: stretch; background: var(--sep); margin: 0 var(--s4); flex-shrink: 0; }
.av-record-btn {
  flex-shrink: 0; margin-left: var(--s3); min-height: 40px; padding: 0 14px;
  background: var(--accent-soft); color: var(--accent); border: none; border-radius: 999px;
  font-size: var(--t-subhead); font-weight: 600; white-space: nowrap;
}
.av-record-btn:active { background: var(--accent-line); }
.av-budget-rub { display: none; }

.av-accordions { display: flex; flex-direction: column; gap: 0; background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.av-accordions > .av-acc-block + .av-acc-block { border-top: 1px solid var(--sep); }
.av-accordions > .av-acc-block[style*="display:none"] + .av-acc-block,
.av-accordions > .av-acc-block[style*="display: none"] + .av-acc-block { border-top: 0; }
.av-acc-block { background: transparent; border: 0; border-radius: 0; overflow: hidden; }
.av-acc-toggle {
  width: 100%; min-height: 52px; background: transparent; border: none;
  padding: 10px var(--s4); text-align: left;
  font-size: var(--t-body); font-weight: 400; color: var(--text);
  display: flex; justify-content: space-between; align-items: center;
  -webkit-tap-highlight-color: transparent; transition: background-color .12s;
}
.av-acc-toggle:active { background: var(--surface3); }
.av-acc-arrow { font-size: 0; color: var(--text3); display: inline-block; transition: transform .2s var(--ease); }
.av-acc-arrow::after { content: ''; display: inline-block; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px,-2px); }
.av-acc-arrow.open { transform: rotate(180deg); }
.av-acc-body { padding: 0 var(--s4) var(--s4); animation: accBodyIn .2s var(--ease); }
@keyframes accBodyIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.av-acc-text { font-size: var(--t-body); line-height: 1.55; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.av-acc-text a { color: var(--accent); }
.av-acc-sublabel { font-size: var(--t-footnote); font-weight: 400; color: var(--text2); text-transform: none; letter-spacing: 0; margin-bottom: 6px; }
.av-details-toggle {
  width: 100%; margin: 0 0 var(--s3); background: var(--surface); border-radius: var(--r-md);
}
/* Экран активности: адрес, план/факт и «Детали» — строки одной группы */
.av-group { background: var(--surface); border-radius: var(--r-md); overflow: hidden; margin-bottom: var(--s3); }
.av-group > .av-block, .av-group > .av-budget-row, .av-group > .av-details-toggle {
  background: transparent; border-radius: 0; margin: 0;
}
.av-group > * + * { border-top: 1px solid var(--sep); }
.av-group > [style*="display:none"] + *, .av-group > [style*="display: none"] + * { border-top: 0; }
.av-group .av-route-btn { margin-top: var(--s2); }
#av-details-wrap { margin-bottom: var(--s3); }
.av-transport-carousel, .av-photo-carousel {
  display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: 2px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-bottom: var(--s3);
}
.av-transport-carousel::-webkit-scrollbar, .av-photo-carousel::-webkit-scrollbar { display: none; }
.av-transport-carousel .gallery-thumb, .av-photo-carousel .gallery-thumb { flex: 0 0 132px; height: 100px; border-radius: 12px; }
.av-photo-carousel .gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.av-sticky-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 80; display: none;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: var(--bar); -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--sep);
}
#screen-activity-view.active .av-sticky-bar { display: block; }
.av-done-btn {
  width: 100%; max-width: 560px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; background: var(--accent); color: var(--on-accent); border: none; border-radius: var(--r);
  font-size: var(--t-body); font-weight: 600; transition: background-color .25s, color .25s;
}
.av-done-btn:active { background: var(--accent-press); }
.av-done-btn.done { background: var(--positive-soft); color: var(--positive); }
.act-view-tips-text { }

/* Галереи и превью */
.photo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: var(--s2); margin-top: var(--s2); }
.gallery-thumb { aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: var(--surface2); cursor: zoom-in; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: var(--s2); margin-bottom: var(--s3); }
.preview-thumb { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: var(--surface2); }
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview-thumb .remove-photo {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,.62); color: #fff; font-weight: 600; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.preview-thumb .remove-photo::after { content: ''; position: absolute; inset: -9px; }
.preview-thumb-pdf { background: transparent; }
.gallery-thumb-pdf { display: flex; }
.gallery-thumb-pdf .pdf-chip { min-height: 0; }
.pdf-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 100%; height: 100%; min-height: 64px;
  background: var(--surface2); border: 0; border-radius: 12px; padding: 8px 6px; cursor: pointer; overflow: hidden;
}
.pdf-chip-badge { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: #fff; background: var(--alert-fill); border-radius: 5px; padding: 2px 7px; }
.pdf-chip-name { font-size: 11px; font-weight: 500; color: var(--text2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Полноэкранный просмотр */
.photo-zoom-overlay {
  position: fixed; inset: 0; z-index: 1000; display: none; flex-direction: column;
  background: rgba(0,0,0,.96); opacity: 0; transition: opacity .2s;
}
.photo-zoom-overlay.open { opacity: 1; }
.pz-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; pointer-events: none; }
.pz-counter { pointer-events: none; color: #fff; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.14); border-radius: 999px; padding: 6px 12px; }
.pz-close { pointer-events: auto; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 18px; line-height: 1; }
.pz-viewport { flex: 1; width: 100%; height: 100%; overflow: hidden; touch-action: none; }
.pz-track { display: flex; width: 100%; height: 100%; will-change: transform; }
.pz-slide { flex: 0 0 100%; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: hidden; }
.pz-slide img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; user-select: none; -webkit-user-drag: none; pointer-events: auto; transition: transform .2s; }
.pz-slide img.zoomed { cursor: grab; }
.pz-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 26px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.pz-prev { left: 10px; } .pz-next { right: 10px; }
@media (hover: none) and (pointer: coarse) { .pz-nav { display: none; } }

/* Редактор активности */
.act-details-toggle {
  display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 48px;
  background: transparent; border: 0; border-radius: 12px; padding: 0 4px; margin: var(--s3) 0 0;
  font-size: var(--t-body); font-weight: 500; color: var(--accent); text-align: left;
}
.act-details-toggle:active { background: var(--accent-soft); }
.act-details-toggle.open { color: var(--text2); }
#act-details-section { animation: accBodyIn .22s var(--ease); }
.type-pick { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 6px; margin-bottom: var(--s2); }
.type-pick-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 64px; min-width: 0; padding: 8px 4px; border-radius: 12px;
  background: var(--surface2); border: 0; color: var(--text2);
  font-size: var(--t-caption2); font-weight: 500; transition: background-color .15s, color .15s, box-shadow .15s;
}
.type-pick-btn .ic { width: 22px; height: 22px; }
.type-pick-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.type-pick-btn.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.rating-opt { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s2); }
.r-star {
  display: inline-flex; align-items: center; gap: 2px; line-height: 1.2;
  min-height: 40px; padding: 0 14px; border-radius: 999px; border: 0;
  background: var(--surface2); color: var(--text); font-size: var(--t-subhead); font-weight: 500;
}
.r-star.sel { background: var(--surface2); color: var(--text); font-weight: 650; box-shadow: inset 0 0 0 1.5px var(--text2); }
.r-stars { display: inline-flex; gap: 1px; margin-right: 4px; }
.r-stars .ic { width: 14px; height: 14px; }
.rec-exp-plan-hint {
  font-size: var(--t-subhead); color: var(--text2); background: var(--surface);
  border-radius: 12px; padding: 12px 14px; margin-bottom: var(--s3); border: 0;
}
.rec-exp-amount-big {
  font-size: var(--t-large) !important; font-weight: 650 !important; letter-spacing: -0.02em !important;
  text-align: center !important; min-height: 76px !important; color: var(--text) !important;
  font-variant-numeric: tabular-nums;
}
.qe-target {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--surface); color: var(--text2);
  font-size: var(--t-footnote); font-weight: 500;
  padding: 10px 12px; border-radius: 12px; margin-bottom: var(--s3);
}
.qe-target .ic { width: 15px; height: 15px; color: var(--text2); }
.qe-target-inbox { color: var(--text3); }

/* ── 14. ДНИ · обзор поездки ───────────────────────────────────────────────── */
.hub-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: 0 0 var(--s4); }
.hub-trip {
  position: relative; flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: 1px; padding: 0;
  background: none; border: 0; text-align: left; color: inherit;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hub-trip:active { opacity: .55; }
.hub-eyebrow { font-size: var(--t-subhead); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text2); font-variant-numeric: tabular-nums; }
.hub-trip-name {
  font-family: var(--font-display);
  font-size: var(--t-large); font-weight: 700; letter-spacing: -0.022em; line-height: 1.15; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  /* слова переносятся целиком, строки выравниваются по длине */
  overflow-wrap: break-word; word-break: normal; text-wrap: balance; order: -1;
}
/* Длинные названия поездок: ступенями шкалы вниз, а не обрезкой посреди слова */
.hub-trip-name.is-long { font-size: var(--t-title1); line-height: 1.18; -webkit-line-clamp: 3; }
.hub-trip-name.is-xlong { font-size: var(--t-title2); line-height: 1.22; -webkit-line-clamp: 3; }
.hub-switch {
  flex: 0 0 auto; align-self: flex-start; margin-top: 4px;
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 0;
  background: var(--surface2); color: var(--accent); font-size: var(--t-subhead); font-weight: 600;
}
.hub-switch:active { background: var(--surface3); }
.hub-title { font-family: var(--font-display); font-size: var(--t-large); font-weight: 700; letter-spacing: -0.022em; margin: var(--s2) 4px var(--s4); }
.stats-screen-title { font-family: var(--font-display); font-size: var(--t-title1) !important; font-weight: 700; color: var(--text) !important; letter-spacing: -0.02em; margin: 0 4px var(--s4); display: block; }

/* Сводка поездки — тихая строка обзора над днями */
.trip-summary {
  display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 60px;
  margin-bottom: var(--s5); padding: 12px var(--s4); border: 0; border-radius: var(--r-md);
  background: var(--surface); color: var(--text); text-align: left; transition: background-color .12s;
}
.trip-summary:active { background: var(--surface3); }
.ts-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--s2); }
.ts-line { font-size: var(--t-subhead); color: var(--text); line-height: 1.4; font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; column-gap: 6px; }
.ts-i { white-space: nowrap; }
.ts-money { font-size: var(--t-footnote); color: var(--text2); font-variant-numeric: tabular-nums; margin-top: -4px; }
.ts-i + .ts-i::before { content: "·"; margin-right: 6px; color: var(--text3); }
.trip-summary-cities { display: flex; flex-wrap: wrap; gap: 6px; }
.trip-summary .tsc { min-height: 28px; padding: 3px 10px; background: var(--surface2); color: var(--text2); }
.ts-files { font-size: var(--t-caption); font-weight: 500; color: var(--text2); flex: 0 0 auto; }
.ts-files.on { display: inline-flex; align-items: center; gap: 4px; }
.ts-files .ic { width: 12px; height: 12px; }
.days-city-group { margin-bottom: var(--s5); }
.days-city-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: 0 4px var(--s2); margin: 0; border: 0; }
.days-city-name { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-title3); font-weight: 650; letter-spacing: -0.01em; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.days-city-ic { display: inline-flex; color: var(--text3); }
.days-city-ic .ic { width: 16px; height: 16px; }
.days-city-dates { font-size: var(--t-footnote); color: var(--text2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.days-city-empty { font-size: var(--t-subhead); color: var(--text2); padding: var(--s3) 4px; }
.days-list { background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
#days-overview-content .day-card {
  position: relative; display: block; background: var(--surface); border: 0; border-radius: 0; padding: 0; margin: 0;
  transition: background-color .15s;
}
#days-overview-content .day-card + .day-card { border-top: 1px solid var(--sep); margin-top: 0; }
#days-overview-content > .btn-ghost { margin-top: var(--s4); }
/* Строка дня: календарный листок слева, главное место дня, тихие траты справа */
#days-overview-content .day-row {
  width: 100%; text-align: left; background: transparent; color: inherit; font: inherit; cursor: pointer;
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; column-gap: var(--s3);
  min-height: 64px; padding: 10px 80px 10px var(--s4); border: none; border-radius: 0; -webkit-tap-highlight-color: transparent;
}
#days-overview-content .day-card.is-current .day-row { padding-right: 40px; }
#days-overview-content .day-row:active { background: var(--surface3); }
.dr-cal { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.dr-num { font-size: var(--t-title2); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.dr-wd { margin-top: 4px; font-size: var(--t-caption2); font-weight: 500; color: var(--text2); white-space: nowrap; }
.day-card.is-current .dr-num, .day-card.is-current .dr-wd { color: var(--accent); }
.day-card.is-current .dr-wd { font-weight: 650; }
.dr-main { display: flex; flex-direction: column; min-width: 0; gap: 3px; }
.dr-title { font-size: var(--t-body); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; color: var(--text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dr-sub { display: flex; flex-wrap: wrap; column-gap: 6px; font-size: var(--t-footnote); color: var(--text2); font-variant-numeric: tabular-nums; line-height: 1.3; }
.dr-sub span { white-space: nowrap; }
.dr-sub span + span::before { content: "·"; margin-right: 6px; color: var(--text3); }
.dr-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: var(--t-footnote); color: var(--text2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dr-docs { display: inline-flex; align-items: center; gap: 3px; color: var(--text3); }
.dr-docs .ic { width: 12px; height: 12px; }
.day-card.is-past .dr-num, .day-card.is-past .dr-title { color: var(--text2); }
/* Прибор «Ход поездки» */
.days-inst { padding: 16px 18px 14px; margin-bottom: var(--s5); }
.dg-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.dg-title { font-size: var(--t-title3); font-weight: 650; letter-spacing: -0.012em; }
.dg-done { font-size: var(--t-footnote); color: var(--inst-ink2); font-variant-numeric: tabular-nums; }
.dg { display: flex; gap: 6px; margin-top: var(--s4); overflow-x: auto; }
.dg-many { overflow-x: auto; scrollbar-width: none; margin: var(--s4) -18px 0; padding: 0 18px; }
.dg-many::-webkit-scrollbar { display: none; }
.dg-col {
  flex: 1 1 0; min-width: 44px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; color: inherit; padding: 6px 0 4px; border-radius: 12px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dg-col:active { background: var(--inst-btn-press); }
.dg-bars { width: 100%; max-width: 40px; height: calc(var(--rows) * 7px - 3px); display: flex; flex-direction: column-reverse; gap: 3px; }
.dg-bars i { height: 4px; border-radius: 2px; background: var(--inst-line); }
.dg-bars i.done { background: var(--inst-past); }
.dg-col.on .dg-bars i { background: rgba(124,156,191,.34); }
.dg-col.on .dg-bars i.done { background: var(--inst-accent); }
.dg-num { font-size: var(--t-body); font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; margin-top: 2px; }
.dg-wd { font-size: var(--t-caption2); color: var(--inst-ink2); line-height: 1; white-space: nowrap; }
.dg-col.past .dg-num { color: var(--inst-ink2); }
.dg-col.on .dg-num, .dg-col.on .dg-wd { color: var(--inst-accent); font-weight: 650; }
.dg-foot { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; row-gap: 2px; margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--inst-line); font-size: var(--t-footnote); color: var(--inst-ink2); font-variant-numeric: tabular-nums; }
.dg-files { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; }
.dg-files .ic { width: 12px; height: 12px; }
.dr-pin {
  position: absolute; top: 50%; right: 34px; transform: translateY(-50%);
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--text3); border-radius: 50%;
  -webkit-tap-highlight-color: transparent; transition: color .15s, background-color .15s;
}
.dr-pin .ic { width: 18px; height: 18px; }
.dr-pin:active { background: var(--accent-soft); color: var(--accent); }
.dr-go { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.dr-ic-transport, .dr-ic-food, .dr-ic-place, .dr-ic-hotel { color: var(--text3); }
.dr-ic-warning { color: var(--alert); }

.inbox-banner {
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  background: var(--surface); border: 0; border-radius: var(--r-md); padding: 12px var(--s4); min-height: 52px;
  font-size: var(--t-subhead); color: var(--text); margin-bottom: var(--s4); cursor: pointer;
}
.inbox-banner:active { background: var(--surface3); }
.inbox-banner .ic { width: 18px; height: 18px; color: var(--text2); }
.inbox-banner-act { margin-left: auto; color: var(--accent); font-weight: 600; }

/* Подсказка следующего шага */
.coach-card { position: relative; background: var(--surface); border: 0; border-radius: var(--r-md); padding: var(--s4) var(--s4) var(--s4); margin-bottom: var(--s4); }
.coach-eyebrow { font-size: var(--t-footnote); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--accent); margin-bottom: 4px; }
.coach-text { font-size: var(--t-body); font-weight: 600; color: var(--text); letter-spacing: -0.01em; margin-bottom: var(--s3); line-height: 1.35; padding-right: 32px; }
.coach-btn { min-height: 40px; background: var(--accent); color: var(--on-accent); border: none; border-radius: 999px; padding: 0 18px; font-size: var(--t-subhead); font-weight: 600; }
.coach-x { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text3); font-size: 14px; cursor: pointer; }

/* Напоминание о резервной копии */
.backup-banner { background: var(--surface); border: 0; border-radius: var(--r-md); padding: var(--s4); margin-bottom: var(--s4); }
.backup-banner-t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: var(--t-body); color: var(--text); }
.backup-banner-t .ic { width: 18px; height: 18px; color: var(--text2); }
.backup-banner-s { font-size: var(--t-footnote); color: var(--text2); margin-top: 4px; line-height: 1.45; }
.backup-banner-row { display: flex; gap: 8px; margin-top: var(--s3); flex-wrap: wrap; }
.backup-banner-btn { flex: 1 1 auto; margin: 0 !important; min-height: 44px; padding: 8px 12px; font-size: var(--t-subhead); width: auto; }

/* ── 15. СТРУКТУРА ПОЕЗДКИ · поездка → города → дни ────────────────────────── */
#screen-trip-view .hero-eyebrow { display: none; }
#trip-exchange-badge.trip-rate-control {
  width: 100%; min-height: 60px; margin-top: var(--s4); padding: 10px var(--s4);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  border: 0; border-radius: var(--r-md); background: var(--surface); color: var(--text); text-align: left;
}
#trip-exchange-badge.trip-rate-control:active { background: var(--surface3); }
.trip-rate-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trip-rate-label { color: var(--text2); font-size: var(--t-footnote); font-weight: 400; }
.trip-rate-value { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: var(--t-body); font-weight: 600; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.trip-rate-value .ic { flex: 0 0 auto; color: var(--text2); }
.trip-links { background: var(--surface); border-radius: var(--r-md); overflow: hidden; margin-bottom: var(--s2); }
.manage-budget-link {
  width: 100%; display: flex; align-items: center; gap: var(--s3); min-height: 52px;
  background: var(--surface); border: none; border-radius: 0; padding: 10px var(--s4); margin: 0;
  color: var(--text); font-size: var(--t-body); font-weight: 400; text-align: left;
}
.manage-budget-link + .manage-budget-link { border-top: 1px solid var(--sep); }
.manage-budget-link .ic { color: var(--text2); width: 20px; height: 20px; }
.manage-budget-link .more-row-arr { margin-left: auto; }
.manage-budget-link:active { background: var(--surface3); }

.city-block { background: var(--surface); border-radius: var(--r-md); padding: var(--s3) var(--s4) var(--s2); margin-bottom: var(--s3); }
.city-block:last-of-type { margin-bottom: var(--s3); }
.city-head { display: flex; align-items: flex-start; gap: 4px; }
.city-head-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; background: none; border: none; text-align: left; padding: 4px 0; min-height: 44px; color: var(--text); }
.city-name { font-size: var(--t-title3); font-weight: 650; color: var(--text); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.city-dates { font-size: var(--t-footnote); color: var(--text2); font-variant-numeric: tabular-nums; }
.city-days { position: relative; margin: var(--s2) 0 0; padding: 0 0 0 22px; display: flex; flex-direction: column; }
.city-days::before { content: ''; position: absolute; left: 6px; top: 14px; bottom: 26px; width: 2px; background: var(--sep); border-radius: 1px; }
.tv-day { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 4px; cursor: pointer; border-radius: 10px; }
.tv-day:active { background: var(--surface3); }
.tv-day::before { content: ''; position: absolute; left: -20px; top: 50%; transform: translateY(-50%); width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-sizing: border-box; }
.tv-day-num { font-weight: 600; font-size: var(--t-body); color: var(--text); min-width: 4.2em; }
.tv-day-date { flex: 1; font-size: var(--t-subhead); color: var(--text2); font-variant-numeric: tabular-nums; }
.add-day-row { position: relative; align-self: flex-start; margin-top: 2px; background: none; border: none; text-align: left; min-height: 44px; padding: 8px 4px; font-size: var(--t-subhead); font-weight: 600; color: var(--accent); }
.add-day-row::before { content: '+'; position: absolute; left: -22px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; line-height: 12px; text-align: center; font-size: 12px; color: var(--accent); background: var(--surface); border: 1.5px dashed var(--accent-line); border-radius: 50%; box-sizing: border-box; }
.row-menu-btn { flex: none; width: 44px; height: 44px; background: none; border: none; font-size: 18px; line-height: 1; color: var(--text3); display: flex; align-items: center; justify-content: center; letter-spacing: 1px; border-radius: 50%; }
.row-menu-btn:active { background: var(--surface3); color: var(--text); }

/* Карточки (поездки, города в списках) */
.card {
  background: var(--surface); border: 0; border-radius: var(--r-md);
  padding: var(--s4); margin-bottom: var(--s2);
  cursor: pointer; position: relative; overflow: hidden;
  -webkit-tap-highlight-color: transparent; transition: background-color .12s;
}
.card:active { background: var(--surface3); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); margin-bottom: 4px; }
.card-title { font-size: var(--t-body); font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.card-sub { font-size: var(--t-footnote); color: var(--text2); font-weight: 400; display: flex; gap: 6px 12px; align-items: center; flex-wrap: wrap; line-height: 1.45; }
.trip-cover-strip { display: none; }
.trip-card-cover { height: 120px; margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) var(--s3); overflow: hidden; background: var(--surface2); }
.trip-card-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.trip-card-cover.archived img { filter: saturate(.7); opacity: .85; }
.card-archived { opacity: .9; }
.card-current-trip { box-shadow: none; }
.trip-active-tag { font-size: var(--t-caption); font-weight: 600; color: var(--text2); background: var(--surface2); padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; }
.card-trip-title, .trip-card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-toggle { display: flex; justify-content: space-between; align-items: center; background: var(--surface); border-radius: var(--r-md); padding: var(--s4); margin-top: var(--s4); cursor: pointer; }

/* Экран города: дни — строки одной группы */
#days-list-container { background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
#days-list-container:empty, #days-list-container:has(> .empty-state) { background: none; }
.day-card {
  position: relative; display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  min-height: 60px; padding: 10px var(--s4); background: var(--surface); cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color .12s;
}
.day-card + .day-card { border-top: 1px solid var(--sep); }
.day-card:active { background: var(--surface3); }
.day-num { min-width: 1.6em; text-align: center; font-size: var(--t-title2); font-weight: 650; color: var(--text2); font-variant-numeric: tabular-nums; }
.day-info { flex: 1 1 0; min-width: 0; }
.day-date { font-size: var(--t-body); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.day-meta { font-size: var(--t-footnote); color: var(--text2); margin-top: 1px; }
.day-budget { display: block; font-size: var(--t-footnote); color: var(--text2); margin-top: 4px; font-variant-numeric: tabular-nums; }
.day-budget .ic { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
.day-emoji { font-size: 24px; line-height: 1; }
.day-card > .more-row-arr { margin-left: 0; }
.day-card > .admin-ctrl { width: 100%; }
/* ── 16. БЮДЖЕТ ────────────────────────────────────────────────────────────── */
.bud-hero { margin-bottom: var(--s4); text-align: left; }
.bud-hero-label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: var(--t-subhead); color: var(--inst-ink2); text-transform: none; letter-spacing: 0; font-weight: 400; margin-bottom: var(--s2); }
.bud-hero-val { font-family: var(--font-display); font-size: var(--t-large); font-weight: 650; letter-spacing: -0.022em; line-height: 1.1; margin-bottom: 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bud-hero-val.neg { color: var(--inst-alert) !important; }
.bud-hero-sub { font-size: var(--t-footnote); color: var(--inst-ink2); font-weight: 400; font-variant-numeric: tabular-nums; }
.bud-hero .progress-wrap { margin-top: var(--s4); height: 6px; background: var(--inst-line); }
.bud-hero .progress-fill { background: var(--inst-accent); }
.bud-hero-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-footnote); font-weight: 600; text-transform: none; letter-spacing: 0; padding: 0; background: none !important; border-radius: 0; }
.bud-hero-state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.bud-hero-state.ok   { color: var(--inst-positive); }
.bud-hero-state.over { color: var(--inst-alert); }
.bud-cur-chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 999px;
  border: 0; background: var(--inst-btn); color: var(--inst-ink); font-size: var(--t-footnote); font-weight: 600;
  margin: 0; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bud-hero-stats { margin-top: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.burn-chip {
  display: flex; align-items: center; gap: 8px; background: none; border: 0; border-radius: 0; padding: 0;
  font-size: var(--t-subhead); font-weight: 500; color: var(--inst-ink); text-align: left;
}
.burn-chip .ic { color: var(--inst-accent); }
.bud-hero-substat { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--inst-line); }
.bud-substat, .bud-substat-link {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 56px; padding: 8px 12px;
  background: var(--inst-btn); border: 0; border-radius: 12px; text-align: left; color: var(--inst-ink); font: inherit;
}
.bud-substat-link:active { background: var(--inst-btn-press); }
.bud-substat span, .bud-substat-link > span { font-size: var(--t-footnote); color: var(--inst-ink2); text-transform: none; letter-spacing: 0; font-weight: 400; }
.bud-substat b { font-size: var(--t-body); font-weight: 650; font-variant-numeric: tabular-nums; color: var(--inst-ink) !important; overflow-wrap: anywhere; }

/* Сегодняшний день — строка внутри прибора остатка */
.bud-today {
  display: grid; grid-template-columns: 1fr auto; column-gap: var(--s2); align-items: center; width: 100%;
  margin-top: var(--s3); padding: var(--s3) 0 0; min-height: 52px;
  background: none; border: 0; border-top: 1px solid var(--inst-line); border-radius: 0;
  color: var(--inst-ink); text-align: left; cursor: pointer;
}
.bud-today:active { opacity: .7; }
.bud-today-label { grid-column: 1; font-size: var(--t-footnote); color: var(--inst-ink2); }
.bud-today-val { grid-column: 1; font-size: var(--t-body); font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.bud-today .more-row-arr { grid-column: 2; grid-row: 1 / span 2; color: var(--inst-ink2); }
.bud-recent-card { background: transparent; border: 0; padding: 0; margin: 0 0 var(--s4); }
.bud-recent-head { font-size: var(--t-title3); font-weight: 650; letter-spacing: -0.01em; color: var(--text); text-transform: none; padding: var(--s3) 4px var(--s2); }
.exp-list { background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.exp-more-row { width: 100%; border: 0; color: var(--text); text-align: left; min-height: 52px; }
.exp-more-row:active { background: var(--surface3); }
.exp-more-row .exp-main { font-size: var(--t-body); }
.exp-row {
  display: flex; align-items: center; gap: var(--s3); min-height: 56px;
  padding: 8px var(--s4); background: var(--surface); border: 0;
}
.exp-row + .exp-row { border-top: 1px solid var(--sep); }
.exp-emoji { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; background: var(--surface2); color: var(--text2); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.exp-emoji .ic { width: 17px; height: 17px; }
.exp-main { flex: 1; min-width: 0; }
.exp-title { font-size: var(--t-body); font-weight: 400; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-meta { font-size: var(--t-footnote); color: var(--text2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-amount { font-size: var(--t-body); font-weight: 600; color: var(--text); flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.exp-amount-plan { color: var(--text2); font-weight: 500; }
.exp-more { margin-top: var(--s2); }

.bud-acc { border: 0; background: var(--surface); }
.bud-acc:first-of-type, .bud-acc-first { border-radius: var(--r-md) var(--r-md) 0 0; }
.bud-acc + .bud-acc { border-top: 1px solid var(--sep); }
.bud-acc-last { border-radius: 0 0 var(--r-md) var(--r-md); overflow: hidden; }
.bud-accs { background: var(--surface); border-radius: var(--r-md); overflow: hidden; margin-top: var(--s2); }
.bud-accs .bud-acc { border-radius: 0; }
.bud-acc-head {
  width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: space-between;
  background: none; border: none; color: var(--text); font-size: var(--t-body); font-weight: 400; letter-spacing: 0;
  padding: 10px var(--s4); -webkit-tap-highlight-color: transparent;
}
.bud-acc-head:active { background: var(--surface3); }
.bud-acc-arr { font-size: 0; color: var(--text3); transition: transform .2s var(--ease); }
.bud-acc-arr::after { content: ''; display: inline-block; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px,-2px); }
.bud-acc-body { padding: 0 0 var(--s2); }
.bud-acc-body .bud-line, .bud-acc-body .exp-row { background: transparent; }
.bud-acc-body > * + * { border-top: 1px solid var(--sep); }
.bud-acc-body .btn-ghost { width: calc(100% - 32px); margin: var(--s2) var(--s4) var(--s2); border-top: 0 !important; }
.bud-stats-link {
  display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 52px;
  margin-top: 0; padding: 10px var(--s4); border-radius: 0; border-top: 1px solid var(--sep) !important;
  background: var(--surface); border: 0; color: var(--text); font-size: var(--t-body); font-weight: 400;
}
.bud-stats-link .ic { width: 20px; height: 20px; color: var(--text2); opacity: 1; }
.bud-stats-link:active { background: var(--surface3); }
.bud-bars { display: flex; align-items: flex-end; gap: 4px; height: 96px; padding-top: var(--s2); overflow-x: auto; }
.bud-bar-col { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 18px; height: 100%; justify-content: flex-end; }
.bud-bar { width: 14px; background: var(--text3); border-radius: 3px 3px 0 0; transition: height .3s; }
.bud-bar-lab { font-size: var(--t-caption2); color: var(--text2); font-weight: 500; }
.bud-empty { background: var(--surface); border: 0; border-radius: var(--r-md); padding: var(--s6) var(--s4); text-align: center; margin-bottom: var(--s4); }
.bud-empty .e-icon { margin-bottom: var(--s2); color: var(--text3); display: flex; justify-content: center; }
.bud-empty .e-icon .ic { width: 30px; height: 30px; }
.bud-empty-t { font-size: var(--t-title3); font-weight: 650; color: var(--text); letter-spacing: -0.01em; }
.bud-empty-s { font-size: var(--t-subhead); color: var(--text2); margin: 6px auto 0; max-width: 24em; line-height: 1.5; }
.bud-empty .btn-primary { max-width: 280px; margin: var(--s4) auto 0; }
.limit-tag { display: inline-block; font-size: var(--t-caption2); font-weight: 600; padding: 2px 7px; border-radius: 12px; vertical-align: middle; }
.limit-tag.manual { background: var(--accent-soft); color: var(--accent); }
.limit-tag.auto   { background: var(--surface2); color: var(--text2); }
.categories-summary { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }
.category-chip { font-size: var(--t-footnote); font-weight: 500; padding: 6px 12px; border-radius: 999px; background: var(--surface2); color: var(--text2); }
.category-chip span { font-weight: 600; margin-left: var(--s2); color: var(--text); }

/* Кошельки */
.wallet-section { background: var(--surface); border: 0; border-radius: var(--r-md); padding: 4px var(--s4); margin-top: var(--s4); }
.wallet-section details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; min-height: 48px; -webkit-tap-highlight-color: transparent; }
.wallet-section details > summary::-webkit-details-marker { display: none; }
.wallet-section details[open] { padding-bottom: var(--s3); }
.wallet-section-label { font-size: var(--t-body); font-weight: 400; color: var(--text); letter-spacing: 0; text-transform: none; }
.ws-arrow { color: var(--text3); transition: transform .18s; font-size: 18px; }
.wallet-section details[open] > summary .ws-arrow { transform: rotate(90deg); }
.ws-optional { font-size: var(--t-footnote); font-weight: 400; color: var(--text2); margin-left: 6px; text-transform: none; letter-spacing: 0; }
.wallet-config-row { display: block; background: var(--surface); border: 0; border-radius: var(--r-md); padding: var(--s3); margin-bottom: var(--s2); }
.wallet-section .wallet-config-row { background: var(--surface2); }
.wallet-config-row input:not([type="checkbox"]), .wallet-config-row select { min-width: 0; min-height: 44px; }
.wallet-config-row .wallet-enabled { width: 22px; height: 22px; min-height: 0; flex: 0 0 auto; }
.wallet-config-row button { background: none; border: none; font-size: var(--t-body); color: var(--alert); min-width: 44px; min-height: 44px; }
.wcfg-head { display: flex; align-items: center; gap: var(--s2); }
.wcfg-head .wallet-name { flex: 1 1 auto; min-width: 0; font-weight: 500; }
.wcfg-head .wallet-delete { flex: 0 0 auto; }
.wcfg-money { display: flex; gap: var(--s2); margin-top: var(--s2); }
.wcfg-money .wallet-currency { flex: 0 0 34%; max-width: 124px; min-width: 0; }
.wcfg-money .wallet-balance { flex: 1 1 auto; min-width: 0; }
.wcfg-rate { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s2); }
.wcfg-rate-label { flex: 0 0 auto; font-size: var(--t-footnote); color: var(--text2); white-space: nowrap; }
.wcfg-rate .wallet-rate { flex: 1 1 auto; min-width: 0; }
.wallet-row { display: flex; justify-content: space-between; align-items: center; min-height: 44px; font-size: var(--t-subhead); padding: var(--s2) 0; border-bottom: 1px solid var(--sep); cursor: pointer; }
.wallet-row:last-child { border-bottom: 0; }
.wallet-row .wn { color: var(--text2); }
.wallet-row .wv { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Статистика */
.stats-empty-hint { font-size: var(--t-subhead); color: var(--text2); padding: var(--s4) 4px; }
.stats-block-title, #budget-stats-content .stats-block-title { font-size: var(--t-footnote); font-weight: 400; color: var(--text2); text-transform: none; letter-spacing: 0; margin: var(--s5) var(--s4) var(--s2); }
#budget-stats-content > .stats-block-title:first-of-type, #budget-stats-content .stats-total + .stats-block-title { margin-top: var(--s4); }
.stats-richcard { background: var(--surface); border: 0; border-radius: var(--r-md); padding: 4px 0; margin-bottom: var(--s3); overflow: hidden; }
.stats-row-item { font-size: var(--t-subhead); color: var(--text); line-height: 1.45; min-height: 44px; }
.stats-row-item + .stats-row-item { border-top: 1px solid var(--sep); }
.stats-top { justify-content: flex-start; gap: 10px; }
.stats-top .st-ic { color: var(--text3); display: inline-flex; flex: 0 0 auto; }
.stats-top .st-t { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.stats-top .r-stars, .sum-highlight-stars .r-stars { color: var(--text2); }
.stats-total { background: var(--surface); border-radius: var(--r-md); padding: 4px var(--s4); }
.stats-total-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); min-height: 48px; padding: 12px 0; font-size: var(--t-body); }
.stats-total-row + .stats-total-row { border-top: 1px solid var(--sep); }
.stats-total-row span { color: var(--text2); }
.stats-total-row b { font-size: var(--t-body); font-weight: 650; font-variant-numeric: tabular-nums; }
.stats-city-group + .stats-city-group { margin-top: var(--s3); }
.stats-city-name { font-size: var(--t-subhead); font-weight: 600; color: var(--text); margin: 0; padding: 12px var(--s4) 2px; }
.stats-richcard .bud-line + .bud-line, .stats-richcard .stats-row-item + .stats-row-item,
.stats-city-group .bud-line + .bud-line { border-top: 1px solid var(--sep); }
.stats-emotion-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s4); }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--s2); margin-bottom: var(--s4); }
.stats-cell { background: var(--surface); border-radius: var(--r-md); padding: var(--s3); text-align: center; }
.stats-cell .sv { font-size: var(--t-title2); font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.stats-cell .sl { font-size: var(--t-caption); color: var(--text2); margin-top: 2px; }

/* ── 17. ИТОГИ ПОЕЗДКИ ─────────────────────────────────────────────────────── */
.sum-hero { background: var(--inst); color: var(--inst-ink); border: 0; border-radius: var(--r-lg); padding: var(--s5) 18px; margin-bottom: var(--s5); text-align: left; box-shadow: var(--inst-shadow); }
.sum-trip-name { font-family: var(--font-display); font-size: var(--t-title1); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; line-height: 1.15; overflow-wrap: anywhere; }
.sum-dates { font-size: var(--t-subhead); color: var(--inst-ink2); margin-bottom: var(--s4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-stats-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--inst-line); }
.sum-stat-val { font-size: var(--t-title2); font-weight: 650; color: var(--inst-ink); font-variant-numeric: tabular-nums; }
.sum-stat-label { font-size: var(--t-caption); color: var(--inst-ink2); text-transform: none; letter-spacing: 0; font-weight: 500; margin-top: 2px; }
.sum-section-title { font-size: var(--t-title3); font-weight: 650; color: var(--text); text-transform: none; letter-spacing: -0.01em; margin: var(--s5) 4px var(--s2); }
.sum-emotion-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.sum-emotion-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--surface); border: 0; border-radius: 12px; padding: 8px 6px; min-width: 44px; font-size: 22px; }
.sum-emotion-chip.sum-emotion-sm { font-size: 17px; min-width: 38px; padding: 6px; }
.sum-emotion-num { font-size: var(--t-caption2); color: var(--text2); font-weight: 600; font-variant-numeric: tabular-nums; }
.sum-mood-city { margin-bottom: var(--s3); }
.sum-mood-city-name { font-size: var(--t-footnote); font-weight: 600; color: var(--text2); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-route { position: relative; background: var(--surface); border-radius: var(--r-md); padding: var(--s3) var(--s4); }
.sum-route-stop { position: relative; display: block; margin-bottom: var(--s3); padding-left: 22px; min-width: 0; }
.sum-route-stop:last-child { margin-bottom: 4px; }
.sum-route-dot { position: absolute; left: 0; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); z-index: 1; }
.sum-route-line { position: absolute; left: 4px; top: 16px; width: 2px; height: calc(100% + 6px); background: var(--sep); }
.sum-route-name { font-size: var(--t-body); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-route-dates { font-size: var(--t-footnote); color: var(--text2); margin-top: 1px; }
.sum-highlight-card { display: flex; align-items: flex-start; gap: var(--s3); background: var(--surface); border: 0; border-radius: 0; padding: 12px var(--s4); margin: 0; }
.sum-highlight-card + .sum-highlight-card, .sum-note-item + .sum-note-item { border-top: 1px solid var(--sep); }
:not(.sum-highlight-card) + .sum-highlight-card, :not(.sum-note-item) + .sum-note-item { border-top-left-radius: var(--r-md); border-top-right-radius: var(--r-md); }
.sum-highlight-card:not(:has(+ .sum-highlight-card)), .sum-note-item:not(:has(+ .sum-note-item)) { border-bottom-left-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.sum-highlight-icon { flex-shrink: 0; color: var(--accent); display: inline-flex; }
.sum-highlight-title { font-size: var(--t-body); font-weight: 600; margin-bottom: 2px; overflow-wrap: anywhere; }
.sum-highlight-stars { font-size: var(--t-footnote); color: var(--text2); }
.sum-note-item { background: var(--surface); border: 0; border-radius: 0; padding: 12px var(--s4); font-size: var(--t-body); line-height: 1.5; color: var(--text); margin: 0; overflow-wrap: anywhere; }
.sum-archive-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50px; background: var(--accent); color: var(--on-accent); border: none; border-radius: var(--r); font-size: var(--t-body); font-weight: 600; margin: var(--s5) 0 var(--s2); }
.sum-archive-btn:active { background: var(--accent-press); }
.sum-back-link { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50px; background: transparent; border: 0; border-radius: var(--r); color: var(--accent); font-size: var(--t-body); font-weight: 500; }
.sum-empty-hint { font-size: var(--t-subhead); color: var(--text2); padding: 4px; }
.vekhi-block { background: transparent; border: 0; padding: 0; margin-bottom: var(--s4); }
.vekhi-block h4 { font-size: var(--t-footnote); font-weight: 400; color: var(--text2); text-transform: none; letter-spacing: 0; margin-bottom: var(--s2); }

/* ── 18. ПОЕЗДКИ И КАРТА ───────────────────────────────────────────────────── */
.journey-head { padding: var(--s2) 4px var(--s4); }
.journey-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.journey-kicker { display: none; }
.journey-title { font-family: var(--font-display); font-size: var(--t-large); line-height: 1.15; font-weight: 700; letter-spacing: -0.022em; color: var(--text); overflow-wrap: anywhere; }
.journey-lead { margin-top: 4px; font-size: var(--t-subhead); line-height: 1.4; color: var(--text2); }
.journey-section-title { margin: 0 4px var(--s2); font-size: var(--t-title3); font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.journey-actions { position: relative; flex: 0 0 auto; margin-top: 4px; }
.journey-actions > summary {
  list-style: none; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--accent); font-size: 16px; letter-spacing: 1px; background: var(--surface2); border: 0;
  -webkit-tap-highlight-color: transparent;
}
.journey-actions > summary::-webkit-details-marker { display: none; }
.journey-actions-menu {
  position: absolute; z-index: 40; top: 50px; right: 0; width: 250px; padding: 0;
  border-radius: 14px; background: var(--surface); border: 0; overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,.28);
}
.journey-actions-menu button { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 10px var(--s4); border: 0; border-radius: 0; background: transparent; color: var(--text); font-size: var(--t-body); text-align: left; }
.journey-actions-menu button .ic { color: var(--accent); }
.journey-actions-menu button:active { background: var(--surface3); }

.wm-card { background: var(--surface); border: 0; border-radius: var(--r-md); overflow: hidden; margin-bottom: var(--s5); }
.journey-atlas { border-radius: var(--r-md); box-shadow: none; }
.wm-wrap{ position: relative; background: var(--surface2); touch-action: none; min-height:min(46vh, 420px); display: flex; align-items: center; }
#screen-world .wm-wrap { min-height: clamp(270px, 38vh, 380px); }
.wm-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wm-land{ fill:var(--wm-unvisited,#d8d3c7); stroke:none; pointer-events:none; }
.wm-neutral { fill: var(--wm-unvisited); stroke: none; }
.wm-marker { cursor: pointer; outline: none; }
.wm-marker-hit { fill: transparent; stroke: none; pointer-events: all; }
.wm-marker-halo { fill: var(--surface); stroke: var(--accent); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.wm-marker-core { fill: var(--accent); stroke: none; }
.wm-marker:focus .wm-marker-halo { stroke-width: 3; }
.wm-cluster { cursor: pointer; outline: none; }
.wm-cluster .wm-marker-halo { fill: var(--accent); stroke: var(--surface); }
.wm-cluster-label { fill: var(--on-accent); font-weight: 700; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.wm-draft { fill: var(--accent); stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.wm-wrap.wm-adding { box-shadow: inset 0 0 0 2px var(--accent); }
.wm-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: row; gap: 6px; z-index: 2; }
.wm-zoom button {
  width: 44px; height: 44px; border-radius: 12px; border: 0;
  background: var(--bar); color: var(--text); font-size: 20px; font-weight: 500;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.wm-zoom button:active { background: var(--surface3); }
.wm-add-instruction { margin: 0; padding: 12px var(--s4); text-align: center; color: var(--accent); background: var(--accent-soft); font-size: var(--t-subhead); font-weight: 600; }
.wm-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: transparent; border-top: 1px solid var(--sep); }
.wm-st { background: transparent; padding: 12px var(--s4); text-align: left; }
.wm-st + .wm-st { border-left: 1px solid var(--sep); }
.wm-st b { display: block; font-size: var(--t-title2); font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.wm-st span { font-size: var(--t-footnote); letter-spacing: 0; text-transform: none; color: var(--text2); }
.wm-empty{ margin: 0; padding: 12px var(--s4); background: transparent; border: 0; border-top: 1px solid var(--sep); border-radius: 0; }
.wm-empty-t { font-weight: 600; font-size: var(--t-subhead); color: var(--text); }
.wm-empty-s { font-size: var(--t-footnote); color: var(--text2); margin-top: 2px; }
.wm-suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px var(--s4) 0; }
.wm-suggest:empty { display: none; }
.wm-suggest-title { width: 100%; color: var(--text2); font-size: var(--t-footnote); font-weight: 400; }
.wm-sug { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--accent-soft); color: var(--accent); font-size: var(--t-subhead); font-weight: 600; }
.wm-sug:active { background: var(--accent-line); }
.wm-pick { width: calc(100% - 32px); margin: var(--s3) var(--s4); background: var(--surface2); color: var(--text); }
.wm-pick:active { background: var(--surface3); }
.wm-stats { display: none; }
.wm-legacy { margin: 0 var(--s4) var(--s3); padding: var(--s3); border-radius: 12px; border: 0; background: var(--surface2); }
.wm-legacy > b, .wm-legacy > span { display: block; }
.wm-legacy > span { margin: 4px 0 10px; color: var(--text2); font-size: var(--t-footnote); line-height: 1.4; }
.wm-legacy-later { width: auto; min-height: 40px; margin: 8px 0 0; }
.wm-chips-wrap { border-top: 1px solid var(--sep); }
.wm-chips-head { display: flex; align-items: center; gap: 8px; padding: 12px var(--s4); min-height: 48px; cursor: pointer; list-style: none; font-size: var(--t-body); font-weight: 400; color: var(--text); }
.wm-chips-head::-webkit-details-marker { display: none; }
.wm-chips-head::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text3); border-bottom: 2px solid var(--text3); transform: rotate(45deg) translate(-2px,-2px); transition: transform .2s var(--ease); }
.wm-chips-wrap[open] .wm-chips-head::after { transform: rotate(-135deg) translate(-2px,-2px); }
.wm-chips-n { font-weight: 600; color: var(--text2); font-variant-numeric: tabular-nums; }
.wm-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 var(--s4) var(--s4); }
.wm-chip { cursor: pointer; font-family: inherit; }
.wm-chip:active { background: var(--surface3); }
.wm-chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.wm-disclaimer { margin: 0; padding: 2px var(--s4) var(--s4); font-size: var(--t-caption); line-height: 1.45; color: var(--text2); }
.journey-overview, .journey-trips-block { margin-top: var(--s5); padding: 0; background: transparent; border: 0; border-radius: 0; }
.wm-totals { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0; background: var(--surface); border-radius: var(--r-md); overflow: hidden; padding: 0; margin: 0; border: 0; }
@media (max-width: 340px) { .wm-totals { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.wm-total { min-width: 0; min-height: 68px; display: flex; flex-direction: column; justify-content: center; text-align: left; padding: 12px var(--s4); background: transparent; border: 0; border-right: 1px solid var(--sep); border-bottom: 1px solid var(--sep); border-radius: 0; }
.wm-total:nth-child(3n) { border-right: 0; }
.wm-total:nth-last-child(-n+3) { border-bottom: 0; }
.wm-total b { display: block; font-size: var(--t-title3); font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.wm-total span { font-size: var(--t-footnote); color: var(--text2); }
.journey-log { padding: 0; margin: 0; }
.journey-log::before { content: none; }
#screen-world .journey-log .card { border-radius: 0; margin: 0; padding: 12px var(--s4); background: var(--surface); }
#screen-world .journey-log .card + .card { border-top: 1px solid var(--sep); }
#screen-world .journey-log .card:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
#screen-world .journey-log .card:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
#screen-world .journey-log .card:only-child { border-radius: var(--r-md); }
#screen-world .journey-log .trip-card-cover { margin: -12px calc(-1 * var(--s4)) var(--s3); height: 132px; }
#screen-world .journey-log .card-title { font-size: var(--t-body); }
#screen-world .journey-log .card-sub { margin-top: 4px; }
#screen-world .journey-log .admin-ctrl { margin-top: var(--s3); }
#screen-world .journey-trips-block .seg { margin-bottom: var(--s3); }
.map-story-sheet { max-height: calc(100dvh - 24px); overflow-y: auto; }
.story-preview-wrap { width: min(64vw, 260px); aspect-ratio: 9 / 16; margin: 14px auto; border-radius: 18px; overflow: hidden; box-shadow: 0 14px 36px rgba(0,0,0,.24); background: #f7f3ea; }
.story-preview-wrap canvas { width: 100%; height: 100%; display: block; }
.map-place-trips { max-height: 200px; overflow: auto; margin: 0 0 var(--s3); border: 0; border-radius: var(--r-md); background: var(--surface); }
.map-trip-check { min-height: 48px; }
.map-trip-check + .map-trip-check { border-top: 1px solid var(--sep); }
.map-place-list, .map-linked-list { margin: var(--s2) 0 var(--s3); }
.map-place-date { color: var(--text2); font-size: var(--t-subhead); margin-bottom: 8px; }

/* ── 19. ПОДГОТОВКА ЧЕРЕЗ НЕЙРОСЕТЬ ────────────────────────────────────────── */
.tp-sheet { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; position: relative; }
.tp-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: 8px; }
.tp-sticky-bar {
  flex: 0 0 auto; z-index: 2;
  margin: 0 calc(-1 * var(--gutter));
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: var(--sheet); border-top: 1px solid var(--sep);
  display: flex; flex-direction: column; gap: 4px;
}
/* Подписи не переносятся по словам: если не помещаются в ряд — ряд переходит на вторую строку */
.tp-sticky-row { display: flex; flex-wrap: wrap; gap: 0 4px; align-items: center; }
.tp-sticky-row > *, .tp-sticky-row > .tp-manual-link { flex: 1 1 auto; margin: 0; min-height: 44px; white-space: nowrap; width: auto; }
.tp-close-btn { margin: 0; }
.tp-generate-btn, .tp-api-btn { width: 100%; margin-top: 0; }
.tp-sticky-bar [hidden], #aiapi-modal [hidden], #aiapi-log-wrap[hidden] { display: none !important; }
#trip-prep-modal [hidden] { display: none !important; }
.tp-mode { margin: 4px 0 var(--s3); }
/* Встроенная нейросеть не справилась: причина и переход к своей */
.tp-ai-fail { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 6px; }
.tp-ai-fail-t { font-size: var(--t-footnote); color: var(--alert); line-height: 1.35; }
.tp-ai-fail .btn-ghost { margin: 0; width: 100%; }
.tp-sticky-bar.is-running .tp-ai-fail { display: none !important; }
/* Идёт запрос к нейросети: вместо кнопок — строка состояния с отменой */
.tp-ai-run { display: none; align-items: center; gap: 10px; min-height: 50px; padding: 0 4px; }
.tp-sticky-bar.is-running .tp-ai-run { display: flex; }
.tp-sticky-bar.is-running > .btn-primary, .tp-sticky-bar.is-running .tp-sticky-row { display: none !important; }
.tp-ai-run .tp-manual-link { flex: 0 0 auto; width: auto; min-height: 44px; padding: 8px 10px; }
.tp-ai-status { flex: 1 1 auto; min-width: 0; font-size: var(--t-subhead); color: var(--text); font-variant-numeric: tabular-nums; }
.tp-ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; animation: tpAiPulse 1.4s ease-in-out infinite; }
@keyframes tpAiPulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tp-ai-dot { animation: none; } }
/* Лист «Нейросеть по API» */
.more-row-val { margin-left: auto; font-size: var(--t-subhead); color: var(--text2); white-space: nowrap; }
.more-row-val + .more-row-arr { margin-left: 6px; }
.aiapi-lead { font-size: var(--t-subhead); color: var(--text2); line-height: 1.4; margin: 0 0 var(--s2); }
.aiapi-key-row { display: flex; gap: 8px; align-items: center; }
.aiapi-key-row .form-input { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.aiapi-eye { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 12px; border: 0; background: var(--surface2); color: var(--text2); display: inline-flex; align-items: center; justify-content: center; }
.aiapi-eye:active { background: var(--surface3); }
.aiapi-status { margin-top: 6px; }
.aiapi-status.is-ok { color: var(--positive); }
.aiapi-status.is-warn { color: var(--alert); }
.aiapi-actions { display: flex; gap: 8px; margin: var(--s3) 0 var(--s2); }
.aiapi-actions > * { flex: 1 1 0; margin: 0; }
.aiapi-privacy { margin: var(--s4) 0 0; font-size: var(--t-footnote); color: var(--text2); line-height: 1.45; }
.aiapi-log-head { display: flex; align-items: center; justify-content: space-between; margin: var(--s5) 4px var(--s2); font-size: var(--t-footnote); color: var(--text2); }
.aiapi-log-head .tp-manual-link { flex: 0 0 auto; width: auto; min-height: 36px; padding: 6px 4px; }
.aiapi-log-row { display: flex; gap: 12px; align-items: center; padding: 10px 16px; min-height: 52px; }
.aiapi-log-row + .aiapi-log-row { border-top: 1px solid var(--sep); }
.aiapi-log-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.aiapi-log-h { font-size: var(--t-subhead); font-weight: 600; color: var(--text); }
.aiapi-log-s { font-size: var(--t-footnote); color: var(--text2); font-variant-numeric: tabular-nums; }
.aiapi-log-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: var(--t-footnote); color: var(--text2); font-variant-numeric: tabular-nums; }
.aiapi-log-side span:first-child { color: var(--text); font-weight: 600; }
.aiapi-forget { color: var(--alert); margin-top: var(--s4); }
.tp-help-btn {
  position: absolute; top: 24px; right: var(--gutter); z-index: 4;
  width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: var(--surface2); color: var(--accent); font-size: var(--t-body); font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.tp-help-btn::after { content: ''; position: absolute; inset: -4px; }
.tp-sheet .modal-title { padding-right: 44px; }
.tp-subtitle { font-size: var(--t-subhead); line-height: 1.5; color: var(--text2); margin: 0 4px var(--s4); }
.tp-how { display: flex; flex-direction: column; background: var(--surface); border: 0; border-radius: var(--r-md); padding: 0 var(--s4); margin: 0 0 var(--s4); }
.tp-how-step { display: grid; grid-template-columns: 26px minmax(0,1fr); gap: 12px; align-items: start; padding: 12px 0; color: var(--text2); }
.tp-how-step + .tp-how-step { border-top: 1px solid var(--sep); }
.tp-how-n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: var(--t-footnote); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.tp-how-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: var(--t-footnote); line-height: 1.45; }
.tp-how-copy strong { color: var(--text); font-size: var(--t-subhead); font-weight: 600; line-height: 1.3; }
.tp-how-fail { font-size: var(--t-footnote); color: var(--text2); margin-top: 8px; line-height: 1.45; }
.tp-section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--t-title3); font-weight: 650; color: var(--text); letter-spacing: -0.01em;
  margin: var(--s6) 4px var(--s2); padding: 0; border: 0;
}
.tp-section-label .ic { color: var(--text3); width: 18px; height: 18px; }
.tp-sheet .tp-section-label:first-of-type { margin-top: var(--s4); }
.tp-sheet .form-label { margin-top: var(--s3); }
.tp-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.tp-grid2 > * { min-width: 0; }
.tp-grid2 input[type="date"] { width: 100%; }
.tp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.tp-chip { cursor: pointer; transition: background-color .14s, color .14s; }
.tp-chip:active { background: var(--surface3); }
.tp-chip.active { color: var(--on-accent); background: var(--accent); }
.tp-chip-style { flex: 1 1 0; justify-content: center; min-width: 90px; }
.tp-card { position: relative; background: var(--surface); border: 0; border-radius: var(--r-md); padding: var(--s4) var(--s4) 18px; margin-bottom: var(--s3); }
.tp-card .form-label:first-of-type { margin-top: 0; }
.tp-card-remove { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; z-index: 2; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--text3); border-radius: 50%; }
.tp-card-remove:active { background: var(--alert-soft); color: var(--alert); }
.tp-card-remove .ic { width: 18px; height: 18px; }
.tp-checks { display: flex; flex-wrap: wrap; gap: var(--s4); margin-top: var(--s3); }
.tp-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: var(--t-body); color: var(--text); cursor: pointer; }
.tp-add-btn, .tp-subadd-btn {
  width: 100%; min-height: 48px; background: transparent; border: 1.5px dashed var(--accent-line);
  color: var(--accent); border-radius: 12px; padding: 10px; font-size: var(--t-body); font-weight: 500; margin-bottom: 4px;
}
.tp-add-btn:active, .tp-subadd-btn:active { background: var(--accent-soft); }
.tp-city-card { background: var(--surface); }
.tp-sub-label { display: flex; align-items: center; gap: 8px; font-size: var(--t-footnote); font-weight: 600; color: var(--text2); text-transform: none; letter-spacing: 0; margin: var(--s4) 4px var(--s2); }
.tp-sub-label .ic { width: 16px; height: 16px; color: var(--text2); }
.tp-sub-card { background: var(--surface2); padding: 14px 14px 16px; }
.tp-stay-card { position: relative; }
.tp-stay-card .tp-card-body > * { margin-bottom: 8px; }
.tp-stay-card .tp-card-body > *:last-child { margin-bottom: 0; }
.tp-stay-card .tp-card-body > *:first-child { width: calc(100% - 48px); }
.tp-card-head2 { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: -2px 0 12px; padding-right: 40px; min-height: 28px; }
.tp-card-head2 .tp-card-ic { flex: 0 0 auto; width: 16px; height: 16px; color: var(--accent); }
.tp-card-head2 .tp-card-name { font-size: var(--t-subhead); font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; white-space: nowrap; }
.tp-card-sum { flex: 1 1 auto; min-width: 0; font-size: var(--t-footnote); color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: none; }
.tp-card-chev { flex: 0 0 auto; margin-left: auto; color: var(--text3); transition: transform .18s var(--ease); font-size: 13px; line-height: 1; }
.tp-card-body { overflow: hidden; }
.tp-card.is-collapsed .tp-card-body { display: none; }
.tp-card.is-collapsed .tp-card-sum { display: block; }
.tp-card.is-collapsed .tp-card-chev { transform: rotate(-90deg); }
.tp-card.is-collapsed .tp-card-head2 { margin-bottom: 0; }
.tp-hint { margin-top: 6px; }
.tp-places-hint { font-size: var(--t-footnote); color: var(--text2); margin: 0 0 8px; line-height: 1.4; }
.tp-place-item { display: flex; align-items: center; gap: 8px; background: var(--surface2); border: 0; border-radius: 12px; padding: 6px 6px 6px 14px; margin-bottom: 6px; }
.tp-place-txt { flex: 1 1 auto; min-width: 0; font-size: var(--t-body); color: var(--text); overflow-wrap: anywhere; }
.tp-place-ctrls { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.tp-place-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--text3); border-radius: 10px; font-size: 15px; font-weight: 700; }
.tp-place-btn:active { background: var(--surface3); color: var(--text); }
.tp-place-btn.tp-place-del:active { color: var(--alert); }
.tp-place-btn .ic { width: 16px; height: 16px; }
.tp-place-add { display: flex; gap: 8px; margin: 4px 0; }
.tp-place-input { flex: 1 1 auto; min-width: 0; margin: 0; }
.tp-place-add-btn { flex: 0 0 auto; width: 48px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); border: 0; border-radius: 12px; }
.tp-place-add-btn .ic { width: 20px; height: 20px; }
.tp-rate-row { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.tp-rate-unit, .tp-rate-home { font-size: var(--t-body); font-weight: 600; color: var(--text); white-space: nowrap; }
.tp-rate-eq { color: var(--text3); font-weight: 600; }
.tp-rate-input { flex: 1 1 auto; min-width: 0; margin: 0; }
.tp-or { display: flex; align-items: center; gap: 12px; margin: var(--s4) 0; color: var(--text2); font-size: var(--t-footnote); }
.tp-or::before, .tp-or::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--sep); }
.tp-paste-area { font-family: var(--font-mono); font-size: var(--t-footnote); line-height: 1.5; }
.tp-optional { position: relative; margin: var(--s4) 0 var(--s2); border: 0; border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.tp-optional-head { display: flex; flex-direction: column; gap: 2px; padding: 12px 48px 12px var(--s4); min-height: 56px; cursor: pointer; list-style: none; justify-content: center; }
.tp-optional-head::-webkit-details-marker { display: none; }
.tp-optional-head::after { content: ''; position: absolute; right: 20px; top: 24px; width: 8px; height: 8px; border-right: 2px solid var(--text3); border-bottom: 2px solid var(--text3); transform: rotate(45deg); transition: transform .2s var(--ease); }
.tp-optional[open] .tp-optional-head::after { transform: rotate(-135deg); }
.tp-optional-head > span:first-child { font-weight: 600; font-size: var(--t-body); color: var(--text); overflow-wrap: anywhere; }
.tp-optional-sub { font-size: var(--t-footnote); color: var(--text2); overflow-wrap: anywhere; }
.tp-optional-body { padding: 0 var(--s4) var(--s4); width: 100%; min-width: 0; }
.tp-optional-body > * { max-width: 100%; }
.tp-optional-body input, .tp-optional-body select, .tp-optional-body textarea, .tp-optional-body .tp-add-btn { width: 100%; }
.tp-optional-body .form-input, .tp-optional-body .form-textarea { background: var(--surface2); }
@media (max-width: 350px) { .tp-optional-body .tp-grid2 { grid-template-columns: 1fr; } }
.tp-money-row { display: flex; gap: 8px; align-items: stretch; margin-top: var(--s2); }
.tp-money-row #tp-budget { flex: 1 1 auto; min-width: 0; }
.tp-cur-select { flex: 0 0 auto; width: auto; min-width: 96px; }
.tp-manual-link { display: flex; align-items: center; justify-content: center; width: 100%; background: none; border: none; margin: 0; padding: 8px 4px; min-height: 44px; font-size: var(--t-subhead); color: var(--accent); text-decoration: none; text-align: center; }
.tp-manual-link:active { opacity: .55; }
.tp-bottom-spacer { height: 84px; }
.ai-onb { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 12px; }
.ai-onb-lead { font-size: var(--t-subhead); color: var(--text2); line-height: 1.5; margin: 0 auto var(--s4); max-width: 26em; text-align: center; }
.ai-onb-btn { width: 100%; }
.ai-onb-copy { font-weight: 600; }
.ai-onb-step2 { background: var(--surface); border: 0; border-radius: var(--r-md); padding: var(--s4); text-align: left; margin: var(--s5) 0 var(--s2); }
.ai-onb-step2-t { font-size: var(--t-title3); font-weight: 650; color: var(--text); margin-bottom: 4px; letter-spacing: -0.01em; }
.ai-onb-step2-s { font-size: var(--t-subhead); line-height: 1.5; color: var(--text2); margin-bottom: var(--s3); }
.ai-onb-step2 .form-textarea { background: var(--surface2); }
.ai-onb-import-hot { box-shadow: inset 0 0 0 1.5px var(--accent) !important; color: var(--accent) !important; }
.help-steps { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-md); padding: 0 var(--s4); margin: 4px 0 var(--s4); }
.help-step { display: flex; gap: 14px; align-items: center; padding: 10px 0; min-height: 48px; }
.help-step + .help-step { border-top: 1px solid var(--sep); }
.help-step-n { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: var(--t-footnote); font-weight: 700; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.help-step-tx { flex: 1 1 auto; font-size: var(--t-body); line-height: 1.35; color: var(--text); }
.help-note { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 0; border-radius: var(--r-md); padding: 12px var(--s4); margin-bottom: 6px; }
.help-note .ic { flex: 0 0 auto; width: 18px; height: 18px; color: var(--text2); margin-top: 1px; }
.help-note-tx { font-size: var(--t-footnote); line-height: 1.5; color: var(--text2); }

/* ── 20. ПУБЛИКАЦИЯ И ИМПОРТ МАРШРУТА ──────────────────────────────────────── */
.rs-modes { display: flex; flex-direction: column; gap: 0; margin-bottom: var(--s4); background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.rs-mode { position: relative; border: 0; border-radius: 0; padding: 12px 48px 12px var(--s4); background: var(--surface); cursor: pointer; min-height: 60px; }
.rs-mode + .rs-mode { border-top: 1px solid var(--sep); }
.rs-mode.active::after { content: ''; position: absolute; right: 20px; top: 50%; width: 7px; height: 13px; border-right: 2.4px solid var(--accent); border-bottom: 2.4px solid var(--accent); transform: translateY(-65%) rotate(45deg); }
.rs-mode.active { background: var(--surface); box-shadow: none; }
.rs-mode.disabled { opacity: .5; }
.rs-mode-t { font-weight: 600; font-size: var(--t-body); color: var(--text); display: flex; align-items: center; gap: 8px; }
.rs-mode-s { font-size: var(--t-footnote); color: var(--text2); margin-top: 2px; line-height: 1.4; }
.rs-soon { font-size: var(--t-caption2); font-weight: 600; color: var(--text2); background: var(--surface2); border-radius: 6px; padding: 2px 7px; }
.rs-switch, .ri-radio { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 4px; font-size: var(--t-body); color: var(--text); cursor: pointer; line-height: 1.35; }
.rs-switch span, .ri-radio span { min-width: 0; overflow-wrap: anywhere; }
.rs-rights { align-items: flex-start; }
.rs-rights input { margin-top: 2px; }
.rs-rights span { font-size: var(--t-subhead); line-height: 1.45; }
.rs-rights-attn { animation: rightsAttn .5s ease 2; }
@keyframes rightsAttn { 50% { transform: translateX(4px); } }
.rs-warn { font-size: var(--t-footnote); color: var(--text2); margin: -6px 0 6px 38px; line-height: 1.45; overflow-wrap: anywhere; }
.rs-warn::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin: 0 6px 1px 0; }
.rs-photos-hint { font-size: var(--t-footnote); font-weight: 600; color: var(--accent); margin: -6px 0 2px 38px; }
.rs-cover-opt { font-size: var(--t-footnote); color: var(--text2); margin: 4px 4px 8px; line-height: 1.4; }
.rs-preview-label { font-size: var(--t-title3); font-weight: 650; letter-spacing: -0.01em; text-transform: none; color: var(--text); margin: var(--s5) 4px 2px; }
.rs-edit-hint { font-size: var(--t-footnote); color: var(--text2); margin: 0 4px var(--s2); line-height: 1.4; }
.rs-preview { border: 0; border-radius: var(--r-md); background: var(--surface); padding: var(--s4); margin-bottom: var(--s4); max-height: 360px; overflow-y: auto; }
.rs-empty { text-align: center; color: var(--text2); font-size: var(--t-footnote); padding: var(--s4); }
.rs-hero { border-bottom: 1px solid var(--sep); padding-bottom: var(--s3); margin-bottom: var(--s3); }
.rs-hero-title { font-weight: 700; font-size: var(--t-title3); color: var(--text); line-height: 1.25; overflow-wrap: anywhere; }
.rs-hero-author { font-size: var(--t-footnote); color: var(--accent); margin-top: 2px; font-weight: 600; overflow-wrap: anywhere; }
.rs-hero-stats { font-size: var(--t-footnote); color: var(--text2); margin-top: 4px; }
.rs-hero-desc { font-size: var(--t-footnote); color: var(--text2); margin-top: 6px; line-height: 1.5; overflow-wrap: anywhere; }
.rs-city-name { display: flex; align-items: center; gap: 6px; font-weight: 650; color: var(--text); margin: var(--s3) 0 4px; }
.rs-city-name .ic { width: 14px; height: 14px; color: var(--text2); }
.rs-day-n { font-size: var(--t-caption); font-weight: 600; color: var(--text2); margin: 8px 0 4px; }
.rs-act { display: flex; gap: 8px; padding: 5px 0; }
.rs-act-time { font-size: var(--t-caption); font-weight: 600; color: var(--text2); min-width: 3em; padding-top: 2px; font-variant-numeric: tabular-nums; }
.rs-act-body { min-width: 0; }
.rs-act-title { font-size: var(--t-footnote); font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.rs-act-bud { color: var(--accent); font-weight: 600; }
.rs-act-addr { font-size: var(--t-caption); color: var(--text2); margin-top: 1px; overflow-wrap: anywhere; }
.rs-act-note { font-size: var(--t-caption); color: var(--text2); margin-top: 3px; line-height: 1.45; background: var(--surface2); border-radius: 8px; padding: 6px 8px; overflow-wrap: anywhere; }
.rs-act-tips { box-shadow: inset 2px 0 0 var(--accent); }
.rs-editable { cursor: pointer; }
.rs-editable:active { opacity: .7; }
.rs-act-empty { font-size: var(--t-caption); color: var(--text2); font-style: italic; }
.rs-link-soon { font-size: var(--t-caption); color: var(--text2); text-align: center; margin: 6px 0 2px; }
.rs-section-div { height: 1px; background: var(--sep); margin: var(--s4) 0; }
.rs-cover-box { position: relative; margin-bottom: 8px; }
.rs-cover-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 128px; border: 1.5px dashed var(--accent-line); border-radius: var(--r-md); background: transparent; color: var(--accent); font-size: var(--t-subhead); font-weight: 500; cursor: pointer; }
.rs-cover-empty .ic { width: 24px; height: 24px; }
.rs-cover-wrap { position: relative; height: 180px; border-radius: var(--r-md); overflow: hidden; background: var(--surface2); }
.rs-cover-blur { position: absolute; inset: -8%; background-size: cover; background-position: center; filter: blur(18px); transform: scale(1.1); opacity: .8; }
.rs-cover-img { position: relative; z-index: 1; width: 100%; height: 180px; object-fit: contain; display: block; }
.rs-cover-del { position: absolute; top: 8px; right: 8px; z-index: 2; width: 36px; height: 36px; border: none; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; }
.rs-photo-count { font-size: var(--t-footnote); font-weight: 600; color: var(--text2); }
.rs-photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 14px; max-height: 360px; overflow-y: auto; border-radius: 12px; }
.rs-pcell { position: relative; aspect-ratio: 1; border-radius: 4px; overflow: hidden; cursor: pointer; }
.rs-pcell.on { box-shadow: inset 0 0 0 3px var(--accent); }
.rs-pcell img { width: 100%; height: 100%; object-fit: cover; }
.rs-pcheck { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; display: flex; align-items: center; justify-content: center; opacity: 0; box-shadow: 0 0 0 2px #fff; }
.rs-pcell.on .rs-pcheck { opacity: 1; }
.rs-pday { position: absolute; bottom: 0; left: 0; right: 0; font-size: 11px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); padding: 8px 4px 4px; text-align: center; }
.rs-link-box { font-family: var(--font-mono); font-size: var(--t-caption); color: var(--text2); background: var(--surface); border: 0; border-radius: var(--r-md); padding: 12px 14px; max-height: 112px; overflow: hidden; word-break: break-all; position: relative; margin-bottom: var(--s3); }
.rs-link-box::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 36px; background: linear-gradient(transparent, var(--surface)); }
.rs-link-note { font-size: var(--t-footnote); color: var(--text2); line-height: 1.45; margin: 0 4px 6px; overflow-wrap: anywhere; }
.rs-link-warn { color: var(--text); }
.rs-inline-link { display: flex; align-items: center; width: 100%; background: none; border: none; margin: 2px 0 8px; padding: 8px 4px; min-height: 44px; font-size: var(--t-subhead); color: var(--accent); text-align: left; }
.ri-head { border-bottom: 1px solid var(--sep); padding-bottom: var(--s3); margin-bottom: var(--s3); }
.ri-season { display: inline-flex; font-size: var(--t-caption); font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 3px 9px; margin-top: 6px; }
.md-h { font-weight: 700; font-size: 1.05em; margin: 8px 0 3px; color: var(--text); }
.md-list { margin: 4px 0 6px 18px; }
.md-list li { margin: 2px 0; }
.md-hr { border: none; border-top: 1px solid var(--sep); margin: 8px 0; }
.mypub-item { border: 0; border-radius: var(--r-md); padding: 12px var(--s4); margin-bottom: var(--s2); background: var(--surface); }
.mypub-title { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.mypub-url { font-family: var(--font-mono); font-size: var(--t-caption); color: var(--text2); word-break: break-all; margin: 4px 0; }
.mypub-meta { font-size: var(--t-footnote); color: var(--text2); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.mypub-meta .ic { width: 13px; height: 13px; }
.mypub-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.mypub-actions .btn-ghost { flex: 1 1 auto; width: auto; min-height: 44px; padding: 8px 12px; font-size: var(--t-subhead); margin: 0; }
.mypub-st { display: inline-flex; align-items: center; gap: 5px; padding: 0; font-size: var(--t-footnote); font-weight: 600; letter-spacing: 0; margin-right: 8px; background: none !important; }
.mypub-st::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.mypub-st.st-pending  { color: var(--text2); }
.mypub-st.st-approved { color: var(--positive); }
.mypub-st.st-rejected { color: var(--alert); }
.mypub-keys, .ugc-contact { margin-top: var(--s4); padding: var(--s4); border: 0; border-radius: var(--r-md); background: var(--surface); text-align: left; }
.mypub-keys-t, .ugc-contact-t { font-weight: 600; font-size: var(--t-body); color: var(--text); margin-bottom: 4px; }
.mypub-keys-s, .ugc-contact-s { font-size: var(--t-footnote); line-height: 1.5; color: var(--text2); margin-bottom: var(--s3); overflow-wrap: anywhere; }
.mypub-keys-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mypub-keys-row .btn-ghost { flex: 1 1 auto; width: auto; margin: 0; min-height: 44px; }
.ugc-contact .btn-ghost { margin: 0; min-height: 44px; width: 100%; }
.mypub-rec { font-size: var(--t-caption); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--accent); }
.ugc-actions { display: flex; flex-direction: column; gap: 0; margin-top: var(--s4); padding-top: var(--s2); border-top: 1px solid var(--sep); }
.ugc-link { background: none; border: none; padding: 10px 0; min-height: 44px; font-size: var(--t-subhead); color: var(--alert); text-align: center; }
.ugc-link + .ugc-link { color: var(--text2); }
.rep-sub { font-size: var(--t-subhead); line-height: 1.5; color: var(--text2); margin: -6px 4px var(--s3); }
.rep-target { font-size: var(--t-subhead); font-weight: 600; color: var(--text); background: var(--surface); border-radius: 12px; padding: 10px 12px; margin-bottom: var(--s3); overflow-wrap: anywhere; }
.rep-target:empty { display: none; }
.hid-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 56px; padding: 8px var(--s4); background: var(--surface); }
.hid-row:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.hid-row:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
.hid-row:only-child { border-radius: var(--r-md); }
.hid-row + .hid-row { border-top: 1px solid var(--sep); }
.hid-name { min-width: 0; font-size: var(--t-body); font-weight: 500; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.hid-btn { width: auto; max-width: 46vw; margin: 0; min-height: 40px; padding: 6px 14px; font-size: var(--t-subhead); white-space: normal; }

/* Пакет поездки (экспорт / импорт файла) */
.modal-overlay { background: var(--dim) !important; }
.pkg-sheet, .modal-overlay > div:first-child:not(.pkg-row) { }
.pkg-trip { font-size: var(--t-title3); font-weight: 650; letter-spacing: -0.01em; color: var(--text); margin-bottom: var(--s3); overflow-wrap: anywhere; }
.pkg-row { display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: 8px 0; border-bottom: 1px solid var(--sep); }
.pkg-row:last-of-type { border-bottom: none; }
.pkg-ic { color: var(--accent); display: inline-flex; }
.pkg-ic .ic { width: 18px; height: 18px; }
.pkg-l { flex: 1; font-size: var(--t-body); color: var(--text); }
.pkg-v { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text2); }
.pkg-size { display: flex; justify-content: space-between; align-items: center; margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--sep); font-size: var(--t-subhead); color: var(--text2); }
.pkg-size b { font-size: var(--t-body); color: var(--text); font-variant-numeric: tabular-nums; }
.pkg-meta { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--sep); }
.pkg-meta-h { font-size: var(--t-footnote); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text2); margin-bottom: var(--s3); }
.pkg-opt { color: var(--text3); font-weight: 400; }
.pkg-cover-row { display: flex; align-items: center; gap: 12px; margin-bottom: var(--s2); }
.pkg-cover-thumb { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--surface2); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.pkg-cover-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pkg-cover-ph { color: var(--text3); display: inline-flex; }
.pkg-cover-ph .ic { width: 22px; height: 22px; }
.pkg-cover-btn { font-size: var(--t-subhead); }
.pkg-meta-l { display: block; font-size: var(--t-footnote); color: var(--text2); margin: 10px 4px 6px; }
.pkg-desc-hint { font-size: var(--t-footnote); color: var(--text2); line-height: 1.4; margin-top: 6px; }
.pkg-imp-sheet { overflow: hidden; }
.pkg-imp-cover { width: calc(100% + 2 * var(--gutter)); margin: 0 calc(-1 * var(--gutter)) var(--s4); height: 168px; overflow: hidden; background: var(--surface2); }
.pkg-imp-cover img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pkg-imp-title { font-size: var(--t-title2); font-weight: 700; letter-spacing: -0.015em; color: var(--text); margin-bottom: 4px; overflow-wrap: anywhere; }
.pkg-imp-days { font-size: var(--t-subhead); font-weight: 400; color: var(--text2); }
.pkg-imp-author { font-size: var(--t-footnote); color: var(--text2); margin-bottom: 8px; overflow-wrap: anywhere; }
.pkg-imp-desc { font-size: var(--t-subhead); color: var(--text2); line-height: 1.5; margin-bottom: 12px; overflow-wrap: anywhere; }
.pkg-imp-cities { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pkg-imp-stats { display: flex; gap: 20px; padding-top: 12px; border-top: 1px solid var(--sep); flex-wrap: wrap; }
.pkg-imp-stats > div { display: flex; flex-direction: column; gap: 2px; }
.pkg-imp-stats span { font-size: var(--t-caption); text-transform: none; letter-spacing: 0; color: var(--text2); }
.pkg-imp-stats b { font-size: var(--t-body); font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.export-item { display: flex; align-items: center; gap: var(--s3); background: var(--surface); border: 0; border-radius: var(--r-md); padding: 12px var(--s4); margin-bottom: var(--s2); cursor: pointer; min-height: 56px; }
.export-item .ei-name { font-size: var(--t-body); font-weight: 500; }
.export-item .ei-sub { font-size: var(--t-footnote); color: var(--text2); margin-top: 2px; line-height: 1.4; }
#export-trips-list-container .export-item + .export-item { margin-top: 0; }

/* ── 21. ЕЩЁ · О ПРИЛОЖЕНИИ · ПРИВАТНОСТЬ ──────────────────────────────────── */
.app-version-tag { text-align: center; color: var(--text2); font-size: var(--t-footnote); padding: var(--s5) 0 var(--s2); }
.theme-seg { margin: 0 0 var(--s2); }
.info-app-name { font-family: var(--font-display); font-size: var(--t-title1); font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin: var(--s2) 4px 2px; }
.info-version { font-size: var(--t-subhead); color: var(--text2); margin: 0 4px var(--s3); font-variant-numeric: tabular-nums; }
.info-desc { font-size: var(--t-body); line-height: 1.5; color: var(--text); margin: 0 4px var(--s5); }
.info-block { background: var(--surface); border: 0; border-radius: var(--r-md); padding: var(--s4); margin-bottom: var(--s4); }
.info-dev-name { font-size: var(--t-body); font-weight: 600; color: var(--text); }
.info-dev-role { font-size: var(--t-footnote); color: var(--text2); margin: 2px 0 var(--s3); }
.info-dev-note { font-size: var(--t-subhead); line-height: 1.5; color: var(--text2); font-style: italic; }
.info-actions { display: flex; flex-direction: column; gap: 0; margin-top: var(--s4); background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.info-actions .btn-ghost { margin: 0; border-radius: 0; background: var(--surface); color: var(--accent); justify-content: flex-start; padding: 0 var(--s4); font-weight: 400; min-height: 52px; }
.info-actions .btn-ghost + .btn-ghost { border-top: 1px solid var(--sep); }
.info-actions .btn-ghost:active { background: var(--surface3); }
.info-list { display: flex; flex-direction: column; gap: 0; margin: 4px 0 var(--s4); background: var(--surface); border-radius: var(--r-md); padding: 0 var(--s4); }
.info-li { display: flex; gap: 12px; align-items: center; padding: 12px 0; }
.info-li + .info-li { border-top: 1px solid var(--sep); }
.info-li .info-li-ic { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; background: var(--surface2); display: flex; align-items: center; justify-content: center; color: var(--text); }
.info-li .info-li-ic .ic { width: 17px; height: 17px; }
.info-li-tx { flex: 1 1 auto; font-size: var(--t-body); line-height: 1.4; color: var(--text); }

/* Документы */
.docs-hint { font-size: var(--t-subhead); color: var(--text2); margin: -6px 4px var(--s3); }
.docs-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--s2); margin: var(--s4) 0; max-height: 52vh; overflow-y: auto; }
.docs-cell { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--surface2); }
.docs-cell img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; display: block; }
.docs-cell-pdf { display: flex; align-items: stretch; cursor: pointer; position: relative; }
.docs-del { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.62); color: #fff; font-size: 13px; line-height: 1; }
.docs-del::after { content: ''; position: absolute; inset: -8px; }
.docs-empty { grid-column: 1 / -1; text-align: center; color: var(--text2); font-size: var(--t-subhead); padding: var(--s6) 0; }

/* Поиск */
.search-result-group { margin-bottom: var(--s4); background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.search-result-group-title { display: flex; align-items: center; gap: 6px; font-size: var(--t-footnote); font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text2); padding: 10px var(--s4) 6px; background: var(--sheet); }
.search-result-group-title .ic { width: 14px; height: 14px; color: var(--text3); }
.search-result-item { flex-direction: column; align-items: flex-start; gap: 2px; min-height: 56px; }
.search-result-item + .search-result-item { border-top: 1px solid var(--sep); }
.search-result-title { font-weight: 600; font-size: var(--t-body); overflow-wrap: anywhere; }
.search-result-sub { font-size: var(--t-footnote); color: var(--text2); }
.highlight { background-color: var(--accent-soft); color: var(--text); border-radius: 4px; padding: 0 2px; }

/* ── 22. ПЕРВЫЙ ЗАПУСК ─────────────────────────────────────────────────────── */
.onboarding {
  position: fixed; inset: 0; z-index: 400; display: none;
  align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 24px) 24px calc(env(safe-area-inset-bottom) + 24px);
  background: var(--bg); opacity: 0; transition: opacity .22s ease;
}
.onboarding.open { opacity: 1; }
.onboarding-card { max-width: 420px; width: 100%; text-align: center; }
.ob-card { display: flex; flex-direction: column; }
.ob-viewport { overflow: hidden; width: 100%; }
.ob-track { display: flex; transition: transform .32s var(--ease); }
.ob-slide { flex: 0 0 100%; min-width: 100%; padding: 8px 4px 0; }
.ob-art { width: 100%; max-width: 300px; margin: 0 auto 28px; padding: 22px 18px; background: var(--inst); border: 0; border-radius: var(--r-lg); box-shadow: var(--inst-shadow); }
.ob-art { --surface: var(--inst-2); --surface2: var(--inst-2); --border: var(--inst-line); --border2: var(--inst-past); --text3: var(--inst-ink2); --accent: var(--inst-accent); }
.ob-art svg { width: 100%; height: auto; display: block; }
.ob-title { font-family: var(--font-display); font-size: var(--t-title1); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 12px; color: var(--text); text-wrap: balance; }
.ob-desc { font-size: var(--t-body); line-height: 1.5; color: var(--text2); margin: 0 auto 8px; max-width: 22em; text-wrap: pretty; }
.ob-dots { display: flex; justify-content: center; gap: 7px; margin: 22px 0 18px; }
.ob-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border2); transition: all .2s; }
.ob-dot.active { background: var(--accent); width: 20px; border-radius: 4px; }
.ob-cta { width: 100%; margin-bottom: 4px; }
.onboarding-skip { background: none; border: 0; color: var(--accent); font-size: var(--t-body); font-weight: 400; min-height: 44px; padding: 10px; margin-top: 2px; }
.start-cards { display: flex; flex-direction: column; gap: 0; margin: 0; text-align: left; background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.start-card {
  width: 100%; display: flex; align-items: center; gap: 14px; min-height: 64px;
  background: var(--surface); border: 0; border-radius: 0; padding: 12px var(--s4);
  text-align: left; transition: background-color .12s;
}
.start-card + .start-card { border-top: 1px solid var(--sep); }
.start-card:active { background: var(--surface3); }
.start-card-ic { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 9px; background: var(--surface2); display: flex; align-items: center; justify-content: center; color: var(--text); }
.start-card-ic .ic { width: 20px; height: 20px; }
.start-card-tx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.start-card-t { font-size: var(--t-body); font-weight: 600; color: var(--text); }
.start-card-s { font-size: var(--t-footnote); line-height: 1.4; color: var(--text2); }
.trip-empty .start-cards { width: 100%; }
#start-options .start-cards { margin-bottom: var(--s2); }
.ex-trips { margin: var(--s4) auto 0; max-width: 440px; width: 100%; text-align: left; }
.ex-trips-h { font-size: var(--t-footnote); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text2); margin: 0 var(--s4) var(--s2); }
.ex-row { display: flex; align-items: center; gap: var(--s3); width: 100%; background: var(--surface); border: 0; border-radius: var(--r-md); padding: 12px var(--s4); margin-bottom: var(--s2); text-align: left; transition: background-color .12s; }
.ex-row:active { background: var(--surface3); }
.ex-beijing { align-items: stretch; }
.ex-photo { width: 72px; min-height: 76px; flex: 0 0 72px; border-radius: 12px; background: url('./demo/gugong_roof.jpg') center / cover no-repeat, var(--surface2); }
.ex-tx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.ex-t { font-size: var(--t-body); font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.ex-s { font-size: var(--t-footnote); color: var(--text2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ex-meta { font-size: var(--t-caption); color: var(--text2); font-weight: 500; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ex-go { align-self: center; max-width: 96px; text-align: right; line-height: 1.25; color: var(--accent); font-size: var(--t-footnote); font-weight: 600; }
/* Пример поездки: действие — отдельной строкой под текстом, название не ломается */
.ex-beijing { flex-wrap: wrap; row-gap: 6px; }
.ex-beijing .ex-tx { flex: 1 1 0; }
.ex-beijing .ex-go { flex: 1 0 100%; max-width: none; text-align: left; padding-left: calc(72px + var(--s3)); }
/* Без поездки шапка хаба не дублирует заголовок пустого состояния */
#screen-days:has(#days-overview-content > .trip-empty) > .hub-head,
#screen-budget:has(#budget-content > .trip-empty) > .hub-head { display: none; }
#examples-modal .ex-trips-h { display: none; }
#examples-modal .ex-trips { margin-top: 0; }

/* ── 23. АДАПТАЦИЯ ─────────────────────────────────────────────────────────── */
/* iPad: колонка чтения + листы по центру, таб-бар остаётся нижним */
@media (min-width: 740px) {
  :root { --gutter: 24px; }
  .screen { max-width: 720px; margin-left: auto; margin-right: auto; }
  .tabbar { justify-content: center; }
  .tabbar > * { max-width: 150px; }
  .modal { align-items: center; justify-content: center; }
  .modal-sheet { max-width: 620px; border-radius: var(--r-sheet); margin-bottom: 0; max-height: 86vh; }
  .modal-handle { display: none; }
  .modal-title { margin-top: var(--s5); }
  .tp-sticky-bar { border-radius: 0 0 var(--r-sheet) var(--r-sheet); }
  .inst { padding: var(--s5) var(--s5) var(--s5); }
  .av-sticky-bar { padding-left: calc(50% - 280px); padding-right: calc(50% - 280px); }
}
@media (min-width: 1100px) {
  .screen { max-width: 780px; }
}
/* iPad в альбомной ориентации: деньги рядом с прибором */
@media (min-width: 1000px) and (orientation: landscape) {
  #now-mode { display: grid !important; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
  #now-mode[style*="display: none"], #now-mode[style*="display:none"] { display: none !important; }
  .today-money { margin-top: var(--s2); }
}
/* Узкие экраны (iPhone SE, Display Zoom) */
@media (max-width: 360px) {
  :root { --gutter: 12px; }
  .inst { padding: 14px 14px 16px; }
  .inst-actions { gap: 6px; }
  .inst-btn { font-size: var(--t-subhead); }
  .tab-item .tab-label { font-size: 11px; letter-spacing: -0.01em; }
}
/* Длинные подписи действий прибора (de/fr/ru при крупном тексте) и узкие экраны →
   главное действие на всю ширину, два вторичных под ним. Слова не рвутся. */
@media (max-width: 400px) {
  .inst-actions.wrap { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .inst-actions.wrap .pri { grid-column: 1 / -1; }
}
@media (max-width: 360px) {
  .inst-actions:not(.two):not(.one) { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .inst-actions:not(.two):not(.one) .pri { grid-column: 1 / -1; }
}

/* Меньше движения */
@media (prefers-reduced-motion: reduce) {
  .screen.anim-forward, .screen.anim-back, .screen.anim-fade,
  .modal-sheet, .app-ov-sheet, .av-acc-body, #act-details-section { animation: none !important; }
  .ob-track, .inst-bar b, .inst-bar u, .progress-fill { transition: none !important; }
  .now-inst:active, .trip-summary:active { transform: none; }
}

/* ═══ Светлая тема · прибор на белой поверхности (вариант на оценку владельцу) ═══
   Структура прибора та же — отрезки, ход, крупные цифры, столбики; меняется
   только материал: белая поверхность как у групп, тёмный текст, синий
   остаётся на «сейчас». Тёмная тема не меняется. Откат — удалить этот блок. */
[data-theme="light"] {
  --inst:        #ffffff;
  --inst-2:      #e8eaee;
  --inst-ink:    #15171b;
  --inst-ink2:   #555b65;
  --inst-line:   rgba(21,23,27,0.10);
  --inst-past:   rgba(21,23,27,0.30);
  --inst-btn:    #e8eaee;
  --inst-btn-press: #dadde3;
  --inst-accent: #3f5f80;
  --inst-on-accent: #ffffff;
  --inst-positive: #286b4c;
  --inst-alert: #a53e35;
  --inst-shadow: 0 1px 2px rgba(20,24,30,0.05), 0 4px 14px rgba(20,24,30,0.05);
}
[data-theme="light"] .inst { --accent-soft: rgba(63,95,128,0.12); }
[data-theme="light"] .inst-btn.pri:active { background: #344f6b; }
/* Canon usability fixes: keep the established shapes and brand accent. */
.hub-switch, .wm-sug, .hid-btn, .ncn-btn, .btn, .btn-edit, .btn-del,
.chip-btn, .tp-chip, .wm-chip, .tsc, .pkg-imp-city { min-height: 44px; }
button.hub-trip, button.back-btn { border: 0; background: transparent; text-align: left; font-family: inherit; }
button.hub-trip { min-height: 44px; }
.form-row > .form-field { flex: 1 1 0; min-width: 0; }
.form-field .form-input { width: 100%; }
.dg-hint { color: var(--inst-ink2); font-size: var(--t-footnote); line-height: 1.4; margin: var(--s3) 0 0; }
.tl-overdue { border-top: 1px solid var(--sep); }
.tl-overdue summary { min-height: 44px; padding: 12px var(--s4); color: var(--text2); cursor: pointer; }
.tp-guide { margin-bottom: var(--s4); }
.tp-guide > summary { min-height: 44px; padding: 12px 4px; color: var(--accent); cursor: pointer; font-size: var(--t-subhead); }
.tp-guide .tp-how { margin-bottom: 0; }
.ai-disclosure { margin: 0 0 var(--s4); color: var(--text2); font-size: var(--t-footnote); line-height: 1.45; }
/* Окно само ставит фокус на заголовок — без этого вокруг него рисуется рамка,
   и заголовок выглядит как поле ввода. Клавиатурный фокус остаётся видимым. */
.modal-title:focus:not(:focus-visible), .ov-title:focus:not(:focus-visible),
.ov-text:focus:not(:focus-visible), .modal:focus:not(:focus-visible),
.sheet-overlay:focus:not(:focus-visible), .app-ov-sheet:focus:not(:focus-visible) { outline: none; }
.toast-action { min-height: 44px; border: 0; background: transparent; color: var(--inst-accent); font: inherit; font-weight: 600; padding: 8px 12px; margin-inline-start: 6px; cursor: pointer; }
[data-theme="light"] .dg-col.on .dg-bars i { background: rgba(63,95,128,0.22); }
/* Всплывающие плашки поверх экрана остаются тёмными, как системные в iOS */
[data-theme="light"] #toast-el, [data-theme="light"] .hint-bar, [data-theme="light"] .offline-bar {
  --inst: #13171c; --inst-ink: #f2f3f5; --inst-ink2: #aab1bb; --inst-line: rgba(255,255,255,0.11);
  --inst-btn: rgba(255,255,255,0.08); --inst-accent: #7c9cbf;
  --inst-shadow: 0 1px 2px rgba(20,24,30,0.10), 0 12px 28px rgba(20,24,30,0.14);
}
