/* Redesign 2026-11: shared components and the three interface themes.
   Loaded last, so it refines style.css and redesign.css without changing markup
   contracts (data-action, ids and labels stay as the code and tests expect). */

/* ---- Compact header: one line, no repeated brand label ---- */
.app-shell > #header {
  min-height: 52px;
  padding: 4px calc(var(--page-gutter) + 46px) 4px var(--page-gutter);
  align-items: center;
  gap: 8px;
}
.app-shell > #header .eyebrow { display: none; }
.app-shell > #header h1 { font-size: 22px; line-height: 1.25; font-weight: 700; }
.app-shell > #header .plus {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0;
}
.app-shell > #header .plus svg { width: 22px; height: 22px; stroke-width: 2.4; }

/* ---- Refresh: one icon in the header corner instead of its own row ---- */
.app-shell > .data-refresh-toolbar {
  position: absolute;
  top: 4px;
  right: max(4px, calc(var(--page-gutter) - 12px));
  z-index: 3;
  min-height: 44px;
  padding: 0;
  gap: 0;
}
.app-shell > .data-refresh-toolbar .data-refresh-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  justify-content: center;
  border-radius: 22px;
  color: #d1d1d6;
  background: transparent;
}
.app-shell > .data-refresh-toolbar .data-refresh-button > span:last-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.app-shell > .data-refresh-toolbar .data-refresh-status:empty { display: none; }
.app-shell > .data-refresh-toolbar .data-refresh-status {
  position: absolute;
  top: 46px;
  right: 6px;
  max-width: min(70vw, 320px);
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--white);
  font-size: 12px;
  text-align: right;
  /* The toolbar is only as wide as ⟳: size the note by its words, never letter by letter. */
  width: max-content;
  overflow-wrap: normal;
}

/* ---- «День»: one date row, goals first and compact, totals beside the count ---- */
.app-shell > #header.today-header { min-height: 0; height: 0; padding: 0; margin: 0; overflow: visible; }
.app-shell > #header.today-header .plus { position: absolute; top: 4px; right: max(52px, calc(var(--page-gutter) + 36px)); z-index: 3; }
.today-screen .day-toolbar { min-height: 52px; margin: 0; padding: 4px 96px 4px 0; border: 0; gap: 2px; }
.today-screen .day-navigation { align-items: center; gap: 0; flex-wrap: wrap; }
.today-screen .day-navigation > button[data-action="previous-day"],
.today-screen .day-navigation > button[data-action="next-day"] { min-width: 40px; min-height: 44px; padding: 0; font-size: 28px; line-height: 1; color: var(--accent); background: transparent; border: 0; }
.today-screen .day-picker { flex: 0 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
/* The day in Russian over the browser's date field: the field stays on top, transparent and tappable. */
.today-screen .day-picker-v2 { position: relative; min-height: 44px; padding: 0 4px; }
.today-screen .day-picker-v2 > .day-label { overflow: hidden; font-size: 18px; font-weight: 600; line-height: 1.2; color: var(--white); white-space: nowrap; text-overflow: ellipsis; }
.today-screen .day-picker-v2 > .day-compact { display: none; }
.today-screen .day-picker-v2 > input { position: absolute; inset: 0; width: 100%; max-width: none; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; background: transparent; color: transparent; opacity: 0; font-size: 16px; cursor: pointer; }
.today-screen .day-picker-v2:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.today-screen .day-picker-v2 > input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.today-screen .today-shortcut { height: 32px; min-height: 32px; padding: 0 12px; border: 0; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.today-screen .calendar-toggle { margin-left: auto; color: #d1d1d6; }
.today-layout { gap: 0; }
.today-screen .section-heading {
  min-height: 36px;
  padding: 8px 0 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--secondary);
  text-transform: uppercase;
  background: transparent;
}
/* «ЦЕЛИ» right under the date row: one 36 px line; the eye and «+» keep 44 px of width. */
.app-shell #main .today-screen .section-heading { align-items: center; min-height: 36px; margin: 0; padding: 0; }
.today-screen .section-heading button { min-width: 44px; min-height: 36px; padding: 0; justify-content: center; color: var(--accent); }
.today-screen .section-heading .goal-privacy { display: flex; align-items: center; width: 44px; height: 36px; min-height: 36px; padding: 0; }
.today-screen .section-heading button > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.daily-primary > .section-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.today-screen .daily-primary .filters { display: flex; flex-wrap: nowrap; gap: 8px; margin: 2px 0 6px; }
.today-screen .daily-primary .filters input,
.today-screen .daily-primary .filters select {
  min-height: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--white);
  font-size: 16px;
}
.today-screen .daily-primary .filters > input { flex: 1 1 auto; min-width: 0; padding: 0 12px; }
.today-screen .daily-primary .filters > .select-control, .today-screen .daily-primary .filters > select { flex: 0 0 auto; width: 132px; }
.daily-primary .date-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 2px 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--secondary);
  text-transform: uppercase;
}
.date-strip-meta { display: flex; align-items: baseline; gap: 10px; margin-left: auto; text-transform: none; letter-spacing: 0; }
.date-strip-search { flex: none; display: grid; place-items: center; width: 40px; height: 36px; min-height: 36px; margin: 0 0 0 -6px; padding: 0; border: 0; background: transparent; color: var(--accent); }
.date-strip-search svg { width: 20px; height: 20px; }
.date-strip-search[aria-expanded="true"] { color: var(--white); }
.date-strip-count { font-size: 12px; font-weight: 600; color: var(--secondary); }
.date-strip-totals { display: flex; gap: 10px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.date-strip-totals .red { color: var(--red); }
.date-strip-totals .green { color: var(--green); }
.app-shell #main .today-screen .operation-rows > .row { min-height: 50px; padding: 5px 0; border-color: var(--hairline); }
.today-screen .operation-rows .row-title { font-size: 16px; font-weight: 600; }
.today-screen .operation-rows .row-main .row-sub { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.operation-date.no-day time:empty { display: none; }
.today-screen .day-toolbar { display: flex; flex-wrap: nowrap; align-items: center; }
.today-screen .day-toolbar .day-navigation {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
}
.today-screen .day-toolbar .today-shortcut { grid-column: 1 / -1; justify-self: start; margin: 2px 0 4px 6px; }
.today-screen .calendar-toggle { margin-left: 2px; }
/* «Запланировано»: a title row like «ЦЕЛИ», compact group rows and search, no explanatory lines. */
.app-shell #main .today-screen .planned-panel-toggle { min-height: 40px; padding: 0; border-radius: 0; background: transparent; }
.app-shell #main .today-screen .planned-scope-toggle { min-height: 40px; padding: 0; }
.today-screen #today-plan-tools > summary { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0; color: var(--accent); font-size: 14px; list-style: none; cursor: pointer; }
.today-screen #today-plan-tools > summary::-webkit-details-marker { display: none; }
.today-screen #today-plan-tools > summary svg { width: 18px; height: 18px; }

/* ---- «Ещё»: groups ---- */
.menu-group .section-heading { min-height: 34px; padding: 10px 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--secondary); text-transform: uppercase; background: transparent; }
.menu-group .menu-row { min-height: 56px; padding: 8px 0; border-color: var(--hairline); }
.menu-group .menu-row .row-title { font-size: 16px; font-weight: 500; }
.menu-group .menu-row .row-sub { font-size: 13px; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-group .danger-row, .menu-group .danger-row .icon-disc { color: var(--red); }

/* ---- Quick theme: rounded blocks, week strip, «+» in the tab bar ---- */
html[data-theme="quick"] .today-screen .today-goals .rows,
html[data-theme="quick"] .today-screen .daily-primary .operation-rows,
html[data-theme="quick"] .menu-group .rows {
  padding: 0 12px;
  border-radius: var(--radius-block);
  background: var(--surface);
}
html[data-theme="quick"] .today-screen .row,
html[data-theme="quick"] .menu-group .menu-row { border-color: var(--surface-raised); }
html[data-theme="quick"] .today-screen .rows > .row:last-child,
html[data-theme="quick"] .menu-group .rows > .row:last-child { border-bottom: 0; }
html[data-theme="quick"] .menu-group .icon-disc { border-radius: 8px; background: var(--surface-raised); }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin: 0 0 8px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 60px; padding: 4px 0; border: 0; background: transparent; color: var(--white); }
.week-day span { font-size: 12px; color: var(--secondary); text-transform: capitalize; }
.week-day b { width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.week-day[aria-current="date"] span { color: var(--accent); }
.week-day[aria-pressed="true"] b { background: var(--accent); color: var(--on-accent); }
html[data-theme="quick"] .app-shell > #header.today-header .plus { display: none; }
#navigation .nav-add { display: none; }
html[data-theme="quick"] #navigation .nav-add {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  min-height: 58px;
  padding: 0;
  border: 0;
  border-radius: 29px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 0 5px var(--bg);
}
html[data-theme="quick"] #navigation .nav-add svg { width: 28px; height: 28px; stroke-width: 2.4; }
@media (max-width: 800px) {
  html[data-theme="quick"] #navigation .nav-add { align-self: flex-start; margin: -22px 4px 0; }
}
.account-switch {
  display: flex;
  flex: 1 1 auto;
  max-width: 260px;
  height: 48px;
  padding: 2px;
  gap: 2px;
  border-radius: 12px;
  background: var(--surface);
}
.account-switch button { flex: 1 1 0; min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--secondary); font-size: 15px; font-weight: 600; }
.account-switch button[aria-pressed="true"] { background: var(--surface-raised); color: var(--white); }

/* ---- Quick and tiles: amounts as colored text instead of filled badges ---- */
/* Main screens only: the account journal is a window and keeps its badges. */
html[data-theme="quick"] :where(.app-shell) .operation-rows .row.operation-row .operation-amount,
html[data-theme="tiles"] :where(.app-shell) .operation-rows .row.operation-row .operation-amount { padding: 0; background: transparent; font-weight: 600; }
html[data-theme="quick"] :where(.app-shell) .operation-rows .row.operation-row .operation-amount.red,
html[data-theme="tiles"] :where(.app-shell) .operation-rows .row.operation-row .operation-amount.red { background: transparent; color: var(--red); }
html[data-theme="quick"] :where(.app-shell) .operation-rows .row.operation-row .operation-amount.green,
html[data-theme="tiles"] :where(.app-shell) .operation-rows .row.operation-row .operation-amount.green { background: transparent; color: var(--green); }
html[data-theme="quick"] :where(.app-shell) .operation-rows .row.operation-row .operation-amount.transfer-amount,
html[data-theme="tiles"] :where(.app-shell) .operation-rows .row.operation-row .operation-amount.transfer-amount { background: transparent; color: var(--white); }

