:root {
  --bg: #f4f6f2;
  --surface: #ffffff;
  --text: #18201c;
  --muted: #68736d;
  --line: #dfe5e0;
  --accent: #2f6b4f;
  --accent-soft: #e3f0e8;
  --warning: #fff4cf;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; }

.topbar {
  min-height: 68px; padding: 0 max(24px, calc((100vw - 1120px) / 2));
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); display: inline-flex; align-items: center; gap: 11px; }
.brand > img { width: 40px; height: 40px; flex: 0 0 auto; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { font-size: 19px; letter-spacing: -.02em; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .04em; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.topbar-actions form { margin: 0; }
.icon-link { font-size: 20px; }
.text-button { border: 0; background: none; color: var(--muted); cursor: pointer; }
.main-nav {
  height: 52px; padding: 0 max(24px, calc((100vw - 1120px) / 2));
  display: flex; gap: 28px; align-items: end; background: var(--surface); border-bottom: 1px solid var(--line);
}
.main-nav a, .main-nav span { padding: 0 2px 14px; color: var(--muted); font-weight: 650; }
.main-nav .active { color: var(--accent); border-bottom: 3px solid var(--accent); }
.main-nav span { opacity: .48; cursor: not-allowed; }
.page-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 72px; }
.family-badge { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 7px 11px 7px 7px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; font-size: 13px; font-weight: 750; }
.family-badge img { width: 26px; height: 26px; }

h1 { margin: 6px 0 10px; font-size: clamp(26px, 3.2vw, 34px); line-height: 1.15; letter-spacing: -.025em; text-wrap: balance; }
h2 { margin: 0; font-size: 20px; }
.lead { color: var(--muted); font-size: 16px; line-height: 1.55; max-width: 670px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.muted, small { color: var(--muted); }

.button { border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 750; cursor: pointer; }
.button.primary { color: white; background: var(--accent); box-shadow: 0 6px 20px rgba(47,107,79,.18); }
.button.secondary { color: var(--text); background: #edf0ee; }
.button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.full-width { grid-column: 1 / -1; }

.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 34px; }
.compact-hero h1 { margin-bottom: 8px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.summary-card, .panel, .auth-card, .onboarding-card, .settings-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 36px rgba(38,54,45,.05);
}
.summary-card { min-height: 174px; padding: 24px; display: flex; flex-direction: column; }
.summary-card span { color: var(--muted); font-weight: 650; }
/* Сумма — на одном уровне во всех карточках: сразу под подписью, а не прижата к низу
   (иначе пояснение «из них … ожидаем возврат» поднимает её). Пояснения и ссылки идут
   сразу под суммой: нет пояснения — ссылка стоит прямо под ней. */
.summary-card span { min-height: 1.4em; }
.summary-card strong { margin: 28px 0 4px; font-size: 34px; line-height: 1.15; }
.summary-card > small + small { margin-top: 4px; }
.summary-amounts { margin: auto 0 4px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.summary-amounts strong { margin: 0; font-size: 26px; }
.accent-card { background: var(--accent-soft); border-color: #c9dfd1; }
.negative-card { background: #fdf1ef; border-color: #edc8c1; }
.negative-card strong, .negative-value { color: #9b3f35; }
.negative-card a { color: #8f463d; }
.totals-banner > .negative-card { margin: -20px -24px -20px 0; padding: 20px 24px; border-width: 0 0 0 1px; border-radius: 0 var(--radius) var(--radius) 0; }
.content-grid { margin-top: 16px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.panel { padding: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel-heading > span { color: var(--muted); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.checklist li { display: flex; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.checklist li > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #edf0ee; font-weight: 750; }
.checklist li.done > span { color: white; background: var(--accent); }
.checklist li div { display: flex; flex-direction: column; gap: 3px; }
.settings-preview dl { margin: 0; }
.settings-preview dl div { display: flex; justify-content: space-between; padding: 16px 0; border-top: 1px solid var(--line); }
.settings-preview dt { color: var(--muted); }
.settings-preview dd { margin: 0; font-weight: 750; }

.auth-card, .settings-card { max-width: 500px; margin: 22px auto; padding: 28px; }
.onboarding-card { max-width: 760px; margin: 10px auto; padding: 38px; }
.settings-card.settings-wide, .family-editor-card { max-width: 820px; }
.step { display: inline-flex; padding: 7px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 750; }
.stacked-form { display: grid; gap: 13px; margin-top: 20px; }
.two-column-form { grid-template-columns: 1fr 1fr; }
.two-column-form > p { align-self: start; }
.two-column-form > p > label { min-height: 48px; display: flex; align-items: flex-end; line-height: 1.2; }
.stacked-form p { margin: 0; display: grid; gap: 7px; }
/* form.as_div: подсказки-списки (пароль) допустимы только в div, не в p.
   Django ставит подсказку над полем — визуально переносим её под поле, как в as_p. */
:is(.stacked-form, .stacked-form > fieldset) > div:not([class]) { display: grid; gap: 7px; }
:is(.stacked-form, .stacked-form > fieldset) > div:not([class]) > label { order: 1; }
:is(.stacked-form, .stacked-form > fieldset) > div:not([class]) > :is(input, select, textarea, .password-field, .custom-select) { order: 2; }
:is(.stacked-form, .stacked-form > fieldset) > div:not([class]) > .errorlist { order: 3; }
:is(.stacked-form, .stacked-form > fieldset) > div:not([class]) > .helptext { order: 4; }
.stacked-form label { font-weight: 700; }
.stacked-form input, .stacked-form select, .stacked-form textarea { width: 100%; padding: 12px 13px; color: var(--text); background: #fbfcfb; border: 1px solid #cfd7d1; border-radius: 10px; }
.stacked-form select {
  min-height: 50px;
  padding-right: 54px;
  appearance: none;
  -webkit-appearance: none;
  background-color: #fbfcfb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 7.5 5 5 5-5' fill='none' stroke='%235b665f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 18px 18px;
}
.custom-select { position: relative; width: 100%; }
.custom-select-native {
  position: absolute !important; width: 1px !important; height: 1px !important;
  margin: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none;
}
.custom-select-trigger {
  width: 100%; min-height: 50px; padding: 12px 16px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; color: var(--text); background: #fbfcfb;
  border: 1px solid #cbd5ce; border-radius: 12px; text-align: left; cursor: pointer;
  box-shadow: 0 1px 2px rgba(24,32,28,.03); transition: border-color .15s, box-shadow .15s, background .15s;
}
.custom-select-trigger:hover { border-color: #9fb5a8; background: #fff; }
.custom-select-trigger:focus-visible, .custom-select.is-open .custom-select-trigger {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #d7e9df;
}
.custom-select-trigger svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: #5b665f; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.custom-select.is-open .custom-select-trigger svg { transform: rotate(180deg); }
.custom-select-menu {
  position: absolute; z-index: 80; top: calc(100% + 7px); left: 0; right: 0; max-height: 300px;
  overflow-y: auto; padding: 7px; background: #fff; border: 1px solid #cbd5ce; border-radius: 14px;
  box-shadow: 0 18px 48px rgba(24,32,28,.18), 0 4px 12px rgba(24,32,28,.08);
}
.custom-select-option {
  width: 100%; padding: 11px 12px; display: flex; align-items: center; gap: 10px;
  color: var(--text); background: transparent; border: 0; border-radius: 9px; text-align: left; cursor: pointer;
}
.custom-select-option:hover, .custom-select-option:focus-visible { outline: none; background: #edf5f0; }
.custom-select-option.is-selected { color: var(--accent); background: var(--accent-soft); font-weight: 750; }
.custom-select-option.is-selected::after { content: "✓"; margin-left: auto; }
.custom-select.is-disabled .custom-select-trigger { color: var(--muted); background: #eef2ef; cursor: not-allowed; }
.custom-select.is-invalid .custom-select-trigger { border-color: #a33c32; box-shadow: 0 0 0 3px #f7ded9; }
.two-column-form input,
.two-column-form select { min-height: 50px; }
.stacked-form input:focus, .stacked-form select:focus, .stacked-form textarea:focus { outline: 3px solid #d7e9df; border-color: var(--accent); }
.stacked-form textarea { display: block; min-height: 104px; line-height: 1.5; resize: vertical; }
.stacked-form textarea::placeholder, .stacked-form input::placeholder { color: #9aa49e; }
.stacked-form input:disabled { color: var(--text); background: #eef2ef; cursor: not-allowed; opacity: 1; }
.password-field { position: relative; display: block; }
.password-field input { display: block; width: 100%; padding-right: 48px; }
.password-toggle { position: absolute; z-index: 2; top: 50%; right: 10px; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; transform: translateY(-50%); border: 0; border-radius: 8px; color: #69736e; background: transparent; cursor: pointer; }
.password-toggle svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.password-toggle:hover { background: var(--accent-soft); }
.password-toggle:focus-visible { outline: 3px solid #b9d8c7; }
.stacked-form .helptext,
.stacked-form .helptext ul { color: var(--muted); font-size: 13px; line-height: 1.45; font-weight: 400; }
.stacked-form .helptext ul { margin: 0; padding-left: 18px; }
.stacked-form .helptext li { margin: 1px 0; }
.stacked-form ul.errorlist { margin: 0; padding-left: 18px; color: #a33c32; }
.success-message { padding: 12px 14px; color: var(--accent); background: var(--accent-soft); border-radius: 10px; font-weight: 700; }
.settings-section { margin: 0; padding: 0 0 24px; border: 0; border-bottom: 1px solid var(--line); }
.settings-section + .settings-section { padding-top: 10px; }
.settings-section legend { margin-bottom: 14px; padding: 0; font-size: 20px; font-weight: 800; }
.section-help { margin: -5px 0 14px; color: var(--muted); line-height: 1.5; }
.family-group { display: grid; gap: 12px; }
.family-group + .family-group { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.family-group-heading p { margin: 5px 0 0; color: var(--muted); line-height: 1.45; }
.member-list { display: grid; gap: 12px; }
.member-form { display: grid; grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfb; }
.member-form-icon { width: 42px; height: 50px; margin-top: 22px; display: grid; place-items: center; font-size: 22px; }
.member-field { display: grid; gap: 6px; }
.member-field label { color: var(--muted); font-size: 12px; }
.delete-member { min-height: 50px; margin-top: 22px; display: flex; align-items: center; }
.delete-member input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.delete-member-button { padding: 9px 10px; color: #8b4a40; background: transparent; border: 0; border-radius: 9px; font-weight: 700; cursor: pointer; }
.delete-member-button:hover { background: #f8e3df; }
.member-form.is-deleted { border-style: dashed; background: #f5f7f5; }
.remove-member { width: 38px; height: 50px; margin-top: 22px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 10px; font-size: 25px; cursor: pointer; }
.remove-member:hover { color: #8b4a40; background: #f8e3df; }
.add-member { justify-self: start; }
.onboarding-actions { justify-content: space-between; }

.income-list { display: grid; gap: 12px; }
.totals-banner { margin-bottom: 20px; padding: 20px 24px; display: flex; justify-content: space-between; gap: 24px; background: var(--accent-soft); border: 1px solid #c9dfd1; border-radius: var(--radius); }
.totals-banner > div { display: flex; flex-direction: column; gap: 6px; }
.totals-banner span { color: var(--muted); font-size: 14px; font-weight: 650; }
.totals-banner strong { font-size: 24px; }
.other-currency-totals { align-items: flex-end; }
.other-currency-totals strong { font-size: 18px; }
.other-currency-totals strong small { color: var(--muted); font-size: 12px; font-weight: 650; }
.totals-banner small { color: var(--muted); }
.rate-warning { margin: -8px 0 20px; color: #97462d; font-size: 14px; }
.site-footer { max-width: 1240px; margin: 8px auto 28px; padding: 0 24px; color: var(--muted); font-size: 12px; text-align: right; }
.site-footer a { color: var(--accent); }
.dashboard-incomes { margin-top: 16px; }
.dashboard-incomes .panel-heading { align-items: flex-start; }
.dashboard-incomes .panel-heading p { margin: 5px 0 0; }
.income-row { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
.income-icon { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; color: var(--accent); background: var(--accent-soft); font-size: 24px; font-weight: 800; }
.income-icon-extra { color: #836416; background: var(--warning); }
.income-icon-receivable { color: #8b4a40; background: #f8e3df; }
.income-icon-expense { color: #9a4c25; background: #f8e3df; }
.expense-pill { color: #8b4a40; background: #f8e3df; }
.income-main { min-width: 0; flex: 1; }
.income-title-row { display: flex; justify-content: space-between; gap: 18px; align-items: baseline; }
.income-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.income-title-row h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-hint {
  position: relative; flex: 0 0 auto; display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 8px; color: var(--muted); cursor: help;
}
.note-hint:hover, .note-hint:focus-visible { color: var(--accent); background: var(--accent-soft); outline: none; }
.note-hint svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.note-bubble {
  position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 20;
  width: max-content; max-width: min(320px, 80vw); padding: 10px 12px; border-radius: 10px;
  color: #fff; background: #1f2a24; box-shadow: 0 8px 24px rgba(24,32,28,.18);
  font-size: 13px; font-weight: 500; line-height: 1.45; white-space: pre-line; text-align: left;
  opacity: 0; visibility: hidden; transform: translate(-50%, 4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  pointer-events: none;
}
.note-bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #1f2a24;
}
.note-hint:hover .note-bubble, .note-hint:focus .note-bubble { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.income-title-row strong { white-space: nowrap; font-size: 20px; }
.income-meta { display: grid; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.pill { padding: 3px 8px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.attention { color: #9a4c25; font-weight: 700; }
.income-edit { margin-left: auto; font-weight: 700; }
.empty-state { padding: 50px 24px; text-align: center; background: var(--surface); border: 1px dashed #c7d0ca; border-radius: var(--radius); }
.empty-state-icon { width: 58px; height: 58px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 18px; color: var(--accent); background: var(--accent-soft); font-size: 26px; font-weight: 800; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { max-width: 520px; margin: 0 auto 24px; color: var(--muted); line-height: 1.5; }
.income-explainer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.income-explainer article { display: flex; flex-direction: column; gap: 7px; padding: 18px; border-radius: 14px; background: #e9eeea; }
.income-explainer span { color: var(--muted); font-size: 14px; line-height: 1.45; }
.form-page { max-width: 720px; margin: 0 auto; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.back-link { display: inline-block; margin-bottom: 28px; font-weight: 700; }
.income-form { margin-top: 32px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.report-table { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
.report-table strong { text-align: right; }
.report-header { color: var(--muted); font-size: 13px; }
.report-balance { color: var(--accent); font-size: 17px; }
.report-balance .negative-value { color: #9b3f35; }

.expected-note { color: #97462d; font-weight: 650; }
.period-switcher { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; flex-wrap: wrap; }
.period-switcher .button { padding: 10px 16px; }
.period-switcher-title { display: flex; flex-direction: column; min-width: 180px; }
.period-switcher-title strong { font-size: 20px; }
.period-today { font-weight: 650; }
.rate-note { margin: 12px 0 0; font-size: 14px; }
.currency-details { margin-top: 20px; padding: 20px 24px; }
.currency-details > summary { display: flex; align-items: baseline; gap: 12px; cursor: pointer; list-style: none; }
.currency-details > summary::-webkit-details-marker { display: none; }
.currency-details > summary::before { content: "▸"; color: var(--muted); }
.currency-details[open] > summary::before { content: "▾"; }
.currency-details > summary h2 { margin: 0; font-size: 18px; }
.currency-details .report-grid { margin-top: 16px; }

.access-card h2 { margin: 0 0 12px; }
.access-card h3 { margin: 20px 0 8px; font-size: 16px; }
.access-list { list-style: none; margin: 0 0 16px; padding: 0; }
.access-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.access-list li form { margin-left: auto; }
.inline-form { margin-bottom: 16px; }
.invite-link-box { margin: 0 0 16px; padding: 16px; border-radius: 12px; background: var(--accent-soft); }
.invite-link-box p { margin: 0 0 10px; }
.invite-form .invite-link-box { margin: 0; }
.invite-link-box .invite-link-label { margin: 0 0 8px; font-weight: 700; }
.invite-link-box .helptext { display: block; margin: 8px 0 0; }
.invite-link-box.is-loading .invite-link { opacity: .45; }
.invite-email-note { color: var(--muted); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }
.invite-link-row {
  align-items: center; gap: 6px; padding: 6px 6px 6px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.invite-link {
  flex: 1; min-width: 0; display: block; color: var(--text);
  font: 600 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all;
}
.copy-icon-button {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  border: 0; border-radius: 10px; color: var(--muted); background: #edf0ee; cursor: pointer;
  transition: background .15s, color .15s;
}
.copy-icon-button:hover { color: var(--text); background: #e2e7e4; }
.copy-icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.copy-icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.copy-icon-button .icon-done { display: none; }
.copy-icon-button.is-copied, .copy-icon-button.is-copied:hover { color: #fff; background: var(--accent); }
.copy-icon-button.is-copied .icon-copy { display: none; }
.copy-icon-button.is-copied .icon-done { display: block; }
/* Статус «скопировано» — только для экранных чтецов, визуально его заменяет галочка. */
.copy-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.joined-badge {
  padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700;
  color: var(--accent); background: var(--accent-soft);
}

.income-meta { align-items: start; }
.plan-chips { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px; background: #f7f9f7;
  color: #3e4943; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip-icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.chip-kind { border-color: transparent; font-weight: 700; }
.chip-kind-regular { color: var(--accent); background: var(--accent-soft); }
.chip-kind-extra { color: #7a5c12; background: var(--warning); }
.chip-kind-receivable { color: #8b4a40; background: #f8e3df; }
.chip-kind-expense { color: #9a4c25; background: #f8e3df; }
.chip-person { padding-left: 3px; }
.avatar {
  width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  color: #fff; background: var(--accent); font-size: 11px; font-weight: 800;
}
.avatar-family { background: #8a968f; }
.avatar-family svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; }
.chip-waiting { color: #97462d; background: #fff1ea; border-color: #f3d2c3; }
.chip-muted { color: var(--muted); border-style: dashed; }

.end-mode {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; width: fit-content;
  border: 1px solid #cfd7d1; border-radius: 12px; background: #f1f4f2;
}
.end-mode button {
  height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 700; cursor: pointer;
}
.end-mode button:hover { color: var(--text); }
.end-mode button.is-active { color: var(--accent); background: var(--surface); box-shadow: 0 1px 3px rgba(24,32,28,.12); }
.end-mode button:focus-visible { outline: 3px solid #d7e9df; }
.end-note { display: block; margin: 0; color: var(--muted); font-size: 14px; }
.end-note strong { color: var(--text); }

.amount-mode { display: grid; gap: 7px; }
.amount-mode[hidden] { display: none; }
.amount-mode-label { font-weight: 700; }

.chip-month { height: 24px; color: var(--accent); background: var(--accent-soft); border-color: transparent; }

.analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; align-items: start; }
.analytics-panel .panel-heading { align-items: flex-start; }
.analytics-panel .panel-heading p { margin: 4px 0 0; }
.text-danger { color: #a33c32; }
.progress, .bar { height: 8px; border-radius: 999px; background: #e9eeea; overflow: hidden; }
.progress i, .bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.progress { margin: 4px 0 14px; }
.payment-list, .category-bars, .unplanned ul { list-style: none; margin: 0; padding: 0; }
.payment { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.payment-mark { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; font-weight: 800; font-size: 14px; color: var(--muted); background: #eef2ef; }
.payment-paid .payment-mark, .payment-over .payment-mark { color: #fff; background: var(--accent); }
.payment-partial .payment-mark { color: #7a5c12; background: var(--warning); }
.payment-overdue .payment-mark { color: #fff; background: #c2533f; }
.payment-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.payment-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payment-overdue .payment-main small { color: #a33c32; font-weight: 650; }
.payment-paid .payment-amount, .payment-over .payment-amount { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(104,115,109,.45); }
.payment-amount { white-space: nowrap; font-weight: 700; }
.category-bar { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.category-bar-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.category-bar-head span:first-child { font-weight: 700; }
.category-bar-head span:last-child { color: var(--muted); white-space: nowrap; }
.bar-near .bar i { background: #d8a530; }
.bar-done .bar i { background: var(--accent); }
.bar-done .category-bar-head span:last-child { color: var(--accent); font-weight: 700; }
.bar-over .bar i { background: #c2533f; }
.bar-unplanned .bar i { background: repeating-linear-gradient(45deg, #b9c3bd 0 6px, #cfd7d1 6px 12px); }
.category-bar small { font-size: 13px; font-weight: 650; }
.unplanned { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.unplanned h3 { margin: 0 0 6px; font-size: 15px; }
.unplanned li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 14px; }

.fact-totals > div:last-child { align-items: flex-end; }

.flash-list { display: grid; gap: 8px; margin-bottom: 16px; }
.demo-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 12px 16px; border-radius: 12px; background: #fdf3dc; color: #5c4210; }
.demo-banner p { margin: 0; }
.flash { margin: 0; padding: 12px 14px; border-radius: 10px; font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.flash-error { color: #a33c32; background: #fbe6e2; }
.quick-pay { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.quick-pay .button { padding: 8px 12px; font-size: 14px; box-shadow: none; white-space: nowrap; }
.quick-pay-other { display: inline-flex; gap: 4px; }
.quick-pay-other input { width: 130px; padding: 8px 10px; border: 1px solid #cfd7d1; border-radius: 10px; background: #fbfcfb; font: inherit; font-size: 14px; }
.more-link { display: inline-block; margin-top: 10px; font-weight: 650; font-size: 14px; }

.fact-payments { margin: 20px 0; }
.section-title { margin: 24px 0 12px; font-size: 20px; }

.chip-done { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.chip-overdue { color: #fff; background: #c2533f; border-color: transparent; }
.chip-overdue .chip-icon { opacity: 1; }
.receivable-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.receivable-actions form { display: inline-flex; gap: 6px; }
.receivable-actions.is-overdue { padding: 8px 10px; border-radius: 12px; background: #fdf0ec; }
.receivable-hint { margin-right: 4px; color: #a33c32; font-size: 14px; font-weight: 700; }
.chip-button-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.chip-button-primary:hover { color: #fff; }
.chip-button { height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #f7f9f7; color: var(--accent); font-size: 13px; font-weight: 700; cursor: pointer; }
.chip-button:hover { border-color: var(--accent); }

.attention-panel { margin-top: 20px; border-color: #f1cfc5; background: #fffaf8; }
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-top: 1px solid #f3ddd6; }
.attention-list li > div:first-child { flex: 1 1 320px; }
.attention-list .receivable-actions { margin-top: 0; }
.attention-link { display: inline-flex; align-items: center; }
.dashboard-analytics { margin-bottom: 20px; }

.end-mode a {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 9px;
  color: var(--muted); font-size: 14px; font-weight: 700;
}
.end-mode a:hover { color: var(--text); }
.end-mode a.is-active { color: var(--accent); background: var(--surface); box-shadow: 0 1px 3px rgba(24,32,28,.12); }
.list-period .end-mode { margin-right: 8px; }
/* Последний платёж — не тревога, а напоминание: янтарный, а не красный «просрочено». */
.chip-last { color: #7a5c12; background: var(--warning); border-color: transparent; }
.chip-last .chip-icon { opacity: 1; }

.button.danger { color: #fff; background: #b8432f; box-shadow: none; }
.button.danger:hover { background: #a33c2a; }
.danger-link { margin-right: auto; align-self: center; color: #a33c32; font-weight: 700; }
.confirm-consequences { margin: 0 0 20px; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); }
.confirm-page .form-actions { justify-content: flex-end; }
.undo-form { display: inline; }
.undo-button { border: 0; background: none; padding: 0 0 0 8px; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; text-decoration: underline; cursor: pointer; }
.undo-button:hover { color: #a33c32; }

.budgets-row { margin-top: 20px; }
.budget-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 0 24px; }
.budget { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
.budget-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.budget-numbers { white-space: nowrap; font-weight: 700; font-size: 14px; }
.budget-note { font-size: 13px; color: var(--muted); }
.budget-near .bar i { background: #d8a530; }
.budget-over .bar i { background: #c2533f; }
.budget-over .budget-numbers { color: #a33c32; }
.chip-kind-budget { color: #2f5d7a; background: #e2eef6; }

.row-actions { justify-self: end; display: inline-flex; align-items: center; gap: 16px; }
.row-actions .income-edit { margin-left: 0; }
.row-actions .danger-link { margin: 0; font-size: 14px; }
.confirm-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 24px 60px rgba(24,32,28,.25); }
.confirm-dialog::backdrop { background: rgba(24,32,28,.45); }
.confirm-dialog form { padding: 24px; }
.confirm-dialog h2 { margin: 0 0 10px; font-size: 20px; line-height: 1.3; }
.confirm-dialog p { margin: 0 0 10px; color: var(--muted); line-height: 1.45; }
.confirm-dialog-warning { font-weight: 700; color: #a33c32 !important; }
.confirm-dialog .form-actions { margin-top: 18px; }

/* Аналитика. Цвета серий проверены валидатором dataviz: план #2a78d6, факт #1baf7a. */
:root { --series-plan: #2a78d6; --series-fact: #1baf7a; --series-saving: #d8a530; }
.analytics-cards { margin-top: 4px; }
.chart-panel, .table-panel { margin-top: 20px; }
.chart-legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 16px; font-size: 14px; color: var(--muted); }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.swatch-plan { background: var(--series-plan); }
.swatch-fact { background: var(--series-fact); }
.swatch-saving { background: var(--series-saving); }
.bar-chart { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 12px; }
.bar-chart-axis { display: flex; flex-direction: column; justify-content: space-between; height: 220px; padding-bottom: 24px; font-size: 12px; color: var(--muted); text-align: right; }
.bar-chart-plot {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 6px; height: 220px;
  background: linear-gradient(to top, transparent 23px, var(--line) 23px, var(--line) 24px, transparent 24px),
              repeating-linear-gradient(to top, transparent 0 48px, #eef1ee 48px 49px);
  background-position: 0 0, 0 -24px;
}
.bar-col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; color: inherit; text-decoration: none; border-radius: 8px; }
.bar-col:hover, .bar-col:focus-visible { background: rgba(47,107,79,.06); outline: none; }
.bar-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 12%; }
.bar-v { display: block; width: 50%; max-width: 18px; min-height: 0; border-radius: 4px 4px 0 0; }
.bar-plan { background: var(--series-plan); }
.bar-fact { background: var(--series-fact); }
.bar-col.is-future .bar-plan { opacity: .45; }
.bar-label { height: 24px; line-height: 24px; font-size: 12px; color: var(--muted); }
.chart-tip {
  position: absolute; bottom: calc(100% - 20px); left: 50%; transform: translateX(-50%); z-index: 5;
  display: none; flex-direction: column; gap: 3px; width: max-content; padding: 8px 10px; border-radius: 10px;
  background: #1f2a24; color: #fff; font-size: 12px; box-shadow: 0 8px 24px rgba(24,32,28,.2); pointer-events: none;
}
.chart-tip span { display: inline-flex; align-items: center; gap: 6px; }
.bar-col:hover .chart-tip, .bar-col:focus-visible .chart-tip { display: flex; }
.table-scroll { overflow-x: auto; margin-top: 8px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 9px 10px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.data-table thead th { border-top: 0; color: var(--muted); font-weight: 650; font-size: 13px; }
.data-table th[scope="row"], .data-table thead th:first-child { text-align: left; }
.data-table tbody th { font-weight: 650; }
.data-table tr.is-future { color: var(--muted); }
.data-table tfoot th, .data-table tfoot td { font-weight: 800; border-top: 2px solid var(--line); }
.split-bar { display: flex; gap: 2px; height: 14px; margin: 8px 0 12px; border-radius: 7px; overflow: hidden; }
.split-bar i { display: block; height: 100%; }
.split-mandatory { background: var(--series-plan); }
.split-flexible { flex: 1; background: var(--series-fact); }
.split-saving { background: var(--series-saving); }
.unplanned-amount { text-align: right; white-space: nowrap; }
.unplanned-amount small { display: block; font-size: 12px; }
.split-legend { margin: 0; display: grid; gap: 6px; }
.split-legend div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.split-legend dt { display: inline-flex; align-items: center; gap: 6px; }
.split-legend dd { margin: 0; font-weight: 700; }

.list-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 14px 4px 2px; }
.list-group-head:first-child { margin-top: 0; }
.list-group-head h2 { margin: 0; font-size: 17px; }
.list-group-head span { color: var(--muted); font-size: 14px; font-weight: 650; white-space: nowrap; }
.list-group-title { padding: 14px 0 4px; color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.payment-list .list-group-title:first-child { padding-top: 4px; }

@media (max-width: 760px) {
  .brand-copy small { display: none; }
  .main-nav { gap: 18px; overflow-x: auto; align-items: end; }
  .main-nav a, .main-nav span { white-space: nowrap; }
  .page-shell { padding-top: 30px; }
  .hero-row { align-items: stretch; flex-direction: column; }
  .summary-grid, .content-grid, .two-column-form { grid-template-columns: 1fr; }
  .two-column-form > p > label { min-height: 0; }
  .income-explainer { grid-template-columns: 1fr; }
  .totals-banner { flex-direction: column; }
  .totals-banner > .negative-card { margin: 0 -24px -20px; padding: 16px 24px 20px; border-width: 1px 0 0; border-radius: 0 0 var(--radius) var(--radius); }
  .other-currency-totals { align-items: flex-start; }
  .report-grid, .analytics-grid { grid-template-columns: 1fr; }
  .payment:has(.quick-pay) { flex-wrap: wrap; }
  .payment .quick-pay { flex-basis: 100%; justify-content: flex-start; padding-left: 40px; }
  .quick-pay-other { flex: 1; }
  .quick-pay-other input { flex: 1; width: auto; min-width: 0; }
  .income-title-row { align-items: flex-start; flex-direction: column; gap: 6px; }
  .form-page { padding: 24px; }
  .summary-card { min-height: 145px; }
  .auth-card, .onboarding-card, .settings-card { padding: 24px; }
  .member-form { grid-template-columns: 36px 1fr auto; }
  .member-form-icon { width: 36px; margin-top: 22px; grid-row: 1 / 3; align-self: start; }
  .member-field { grid-column: 2; }
  .delete-member, .remove-member { grid-column: 3; grid-row: 1 / 3; }
}

/* Профиль */
.profile-login { margin: 0 0 14px; color: var(--muted); }
.profile-login strong { color: var(--text); }
.profile-self-link { margin: 0 0 18px; }
.profile-form { margin: 0 0 22px; }
.profile-form > button { justify-self: start; }

/* Шапка для гостей */
.text-link { color: var(--text); font-weight: 650; }
.button.small { padding: 10px 14px; font-size: 14px; }
a.button { display: inline-block; }

/* Лендинг */
.landing { display: grid; gap: 56px; }
.landing-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 48px; align-items: center; }
.landing-hero h1 { font-size: clamp(28px, 3vw, 36px); line-height: 1.15; text-wrap: balance; }
.landing-h2, .landing-card h3 { text-wrap: balance; }
.landing .lead { font-size: 16px; line-height: 1.6; }
.landing-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.landing-cta form { display: contents; }
.landing-note { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.landing-preview { margin: 0; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 24px 60px rgba(24,32,28,.08); }
.landing-h2 { margin: 0 0 16px; font-size: clamp(20px, 2vw, 22px); letter-spacing: -.02em; line-height: 1.25; }
.landing-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.landing-card { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.landing-card h3 { margin: 14px 0 6px; font-size: 16px; }
.landing-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.landing-icon { width: 40px; height: 40px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border-radius: 11px; }
.landing-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.landing-steps-list { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.landing-steps-list li { counter-increment: step; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 8px; }
.landing-steps-list li::before { content: counter(step); width: 34px; height: 34px; display: grid; place-items: center; color: white; background: var(--accent); border-radius: 50%; font-weight: 800; }
.landing-steps-list strong { font-size: 15px; }
.landing-steps-list span { color: var(--muted); font-size: 14px; line-height: 1.55; }
.landing-faq { display: grid; gap: 10px; max-width: 820px; }
.landing-faq details { padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.landing-faq summary { cursor: pointer; font-size: 15px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.landing-faq summary::-webkit-details-marker { display: none; }
.landing-faq summary::after { content: "+"; color: var(--accent); font-size: 20px; line-height: 1; font-weight: 500; }
.landing-faq details[open] summary::after { content: "−"; }
.landing-faq p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.landing-final { padding: 40px; text-align: center; background: var(--accent-soft); border-radius: 24px; display: grid; justify-items: center; }
.landing-final .lead { margin: 0 0 22px; }

@media (max-width: 960px) {
  .landing-hero { grid-template-columns: 1fr; }
  .landing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing-steps-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .landing { gap: 44px; }
  .landing-grid { grid-template-columns: 1fr; }
  .landing-cta .button { flex: 1 1 100%; text-align: center; }
  .landing-final { padding: 28px 18px; }
  .topbar-actions .text-link { display: none; }
}

/* Формы входа и регистрации */
.auth-card .stacked-form { gap: 18px; }
.auth-card .stacked-form > .button { width: 100%; margin-top: 4px; padding: 14px 18px; }
.auth-card .stacked-form .helptext li::marker { color: #a3ada7; }
.auth-card > .muted { margin: 20px 0 0; text-align: center; }
.auth-card > .muted + .muted { margin-top: 8px; }

.landing-band { padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; }
.landing-band .lead { margin: 0 0 18px; }
.currency-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.currency-chips li { padding: 6px 11px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; font-size: 13px; font-weight: 700; letter-spacing: .02em; }
@media (max-width: 560px) { .landing-band { padding: 22px 18px; } }

/* Превью «План и факт» на лендинге */
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.preview-month { font-weight: 800; font-size: 17px; }
.preview-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.preview-foot { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; }
.preview-currencies { display: flex; flex: 0 0 auto; }
.preview-currencies i { width: 24px; height: 24px; display: grid; place-items: center; margin-left: -6px; color: var(--accent); background: var(--accent-soft); border: 2px solid var(--surface); border-radius: 50%; font-style: normal; font-size: 11px; font-weight: 800; }
.preview-currencies i:first-child { margin-left: 0; }

.invite-form { margin-top: 18px; }
.invite-form > .button { justify-self: start; }

/* Шапка главной */
.family-hero { align-items: center; }
.family-hero-main { display: flex; align-items: center; gap: 18px; }
.family-hero h1 { margin: 2px 0 8px; }
.family-greeting { margin: 0; color: var(--muted); font-size: 15px; font-weight: 600; }
.family-avatars { display: flex; flex: 0 0 auto; padding-left: 8px; }
.family-avatar { width: 46px; height: 46px; margin-left: -10px; display: grid; place-items: center; color: white; background: var(--accent); border: 3px solid var(--bg); border-radius: 50%; font-size: 18px; font-weight: 800; }
.family-avatar:nth-child(2n) { background: #c98a3a; }
.family-avatar:nth-child(3n) { background: #5b7fb0; }
.family-avatar.pet { background: #eaf1ec; font-size: 18px; }
.family-status { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; }
.family-status > span:first-child { font-weight: 600; color: var(--text); }
.family-status-ok, .family-status-alert { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 750; }
.family-status-ok { color: var(--accent); background: var(--accent-soft); }
.family-status-alert { color: #a33c32; background: #fbe6e2; }
@media (max-width: 560px) {
  .family-hero-main { align-items: flex-start; flex-direction: column; gap: 12px; }
  .family-avatar { width: 38px; height: 38px; font-size: 15px; }
}

/* Превью на лендинге — как блоки на главной: итоги и платежи по плану */
.preview-family { display: flex; }
.preview-avatar { width: 30px; height: 30px; display: grid; place-items: center; color: white; background: var(--accent); border: 2px solid var(--surface); border-radius: 50%; font-size: 13px; font-weight: 800; }
.preview-avatar.alt { margin-left: -8px; background: #c98a3a; }
.preview-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.preview-totals div { display: grid; gap: 4px; padding: 12px; background: #f7f9f7; border-radius: 12px; }
.preview-totals small { color: var(--muted); font-size: 12px; }
.preview-totals strong { font-size: 18px; letter-spacing: -.02em; white-space: nowrap; }
.preview-totals .preview-left { color: var(--accent); background: var(--accent-soft); }
.preview-payments-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.preview-payments-head strong { font-size: 15px; }
.preview-payments-head span { color: var(--muted); font-size: 13px; }
.preview-rows li { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.preview-rows { gap: 0; }
.preview-status { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font-size: 13px; font-weight: 800; }
.preview-status.ok { color: white; background: var(--accent); }
.preview-status.part { color: var(--accent); background: var(--accent-soft); font-size: 10px; }
.preview-status.soon { color: #9a6418; background: #fdf1dc; font-size: 12px; }
.preview-name { display: grid; gap: 2px; font-weight: 700; line-height: 1.2; }
.preview-name small { color: var(--muted); font-size: 12px; font-weight: 500; }
.preview-amount { display: grid; justify-items: end; gap: 2px; font-weight: 750; white-space: nowrap; }
.preview-amount small { color: var(--muted); font-size: 12px; font-weight: 500; }
.preview-amount.paid { color: var(--muted); }
.preview-amount.paid span { text-decoration: line-through; text-decoration-thickness: 1px; }
@media (max-width: 560px) {
  .preview-totals strong { font-size: 16px; }
}

/* Списки «Доходы» и «Расходы»: группа — одна карточка, строки — через разделитель. */
.plan-groups { display: grid; gap: 14px; }
.plan-group { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.plan-group-head { display: flex; align-items: center; gap: 10px 18px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fafbfa; }
.plan-group-head h2 { margin: 0; font-size: 16px; white-space: nowrap; }
.plan-group-spent { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.plan-group-spent .bar { flex: 1; min-width: 60px; max-width: 220px; height: 6px; }
.plan-group-spent small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-group-total { margin-left: auto; color: var(--muted); font-size: 14px; font-weight: 650; white-space: nowrap; }
.plan-row { display: grid; gap: 6px; padding: 12px 18px; }
.plan-row + .plan-row { border-top: 1px solid var(--line); }
.plan-row.is-muted { opacity: .6; }
.plan-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 16px; flex-wrap: wrap; }
.plan-row-top .income-name { flex: 1 1 140px; min-width: 0; }
.plan-row-top strong { white-space: nowrap; font-size: 17px; }
.plan-row-amount { display: grid; justify-items: end; margin-left: auto; text-align: right; }
.plan-row-amount small { color: var(--muted); font-size: 13px; font-weight: 650; white-space: nowrap; }
.plan-row-name { display: block; min-width: 0; color: var(--text); font-size: 16px; font-weight: 700; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-row-name:hover { color: var(--accent); }
.plan-row-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; color: var(--muted); font-size: 14px; }
.plan-row-meta .plan-chips { width: auto; flex: 1 1 auto; }
.plan-row .chip { height: auto; min-height: 26px; padding-top: 3px; padding-bottom: 3px; font-size: 13px; white-space: normal; }
.plan-row-meta .plan-chips { min-width: 0; }
.list-budgets { margin-bottom: 14px; }

/* «Другая сумма» — по ссылке, чтобы строка платежа не раздувалась полем ввода. */
.quick-pay-more summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 650; list-style: none; }
.quick-pay-more summary::-webkit-details-marker { display: none; }
.quick-pay-more summary:hover { color: var(--accent); }
.quick-pay-more[open] summary { display: none; }

/* «Операции месяца» на странице «Факт». */
.fact-operations { margin-top: 16px; }
.operation-list { list-style: none; margin: 0; padding: 0; }
.operation { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "date name amount" "date meta amount"; column-gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.operation-date { grid-area: date; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.operation-name { grid-area: name; font-weight: 700; text-decoration: none; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operation-name:hover { color: var(--accent); }
.operation-meta { grid-area: meta; color: var(--muted); font-size: 13px; }
.operation-amount { grid-area: amount; align-self: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.operation-income .operation-amount { color: var(--accent); }

@media (max-width: 640px) {
  .plan-row, .plan-group-head { padding-left: 14px; padding-right: 14px; }
  .plan-group-head { flex-wrap: wrap; }
  .plan-group-spent { order: 3; flex-basis: 100%; }
  .plan-row-meta .row-actions { margin-left: auto; }
}

/* Печать и «Сохранить как PDF»: браузеры по умолчанию не печатают фон,
   а столбцы графика, полосы категорий и структура плана нарисованы фоном. */
@media print {
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .panel, .summary-card { break-inside: avoid; }
  .chart-tip { display: none; }
}

/* Счета */
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.currency-totals { margin: -8px 0 20px; font-size: 14px; }
.account-group { margin-bottom: 16px; }
.account-currency { color: var(--muted); font-size: 12px; font-weight: 800; }
.account-balance strong { font-size: 28px; color: var(--text); }
.account-history .operation { grid-template-columns: 64px minmax(0, 1fr) auto; }
.archived-accounts { margin-top: 16px; }
.archived-accounts summary { cursor: pointer; font-weight: 750; }
.operation-muted { opacity: .55; }
.operation-muted .operation-amount { text-decoration: line-through; }
.chip-op { height: 22px; font-size: 12px; }
.chip-op-transfer, .chip-op-exchange { color: #2f5d7a; background: #e2eef6; border-color: transparent; }
.chip-op-fee, .chip-op-expense { color: #9a4c25; background: #f8e3df; border-color: transparent; }
.chip-op-income { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.op-cancel-form, .op-archive-form { display: inline; margin: 0; }
.op-cancel-form .text-button { padding: 0 0 0 6px; font-size: 13px; text-decoration: underline; }
.account-footer { margin-top: 20px; justify-content: flex-start; }
@media (max-width: 720px) { .hero-actions { justify-content: flex-start; } }
.template-picks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -6px 0 14px; color: var(--muted); font-size: 14px; }
.template-picks .chip { text-decoration: none; }
.allocation-rows { display: grid; gap: 8px; margin-bottom: 6px; }
.allocation-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px; align-items: start; }
.allocation-row > span { display: grid; gap: 4px; min-width: 0; }
.allocation-row select, .allocation-row input { width: 100%; min-width: 0; }
.allocation-head { color: var(--muted); font-size: 13px; font-weight: 700; }
.allocation-hint { font-size: 13px; }
.income-allocation { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
@media (max-width: 720px) {
  .allocation-head { display: none; }
  .allocation-row { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .allocation-row > span:first-child { grid-column: 1 / -1; }
}
.quick-pay-account { max-width: 150px; padding: 7px 8px; border: 1px solid #cfd7d1; border-radius: 10px; background: #fbfcfb; font: inherit; font-size: 13px; }
.funds-tabs { display: inline-flex; gap: 4px; margin: -14px 0 18px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.funds-tabs a { padding: 7px 16px; border-radius: 999px; color: var(--muted); font-weight: 700; font-size: 14px; text-decoration: none; }
.funds-tabs a.active { color: #fff; background: var(--accent); }
.funds-tab-note { margin: -8px 0 18px; font-size: 14px; }
