:root {
  color-scheme: light;
  --ink: #101820;
  --muted: #667085;
  --paper: #f7f8fa;
  --panel: #ffffff;
  --line: #e1e4e8;
  --green: #1f8a5b;
  --blue: var(--brand-blue-ink);
  --red: #b3403b;
  --amber: #b87918;
  --mint: #e7f3ed;
  --sky: var(--brand-blue-tint);
  --rose: #f7e7e4;
  --gold: var(--brand-yellow);
  --shadow: 0 14px 34px rgba(16, 24, 32, 0.08);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

body:not([data-ready="true"]) .app-shell {
  display: none;
}

.load-status { padding: 40px 20px; text-align: center; }
.form-error { color: var(--red); overflow-wrap: anywhere; }
.form-error:empty { display: none; }
.scope-label { color: var(--muted); font-size: 13px; }
.logout-button { min-height: 44px; padding: 8px; background: white; border: 1px solid var(--line); border-radius: 8px; }
button:disabled { cursor: wait; opacity: 0.6; }
#current-user-name { font-size: 14px; }
#cafe-health { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
#cafe-health dd { margin: 0; }

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 18px 14px calc(88px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.topbar h1,
.pin-box h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 22px;
  box-shadow: var(--shadow);
}
.icon-button > svg { display: block; width: 22px; height: 22px; pointer-events: none; }
button { -webkit-tap-highlight-color: transparent; }
html[data-input-mode="pointer"] #money-board :is(button, [tabindex]):focus { outline: none; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#current-user-select {
  width: 122px;
  min-height: 46px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric-grid.compact {
  margin-top: 12px;
}

.metric,
.summary-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.metric span,
.health-band span,
.withdrawal-band span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.metric small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}

.accent-green {
  background: var(--mint);
  border-color: #c6dfd1;
}

.accent-blue {
  background: var(--sky);
  border-color: #cad9e8;
}

.accent-red {
  background: var(--rose);
  border-color: #e8cac6;
}

.health-band,
.withdrawal-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
  padding: 12px;
  background: #16212c;
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.health-band strong,
.withdrawal-band strong {
  font-size: 20px;
  overflow-wrap: anywhere;
}

.health-band span,
.withdrawal-band span {
  color: rgba(255, 255, 255, 0.72);
}

.quick-form,
.inline-form,
dialog form {
  margin: 10px 0 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.segmented button,
.tab-strip button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f7f2;
  color: var(--ink);
  font-size: 13px;
}

.segmented button.active,
.tab-strip button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.tab-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(82px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab-strip button {
  white-space: nowrap;
}

.analytics-panel {
  display: none;
}

.analytics-panel.active {
  display: block;
}

.form-grid,
.inline-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.inline-form.tall {
  grid-template-columns: 1fr;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 104, 168, 0.14);
}

.wide {
  grid-column: 1 / -1;
}

.primary-action,
.inline-form button,
dialog button {
  min-height: 43px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 0 14px;
  font-weight: 700;
}

.primary-action {
  width: 100%;
  margin-top: 10px;
}

.warning-line {
  margin: 10px 0 0;
  color: var(--red);
  font-weight: 700;
}

.keeper-board {
  margin: 10px 0 14px;
}

.board-row {
  margin-top: 10px;
}

.board-row h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.coin-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.account-rail {
  padding-bottom: 2px;
}

.section-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.coin-card,
.section-chip {
  display: grid;
  justify-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
}

.coin-card {
  align-content: start;
  gap: 7px;
  min-height: 134px;
  padding: 10px 6px 9px;
}

.section-chip {
  align-content: center;
  gap: 4px;
  min-height: 62px;
  padding: 8px 6px;
}

.coin-card.active,
.section-chip.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(16, 24, 32, 0.14), var(--shadow);
}

