/* ===== Work calendar ===================================================== */
.wcal { display: grid; gap: 4px; }
.wcal__row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wcal__head div { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); text-align: center; padding: 4px 0; }
.wcal__day {
  min-height: 92px; padding: 4px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.wcal__day.is-off { background: var(--surface-sunken); }
.wcal__day.is-out { background: transparent; border-style: dashed; opacity: 0.5; }
.wcal__day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.wcal__num { align-self: flex-start; min-width: 32px; min-height: 32px; display: inline-grid; place-items: center; border-radius: 6px; font-weight: 700; font-size: var(--fs-sm); color: var(--ink); text-decoration: none; }
.wcal__num:hover { background: var(--accent-soft); }
.wcal__chip {
  display: block; font-size: 11px; font-weight: 600; line-height: 1.3; padding: 2px 6px; border-radius: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none;
  background: var(--plan-soft); color: var(--ink-2); border-left: 3px solid var(--ink-3);
}
.wcal__chip--holiday { border-left-color: #e34948; }
.wcal__chip--extra_workday { border-left-color: #52514e; }
.wcal__chip--vacation { border-left-color: #2a78d6; }
.wcal__chip--sick { border-left-color: #eb6834; }
.wcal__chip--business_trip { border-left-color: #6250d6; }
.wcal__chip--unpaid_leave { border-left-color: #898781; }
.wcal__chip--personal_day { border-left-color: #e87ba4; }
.wcal__chip--overtime { border-left-color: #eda100; }
.wcal__chip--remote { border-left-color: #1baf7a; }
.wcal-list .wcal__chip { flex: none; }
.wcal__short, .wcal__legend { display: none; }
@media (max-width: 640px) {
  .wcal__day { min-height: 64px; padding: 2px; }
  /* Two letters on the kind's colour instead of a bare colour stripe (audit M-11). */
  /* Dark letters on light colours, white on the three dark ones: readable (≥ 4.5:1) on each. */
  .wcal__chip { padding: 1px 2px; border-left-width: 0; text-align: center; color: #111110; font-size: 10px; line-height: 1.4; }
  .wcal__chip--vacation, .wcal__chip--business_trip, .wcal__chip--extra_workday { color: #ffffff; }
  .wcal__long { display: none; }
  .wcal__short { display: inline; }
  .wcal__legend { display: block; }
  .wcal__chip--holiday { background: #e34948; } .wcal__chip--vacation { background: #1c5cab; } .wcal__chip--sick { background: #eb6834; }
  .wcal__chip--business_trip { background: #6250d6; } .wcal__chip--overtime { background: #eda100; } .wcal__chip--unpaid_leave { background: #898781; }
  .wcal__chip--personal_day { background: #e87ba4; } .wcal__chip--remote { background: #1baf7a; } .wcal__chip--extra_workday { background: #52514e; }
}

/* ===== Operations / import / reconciliation ============================= */
.select--cat { max-width: 230px; min-height: 34px; padding-top: 4px; padding-bottom: 4px; font-size: var(--fs-sm); }
.select--cat.is-empty { border-style: dashed; color: var(--ink-3); }
.review tr.is-invalid td { background: var(--over-soft); }
.review tr.is-duplicate td { background: var(--pending-soft); }
.review-tabs { display: flex; flex-wrap: wrap; max-width: 100%; }
.recon { align-items: flex-start !important; flex-wrap: wrap; }
.recon__options { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== Reports =========================================================== */
.cat-report__bar { min-width: 160px; }
.cat-report__bar progress { width: 100%; }
@media (max-width: 767px) { .cat-report__bar, .cat-report__bar-h { display: none; } }

/* ===== Forecast ========================================================== */
.forecast-controls { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.forecast-controls .segmented { display: flex; flex-wrap: wrap; max-width: 100%; }
.forecast-extra { min-width: 0; border: 0; margin: 0; padding: 0; }
.forecast-extra legend { font-weight: 600; margin-bottom: 4px; }
.forecast-custom > summary { list-style: none; }
.forecast-custom > summary::-webkit-details-marker { display: none; }
.forecast-custom__form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
.forecast-custom__form .input { width: auto; min-height: 40px; }
.forecast-scenario-hint { margin: 0; max-width: 72ch; }
.forecast-gap p { margin: 0; }
.forecast-gap .btn-group { margin-top: 2px; }

.forecast-days { list-style: none; margin: 0; padding: 0 20px 12px; }
.forecast-day { padding: 12px 0; border-bottom: 1px solid var(--line); }
.forecast-day:last-child { border-bottom: 0; }
.forecast-day.is-today { margin: 0 -20px; padding: 12px 20px; background: var(--accent-soft); }
.forecast-day.is-negative .forecast-day__head strong { color: var(--over); }
.forecast-day.is-past { color: var(--ink-2); }
.forecast-day__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.forecast-day__closing { margin-left: auto; font-weight: 650; }
.forecast-day__closing.is-negative, td.is-negative { color: var(--over); }
.forecast-day__events { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: var(--fs-sm); }
.forecast-day__events li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.forecast-day__events .num { margin-left: auto; font-variant-numeric: tabular-nums; }
.forecast-day__title { min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 639px) {
  .forecast-days { padding: 0 16px 8px; }
  .forecast-day.is-today { margin: 0 -16px; padding: 12px 16px; }
  .forecast-day__closing { margin-left: 0; width: 100%; }
}

/* ===== Dashboard: «Можно потратить до выплаты» =========================== */
.spendable__body { display: grid; gap: 16px 32px; grid-template-columns: minmax(0, 1fr); }
.spendable__label { margin: 0; font-size: var(--fs-sm); color: var(--ink-2); font-weight: 600; }
.spendable__value { margin: 4px 0; font-size: var(--fs-hero); font-weight: 750; line-height: 1.1; overflow-wrap: anywhere; }
.spendable__main p { margin: 0; }
.spendable__parts { margin: 0; display: grid; gap: 8px; font-size: var(--fs-sm); align-content: start; }
.spendable__parts div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.spendable__parts dt { color: var(--ink-2); }
.spendable__parts dd { margin: 0; font-weight: 600; text-align: right; }
.spendable__gap { background: var(--over-soft); color: var(--ink); }
.spendable__value--unknown { font-size: var(--fs-xl); color: var(--ink-2); }
.spendable__missing { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; font-size: var(--fs-sm); }
.spendable__missing li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--pending-soft); color: var(--ink); }
.spendable__missing li span { flex: 1 1 220px; }
@media (min-width: 900px) {
  .spendable__body { grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); }
}

/* ===== Loan document review ============================================== */
.field--check .input, .field--check .select { border-color: var(--pending-mark); box-shadow: 0 0 0 1px var(--pending-mark); }
.field__hint--missing { color: var(--pending); font-weight: 600; }
.doc-source { display: block; margin-top: 2px; color: var(--ink-3); font-style: italic; overflow-wrap: anywhere; }

/* ===== Tariffs ============================================================ */
.plans { display: grid; gap: var(--gutter); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.plan.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan h2 { margin: 0; }
.plan__price { margin: 0; font-size: var(--fs-xl); font-weight: 700; }
.plan__features { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; font-size: var(--fs-sm); }

/* ===== Onboarding ========================================================= */
.onboarding { display: grid; gap: var(--gutter); grid-template-columns: minmax(0, 1fr); max-width: 1040px; }
.onboarding__steps ol { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 2px; counter-reset: step; }
.onboarding__steps li { counter-increment: step; }
.onboarding__steps a { display: flex; align-items: center; gap: 10px; min-height: var(--touch); padding: 4px 10px; border-radius: var(--radius-sm); color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); }
.onboarding__steps a::before { content: counter(step); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: var(--fs-xs); flex: none; }
.onboarding__steps .is-current a { background: var(--accent-soft); color: var(--accent-ink); }
.onboarding__steps .is-done a::before { content: "✓"; background: var(--fact); border-color: var(--fact); color: #fff; }
.onboarding__steps .is-skipped a { color: var(--ink-3); }
.onboarding__card h1 { margin: 0; }
.onboarding__card p { margin: 0; max-width: 68ch; }
/* Setup bills: a table on wide screens; on a phone each payment is a small card with visible labels. */
.bill-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 639px) {
  .bills-wrap { overflow: visible; }
  .bills-table thead { display: none; }
  .bills-table, .bills-table tbody, .bills-table td { display: block; width: 100%; }
  .bills-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .bills-table td { padding: 0; border: 0; }
  .bills-table td:first-child, .bills-table td:last-child { grid-column: 1 / -1; }
  .bills-table .bill-label { position: static; width: auto; height: auto; margin: 0 0 4px; overflow: visible; clip: auto; white-space: normal; display: block; font-size: var(--fs-xs); color: var(--ink-2); }
}
.onboarding__skip { display: inline-block; }
@media (min-width: 900px) {
  .onboarding { grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
}

/* ===== Help ================================================================ */
.help { display: grid; gap: var(--gutter); grid-template-columns: minmax(0, 1fr); }
.help__toc ol { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.help__article h2 { margin: 0; }
.help__article p { margin: 0; max-width: 72ch; }
.help__article section { scroll-margin-top: 80px; }
.checklist { list-style: none; margin: 0; display: grid; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.checklist__mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: var(--fs-xs); flex: none; }
.checklist .is-done { color: var(--ink-3); }
.checklist .is-done .checklist__mark { background: var(--fact); border-color: var(--fact); color: #fff; }
.glossary { margin: 0; display: grid; gap: 4px 16px; }
.glossary dt { font-weight: 650; margin-top: 8px; }
.glossary dd { margin: 0; color: var(--ink-2); max-width: 72ch; }
.hint-link { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 6px; border-radius: 50%; border: 1px solid var(--line-strong);
  font-size: 12px; font-weight: 700; color: var(--ink-3); text-decoration: none; vertical-align: middle; }
.hint-link:hover, .hint-link:focus-visible { color: var(--accent-ink); border-color: var(--accent); }
@media (min-width: 1100px) {
  .help { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
}

/* ===== Public page ========================================================= */
.landing { background: var(--bg); }
.landing main { max-width: 1160px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 56px; }
.landing__top { max-width: 1160px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.landing__nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-right: auto; font-size: var(--fs-sm); }
.landing__nav a { color: var(--ink-2); text-decoration: none; }
.landing__nav a:hover { color: var(--accent-ink); }
.landing__footer { border-top: 1px solid var(--line); padding: 24px 16px; text-align: center; color: var(--ink-3); font-size: var(--fs-sm); }
.landing__footer p { margin: 0 0 8px; }

/* ===== Legal pages ========================================================== */
.legal { max-width: 72ch; margin: 0 auto; padding: 32px 16px 48px; display: grid; gap: 20px; }
.legal h1 { margin: 0; }
.legal h2 { margin: 8px 0 0; font-size: var(--fs-lg); }
.legal p, .legal ul { margin: 0; }
.legal ul { padding-left: 1.2em; display: grid; gap: 6px; }
.legal section { display: grid; gap: 10px; scroll-margin-top: 80px; }
.legal__edition { color: var(--ink-3); font-size: var(--fs-sm); }
.legal__operator { margin: 0; display: grid; gap: 6px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.legal__operator div { display: grid; gap: 2px; }
.legal__operator dt { color: var(--ink-3); font-size: var(--fs-xs); }
.legal__operator dd { margin: 0; overflow-wrap: anywhere; }
.legal__missing { background: var(--pending-soft); color: var(--pending); padding: 0 4px; border-radius: 4px; }
.consent { align-items: flex-start; }
.hero { display: grid; gap: 32px; align-items: center; padding-top: 24px; }
.hero h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.2rem); line-height: 1.08; margin: 8px 0 16px; text-wrap: balance; letter-spacing: -0.015em; }
.hero__lead { font-size: var(--fs-lg); color: var(--ink-2); max-width: 56ch; margin: 0 0 20px; }
.hero__text .btn-group { margin-bottom: 12px; }
.hero__demo { margin: 0; min-width: 0; }
.hero__demo figcaption { margin-top: 8px; }
.eyebrow { margin: 0; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); }
.landing-section h2, .landing-cta h2 { font-size: var(--fs-xl); margin: 0 0 16px; text-wrap: balance; }
.landing-section h3 { margin: 0 0 6px; font-size: var(--fs-md); }
.landing-section p { margin: 0; color: var(--ink-2); }
.cards-3 { display: grid; gap: var(--gutter); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.steps { margin: 0; padding-left: 1.3em; display: grid; gap: 12px; max-width: 72ch; }
.steps li::marker { font-weight: 700; color: var(--accent-ink); }
.facts { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; max-width: 72ch; color: var(--ink-2); }
.faq { display: grid; gap: 8px; max-width: 760px; }
.faq p { margin: 0; color: var(--ink-2); }
.landing-cta { text-align: center; padding: 40px 16px; background: var(--accent-soft); border-radius: var(--radius-lg); display: grid; justify-items: center; gap: 12px; }
.landing-cta p { margin: 0; color: var(--ink-2); }
@media (min-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); padding-top: 48px; }
}
@media (max-width: 899px) {
  .onboarding__steps ol { display: flex; gap: 4px; overflow-x: auto; }
  .onboarding__steps .onboarding__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .onboarding__steps a { padding: 4px; }
}

/* Statement review on a phone (M-04): each row becomes a card – tick, date and
   description, amount on the right; category and checks full width below. */
@media (max-width: 640px) {
  .table-wrap:has(> .review) { overflow: visible; }
  .review, .review tbody { display: block; }
  .review thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .review tr { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .review td { display: block; padding: 0; border: 0; background: none; }
  .review tr.is-invalid { background: var(--over-soft); }
  .review tr.is-duplicate { background: var(--pending-soft); }
  .review td:nth-child(1) { grid-row: 1 / span 2; }
  .review td:nth-child(2) { grid-column: 2; font-size: var(--fs-sm); color: var(--ink-2); }
  .review td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .review td:nth-child(4) { grid-column: 3; grid-row: 1 / span 2; }
  .review td:nth-child(5), .review td:nth-child(6) { grid-column: 1 / -1; }
  .review td:nth-child(6):empty { display: none; }
  .review .select--cat { width: 100%; max-width: none; }
}