/* ---- Tiles theme: goals as two-column tiles, «Ещё» as a grid ---- */
html[data-theme="tiles"] .today-screen .planned-panel { border-radius: var(--radius-block); background: var(--surface); padding: 0 12px; margin-top: 8px; }
html[data-theme="tiles"] .today-screen .operation-rows .icon-disc { border-radius: 10px; }
html[data-theme="tiles"] .menu-group .rows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
html[data-theme="tiles"] .menu-group .menu-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-height: 92px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-block);
  background: var(--surface);
  text-align: left;
}
html[data-theme="tiles"] .menu-group .menu-row .icon-disc { width: auto; height: auto; background: transparent; color: var(--accent); }
html[data-theme="tiles"] .menu-group .menu-row .row-title { font-size: 14px; line-height: 1.2; white-space: normal; }
html[data-theme="tiles"] .menu-group .menu-row .row-sub,
html[data-theme="tiles"] .menu-group .menu-row .chevron {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
html[data-theme="tiles"] .menu-group .danger-row { background: #2a1715; }
html[data-theme="quick"] .today-screen .planned-panel,
html[data-theme="tiles"] .today-screen .planned-panel { margin-top: 8px; padding: 0 12px; border-radius: var(--radius-block); background: var(--surface); overflow: hidden; }
html[data-theme="tiles"] .menu-group .menu-row .row-title { font-size: 13px; hyphens: auto; overflow-wrap: normal; word-break: normal; }

/* ==== Global layer: the main screens in the active theme's style ==== */
/* Windows keep their pre-redesign look in every theme until the owner approves
   the stage 2 forms: the operation form, the category picker, the account journal
   and the other forms in #editor and the other dialogs live outside .app-shell.
   :where() limits the rules without changing their specificity. */
/* Lists (account rows keep their dense layout until stage 3) */
.app-shell #main .rows > .row { min-height: 52px; padding: 8px 0; gap: 12px; border-color: var(--hairline); }
.app-shell #main .rows > .row .row-title { font-size: 16px; line-height: 1.3; }
.app-shell #main .rows > .row .row-sub { font-size: 13px; line-height: 1.35; margin-top: 2px; color: var(--secondary); }
.app-shell #main .rows > .row .row-amount { font-size: 16px; }
:where(.app-shell) .icon-disc { width: 36px; height: 36px; border-radius: 18px; background: var(--surface); color: #e5e5ea; }
:where(.app-shell) .icon-disc svg { width: 20px; height: 20px; }
:where(.app-shell) .chevron { color: #636366; }
/* Section titles */
.app-shell #main .section-heading { min-height: 36px; padding: 14px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--secondary); background: transparent; }
:where(.app-shell) .section-band { margin-top: 16px; padding: 8px 0; border-color: var(--hairline); font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--secondary); }
:where(.app-shell) .section-band span:last-child { border: 0; padding: 0; font-size: 13px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
:where(.app-shell) .note { font-size: 13px; line-height: 1.5; color: var(--secondary); }
/* Fields: always a filled surface, a label above, the theme accent in focus */
:where(.app-shell) .field > span { font-size: 13px; color: var(--secondary); margin-bottom: 6px; }
:where(.app-shell) .field input, :where(.app-shell) .field select, :where(.app-shell) .field textarea {
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: var(--surface);
}
:where(.app-shell) .field input:focus, :where(.app-shell) .field select:focus, :where(.app-shell) .field textarea:focus { border-color: var(--accent); outline: none; }
/* Buttons */
:where(.app-shell) .secondary { min-height: 44px; border: 0; border-radius: var(--radius-control); background: var(--surface); color: var(--white); font-size: 15px; }
:where(.app-shell) .primary, :where(.app-shell) .empty button { min-height: 44px; border-radius: var(--radius-control); font-size: 15px; }
:where(.app-shell) .empty { border: 0; border-radius: var(--radius-control); background: var(--surface); font-size: 14px; }
/* Segmented controls */
:where(.app-shell) .segmented { padding: 2px; gap: 2px; border: 0; border-radius: calc(var(--radius-control) + 2px); background: var(--surface); }
:where(.app-shell) .segmented button { min-height: 40px; border-radius: var(--radius-control); font-size: 14px; }
:where(.app-shell) .segmented .selected { color: var(--white); background: var(--surface-raised); }
:where(.app-shell) .segmented .selected.expense { color: var(--red); background: var(--surface-raised); }
:where(.app-shell) .segmented .selected.income { color: var(--green); background: var(--surface-raised); }

/* Quick: every list is a rounded inset block */
html[data-theme="quick"] .app-shell #main .rows { padding: 0 12px; border-radius: var(--radius-block); background: var(--surface); }
html[data-theme="quick"] .app-shell #main .rows > .row { border-color: var(--surface-raised); }
html[data-theme="quick"] .app-shell #main .rows > .row:last-child { border-bottom: 0; }
html[data-theme="quick"] :where(.app-shell) .icon-disc { background: var(--surface-raised); }
html[data-theme="quick"] :where(.app-shell) .section-band { border: 0; }

/* Tiles: list rows become separate cards */
html[data-theme="tiles"] .app-shell #main .rows:not(.operation-rows) { display: grid; gap: 8px; }
html[data-theme="tiles"] .app-shell #main .rows:not(.operation-rows) > .row {
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-block);
  background: var(--surface);
}
html[data-theme="tiles"] :where(.app-shell) .icon-disc { border-radius: 10px; background: var(--surface-raised); }
html[data-theme="tiles"] :where(.app-shell) .section-band { border: 0; }
/* Accounts list rows are articles; the refresh icon needs room on the balance screen. */
html:not([data-theme="quick"]) .accounts-compact .accounts-summary-row { padding-right: 46px; }
html[data-theme="quick"] :where(.app-shell) .account-list > .account-item { border-color: var(--surface-raised); }
html[data-theme="tiles"] .app-shell #main .account-list { display: grid; gap: 8px; }
html[data-theme="tiles"] .app-shell #main .account-list > .account-item { padding: 6px 12px; border: 0; border-radius: var(--radius-block); background: var(--surface); }
/* Day totals in several currencies wrap whole amounts instead of widening the page. */
.daily-primary .date-strip { flex-wrap: wrap; }
.date-strip-meta, .date-strip-totals { flex-wrap: wrap; justify-content: flex-end; row-gap: 2px; min-width: 0; }
.date-strip-totals > span { white-space: nowrap; }
/* The narrowest phones keep every day control on one row with 44 px targets. */
@media (max-width: 360px) {
  :root { --page-gutter: 12px; }
  .today-screen .day-toolbar { padding-right: 86px; }
  .today-screen .day-picker-v2 > .day-full { display: none; }
  .today-screen .day-picker-v2 > .day-compact { display: inline; font-size: 16px; }
  .today-screen .day-navigation > button[data-action="previous-day"],
  .today-screen .day-navigation > button[data-action="next-day"] { min-width: 32px; }
  .today-screen .calendar-toggle { margin-left: 0; }
}
/* Quick: the accounts header carries the «Счета | Капитал» switch, so it is shown. */
html[data-theme="quick"] .app-shell > #header.accounts-header { display: flex; }

/* ==== Stage 3: «Счета» and «Капитал» (boards «A · Счета», «B · Счета и капитал», «C · Счета», 02.11) ====
   «Изначальная тема» keeps the previous screen: there app.js renders the old markup. */
.app-shell > #header.accounts-header { display: flex; }
.app-shell > #header.accounts-header h1 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-shell > #header.accounts-header .accounts-tools { display: flex; flex: none; align-items: center; }
.app-shell > #header.accounts-header :is(.capital-visibility, .account-edit-toggle) {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--accent);
}
.app-shell > #header.accounts-header :is(.capital-visibility, .account-edit-toggle) svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-shell > #header.accounts-header .account-switch { flex: 1 1 auto; min-width: 0; }
.app-shell > #header.accounts-header .plus { flex: none; }

/* Totals: «Классика» — a bar per line, the amount on it; «Быстрый ввод» — a card with the net capital; «Плитки» — two tiles. */
.accounts-v2 .acc-totals { display: grid; gap: 6px; margin: 0 0 6px; padding: 4px 0 14px; border-bottom: 1px solid var(--hairline); }
.accounts-v2 .acc-net { display: none; }
.accounts-v2 .acc-total { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 10px; }
.accounts-v2 .acc-total-label { font-size: 13px; color: var(--secondary); }
.accounts-v2 .acc-total-amount {
  justify-self: start;
  min-width: var(--share);
  max-width: 100%;
  min-height: 26px;
  display: flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--green);
  color: #000;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.accounts-v2 .acc-total.negative .acc-total-amount { background: var(--red); }
.accounts-v2 .acc-total-bar { display: none; }
.accounts-v2 .acc-totals > p { grid-column: 1 / -1; margin: 0; }

html[data-theme="quick"] .accounts-v2 .acc-totals { gap: 8px; margin: 4px 0 6px; padding: 12px 14px 14px; border: 0; border-radius: 14px; background: var(--surface); }
html[data-theme="quick"] .accounts-v2 .acc-net { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 12px; }
html[data-theme="quick"] .accounts-v2 .acc-net span { font-size: 13px; color: var(--secondary); }
/* Huge amounts wrap by digits rather than leave the screen. */
html[data-theme="quick"] .accounts-v2 .acc-net strong { min-width: 0; max-width: 100%; margin-left: auto; font-size: 26px; font-weight: 700; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
html[data-theme="quick"] .accounts-v2 .acc-total { grid-template-columns: auto minmax(0, 1fr); row-gap: 4px; }
html[data-theme="quick"] .accounts-v2 .acc-total-amount { justify-self: end; min-width: 0; min-height: 0; height: auto; padding: 0; border-radius: 0; background: none; color: var(--green); font-size: 13px; font-weight: 600; text-align: right; }
html[data-theme="quick"] .accounts-v2 .acc-total.negative .acc-total-amount { background: none; color: var(--red); }
html[data-theme="quick"] .accounts-v2 .acc-total-bar { display: block; grid-column: 1 / -1; position: relative; height: 8px; border-radius: 4px; background: var(--surface-raised); overflow: hidden; }
html[data-theme="quick"] .accounts-v2 .acc-total-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--share); border-radius: 4px; background: var(--green); }
html[data-theme="quick"] .accounts-v2 .acc-total.negative .acc-total-bar::after { background: var(--red); }

