/* Витрати — спокійний мобільний інтерфейс. Світла й темна теми за prefers-color-scheme. */

:root {
  color-scheme: light dark;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #15181d;
  --muted: #687180;
  --line: #e3e6ea;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ee;
  --bar: #18232d;
  --bar-ink: #ffffff;
  --p1: #0f766e;
  --p2: #c46a1b;
  --warn: #965607;
  --warn-bg: #fcf1dc;
  --bad: #b42318;
  --bad-bg: #fdeceb;
  --toast-bg: #1d232b;
  --toast-ink: #ffffff;
  --toast-accent: #7ee0d2;
  --shadow: 0 1px 2px rgb(16 24 32 / 6%), 0 4px 14px rgb(16 24 32 / 6%);
  --radius: 16px;
  --tabbar-h: 58px;
  --sa-top: env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
  --sa-left: env(safe-area-inset-left, 0px);
  --sa-right: env(safe-area-inset-right, 0px);
  --gutter: max(16px, var(--sa-left));
  --gutter-r: max(16px, var(--sa-right));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f12;
    --surface: #171a1f;
    --surface-2: #20252c;
    --text: #eceef1;
    --muted: #9aa3ae;
    --line: #2a3038;
    --accent: #3cc4b0;
    --accent-ink: #052520;
    --accent-soft: #14302c;
    --bar: #0b0d10;
    --p1: #3cc4b0;
    --p2: #f0a35e;
    --warn: #f3b860;
    --warn-bg: #2d2412;
    --bad: #ff8a7d;
    --bad-bg: #351c19;
    --toast-bg: #eceef1;
    --toast-ink: #15181d;
    --toast-accent: #0f766e;
    --shadow: none;
  }
}

/* ?sa — імітація виреза й нижньої смуги iPhone для перевірки в емуляторі */
.fake-safe-area { --sa-top: 47px; --sa-bottom: 34px; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
body.sheet-open { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.warn-text { color: var(--warn); }
.bad-text { color: var(--bad); }
p { margin: 0 0 8px; }

.ic { display: block; flex: none; }

/* ---------- Каркас ---------- */
#screens { padding-bottom: calc(var(--tabbar-h) + var(--sa-bottom) + 24px); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bar);
  color: var(--bar-ink);
  padding-top: var(--sa-top);
}
.topbar-in {
  max-width: 560px;
  margin: 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 calc(var(--gutter-r) - 6px) 0 var(--gutter);
}
.topbar-title { font-size: 19px; font-weight: 650; margin: 0; letter-spacing: -0.01em; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 2px; min-width: 0; }

.content { max-width: 560px; margin: 0 auto; padding: 12px var(--gutter-r) 0 var(--gutter); }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--sa-bottom));
  padding: 0 var(--sa-right) var(--sa-bottom) var(--sa-left);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
}
.tab.on { color: var(--accent); }
@media (min-width: 720px) {
  .tabbar { padding-left: calc(50% - 280px); padding-right: calc(50% - 280px); }
}

/* ---------- Кнопки ---------- */
.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  color: inherit;
  flex: none;
}
.icon-btn:disabled { opacity: 0.3; }
.icon-btn.small { width: 40px; height: 40px; }
.content .icon-btn { color: var(--text); }
.spin .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.primary-btn {
  width: 100%;
  min-height: 54px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 17px;
  font-weight: 650;
  transition: opacity 0.15s, transform 0.1s;
}
.primary-btn:active:not(:disabled) { transform: scale(0.985); }
.primary-btn:disabled { background: color-mix(in srgb, var(--accent) 30%, var(--bg)); color: color-mix(in srgb, var(--accent-ink) 85%, var(--accent)); }

.secondary-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}
.secondary-btn.wide { width: 100%; margin-bottom: 10px; }
.secondary-btn:disabled { opacity: 0.5; }