.coin-name {
  min-height: 32px;
  display: grid;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.coin-icon,
.account-icon {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
}

.coin-icon {
  width: 54px;
  height: 54px;
  background: linear-gradient(180deg, #8f9aaa, #667085);
  font-size: 16px;
}

.coin-card strong,
.section-chip strong {
  display: block;
  width: 100%;
  font-size: 16px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.section-chip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tone-masha {
  border-color: #efb6cb;
  background: #fff4f8;
}

.tone-masha .coin-icon {
  background: linear-gradient(180deg, #f47eaa, #d94c86);
}

.tone-nikita {
  border-color: #a8d8f4;
  background: #f1f9fe;
}

.tone-nikita .coin-icon {
  background: linear-gradient(180deg, #36c6f4, #1688cf);
}

.tone-tfamily {
  border-color: #c6b8f5;
  background: #f6f2ff;
}

.tone-tfamily .coin-icon {
  background: linear-gradient(180deg, #9d7cff, #6e4edb);
}

.tone-cafe {
  border-color: var(--brand-yellow-tint);
  background: var(--brand-yellow-tint);
}

.tone-cafe .coin-icon {
  background: var(--brand-yellow);
  color: var(--brand-yellow-symbol);
}

.tone-red .coin-icon {
  background: linear-gradient(180deg, #e77968, #bd423b);
}

.tone-neutral .coin-icon {
  background: linear-gradient(180deg, #8f9aaa, #667085);
}

.category-coin:not(.spent) .coin-icon {
  background: linear-gradient(180deg, #c8ced6, #aeb5be);
  color: #fff;
}

.coin-card.account-masha {
  border-color: #efb6cb;
  background: #fff4f8;
}

.coin-card.account-masha .coin-icon {
  background: linear-gradient(180deg, #f47eaa, #d94c86);
}

.coin-card.account-nikita {
  border-color: #a8d8f4;
  background: #f1f9fe;
}

.coin-card.account-nikita .coin-icon {
  background: linear-gradient(180deg, #36c6f4, #1688cf);
}

.coin-card.account-cafe {
  border-color: var(--brand-yellow-tint);
  background: var(--brand-yellow-tint);
}

.coin-card.account-cafe .coin-icon {
  background: var(--brand-yellow);
  color: var(--brand-yellow-symbol);
}

.coin-card.account-cash .coin-icon {
  background: linear-gradient(180deg, #8f9aaa, #667085);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-panel h2,
.section-head h2 {
  margin: 0 0 10px;
  font-size: 18px;
  letter-spacing: 0;
}

.summary-panel dl,
.entity-list dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 0;
  font-size: 14px;
}

.summary-panel dt,
.entity-list dt {
  color: var(--muted);
}

.summary-panel dd,
.entity-list dd {
  margin: 0;
  font-weight: 700;
}

.alert-panel {
  background: #fff8df;
  border-color: #ebd58a;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 128px 138px;
  gap: 8px;
  margin-bottom: 10px;
}

.table-list,
.entity-list {
  display: grid;
  gap: 8px;
}

.operation-row,
.entity-row,
.account-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.operation-row {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.operation-main {
  min-width: 0;
}

.operation-row h3,
.account-card h3,
.entity-row h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.operation-meta,
.account-card p,
.entity-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.amount {
  font-size: 16px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.amount.expense {
  color: var(--red);
}

.amount.income {
  color: var(--green);
}

.amount.transfer,
.amount.adjustment {
  color: var(--blue);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  grid-column: 1 / -1;
}

.row-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.account-card strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.account-card {
  justify-items: center;
  text-align: center;
}

.account-icon {
  width: 54px;
  height: 54px;
  margin-bottom: 2px;
  background: var(--blue);
  font-size: 17px;
}

.account-card.account-masha {
  border-color: #efb6cb;
  background: #fff4f8;
}

.account-card.account-masha .account-icon {
  background: linear-gradient(180deg, #f47eaa, #d94c86);
}

.account-card.account-nikita {
  border-color: #a8d8f4;
  background: #f1f9fe;
}

.account-card.account-nikita .account-icon {
  background: linear-gradient(180deg, #36c6f4, #1688cf);
}

.account-card.account-cafe {
  border-color: var(--brand-yellow-tint);
  background: var(--brand-yellow-tint);
}

.account-card.account-cafe .account-icon {
  background: var(--brand-yellow);
  color: var(--brand-yellow-symbol);
}

.account-card.account-cash .account-icon {
  background: linear-gradient(180deg, #8f9aaa, #667085);
}

.account-card.account-bank .account-icon {
  background: linear-gradient(180deg, #28c7ed, #1f8acb);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 10px;
}

.section-head.small-head {
  margin-top: 16px;
}

.section-head strong {
  font-size: 24px;
  overflow-wrap: anywhere;
}

.subtle {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.split-list,
.bar-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.split-item,
.bar-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.split-item {
  display: flex;
  justify-content: space-between;
}

.bar-item header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

.bar-track {
  height: 8px;
  border-radius: 8px;
  background: #ece8df;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.compact-row {
  box-shadow: none;
}

.year-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.year-month {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.year-month span {
  color: var(--muted);
  font-size: 12px;
}

.year-month strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.year-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.year-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.year-table th,
.year-table td {
  min-width: 74px;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.year-table th:first-child,
.year-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 168px;
  max-width: 188px;
  text-align: left;
  background: var(--panel);
  white-space: normal;
}

.year-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8f7f2;
  color: var(--muted);
  font-weight: 700;
}

.year-table thead th:first-child {
  z-index: 3;
}

.year-table tbody tr:last-child td {
  border-bottom: 0;
}

.year-row-label strong,
.year-row-label span {
  display: block;
}

.year-row-label span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.withdrawal-band {
  grid-template-columns: 1fr;
  background: #2b1f21;
}

.withdrawal-band strong {
  font-size: 30px;
}

#cafe-withdrawn-by {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#cafe-withdrawn-by span {
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.entity-row progress {
  width: 100%;
  height: 8px;
  accent-color: var(--blue);
}

dialog {
  width: min(420px, calc(100% - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(16, 24, 32, 0.45);
}

dialog form {
  display: grid;
  gap: 10px;
  margin: 0;
}

dialog menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  margin: 4px 0 0;
}

#edit-delete {
  background: var(--red);
}

#edit-cancel {
  background: #f0eee7;
  color: var(--ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 20;
  transform: translateX(-50%);
  width: min(440px, calc(100% - 28px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

.pin-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--paper);
}

.pin-box {
  width: min(360px, 100%);
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.app-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--gold);
  font-weight: 900;
  font-size: 28px;
}

.hidden {
  display: none !important;
}

/* Everyday entry stays within reach; long reports remain in their own view. */
h2 { font-size: 19px; line-height: 1.3; }
button, input, select { touch-action: manipulation; }
button:focus-visible { outline: 3px solid #287fc0; outline-offset: 3px; }
input, select { font-size: 16px; min-width: 0; }
.text-action { border: 0; background: transparent; color: #2b6397; min-height: 44px; padding: 6px; font-size: 14px; }
.section-head { gap: 12px; }
.section-head h2 { margin: 0; }
.personal-balances { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.person-balance { display: grid; gap: 9px; padding: 16px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: white; min-width: 0; }
.person-balance.tone-masha { border-top: 4px solid #e276ac; }
.person-balance.tone-nikita { border-top: 4px solid #54ade1; }
.person-balance strong { font-size: 24px; overflow-wrap: anywhere; }
.person-balance small { color: var(--muted); min-height: 34px; line-height: 1.4; }
.setup-band { border-block: 1px solid var(--line); padding: 16px 0; margin-bottom: 20px; }
.setup-band h2 { margin: 0; }
.setup-band p { color: var(--muted); margin: 8px 0; font-size: 14px; }
.setup-band .primary-action { width: auto; padding: 0 18px; }
.category-board { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.category-board .coin-card { border: 0; background: transparent; box-shadow: none; min-height: 128px; padding: 6px 2px; }
.category-board .coin-name { order: 1; height: 34px; line-height: 1.2; font-size: 13px; overflow-wrap: anywhere; }
.category-board .coin-icon { order: 0; }
.category-board small { order: 2; font-size: 11px; color: var(--muted); }
.upcoming-strip { border-bottom: 1px solid var(--line); margin-bottom: 20px; padding-bottom: 12px; }
.upcoming-row { display: flex; gap: 16px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.upcoming-row small { display: block; margin-top: 6px; color: var(--muted); }
.upcoming-row strong { text-align: right; overflow-wrap: anywhere; }
.more-links { display: grid; }
.more-links button { text-align: left; padding: 20px 6px; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.history-filters { margin: 14px 0; }
summary { cursor: pointer; padding: 12px 0; font-size: 14px; color: #42556b; }
.app-shell { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.saved-bar { position: fixed; bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 24px)); display: flex; align-items: center; gap: 10px; z-index: 18; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; }
.saved-bar span { flex: 1; }
.saved-bar button { min-height: 44px; border: 0; background: transparent; color: #2b6397; }
dialog { width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 0; border-radius: 8px; border: 1px solid var(--line); }
dialog form, .quick-form { margin: 0; padding: 20px; border: 0; border-radius: 0; box-shadow: none; }
dialog form > label { margin: 12px 0; }
dialog .icon-button { flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; background: transparent; color: var(--ink); box-shadow: none; font-size: 25px; line-height: 1; }
dialog .section-head { margin-top: 0; }
.segmented { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segmented button { padding: 8px; color: var(--ink); background: #f0f2f5; font-weight: 500; }
.amount-input input { height: 64px; font-size: 30px; font-weight: 600; }
fieldset { border: 0; margin: 20px 0 0; padding: 0; min-width: 0; }
legend { font-size: 15px; font-weight: 600; }
.favorite-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.favorite-choices label { display: flex; align-items: center; min-height: 44px; gap: 8px; color: var(--ink); }
.favorite-choices input { width: 18px; min-height: 18px; flex: 0 0 18px; }
.favorite-choices span { overflow-wrap: anywhere; }
.setup-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 18px; }
.tab-strip { grid-template-columns: repeat(4, minmax(65px, 1fr)); }
@media (max-width: 600px) {
  dialog { width: 100%; max-width: none; margin: auto 0 0; max-height: 92dvh; border-radius: 8px 8px 0 0; }
  dialog form { padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
  .category-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .person-balance { padding: 12px; }
  .person-balance strong { font-size: 21px; }
  .topbar h1 { font-size: 28px; }
}

@media (max-width: 720px) {
  .app-shell {
    padding-inline: 10px;
  }

  .toolbar,
  .form-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .coin-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .section-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .health-band {
    grid-template-columns: 1fr;
  }

  .year-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .topbar h1 {
    font-size: 30px;
  }

  .metric strong,
  .section-head strong {
    font-size: 21px;
  }

  .coin-grid {
    gap: 8px;
  }

  .coin-card {
    min-height: 126px;
  }

  .coin-icon {
    width: 50px;
    height: 50px;
  }
}

.category-board .coin-name { font-weight: 500; word-break: normal; }
.category-board .coin-icon { background: #f0e8f9; color: #77579f; box-shadow: none; }
.category-board .category-coin.tone-tfamily .coin-icon { background: #f0e8f9; color: #77579f; }
.category-board .category-coin.tone-masha .coin-icon { background: #f9e3ef; color: #a74178; }
.category-board .category-coin.tone-nikita .coin-icon { background: #e0f1fb; color: #287aac; }
.category-board .category-coin.tone-cafe .coin-icon { background: var(--brand-yellow); color: var(--brand-yellow-symbol); }
.category-board .coin-icon svg { width: 25px; height: 25px; stroke-width: 1.8; }
.money-board { --flow-color: #435361; --flow-tint: #eef1f4; --flow-fill: #617888; --flow-symbol: #fff; --flow-edge: #d1dbe1; }
html:has(.dashboard-header), body:has(.dashboard-header) { background: #fafbfe; }
.app-shell:has(.dashboard-header) { --board-gutter: 14px; }
.money-board .account-lane { background: #fff; margin-inline: calc(-1 * var(--board-gutter)); padding-inline: var(--board-gutter); }
.catalog-toolbar { display: flex; align-items: center; gap: 2px; min-width: 0; }
#board-period { display: inline-flex; align-items: center; justify-content: center; gap: 5px; width: 140px; min-width: 0; min-height: 44px; padding: 4px; background: transparent; color: var(--ink); border: 0; border-radius: 6px; font-size: 12px; }
#board-period span { overflow-wrap: normal; text-align: center; line-height: 16px; }
#board-period svg { width: 18px; height: 18px; flex: 0 0 18px; }
#board-period-form { display: grid; gap: 12px; }
#board-period-form h2 { font-size: 18px; }
#board-period-dates { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
#board-period-dates input { width: 100%; min-width: 0; box-sizing: border-box; }
#board-period-error { display: flex; align-items: center; gap: 8px; color: #a52c36; font-size: 13px; }
.catalog-tool { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); padding: 8px; }
.catalog-tool svg { width: 19px; height: 19px; }
.catalog-tool[aria-pressed="true"] { background: #e4f3e9; border-color: #408556; }
.flow-holding .flow-icon { transform: scale(1.06); outline: 2px solid currentColor; outline-offset: 3px; }
.custom-owner-tab.flow-holding { outline: 2px solid currentColor; outline-offset: -3px; }
.catalog-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 5px; max-height: 240px; overflow-y: auto; overscroll-behavior-y: contain; padding: 2px; }
.catalog-icons button { min-width: 0; height: 44px; padding: 8px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); }
.catalog-icons button[aria-pressed="true"] { border-color: #287aac; background: #e0f1fb; }
.catalog-icons svg, #catalog-icon-preview svg, .account-icon svg { width: 24px; height: 24px; }
.catalog-icon-heading { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.catalog-actions { position: sticky; bottom: 0; background: white; padding-top: 10px; }
#catalog-main-actions, .catalog-confirm-buttons { display: flex; align-items: center; gap: 10px; }
.catalog-confirm-buttons button { flex: 1; min-height: 44px; }
#catalog-delete-question { font-size: 14px; overflow-wrap: anywhere; }
#catalog-delete-accept { background: #b32632; color: white; }
.catalog-actions .primary-action { flex: 1; margin: 0; }
#catalog-delete { color: #b32632; flex: 0 0 44px; height: 44px; }
#catalog-delete svg { width: 20px; height: 20px; }
.custom-emoji { font-size: 26px; line-height: 1; }
.money-lane .section-head h2 { flex: 1; }
.money-lane .section-head .catalog-tool { flex: 0 0 40px; width: 40px; height: 40px; }
.money-board .tone-masha { --flow-color: var(--brand-pink-ink); --flow-tint: var(--brand-pink-tint); --flow-fill: var(--brand-pink); --flow-edge: var(--brand-pink-tint); }
.money-board .tone-nikita { --flow-color: var(--brand-blue-ink); --flow-tint: var(--brand-blue-tint); --flow-fill: var(--brand-blue); --flow-edge: var(--brand-blue-tint); }
.money-board .tone-tfamily { --flow-color: var(--brand-purple-ink); --flow-tint: var(--brand-purple-tint); --flow-fill: var(--brand-purple); --flow-edge: var(--brand-purple-tint); }
.money-board .tone-cafe { --flow-color: var(--brand-yellow-ink); --flow-tint: var(--brand-yellow-tint); --flow-fill: var(--brand-yellow); --flow-symbol: var(--brand-yellow-symbol); --flow-edge: var(--brand-yellow-tint); }
.money-lane { padding: 6px 0; border-bottom: 1px solid #e9edf0; }
.money-lane .section-head { margin: 0; min-height: 22px; }
.money-lane .section-head .text-action { min-height: 32px; }
.money-lane h2 { font-size: 16px; font-weight: 600; color: #25303b; }
.owner-tabs { display: flex; gap: 4px; margin-bottom: 4px; }
.owner-tabs button { position: relative; flex: 1; min-width: 0; min-height: 40px; padding: 4px; border: 0; border-radius: 6px; color: var(--flow-color); background: transparent; font-size: 13px; }
.owner-tabs button::after { content: ''; position: absolute; bottom: 0; left: 50%; width: 24px; transform: translateX(-50%); height: 2px; background: transparent; border-radius: 2px; }
.owner-tabs button[aria-pressed="true"]::after { display: none; }
.owner-tabs button[aria-pressed="true"] { font-weight: 600; color: var(--flow-color); background: var(--flow-tint); }
.owner-tabs button:not([aria-pressed="true"]) .section-total { color: #38444f; }
.analytics-filter { display: grid; gap: 12px; margin-bottom: 16px; }
.analytics-filter > label { max-width: 320px; }
.analytics-filter > .primary-action { margin: 0; max-width: 320px; }
.analytics-sections { border: 0; padding: 0; margin: 0; min-width: 0; }
.analytics-sections legend { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
#analytics-section-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px 12px; max-width: 620px; }
.analytics-sections .analytics-check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; color: var(--ink); }
.analytics-check input { width: 18px; height: 18px; min-height: 0; margin: 0; flex: 0 0 18px; accent-color: #267a9f; }
.analytics-check span { overflow-wrap: anywhere; }
#analytics-dates { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; align-items: end; }
#analytics-dates label, #analytics-dates input { width: 100%; min-width: 0; box-sizing: border-box; }
#analytics-dates button { grid-column: 1 / -1; }
.analytics-metrics-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; }
.analytics-metrics-head h3, .analytics-forecast h3 { font-size: 16px; margin: 0; }
.analytics-unit { display: flex; flex-shrink: 0; border-bottom: 1px solid var(--line); }
.analytics-unit button { min-height: 44px; padding: 8px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--ink); }
.analytics-unit button[aria-pressed="true"] { border-bottom-color: #267a9f; font-weight: 600; }
.analytics-forecast { margin: 20px 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.analytics-forecast dl { display: grid; grid-template-columns: minmax(70px,1fr) minmax(0,2fr); gap: 10px; }
.analytics-forecast dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-weight: 600; }
#view-analytics .metric { box-shadow: none; }
#view-analytics .metric strong { font-size: 20px; }
#view-analytics .metric span { min-height: 32px; }
#view-analytics .metric strong, #year-net { overflow-wrap: anywhere; }
#view-analytics .section-head { align-items: baseline; }
.owner-row { display: flex; gap: 2px; min-width: 0; align-items: center; }
.owner-row .owner-tabs { flex: 1; min-width: 0; margin-bottom: 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.owner-row .owner-tabs::-webkit-scrollbar { display: none; }
.owner-row .owner-tabs button { flex: 1 0 auto; min-width: 55px; white-space: nowrap; display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 44px; }
.owner-row .owner-tabs .custom-owner-tab { flex: 1 0 auto; max-width: 140px; }
.custom-owner-tab > span { display: block; overflow: hidden; text-overflow: ellipsis; }
.owner-add { flex: 0 0 32px; width: 32px; height: 44px; min-width: 0; padding: 4px; border: 0; background: transparent; color: #798590; }
.owner-add svg { width: 20px; height: 20px; }
.owner-add[hidden] { display: none; }
#board-group-form { display: grid; gap: 12px; }
.section-total { font-size: 12px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.expense-rail { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.expense-page { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); grid-template-rows: repeat(var(--expense-rows, 3),103px); gap: 6px; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; }
.expense-page .flow-node { height: 103px; }
.flow-accounts, .income-rail { display: grid; gap: 8px; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 116px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: 0; scrollbar-width: thin; }
.flow-accounts > button, .income-rail > button { scroll-snap-align: start; }
.flow-accounts:focus-visible, .income-rail:focus-visible, .expense-rail:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.flow-add-income { cursor: pointer; }
.flow-add-account { cursor: pointer; --flow-tint: #eef1f3; --flow-color: #46515a; }
#account-form { display: grid; gap: 14px; }
#account-form .primary-action { position: sticky; bottom: 0; }
.flow-node { display: flex; align-items: center; flex-direction: column; gap: 3px; padding: 3px 2px; min-width: 0; min-height: 103px; height: 103px; border: 2px solid transparent; border-radius: 8px; color: var(--ink); background: transparent; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.flow-icon { display: grid; place-items: center; width: 56px; height: 56px; flex: 0 0 56px; border-radius: 50%; background: var(--flow-fill); color: var(--flow-symbol); box-shadow: 0 3px 0 var(--flow-edge); transition: transform 140ms ease, background-color 140ms ease; }
.flow-icon svg { width: 29px; height: 29px; stroke-width: 1.8; }
.flow-name { font-size: 12px; font-weight: 400; line-height: 15px; height: 15px; min-height: 15px; flex-shrink: 0; width: calc(100% + 6px); white-space: nowrap; text-align: center; }
.flow-node small { font-size: 12px; color: var(--muted); }
.flow-node .flow-amount { font-size: 13px; line-height: 18px; height: 18px; flex-shrink: 0; width: 100%; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: center; color: var(--flow-color); font-weight: 600; }
.flow-node .amount-zero { color: var(--flow-color); font-weight: 600; }
.flow-node .amount-pending { color: #73808b; font-weight: 400; }
.flow-account { height: 117px; }
.flow-debt { --flow-color: #b03b48; --flow-tint: #fff0f2; }
.flow-debt .flow-icon { color: #b03b48; background: #fff0f2; border: 1px solid #d8949c; }
.flow-debt.first-debt { border-left: 1px solid #d5dce0; border-radius: 0; }
.flow-debt .flow-name { overflow: hidden; text-overflow: ellipsis; width: 100%; }
#debt-payment-dialog, #debt-spending-dialog { width: min(440px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
#debt-payment-form, #debt-spending-form { display: grid; gap: 14px; }
#debt-payment-form input[name="amount"], #debt-spending-form input[name="amount"] { font-size: 30px; font-variant-numeric: tabular-nums; }
.debt-payment-preview { margin: 0; font-size: 14px; }
.debt-payment-preview div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 6px 0; }
.debt-payment-preview dd { margin: 0; font-weight: 600; }
#debt-payment-name, #debt-spending-name { margin: 0; overflow-wrap: anywhere; }
#debt-reconcile-dialog { width: min(440px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; background: #fff; }
#debt-reconcile-dialog > details { padding: 0 16px 20px; }
#debt-reconcile-form { display: grid; gap: 12px; }
#debt-reconcile-form p { margin: 0; overflow-wrap: anywhere; }
#debt-reconcile-form input[name="actual_balance"] { font-size: 28px; }
#debt-reconcile-history article { padding: 10px 0; border-bottom: 1px solid #d5dce0; overflow-wrap: anywhere; }
.flow-account .unconfirmed { font-size: 10px; line-height: 12px; }
.flow-add-account .flow-icon, .flow-add-income .flow-icon, .flow-add-expense .flow-icon { margin-top: 18px; }
.flow-add-account .flow-icon, .flow-add-income .flow-icon, .flow-add-expense .flow-icon { background: transparent; border: 1px solid #d3dbe1; color: #627480; box-shadow: none; }
.flow-add-account .flow-icon svg, .flow-add-income .flow-icon svg, .flow-add-expense .flow-icon svg { width: 24px; height: 24px; }
.flow-node:focus-visible, .owner-tabs button:focus-visible, .owner-add:focus-visible { outline: 2px solid var(--flow-color, #28756a); outline-offset: -2px; }
.flow-node.selected { border-color: var(--flow-color); background: var(--flow-tint); }
.flow-node.available { border-color: #b7c3cb; border-style: dashed; }
.flow-node.drop-target { border-color: var(--flow-color); border-style: solid; background: var(--flow-tint); }
.flow-node:active { cursor: grabbing; }
.flow-selection { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; padding: 6px 0; }
.flow-selection span { flex: 1; overflow-wrap: anywhere; }
.flow-selection button { width: 40px; height: 40px; border: 0; background: transparent; color: var(--ink); }
.flow-selection svg { width: 18px; }
.flow-ghost { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -120%); padding: 10px 14px; max-width: 250px; background: #17232d; color: white; border-radius: 8px; box-shadow: var(--shadow); font-size: 14px; }
.money-dragging { overscroll-behavior: none; }
.money-route { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; margin: 4px 0 12px; }
#quick-dialog[data-compact="true"] .segmented { display: none; }
.amount-keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.amount-keypad button { height: 48px; padding: 4px; display: grid; place-items: center; border: 0; border-radius: 6px; background: #f1f3f5; color: var(--ink); font-size: 24px; box-shadow: none; }
.amount-keypad button:active { background: #dce3e9; }
.amount-keypad svg { width: 24px; }
#amount-sign { min-height: 40px; padding: 4px 12px; border: 1px solid var(--line); background: white; color: var(--ink); }
#quick-form .primary-action { position: sticky; bottom: 0; margin-top: 8px; }
#quick-form .amount-input input { text-align: right; font-size: 32px; font-variant-numeric: tabular-nums; }
#quick-form #payer-preview { margin: 10px 0 0; }
.saved-bar { flex-wrap: wrap; gap: 4px 10px; }
.saved-bar span { min-width: 120px; }
@media (max-width: 600px) {
  .flow-accounts, .income-rail { grid-auto-columns: calc((100% - 18px) / 4); gap: 6px; }
  .money-lane { display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 4px; padding: 4px 0; }
  .money-lane .section-head { grid-column: 1; grid-row: 1; align-items: center; margin-bottom: 0; }
  .expense-lane .section-head { align-items: center; }
  .money-lane h2 { font-size: 14px; white-space: nowrap; }
  .money-lane .owner-row { grid-column: 2; grid-row: 1; margin-bottom: 0; }
  #expense-sections button { padding-inline: 0; }
  #expense-sections button > span { white-space: nowrap; }
  .money-lane .income-rail, .money-lane .flow-accounts, .money-lane .expense-rail { grid-column: 1 / -1; }
  #quick-dialog[data-compact="true"] form { padding-top: 12px; }
}
.topbar { gap: 4px; margin-bottom: 0; }
.topbar-title { display: flex; align-items: center; gap: 4px; min-width: 0; }
.topbar-title h1 { font-size: 20px; line-height: 1.2; overflow-wrap: anywhere; }
.topbar-title .icon-button { flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center; box-shadow: none; border: 0; background: transparent; }
.top-actions { min-width: 0; }
.topbar .catalog-tool { border: 0; background: transparent; }
.topbar .catalog-tool[aria-pressed="true"] { background: var(--mint); }
@media (max-width: 360px) {
  #board-period { width: 118px; font-size: 11px; }
  .topbar-title h1 { font-size: 18px; }
}
.app-wordmark { color: var(--muted); font-size: 14px; }
.topbar.dashboard-header { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; gap: 4px; min-height: 48px; border-bottom: 1px solid #e9edf0; background: #fff; margin-inline: calc(-1 * var(--board-gutter)); padding-inline: var(--board-gutter); }
.dashboard-header #page-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#board-header-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; width: 100%; max-width: 420px; margin: 0 auto; min-width: 0; }
#board-header-summary[hidden] { display: none; }
#board-header-summary > div { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; }
#board-header-summary span { font-size: 11px; line-height: 14px; color: var(--muted); }
#board-header-summary strong { max-width: 100%; font-size: 16px; line-height: 20px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
#board-total-income, #board-total-expense { color: #17232d; }
.dashboard-header #board-period { width: 44px; height: 44px; padding: 8px; background: transparent; border: 0; border-radius: 8px; }
.dashboard-header #board-period span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.dashboard-header #board-period svg { width: 22px; height: 22px; flex-basis: 22px; }
html.pwa-board { --flow-row-height: 103px; }
html.pwa-board:not(.pwa-board-scroll), html.pwa-board:not(.pwa-board-scroll) body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.pwa-board .app-shell { padding-top: calc(4px + env(safe-area-inset-top)); padding-bottom: calc(4px + env(safe-area-inset-bottom)); min-height: 100dvh; }
.pwa-board:not(.pwa-board-scroll) .app-shell { height: 100dvh; overflow: hidden; }
.pwa-board:not(.pwa-board-scroll) #view-dashboard, .pwa-board:not(.pwa-board-scroll) .topbar { touch-action: pan-x pinch-zoom; }
.pwa-board .owner-tabs { margin-bottom: 0; }
.pwa-board .expense-page { grid-template-rows: repeat(var(--expense-rows), var(--flow-row-height)); }
.pwa-board .income-rail, .pwa-board .flow-accounts, .pwa-board .expense-rail { scrollbar-width: none; }
.pwa-board .income-rail::-webkit-scrollbar, .pwa-board .flow-accounts::-webkit-scrollbar, .pwa-board .expense-rail::-webkit-scrollbar { display: none; }
html.pwa-board-compact { --flow-row-height: 91px; }
.pwa-board-compact .money-lane { display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 4px; padding: 1px 0; }
.pwa-board-compact .money-lane .section-head { grid-column: 1; grid-row: 1; }
.pwa-board-compact .money-lane h2 { font-size: 14px; }
.pwa-board-compact .owner-row { grid-column: 2; grid-row: 1; }
.pwa-board-compact .income-rail, .pwa-board-compact .flow-accounts, .pwa-board-compact .expense-rail { grid-column: 1 / -1; }
.pwa-board-compact .flow-node { min-height: 91px; height: 91px; }
.pwa-board-compact .flow-account { height: 105px; }
.pwa-board-compact .flow-icon { width: 44px; height: 44px; flex-basis: 44px; }
.pwa-board-compact .flow-icon svg { width: 25px; height: 25px; }
.pwa-board-compact .flow-selection { padding: 0; }
body.navigation-open { overflow: hidden; }
dialog.navigation-drawer {
  position: fixed; inset: 0 auto 0 0; margin: 0; width: min(336px, calc(100% - 32px));
  max-width: none; height: 100%; height: 100dvh; max-height: none; border: 0; border-radius: 0;
  padding: calc(16px + env(safe-area-inset-top)) 20px calc(12px + env(safe-area-inset-bottom));
  background: var(--panel); color: var(--ink); overflow-y: auto; overscroll-behavior: contain;
}
dialog.navigation-drawer[open] { display: flex; flex-direction: column; box-shadow: 12px 0 48px #152c3826; animation: drawer-enter 160ms ease-out; }
.navigation-drawer::backdrop { background: #162d3b55; backdrop-filter: blur(3px); }
.navigation-drawer > * { flex-shrink: 0; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 32px; }
.drawer-brand { display: flex; align-items: center; gap: 10px; }
.drawer-brand > img { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.drawer-brand > svg { width: 26px; height: 26px; color: #25303b; stroke-width: 1.8; }
.drawer-head strong { font-size: 28px; font-weight: 650; }
.drawer-head .icon-button { box-shadow: none; display: grid; place-items: center; width: 44px; height: 44px; background: transparent; border: 0; color: #77828d; }
.drawer-profile { display: flex; gap: 12px; align-items: center; min-width: 0; flex: 1; }
.drawer-avatar { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: var(--brand-pink-tint); color: var(--brand-pink-ink); }
.drawer-profile > div { display: grid; gap: 3px; min-width: 0; }
.drawer-profile small { font-size: 11px; color: var(--muted); }
.drawer-profile #current-user-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.drawer-section-label { margin: 0 12px 8px; color: #737e89; font-size: 12px; font-weight: 500; }
.drawer-tools-title { margin-top: 24px; }
.drawer-links { display: grid; gap: 4px; }
.drawer-links button, .drawer-logout { position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; width: 100%; padding: 12px; border: 0; border-radius: 6px; background: transparent; color: #3e4e59; text-align: left; font-size: 15px; font-weight: 500; line-height: 1.4; }
.drawer-links svg, .drawer-logout svg, .drawer-profile svg { width: 22px; height: 22px; flex-shrink: 0; }
.drawer-links button:hover, .drawer-logout:hover { background: var(--paper); }
.drawer-links button > svg { width: 34px; height: 34px; padding: 7px; border-radius: 50%; background: var(--brand-pink); color: #fff; stroke-width: 1.8; }
.drawer-links [data-view="operations"] > svg, .drawer-links #drawer-reconcile > svg { background: var(--brand-blue); }
.drawer-links [data-view="analytics"] > svg, .drawer-links [data-view="settings"] > svg { background: var(--brand-purple); }
.drawer-links [data-view="debts"] > svg { background: var(--brand-yellow); color: var(--brand-yellow-symbol); }
.drawer-links button.active { background: var(--brand-pink-tint); color: var(--brand-pink-ink); font-weight: 600; }
.drawer-links button.active > svg { background: var(--brand-pink); color: #fff; }
.drawer-footer { display: flex; align-items: center; gap: 12px; margin-top: auto; padding: 20px 4px 4px; border-top: 1px solid var(--line); }
.drawer-tools { padding-bottom: 24px; }
.drawer-logout { width: 44px; height: 44px; min-height: 44px; flex: 0 0 44px; justify-content: center; padding: 10px; color: #677683; }
.drawer-links button:focus-visible, .drawer-logout:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
@keyframes drawer-enter { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  dialog.navigation-drawer[open] { animation: none; }
  .flow-icon { transition: none; }
}
@media (hover: hover) {
  .flow-node:not(.selected):hover .flow-icon { transform: translateY(-2px); }
  .owner-tabs button:not([aria-pressed="true"]):hover { background: #edf1f4; border-radius: 6px; }
  .owner-add:hover, #open-navigation:hover, #board-period:hover { background: #edf1f4; }
}
@media (min-width: 601px) {
  .money-lane { display: grid; grid-template-columns: 76px minmax(0,1fr); column-gap: 12px; padding: 12px 0; }
  .money-lane .section-head { grid-column: 1; grid-row: 1; align-items: center; }
  .money-lane .owner-row { grid-column: 2; grid-row: 1; }
  .money-lane .income-rail, .money-lane .flow-accounts, .money-lane .expense-rail { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .app-shell:has(.dashboard-header) { --board-gutter: 10px; }
  .category-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .segmented { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