html[data-theme="tiles"] .accounts-v2 .acc-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 4px 0 8px; border: 0; }
html[data-theme="tiles"] .accounts-v2 .acc-total { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; text-align: left; min-width: 0; height: 72px; padding: 0 14px; border-radius: 16px; background: #13261a; }
html[data-theme="tiles"] .accounts-v2 .acc-total.negative { background: #2a1715; }
html[data-theme="tiles"] .accounts-v2 .acc-total-label { color: #9fd8ab; }
html[data-theme="tiles"] .accounts-v2 .acc-total.negative .acc-total-label { color: #f0a39d; }
html[data-theme="tiles"] .accounts-v2 .acc-total-amount { justify-self: auto; min-width: 0; max-width: 100%; min-height: 0; height: auto; padding: 0; border-radius: 0; background: none; color: var(--green); font-size: 19px; }
html[data-theme="tiles"] .accounts-v2 .acc-total.negative .acc-total-amount { background: none; color: var(--red); }

/* Groups: the title and the group's total. */
.accounts-v2 .section-band.account-band { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; min-height: 32px; margin: 0; padding: 0 0 6px; border: 0; background: transparent; color: var(--secondary); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.accounts-v2 .account-band-total { letter-spacing: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
html[data-theme="quick"] .accounts-v2 .section-band.account-band { padding: 0 10px 6px; }

/* Rows: icon, name, the amount on the right. The swipe slides the row over its buttons. */
.accounts-v2 .account-list { display: block; margin: 0; padding: 0; border: 0; }
.accounts-v2 .account-list > .account-item:not(.account-editing) { display: block; position: relative; overflow: hidden; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.accounts-v2 .account-list > .account-item > .account-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 12px;
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  color: var(--white);
  text-align: left;
  touch-action: pan-y;
  transition: transform .2s ease;
}
.accounts-v2 .account-row.swiping { transition: none; }
.accounts-v2 .account-row::after { content: ""; position: absolute; left: 44px; right: 0; bottom: 0; height: 1px; background: var(--hairline); }
.accounts-v2 .account-list > .account-item:last-child > .account-row::after { display: none; }
.accounts-v2 .account-list > .account-item > .account-row > .icon-disc { flex: none; align-self: center; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 16px; background: var(--surface); color: #e5e5ea; overflow: hidden; }
.accounts-v2 .account-list > .account-item > .account-row > .icon-disc :is(svg, img) { width: 18px; height: 18px; }
.accounts-v2 .account-list > .account-item > .account-row > .icon-disc img { width: 100%; height: 100%; object-fit: cover; }
/* A very long amount moves under the name instead of squeezing it. */
.accounts-v2 .account-row > .row-main { flex: 1 1 8em; min-width: 0; }
/* A long name stays on one line, cut with «…»; the full name is in its tooltip. */
.accounts-v2 .account-row .row-title { display: block; overflow: hidden; margin: 0; font-size: 16px; font-weight: 400; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.accounts-v2 .account-row > .row-amount { flex: 0 1 auto; max-width: 100%; margin: 0 0 0 auto; font-size: 16px; font-weight: 600; line-height: 1.3; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.accounts-v2 .amount-hidden .account-row > .row-amount { color: var(--secondary); letter-spacing: .08em; }
.accounts-v2 .account-swipe-actions { z-index: 0; display: flex; }
.accounts-v2 .account-swipe-actions button { flex: 1 1 0; display: grid; place-items: center; min-width: 0; min-height: 44px; padding: 0; border: 0; border-radius: 0; background: #48484a; color: #fff; }
.accounts-v2 .account-swipe-actions button[data-action="account-settings"] { background: var(--accent); color: var(--on-accent); }
.accounts-v2 .account-swipe-actions .swipe-delete { background: var(--red); color: #fff; }
.accounts-v2 .account-swipe-actions svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

html[data-theme="quick"] .accounts-v2 .account-list { overflow: hidden; border-radius: var(--radius-block); background: var(--surface); }
html[data-theme="quick"] .accounts-v2 .account-list > .account-item > .account-row { padding: 0 12px; background: var(--surface); }
html[data-theme="quick"] .accounts-v2 .account-row::after { left: 56px; right: 12px; background: var(--surface-raised); }
html[data-theme="quick"] .accounts-v2 .account-list > .account-item > .account-row > .icon-disc { background: var(--surface-raised); }

html[data-theme="tiles"] .app-shell #main .accounts-v2 .account-list:not(:has(.account-editing)) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html[data-theme="tiles"] .app-shell #main .accounts-v2 .account-list > .account-item:not(.account-editing) { border-radius: 16px; background: var(--surface); }
html[data-theme="tiles"] .accounts-v2 .account-list > .account-item > .account-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: space-between;
  gap: 6px 8px;
  height: auto;
  min-height: 76px;
  padding: 10px 12px;
  background: var(--surface);
}
html[data-theme="tiles"] .accounts-v2 .account-row::after { display: none; }
html[data-theme="tiles"] .accounts-v2 .account-list > .account-item > .account-row > .icon-disc { width: 18px; height: 18px; border-radius: 4px; background: transparent; color: #aeaeb2; }
html[data-theme="tiles"] .accounts-v2 .account-row .row-title { font-size: 14px; color: #e5e5ea; }
html[data-theme="tiles"] .accounts-v2 .account-row > .row-amount { grid-column: 1 / -1; margin: 0; font-size: 17px; font-weight: 700; text-align: left; }

/* The narrowest phones: the quick switch and the tile totals keep every digit. */
@media (max-width: 360px) {
  html[data-theme="quick"] .app-shell > #header.accounts-header .account-switch button { min-width: 0; padding: 0 4px; font-size: 13px; }
  html[data-theme="quick"] .accounts-v2 .acc-net strong { font-size: 22px; }
  html[data-theme="tiles"] .accounts-v2 .acc-total { height: auto; min-height: 72px; padding: 10px 12px; }
  html[data-theme="tiles"] .accounts-v2 .acc-total-amount { font-size: 15px; white-space: normal; overflow-wrap: anywhere; }
}

/* ==== Stage 2: operation forms (#editor.op-v2), mockups approved 03.11.2026 ====
   The same controls as before, moved into rows by composeOperationV2() in app.js.
   «Изначальная тема» never gets .op-v2 and keeps the previous form. */
#editor.op-v2 {
  --op-pad: 16px;
  --chip: #141414;
  --key-h: clamp(52px, 7vh, 70px);
  background: var(--bg);
  color: var(--white);
  scroll-padding-top: 60px;
  scroll-padding-bottom: 120px;
}
#editor.op-v2 [hidden] { display: none !important; }
#editor.op-v2 #editor-form { min-height: 100%; display: flex; flex-direction: column; }
#editor.op-v2 #form-fields { flex: 1; display: flex; flex-direction: column; padding: 0; }
#editor.op-v2 #operation-workspace { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#editor.op-v2 [data-operation-panel] { margin: 0; padding: 0; }
#editor.op-v2 [data-operation-panel]:not([data-operation-panel="main"]) { padding: 12px var(--op-pad) 0; }
/* Detail fields look like fields: a filled surface, a label above, the accent in focus. */
#editor.op-v2 [data-operation-panel]:not([data-operation-panel="main"]) .field { display: block; margin: 0 0 10px; padding: 0; border: 0; }
#editor.op-v2 [data-operation-panel]:not([data-operation-panel="main"]) .field > span:first-child { display: block; margin: 0 0 6px; font-size: 13px; color: var(--secondary); }
#editor.op-v2 #operation-workspace [data-operation-panel]:not([data-operation-panel="main"]) :is(input:not([type="hidden"]), textarea, select) {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: var(--chip);
  color: var(--white);
  font-size: 16px;
}
#editor.op-v2 #operation-workspace [data-operation-panel]:not([data-operation-panel="main"]) textarea { min-height: 120px; resize: vertical; }
#editor.op-v2 #operation-workspace [data-operation-panel]:not([data-operation-panel="main"]) :is(input, textarea, select):focus { outline: none; border-color: var(--accent); }
#editor.op-v2 .form-error { padding-inline: var(--op-pad); }
#editor.op-v2 :is(button, input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Header: «Отмена» · kind menu ▾ · ⟳. «Сохранить» lives at the calculator. */
#editor.op-v2 .dialog-head {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  min-height: 52px;
  padding: 4px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg);
  backdrop-filter: none;
}
#editor.op-v2 #cancel { justify-self: start; min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--white); font-size: 17px; font-weight: 400; }
#editor.op-v2 #editor-title { justify-self: center; min-width: 0; margin: 0; font-size: 17px; font-weight: 600; line-height: 1.25; text-align: center; overflow-wrap: anywhere; }
/* The native menu covers its visible name, so the chevron sits right after the text. */
#editor.op-v2 .operation-kind-label { position: relative; display: inline-flex; align-items: center; max-width: 100%; min-width: 0; min-height: 44px; vertical-align: middle; }
#editor.op-v2 .op-kind-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 600; pointer-events: none; }
#editor.op-v2 .operation-kind-label::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin: 0 4px 4px 8px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  pointer-events: none;
}
#editor.op-v2 .operation-kind-label:has(select:disabled)::after { display: none; }
#editor.op-v2 #editor-title .operation-kind-label .select-control { position: absolute; inset: 0; display: block; }
#editor.op-v2 #editor-title .operation-kind-label select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
#editor.op-v2 #editor-title .select-value { display: none; }
/* One header row for every kind, the opening balance included; the old fixed menu widths do not apply. */
#editor.op-v2.opening-entry .dialog-head { grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px; }
#editor.op-v2.opening-entry #cancel { grid-column: 1; grid-row: 1; }
#editor.op-v2.opening-entry #editor-title { grid-column: 2; grid-row: 1; justify-self: center; max-width: 100%; }
#editor.op-v2.opening-entry .dialog-head > .data-refresh-toolbar { grid-column: 3; grid-row: 1; }
#editor.op-v2.quick-entry #editor-title #operation-kind { width: 100%; max-width: none; padding: 0; font-size: 17px; }
#editor.op-v2 .dialog-head > .data-refresh-toolbar { position: relative; justify-self: end; display: flex; min-height: 44px; margin: 0; padding: 0; gap: 0; border: 0; background: transparent; }
#editor.op-v2 .dialog-head .data-refresh-button { width: 44px; height: 44px; min-width: 44px; padding: 0; justify-content: center; border: 0; border-radius: 22px; background: transparent; color: #d1d1d6; }
#editor.op-v2 .dialog-head .data-refresh-button > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#editor.op-v2 .dialog-head .data-refresh-status:empty { display: none; }
#editor.op-v2 .dialog-head .data-refresh-status { position: absolute; top: 46px; right: 4px; width: max-content; max-width: min(70vw, 320px); padding: 5px 9px; border-radius: 8px; background: var(--surface-raised); color: var(--white); font-size: 12px; text-align: right; }

/* Rows: full width with hairlines in classic; quick and tiles group them below. */
#editor.op-v2 #operation-panel-main { display: flex; flex-direction: column; }
#editor.op-v2 .op-group { display: flex; flex-direction: column; }
#editor.op-v2 .op-amount-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 8px var(--op-pad) 10px;
  border-bottom: 1px solid var(--hairline);
}
#editor.op-v2 .op-amount-label { flex: none; padding-bottom: 9px; font-size: 15px; color: var(--secondary); white-space: nowrap; }
#editor.op-v2 .op-amount-row > .field { display: flex; align-items: center; justify-content: flex-end; flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; border: 0; }
#editor.op-v2 .op-amount-row > .field > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#editor.op-v2 #operation-workspace .op-amount-row input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--white);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#editor.op-v2 #operation-workspace .op-amount-row input::placeholder { color: var(--secondary); opacity: 1; }
#editor.op-v2 #operation-workspace .op-amount-row input:is(.calc-target, :focus) { outline: none; box-shadow: inset 0 -2px 0 var(--accent); }
#editor.op-v2 .field > .op-amount-currency { flex: none; margin: 0 0 0 6px; font-size: 26px; font-weight: 600; line-height: 1; color: var(--white); }
#editor.op-v2 .op-amount-row[data-kind="expense"] :is(input, .field > .op-amount-currency) { color: var(--red); }
#editor.op-v2 .op-amount-row[data-kind="income"] :is(input, .field > .op-amount-currency) { color: var(--green); }

/* Category row: own icon, name, budget hint and «Разделить». */
#editor.op-v2 #operation-category-amount {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 60px;
  padding: 0 12px 0 var(--op-pad);
  border-bottom: 1px solid var(--hairline);
}
#editor.op-v2 #operation-category-amount:not(:has(#category-field)),
#editor.op-v2 #operation-category-amount.has-splits,
#editor.op-v2 #operation-category-amount > :is(.operation-split-total-label, .operation-total-label) { display: none; }
#editor.op-v2 #category-field { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
#editor.op-v2 #category-field > .category-select-button,
#editor.op-v2 .split-row .category-select-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--white);
  font-size: 16px;
  text-align: left;
}
#editor.op-v2 .category-select-button > span:nth-child(2) { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#editor.op-v2 .operation-category-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--surface);
  color: #e5e5ea;
  overflow: hidden;
}
#editor.op-v2 .operation-category-icon :is(svg, img) { width: 18px; height: 18px; }
#editor.op-v2 .operation-category-icon img { width: 32px; height: 32px; object-fit: contain; }
#editor.op-v2 .category-chevron { display: none; }
#editor.op-v2 .op-budget-hint { margin: -6px 0 6px 44px; font-size: 13px; line-height: 1.3; color: var(--secondary); }
#editor.op-v2 .op-budget-hint.red { color: var(--red); }
#editor.op-v2 .transaction-category-tools { display: flex; align-items: center; min-height: 46px; padding: 0 var(--op-pad); border: 0; border-bottom: 1px solid var(--hairline); }
#editor.op-v2 .transaction-category-tools.op-split-start { flex: none; min-height: 0; padding: 0; border: 0; }
#editor.op-v2 .transaction-category-tools .inline-add[data-form-action="add-split"] {
  position: static;
  display: flex;
  align-items: center;
  gap: 12px;
  width: auto;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 16px;
}
#editor.op-v2 .transaction-category-tools .inline-add svg { width: 20px; height: 20px; margin: 0 6px; padding: 0; border: 0; stroke-width: 2; }
#editor.op-v2 .transaction-category-tools .inline-add span { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
#editor.op-v2 .transaction-category-tools.op-split-start .inline-add[data-form-action="add-split"] {
  gap: 6px;
  height: 44px;
  min-height: 44px;
  padding: 0 14px 0 10px;
  border-radius: 22px;
  background: var(--chip);
  font-size: 14px;
}
#editor.op-v2 .transaction-category-tools.op-split-start .inline-add svg { width: 17px; height: 17px; margin: 0; }
#editor.op-v2 #split-summary,
#editor.op-v2 #operation-amount-help { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#editor.op-v2 #category-suggestion:empty { display: none; }
#editor.op-v2 #category-suggestion { padding: 4px var(--op-pad); }
#editor.op-v2 .lifecycle-create, #editor.op-v2 .segmented { display: none; }

/* Parts: category · amount · ×; the calculator writes into the outlined one. */
#editor.op-v2 .split-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 34%) 44px;
  align-items: center;
  gap: 4px 8px;
  min-height: 56px;
  margin: 0;
  padding: 4px 4px 4px var(--op-pad);
  border: 0;
  border-bottom: 1px solid var(--hairline);
}
#editor.op-v2 #operation-workspace .split-row > input {
  min-height: 44px;
  padding: 0 10px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--chip);
  color: var(--white);
  font-size: 17px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#editor.op-v2 .op-category-group[data-kind="expense"] .split-row > input,
