:root {
  --bg: #f2efe9; --surface: #f2efe9; --surface-soft: #f8f6f1;
  --ink: #2b2b2b; --muted: #6d6d69; --line: #d4d0c7;
  --brand: #2b2b2b; --accent: #9b7e56; --accent-soft: #eee7dc;
  --warning: #9b7e56; --warning-soft: #eee7dc;
  --income: #326a50; --danger: #985047;
  --shadow: 0 18px 45px rgba(22, 23, 23, .14);
  --type-screen-title: 21px; --type-row-title: 12px; --type-body: 11px;
  --type-meta: 10px; --type-field-native: 16px; --type-control: 11px;
}

* { box-sizing: border-box; }
html {
  min-width: min(280px, 100%);
  font-family: 'Onest', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); touch-action: manipulation; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(23, 107, 77, .28);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prototype-label {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 50%;
  height: 23px;
  padding: 4px 11px;
  transform: translateX(-50%);
  border-radius: 0 0 10px 10px;
  background: var(--brand);
  color: #fff;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.app { min-height: 100vh; min-height: 100dvh; }
.app > header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: calc(70px + env(safe-area-inset-top, 0px));
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 243, 239, .96);
  backdrop-filter: blur(15px);
}
.logo, .header-back, .avatar, .notification-button, .contextual-action {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 15px;
}
.header-back { display: none; place-items: center; padding: 0; border: 0; border-radius: 15px; background: transparent; color: #fff; }
.header-back svg { width: 20px; height: 20px; transform: rotate(180deg); }
.settings-route .header-back { display: grid; }
.settings-route .logo { display: none; }
.logo {
  padding: 0;
  background: var(--brand);
  color: #fff;
  box-shadow: inset 0 0 0 1px #547064;
  font-size: 21px;
  font-weight: 600;
  line-height: 1;
}
.header-actions { position: relative; display: flex; align-items: center; gap: 0; margin-left: auto; }
.header-actions > button > svg { width: 22px; height: 22px; stroke-width: 1.8; }
.header-actions > .contextual-action, .header-actions > .notification-button { width: 36px; height: 44px; }
.contextual-action { position: relative; display: none; padding: 0; border: 0; background: transparent; color: #526159; }
.operations-route .contextual-action { display: grid; }
.operations-route .header-actions { grid-column: 3; }
.notification-button { position: relative; padding: 0; background: transparent; color: #526159; -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent; }
.notification-button > svg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.notification-button:active { background: #e1dfd8; }
.filter-button.active::after { content: ""; position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border: 2px solid var(--bg); border-radius: 50%; background: var(--accent); }
.operations-search {
  position: relative;
  width: calc(100% - 34px);
  max-width: 864px;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  margin: 8px auto 0;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.operations-search:not([hidden]) { display: flex; }
.operations-search:not([hidden]) + main { padding-top: 13px; }
.operations-search > svg { flex: 0 0 auto; color: var(--muted); }
.operations-search input { width: 100%; min-width: 0; height: 46px; border: 0; outline: 0; background: transparent; font-size: 16px; }
.operations-search button { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; }
.notification-button b {
  position: absolute;
  top: 3px;
  right: 2px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid var(--bg);
  border-radius: 10px;
  background: var(--warning);
  color: #fff;
  font-size: 10px;
}
.avatar { position: relative; isolation: isolate; margin-left: 10px; background: transparent; font-size: 11px; font-weight: 600; }
.avatar::before { content: ""; position: absolute; z-index: -1; width: 44px; height: 44px; border-radius: 15px; background: #e1dfd8; }
.avatar span {
  position: absolute;
  right: 1px;
  bottom: 2px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
}
.location { display: none; }
.location small {
  display: block;
  margin-bottom: 3px;
  overflow: hidden;
  color: #7b8680;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.location strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
  letter-spacing: -.025em;
}

main {
  width: 100%;
  max-width: 920px;
  margin: auto;
  padding: 20px 17px 104px;
}
.finance-boot { display: grid; gap: 14px; padding-top: 8px; }
.finance-boot > div { overflow: hidden; border-radius: 16px; background: #e5e1d9; }
.finance-boot > div::after { content: ""; display: block; width: 100%; height: 100%; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: finance-boot-shimmer 1.15s infinite; }
.finance-boot-balance { height: 164px; }
.finance-boot-period { width: 62%; height: 42px; }
.finance-boot-row { height: 78px; }
.finance-boot-row.short { width: 84%; }
.finance-boot > span { color: var(--muted); font-size: 11px; text-align: center; }
@keyframes finance-boot-shimmer { to { transform: translateX(100%); } }
.screen-heading { margin: 2px 1px 17px; }
.screen-heading small { color: var(--muted); font-size: 11px; }
.screen-heading h1 {
  margin: 5px 0 7px;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: -.05em;
}
.screen-heading p {
  max-width: 600px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.sync-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  color: #536159;
  font-size: 10px;
  font-weight: 600;
}
.sync-line i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.pull-refresh {
  --pull-offset: 0px;
  position: fixed;
  z-index: 29;
  top: calc(70px + env(safe-area-inset-top, 0px));
  left: 50%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  transform: translate(-50%, calc(-48px + var(--pull-offset)));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transition: transform .16s ease, opacity .16s ease;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.pull-refresh.visible { --pull-offset: 58px; opacity: 1; }
.pull-refresh.pulling { transition: none; }
.pull-refresh.refreshing { --pull-offset: 58px; opacity: 1; }
.pull-refresh.success { color: #2f7655; border-color: #b9d6c5; }
.pull-refresh.error { color: #9a6b22; border-color: #e0c994; }
.pull-refresh svg { width: 16px; height: 16px; }
.pull-refresh.refreshing svg { animation: pull-refresh-spin .8s linear infinite; }
@keyframes pull-refresh-spin { to { transform: rotate(360deg); } }

.welcome small { color: #728078; font-size: 12px; }
.welcome h1 { margin: 5px 0 20px; font-size: 30px; line-height: 1.12; letter-spacing: -.05em; }
.summary { padding: 21px; border-radius: 24px; background: var(--brand); color: #fff; }
.summary small { color: #c2d3ca; font-size: 11px; }
.summary strong { display: block; margin: 8px 0 16px; font-size: 30px; letter-spacing: -.05em; }
.summary-line { height: 7px; overflow: hidden; border-radius: 8px; background: #345448; }
.summary-line span { display: block; width: 42%; height: 100%; border-radius: inherit; background: var(--accent); }
.summary-meta { display: flex; justify-content: space-between; margin-top: 8px; color: #d5e2dc; font-size: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 2px 10px; }
.section-head h2 { margin: 0; font-size: 15px; letter-spacing: -.025em; }
.section-head button { min-height: 44px; border: 0; background: transparent; color: var(--accent); font-size: 11px; font-weight: 600; }

.operation-day { margin-top: 18px; }
.operation-day:first-child { margin-top: 0; }
.day-heading {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 3px 7px;
}
.day-heading h2 { margin: 0; color: #55635b; font-size: 11px; font-weight: 600; }
.day-totals { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 9px; font-size: 10px; }
.day-totals b { white-space: nowrap; }
.day-totals .income { color: var(--income); }
.day-totals .expense { color: #9a4437; }
.operation-list { overflow: visible; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.swipe-row { position: relative; overflow: hidden; contain: paint; background: #a43f34; }
.swipe-main {
  position: relative;
  z-index: 1;
  touch-action: pan-y;
  transform: translate3d(0, 0, 0);
  transition: transform .08s cubic-bezier(.2,.8,.2,1);
  backface-visibility: hidden;
}
.swipe-row.swipe-open > .swipe-main,
.swipe-row.keyboard-open > .swipe-main { transform: translate3d(-96px, 0, 0); }
.swipe-row.swipe-ready > .swipe-main { will-change: transform; }
.swipe-row.swipe-dragging > .swipe-main { transition: none !important; user-select: none; }
.operation-swipe { border-bottom: 1px solid #ebe9e3; }
.operation-swipe:last-child { border-bottom: 0; }
.delete-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 96px;
  border: 0;
  background: #a43f34;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.operation-row {
  width: 100%;
  min-width: 0;
  min-height: 70px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border: 0;
  background: var(--surface);
  text-align: left;
}
.operation-row:hover { background: #faf9f6; }
.operation-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 600;
}
.type-expense .operation-mark { background: #f6e8e3; color: #9a4437; }
.type-income .operation-mark { background: var(--accent-soft); color: var(--income); }
.type-transfer .operation-mark { background: #e7edf3; color: #48647c; }
.type-expense .operation-value strong { color: #843c32; }
.type-income .operation-value strong { color: var(--income); }
.type-transfer .operation-value strong { color: #48647c; }
.operation-copy { min-width: 0; }
.operation-copy strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.3;
}
.review-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: #f0b429;
}
.operation-copy small {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}
.operation-copy .operation-comment { display: flex; align-items: center; gap: 4px; min-width: 0; color: #485850; }
.operation-comment svg { width: 12px; height: 12px; flex: 0 0 12px; }
.operation-comment span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.operation-badge {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  margin-top: 6px;
  padding: 2px 7px;
  border-radius: 7px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 10px;
  font-weight: 600;
}
.operation-badge.pending { background: #f1eee5; color: #756641; }
.operation-badge.refund { background: var(--accent-soft); color: var(--accent); }
.operation-value { min-width: 75px; text-align: right; }
.operation-value strong { display: block; white-space: nowrap; font-size: 11px; }
.operation-value strong.income { color: var(--income); }
.operation-value small { display: block; margin-top: 5px; color: #8b948f; font-size: 10px; }

.prototype-state {
  min-height: 245px;
  display: grid;
  place-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  text-align: center;
}
.prototype-state > div { max-width: 290px; }
.prototype-state i { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 15px; border-radius: 18px; background: var(--surface-soft); color: #67736c; font-style: normal; }
.prototype-state h2 { margin: 0 0 7px; font-size: 15px; }
.prototype-state p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.prototype-state button { min-height: 44px; margin-top: 16px; padding: 0 16px; border: 0; border-radius: var(--action-radius); background: var(--brand); color: #fff; font-size: 10px; font-weight: 600; }
.loading-lines { width: min(100%, 260px); }
.loading-lines span { display: block; height: 11px; margin: 10px 0; border-radius: 8px; background: linear-gradient(90deg, #ebe9e3 25%, #f6f5f2 50%, #ebe9e3 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.loading-lines span:nth-child(2) { width: 76%; }
.loading-lines span:nth-child(3) { width: 88%; }

.placeholder-screen { max-width: 460px; margin: 52px auto; text-align: center; }
.placeholder-screen > i { display: grid; place-items: center; width: 64px; height: 64px; margin: auto; border-radius: 21px; background: var(--accent-soft); color: var(--accent); font-style: normal; }
.placeholder-screen h1 { margin: 18px 0 8px; font-size: 30px; }
.placeholder-screen p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

#bottomNav {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  height: calc(72px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 5px 4px env(safe-area-inset-bottom);
  border-top: 1px solid #dcdad4;
  background: rgba(251, 250, 247, .98);
  backdrop-filter: blur(16px);
}
#bottomNav button {
  position: relative;
  min-width: 0;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: #79847d;
  font-size: 10px;
  font-weight: 600;
}
#bottomNav button.active { color: var(--accent); }
#bottomNav b {
  position: absolute;
  top: 5px;
  left: calc(50% + 7px);
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  line-height: 1;
  border: 2px solid #fbfaf7;
  border-radius: 9px;
  background: var(--warning);
  color: #fff;
  font-size: 10px;
}

.overlay { position: fixed; z-index: 100; inset: 0; }
.scrim { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(16, 32, 25, .6); backdrop-filter: blur(2px); }
#panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(86vw, 360px);
  padding: 22px 16px calc(22px + env(safe-area-inset-bottom));
  overflow: auto;
  background: #f7f6f2;
  box-shadow: var(--shadow);
  animation: drawer .2s ease;
}
#panel:focus { outline: none; }
.profile-panel, .notification-panel {
  right: 0;
  left: auto !important;
  border-radius: 24px 0 0 24px;
  animation: profile .2s ease !important;
}
.more-panel { right: 0; left: auto !important; border-radius: 24px 0 0 24px; animation: profile .2s ease !important; }
.operation-detail {
  top: auto !important;
  right: 0;
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
  max-height: 92vh;
  border-radius: 25px 25px 0 0;
  animation: sheet .2s ease !important;
}
.panel-head { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.panel-head strong { min-width: 0; overflow-wrap: anywhere; font-size: 21px; }
.panel-head button { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 14px; background: #e8e6df; }
.panel-head button svg { display: block; }
.family { padding: 16px; border-radius: 18px; background: var(--brand); color: #fff; }
.family small { color: #bacdc3; font-size: 10px; }
.family strong { display: block; margin-top: 5px; font-size: 15px; }
.label { margin: 21px 8px 8px; color: #7c8580; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.panel-list { overflow: hidden; border: 1px solid #e2e0da; border-radius: 18px; background: #fff; }
.panel-row { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border: 0; border-bottom: 1px solid #ebe9e3; background: #fff; text-align: left; }
.panel-row:last-child { border-bottom: 0; }
.panel-row i { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 11px; background: #edf1ed; color: #53645b; font-style: normal; }
.panel-row span { min-width: 0; flex: 1; overflow-wrap: anywhere; font-size: 12px; font-weight: 600; }
.panel-row small { color: #838b86; font-size: 10px; }
.profile { padding: 12px 0 20px; text-align: center; }
.profile-avatar { display: grid; place-items: center; width: 68px; height: 68px; margin: auto; border-radius: 50%; background: #dfe3de; font-weight: 600; }
.profile h2 { margin: 12px 0 3px; font-size: 21px; }
.profile p { margin: 0; color: #79837d; font-size: 10px; }

.detail-hero { padding: 0 2px 16px; text-align: center; }
.detail-hero h2 { margin: 2px 0 7px; overflow-wrap: anywhere; font-size: 21px; line-height: 1.25; }
.amount-editor { min-height: 44px; padding: 4px 12px; border: 0; background: transparent; font-size: 30px; font-weight: 600; letter-spacing: -.04em; }
.detail-hero.type-expense .amount-editor { color: #843c32; }
.detail-hero.type-income .amount-editor { color: var(--income); }
.detail-hero.type-transfer .amount-editor { color: #48647c; }
.detail-fields { overflow: visible; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.detail-field-wrap { position: relative; border-bottom: 1px solid #ebe9e3; }
.detail-field-wrap:last-child { border-bottom: 0; }
.detail-field-wrap:first-child > .detail-field { border-radius: 16px 16px 0 0; }
.detail-field-wrap:last-child > .detail-field { border-radius: 0 0 16px 16px; }
.detail-field {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 0;
  background: #fff;
  text-align: left;
}

.detail-field > span { color: var(--muted); font-size: 10px; }
.detail-field > strong { min-width: 0; overflow-wrap: anywhere; text-align: right; font-size: 10px; font-weight: 600; }
.detail-field svg { width: 16px; height: 16px; color: #9aa39e; }
.operation-detail .panel-head { margin-top: max(4px, env(safe-area-inset-top)); }
.anchored-popover {
  --popover-anchor-x: 0%;
  --popover-shift-x: 0px;
  position: absolute;
  z-index: 20;
  top: 100%;
  right: 0;
  left: auto;
  width: min(280px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: var(--popover-available-height, min(420px, calc(100dvh - 24px)));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(24, 38, 31, .16);
  transform: translateX(calc(var(--popover-anchor-x) + var(--popover-shift-x)));
}
.anchored-popover.position-pending {
  visibility: hidden;
  pointer-events: none;
}
.anchored-popover.calendar-popover { width: min(300px, calc(100vw - 24px)); }
.anchored-popover > .inline-editor, .anchored-popover > .category-navigator, .anchored-popover > .inline-calendar, .anchored-popover > .filter-inline-options { max-height: inherit; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.popover-options {
  max-height: min(264px, calc(var(--popover-available-height, 320px) - 48px));
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.popover-options button { min-height: 44px; }
.inline-editor, .category-navigator, .inline-calendar { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #f8f7f3; box-shadow: 0 5px 18px rgba(24, 38, 31, .08); }
.inline-editor input { width: 100%; min-width: 0; min-height: 48px; padding: 0 12px; border: 0; outline: 0; background: #fff; font-size: 16px; }
.inline-editor.with-actions { display: grid; grid-template-columns: minmax(0, 1fr) 44px 44px; align-items: center; }
.inline-editor.with-actions input { grid-column: 1; grid-row: 1; }
.editor-action { width: 44px; height: 48px; display: grid; place-items: center; padding: 0; border: 0; background: #fff; }
.editor-action svg { width: 18px; height: 18px; }
.editor-action.cancel { grid-column: 2; grid-row: 1; color: #a43f34; border-right: 1px solid var(--line); border-left: 1px solid var(--line); }
.editor-action.confirm { grid-column: 3; grid-row: 1; color: var(--accent); }
.party-editor-search { min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-bottom: 1px solid var(--line); background: #fff; }
.party-editor-search svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--muted); }
.party-editor-input { min-width: 0; height: 48px; flex: 1; overflow: hidden; }
.party-editor-search input { width: 133.3334%; min-width: 0; min-height: 48px; padding: 0; border: 0; outline: 0; background: transparent; font-size: 16px; transform: scale(.75); transform-origin: left center; }
.popover-options button, .filter-inline-options button { width: 100%; min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 12px; border: 0; border-bottom: 1px solid #e5e3dd; background: #fff; text-align: left; font-size: 10px; }
.popover-options button > span, .filter-inline-options button > span, .category-node-actions > span { min-width: 0; overflow-wrap: anywhere; white-space: normal; line-height: 1.35; }
.popover-options button:last-child, .filter-inline-options button:last-child { border-bottom: 0; }
.popover-options svg, .filter-inline-options svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--accent); }
.popover-options button[aria-pressed="false"] svg { visibility: hidden; }
.popover-options button[aria-pressed="true"] { background: var(--accent-soft); font-weight: 600; }
.category-navigator .popover-options { max-height: min(264px, calc(var(--popover-available-height, 352px) - 88px)); }
.category-node-actions { min-width: 0; display: flex; align-items: stretch; border-bottom: 1px solid #e5e3dd; background: #fff; }
.category-node-actions:last-child { border-bottom: 0; }
.category-node-actions > span { min-width: 0; min-height: 44px; display: flex; align-items: center; flex: 1; padding: 7px 12px; font-size: 10px; }
.category-node-actions .category-node-select { min-width: 0; flex: 1; border-bottom: 0; font-weight: 400; }
.category-node-actions .category-node-open { width: 44px; flex: 0 0 44px; justify-content: center; padding: 0; border-bottom: 0; border-left: 1px solid #e5e3dd; }
.category-level-head { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.category-level-head strong { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.category-level-back { min-height: 44px; display: flex; align-items: center; gap: 4px; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 10px; font-weight: 600; }
.category-level-back svg { width: 14px; transform: rotate(180deg); }
.inline-calendar { padding: 10px; }
.calendar-head { min-height: 44px; display: flex; align-items: center; justify-content: space-between; }
.calendar-head strong { font-size: 11px; }
.calendar-head button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--accent); }
.calendar-head button:first-child svg { transform: rotate(180deg); }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; }
.calendar-weekdays span { padding: 5px 0; color: var(--muted); text-align: center; font-size: 10px; }
.calendar-grid button, .calendar-grid i { min-width: 0; min-height: 44px; border: 0; border-radius: 9px; background: transparent; font-size: 10px; font-style: normal; }
.calendar-grid button[aria-pressed="true"] { background: var(--brand); color: #fff; font-weight: 600; }
.add-reference { min-height: 44px; border: 0; background: transparent; color: var(--accent); font-size: 10px; font-weight: 600; }
.source-details { margin-top: 12px; padding: 0 12px; border-radius: 14px; background: #ebe9e3; color: #627068; font-size: 10px; }
.source-details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.source-details p { margin: 0; padding: 0 0 12px; overflow-wrap: anywhere; line-height: 1.5; }
.operation-bank-details { margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.operation-bank-summary { width: 100%; min-height: 46px; display: flex; align-items: center; gap: 7px; padding: 0 12px; border: 0; background: transparent; color: var(--accent); text-align: left; font-size: 11px; font-weight: 600; }
.operation-bank-summary svg { width: 14px; height: 14px; transition: transform .16s ease; }
.operation-bank-summary[aria-expanded="true"] svg { transform: rotate(90deg); }
.operation-bank-details dl { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin: 0; padding: 0 14px 14px; }
.operation-bank-details dl[hidden] { display: none; }
.operation-bank-details dl div { min-width: 0; }
.operation-bank-details .bank-detail-wide { grid-column: 1 / -1; }
.operation-bank-details dt { margin-bottom: 3px; color: var(--muted); font-size: 10px; }
.operation-bank-details dd { margin: 0; overflow-wrap: anywhere; font-size: 10px; line-height: 1.45; }
.operation-card-save { width: 100%; min-height: 48px; margin-top: 12px; border: 0; border-radius: 11px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; }
.delete-from-card { width: fit-content; min-width: 144px; min-height: 44px; display: block; margin: 9px auto 0; padding: 0 14px; border: 0; background: transparent; color: #a43f34; font-size: 10px; font-weight: 600; }

.filters-panel {
  right: 0;
  left: auto !important;
  display: flex;
  flex-direction: column;
  border-radius: 24px 0 0 24px;
  animation: profile .2s ease !important;
}
.filter-rows { overflow: visible; }
.filter-row-block { position: relative; }
.filter-rows > .filter-row, .filter-row-block { border-bottom: 1px solid #e6e4de; }
.filter-row-block .filter-row { border-bottom: 0; }
.filter-row-block:last-child, .filter-rows > .filter-row:last-child { border-bottom: 0; }
.filter-row { width: 100%; height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: transparent; }
.filter-field-shell { display: flex; align-items: center; background: transparent; }
.filter-field { min-width: 0; flex: 1; border: 0; text-align: left; }
.filter-field-clear { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); }
.filter-field-clear:focus, .filter-field-clear:active { background: transparent; }
.filter-field-clear svg { width: 16px; height: 16px; }
.filter-field span { min-width: 0; display: grid; gap: 4px; }
.filter-field small { color: var(--muted); font-size: 10px; }
.filter-field strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-field svg { flex: 0 0 auto; color: #8b958f; }
.filter-field strong, .filter-review strong, .filter-amount > strong { font-size: 11px; font-weight: 600; line-height: 1.2; }
.filter-review input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--accent); }
.filter-kind { margin: 0; padding: 10px 12px 12px; border: 0; border-bottom: 1px solid #e6e4de; }
.filter-kind legend { padding: 0; color: var(--muted); font-size: 10px; font-weight: 600; }
.filter-kind-buttons, .filter-scope-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.filter-scope-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filter-kind-buttons button, .filter-scope-buttons button { min-width: 0; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 10px; }
.filter-kind-buttons button[aria-pressed="true"], .filter-scope-buttons button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.filter-kind-buttons svg, .filter-scope-buttons svg { width: 13px; height: 13px; color: var(--accent); }
.filter-amount { align-items: center; }
.filter-inline-options { margin: 0 8px 8px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; }
.filter-row-block > .category-navigator { margin-top: 0; }
.filter-row-block > .filter-inline-options { margin-top: 0; }
.filter-row-block > .filter-popover {
  position: fixed;
  z-index: 110;
  top: var(--filter-popover-top) !important;
  right: auto !important;
  bottom: auto !important;
  left: var(--filter-popover-left) !important;
  transform: none;
}
.filter-period-popover { width: min(328px, calc(100vw - 24px)); }
.filter-period-options { overflow: hidden; background: var(--surface); }
.filter-period-options .popover-options { max-height: min(300px, calc(var(--popover-available-height, 420px) - 44px)); }
.filter-period-calendar { padding: 8px 10px 10px; background: var(--surface); }
.filter-period-calendar-top { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.filter-period-calendar-top button { min-height: 40px; display: inline-flex; align-items: center; gap: 3px; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 10px; font-weight: 600; }
.filter-period-calendar-top button svg { width: 14px; transform: rotate(180deg); }
.filter-period-calendar-top small { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.filter-period-calendar .calendar-grid button.in-range { border-radius: 0; background: var(--accent-soft); }
.filter-period-calendar .calendar-grid button.range-start,
.filter-period-calendar .calendar-grid button.range-end { background: var(--brand); color: #fff; font-weight: 600; }
.amount-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.amount-input { min-width: 0; height: 36px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #faf9f6; }
.amount-range input { width: 133.3334%; min-width: 0; height: 48px; padding: 0 11px; border: 0; background: transparent; font-size: 16px; transform: scale(.75); transform-origin: left top; }
.amount-range input::placeholder { color: var(--muted); opacity: 1; font-size: 16px; font-weight: 400; }
.filter-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1.5fr; gap: 8px; margin-top: auto; padding-top: 16px; background: var(--bg); }
.filter-actions button { min-height: 48px; border: 1px solid var(--line); border-radius: var(--action-radius); background: #fff; font-size: 10px; font-weight: 600; }
.filter-actions .primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.filter-preview { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding: 0 2px; border-top: 1px solid var(--line); font-size: 10px; }
.filter-preview span { color: var(--muted); }
.filter-preview + .filter-actions { margin-top: 0; }
.operations-filter-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.operations-filter-summary strong { font-size: 12px; }
.operations-filter-summary span { color: var(--muted); font-size: 10px; }
.operations-active-filter-bar { min-height: 32px; display: flex; align-items: center; justify-content: flex-end; margin: 0 0 2px; }
.operations-active-filter-bar button { min-height: 32px; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 10px; font-weight: 600; }
.notification-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 12px; padding: 4px; border-radius: 13px; background: #e8e6df; }
.notification-tabs button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 600; }
.notification-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(20, 34, 27, .08); }
.notification-list { overflow: hidden; border: 1px solid #e2e0da; border-radius: 17px; background: #fff; }
.notification-item { width: 100%; min-height: 66px; display: grid; grid-template-columns: 9px minmax(0, 1fr); align-items: start; gap: 10px; padding: 13px; border: 0; border-bottom: 1px solid #ebe9e3; background: #fff; text-align: left; }
.notification-item:last-child { border-bottom: 0; }
.notification-item i { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: transparent; }
.notification-item.unread { background: #f7fbf8; }
.notification-item.unread i { background: var(--accent); }
.notification-item.read strong { color: #69756e; font-weight: 600; }
.notification-item strong { display: block; font-size: 11px; }
.notification-item small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.notification-empty { min-height: 180px; display: grid; place-content: center; padding: 24px; border: 1px solid var(--line); border-radius: 17px; background: #fff; text-align: center; }
.notification-empty strong { font-size: 12px; }
.notification-empty small { margin-top: 5px; color: var(--muted); font-size: 10px; }

.toast { position: fixed; z-index: 120; top: calc(82px + env(safe-area-inset-top, 0px)); right: 16px; bottom: auto; left: 16px; max-width: 390px; margin: auto; padding: 11px 13px; border-radius: 14px; background: var(--brand); color: #fff; text-align: center; font-size: 10px; font-weight: 600; box-shadow: var(--shadow); }
.toast button { min-height: 44px; margin-left: 10px; border: 0; background: transparent; color: #f2efe9; font-weight: 600; text-decoration: underline; }

/* Settings */
.settings-route #bottomNav { display: none; }
.settings-route main { max-width: 760px; padding-bottom: 40px; }
.settings-screen { min-width: 0; }
.settings-section { margin-top: 24px; }
.settings-section:first-of-type { margin-top: 0; }
.settings-section > h2 { margin: 0 2px 8px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.settings-group { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.settings-row {
  width: 100%;
  min-width: 0;
  min-height: 64px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 11px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.settings-row:last-child { border-bottom: 0; }
.settings-row > i { width: 36px; height: 36px; display: grid; place-items: center; color: var(--ink); font-style: normal; }
.settings-row > i svg { width: 20px; height: 20px; }
.settings-row > span { min-width: 0; }
.settings-row strong, .settings-row small { display: block; overflow-wrap: anywhere; }
.settings-row strong { font-size: 12px; font-weight: 600; }
.settings-row small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.settings-row > b { max-width: 78px; color: var(--muted); text-align: right; font-size: 10px; font-weight: 600; }
.settings-row > svg { width: 16px; height: 16px; color: var(--muted); }
.settings-row:disabled { cursor: default; opacity: .56; }

.reference-screen { display: grid; gap: 22px; }
.reference-section { min-width: 0; }
.reference-section-head { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reference-section-head h2 { margin: 0; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.reference-section-head button, .secondary-reference-action { min-height: 44px; border: 0; background: transparent; color: var(--accent); font-size: 10px; font-weight: 600; white-space: nowrap; }
.reference-list { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.reference-row { width: 100%; min-width: 0; min-height: 62px; display: grid; grid-template-columns: 40px minmax(0, 1fr) 18px; align-items: center; gap: 10px; padding: 8px 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.reference-row:last-child { border-bottom: 0; }
.reference-row > i { width: 40px; height: 40px; display: grid; place-items: center; color: var(--ink); font-style: normal; }
.reference-row > i svg { width: 22px; height: 22px; }
.reference-row > span { min-width: 0; }
.reference-row strong, .reference-row small { display: block; overflow-wrap: anywhere; }
.reference-row strong { font-size: 12px; }
.reference-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.reference-row > svg { width: 16px; color: var(--muted); }
.reference-row:disabled { cursor: default; }
.reference-row:disabled > svg { display: none; }
.reference-editor-form { display: grid; gap: 14px; }
.reference-editor-form label { display: grid; gap: 4px; }
.reference-editor-form label span, .reference-field-label { color: var(--muted); font-size: 10px; }
.compact-input-shell { width: 100%; height: 48px; display: flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: transparent; }
.compact-input-shell input { width: 123.0769%; min-width: 123.0769%; height: 59.0769px; padding: 0 14.7692px; border: 0; outline: 0; background: transparent; font-size: var(--type-field-native); line-height: 1; transform: scale(.8125); transform-origin: left center; }
.technical-reference-field .compact-input-shell { background: var(--surface-soft); }
.technical-reference-field input[readonly] { color: var(--muted); cursor: default; }
.counterparty-display-name .compact-input-shell { background: var(--surface-soft); }
.bank-alias-field .compact-input-shell { background: transparent; }
.category-name-field .compact-input-shell { background: var(--surface-soft); }
.reference-editor-form > small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.category-icon-picker legend { padding: 0 2px; color: var(--muted); font-size: var(--type-meta); line-height: 1.3; }
.category-icon-grid { display: grid; grid-template-columns: repeat(3, minmax(44px, 1fr)); gap: 6px; }
.category-icon-option { min-width: 44px; min-height: 44px; display: grid; place-items: center; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: transparent; font-size: var(--type-control); line-height: 1.2; }
.category-icon-option[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-soft); color: var(--accent); }
.category-icon-option svg { width: 22px; height: 22px; }
.secondary-reference-action { width: 100%; }
.integration-status-card { display: grid; gap: 10px; padding: 18px; border-radius: 16px; background: var(--surface-soft); }
.integration-status-card > span { display: flex; align-items: center; gap: 8px; }
.integration-status-card > span i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.integration-status-card strong { font-size: 12px; }
.integration-status-card small { color: var(--muted); font-size: 10px; }
.integration-status-card button { min-height: 44px; border: 0; border-radius: var(--action-radius); background: var(--ink); color: #fff; font-size: 10px; font-weight: 600; }
.integration-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

@keyframes drawer { from { transform: translateX(-25px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes profile { from { transform: translateX(25px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes sheet { from { transform: translateY(35px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media(prefers-reduced-motion:reduce) { * { animation: none !important; scroll-behavior: auto !important; } }

@media(max-width:759px) {
  input[type="text"], input[type="search"], input[type="number"] { font-size: 16px; }
}

@media(max-width:379px) {
  .calendar-weekdays { display: none; }
  .calendar-grid { grid-template-columns:repeat(4, 1fr); }
  .calendar-grid i { display: none; }
}

/* Iteration: review, bulk actions, filters, reimbursements */
.anchored-popover.open-up { top: auto !important; bottom: calc(100% + 5px); }
.review-kind-switch, .review-view-controls > div, .bulk-scope { display: flex; gap: 6px; }
.review-kind-switch { margin: 0 0 8px; }
.review-back { min-height: 36px; display: inline-flex; align-items: center; gap: 5px; margin: 0 0 8px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 600; }
.review-back svg { width: 15px; height: 15px; transform: rotate(180deg); }
.review-period { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-soft); color: var(--muted); font-size: 10px; }
.review-period button { min-height: 32px; border: 0; background: transparent; color: var(--accent); font-weight: 600; }
.review-kind-switch button, .review-view-controls button, .bulk-scope button { min-height: 38px; flex: 1; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 600; }
.review-kind-switch button[aria-pressed="true"], .review-view-controls button[aria-pressed="true"], .bulk-scope button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.review-view-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.review-view-controls > div { flex: 1; }
.rule-field select { min-height: 38px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); color: var(--ink); font-size: 10px; }
.review-sort-control { position: relative; flex: 0 0 auto !important; }
.review-sort-trigger { min-width: 116px; min-height: 38px; display: grid; grid-template-columns: minmax(0,1fr) auto 14px; align-items: center; gap: 5px; padding: 0 9px 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); text-align: left; font-size: 10px; }
.review-sort-trigger b { color: var(--accent); font-size: 12px; }
.review-sort-trigger svg { width: 13px; height: 13px; transition: transform .16s ease; }
.review-sort-trigger[aria-expanded="true"] svg { transform: rotate(90deg); }
.review-sort-menu { position: absolute; z-index: 35; top: calc(100% + 5px); right: 0; width: 174px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); box-shadow: var(--shadow); }
.review-sort-menu button { width: 100%; min-height: 42px; display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 0 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; text-align: left; }
.review-sort-menu button:last-child { border-bottom: 0; }
.review-sort-menu button[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.review-sort-menu b { font-size: 12px; }
.review-search, .party-editor-search, .operations-search, .filter-search { background: var(--surface-soft) !important; box-shadow: none; }
.review-selection-bar { position: sticky; z-index: 16; top: 78px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin: 0 0 8px; padding: 8px; border-radius: 12px; background: var(--ink); color: #fff; }
.review-selection-bar button { min-height: 34px; border: 0; background: transparent; color: #fff; font-size: 10px; }
.review-selection-bar strong { text-align: center; font-size: 10px; }
.review-group-summary, .review-operation-row { position: relative; }
.review-swipe-row { background: transparent; }
.review-delete-action {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: 96px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 3px;
  padding: 4px;
  border: 0;
  background: #a43f34;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.review-delete-action svg { width: 17px; height: 17px; }
.review-group-summary, .review-operation-main { background: var(--bg); }
.review-selection-check { position: absolute; z-index: 5; top: 50%; left: 2px; width: 30px; height: 30px; transform: translateY(-50%); }
.review-selection-check input { position: absolute; opacity: 0; }
.review-selection-check span { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--muted); border-radius: 8px; background: var(--surface); }
.review-selection-check svg { width: 15px; opacity: 0; }
.review-selection-check input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.review-selection-check input:checked + span svg { opacity: 1; }
.selection-mode .review-group-toggle, .selection-mode .review-operation-main { padding-left: 40px; }
.review-screen.has-selection { padding-bottom: 76px; }
.review-bulk-action { position: fixed; z-index: 39; right: 17px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); left: 17px; max-width: 886px; margin: auto; padding: 0; }
.review-bulk-action button { width: 100%; min-height: 48px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; box-shadow: var(--shadow); }
.review-operation-value { display: grid; justify-items: end; }
.review-operation-value b.income { color: var(--income); }
.review-operation-value b.expense { color: #843c32; }
.bulk-review-summary, .adjustment-summary { display: flex; justify-content: space-between; gap: 12px; margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-soft); font-size: 11px; }
.bulk-scope { align-items: center; margin-bottom: 12px; }
.bulk-scope > span { min-width: 60px; color: var(--muted); font-size: 10px; }
.bulk-fields { overflow: visible; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.bulk-field { position: relative; }
.bulk-field + .bulk-field { border-top: 1px solid var(--line); }
.bulk-field-trigger { width: 100%; min-height: 48px; display: grid; grid-template: auto auto / minmax(0, 1fr) 16px; align-content: center; column-gap: 8px; padding: 6px 12px; border: 0; background: transparent; color: var(--ink); text-align: left; }
.bulk-field-trigger small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; line-height: 1.2; }
.bulk-field-trigger strong { min-width: 0; overflow: hidden; color: var(--ink); font-size: 10px; font-weight: 600; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.bulk-field-trigger strong.unset { color: var(--muted); font-weight: 500; }
.bulk-field-trigger svg { width: 14px; height: 14px; align-self: center; transform: rotate(90deg); transition: transform .16s ease; }
.bulk-field-trigger[aria-expanded="true"] svg { transform: rotate(-90deg); }
.bulk-field > .anchored-popover { right: 0; left: auto; width: min(328px, calc(100vw - 24px)); z-index: 35; }
.bulk-field > .bulk-popover {
  position: fixed;
  z-index: 110;
  top: var(--bulk-popover-top) !important;
  right: auto !important;
  bottom: auto !important;
  left: var(--bulk-popover-left) !important;
  transform: none;
}
.bulk-rule { min-height: 54px; display: flex; align-items: center; gap: 9px; margin: 12px 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.bulk-rule input { width: 18px; height: 18px; accent-color: var(--ink); }
.adjustment-expenses { display: grid; gap: 8px; max-height: 58vh; overflow: auto; }
.adjustment-expense { display: grid; grid-template-columns: 22px minmax(0,1fr) minmax(112px, 35%); align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.adjustment-expense > input { width: 18px; height: 18px; accent-color: var(--ink); }
.adjustment-expense strong, .adjustment-expense small { display: block; }
.adjustment-expense strong { font-size: 10px; }
.adjustment-expense small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.adjustment-amount { display: grid; gap: 3px; }
.adjustment-amount input { width: 100%; height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); text-align: right; }
.adjustment-amount b { color: var(--ink); font-size: 10px; font-weight: 600; text-align: right; }
.adjustment-save, .operation-adjustment-button, .rules-add { width: 100%; min-height: 46px; margin-top: 12px; border: 1px solid var(--ink); border-radius: 10px; background: transparent; color: var(--ink); font-size: 10px; font-weight: 600; }
.adjustment-save { background: var(--ink); color: #fff; }
.adjustment-save:disabled { opacity: .3; }
.operation-net-result { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--surface-soft); font-size: 10px; }
.operation-net-result span { display: grid; gap: 3px; }
.operation-net-result small { color: var(--text-muted); font-size: 10px; font-weight: 500; }
.category-delete-action { display: flex; align-items: center; justify-content: center; gap: 5px; }
.category-delete-action span { line-height: 1; }
.delete-action svg, .category-delete-action svg { width: 16px; height: 16px; }
.category-delete-action svg { flex: 0 0 auto; }
.operation-filters-reset { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-soft); color: var(--muted); font-size: 10px; }
.operation-filters-reset button { min-height: 34px; border: 0; background: transparent; color: var(--accent); font-weight: 600; }
.review-assignment-grid.fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rule-field[hidden] { display: none; }


.operations-route .app > header { padding-right: 17px; padding-left: 17px; }

@media(max-width:319px) {
  .operations-route .app > header, .operations-route main { padding-right: 8px; padding-left: 8px; }
  .operations-search { width: calc(100% - 16px); }
}

@media(min-width:760px) {
  .rule-swipe:hover .classification-rule { transform: translateX(-160px); }
  .app > header { padding-right: max(24px, calc((100vw - 1080px) / 2)); padding-left: max(24px, calc((100vw - 1080px) / 2)); }
  main { padding: 32px 28px 112px; }
  .operations-search { width: calc(100% - 56px); }
  .operations-route .app > header { padding-right: max(28px, calc((100vw - 920px) / 2 + 28px)); padding-left: max(28px, calc((100vw - 920px) / 2 + 28px)); }
  .operations-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 22px; align-items: start; }
  .operations-aside { position: sticky; top: 114px; display: block !important; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
  .operations-aside h2 { margin: 0 0 10px; font-size: 12px; }
  .operations-aside p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
  .operations-aside dl { margin: 18px 0 0; }
  .operations-aside div { display: flex; justify-content: space-between; gap: 12px; margin-top: 9px; }
  .operations-aside dt { color: var(--muted); font-size: 10px; }
  .operations-aside dd { margin: 0; font-size: 10px; font-weight: 600; }
  #panel { width: 370px; }
  .operation-detail { top: 23px !important; bottom: 0 !important; left: auto !important; width: min(460px, 46vw) !important; max-height: none; border-radius: 24px 0 0 0; animation: profile .2s ease !important; }
  #bottomNav { right: max(18px, calc((100vw - 720px) / 2)); bottom: 14px; left: max(18px, calc((100vw - 720px) / 2)); height: 68px; padding: 4px; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 10px 35px rgba(22, 39, 30, .12); }
  .settings-route main { padding-top: 40px; }
  .settings-group { border: 1px solid var(--line); }
  .settings-row { padding-right: 16px; padding-left: 16px; }
  .settings-screen { max-width: 700px; margin: 0 auto; }
  .settings-section { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 18px; align-items: start; }
  .settings-section > h2 { margin-top: 22px; }
}

.operations-route main { padding-top: 10px; }
.finance-work-route main { padding-bottom: calc(132px + env(safe-area-inset-bottom, 0px)); }

/* Review queue */
.review-screen { min-width: 0; }
.review-title-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; gap: 8px; margin-bottom: 10px; }
.review-heading { min-width: 0; margin: 0; }
.review-heading h1 { margin-bottom: 0; }
.review-header-menu { position: relative; }
.review-more { width: 32px; height: 32px; display: grid; place-items: center; padding: 4px 0 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: 21px; letter-spacing: 2px; line-height: 1; }
.review-more[aria-expanded="true"] { border: 0; background: transparent; color: var(--accent); }
.review-options-menu { position: absolute; z-index: 48; top: calc(100% + 6px); right: 0; width: min(342px, calc(100vw - 34px)); max-height: calc(100vh - 188px - env(safe-area-inset-bottom, 0px)); overflow-y: auto; overscroll-behavior: contain; padding: 6px 12px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); box-shadow: var(--shadow); }
.review-options-menu section { padding: 10px 0; border-bottom: 1px solid var(--line); }
.review-options-menu section:last-child { padding-bottom: 0; border-bottom: 0; }
.review-options-menu section > strong { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 600; }
.review-menu-buttons { display: grid; gap: 6px; }
.review-menu-buttons.columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.review-menu-buttons.columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.review-menu-buttons button { min-width: 0; min-height: 36px; padding: 0 7px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 600; }
.review-menu-buttons button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.review-sort-direction { margin-top: 6px; }
.review-search { height: 42px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 7px; margin-bottom: 12px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.review-search > label { min-width: 0; display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 8px; }
.review-search > label svg { width: 17px; height: 17px; color: var(--muted); }
.review-search input { min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; transform: scale(.75); transform-origin: left center; width: 133.3334%; }
.review-search span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.review-search-clear { width: 28px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--muted); }
.review-search-clear svg { width: 15px; height: 15px; }
.review-search-empty { padding: 28px 0; color: var(--muted); text-align: center; font-size: 10px; }
.review-groups { display: grid; gap: 12px; }
.review-groups.is-list { gap: 0; }
.review-group, .review-date-group { overflow: visible; border-bottom: 1px solid var(--line); background: transparent; }
.review-group:last-child, .review-date-group:last-child { border-bottom: 0; }
.review-group-summary { min-width: 0; }
.review-group-toggle { width: 100%; min-height: 54px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 2px; border: 0; background: transparent; text-align: left; }
.review-group-copy { min-width: 0; }
.review-group-copy strong, .review-group-copy small { display: block; overflow-wrap: anywhere; }
.review-group-copy strong { font-size: 12px; font-weight: 600; }
.review-group-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.3; }
.review-group-total { min-width: 100px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; text-align: right; }
.review-group-total strong { white-space: nowrap; font-size: 11px; }
.review-group-total strong.income, .review-operation-main > b.income { color: var(--income); }
.review-group-total strong.expense, .review-operation-main > b.expense { color: #843c32; }
.review-group-total svg { width: 15px; transition: transform .16s ease; }
.review-group-toggle[aria-expanded="true"] .review-group-total svg { transform: rotate(90deg); }
.review-assignment { position: relative; padding: 0 0 8px; }
.review-assignment-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 9px; }
.review-assignment-field { position: relative; min-width: 0; }
.review-assignment-field + .review-assignment-field { border-left: 1px solid var(--line); }
.review-assignment-field > button { width: 100%; min-width: 0; min-height: 30px; display: grid; grid-template-columns: minmax(0, 1fr) 14px; grid-template-rows: 1fr; align-items: center; padding: 0 7px; border: 0; background: rgba(248,246,241,.42); text-align: left; }
.review-assignment-field small, .review-assignment-field strong { min-width: 0; grid-column: 1; grid-row: 1; align-self: center; }
.review-assignment-field small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.review-assignment-field strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; line-height: 1.4; }
.review-assignment-field strong.unset { color: var(--muted); font-weight: 500; }
.review-assignment-field svg { width: 13px; height: 13px; grid-column: 2; grid-row: 1; align-self: center; justify-self: end; }
.review-assignment-field > .anchored-popover { top: calc(100% + 5px); left: 0; width: min(328px, calc(100vw - 24px)); z-index: 30; }
.review-assignment-field:nth-child(2) > .anchored-popover { --popover-anchor-x: -50%; left: 50%; }
.review-assignment-field:nth-child(3) > .anchored-popover { right: 0; left: auto; }
.review-assignment-actions { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.review-inline-rule { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.review-inline-rule input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--ink); }
.review-apply { position: relative; min-width: 76px; height: 28px; padding: 0 11px; border: 0; border-radius: var(--action-radius); background: var(--ink); color: #fff; font-size: 10px; font-weight: 600; }
.review-apply::before { content: ""; position: absolute; inset: -4px 0; }
.review-apply:disabled { opacity: .28; }
.review-rule-summary { min-height: 32px; display: flex; align-items: center; gap: 4px; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 10px; text-align: left; }
.review-rule-summary svg { width: 13px; height: 13px; transition: transform .16s ease; }
.review-rule-summary[aria-expanded="true"] svg { transform: rotate(90deg); }
.review-rule-conditions { grid-column: 1 / -1; }
.review-rule-builder { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 12px; padding: 7px 0 9px; }
.review-rule-if > strong, .review-rule-then > strong { display: block; margin-bottom: 5px; color: var(--accent); font-size: 10px; }
.review-rule-if label { min-height: 34px; display: flex; align-items: center; gap: 7px; border-bottom: 1px solid var(--line); }
.review-rule-if input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--ink); }
.review-rule-if span, .review-rule-if small, .review-rule-if b { display: block; min-width: 0; }
.review-rule-if small, .review-rule-then dt { color: var(--muted); font-size: 10px; }
.review-rule-if b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.review-rule-if .rule-description-condition { align-items: flex-start; padding: 5px 0; }
.rule-description-condition span { width: 100%; }
.rule-description-condition input[type="text"] { width: 100%; min-width: 0; height: 30px; margin-top: 3px; padding: 0 7px; border: 1px solid var(--line); border-radius: 7px; background: transparent; font-size: 10px; }
.operation-rule-card { margin-top: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.operation-rule-control { min-height: 46px; display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; }
.operation-rule-control > label { min-width: 0; min-height: 46px; display: flex; align-items: center; gap: 9px; padding: 0 12px; color: var(--muted); font-size: 10px; }
.operation-rule-control-copy { min-width: 0; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.operation-rule-control-copy > span { flex: 0 0 auto; }
.operation-rule-control-copy small { min-width: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; }
.operation-rule-control input[type="checkbox"], .operation-rule-condition > input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--ink); }
.operation-rule-control > button { width: 44px; height: 46px; display: grid; place-items: center; padding: 0; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--accent); }
.operation-rule-control > button svg { width: 14px; height: 14px; transition: transform .16s ease; }
.operation-rule-control > button[aria-expanded="true"] svg { transform: rotate(90deg); }
.operation-rule-settings { padding: 0 12px 12px; border-top: 1px solid var(--line); }
.operation-rule-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding-top: 10px; }
.operation-rule-columns section > strong { display: block; margin-bottom: 5px; color: var(--accent); font-size: 10px; }
.operation-rule-columns section > label, .operation-rule-condition { min-width: 0; min-height: 38px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.operation-rule-columns section > label:last-child { border-bottom: 0; }
.operation-rule-condition > input[type="checkbox"] { align-self: center; margin: 0; }
.operation-rule-columns label > span { min-width: 0; flex: 1; overflow: hidden; }
.operation-rule-condition > span { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 8px; }
.operation-rule-columns small { display: block; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.25; }
.operation-rule-columns input:not([type="checkbox"]), .operation-rule-columns select { width: 133.3334%; min-width: 0; height: 36px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; transform: scale(.75); transform-origin: left center; }
.operation-rule-picker-field { position: relative; min-width: 0; min-height: 44px; display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.operation-rule-picker-field:last-child { border-bottom: 0; }
.operation-rule-picker-field > button { min-width: 0; min-height: 44px; display: grid; grid-template-columns: minmax(0, 1fr) 15px; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: left; font-size: 10px; }
.operation-rule-picker-field > button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operation-rule-picker-field > button svg { width: 15px; height: 15px; color: var(--muted); }
.rule-kind-switch { min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.rule-kind-switch button { min-width: 0; min-height: 28px; padding: 0 5px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 10px; }
.rule-kind-switch button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 600; }
.review-rule-result-field { position: relative; border-bottom: 1px solid var(--line); }
.review-rule-result-field > button { width: 100%; min-height: 38px; display: grid; grid-template-columns: minmax(0, 1fr) 14px; padding: 5px 0; border: 0; background: transparent; text-align: left; }
.review-rule-result-field small, .review-rule-result-field b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-rule-result-field small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; }
.review-rule-result-field b { font-size: 10px; }
.review-rule-result-field svg { width: 13px; height: 13px; align-self: center; }
.review-rule-result-field > .anchored-popover { top: calc(100% + 4px); right: 0; width: min(328px, calc(100vw - 24px)); z-index: 35; }
.review-operation-list { margin-top: 2px; border-top: 1px solid var(--line); }
.review-operation-row { min-width: 0; border-bottom: 1px solid var(--line); }
.review-operation-row:last-child { border-bottom: 0; }
.review-operation-main { width: 100%; min-height: 70px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 2px 10px 14px; border: 0; background: var(--bg); text-align: left; }
.swipe-ready .classification-rule, .swipe-ready .category-tree-row { will-change: transform; backface-visibility: hidden; -webkit-tap-highlight-color: transparent; }
.rule-swipe.swipe-ready:not(.swipe-open) > .classification-rule,
.category-tree-swipe.swipe-ready:not(.swipe-open) > .category-tree-row { transform: translate3d(0, 0, 0); }
.swipe-dragging .classification-rule, .swipe-dragging .category-tree-row { transition: none !important; user-select: none; }
.review-operation-main > span { min-width: 0; }
.review-operation-main strong, .review-operation-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-operation-main strong { font-size: 10px; font-weight: 600; }
.review-bank-label { color: var(--muted); font-weight: 500; }
.review-operation-main small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.review-operation-main .review-operation-comment { display: flex; align-items: center; gap: 4px; margin-top: 4px; color: #485850; }
.review-operation-comment svg { width: 12px; height: 12px; flex: 0 0 12px; }
.review-operation-comment span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-operation-main > b { white-space: nowrap; font-size: 10px; font-weight: 600; }
.review-operation-editor { padding: 2px 2px 5px 14px; }
.review-operation-editor .review-assignment { padding-bottom: 2px; }
.popover-footer-action { width: 100%; display: block; padding: 0 12px; border-top: 1px solid var(--line); background: var(--surface-soft) !important; text-align: left; }
.party-popover > .popover-options { max-height: min(264px, calc(var(--popover-available-height, 320px) - 96px)); }
.party-editor > .popover-options { max-height: min(264px, calc(var(--popover-available-height, 368px) - 96px)); }
.review-editor-hero { padding: 4px 0 18px; border-bottom: 1px solid var(--line); }
.review-editor-hero small { color: var(--accent); font-size: 10px; font-weight: 600; }
.review-editor-hero h2 { margin: 6px 0; overflow-wrap: anywhere; font-size: 21px; }
.review-editor-hero p { margin: 0; color: var(--muted); font-size: 10px; }
.review-editor-fields { margin-top: 16px; }
.review-field-wrap .unset { color: var(--muted); font-weight: 500; }
.review-editor-hint { margin: 14px 2px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.review-continue { width: 100%; min-height: 48px; border: 0; border-radius: var(--action-radius); background: var(--ink); color: #fff; font-size: 10px; font-weight: 600; }
.review-continue:disabled { opacity: .34; cursor: not-allowed; }
.review-confirmation > small { color: var(--accent); font-size: 10px; font-weight: 600; }
.review-confirmation h2 { margin: 7px 0 3px; overflow-wrap: anywhere; font-size: 21px; }
.review-confirmation > p { margin: 0 0 20px; color: var(--muted); font-size: 10px; }
.review-confirmation dl { margin: 0; border-top: 1px solid var(--line); }
.review-confirmation dl div { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.review-confirmation dt { color: var(--muted); font-size: 10px; }
.review-confirmation dd { margin: 0; overflow-wrap: anywhere; text-align: right; font-size: 10px; font-weight: 600; }
.review-rule { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; }
.review-rule span { min-width: 0; }
.review-rule strong, .review-rule small { display: block; }
.review-rule strong { font-size: 11px; }
.review-rule small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.review-rule input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--ink); }
.review-rule-settings { min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 10px; font-weight: 600; }
.review-editor-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1.5fr; gap: 8px; margin-top: 18px; padding-top: 12px; background: var(--bg); }
.review-editor-actions button { min-height: 48px; border: 1px solid var(--line); border-radius: var(--action-radius); background: transparent; font-size: 10px; font-weight: 600; }
.review-editor-actions .primary { border-color: var(--ink); background: var(--ink); color: #fff; }
.review-editor .review-popover, .review-inline-popover, .party-popover, .category-popover { width: min(328px, calc(100vw - 24px)); max-width: calc(100vw - 24px); }
.classification-rules { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rule-swipe { position: relative; overflow: hidden; contain: paint; border-bottom: 1px solid var(--line); background: var(--danger); }
.rule-swipe:last-child { border-bottom: 0; }
.rule-swipe-actions { position: absolute; inset: 0 0 0 auto; width: 160px; display: grid; grid-template-columns: 1fr 1fr; }
.rule-swipe-actions button { border: 0; background: #78654c; color: #fff; font-size: 10px; font-weight: 600; }
.rule-swipe-actions .danger { background: var(--danger); }
.classification-rule { position: relative; z-index: 1; min-height: 96px; display: grid; grid-template-columns: minmax(0, 1fr) 52px; align-items: center; background: var(--bg); touch-action: pan-y; transition: transform .08s cubic-bezier(.2,.8,.2,1); }
.rule-swipe.swipe-open .classification-rule { transform: translateX(-160px); }
.rule-swipe.keyboard-open .classification-rule { transform: translateX(-160px); }
.rule-main { min-width: 0; min-height: 96px; display: block; padding: 12px 8px 12px 2px; border: 0; background: transparent; text-align: left; touch-action: pan-y; }
.rule-main strong, .rule-main small { display: block; overflow-wrap: anywhere; }
.rule-main strong { font-size: 12px; font-weight: 600; }
.rule-main small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.rule-toggle { position: relative; width: 52px; height: 52px; display: grid; place-items: center; cursor: pointer; }
.rule-toggle input { position: absolute; width: 36px; height: 22px; margin: 0; opacity: 0; cursor: pointer; }
.rule-toggle span { position: relative; width: 36px; height: 22px; border-radius: 12px; background: #bbb8b0; transition: background .16s ease; }
.rule-toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .16s ease; }
.rule-toggle input:checked + span { background: var(--ink); }
.rule-toggle input:checked + span::after { transform: translateX(14px); }
.rule-toggle input:focus-visible + span { outline: 3px solid rgba(155, 126, 86, .5); outline-offset: 2px; }
.rules-panel .panel-head [data-action="open-rules"] svg { transform: rotate(180deg); }
.rule-editor-panel { padding-top: 12px; }
.rule-editor-panel .panel-head { min-height: 44px; margin-bottom: 8px; }
.rule-editor-form { display: grid; gap: 0; }
.rule-editor-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.rule-editor-section { grid-column: 1 / -1; margin: 1px 2px -1px; color: var(--accent); font-size: 10px; }
.rule-field { min-width: 0; min-height: 44px; display: grid; align-content: center; overflow: hidden; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; }
.rule-field-full { grid-column: 1 / -1; }
.rule-field span { display: block; color: var(--muted); font-size: 10px; line-height: 1.1; }
.rule-field input { width: 123.0769%; min-width: 0; height: 27px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; line-height: 1; transform: scale(.8125); transform-origin: left center; }
.rule-field textarea { width: 100%; min-height: 72px; margin-top: 5px; padding: 0; resize: vertical; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: var(--type-control); line-height: 1.45; }
.rule-bank-titles-field > small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.rule-kind-field { display: grid; grid-template-rows: auto 1fr; gap: 3px; }
.rule-kind-field .rule-kind-switch { align-self: stretch; }
.rule-field:focus-within { outline: 2px solid rgba(155, 126, 86, .45); outline-offset: 1px; }
.rule-editor-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 8px; margin-top: 14px; }
.rule-editor-delete { min-height: 48px; border: 1px solid var(--line); border-radius: var(--action-radius); background: transparent; color: var(--danger); font-size: 10px; font-weight: 600; }
.rule-editor-links { margin-top: 9px; border-top: 1px solid var(--line); }
.rule-editor-links button { width: 100%; min-height: 44px; display: grid; grid-template-columns: minmax(0, 1fr) auto 14px; align-items: center; gap: 8px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; font-size: 10px; font-weight: 600; }
.rule-editor-links button:last-child { border-bottom: 0; }
.rule-editor-links b { color: var(--muted); font-size: 10px; font-weight: 500; }
.rule-editor-links svg { width: 14px; height: 14px; color: var(--muted); }
.history-detail-summary { margin-bottom: 10px; }
.history-detail-summary p { display: flex; align-items: baseline; gap: 5px; margin: 0; color: var(--muted); font-size: 10px; }
.history-detail-summary strong { color: var(--ink); font-size: 10px; font-weight: 600; }
.history-operation-list { display: grid; gap: 8px; max-height: min(58dvh, 560px); overflow-y: auto; overscroll-behavior: contain; }
.history-operation { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.history-operation-open { width: 100%; min-height: 44px; display: grid; grid-template-columns: minmax(0, 1fr) 14px; align-items: center; gap: 8px; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: left; }
.history-operation-open > span { display: grid; gap: 3px; }
.history-operation-open svg { width: 14px; height: 14px; color: var(--muted); }
.history-operation strong { overflow-wrap: anywhere; font-size: 10px; }
.history-operation small { color: var(--muted); font-size: 10px; }
.history-operation dl { margin: 8px 0 0; border-top: 1px solid var(--line); }
.history-operation dl div { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 8px; padding-top: 7px; }
.history-operation dt { color: var(--muted); font-size: 10px; }
.history-operation dd { margin: 0; overflow-wrap: anywhere; font-size: 10px; }
.history-undo-button { width: 100%; min-height: 46px; margin-top: 12px; border: 1px solid var(--danger); border-radius: var(--action-radius); background: transparent; color: var(--danger); font-size: 10px; font-weight: 600; }
.history-undone { color: var(--muted); text-align: center; font-size: 10px; }
.history-confirm-copy p, .rule-impact-copy p { color: var(--muted); font-size: 10px; line-height: 1.5; }
.history-confirm-copy > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.rule-impact-copy { display: grid; gap: 14px; }
.rule-impact-copy dl { margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rule-impact-copy dl > div { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rule-impact-copy dl > .rule-impact-lead { grid-template-columns: max-content minmax(0, 1fr); }
.rule-impact-copy .rule-impact-lead dt { white-space: nowrap; }
.rule-impact-copy dl > div:last-child { border-bottom: 0; }
.rule-impact-copy dt { color: var(--muted); font-size: 10px; }
.rule-impact-copy dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 10px; font-weight: 600; }
.rule-impact-copy .rule-impact-note { margin: 0; }
.rule-impact-copy > div { display: grid; grid-template-columns: 1fr; gap: 8px; }
.history-confirm-copy button, .rule-impact-copy button { min-height: 44px; border: 1px solid var(--line); border-radius: var(--action-radius); background: transparent; font-size: 10px; font-weight: 600; }
.history-confirm-copy button.danger { border-color: var(--danger); color: var(--danger); }
.rule-impact-copy button.primary { border-color: var(--ink); background: var(--ink); color: #fff; }
.rule-delete-confirm { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rule-delete-confirm p { grid-column: 1 / -1; }
.rule-delete-confirm button { min-height: 44px; border: 1px solid var(--line); border-radius: var(--action-radius); background: transparent; }
.rule-delete-confirm .danger { border-color: var(--danger); color: var(--danger); }

.finance-work-route .header-actions { grid-column: 3; }
.finance-work-route .app > header { padding-right: 17px; padding-left: 17px; }

@media(max-width:359px) {
  .review-assignment-field > button { padding-right: 5px; padding-left: 5px; }
  .review-assignment-field strong { font-size: 10px; }
  .review-inline-rule { font-size: 10px; }
}

@media(min-width:760px) {
  .review-screen { max-width: 920px; margin: 0 auto; }
  .review-group { padding: 0 12px; background: rgba(248,246,241,.45); }
  .review-group-toggle { padding-right: 0; padding-left: 0; }
  .review-assignment { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 14px; align-items: center; }
  .review-assignment-actions { justify-content: flex-end; }
  .review-rule-summary { grid-column: 1 / -1; }
  .review-operation-editor { padding-right: 0; }
  .review-editor { top: 23px !important; right: 0; bottom: 0 !important; left: auto !important; width: min(460px, 46vw) !important; max-height: none; border-radius: 24px 0 0 0; }
  .finance-work-route .app > header { padding-right: 17px; padding-left: 17px; }
}

/* Hierarchical category settings */
.category-tree { display: grid; }
.category-tree-node + .category-tree-node { border-top: 1px solid var(--line); }
.category-tree-swipe { position: relative; overflow: hidden; contain: paint; background: var(--danger); }
.category-delete-action { position: absolute; inset: 0 0 0 auto; width: 88px; border: 0; background: var(--danger); color: #fff; font-size: var(--type-control); font-weight: 600; }
.category-tree-row { position: relative; z-index: 1; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; padding-left: calc(var(--category-depth) * 18px); background: var(--bg); touch-action: pan-y; transition: transform .08s cubic-bezier(.2,.8,.2,1); }
.category-tree-swipe.swipe-open .category-tree-row, .category-tree-swipe.keyboard-open .category-tree-row { transform: translateX(-88px); }
.category-tree-main { min-width: 0; border: 0; }
.category-tree-toggle, .category-tree-add { display: grid; place-items: center; width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--muted); }
.category-tree-toggle svg { width: 16px; height: 16px; transition: transform .16s ease; }
.category-tree-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.category-tree-add { font-size: 21px; color: var(--accent); }
.category-tree-children { margin-left: 18px; border-left: 1px solid var(--line); }
.category-tree-add-row { width: 100%; min-height: 44px; padding: 0 16px 0 42px; border: 0; background: transparent; color: var(--accent); text-align: left; font-size: var(--type-control); font-weight: 600; }
.category-no-icon { font-style: normal; color: var(--muted); }

.category-active-control { display: flex !important; align-items: center; justify-content: space-between; min-height: 44px; }
.category-active-control > span:first-child { position: static; }
.category-budget-editor { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.category-budget-editor > .compact-input-shell { background: transparent; }
.category-budget-field { display: block; overflow: hidden; box-shadow: none; }
.category-budget-field input { min-width: 0; background: var(--surface-soft); }
.category-budget-field input:focus-visible { outline: 0; }
.category-budget-field:focus-within { outline: 2px solid rgba(155, 126, 86, .35); outline-offset: 1px; }
.category-budget-editor p { margin: 0; color: var(--muted); font-size: var(--type-body); }
.budget-effective { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, .55fr); gap: 8px; }
.budget-select-control { position: relative; min-width: 0; display: grid; gap: 4px; }
.budget-select-control > span { color: var(--muted); font-size: var(--type-meta); }
.budget-select-trigger { width: 100%; min-width: 0; min-height: 44px; display: grid; grid-template-columns: minmax(0, 1fr) 16px; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-align: left; font-size: var(--type-body); font-weight: 600; }
.budget-select-trigger svg { width: 14px; height: 14px; justify-self: end; transform: rotate(90deg); }
.budget-select-menu { position: absolute; z-index: 25; right: 0; bottom: calc(100% + 5px); left: 0; max-height: 208px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); }
.budget-select-menu button { width: 100%; min-height: 40px; padding: 0 9px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-size: var(--type-body); }
.budget-select-menu button[aria-selected="true"] { background: var(--surface-soft); color: var(--accent); font-weight: 600; }
.budget-effective-title { font-size: var(--type-meta); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.budget-history ul { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.budget-history li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.reference-form-error { margin: 0; color: var(--danger); font-size: 10px; }
.category-parent-label { margin: 0; color: var(--muted); font-size: 10px; }

/* Shared typography and panel controls */
.panel-head strong { font-size: var(--type-screen-title); }
.settings-row strong, .reference-row strong, .panel-row span { font-size: var(--type-row-title); }
.settings-row small, .reference-row small, .reference-editor-form > small { font-size: var(--type-meta); }
.reference-editor-form label span, .reference-field-label { font-size: var(--type-meta); }
.reference-editor-form input { font-size: var(--type-field-native); }
.reference-section-head button, .secondary-reference-action, .review-continue { font-size: var(--type-control); }
.panel-head [data-action="close"] { border: 0; border-radius: 0; background: transparent; color: var(--accent); }
.panel-head .panel-back { width: auto; flex: 0 0 auto; display: inline-flex; gap: 4px; padding: 0; background: transparent; border-radius: 0; color: var(--accent); font-size: var(--type-control); font-weight: 600; }
.panel-back svg { transform: rotate(180deg); width: 15px; height: 15px; }

.reference-editor-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 8px; }
.reference-editor-actions > .review-continue:only-child { grid-column: 1 / -1; }
.reference-delete { min-height: 48px; border: 1px solid var(--line); border-radius: var(--action-radius); background: transparent; color: var(--danger); font-size: var(--type-control); font-weight: 600; }
.reference-delete-confirm { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reference-delete-confirm p, .reference-delete-confirm small { grid-column: 1 / -1; }
.reference-delete-confirm small { color: var(--muted); font-size: var(--type-meta); line-height: 1.5; }
.reference-delete-confirm button { min-height: 44px; border: 1px solid var(--line); border-radius: var(--action-radius); background: transparent; }
.reference-delete-confirm .danger { border-color: var(--danger); color: var(--danger); }

/* One mobile surface for hierarchical categories and counterparties. */
.reference-picker-head { display: none; }

@media(max-width:759px) {
  #panel:has(.category-popover),
  #panel:has(.party-popover) { overflow: visible; }

  .anchored-popover.category-popover,
  .anchored-popover.party-popover {
    position: fixed !important;
    z-index: 180 !important;
    top: max(8px, env(safe-area-inset-top, 0px)) !important;
    right: 8px !important;
    bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
    left: 8px !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 0 0 100vmax rgba(16, 31, 24, .34), 0 16px 44px rgba(16, 31, 24, .22);
    transform: none !important;
  }

  .anchored-popover.category-popover.position-pending,
  .anchored-popover.party-popover.position-pending { visibility: hidden; }

  .reference-picker-head {
    min-height: 58px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 6px 7px 6px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }
  .reference-picker-head strong { overflow: visible; white-space: nowrap; padding-bottom: 2px; font-size: var(--type-screen-title); line-height: var(--type-screen-title-line); }
  .reference-picker-head button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--ink); }
  .reference-picker-head button svg { width: 20px; height: 20px; }

  .category-popover > .category-navigator,
  .party-popover > .party-editor,
  .party-popover > .party-filter-options {
    min-height: 0;
    height: 100%;
    max-height: none !important;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .category-popover .category-level-head,
  .party-popover .party-editor-search { flex: 0 0 auto; }

  .category-popover .popover-options,
  .party-popover .popover-options,
  .party-popover > .popover-options,
  .party-popover .party-editor > .popover-options {
    min-height: 0;
    max-height: none !important;
    flex: 1 1 auto;
    overflow-y: auto;
  }

  .category-popover .add-reference,
  .party-popover .popover-footer-action {
    position: static;
    flex: 0 0 auto;
    margin: 0;
    background: var(--surface);
  }
}

.reference-editor-form input::placeholder, .category-budget-editor input::placeholder { color: var(--muted); font-size: var(--type-field-native); opacity: 1; }
.category-budget-field input::placeholder { font-size: var(--type-control); }
.bank-account-row { grid-template-columns: 40px minmax(0, 1fr); }
.bank-account-inline-editor { min-height: 74px; display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; gap: 8px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.bank-account-inline-editor:last-child { border-bottom: 0; }
.bank-account-inline-editor > i { width: 40px; height: 40px; display: grid; place-items: center; font-style: normal; }
.bank-account-edit-copy { min-width: 0; }
.bank-account-edit-group { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 44px 44px; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); box-shadow: none; }
.bank-account-edit-group input { width: 133.3334%; min-width: 0; background: var(--surface-soft); font-size: 16px; transform: scale(.75); transform-origin: left center; }
.bank-account-edit-group:focus-within { outline: 2px solid rgba(155, 126, 86, .35); outline-offset: 1px; }
.bank-account-edit-group input:focus-visible { outline: 0; }
.bank-account-inline-editor small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: var(--type-meta); }
.bank-account-inline-actions { display: contents; }
.bank-account-inline-actions button { border-left: 1px solid var(--line); color: var(--accent); }
.bank-account-inline-actions button:first-child { color: var(--danger); }
.bank-account-inline-actions button + button { border-left: 1px solid var(--line); }
.bank-account-inline-actions svg { width: 18px; height: 18px; }
.bank-account-role-options { min-width: 0; display: grid; gap: 0; margin: 12px 0 2px; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.bank-account-role-options legend { margin-left: 10px; padding: 0 5px; color: var(--muted); font-size: var(--type-meta); }
.bank-account-role-option { min-height: 54px; display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-soft); cursor: pointer; }
.bank-account-role-option + .bank-account-role-option { border-top: 1px solid var(--line); }
.bank-account-role-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.bank-account-role-option span, .bank-account-role-option strong, .bank-account-role-option small { min-width: 0; display: block; }
.bank-account-role-option strong { font-size: var(--type-control); }
.bank-account-role-option small { margin-top: 2px; white-space: normal; line-height: 1.25; }
.system-status {
  position: fixed;
  z-index: 1000;
  right: 16px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid #985047;
  border-radius: 6px;
  background: #f8f6f1;
  color: #532d29;
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
}

.system-status[hidden] { display: none; }

.security-screen { display: grid; gap: 18px; }
.security-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.security-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px; border-bottom: 1px solid var(--line); }
.security-card-head h2 { margin: 0; font-size: 16px; }
.security-card-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 16px; }
.security-primary { min-height: 40px; padding: 0 13px; border: 0; border-radius: 6px; background: var(--ink); color: var(--surface); white-space: nowrap; font-size: 11px; font-weight: 600; }
.security-item { min-height: 66px; display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.security-item:last-child { border-bottom: 0; }
.security-item span { min-width: 0; flex: 1; }
.security-item strong, .security-item small { display: block; }
.security-item strong { font-size: 12px; }
.security-item small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.security-danger { min-height: 38px; padding: 0 10px; border: 1px solid #d4b9b4; border-radius: 6px; background: transparent; color: var(--danger); font-size: 10px; font-weight: 600; }
.security-empty, .security-loading { margin: 0; padding: 18px; color: var(--muted); font-size: 11px; line-height: 17px; }
.detail-field-readonly { cursor: default; }
.sync-history-row { cursor: default; }
.sync-history-row > i { color: var(--accent); }
.recovery-codes-once { padding: 18px; background: #f4efe3; }
.recovery-codes-once > strong { display: block; font-size: 12px; }
.recovery-codes-once pre { margin: 14px 0; font: 600 13px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; user-select: all; }
.recovery-codes-once button { min-height: 40px; padding: 0 13px; border: 1px solid var(--ink); border-radius: 6px; background: transparent; font-size: 11px; font-weight: 600; }
@media (max-width: 620px) {
  .security-card-head { display: grid; }
  .security-primary { width: 100%; }
  .security-item { align-items: flex-start; }
}
