/* Usage-mode layer of the one dashboard: «Первая запись» card and the business mode dissolved into the usual screens
   (header switch, lines in «Доходы», expected payments, linked costs, the «Дело за месяц» hero in «Аналитика»).
   Base tokens follow Bootstrap (Малахит, light/dark); «Эфир» refines them with --rd-* below. */
.yf-starter-card,
.yf-scope-switch,
.yf-expected,
.yf-linked-costs,
.yf-biz-hero,
.yf-tax-settings {
    --yf-ul-ink: var(--bs-body-color);
    --yf-ul-muted: var(--bs-secondary-color);
    --yf-ul-line: var(--bs-border-color);
    --yf-ul-fill: var(--bs-tertiary-bg);
    --yf-ul-surface: var(--bs-body-bg);
    --yf-ul-accent: var(--bs-primary);
    --yf-ul-positive: #1f9d55;
    --yf-ul-negative: #d64545;
}
[hidden].yf-income-biz, .yf-income-biz [hidden], .yf-expected[hidden], .yf-expected [hidden], .yf-linked-costs [hidden],
.yf-biz-hero[hidden], .yf-biz-hero [hidden], .yf-exm-row--business[hidden], .yf-tax-settings [hidden] { display: none !important; }

/* ---------- «Первая запись» ---------- */
.yf-starter-card .card-body { padding: 16px 18px; }
.yf-starter-card__head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.yf-starter-card__icon {
    flex: 0 0 auto; display: inline-grid; place-items: center; width: 36px; height: 36px;
    border-radius: 50%; background: var(--yf-ul-fill); color: var(--yf-ul-accent); font-size: 18px;
}
.yf-starter-card__icon.is-success { color: var(--yf-ul-positive); }
.yf-starter-card__title { font-size: 1.05rem; font-weight: 600; margin: 0 0 2px; color: var(--yf-ul-ink); }
.yf-starter-card__lead { margin: 0; color: var(--yf-ul-muted); font-size: .9rem; }
.yf-starter-card__form { display: flex; gap: 8px; }
.yf-starter-card__form .form-control { min-width: 0; flex: 1 1 auto; min-height: 44px; }
.yf-starter-card__form .btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; white-space: nowrap; }
.yf-starter-card__example { margin: 10px 0 0; color: var(--yf-ul-muted); font-size: .85rem; }
.yf-starter-card__chip {
    border: 1px solid var(--yf-ul-line); background: transparent; color: var(--yf-ul-ink);
    border-radius: 999px; padding: 2px 10px; font: inherit; cursor: pointer;
}
.yf-starter-card__chip:hover, .yf-starter-card__chip:focus-visible { border-color: var(--yf-ul-accent); color: var(--yf-ul-accent); }
.yf-starter-card__done { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.yf-starter-card__done p { margin: 0; flex: 1 1 260px; color: var(--yf-ul-ink); }
body.yf-onboarding-active .yf-starter-card { display: none !important; }
.yf-starter-card__hub { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- «Всё · Дело · Личное» in the header ---------- */
.yf-scope-switch {
    display: inline-flex; align-items: center; gap: 2px; padding: 3px; margin-left: auto; margin-right: 8px;
    border-radius: 999px; background: var(--yf-ul-fill); flex: 0 0 auto;
    /* The bar is sticky: like the section tabs next to it, the switch blurs what scrolls under it. */
    -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8);
}
.yf-scope-switch button {
    border: 0; background: transparent; color: var(--yf-ul-muted); font: inherit; font-size: .85rem; font-weight: 600;
    min-height: 32px; padding: 4px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}
.yf-scope-switch button.is-active { background: var(--yf-ul-surface); color: var(--yf-ul-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.yf-scope-switch button:focus-visible { outline: 2px solid var(--yf-ul-accent); outline-offset: 2px; }

/* ---------- «Доходы»: two lines inside the month card (coloured card: inherit its ink) ---------- */
.yf-income-biz { display: grid; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
.yf-income-biz__row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; width: 100%; padding: 8px 10px; border: 0;
    border-radius: 12px; background: color-mix(in srgb, currentColor 8%, transparent); color: inherit; font: inherit;
    font-size: .9rem; text-align: left;
}
button.yf-income-biz__row { cursor: pointer; }
button.yf-income-biz__row:hover, button.yf-income-biz__row:focus-visible { background: color-mix(in srgb, currentColor 14%, transparent); }
.yf-income-biz__row.is-overdue .yf-income-biz__icon { color: #ffb4b4; }
.yf-income-biz__icon { display: inline-grid; place-items: center; font-size: 18px; opacity: .9; }
.yf-income-biz__text { flex: 1 1 200px; min-width: 0; font-weight: 600; }
.yf-income-biz__go { opacity: .7; }
.yf-income-biz__actions { display: inline-flex; align-items: center; gap: 8px; }
.yf-income-biz__link { border: 0; background: none; padding: 0; color: inherit; opacity: .8; font: inherit; font-size: .82rem; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.yf-income-biz__link:hover { opacity: 1; }
.yf-income-biz .yf-inline-action { background: color-mix(in srgb, currentColor 16%, transparent) !important; color: inherit !important; border-color: transparent !important; }

/* ---------- «Ждём от клиентов» above the plan table ---------- */
.yf-expected { margin: 14px 0 6px; padding: 12px 14px; border: 1px solid var(--yf-ul-line); border-radius: 14px; background: var(--yf-ul-fill); }
.yf-expected__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: var(--yf-ul-ink); }
.yf-expected__total { font-weight: 700; font-variant-numeric: tabular-nums; }
.yf-expected__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.yf-expected__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--yf-ul-surface); }
.yf-expected__item.is-leaving { opacity: .45; transition: opacity .2s ease; }
.yf-expected__label { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.yf-expected__label strong { font-weight: 600; color: var(--yf-ul-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yf-expected__label small { color: var(--yf-ul-muted); font-size: .78rem; }
.yf-expected__item.is-overdue .yf-expected__label small { color: var(--yf-ul-negative); font-weight: 600; }
.yf-expected__amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; color: var(--yf-ul-ink); }
.yf-expected__paid { border: 1px solid var(--yf-ul-positive); color: var(--yf-ul-positive); background: transparent; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.yf-expected__paid:hover, .yf-expected__paid:focus-visible { background: var(--yf-ul-positive); color: #fff; }
.yf-expected__hint { margin: 8px 0 0; color: var(--yf-ul-muted); font-size: .8rem; }

/* ---------- plan form (business): client and promised day ---------- */
.yf-plan-business-field__hint { display: block; margin-top: 4px; color: var(--bs-secondary-color); font-size: .78rem; }

/* ---------- «Связанные расходы» in the income form ---------- */
.yf-linked-costs { border: 1px solid var(--yf-ul-line); border-radius: 14px; background: var(--yf-ul-fill); overflow: hidden; }
.yf-linked-costs__toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: transparent; color: var(--yf-ul-ink); font: inherit; text-align: left; cursor: pointer; }
.yf-linked-costs__icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--yf-ul-surface); color: var(--yf-ul-accent); font-size: 17px; flex: 0 0 auto; }
.yf-linked-costs__title { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.yf-linked-costs__title small { color: var(--yf-ul-muted); font-size: .78rem; }
.yf-linked-costs__count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--yf-ul-accent); color: #fff; font-size: .75rem; font-weight: 700; }
.yf-linked-costs__chevron { transition: transform .15s ease; color: var(--yf-ul-muted); }
.yf-linked-costs.is-open .yf-linked-costs__chevron { transform: rotate(180deg); }
.yf-linked-costs__body { padding: 0 12px 12px; }
.yf-linked-costs--row { margin-top: 10px; }
.yf-linked-costs__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.yf-linked-costs__item label { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--yf-ul-surface); cursor: pointer; }
.yf-linked-costs__item input { flex: 0 0 auto; width: 18px; height: 18px; accent-color: var(--yf-ul-accent); }
.yf-linked-costs__name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.yf-linked-costs__name strong { font-weight: 600; color: var(--yf-ul-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yf-linked-costs__name small { color: var(--yf-ul-muted); font-size: .76rem; }
.yf-linked-costs__amount { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--yf-ul-ink); }
.yf-linked-costs__empty { padding: 8px; color: var(--yf-ul-muted); font-size: .85rem; }
.yf-linked-costs__result { margin: 8px 0 0; color: var(--yf-ul-ink); font-size: .85rem; font-weight: 600; }

/* ---------- «Дело за месяц» hero in «Аналитика» ---------- */
.yf-biz-hero .card-body { padding: 18px 20px; }
.yf-biz-hero__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.yf-biz-hero__title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--yf-ul-ink); display: inline-flex; align-items: center; gap: 8px; }
.yf-biz-hero__grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 12px; }
.yf-biz-hero__item { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; border-radius: 16px; background: var(--yf-ul-fill); }
.yf-biz-hero__item--net { background: color-mix(in srgb, var(--yf-ul-positive) 12%, var(--yf-ul-fill)); }
.yf-biz-hero__item.is-overdue .yf-biz-hero__value, .yf-biz-hero__item.is-overdue .yf-biz-hero__note { color: var(--yf-ul-negative); }
.yf-biz-hero__label { color: var(--yf-ul-muted); font-size: .85rem; font-weight: 600; }
.yf-biz-hero__value { font-size: clamp(1.4rem, 2.6vw, 2rem); line-height: 1.1; font-weight: 800; color: var(--yf-ul-ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.yf-biz-hero__item--net .yf-biz-hero__value { color: var(--yf-ul-positive); }
.yf-biz-hero__value.is-updated { animation: yf-biz-pulse .6s ease; }
@keyframes yf-biz-pulse { 0% { opacity: .35; transform: translateY(2px); } 100% { opacity: 1; transform: none; } }
.yf-biz-hero__note { color: var(--yf-ul-muted); font-size: .8rem; }
.yf-biz-hero__after { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; margin-top: 4px; padding-top: 8px; border-top: 1px dashed color-mix(in srgb, var(--yf-ul-positive) 35%, transparent); color: var(--yf-ul-ink); font-size: .85rem; font-weight: 600; }
.yf-biz-hero__after[hidden] { display: none !important; }
.yf-biz-hero__after strong { font-size: 1.05rem; font-weight: 800; color: var(--yf-ul-positive); font-variant-numeric: tabular-nums; }
.yf-biz-hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
.yf-biz-hero__deals { margin-top: 14px; }
.yf-biz-hero__deals h3 { font-size: .92rem; font-weight: 700; margin: 0 0 8px; color: var(--yf-ul-ink); }
.yf-biz-hero__deals ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.yf-biz-hero__deals li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--yf-ul-fill); }
.yf-biz-hero__deal { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.yf-biz-hero__deal strong { color: var(--yf-ul-ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yf-biz-hero__deal small { color: var(--yf-ul-muted); font-size: .78rem; }
.yf-biz-hero__margin { font-weight: 700; white-space: nowrap; color: var(--yf-ul-ink); font-variant-numeric: tabular-nums; }
.yf-biz-hero__locked { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.yf-biz-hero__locked > div { display: flex; flex-direction: column; gap: 4px; }
.yf-biz-hero__locked p { margin: 0; flex: 1 1 260px; color: var(--yf-ul-muted); font-size: .9rem; }

/* ---------- «Настройки → Режим работы»: tax rate ---------- */
.yf-tax-settings__presets { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 14px; background: var(--yf-ul-fill); }
.yf-tax-settings__presets button { border: 0; background: transparent; color: var(--yf-ul-muted); font: inherit; font-size: .88rem; font-weight: 600; min-height: 34px; padding: 4px 14px; border-radius: 11px; cursor: pointer; }
.yf-tax-settings__presets button.is-active { background: var(--yf-ul-surface); color: var(--yf-ul-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.yf-tax-settings__custom { display: flex; gap: 8px; margin-top: 10px; max-width: 320px; }

/* Category scope switch in the category forms and the work marker on chips (business mode only). */
/* «Рабочая категория»: the same row as «Повторяющийся тег» (.yf-recurring-setting in tag-color-picker.css). */
/* The switch: icons on «Дело» / «Личное», and a coloured active view so «not everything» is visible at a glance. */
.yf-scope-switch button { display: inline-flex; align-items: center; gap: 5px; }
.yf-scope-switch button i { font-size: 14px; }
.yf-scope-switch button[data-scope="business"].is-active { background: #138a5b; color: #fff; box-shadow: 0 2px 8px -2px rgba(19, 138, 91, .55); }
.yf-scope-switch button[data-scope="personal"].is-active { background: #3b6fd8; color: #fff; box-shadow: 0 2px 8px -2px rgba(59, 111, 216, .5); }
/* The badge of a business category: the accent of «Дело», and its meaning next to «Добавить категорию». */
.yf-scope-mark { color: #138a5b !important; opacity: 1 !important; }
body.dark-theme .yf-scope-mark { color: #4fd1a1 !important; }
.yf-tag-list-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.yf-scope-legend { display: none; align-items: center; gap: 4px; color: var(--bs-secondary-color); font-size: 12px; white-space: nowrap; }
.yf-scope-legend i { color: #138a5b; font-size: 13px; }
body.dark-theme .yf-scope-legend i { color: #4fd1a1; }
.card:has(.tag[data-tag-scope="business"]) .yf-scope-legend { display: inline-flex; }
/* Tax presets: which rate is mine. */
.yf-tax-settings__guide { display: grid; gap: 3px; margin: 10px 0 0; padding: 0; list-style: none; color: var(--bs-secondary-color); font-size: 12.5px; line-height: 1.45; }
.yf-tax-settings__guide b { color: var(--bs-body-color); }
/* «+ Жду оплату» lives in the «Дело» view only. */
body:not([data-usage-scope="business"]) .yf-table-card-actions .yf-expected-add { display: none !important; }
/* «Дело за месяц» without numbers: the steps instead of the tiles. */
.yf-biz-hero.is-empty .yf-biz-hero__grid, .yf-biz-hero.is-empty .yf-biz-hero__deals { display: none !important; }
.yf-biz-hero__start { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.yf-biz-hero__start[hidden] { display: none !important; }
.yf-biz-hero__start li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--yf-ul-line); border-radius: 12px; background: var(--yf-ul-surface); }
.yf-biz-hero__start li > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.yf-biz-hero__start strong { font-size: 13.5px; }
.yf-biz-hero__start small { color: var(--yf-ul-muted); font-size: 12px; line-height: 1.4; }
.yf-biz-hero__step-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--yf-ul-fill); color: var(--yf-ul-accent); font-size: 16px; }
.yf-biz-hero__start li.is-done { opacity: .6; }
.yf-biz-hero__start li.is-done .yf-biz-hero__step-mark { background: rgba(31, 157, 85, .14); color: var(--yf-ul-positive); }
.yf-biz-hero__start li.is-done .yf-biz-hero__step-mark i::before { content: "\ea5e"; }
.yf-biz-hero__start li.is-done > button { display: none; }
@media (max-width: 575.98px) { .yf-biz-hero__start li { grid-template-columns: 34px minmax(0, 1fr); } .yf-biz-hero__start li > button { grid-column: 2; justify-self: start; } }
/* «Финансовая аналитика» keeps its full grid in every view (Всё · Дело · Личное); the 25.11 fold to one line in «Дело»
   was reverted on 27.11 at the owner's request. */
/* «Доходы»: without a tax rate the row is a hint of the «Дело» view only; an empty box goes with it. */
body:not([data-usage-scope="business"]) .yf-income-biz__row.is-unset { display: none !important; }
body:not([data-usage-scope="business"]) .yf-income-biz.is-quiet { display: none !important; }
/* Category cards follow Всё / Дело / Личное: the other side's categories stay (order, drag) but step back. */
:is(#tagsContainer, #incomeTagsContainer) .tag { transition: opacity .18s ease; }
body[data-usage-scope="business"] :is(#tagsContainer, #incomeTagsContainer) .tag[data-tag-scope="personal"],
body[data-usage-scope="personal"] :is(#tagsContainer, #incomeTagsContainer) .tag[data-tag-scope="business"] { opacity: .38; }
.yf-tag-scope { min-width: 0; margin: 0 0 14px; }
.yf-tag-builder__name .yf-tag-scope { margin: 12px 0 0; }
.yf-tag-scope .yf-recurring-setting small i { margin: 0 2px 0 1px; font-size: 12px; vertical-align: -1px; }
/* Settings → «Режим работы»: the mode card and «Налог с поступлений» stack with the same gap as other panels. */
.yf-usage-mode-settings:not([hidden]) { display: grid; gap: 14px; }
.yf-usage-mode-settings .yf-account-section { min-height: 0; }
body.yf-dashboard-auth .yf-usage-mode-settings .yf-personalization__status:not(:empty) { margin: 16px 2px 0 !important; }
.yf-mode-option .yf-mode-option__icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--bs-tertiary-bg); font-size: 20px; }
.yf-mode-badge { font-weight: 600; }
/* «Дело» without the «Бизнес» plan: a slightly muted, switched-off card with the plan
   at its top, next to the icon, so the text stays readable. The selector is long on
   purpose — it has to beat the hover and background rules of both designs («Малахит» and «Эфир»). */
:root body.yf-dashboard-auth .yf-mode-options .yf-design-option.yf-mode-option.is-locked {
    border: 1px dashed rgba(120, 128, 126, .45); background: rgba(120, 128, 126, .05);
    box-shadow: none; transform: none; cursor: not-allowed; opacity: 1;
}
.yf-mode-option.is-locked > :not(.yf-mode-option__lock, input) { filter: grayscale(.7); opacity: .72; }
.yf-mode-option__lock {
    position: absolute; top: 12px; left: 60px; right: 12px; margin-inline: auto; min-height: 38px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: fit-content; max-width: calc(100% - 72px); padding: 7px 14px;
    border: 1px solid rgba(15, 23, 42, .1); border-radius: 999px; background: #fff; color: #1c2623;
    box-shadow: 0 8px 22px -10px rgba(15, 23, 42, .35);
    font-size: 13px; font-weight: 700; line-height: 1.35; text-align: center;
}
.yf-mode-option__lock i { flex: none; font-size: 16px; }
.yf-mode-option.is-locked > .yf-design-option__check { display: none; }
body.yf-dashboard-auth.dark-theme .yf-mode-option__lock { border-color: rgba(255, 255, 255, .16); background: #26302e; color: #f1f5f3; }
.yf-usage-mode-settings .yf-mode-lock { margin-top: 12px; }
body.yf-dashboard-auth.dark-theme .yf-mode-option .yf-mode-option__icon { background: rgba(255, 255, 255, .08); color: #eef4f1; }
@media (max-width: 575.98px) {
    .yf-mode-option__lock { gap: 6px; padding: 5px 10px; border-radius: 14px; font-size: 12px; }
}

/* Narrower screens: the section tabs keep their room, the switch takes its own row under the bar. */
@media (max-width: 1199.98px) {
    .yf-dashboard-commandbar:has(.yf-scope-switch) { flex-wrap: wrap; row-gap: 8px; }
    .yf-scope-switch { order: 3; margin: 0; }
}
@media (max-width: 767.98px) {
    .yf-starter-card__form .btn span { display: none; }
    .yf-scope-switch { width: 100%; justify-content: space-between; }
    .yf-scope-switch button { flex: 1 1 0; }
    .yf-biz-hero__grid { grid-template-columns: minmax(0, 1fr); }
    .yf-biz-hero .card-body { padding: 14px; }
    .yf-expected__item { flex-wrap: wrap; }
    .yf-expected__label { flex-basis: 100%; }
}

/* ---------- «Малахит» dark (the classic dark theme does not switch Bootstrap's variables) ---------- */
body.dark-theme .yf-starter-card,
body.dark-theme .yf-scope-switch,
body.dark-theme .yf-expected,
body.dark-theme .yf-linked-costs,
body.dark-theme .yf-biz-hero,
body.dark-theme .yf-tax-settings {
    --yf-ul-ink: #e7eef0;
    --yf-ul-muted: #9fb2b6;
    --yf-ul-line: rgba(255, 255, 255, .1);
    --yf-ul-fill: rgba(255, 255, 255, .05);
    --yf-ul-surface: rgba(255, 255, 255, .09);
    --yf-ul-accent: #3ccf91;
    --yf-ul-positive: #4ade80;
    --yf-ul-negative: #f87171;
}
body.dark-theme .yf-option-scope { color: #3ccf91; background: rgba(60, 207, 145, .14); }

/* ---------- «Эфир» ---------- */
:root body.yf-redesign.yf-dashboard-auth .yf-starter-card,
:root body.yf-redesign.yf-dashboard-auth .yf-scope-switch,
:root body.yf-redesign.yf-dashboard-auth .yf-expected,
:root body.yf-redesign.yf-dashboard-auth .yf-linked-costs,
:root body.yf-redesign.yf-dashboard-auth .yf-biz-hero,
:root body.yf-redesign.yf-dashboard-auth .yf-tax-settings {
    --yf-ul-ink: var(--rd-ink);
    --yf-ul-muted: var(--rd-muted);
    --yf-ul-line: var(--rd-line-soft);
    --yf-ul-fill: var(--rd-fill-soft);
    --yf-ul-surface: var(--rd-surface);
    --yf-ul-accent: var(--rd-accent);
    --yf-ul-positive: var(--rd-positive);
    --yf-ul-negative: var(--rd-negative);
}
:root body.yf-redesign.yf-dashboard-auth .yf-scope-switch button.is-active,
:root body.yf-redesign.yf-dashboard-auth .yf-tax-settings__presets button.is-active { box-shadow: var(--rd-shadow-control); }

@media (prefers-reduced-motion: reduce) {
    .yf-scope-switch button, .yf-linked-costs__chevron { transition: none !important; }
    .yf-biz-hero__value.is-updated { animation: none; }
}

/* «дело» mark on work categories in the category pickers (business mode). */
.yf-option-scope { margin-left: auto; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--bs-primary) 12%, transparent); color: var(--bs-primary); font-size: .72rem; font-weight: 700; text-transform: lowercase; }
:root body.yf-redesign.yf-dashboard-auth .yf-option-scope { background: color-mix(in srgb, var(--rd-accent) 14%, transparent); color: var(--rd-accent); }

/* Work categories (scope=business): a small briefcase next to the name in the category cards and the tables —
   only in business mode (the page carries [data-usage-business] there). */
.yf-scope-mark { display: none; }
body:has([data-usage-business]) .yf-scope-mark { display: inline-block; margin-left: 4px; font-size: .78em; line-height: 1; opacity: .72; vertical-align: -1px; color: inherit; }
body:has([data-usage-business]) .finance-table-tag .yf-scope-mark { margin-left: 3px; }

/* Phones: the bar with the section tabs is hidden (the tabs live in the bottom nav, the period in the header); the
   view switch stays on its own row. */
@media (max-width: 767.98px) {
    body:is([data-dashboard-section="income"], [data-dashboard-section="expenses"], [data-dashboard-section="analytics"]) .yf-dashboard-commandbar:has(.yf-scope-switch) { display: flex !important; padding: 0; margin-bottom: 8px; background: none; border: 0; box-shadow: none; }
    .yf-dashboard-commandbar:has(.yf-scope-switch) > .yf-section-nav { display: none !important; }
}

/* The view filters «Доходы», «Расходы» and «Аналитика» only: on «Финансы» (accounts, savings) and elsewhere it is hidden. */
body:not([data-dashboard-section="income"]):not([data-dashboard-section="expenses"]):not([data-dashboard-section="analytics"]) .yf-scope-switch { display: none !important; }

/* ---------- «Первая запись» as a mini chat with the AI assistant ---------- */
.yf-starter-card__badge {
    display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; padding: 2px 8px; border-radius: 999px;
    background: color-mix(in srgb, var(--yf-ul-accent) 12%, transparent); color: var(--yf-ul-accent);
    font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.yf-starter-card__field { position: relative; flex: 1 1 auto; min-width: 0; display: flex; }
.yf-starter-card__field .form-control { padding-right: 46px; }
.yf-starter-card__mic {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%;
    background: color-mix(in srgb, var(--yf-ul-accent) 12%, transparent); color: var(--yf-ul-accent); font-size: 18px; cursor: pointer;
}
.yf-starter-card__mic:hover, .yf-starter-card__mic:focus-visible { background: var(--yf-ul-accent); color: #fff; }
.yf-starter-chat { display: grid; gap: 6px; margin: 0 0 12px; }
.yf-starter-chat[hidden] { display: none; }
.yf-starter-chat__bubble {
    max-width: min(560px, 88%); padding: 8px 12px; border-radius: 14px; font-size: .9rem; line-height: 1.4;
    animation: yf-starter-pop .22s ease both;
}
.yf-starter-chat__bubble--user { justify-self: end; border-bottom-right-radius: 4px; background: var(--yf-ul-accent); color: #fff; }
.yf-starter-chat__bubble--assistant { justify-self: start; border-bottom-left-radius: 4px; background: var(--yf-ul-fill); color: var(--yf-ul-ink); }
.yf-starter-chat__bubble.is-done { color: var(--yf-ul-positive); font-weight: 650; }
.yf-starter-chat__bubble.is-error { color: var(--yf-ul-negative); }
.yf-starter-chat__bubble.is-typing { letter-spacing: .2em; color: var(--yf-ul-muted); }
.yf-starter-chat__open { justify-self: start; border: 0; background: none; padding: 0; color: var(--yf-ul-accent); font: inherit; font-size: .85rem; font-weight: 650; cursor: pointer; }
.yf-starter-card__where { flex-basis: 100%; display: flex; gap: 6px; align-items: center; margin: 2px 0 0; color: var(--yf-ul-muted); font-size: .85rem; }
.yf-starter-card__example { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
@keyframes yf-starter-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .yf-starter-chat__bubble { animation: none; } }
.yf-starter-chat__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.yf-starter-chat__action {
    padding: 5px 12px; border: 1px solid color-mix(in srgb, var(--yf-ul-accent) 40%, transparent); border-radius: 999px;
    background: transparent; color: var(--yf-ul-accent); font: inherit; font-size: .85rem; font-weight: 650; cursor: pointer;
}
.yf-starter-chat__action:first-child { background: var(--yf-ul-accent); color: #fff; border-color: var(--yf-ul-accent); }

/* ---------- «Планируемый доход»: Личное | Дело, «Ещё», «Перенести» ---------- */
.yf-plan-scope, .yf-plan-more, .yf-plan-move {
    --yf-ul-ink: var(--bs-body-color);
    --yf-ul-muted: var(--bs-secondary-color);
    --yf-ul-line: var(--bs-border-color);
    --yf-ul-fill: var(--bs-tertiary-bg);
    --yf-ul-accent: var(--bs-primary);
}
.yf-plan-scope { display: inline-flex; gap: 2px; margin: 0 0 14px; padding: 3px; border-radius: 999px; background: var(--yf-ul-fill); border: 1px solid var(--yf-ul-line); }
.yf-plan-scope button {
    display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 16px; border: 0; border-radius: 999px;
    background: transparent; color: var(--yf-ul-muted); font-size: .9rem; font-weight: 600; cursor: pointer; transition: background .16s ease, color .16s ease;
}
.yf-plan-scope button:hover { color: var(--yf-ul-ink); }
.yf-plan-scope button.is-active { background: var(--yf-ul-accent); color: #fff; box-shadow: 0 1px 4px color-mix(in srgb, var(--yf-ul-accent) 40%, transparent); }
.yf-plan-scope button:focus-visible { outline: 2px solid var(--yf-ul-accent); outline-offset: 2px; }
.yf-plan-more { margin-top: 14px; border: 1px solid var(--yf-ul-line); border-radius: 14px; background: color-mix(in srgb, var(--yf-ul-fill) 55%, transparent); }
.yf-plan-more > summary {
    display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; list-style: none; cursor: pointer; color: var(--yf-ul-ink); font-weight: 600;
}
.yf-plan-more > summary::-webkit-details-marker { display: none; }
.yf-plan-more > summary small { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--yf-ul-muted); font-size: .8rem; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.yf-plan-more__chevron { margin-left: auto; color: var(--yf-ul-muted); transition: transform .18s ease; }
.yf-plan-more[open] > summary .yf-plan-more__chevron { transform: rotate(180deg); }
.yf-plan-more__body { padding: 4px 14px 14px; }
.yf-plan-more__stats { margin-top: 12px; }
.yf-plan-more__stats:empty { display: none; }
.yf-plan-more .yf-plan-business-field[hidden] { display: none !important; }
.yf-plan-move {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--yf-ul-line);
    border-radius: 12px; background: transparent; color: var(--yf-ul-ink); font-size: .85rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.yf-plan-move:hover { border-color: var(--yf-ul-accent); color: var(--yf-ul-accent); }
.yf-plan-row-client { margin-top: 8px; }
@media (max-width: 575.98px) {
    .yf-plan-scope { display: flex; } .yf-plan-scope button { flex: 1 1 0; justify-content: center; }
    .yf-plan-more > summary small { display: none; }
}
body.dark-theme .yf-plan-scope, body.dark-theme .yf-plan-more, body.dark-theme .yf-plan-move {
    --yf-ul-ink: #e7eef0; --yf-ul-muted: #9fb2b6; --yf-ul-line: rgba(255, 255, 255, .1); --yf-ul-fill: rgba(255, 255, 255, .05); --yf-ul-accent: #3ccf91;
}
body.dark-theme .yf-plan-scope button.is-active { color: #06251a; }
:root body.yf-redesign.yf-dashboard-auth .yf-plan-scope,
:root body.yf-redesign.yf-dashboard-auth .yf-plan-more,
:root body.yf-redesign.yf-dashboard-auth .yf-plan-move {
    --yf-ul-ink: var(--rd-ink); --yf-ul-muted: var(--rd-muted); --yf-ul-line: var(--rd-line-soft); --yf-ul-fill: var(--rd-fill-soft); --yf-ul-accent: var(--rd-accent);
}

.yf-plan-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.yf-plan-row-actions .yf-plan-move { width: auto; flex: 0 1 auto; }
.yf-plan-row-client .form-control { min-width: 0; }

/* Analytics cards: which view («Дело» / «Личное») the numbers are for. */
.yf-analytics-scope-chip {
    display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 999px; vertical-align: middle;
    background: color-mix(in srgb, var(--bs-primary) 16%, transparent); color: var(--bs-primary); font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.yf-analytics-scope-chip[hidden] { display: none; }
body.dark-theme .yf-analytics-scope-chip { background: rgba(60, 207, 145, .16); color: #3ccf91; }
:root body.yf-redesign.yf-dashboard-auth .yf-analytics-scope-chip { background: color-mix(in srgb, var(--rd-accent) 18%, transparent); color: var(--rd-accent); }
#financial-overview-card .yf-analytics-scope-chip { background: rgba(255, 255, 255, .16); color: #fff; }