#editor.op-v2 #operation-workspace .split-row > input { color: var(--red); }
#editor.quick-entry.op-v2:has(.op-amount-row[data-kind="income"]) #operation-workspace .split-row > input { color: var(--green); }
#editor.op-v2 #operation-workspace .split-row > input:is(.calc-target, :focus) { outline: none; border-color: var(--accent); }
#editor.op-v2 .split-row > button[data-form-action="remove-split"] { width: 44px; min-width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--secondary); font-size: 22px; }
#editor.op-v2 .split-row > .op-budget-hint { grid-column: 1 / -1; margin: 0 0 4px 44px; }

/* Accounts: icon, small role caption, name. */
#editor.op-v2 #operation-workspace .operation-account {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  grid-auto-rows: auto;
  column-gap: 12px;
  align-items: center;
  min-height: 58px;
  margin: 0;
  padding: 4px 12px 4px var(--op-pad);
  border: 0;
  border-bottom: 1px solid var(--hairline);
}
#editor.op-v2 .operation-account > .operation-account-icon {
  grid-row: 1 / span 2;
  width: 32px;
  height: 32px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--surface);
  color: #e5e5ea;
  overflow: hidden;
}
#editor.op-v2 .operation-account > .operation-account-icon :is(svg, img) { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
#editor.op-v2 .operation-account > .operation-account-icon img { width: 32px; height: 32px; object-fit: contain; border-radius: 16px; }
#editor.op-v2 #operation-workspace .operation-account > span:not(.select-control):not(.operation-account-icon) {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  grid-column: 2;
  align-self: end;
  margin: 0 0 -8px;
  font-size: 12px;
  line-height: 1.2;
  color: var(--secondary);
  white-space: nowrap;
  pointer-events: none;
}
#editor.op-v2 .operation-account > .operation-account-icon { grid-column: 1; }
#editor.op-v2 .operation-account > :is(.select-control, select) { grid-column: 2; position: relative; display: block; min-width: 0; }
#editor.op-v2 #operation-workspace .operation-account select {
  width: 100%;
  min-height: 44px;
  padding: 0 22px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--white);
  font-size: 16px;
  text-overflow: ellipsis;
  appearance: none;
  -webkit-appearance: none;
}
#editor.op-v2 .operation-account .select-value { display: none; }
#editor.op-v2 :is(.operation-account, .op-choice-field) .select-control::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.8px solid #636366;
  border-bottom: 1.8px solid #636366;
  transform: translateY(-50%) rotate(-45deg);
  pointer-events: none;
}
#editor.op-v2 .op-swap-row { position: relative; height: 0; z-index: 2; }
#editor.op-v2 .op-swap {
  position: absolute;
  right: 48px;
  top: -22px;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surface-raised);
  border-radius: 22px;
  background: var(--bg);
  color: var(--accent);
}
#editor.op-v2 .op-swap svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* «Подпись · значение» rows and amount fields the calculator fills. */
#editor.op-v2 #operation-workspace :is(.op-choice-field, .op-money-field, .op-input-field) {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin: 0;
  padding: 5px 12px 5px var(--op-pad);
  border: 0;
  border-bottom: 1px solid var(--hairline);
}
#editor.op-v2 #operation-workspace :is(.op-choice-field, .op-money-field, .op-input-field) > span:first-child {
  position: static;
  width: auto;
  height: auto;
  clip-path: none;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 58%;
  font-size: 15px;
  line-height: 1.3;
  color: var(--secondary);
}
#editor.op-v2 #operation-workspace .op-choice-field > span:first-child { flex: 0 1 auto; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
#editor.op-v2 #operation-workspace .op-money-field > span:first-child { overflow-wrap: normal; word-break: normal; hyphens: auto; }
#editor.op-v2 .op-choice-field > :is(.select-control, select) { flex: 1 1 auto; position: relative; min-width: 0; }
#editor.op-v2 #operation-workspace .op-choice-field select {
  width: 100%;
  min-height: 44px;
  padding: 0 20px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--white);
  font-size: 16px;
  text-align: right;
  text-align-last: right;
  text-overflow: ellipsis;
  appearance: none;
  -webkit-appearance: none;
}
#editor.op-v2 .op-choice-field .select-value { display: none; }
/* Plain inputs in rows: the schedule of a repeating operation (a number, an end date). */
#editor.op-v2 #operation-workspace .op-input-field input { flex: 1 1 auto; min-width: 0; min-height: 44px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--white); font-size: 16px; text-align: right; }
#editor.op-v2 #operation-workspace .op-money-field input {
  flex: 0 0 auto;
  width: min(42%, 150px);
  min-height: 44px;
  padding: 0 10px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--chip);
  color: var(--white);
  font-size: 17px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#editor.op-v2 #operation-workspace .op-money-field input:is(.calc-target, :focus) { outline: none; border-color: var(--accent); }
#editor.op-v2 #destination-amount[hidden] { display: none; }
#editor.op-v2 .op-fx-rate { margin: 0; padding: 0 12px 8px var(--op-pad); font-size: 13px; text-align: right; color: var(--secondary); border-bottom: 1px solid var(--hairline); }
#editor.op-v2 #destination-amount:has(.op-fx-rate:not([hidden])) .op-money-field { border-bottom: 0; }
#editor.op-v2 #purpose-help { margin: 4px var(--op-pad) 8px; font-size: 13px; }
#editor.op-v2 #deposit-funding-help:not(:empty) { margin: 6px var(--op-pad) 8px; font-size: 13px; color: var(--secondary); }

/* Date, time and status in one row; the row opens the existing date and time sheet. */
#editor.op-v2 .transaction-metadata { display: flex; flex-direction: column; }
#editor.op-v2 .op-date-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  margin: 0;
  padding: 0 12px 0 var(--op-pad);
  border-bottom: 1px solid var(--hairline);
}
#editor.op-v2 .op-date-row .operation-date-control { position: relative; display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
#editor.op-v2 .op-date-icon { flex: none; width: 32px; height: 32px; margin-right: 12px; display: flex; align-items: center; justify-content: center; border-radius: 16px; background: var(--surface); color: #e5e5ea; }
#editor.op-v2 .op-date-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
#editor.op-v2 .op-date-label { flex: 0 1 auto; min-width: 0; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--white); font-size: 16px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#editor.op-v2 .op-date-row :is(.operation-date-control, .op-date-row) > .field,
#editor.op-v2 .op-date-row > .field:has([name="date"]) { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip-path: inset(50%); border: 0; }
#editor.op-v2 .op-date-row.op-date-captioned { position: relative; min-height: 60px; }
#editor.op-v2 .op-date-row.op-date-captioned .operation-date-control > .field,
#editor.op-v2 .op-date-row.op-date-captioned > .field:has([name="date"]) {
  position: absolute;
  left: 44px;
  top: 2px;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip-path: none;
  pointer-events: none;
}
#editor.op-v2 .op-date-row.op-date-captioned > .field:has([name="date"]) { left: calc(var(--op-pad) + 44px); }
#editor.op-v2 .op-date-row.op-date-captioned .field:has([name="date"]) > span { position: static; display: block; width: auto; height: auto; margin: 0; overflow: visible; clip-path: none; font-size: 12px; line-height: 1.2; color: var(--secondary); white-space: nowrap; }
#editor.op-v2 .op-date-row.op-date-captioned [name="date"] { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); }
#editor.op-v2 .op-date-row.op-date-captioned .op-date-label { padding-top: 14px; }
#editor.op-v2 #operation-workspace .op-date-row .operation-time-toggle { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; min-height: 44px; padding: 0 0 0 6px; border: 0; background: transparent; color: var(--white); font-size: 16px; white-space: nowrap; }
#editor.op-v2 .op-date-row .operation-time-toggle::before { content: "· "; color: var(--secondary); }
#editor.op-v2 #operation-workspace .op-date-row.no-time .operation-time-toggle {
  flex: none;
  width: 44px;
  padding: 0;
  font-size: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 7v5l3 2'/%3E%3C/svg%3E") center / 20px no-repeat;
}
#editor.op-v2 .op-date-row.no-time .operation-time-toggle::before { content: none; }
#editor.op-v2 .op-date-row > .field:has([name="status"]) { position: relative; flex: none; display: flex; align-items: center; margin: 0 0 0 auto; padding: 0; border: 0; }
#editor.op-v2 .op-date-row > .field:has([name="status"]) > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#editor.op-v2 #operation-workspace .op-date-row [name="status"] {
  min-height: 44px;
  width: auto;
  padding: 0 12px 0 32px;
  border: 0;
  border-radius: 22px;
  background: var(--chip);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}
#editor.op-v2 .op-date-row.planned [name="status"] { color: #d1d1d6; }
#editor.op-v2 .op-date-row .select-value { display: none; }
#editor.op-v2 .op-date-row .operation-status-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  border: 0;
  border-radius: 0;
  color: var(--accent);
  transform: translateY(-50%);
  pointer-events: none;
}
#editor.op-v2 .op-date-row.planned .operation-status-icon { color: #d1d1d6; }
#editor.op-v2 .op-date-row .operation-status-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; }
#editor.op-v2 #operation-datetime-panel { padding: 8px var(--op-pad) 12px; border-bottom: 1px solid var(--hairline); }

/* Details: one row of labelled chips; filled ones carry a dot and a summary line. */
#editor.op-v2 .operation-refresh-row { display: contents; }
#editor.op-v2 #operation-workspace .operation-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 12px 8px 0;
  padding: 0;
  min-height: 0;
  border: 0;
}
#editor.op-v2 #operation-workspace .operation-tabs button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  height: 52px;
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--chip);
  color: #aeaeb2;
  font-size: 12px;
}
#editor.op-v2 #operation-workspace .operation-tabs button span { position: static; width: auto; height: auto; max-width: 100%; overflow: hidden; clip-path: none; text-overflow: ellipsis; white-space: nowrap; }
#editor.op-v2 #operation-workspace .operation-tabs svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
#editor.op-v2 #operation-workspace .operation-tabs button[aria-selected="true"] { color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); background: var(--chip); }
#editor.op-v2 #operation-workspace .operation-tabs button[data-filled] { color: var(--accent); }
#editor.op-v2 #operation-workspace .operation-tabs button[data-filled]::after { content: ""; position: absolute; top: 6px; right: 8px; width: 6px; height: 6px; border-radius: 3px; background: var(--accent); }
#editor.op-v2 .op-details-summary { margin: 6px var(--op-pad) 0; font-size: 13px; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#editor.op-v2 .op-details-summary::before { content: attr(data-text); }

/* Saved operation: «Копировать» · «История» · «Удалить». */
#editor.op-v2 #operation-workspace .operation-quick-actions { display: flex; gap: 6px; margin: 10px 12px 0; padding: 0; border: 0; }
#editor.op-v2 #operation-workspace .operation-quick-actions button {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--chip);
  color: var(--accent);
  font-size: 14px;
}
#editor.op-v2 #operation-workspace .operation-quick-actions button.red { color: var(--red); background: var(--chip); }
#editor.op-v2 #operation-workspace .operation-quick-actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
#editor.op-v2 .operation-extra { margin: 10px var(--op-pad) 0; }
#editor.op-v2 .op-row-button { margin: 10px 12px 0; min-height: 44px; border-radius: var(--radius-control); }