.link-btn { color: var(--accent); min-height: 44px; padding: 0 4px; font-size: 15px; font-weight: 550; }
.link-btn.danger { color: var(--bad); }

.danger-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 20px;
  border-radius: 12px;
  border: 1px solid var(--bad);
  color: var(--bad);
  font-weight: 600;
}
.danger-btn.armed { background: var(--bad); color: #fff; }
.danger-btn.small-btn { margin-top: 12px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; }

/* ---------- Статус і банери ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 13px;
  font-weight: 550;
  color: var(--bar-ink);
  white-space: nowrap;
}
.pill-in { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 999px; background: rgb(255 255 255 / 10%); }
.status-pill.ok { color: #b9e7df; }
.status-pill.warn { color: #ffd38f; }
.status-pill.warn .pill-in { background: rgb(255 200 120 / 14%); }
.status-pill.bad { color: #ffaba1; }
.status-pill.bad .pill-in { background: rgb(255 120 110 / 16%); }
.status-pill.busy .ic { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  margin: 4px 0 10px;
}
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner-btn { font-weight: 650; min-height: 40px; padding: 0 6px; color: inherit; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }

/* ---------- Картки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  box-shadow: var(--shadow);
}
.card-title { font-size: 15px; font-weight: 650; margin: 0 0 12px; letter-spacing: -0.005em; }
.hint { background: var(--accent-soft); border-color: transparent; box-shadow: none; font-size: 15px; }
.hint-title { font-weight: 650; margin-bottom: 4px; }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }

.empty { text-align: center; padding: 48px 16px; }
.empty-title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.empty-sub { color: var(--muted); font-size: 14px; }

/* ---------- Форма ---------- */
.amount-box {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 18px 12px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  cursor: text;
  box-shadow: var(--shadow);
}
.amount-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.amount-input {
  width: 2.5ch;
  max-width: 82%;
  min-width: 1.5ch;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0;
  font-size: 46px;
  font-weight: 680;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  text-align: right;
  caret-color: var(--accent);
}
.amount-input::placeholder { color: var(--muted); opacity: 0.5; }
.amount-cur { font-size: 28px; font-weight: 600; color: var(--muted); }
.approx { text-align: center; color: var(--muted); font-size: 14px; min-height: 20px; margin: 6px 0 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 550;
  max-width: 100%;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-ghost { background: transparent; border-style: dashed; color: var(--muted); }
.chip.static { min-height: 34px; font-size: 13.5px; cursor: default; padding: 0 10px; }
.chip.inactive { opacity: 0.5; }
.chip-x { width: 30px; height: 30px; margin: 0 -8px 0 2px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 17px; line-height: 1; display: inline-grid; place-items: center; }
.chip-date { overflow: hidden; cursor: pointer; }
.date-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  font-size: 16px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.field-label { font-size: 13px; color: var(--muted); font-weight: 600; margin: 18px 2px 8px; }

.cat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cat {
  min-height: 70px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  font-size: 12.5px;
  line-height: 1.2;
  text-align: center;
  transition: background 0.12s, border-color 0.12s;
}
.cat-icon { font-size: 23px; line-height: 1; }
.cat-name { overflow-wrap: anywhere; }
.cat.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }

.acc-group { margin-bottom: 10px; }
.acc-owner { font-size: 12.5px; color: var(--muted); margin: 0 2px 6px; }
.acc-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.acc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62vw; }

.text-input {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 16px;
  padding: 10px 12px;
  -webkit-appearance: none;
  appearance: none;
}
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.text-input { resize: none; line-height: 1.35; font-size: 16px; }
.form > .text-input { margin-top: 18px; }
.code-input { width: 120px; flex: none; text-transform: uppercase; }
.icon-input { width: 58px; flex: none; text-align: center; padding: 8px 4px; font-size: 20px; }

.sticky-cta {
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--sa-bottom));
  margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter));
  padding: 14px var(--gutter-r) 10px var(--gutter);
  background: linear-gradient(to top, var(--bg) 72%, transparent);
  z-index: 5;
}