/* Explanations: short cards; longer hints behind «i». */
#editor.op-v2 .op-info-card { display: flex; gap: 10px; align-items: flex-start; margin: 10px 12px 0; padding: 10px 12px; border-radius: 12px; background: var(--chip); }
#editor.op-v2 .op-info-icon { flex: none; width: 18px; height: 18px; color: var(--secondary); }
#editor.op-v2 .op-info-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
#editor.op-v2 .op-info-text { display: grid; gap: 6px; min-width: 0; }
#editor.op-v2 .op-info-text .field-help { margin: 0; font-size: 14px; line-height: 1.35; color: #c7c7cc; }
#editor.op-v2 .op-hint { display: none; }
#editor.op-v2.op-hints-open .op-hint { display: block; margin: 6px var(--op-pad); font-size: 13px; line-height: 1.4; }
#editor.op-v2 .op-effects-card { margin: 10px 12px 0; padding: 8px 12px 10px; border-radius: 12px; background: var(--chip); }
#editor.op-v2 .op-effects-head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--secondary); }
#editor.op-v2 .op-hint-toggle { width: 44px; height: 44px; margin: -6px -10px -6px 0; padding: 0; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--secondary); }
#editor.op-v2 .op-hint-toggle[aria-expanded="true"] { color: var(--accent); }
#editor.op-v2 .op-hint-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; }
#editor.op-v2 .op-effect { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; font-size: 15px; color: #e5e5ea; }
#editor.op-v2 .op-effect > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#editor.op-v2 .op-effect > b { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
#editor.op-v2 .op-effect > b.red { color: var(--red); }
#editor.op-v2 .op-effect > b.green { color: var(--green); }
#editor.op-v2 .op-effect-note { margin: 4px 0 0; font-size: 13px; color: var(--secondary); }
#editor.op-v2 #lifecycle-preview { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#editor.op-v2 .op-categories-card { margin: 10px 12px 0; padding: 4px 12px 8px; border: 0; border-radius: 12px; background: var(--chip); }
#editor.op-v2 .op-categories-card > h3 { margin: 8px 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--secondary); }
#editor.op-v2 .op-categories-card [data-form-action="add-allocation"] { min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 15px; }
#editor.op-v2 .op-categories-card .lifecycle-allocation { margin: 6px 0; padding: 8px 0; border: 0; border-top: 1px solid var(--hairline); }
#editor.op-v2 .op-summary-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-height: 72px; margin: 0; padding: 8px var(--op-pad) 10px; border: 0; border-bottom: 1px solid var(--hairline); background: transparent; }
#editor.op-v2 .op-summary-row strong { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
#editor.op-v2 .transaction-effects { margin: 10px var(--op-pad) 0; }
#editor.op-v2 #form-fields > .note { margin: 10px var(--op-pad) 0; }

/* Income tax: one summary row; the existing fields open as a sheet. */
#editor.op-v2:not(.taxed-income) #tax-accrual { display: none; }
#editor.op-v2 #tax-accrual { margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--hairline); background: transparent; }
#editor.op-v2 #tax-accrual:not(.sheet-open) > :is(.op-tax-sheet-head, .tax-toggle, #tax-accrual-fields) { display: none; }
#editor.op-v2 .op-tax-summary {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto 10px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 6px 12px 6px var(--op-pad);
  border: 0;
  background: transparent;
  color: var(--white);
  text-align: left;
}
#editor.op-v2 .op-tax-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 16px; background: var(--surface); color: #e5e5ea; }
#editor.op-v2 .op-tax-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
#editor.op-v2 .op-tax-copy { display: grid; min-width: 0; font-size: 16px; }
#editor.op-v2 .op-tax-copy small { font-size: 13px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#editor.op-v2 .op-tax-amount { color: var(--red); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
#editor.op-v2 .op-tax-summary .category-chevron { display: block; color: #636366; }
#editor.op-v2 #tax-accrual.sheet-open {
  position: fixed;
  left: auto;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(100%, 590px);
  max-height: 84dvh;
  overflow: auto;
  padding: 0 0 max(16px, env(safe-area-inset-bottom));
  border: 0;
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .65);
}
#editor.op-v2.tax-sheet-expanded #operation-workspace::after { content: ""; position: fixed; inset: 0 0 0 auto; width: min(100%, 590px); z-index: 29; background: rgba(0, 0, 0, .55); }
#editor.op-v2 #tax-accrual.sheet-open > .op-tax-summary { display: none; }
#editor.op-v2 #tax-accrual.sheet-open > .op-tax-sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 4px 8px 4px var(--op-pad); background: var(--surface); font-size: 17px; font-weight: 600; }
#editor.op-v2 #tax-accrual.sheet-open > .op-tax-sheet-head .text-button { min-height: 44px; padding: 0 8px; color: var(--accent); font-size: 17px; font-weight: 600; }
#editor.op-v2 #tax-accrual.sheet-open > .tax-toggle { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 var(--op-pad); }
#editor.op-v2 #tax-accrual.sheet-open > #tax-accrual-fields:not([hidden]) { display: block; padding: 0 var(--op-pad); }

/* Bottom dock: «Сохранить» above the calculator, both always in reach. */
#editor.op-v2 .operation-dock { position: sticky; bottom: 0; z-index: 5; flex: 1 0 auto; display: flex; flex-direction: column; justify-content: flex-end; margin-top: auto; padding-top: 8px; background: var(--bg); }
#editor.op-v2 .operation-dock > #form-error { margin: 0; padding: 0 var(--op-pad) 8px; font-size: 14px; line-height: 1.35; color: var(--red); }
#editor.op-v2 .operation-dock > #form-error:empty { display: none; }
#editor.op-v2 .operation-savebar { padding: 0 8px 8px; }
#editor.op-v2 .operation-savebar:not(.on-keys) { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
#editor.op-v2 .operation-savebar:not(:has(#save:not([hidden]))) { display: none; }
#editor.op-v2 .operation-savebar #save {
  display: block;
  width: 100%;
  max-width: none;
  height: 50px;
  min-height: 50px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 18px;
  font-weight: 700;
}
#editor.op-v2 .operation-savebar #save:disabled { opacity: .55; }
#editor.op-v2 #operation-keypad { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: flex-end; max-height: 336px; margin: 0; padding: 0 0 max(10px, env(safe-area-inset-bottom)); }
#editor.op-v2 #operation-calculation { margin: 0; padding: 0 var(--op-pad) 6px; font-size: 13px; text-align: right; color: var(--secondary); }
#editor.op-v2 .operation-keypad-grid { flex: 1 1 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(52px, 1fr)); gap: 1px; padding: 0; border: 0; background: var(--bg); }
#editor.op-v2 .operation-keypad-grid button { min-width: 0; height: auto; min-height: 52px; padding: 0; border: 0; border-radius: 0; background: var(--key-digit); color: #fff; font-size: 27px; font-weight: 400; }
#editor.op-v2 .operation-keypad-grid .operator { background: var(--op-key); color: var(--op-key-text); font-size: 30px; }
#editor.op-v2 .operation-keypad-grid :is(.utility, .currency) { background: var(--key-function); color: #fff; }
#editor.op-v2 .operation-keypad-grid .currency svg { width: 26px; height: 26px; margin: auto; fill: none; stroke: currentColor; stroke-width: 1.6; }
#editor.op-v2 .operation-keypad-grid .backspace { grid-column: span 2; }
#editor.op-v2.datetime-expanded #operation-keypad { display: none; }

/* Category picker: frequent first, then the directory. */
#editor.op-v2 #category-picker { padding: 0 0 12px; }
#editor.op-v2 .category-picker-head { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 4px 0 8px; }
#editor.op-v2 .category-picker-head [data-form-action="category-picker-back"] { min-height: 44px; padding: 0 8px; color: var(--accent); font-size: 16px; }
#editor.op-v2 .category-section-title { margin: 10px var(--op-pad) 2px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--secondary); }
#editor.op-v2 #category-picker .category-grid { padding-inline: 8px; }
/* The frequent row keeps the directory's grid; its own class keeps the directory grid unique. */
#editor.op-v2 #category-picker .category-frequent-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 6px; padding: 4px 8px 12px; }
@media (min-width: 700px) { #editor.op-v2 #category-picker .category-frequent-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
#editor.op-v2 #category-picker .category-search { display: block; margin: 0 var(--op-pad) 8px; }

/* Quick: rounded blocks, rounded keys with gaps. */
html[data-theme="quick"] #editor.op-v2 { --chip: #2c2c2e; }
html[data-theme="quick"] #editor.op-v2 .op-group { margin: 10px 12px 0; border-radius: var(--radius-block); background: var(--surface); overflow: hidden; }
html[data-theme="quick"] #editor.op-v2 .op-group > *,
html[data-theme="quick"] #editor.op-v2 .op-group #operation-category-amount,
html[data-theme="quick"] #editor.op-v2 .op-group .split-row { border-bottom-color: var(--surface-raised); }
html[data-theme="quick"] #editor.op-v2 .op-group > :last-child { border-bottom: 0; }
html[data-theme="quick"] #editor.op-v2 :is(.operation-account > .operation-account-icon, .operation-category-icon, .op-date-icon, .op-tax-icon) { background: var(--surface-raised); }
html[data-theme="quick"] #editor.op-v2 :is(.op-info-card, .op-effects-card, .op-categories-card) { background: var(--surface); border-radius: var(--radius-block); }
html[data-theme="quick"] #editor.op-v2 .op-swap { background: var(--surface); border-color: var(--bg); }
html[data-theme="quick"] #editor.op-v2 .operation-savebar #save { border-radius: var(--radius-block); }
html[data-theme="quick"] #editor.op-v2 .operation-keypad-grid { gap: 6px; padding: 0 8px; }
html[data-theme="quick"] #editor.op-v2 .operation-keypad-grid button { border-radius: 12px; }

/* Tiles: every row its own card; ✓ on the calculator saves. */
html[data-theme="tiles"] #editor.op-v2 { --chip: #2c2c2e; }
html[data-theme="tiles"] #editor.op-v2 .op-group { margin: 8px 12px 0; gap: 8px; }
html[data-theme="tiles"] #editor.op-v2 .op-group > * { border-radius: var(--radius-block); background: var(--surface); border-bottom: 0; overflow: hidden; }
html[data-theme="tiles"] #editor.op-v2 .op-group > .op-swap-row { overflow: visible; background: transparent; }
html[data-theme="tiles"] #editor.op-v2 .op-group #operation-category-amount,
html[data-theme="tiles"] #editor.op-v2 .op-group .split-row { border-bottom-color: var(--surface-raised); }
html[data-theme="tiles"] #editor.op-v2 .op-group > :is(#category-suggestion:empty, #splits:empty, #split-summary) { display: none; }
html[data-theme="tiles"] #editor.op-v2 .op-group > .transaction-metadata { overflow: hidden; }
html[data-theme="tiles"] #editor.op-v2 :is(.operation-account > .operation-account-icon, .operation-category-icon, .op-date-icon, .op-tax-icon) { border-radius: 10px; background: var(--surface-raised); }
html[data-theme="tiles"] #editor.op-v2 :is(.op-info-card, .op-effects-card, .op-categories-card) { background: var(--surface); border-radius: var(--radius-block); }
html[data-theme="tiles"] #editor.op-v2 .op-swap { background: var(--surface); border-color: var(--bg); }
html[data-theme="tiles"] #editor.op-v2 .operation-keypad-grid { gap: 6px; padding: 0 8px; }
html[data-theme="tiles"] #editor.op-v2 .operation-keypad-grid button { border-radius: 14px; }
html[data-theme="tiles"] #editor.op-v2 .operation-dock { position: sticky; }
html[data-theme="tiles"] #editor.op-v2 .operation-savebar #save { border-radius: var(--radius-block); }
html[data-theme="tiles"] #editor.op-v2 .operation-keypad-grid:has(> #save) .backspace { grid-column: span 1; }
html[data-theme="tiles"] #editor.op-v2 .operation-keypad-grid > #save {
  /* Fills its cell also in compact forms, where the old header pushed «Сохранить» to the end. */
  justify-self: stretch;
  margin: 0;
  min-width: 0;
  width: auto;
  max-width: none;
  height: auto;
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  font-size: 0;
  color: var(--on-accent);
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 28px no-repeat;
}

@media (max-width: 360px) {
  #editor.op-v2 { --op-pad: 12px; }
  #editor.op-v2 #cancel { padding: 0 6px 0 8px; font-size: 16px; }
  #editor.op-v2 .op-kind-text { font-size: 16px; }
  #editor.op-v2 .operation-kind-label::after { margin-left: 6px; }
  /* The status keeps its menu and icon; the date gets the room. */
  #editor.op-v2 #operation-workspace .op-date-row [name="status"] { width: 44px; padding: 0; color: transparent; }
  #editor.op-v2 .op-date-row .operation-status-icon { left: 13px; }
  #editor.op-v2 #operation-workspace .op-amount-row input { font-size: 30px; }
  #editor.op-v2 #operation-workspace .operation-tabs { gap: 4px; margin-inline: 8px; }
}

/* ==== Stage 3: windows of accounts, budgets and planning (#editor.win-v2) ====
   The same fields and buttons in the look of the stage 2 forms: «Отмена» or
   «Назад» · title · ⟳ on top, rows «подпись · значение», «Сохранить» at the
   bottom. «Изначальная тема» never gets .win-v2. */
#editor.win-v2 { --op-pad: 16px; --chip: #141414; background: var(--bg); color: var(--white); scroll-padding-top: 60px; scroll-padding-bottom: 96px; }
#editor.win-v2 [hidden] { display: none !important; }
#editor.win-v2 #editor-form { min-height: 100%; display: flex; flex-direction: column; }
#editor.win-v2 #form-fields { flex: 1; display: flex; flex-direction: column; padding: 4px var(--op-pad) 0; }
#editor.win-v2 #account-settings-fields { flex: 1; display: flex; flex-direction: column; }
#editor.win-v2 :is(button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#editor.win-v2 .dialog-head {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 4px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg);
  backdrop-filter: none;
}
#editor.win-v2 #cancel { justify-self: start; min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--white); font-size: 17px; font-weight: 400; }
#editor.win-v2 #editor-title { justify-self: center; min-width: 0; max-width: 100%; margin: 0; overflow: hidden; font-size: 17px; font-weight: 600; line-height: 1.25; text-align: center; white-space: nowrap; text-overflow: ellipsis; }
#editor.win-v2 .dialog-head > .data-refresh-toolbar { position: relative; justify-self: end; display: flex; min-height: 44px; margin: 0; padding: 0; gap: 0; border: 0; background: transparent; }
#editor.win-v2 .dialog-head .data-refresh-button { width: 44px; height: 44px; min-width: 44px; padding: 0; justify-content: center; border: 0; border-radius: 22px; background: transparent; color: #d1d1d6; }
#editor.win-v2 .dialog-head .data-refresh-button > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#editor.win-v2 .dialog-head .data-refresh-status:empty { display: none; }
#editor.win-v2 .dialog-head .data-refresh-status { position: absolute; top: 46px; right: 4px; width: max-content; max-width: min(70vw, 320px); padding: 5px 9px; border-radius: 8px; background: var(--surface-raised); color: var(--white); font-size: 13px; }

/* Rows «подпись · значение»; long texts stack. */
#editor.win-v2 #form-fields label.field { display: flex; align-items: center; gap: 12px; min-height: 52px; margin: 0; padding: 4px 0; border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; background: transparent; }
#editor.win-v2 #form-fields label.field > span:first-child { position: static; flex: 0 0 auto; max-width: 48%; margin: 0; font-size: 15px; line-height: 1.3; color: var(--secondary); overflow-wrap: normal; word-break: normal; hyphens: manual; }
#editor.win-v2 #form-fields label.field > :is(input, select, textarea, .select-control) { flex: 1 1 auto; min-width: 0; }
#editor.win-v2 #form-fields label.field :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select) {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--white);
  font-size: 16px;
  text-align: right;
  text-align-last: right;
}
#editor.win-v2 #form-fields label.field .select-control { position: relative; display: block; }
#editor.win-v2 #form-fields label.field .select-value { display: none; }
#editor.win-v2 #form-fields label.field select { padding-right: 18px; appearance: none; -webkit-appearance: none; }
#editor.win-v2 #form-fields label.field .select-control::after { content: "›"; position: absolute; right: 0; top: 50%; transform: translateY(-52%); color: var(--secondary); font-size: 20px; pointer-events: none; }
#editor.win-v2 #form-fields label.field:has(textarea) { display: block; padding: 10px 0; }
#editor.win-v2 #form-fields label.field:has(textarea) > span:first-child { display: block; max-width: none; margin-bottom: 6px; font-size: 13px; }
#editor.win-v2 #form-fields label.field textarea { width: 100%; min-height: 96px; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-control); background: var(--chip); color: var(--white); font-size: 16px; resize: vertical; }
#editor.win-v2 #form-fields :is(input, select, textarea):focus { outline: none; }
#editor.win-v2 #form-fields label.field:focus-within { border-bottom-color: var(--accent); }
#editor.win-v2 #form-fields label.field input[type="checkbox"] { flex: none; width: 24px; height: 24px; margin-left: auto; accent-color: var(--accent); }
#editor.win-v2 #form-fields .field-help, #editor.win-v2 #form-fields > .note, #editor.win-v2 #account-settings-fields > .note { margin: 8px 0; font-size: 13px; line-height: 1.4; color: var(--secondary); }
#editor.win-v2 #form-fields details > summary { display: flex; align-items: center; min-height: 48px; padding: 0; border-bottom: 1px solid var(--hairline); color: var(--white); font-size: 16px; list-style: none; cursor: pointer; }
#editor.win-v2 #form-fields details > summary::-webkit-details-marker { display: none; }
#editor.win-v2 #form-fields details > summary::after { content: "›"; margin-left: auto; color: var(--secondary); font-size: 20px; transition: transform .15s ease; }
#editor.win-v2 #form-fields details[open] > summary::after { transform: rotate(90deg); }
#editor.win-v2 #form-fields fieldset { margin: 0; padding: 8px 0 10px; border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; }
#editor.win-v2 #form-fields fieldset > legend { padding: 8px 0 4px; font-size: 13px; color: var(--secondary); }
/* Facts as rows: «Текущий остаток · 48 320,15 ₽». */
#editor.win-v2 #form-fields .detail-grid { display: block; margin: 0; }
#editor.win-v2 #form-fields .detail-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; min-height: 48px; margin: 0; padding: 4px 0; border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; background: transparent; }
#editor.win-v2 #form-fields .detail-box > span { margin: 0; font-size: 15px; color: var(--secondary); }
/* A long amount takes its own line rather than hide digits. */
#editor.win-v2 #form-fields .detail-box > strong { flex: none; max-width: 100%; margin: 0 0 0 auto; font-size: 16px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
#editor.win-v2 #form-fields .form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; padding: 0; border: 0; }
#editor.win-v2 #form-fields .form-actions > button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--surface); color: var(--white); font-size: 15px; font-weight: 500; }
#editor.win-v2 #form-fields .form-actions > button:is(.danger, .red) { color: var(--red); }

/* «Сохранить» at the bottom; the bar hides when the window saves nothing. */
#editor.win-v2 .win-savebar { position: sticky; bottom: 0; z-index: 5; margin: auto 0 0; padding: 8px 8px max(12px, env(safe-area-inset-bottom)); background: var(--bg); }
#editor.win-v2 .win-savebar > #form-error { margin: 0 8px 8px; font-size: 14px; line-height: 1.35; color: var(--red); }
#editor.win-v2 .win-savebar > #form-error:empty { display: none; }
#editor.win-v2 .win-savebar:not(:has(> #save:not([hidden]))):has(> #form-error:empty) { display: none; }
#editor.win-v2 .win-savebar > #save { display: block; width: 100%; max-width: none; height: 50px; min-height: 50px; margin: 0; padding: 0; border: 0; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-size: 18px; font-weight: 700; }
#editor.win-v2 .win-savebar > #save:disabled { opacity: .55; }

/* The journal: the balance with ✎, search and «+»; the operation rows as before. */
#editor.win-v2 .account-register-actions { display: flex; align-items: center; gap: 2px; min-height: 60px; margin: 0; padding: 0; border-bottom: 1px solid var(--hairline); }
#editor.win-v2 .register-current { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: 26px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
#editor.win-v2 .account-register-actions .compact-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 22px; background: transparent; color: var(--accent); }
#editor.win-v2 .account-register-actions .compact-icon svg { width: 22px; height: 22px; }
#editor.win-v2 #account-search-panel { padding: 8px 0 0; }

html[data-theme="quick"] #editor.win-v2 #form-fields label.field,
html[data-theme="quick"] #editor.win-v2 #form-fields .detail-box,
html[data-theme="tiles"] #editor.win-v2 #form-fields label.field,
html[data-theme="tiles"] #editor.win-v2 #form-fields .detail-box { margin: 0 0 6px; padding: 4px 14px; border: 0; border-radius: var(--radius-block); background: var(--surface); }
html[data-theme="tiles"] #editor.win-v2 #form-fields :is(label.field, .detail-box) { margin-bottom: 8px; }
html[data-theme="quick"] #editor.win-v2 #form-fields label.field:has(textarea),
html[data-theme="tiles"] #editor.win-v2 #form-fields label.field:has(textarea) { padding: 10px 14px; }
html[data-theme="quick"] #editor.win-v2 .win-savebar > #save,
html[data-theme="tiles"] #editor.win-v2 .win-savebar > #save { border-radius: var(--radius-block); }

/* ==== Stage 3: «Бюджет» (boards «A · Бюджет», «B · Бюджет», «C · Бюджет», 02.11) ====
   Header: ‹ month › · «i» · «+»; ⟳ stays in the corner. The month opens the browser's
   month picker: the input lies over its name. */
.app-shell > #header.budget-header { gap: 0; }
.app-shell > #header.budget-header .month-step { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 30px; line-height: 1; }
.app-shell > #header.budget-header .month-label { position: relative; flex: 0 1 auto; min-width: 0; display: flex; align-items: center; min-height: 44px; margin: 0; padding: 0 4px; }
.app-shell > #header.budget-header .month-label > span { overflow: hidden; font-size: 18px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.app-shell > #header.budget-header .month-label > .month-compact { display: none; }
@media (max-width: 360px) {
  .app-shell > #header.budget-header .month-label > .month-full { display: none; }
  .app-shell > #header.budget-header .month-label > .month-compact { display: inline; font-size: 16px; }
}
.app-shell > #header.budget-header .month-label > .month-picker { position: absolute; inset: 0; width: 100%; max-width: none; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; font-size: 16px; cursor: pointer; }
.app-shell > #header.budget-header .budget-help-toggle { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin-left: auto; padding: 0; border: 0; border-radius: 22px; background: transparent; color: var(--accent); }
.app-shell > #header.budget-header .budget-help-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-shell > #header.budget-header .budget-help-toggle[aria-expanded="true"] { background: var(--surface); }
#main .budget-help { margin: 4px 0 8px; }