.select {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a929c' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  font-size: 16px;
  padding: 0 32px 0 12px;
  -webkit-appearance: none;
  appearance: none;
  text-overflow: ellipsis;
}
.select-wrap { display: flex; align-items: center; gap: 6px; flex: 1 1 140px; min-width: 0; }
.stack { display: flex; flex-direction: column; flex: 1 1 140px; }
.stack .field-label { margin-top: 0; }

.segmented {
  display: flex;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
  flex: 1 1 auto;
}
.segmented button {
  flex: 1;
  min-height: 40px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 550;
  color: var(--muted);
  padding: 0 10px;
  white-space: nowrap;
}
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 14%); font-weight: 650; }

.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; transition: background 0.15s; flex: none; }
.switch-track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: transform 0.15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-label { font-size: 15px; }

/* ---------- Історія ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin: 2px 0 6px; }
.month-center { text-align: center; min-width: 0; flex: 1; }
.month-name { font-weight: 600; font-size: 15px; color: var(--muted); }
.sum-toggle { font-size: 24px; font-weight: 720; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; min-height: 44px; padding: 0 8px; }

.filters { display: grid; gap: 8px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { display: block; margin: 0 auto 4px; min-height: 36px; padding: 0 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 13.5px; font-weight: 600; }

.day-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px 4px; }
.day-title { font-size: 14px; color: var(--muted); font-weight: 600; margin: 0; }
.day-sum { font-size: 14.5px; font-weight: 650; font-variant-numeric: tabular-nums; min-height: 40px; padding: 0 4px 0 12px; }

.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.rows li + li .row { border-top: 1px solid var(--line); }
.row {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  min-height: 62px;
  text-align: left;
}
.row:active { background: var(--surface-2); }
.row-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; font-size: 19px; }
.row-main { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.row-title, .row-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title { font-size: 15.5px; font-weight: 520; }
.row-sub { font-size: 13px; color: var(--muted); }
.row-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.flag { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.flag.warn { background: var(--warn-bg); color: var(--warn); }
.flag.bad { background: var(--bad-bg); color: var(--bad); }
.row-amount { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.row-orig { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-sec { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Зведення ---------- */
.summary-top { margin: 6px 0 4px; display: flex; }
.period-title { text-align: center; color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.hero { text-align: center; padding: 20px 16px 18px; }
.hero-label { color: var(--muted); font-size: 14px; }
.hero-sum { font-size: 40px; font-weight: 760; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; min-height: 54px; padding: 0 8px; }
.hero-sub { color: var(--muted); font-size: 14px; }
.hero-note { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.hero-warn { color: var(--warn); font-size: 13px; margin-top: 8px; }

.life { background: linear-gradient(160deg, var(--accent-soft), var(--surface) 70%); }
.kv { margin: 0 0 10px; }
.kv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 0; }
.kv dt { font-size: 15px; }
.kv dd { margin: 0; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv-hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; font-weight: 400; }

.bars { list-style: none; margin: 0; padding: 0; }
.bar-item { margin: 12px 0; }
.bar-item:first-child { margin-top: 0; }
.bar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.bar-pct { color: var(--muted); font-weight: 450; margin-left: 6px; font-size: 12.5px; display: inline-block; min-width: 30px; text-align: right; }
.bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.tag { font-size: 11px; background: var(--surface-2); color: var(--muted); padding: 1px 6px; border-radius: 6px; margin-left: 6px; font-weight: 600; white-space: nowrap; }

.split { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface-2); }
.split-seg.p1, .dot.p1 { background: var(--p1); }
.split-seg.p2, .dot.p2 { background: var(--p2); }
.legend { list-style: none; padding: 0; margin: 12px 0 0; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend-name { flex: 1; }
.legend-val { font-variant-numeric: tabular-nums; font-weight: 650; }

.chart-wrap { margin: 0 -4px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-bar { fill: var(--accent); }
.chart-day:focus .chart-bar, .chart-day:hover .chart-bar { fill: var(--p2); }
.chart-day:focus { outline: none; }
.chart-avg { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 9px; }
.chart-label { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 6px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: right; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 0 4px 6px; }
.table td { text-align: right; padding: 9px 4px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; white-space: normal; padding-left: 0; }
.table td:last-child, .table th:last-child { padding-right: 0; }
.table tfoot td { font-weight: 700; }

/* ---------- Налаштування ---------- */
.plain-list { list-style: none; padding: 0; margin: 0 0 8px; }
.plain-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.plain-list li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.plain-list li > span:last-child { white-space: nowrap; }
.plain-list .inactive { opacity: 0.55; }
.cat-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.edit-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 10px 0; display: grid; gap: 8px; }
.edit-item.inactive { opacity: 0.6; }
.edit-line { display: flex; gap: 8px; align-items: center; }
.edit-line.wrap { flex-wrap: wrap; }
.move { display: flex; flex: none; }
.queue { list-style: none; padding: 0; margin: 0; }
.queue-item { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.settings .card p { font-size: 15px; }

/* ---------- Редагування: нижній аркуш ---------- */
#sheet-root .sheet-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / 38%); opacity: 0; transition: opacity 0.2s; z-index: 39; }
#sheet-root .sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: calc(var(--sa-top) + 20px);
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  transform: translateY(102%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  z-index: 40;
  box-shadow: 0 -8px 30px rgb(0 0 0 / 18%);
}
#sheet-root .sheet.small { top: auto; }
#sheet-root.open .sheet-backdrop { opacity: 1; }
#sheet-root.open .sheet { transform: none; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.sheet-title { text-align: center; font-size: 16px; font-weight: 650; margin: 0; }
.sheet-cancel, .sheet-save { min-height: 44px; padding: 0 12px; color: var(--accent); font-size: 16px; }
.sheet-cancel { justify-self: start; }
.sheet-save { justify-self: end; font-weight: 700; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px var(--gutter-r) calc(28px + var(--sa-bottom)) var(--gutter); flex: 1; }
.sheet.small .sheet-body .sheet-title { text-align: left; margin-bottom: 6px; }
.sheet.small .segmented { margin-top: 12px; }
.fx-box { margin-top: 6px; font-size: 15px; }
.inline-field { display: flex; align-items: center; gap: 8px; margin: 8px 0; white-space: nowrap; }
.inline-field .text-input { flex: 1; min-width: 0; }
.meta { margin-top: 18px; }

/* ---------- Тост ---------- */
#toast-root {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter-r);
  bottom: calc(var(--tabbar-h) + var(--sa-bottom) + 84px);
  display: flex;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s, transform 0.18s;
  z-index: 60;
}
#toast-root.show { opacity: 1; transform: none; }
.toast {
  pointer-events: auto;
  background: var(--toast-bg);
  color: var(--toast-ink);
  border-radius: 14px;
  padding: 8px 8px 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 22%);
  font-size: 15px;
  min-height: 48px;
}
.toast-text { padding: 4px 0; }
.toast-btn { color: var(--toast-accent); font-weight: 700; min-height: 40px; padding: 0 10px; white-space: nowrap; }

/* ---------- Підключення ---------- */
.connect { max-width: 480px; margin: 0 auto; padding: calc(var(--sa-top) + 36px) var(--gutter-r) calc(var(--sa-bottom) + 32px) var(--gutter); text-align: center; }
.connect h1 { margin: 12px 0 2px; font-size: 26px; letter-spacing: -0.015em; }
.connect .card { text-align: left; margin-top: 22px; }
.connect .card > * + * { margin-top: 10px; }
.connect-logo { border-radius: 18px; }
.connect-msg { color: var(--bad); font-size: 14px; min-height: 1.2em; }

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