/* The month in figures: hidden in «Классика» (its section heads carry the totals). */
.budget-month-summary { display: none; }
html[data-theme="quick"] .budget-month-summary { display: grid; gap: 8px; margin: 8px 0 4px; padding: 0; border: 0; border-radius: 0; background: none; }
/* The cards already carry the totals of the main currency: its section heads keep only the title. */
:is(html[data-theme="quick"], html[data-theme="tiles"]) .budget-section.main-currency .budget-section-head > span:last-child { display: none; }
html[data-theme="quick"] .budget-sum-ring { display: none; }
html[data-theme="quick"] .budget-sum { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 6px 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); }
html[data-theme="quick"] .budget-sum-name { font-size: 15px; font-weight: 600; }
html[data-theme="quick"] .budget-sum-figures { font-size: 14px; color: var(--secondary); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
html[data-theme="quick"] .budget-sum-figures b { color: var(--white); font-size: 17px; }
html[data-theme="quick"] .budget-sum-bar { grid-column: 1 / -1; position: relative; height: 8px; overflow: hidden; border-radius: 4px; background: var(--surface-raised); }
html[data-theme="quick"] .budget-sum-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--progress); border-radius: 4px; background: var(--red); }
html[data-theme="quick"] .budget-sum.income .budget-sum-bar::after { background: var(--green); }
html[data-theme="quick"] .budget-sum-note { grid-column: 1 / -1; font-size: 13px; color: var(--secondary); }
html[data-theme="quick"] .budget-sum.over .budget-sum-note { color: var(--red); }

html[data-theme="tiles"] .budget-month-summary { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 6px 14px; margin: 8px 0 4px; padding: 14px; border-radius: 16px; background: var(--surface); }
html[data-theme="tiles"] .budget-sum-ring { grid-row: 1 / span 2; display: grid; place-content: center; justify-items: center; width: 112px; height: 112px; border-radius: 50%; background: radial-gradient(closest-side, var(--surface) 78%, transparent 79%), conic-gradient(var(--red) var(--progress), var(--surface-raised) 0); }
html[data-theme="tiles"] .budget-sum-ring strong { font-size: 24px; font-weight: 700; }
html[data-theme="tiles"] .budget-sum-ring span { font-size: 12px; color: var(--secondary); }
html[data-theme="tiles"] .budget-month-summary:not(:has(.budget-sum-ring)) { grid-template-columns: minmax(0, 1fr); }
html[data-theme="tiles"] .budget-sum { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
html[data-theme="tiles"] .budget-sum-name { font-size: 13px; color: var(--secondary); }
html[data-theme="tiles"] .budget-sum-figures { font-size: 14px; color: var(--secondary); font-variant-numeric: tabular-nums; }
html[data-theme="tiles"] .budget-sum-figures b { color: var(--white); font-size: 18px; }
html[data-theme="tiles"] .budget-sum-bar { display: none; }
html[data-theme="tiles"] .budget-sum-note { font-size: 13px; color: var(--secondary); }
html[data-theme="tiles"] .budget-sum.over .budget-sum-note { color: var(--red); }

/* «Быстрый ввод»: categories as rows with a bar; «Плитки»: cards in three columns. */
html[data-theme="quick"] .app-shell #main .mp-budget-grid { display: block; padding: 0; overflow: hidden; border-radius: 14px; background: var(--surface); }
html[data-theme="quick"] .app-shell #main .mp-budget-tile {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  grid-template-areas: "icon name actual target" "icon bar bar bar";
  align-items: center;
  gap: 4px 6px;
  width: 100%;
  min-height: 56px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--surface-raised);
  text-align: left;
}
html[data-theme="quick"] .app-shell #main .mp-budget-tile:last-child { border-bottom: 0; }
html[data-theme="quick"] .app-shell #main .mp-budget-tile .budget-ring { grid-area: icon; width: 36px; height: 36px; padding: 0; background: var(--surface-raised); }
html[data-theme="quick"] .app-shell #main .mp-budget-tile .budget-ring-icon { width: 32px; height: 32px; }
html[data-theme="quick"] .app-shell #main .mp-budget-tile .budget-tile-name { grid-area: name; overflow: hidden; font-size: 15px; text-align: left; white-space: nowrap; text-overflow: ellipsis; }
html[data-theme="quick"] .app-shell #main .mp-budget-tile .budget-tile-actual { grid-area: actual; font-size: 15px; font-weight: 700; }
html[data-theme="quick"] .app-shell #main .mp-budget-tile .budget-tile-target { grid-area: target; font-size: 13px; color: var(--secondary); }
html[data-theme="quick"] .app-shell #main .mp-budget-tile::after { content: ""; grid-area: bar; height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--red) var(--progress), var(--surface-raised) 0); }
html[data-theme="quick"] .app-shell #main .mp-budget-grid.income .mp-budget-tile::after { background: linear-gradient(to right, var(--green) var(--progress), var(--surface-raised) 0); }

html[data-theme="tiles"] .app-shell #main .mp-budget-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px 0; }
html[data-theme="tiles"] .app-shell #main .mp-budget-tile { justify-content: flex-start; min-height: 112px; padding: 10px 6px; border-radius: 16px; background: var(--surface); }
html[data-theme="tiles"] .app-shell #main .mp-budget-tile .budget-ring { width: 46px; height: 46px; }
html[data-theme="tiles"] .app-shell #main .mp-budget-tile .budget-ring-icon { width: 40px; height: 40px; }

/* The calculator of a budget amount: the keys of the stage 2 forms under «Сохранить». */
#editor.win-v2 #operation-keypad { margin: 8px -8px 0; padding: 0; }
#editor.win-v2 #operation-calculation { margin: 0; padding: 0 16px 6px; font-size: 13px; text-align: right; color: var(--secondary); }
#editor.win-v2 .operation-keypad-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(52px, 1fr)); gap: 1px; padding: 0; border: 0; background: var(--bg); }
#editor.win-v2 .operation-keypad-grid button { min-width: 0; height: auto; min-height: 52px; padding: 0; border: 0; border-radius: 0; background: var(--key-digit); color: #fff; font-size: 27px; font-weight: 400; }
#editor.win-v2 .operation-keypad-grid .operator { background: var(--op-key); color: var(--op-key-text); font-size: 30px; }
#editor.win-v2 .operation-keypad-grid :is(.utility, .currency) { background: var(--key-function); color: #fff; }
#editor.win-v2 .operation-keypad-grid .currency svg { width: 26px; height: 26px; margin: auto; fill: none; stroke: currentColor; stroke-width: 1.6; }
#editor.win-v2 .operation-keypad-grid .backspace { grid-column: span 2; }
:is(html[data-theme="quick"], html[data-theme="tiles"]) #editor.win-v2 .operation-keypad-grid { gap: 6px; padding: 0 8px; }
html[data-theme="quick"] #editor.win-v2 .operation-keypad-grid button { border-radius: 12px; }
html[data-theme="tiles"] #editor.win-v2 .operation-keypad-grid button { border-radius: 14px; }

/* ==== Stage 3: «Планирование» — sections and rows in the style of «Счета» ==== */
.planning-v2 .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin: 8px 0 0; padding: 0; border: 0; color: var(--secondary); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.planning-v2 .section-heading > button { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: var(--accent); font-size: 15px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.planning-v2 .section-heading > button svg { width: 18px; height: 18px; }
.planning-v2 .rows > .row { min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--hairline); }
.planning-v2 .rows > .row > .row-main { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.planning-v2 .rows > .row > .row-main > :is(.row-title, .row-sub) { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.planning-v2 .rows > .row:last-child { border-bottom: 0; }
.planning-v2 .rows > .row > .icon-disc { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 16px; background: var(--surface); }
.planning-v2 > .note { font-size: 13px; line-height: 1.4; color: var(--secondary); }
html[data-theme="quick"] .planning-v2 .rows:not(:empty) { overflow: hidden; border-radius: var(--radius-block); background: var(--surface); }
html[data-theme="quick"] .planning-v2 .rows > .row { padding: 8px 12px; border-bottom-color: var(--surface-raised); }
html[data-theme="quick"] .planning-v2 .rows > .row > .icon-disc { background: var(--surface-raised); }
html[data-theme="tiles"] .planning-v2 .rows > .row { margin-bottom: 8px; border: 0; }

/* The journal's search keeps the full width of the list, its caption above. */
#editor.win-v2 #account-search-panel label.field,
html[data-theme] #editor.win-v2 #account-search-panel label.field { display: block; min-height: 0; margin: 0; padding: 0 0 8px; border: 0; border-radius: 0; background: transparent; }
#editor.win-v2 #account-search-panel label.field > span:first-child { display: block; max-width: none; margin: 0 0 6px; font-size: 13px; }
#editor.win-v2 #account-search-panel #account-register-search { width: 100%; min-height: 44px; padding: 0 12px; border-radius: var(--radius-control); background: var(--chip); text-align: left; }

/* ==== Компактный «День» (04.11): goal rows as on Money Pro, after the global list layer ==== */
/* Goal rows («День» and «Цели»), as on Money Pro: the ring, then two lines sized on their own —
   name | figure and «За 30 дней» | «из …». A number is never cut: a line too narrow wraps its right part. */
.app-shell #main .goal-rows > .goal-row { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 0 10px; min-height: 48px; padding: 5px 0; border-color: var(--hairline); }
.app-shell #main .goal-rows > .goal-row > .progress-ring { grid-column: 1; grid-row: 1; width: 36px; height: 36px; }
.app-shell #main .goal-rows > .goal-row > .progress-ring svg { width: 22px; height: 22px; }
.app-shell #main .goal-rows > .goal-row > .row-main { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.app-shell #main .goal-rows > .goal-row .goal-line { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; min-width: 0; }
.app-shell #main .goal-rows > .goal-row .goal-title { flex: 1 1 4em; display: flex; align-items: baseline; gap: 4px; min-width: 0; margin: 0; font-size: 16px; font-weight: 600; line-height: 20px; }
.app-shell #main .goal-rows > .goal-row .goal-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.app-shell #main .goal-rows > .goal-row .goal-done { flex: none; color: var(--green); font-size: 14px; font-weight: 700; }
.app-shell #main .goal-rows > .goal-row .row-amount { flex: none; max-width: 100%; margin: 0 0 0 auto; font-size: 16px; font-weight: 600; line-height: 20px; text-align: right; white-space: nowrap; }
.app-shell #main .goal-rows > .goal-row :is(.goal-change, .goal-target) { flex: 0 1 auto; min-width: 0; margin: 0; font-size: 13px; line-height: 17px; color: var(--secondary); overflow-wrap: anywhere; }
.app-shell #main .goal-rows > .goal-row .goal-target { margin-left: auto; text-align: right; }
/* An owner's picture shows inside the ring, above its inner circle. */
:where(.app-shell) .progress-ring > .account-custom-icon { position: relative; z-index: 1; width: calc(100% - 4px); height: calc(100% - 4px); border-radius: 50%; object-fit: cover; }
/* Tiles: two columns; a small ring beside the name, the figure and «из …» under it.
   The narrowest phones give the figure the whole tile. */
html[data-theme="tiles"] .app-shell #main .rows.goal-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html[data-theme="tiles"] .app-shell #main .rows.goal-rows > .goal-row { grid-template-columns: 30px minmax(0, 1fr); grid-template-areas: "ring title" "ring amount" "ring target"; align-content: center; gap: 1px 8px; min-height: 60px; padding: 6px 10px; border: 0; border-radius: var(--radius-block); background: var(--surface); }
html[data-theme="tiles"] .app-shell #main .rows.goal-rows > .goal-row :is(.row-main, .goal-line) { display: contents; }
html[data-theme="tiles"] .app-shell #main .rows.goal-rows > .goal-row > .progress-ring { grid-area: ring; width: 30px; height: 30px; border-width: 2px; }
html[data-theme="tiles"] .app-shell #main .rows.goal-rows > .goal-row > .progress-ring svg { width: 18px; height: 18px; }
html[data-theme="tiles"] .app-shell #main .rows.goal-rows > .goal-row .goal-title { grid-area: title; font-size: 14px; line-height: 17px; }
html[data-theme="tiles"] .app-shell #main .rows.goal-rows > .goal-row .row-amount { grid-area: amount; margin: 0; font-size: 15px; line-height: 18px; text-align: left; }
html[data-theme="tiles"] .app-shell #main .rows.goal-rows > .goal-row .goal-change { display: none; }
html[data-theme="tiles"] .app-shell #main .rows.goal-rows > .goal-row .goal-target { grid-area: target; margin: 0; font-size: 12px; line-height: 14px; text-align: left; }
@media (max-width: 360px) {
  html[data-theme="tiles"] .app-shell #main .rows.goal-rows > .goal-row { grid-template-areas: "ring title" "amount amount" "target target"; }
}

/* ==== Разбор скриншотов и СМС (05.11): 📷 on «День» and in the journal, the proposals window, «Подключение ИИ» ==== */
.today-screen .import-start { flex: none; display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px; margin-left: 0; padding: 0; border: 0; background: transparent; color: #d1d1d6; }
.today-screen .import-start svg { width: 22px; height: 22px; }
#editor.win-v2 .import-pick-step { display: grid; gap: 10px; padding: 4px 0; }
#editor.win-v2 .import-account { margin: 0; color: var(--secondary); font-size: 14px; }
#editor.win-v2 .import-choose { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; color: var(--accent); font-size: 16px; }
#editor.win-v2 .import-choose svg { width: 22px; height: 22px; }
#editor.win-v2 .import-files { display: flex; flex-wrap: wrap; gap: 6px; }
#editor.win-v2 .import-files:empty { display: none; }
#editor.win-v2 .import-file { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 4px 2px 10px; border-radius: 14px; background: var(--surface); font-size: 13px; }
#editor.win-v2 .import-file > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#editor.win-v2 .import-file > button { min-width: 32px; min-height: 32px; padding: 0; color: var(--secondary); font-size: 18px; }
#editor.win-v2 .import-summary { margin: 4px 0 6px; color: var(--secondary); font-size: 13px; }
#editor.win-v2 .import-rows { display: grid; }
#editor.win-v2 .import-row { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; column-gap: 4px; padding: 4px 0; border-bottom: 1px solid var(--hairline); }
#editor.win-v2 .import-row:last-child { border-bottom: 0; }
#editor.win-v2 .import-check { display: grid; place-items: center; width: 36px; min-height: 44px; margin: 0; }
#editor.win-v2 .import-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
#editor.win-v2 .import-open { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; min-height: 48px; padding: 2px 0; border: 0; background: transparent; color: var(--white); text-align: left; }
#editor.win-v2 .import-open > .icon-disc { width: 32px; height: 32px; }
#editor.win-v2 .import-open .row-main { display: grid; min-width: 0; }
#editor.win-v2 .import-open .row-title { overflow: hidden; font-size: 16px; font-weight: 600; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; }
#editor.win-v2 .import-open .row-sub { overflow: hidden; margin: 1px 0 0; color: var(--secondary); font-size: 13px; line-height: 17px; white-space: nowrap; text-overflow: ellipsis; }
#editor.win-v2 .import-open .row-amount { font-size: 16px; font-weight: 600; white-space: nowrap; }
#editor.win-v2 .import-flags { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 0 0 2px; }
#editor.win-v2 .import-flags:empty { display: none; }
#editor.win-v2 .import-flag { padding: 1px 8px; border-radius: 10px; background: var(--surface); color: var(--secondary); font-size: 12px; line-height: 18px; }
#editor.win-v2 .import-flag.ok { color: var(--green); }
#editor.win-v2 .import-flag.bad { color: var(--red); }
#editor.win-v2 .import-flag.warn { color: #ffb340; }
#editor.win-v2 .import-flag.plan { color: var(--accent); }
#editor.win-v2 .import-flags .text-button { min-height: 28px; padding: 0 6px; color: var(--accent); font-size: 13px; }
#editor.win-v2 .import-row.saved .import-open { opacity: .6; }
#editor.win-v2 .import-hint { margin: 8px 0 0; font-size: 12px; }
.app-shell #main .ai-connection { display: grid; gap: 12px; max-width: 560px; }
.app-shell #main .ai-status { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; color: var(--secondary); font-size: 15px; font-weight: 600; }
.app-shell #main .ai-status.ai-on { color: var(--green); }
.app-shell #main .ai-status svg { width: 20px; height: 20px; }
.app-shell #main .ai-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.app-shell #main .ai-actions > button { min-height: 44px; padding: 0 16px; border-radius: var(--radius-control); font-size: 15px; }
.app-shell #main .ai-actions > .primary { border: 0; background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* ==== «Неразобран», текущий остаток и сортировка счетов (07.11) ====
   Interface themes only; «Изначальная тема» keeps the previous rows. */
/* ⇅ beside the eye on «Счета»: the device's own menu over the icon; a dot when the order is not manual. */
.app-shell > #header.accounts-header .account-sort { position: relative; flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; border-radius: 22px; color: var(--accent); }
.app-shell > #header.accounts-header .account-sort svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-shell > #header.accounts-header .account-sort.active::after { content: ""; position: absolute; top: 9px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.app-shell > #header.accounts-header .account-sort select { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; font-size: 16px; cursor: pointer; }
/* «Быстрый ввод» on a phone: ⇅ joins the eye, the switch, ✎ and «+»; the switch words get smaller. */
@media (max-width: 430px) {
  html[data-theme="quick"] .app-shell > #header.accounts-header:has(.account-sort) { gap: 4px; }
  html[data-theme="quick"] .app-shell > #header.accounts-header:has(.account-sort) .account-switch button { flex: 1 1 auto; min-width: 0; padding: 0 4px; font-size: 13px; }
}
/* The narrowest phones: no gaps and a narrow ⇅, so «Счета | Капитал» keeps 44 px buttons. */
@media (max-width: 360px) {
  html[data-theme="quick"] .app-shell > #header.accounts-header:has(.account-sort) { gap: 0; }
  html[data-theme="quick"] .app-shell > #header.accounts-header .account-sort { width: 28px; }
  html[data-theme="quick"] .app-shell > #header.accounts-header:has(.account-sort) .account-switch button { flex: 1 1 0; min-width: 44px; }
}
/* «!» on the icon's corner: the row does not get wider. */
.unreconciled-mark { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 2px solid var(--bg); border-radius: 50%; background: #ff9f0a; color: #000; font-size: 11px; font-weight: 800; font-style: normal; line-height: 1; }
.accounts-v2 .account-row > .unreconciled-mark { position: absolute; z-index: 2; top: calc(50% - 20px); left: 20px; }
html[data-theme="quick"] .accounts-v2 .account-row > .unreconciled-mark { left: 32px; border-color: var(--surface); }
html[data-theme="tiles"] .accounts-v2 .account-row > .unreconciled-mark { top: 3px; left: 21px; width: 14px; height: 14px; border-color: var(--surface); font-size: 10px; }
/* The reference current balance: grey, after a slash; on a narrow row it goes under the amount, whole. */
.accounts-v2 .account-row .row-reported { color: var(--secondary); font-weight: 400; white-space: nowrap; }
html[data-theme="tiles"] .accounts-v2 .account-row .row-reported { font-size: 14px; }
.accounts-v2 .account-swipe-actions .swipe-unreconciled { background: #ff9f0a; color: #000; font-size: 24px; font-weight: 800; }
.accounts-v2 .account-swipe-actions .swipe-unreconciled[aria-pressed="true"] { background: #48484a; color: #ff9f0a; }
/* The journal header is a button now: it opens «Неразобран». A plain balance looks as before. */
#editor.win-v2 button.register-current { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; font-size: 26px; font-weight: 700; line-height: inherit; text-align: left; white-space: normal; cursor: pointer; }
#editor.win-v2 button.register-current > .register-amount { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#editor.win-v2 button.register-current > .unreconciled-mark { flex: none; width: 22px; height: 22px; border-color: var(--bg); font-size: 14px; }
#editor.win-v2 button.register-current > .row-reported { flex: 0 1 auto; color: var(--secondary); font-size: 15px; font-weight: 400; white-space: nowrap; }
/* The «Неразобран» window. */
#editor.win-v2 .review-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin: 0; padding: 0 2px; border-bottom: 1px solid var(--hairline); font-size: 17px; }
#editor.win-v2 .review-switch input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: #ff9f0a; }
/* A row with a reference balance: the name keeps at least 6em, the amount stays on the right,
   and only the grey part goes under the amount when the row is narrow. «Плитки» keep their grid. */
html:not([data-theme="tiles"]) .accounts-v2 .account-list > .account-item > .account-row:has(> .row-amount .row-reported) { display: grid; grid-template-columns: auto minmax(6em, 1fr) auto; align-items: center; column-gap: 12px; }
/* The journal header: the reference balance never pushes ✎, 🔍 and «+» to a second line. */
#editor.win-v2 button.register-current { flex: 1 1 0; }
/* ⇅ of the categories: the accent colour of the theme, a dot when a sort is chosen, like «Счета». */
.category-sort { border-radius: 22px; color: var(--accent); }
.category-sort svg { width: 22px; height: 22px; stroke-width: 1.8; }
.category-sort.active::after { content: ""; position: absolute; top: 9px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
/* ==== Кредитный лимит и компактная форма счёта (10.11) ==== */
/* The journal of a credit card with a limit: «Доступно» big, the limit and the debt grey on one line. */
#editor.win-v2 button.register-current.credit { flex: 1 1 0; min-width: 0; row-gap: 2px; }
#editor.win-v2 button.register-current.credit > .register-amount { font-size: 20px; }
#editor.win-v2 button.register-current .register-caption { color: var(--secondary); font-size: 13px; font-weight: 400; }
#editor.win-v2 button.register-current .register-credit { flex: 1 0 100%; min-width: 0; overflow: hidden; color: var(--secondary); font-size: 13px; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
#editor.win-v2 button.register-current .register-credit .row-reported { font-size: inherit; }
/* «Настройки счёта» as in Money Pro: the icon beside the name, one row per figure. */
#editor.win-v2 .acc-compact .acc-head { display: flex; align-items: center; gap: 12px; padding: 8px 0 10px; border-bottom: 1px solid var(--hairline); }
#editor.win-v2 .acc-compact .acc-head-icon { flex: none; display: grid; place-items: center; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
#editor.win-v2 .acc-compact .acc-head-icon > #account-icon-preview { display: grid; place-items: center; width: 56px; height: 56px; margin: 0; overflow: hidden; border-radius: 50%; background: var(--chip); color: var(--white); }
#editor.win-v2 .acc-compact .acc-head-icon > #account-icon-preview svg { width: 28px; height: 28px; }
#editor.win-v2 .acc-compact .acc-head-icon > #account-icon-preview img { width: 100%; height: 100%; object-fit: cover; }
#editor.win-v2 #form-fields .acc-compact .acc-head > label.field { flex: 1 1 auto; min-width: 0; min-height: 0; padding: 0; border: 0; }
#editor.win-v2 #form-fields .acc-compact .acc-head > label.field > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#editor.win-v2 #form-fields .acc-compact .acc-head > label.field input[name="name"][type="text"] { width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--radius-control); background: var(--chip); color: var(--white); font-size: 19px; font-weight: 600; text-align: left; text-align-last: left; }
#editor.win-v2 .acc-compact .account-icon-picker { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--hairline); }
#editor.win-v2 .acc-compact .acc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; margin: 0; padding: 4px 0; border-bottom: 1px solid var(--hairline); }
#editor.win-v2 .acc-compact .acc-row > span { flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--secondary); font-size: 15px; white-space: nowrap; text-overflow: ellipsis; }
#editor.win-v2 .acc-compact .acc-row > strong { flex: 0 1 auto; min-width: 0; overflow: hidden; font-size: 16px; font-weight: 600; text-align: right; white-space: nowrap; text-overflow: ellipsis; }
#editor.win-v2 .acc-compact .acc-row-button { width: 100%; border-width: 0 0 1px; border-radius: 0; background: transparent; color: var(--white); font: inherit; text-align: left; cursor: pointer; }
#editor.win-v2 .acc-compact .acc-chevron { margin-left: 8px; color: var(--secondary); font-weight: 400; }
#editor.win-v2 #form-fields .acc-compact .acc-rows > label.field input { text-align: right; }
#editor.win-v2 .acc-compact .form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
#editor.win-v2 .acc-compact .form-actions > button { flex: 1 1 0; min-width: max-content; min-height: 44px; margin: 0; }
@media (max-width: 360px) { #editor.win-v2 button.register-current .register-caption { display: none; } }
