:root {
  color-scheme: light;
  --font-display: "Lora", "Rutina Display Fallback", Georgia, serif;
  --font-brand: "Lora", "Rutina Wordmark Fallback", Georgia, serif;
  --font-ui: "Golos Text", "Rutina UI Fallback", system-ui, sans-serif;

  --bg: #f8f7f3;
  --bg-elevated: #fffefa;
  --surface: #fffefa;
  --surface-2: #efefeb;
  --surface-3: #e7e6e0;
  --text: #252421;
  --text-soft: #47453f;
  --muted: #615e56;
  --line: #d8d6ce;
  --line-strong: #847e72;
  --accent: #795123;
  --accent-strong: #604019;
  --accent-soft: #f1e5d2;
  --accent-contrast: #fffefa;
  --danger: #973d35;
  --danger-soft: #f7e7e4;
  --success: #3d634a;
  --success-soft: #e7eee6;
  --warning: #775512;
  --warning-soft: #f7edd3;
  --rose: #884960;
  --rose-soft: #f5e7ed;
  --info: #365d73;
  --info-soft: #e6edf0;
  --shadow-sm: 0 1px 2px rgb(43 37 27 / 8%);
  --shadow-md: 0 8px 24px rgb(43 37 27 / 10%);
  --shadow-lg: 0 20px 48px rgb(43 37 27 / 18%);
  --focus: var(--accent);
  --selection: var(--accent-soft);
  --hairline: 1px;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --container: 1320px;
  --gutter: clamp(12px, 2.4vw, 32px);
  --topbar-height: 64px;
  --text-display: clamp(32px, 4vw, 48px);
  --text-h2: clamp(26px, 2.2vw, 30px);
  --text-h3: 20px;
  --text-body: 15px;
  --text-secondary: 13px;
  --text-micro: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --control-h: 40px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  /* ANI-1: 160–240 мс — единственные длительности переходов; быстрее/медленнее нельзя. */
  --dur-fast: 160ms;
  --dur: 200ms;
  --dur-slow: 240ms;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0d0c;
  --bg-elevated: #1a1815;
  --surface: #171613;
  --surface-2: #201e1a;
  --surface-3: #292621;
  --text: #f1eae0;
  --text-soft: #d3c9bb;
  --muted: #aea396;
  --line: #37332c;
  --line-strong: #81786a;
  --accent: #d2a36a;
  --accent-strong: #e7ba81;
  --accent-soft: #36291c;
  --accent-contrast: #19120b;
  --danger: #f1a097;
  --danger-soft: #392321;
  --success: #a5c9a6;
  --success-soft: #243127;
  --warning: #e8c27b;
  --warning-soft: #372c19;
  --rose: #e4a5bd;
  --rose-soft: #382631;
  --info: #a1c4d8;
  --info-soft: #22313a;
  --shadow-sm: none;
  --shadow-md: 0 8px 24px rgb(0 0 0 / 45%);
  --shadow-lg: 0 20px 48px rgb(0 0 0 / 55%);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar, *::-webkit-scrollbar { width: 0; height: 0; display: none; }
body {
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1000px 570px at 68% 0%, var(--bg-elevated), transparent 78%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--selection); color: var(--text); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; }
h1, h2 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.025em; }
h1 { font-size: var(--text-display); overflow-wrap: anywhere; }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.amount, .table { font-variant-numeric: tabular-nums; }
.amount { text-align: right; }
p { margin: 0 0 var(--space-3); }
ul, ol { margin: 0; padding: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: var(--text-secondary); }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 12px; top: 8px; }

/* ---- Шапка (NAV-1…NAV-3) ---- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
}
.topbar__inner {
  max-width: var(--container); margin: 0 auto; min-height: var(--topbar-height);
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0 var(--gutter);
}
.topbar--bare { position: static; background: transparent; border-bottom: 0; }
.topbar__inner::after { content: ""; position: absolute; inset: auto 0 0; border-bottom: var(--hairline) solid var(--line); pointer-events: none; }
.topbar--bare .topbar__inner { justify-content: center; }
.topbar--bare .topbar__inner::after { content: none; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex: 0 0 auto; }
.brand__mark { width: 36px; height: 36px; }
.brand__word { font-family: var(--font-brand); font-size: 25px; font-weight: 600; line-height: 1; letter-spacing: -0.025em; inline-size: 3.35em; }
.mainnav { display: flex; align-items: center; gap: 2px; margin-inline: auto; }
.mainnav__link {
  display: inline-flex; align-items: center; height: 44px; padding: 0 9px; position: relative;
  border-radius: var(--radius-sm); color: var(--muted); text-decoration: none;
  font-size: 13.5px; white-space: nowrap;
}
.mainnav__link:hover { color: var(--text); background: var(--surface-2); }
.mainnav__link.is-active { color: var(--text); }
.mainnav__link.is-active::after { content: ""; position: absolute; inset: auto 9px 2px; border-bottom: var(--hairline) solid var(--accent); }
.topbar__tools { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.iconbtn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--muted);
  cursor: pointer; position: relative;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.iconbtn--ghost { width: 34px; height: 34px; }
.iconbtn__badge {
  position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--accent); color: var(--accent-contrast);
  font-size: 10.5px; font-weight: 600; line-height: 16px; text-align: center;
}
.accountbtn { display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); text-decoration: none; }
.accountbtn:hover { background: var(--surface-2); }
.topbar__burger { display: none; width: 44px; height: 44px; }
.avatar {
  display: inline-grid; place-items: center; border-radius: 50%;
  background: var(--surface-3); color: var(--text-soft);
  font-size: 13px; font-weight: 600; width: 40px; height: 40px; flex: 0 0 auto;
}
.avatar--sm { width: 32px; height: 32px; font-size: 11.5px; }
.avatar--clay { background: color-mix(in srgb, var(--accent) 24%, var(--surface)); color: var(--accent-strong); }
.avatar--sage { background: color-mix(in srgb, var(--success) 20%, var(--surface)); color: var(--success); }
.avatar--rose { background: var(--rose-soft); color: var(--rose); }
.avatar--sky { background: var(--info-soft); color: var(--info); }
.avatar--sand { background: var(--warning-soft); color: var(--warning); }

/* ---- Страница ---- */
.page {
  width: 100%; max-width: var(--container); margin: 0 auto; flex: 1 0 auto;
  padding: clamp(16px, 2.6vw, 32px) var(--gutter) 40px;
}
.page > :first-child { margin-top: 0; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.pagehead__title { display: flex; flex-direction: column; gap: 4px; }
.pagehead__sub { color: var(--muted); font-size: 13.5px; }
.pagehead__actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* ---- Кнопки и поля (UI-4, UI-5) ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-h); padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; line-height: 1.25; font-weight: 500; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active:not(:disabled, .is-disabled, [aria-disabled="true"]) { border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-contrast); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn--danger:hover { background: var(--danger-soft); }
.btn.btn--sm { min-height: 36px; height: 36px; padding: 0 10px; font-size: 13px; }
.btn--icon { width: var(--control-h); padding: 0; }
.btn:disabled, .btn.is-disabled, .iconbtn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.iconbtn:enabled:active { background: var(--surface-3); }
.linkbtn { border: 0; background: none; color: var(--accent); font: inherit; font-size: 13.5px; cursor: pointer; padding: 4px 2px; text-decoration: none; }
.linkbtn:hover { color: var(--accent-strong); text-decoration: underline; }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.form__row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.form__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: var(--space-4); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 13px; color: var(--text-soft); font-weight: 500; }
.field__hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.input, .select, .textarea {
  width: 100%; min-height: var(--control-h); height: var(--control-h); padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; line-height: 1.4;

}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); }
:is(.input, .select, .textarea):disabled { opacity: 0.6; cursor: not-allowed; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.formerror { color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13.5px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: 14px; cursor: pointer; }
.form :is(.input, .select), .filters :is(.input, .select) { min-height: 44px; }
label:has(> input:is([type="checkbox"], [type="radio"])) { min-inline-size: 32px; min-block-size: 32px; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }
.filters { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.segmented a, .segmented button {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font: inherit; font-size: 13.5px; text-decoration: none; cursor: pointer;
}
.segmented :is(a, button):hover { background: var(--surface-2); color: var(--text); }
.segmented .is-active { background: var(--accent-soft); color: var(--text); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

/* ---- Карточки, сетки ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); box-shadow: var(--shadow-sm); }
.card--flat { background: transparent; border-width: var(--hairline) 0 0; border-radius: 0; padding-inline: 0; box-shadow: none; }
.card__title { font-size: var(--text-h3); margin-bottom: var(--space-3); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.grid { display: grid; gap: var(--space-4); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.divider { height: 1px; background: var(--line); border: 0; margin: var(--space-3) 0; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-soft); font-size: var(--text-micro); }
.tag--danger { background: var(--danger-soft); color: var(--danger); }
.tag--success { background: var(--success-soft); color: var(--success); }
.tag--warning { background: var(--warning-soft); color: var(--warning); }
.tag--accent { background: var(--accent-soft); color: var(--accent-strong); }
.tag--info { background: var(--info-soft); color: var(--info); }
.tag--rose { background: var(--rose-soft); color: var(--rose); }
.kv { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 6px var(--space-4); font-size: 14px; }
.kv dt { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  /* UI-2: длинные термины (правила/причины) не должны расширять страницу на телефоне. */
  .kv { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
  .kv dt { margin-top: 6px; }
}
.list { display: flex; flex-direction: column; }
.list__row { display: flex; align-items: center; gap: var(--space-3); padding: 10px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.list__row:last-child { border-bottom: 0; }
.list__row:hover { background: var(--surface-2); border-radius: var(--radius-sm); }
.list__main { min-width: 0; flex: 1 1 auto; }
.list__title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__meta { font-size: 12.5px; color: var(--muted); }
.skeleton { display: block; min-height: 1em; background: var(--surface-3); border-radius: var(--radius-sm); }
.empty { color: var(--muted); font-size: 14px; padding: var(--space-3) 0; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--surface-3); color: var(--text-soft); font-size: 12px; font-weight: 600; }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent); font-size: 14px; }
.alert--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.alert--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }

/* ---- Инфострока (SLG-1…SLG-3, NAV-7) ---- */
.infobar {
  flex: 0 0 auto; width: 100%; max-width: var(--container); margin: 0 auto;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px;
  padding: 14px clamp(12px, 2.4vw, 32px) 18px;
  color: var(--muted); font-size: 12.5px; line-height: 1.45;
  border-top: 1px solid var(--line); overflow-wrap: anywhere;
}
.infobar__slogan { font: inherit; color: var(--muted); font-size: 12.5px; max-width: 78ch; }
.infobar__item { white-space: nowrap; }
.infobar__signature { white-space: nowrap; }
.infobar__link { color: var(--muted); }
.infobar__link:hover { color: var(--accent); }

/* ---- Flash и тост ---- */
.flash { margin: 0 auto var(--space-4); padding: 10px 14px; border-radius: var(--radius-sm); background: var(--success-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--success) 26%, transparent); font-size: 14px; max-width: 1320px; }
.flash.is-dismissing { opacity: 0; transition: opacity var(--dur-slow) var(--ease); }
.flash--error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-md); z-index: 90; opacity: 0; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---- Оверлеи: поиск и уведомления (NAV-4, NAV-6, ANI-2) ---- */
.overlay { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: center; align-items: flex-start; padding: clamp(12px, 8vh, 90px) 16px 24px; }
.overlay__backdrop { position: fixed; inset: 0; background: rgb(20 16 11 / 45%); opacity: 0; transition: opacity var(--dur) var(--ease); }
.overlay[data-state="open"] .overlay__backdrop { opacity: 1; }
.overlay__panel { position: relative; width: min(680px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); transform: translateY(-8px) scale(0.995); opacity: 0; transition: transform var(--dur-slow) var(--ease), opacity var(--dur-slow) var(--ease); }
.overlay[data-state="open"] .overlay__panel { transform: none; opacity: 1; }
.overlay--right { justify-content: flex-end; padding: 0; }
.notifpanel { position: relative; height: 100%; width: min(420px, 100%); background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; transform: translateX(16px); opacity: 0; transition: transform var(--dur-slow) var(--ease), opacity var(--dur-slow) var(--ease); }
.overlay[data-state="open"] .notifpanel { transform: none; opacity: 1; }
@starting-style {
  .overlay[data-state="open"] .overlay__backdrop { opacity: 0; }
  .overlay[data-state="open"] .overlay__panel { opacity: 0; transform: translateY(-8px); }
  .overlay[data-state="open"] .notifpanel { opacity: 0; transform: translateX(16px); }
}
.notifpanel__head { display: flex; align-items: center; gap: var(--space-2); padding: 16px; border-bottom: 1px solid var(--line); }
.notifpanel__title { font-size: 20px; margin-right: auto; }
.notifpanel__list { padding: 8px 12px 24px; overflow-y: auto; }
.searchbox { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.searchbox__icon { color: var(--muted); flex: 0 0 auto; }
.searchbox:focus-within { border-bottom-color: var(--focus); }
.searchbox__input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.searchbox__input { min-width: 0; flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; outline: none; height: 32px; }
.searchbox__hint { padding: 12px 18px 0; color: var(--muted); font-size: 13px; }
.searchresults { padding: 8px 10px 16px; max-height: min(60vh, 520px); overflow-y: auto; }
.searchresults__group { padding: 10px 8px 4px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.searchresults__row { display: flex; gap: 10px; align-items: center; padding: 9px 8px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); }
.searchresults__row:hover, .searchresults__row:focus-visible { background: var(--surface-2); }
.searchresults__title { font-size: 14px; }
.searchresults__meta { font-size: 12.5px; color: var(--muted); }
.notifitem { display: flex; gap: 10px; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.notifitem:last-child { border-bottom: 0; }
.notifitem__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: 0 0 auto; }
.notifitem__dot--read { background: transparent; border: 1px solid var(--line-strong); }
.notifitem__body { flex: 1; font-size: 13.5px; }
.notifitem__meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.notifitem__title { font-weight: 600; font-size: 13.5px; }

/* ---- Главная ---- */
.home { display: flex; flex-direction: column; gap: var(--space-5); }
.home__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.home__greeting { font-size: clamp(26px, 2.8vw, 36px); }
.daycontext { display: flex; align-items: baseline; gap: var(--space-3); color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.daycontext__date { font-family: var(--font-display); color: var(--text-soft); font-size: 17px; }
.daycontext__time { font-variant-numeric: tabular-nums; }
.home__grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.rail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); box-shadow: var(--shadow-sm); }
.rail__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: 0; }
.rail__title { font-family: var(--font-display); font-size: 18px; }
.rail__track { position: relative; height: 56px; margin-top: 26px; border-top: 2px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.rail__fill { position: absolute; left: 0; top: -2px; height: 2px; width: 100%; background: var(--accent); transform-origin: left center; transform: scaleX(var(--now-frac, 0.5)); transition: transform var(--dur) var(--ease); }
.rail__marker { position: absolute; top: -9px; bottom: -9px; left: 0; width: 2px; background: var(--accent); transform: translateX(0); transition: transform var(--dur) var(--ease); }
.rail__nowlabel { position: absolute; top: -24px; left: 8px; white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--accent-strong); }
.rail__nowlabel--left { left: auto; right: 8px; }
.rail__item { position: absolute; left: var(--pos); top: 10px; height: 34px; transform: translateX(-50%); display: flex; align-items: center; text-decoration: none; color: var(--text-soft); }
.rail__pip { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface); flex: 0 0 auto; }
.rail__item--task .rail__pip { border-radius: 2px; background: var(--info); }
.rail__item--event .rail__pip { background: var(--success); }
.rail__item--trip .rail__pip { background: var(--warning); }
.rail__scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2); }
.counter { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.counter:hover { background: var(--surface-2); }
.counter__value { font-family: var(--font-display); font-size: 24px; line-height: 1.1; }
.counter__label { font-size: 12.5px; color: var(--muted); }
.jumpmenu { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-md); padding: 6px; display: flex; flex-direction: column; min-width: 170px; }
.jumpmenu a, .jumpmenu button { text-align: left; padding: 8px 10px; border-radius: 7px; border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--text); text-decoration: none; cursor: pointer; }
.jumpmenu a:hover, .jumpmenu button:hover { background: var(--surface-2); }

/* ---- Доска и календарь (PLAN-1, CAL-1…CAL-5) ---- */
.planning-toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.board { display: grid; grid-template-columns: repeat(5, minmax(230px, 1fr)); gap: var(--space-3); overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board__col { background: color-mix(in srgb, var(--surface-2) 55%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 220px; }
.board__col.is-drop { border-color: var(--accent); background: var(--accent-soft); }
.board__colhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; padding: 2px 4px; }
.board__coltitle { font-size: 13px; font-weight: 600; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.05em; }
.board__cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.taskcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-decoration: none; color: var(--text); cursor: grab; box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease); }
.taskcard:hover { border-color: var(--line-strong); }
.taskcard.is-dragging { opacity: 0.55; transform: rotate(0.6deg) scale(0.99); }
.taskcard.is-highlight { border-color: var(--accent); background: var(--accent-soft); }
.taskcard__title { font-size: 14px; line-height: 1.35; }
.taskcard__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--muted); }
.taskcard__level { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.taskcard__level--important { background: var(--danger); }
.taskcard__level--normal { background: var(--warning); }
.taskcard__level--background { background: var(--line-strong); }
.calendar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.calendar__head { display: flex; align-items: center; gap: var(--space-3); padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.calendar__title { font-family: var(--font-display); font-size: 20px; margin-right: auto; }
.calendar__weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.calendar__weekday { padding: 8px 10px; font-size: 12px; color: var(--muted); text-align: left; }
.calendar__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar__cell { position: relative; min-height: 112px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 7px 8px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.calendar__cell:nth-child(7n) { border-right: 0; }
.calendar__cell--out { background: color-mix(in srgb, var(--surface-2) 55%, transparent); color: var(--muted); }
.calendar__cell--weekend { background: color-mix(in srgb, var(--surface-2) 35%, var(--surface)); }
.calendar__cell--holiday { background: color-mix(in srgb, var(--warning-soft) 60%, var(--surface)); }
.calendar__cell--short { background: color-mix(in srgb, var(--warning-soft) 30%, var(--surface)); }
.calendar__cell--today { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar__cell--cashgap { background: color-mix(in srgb, var(--danger-soft) 90%, var(--surface)); }
.calendar__celllink { position: absolute; inset: 0; z-index: 0; }
.calendar__daynum { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-soft); font-variant-numeric: tabular-nums; align-self: flex-start; }
.calendar__today-badge { font-size: 10px; color: var(--accent-contrast); background: var(--accent); border-radius: 5px; padding: 0 4px; }
.calendar__items { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chip { display: block; width: 100%; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); border-left: 2px solid var(--line-strong); color: var(--text-soft); font-size: 11.5px; line-height: 1.35; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { background: var(--accent-soft); color: var(--text); }
.chip--event { border-left-color: var(--success); }
.chip--task { border-left-color: var(--info); }
.chip--trip { border-left-color: var(--warning); }
.chip--hold { border-left-color: var(--rose); background: var(--rose-soft); }
.chip--birthday { border-left-color: var(--rose); }
.chip--high { border-color: var(--accent); background: var(--accent-soft); }
.calendar__more { font-size: 11px; color: var(--muted); }

/* ---- Люди, питомцы, финансы, документы ---- */
.peoplegroup { margin-bottom: var(--space-6); }
.peoplegroup__head { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-3); }
.peoplegroup__title { font-size: 20px; }
.peoplegroup__count { color: var(--muted); font-size: 13px; }
.personcard { display: flex; flex-direction: column; gap: var(--space-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); text-decoration: none; color: var(--text); }
.personcard:hover { border-color: var(--line-strong); }
.personcard__head { display: flex; align-items: center; gap: var(--space-3); }
.personcard__name { font-size: 16px; }
.personcard__meta { font-size: 12.5px; color: var(--muted); }
.personcard__now { font-size: 13px; color: var(--text-soft); }
.petcard__photo { width: 100%; aspect-ratio: 4 / 3; border-radius: 10px; background: linear-gradient(135deg, var(--surface-2), var(--surface-3)); display: grid; place-items: center; color: var(--muted); font-family: var(--font-display); font-size: 40px; }
.petcard__photo--cat { background: linear-gradient(135deg, var(--warning-soft), var(--surface-2)); }
.petcard__photo--dog { background: linear-gradient(135deg, var(--success-soft), var(--surface-2)); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat__value { font-family: var(--font-display); font-size: 26px; }
.stat__label { font-size: 12.5px; color: var(--muted); }
.weight-chart { width: 100%; height: 90px; }
.money--income { color: var(--success); }
.money--expense { color: var(--danger); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.tree { display: flex; flex-direction: column; gap: var(--space-3); }
.tree__group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); }
.tree__title { font-size: 18px; margin-bottom: var(--space-3); }
.tile { display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); text-decoration: none; cursor: grab; }
.tile:hover { border-color: var(--accent); background: var(--accent-soft); }
.tile.is-dragging { opacity: 0.6; }
.dropzone { min-height: 48px; border: 1px dashed transparent; border-radius: 10px; padding: 4px; }
.dropzone.is-drop { border-color: var(--accent); background: var(--accent-soft); }
.docrow { display: grid; grid-template-columns: 40px 1fr auto; gap: var(--space-3); align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.docrow:last-child { border-bottom: 0; }
.docrow__icon { width: 40px; height: 48px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter__fill { height: 100%; background: var(--accent); border-radius: 4px; }
.meter__fill--danger { background: var(--danger); }
.meter__fill--success { background: var(--success); }

/* ---- Личный кабинет ---- */
.account { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.account__nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; }
.account__nav a { padding: 8px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; }
.account__nav a:hover { background: var(--surface-2); color: var(--text); }
.account__nav a.is-active { background: var(--accent-soft); color: var(--text); }
.authpage .page { display: flex; align-items: center; justify-content: center; padding-top: clamp(24px, 8vh, 80px); }
.authcard { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: clamp(20px, 4vw, 34px); }
.authcard__title { font-size: 28px; margin-bottom: var(--space-4); }
.authcard__note { color: var(--text-soft); font-size: 14px; margin-bottom: var(--space-4); }
.authcard__alt { margin: var(--space-4) 0 0; font-size: 13.5px; }
.statepage { max-width: 560px; margin: 10vh auto; display: flex; flex-direction: column; gap: var(--space-3); align-items: flex-start; }
.notice { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; color: var(--text-soft); font-size: 13.5px; }

/* ---- Уточнение места прогноза прямо в виджете (WX-2) ---- */
.weatherplace { display: inline-flex; align-items: center; gap: 6px; align-self: center; margin-left: 4px; }
.weatherplace .select { width: auto; min-width: 138px; max-width: 210px; }
.select.select--sm { height: 32px; min-height: 32px; font-size: 13px; padding: 0 30px 0 10px; background-position: calc(100% - 15px) 13px, calc(100% - 10px) 13px; }

/* ---- Напоминание о кассовом разрыве (HOME-5): цвет дублируется значком и текстом ---- */
.cashgap-reminder__icon { font-size: 18px; line-height: 1; flex: 0 0 auto; }
.cashgap-reminder--soon { border-left: 4px solid var(--danger); }
.cashgap-reminder--later { border-left: 4px solid var(--warning); }

/* Скрытая подпись для доступности (не влияет на раскладку). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Подсказки (TIP-1…TIP-4): небольшой tooltip, не перекрывает и не сдвигает раскладку ---- */
.tooltip {
  position: fixed; z-index: 120; max-width: min(300px, calc(100vw - 24px));
  padding: 6px 9px; border-radius: 8px; background: var(--text); color: var(--bg);
  font-size: 12.5px; line-height: 1.35; box-shadow: var(--shadow-md);
  pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.tooltip.tooltip--text {
  padding: 0; border: 0; border-radius: 0; box-shadow: none;
  background: transparent; color: var(--text); transform: none;
  font-size: 12px; overflow-wrap: anywhere;
}
.tooltip.tooltip--rail {
  position: absolute; top: 0; width: min(300px, 100%); max-width: none; height: 56px;
  overflow: hidden; transition: none;
}
.tooltip__rail-title {
  max-height: 32px; line-height: 16px; overflow: hidden;
  scrollbar-width: none;
}
.tooltip__rail-title::-webkit-scrollbar { display: none; }
.tooltip__rail-title-track > span { display: block; white-space: pre; }
.tooltip__rail-meta { max-height: 24px; line-height: 12px; overflow: hidden; }
.tooltip.tooltip--edge {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tooltip.is-visible { opacity: 1; transform: translateY(0); }
.tooltip.tooltip--below { transform: translateY(-4px); }
.tooltip.tooltip--below.is-visible { transform: translateY(0); }
/* Термин с подсказкой: подчёркивание точками, а не иконка «?» (TIP-3). */
.hastip { border-bottom: 1px dotted var(--line-strong); cursor: help; }

/* ---- Полная страница поиска (NAV-5, PLC-10): общие токены и компоненты ---- */
.searchpage { max-width: 920px; margin: 0 auto; }
.searchpage__form { display: flex; align-items: flex-end; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.searchpage__field { flex: 1 1 260px; }
.searchpage__results { padding: 4px 12px 12px; }
.searchpage__results .searchresults { max-height: none; overflow: visible; padding: 0; }
.searchpage__results .searchresults__group:first-child { padding-top: 8px; }

/* ---- Адаптив (UI-1, NAV-3) ---- */
@media (max-width: 1180px) {
  .topbar__inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: var(--topbar-height); gap: 0; }
  .topbar__tools { grid-area: 1 / 2; }
  .mainnav {
    display: none;
    position: absolute;
    inset: 100% 0 auto;
    margin: 0;
    padding: var(--space-2) var(--gutter) var(--space-3);
    max-height: calc(100dvh - var(--topbar-height));
    overflow: auto;
    border-block: var(--hairline) solid var(--line);
    background: var(--bg);
    box-shadow: var(--shadow-md);
  }
  .mainnav.is-open { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mainnav__link { padding: 0 var(--space-2); }
  .mainnav__link.is-active::after { inset-inline: var(--space-2); }
  .topbar--bare .topbar__inner { display: flex; }
  .topbar__burger { display: inline-grid; }
  .account { grid-template-columns: 1fr; }
  .account__nav { flex-direction: row; flex-wrap: wrap; position: static; }
}
@media (max-width: 760px) {
  :root { --topbar-height: 56px; }
  .page { padding-top: 16px; padding-bottom: 28px; }
  .brand__word { font-size: 22px; }
  .brand__mark { width: 32px; height: 32px; }
  .rail { padding: var(--space-3); }
  .rail__world { display: none; }
  .rail__title { font-size: 16px; }
  .calendar__cell { min-height: 84px; }
  .calendar__weekday { padding: 6px 5px; font-size: 10.5px; }
  .board { grid-template-columns: 1fr; }
  .peoplegroup__title { font-size: 18px; }
  .infobar { padding-bottom: 22px; }
  .topbar__tools { gap: 0; }
}
@media (max-width: 430px) {
  .calendar__cell { min-height: 72px; padding: 4px; }
  .chip { font-size: 10.5px; padding: 1px 4px; }
  .calendar__daynum { font-size: 11.5px; }
  .home__head { gap: var(--space-2); }
}
@media (prefers-reduced-motion: reduce) {
  /* ANI-4: движение мгновенное. Задержки тоже обнуляем — иначе элементы каскада
     оставались бы в стартовом (полупрозрачном) состоянии и снимки «плыли». */
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: 0.001ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
  .tooltip__rail-title { overflow-x: auto; pointer-events: auto; }
}

/* ==== UX-1: оболочка и главная — цели нажатия ≥44, раскрытия, меню действий, компактная главная ==== */

/* UI-6/UX-1: единая минимальная цель нажатия 44×44 (кроме inline-ссылок внутри текста).
   Высота токена --control-h (40px) и общая высота полей по UI-4 не меняются: минимум
   задаётся отдельным слоем, чтобы не ломать контракт общих компонентов. */
.btn, .linkbtn, .iconbtn, .iconbtn--ghost, .accountbtn, .mainnav__link,
.segmented a, .segmented button, .jumpmenu a, .jumpmenu button,
.routecard__tab, .menu__toggle, .menu__item, .expander__summary, .banner__summary,
.brand, .skip-link, .list__row, .yearago__item, .rail__item, .placechip, .counter,
.docrow, .tile, .personcard, .board__colhead, .weatherplace__summary, .suggestionrow {
  min-height: 44px;
}
.iconbtn, .iconbtn--ghost, .accountbtn, .menu__toggle, .btn--icon { min-width: 44px; }
.skip-link { display: inline-flex; align-items: center; }
.mainnav__link { display: inline-flex; align-items: center; }
.rail__item { justify-content: center; }
.weatherplace__summary, .expander__summary, .banner__summary, .menu > summary { list-style: none; }
.weatherplace__summary::-webkit-details-marker, .expander__summary::-webkit-details-marker,
.banner__summary::-webkit-details-marker, .menu > summary::-webkit-details-marker { display: none; }

/* Раскрытие (details/summary): компактная строка, тело — по клику (UI-6/UX-1). */
.expander { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.expander__summary { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px;
  cursor: pointer; color: var(--text-soft); font-size: 13.5px; }
.expander__summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; flex: 0 0 auto;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
.expander[open] > .expander__summary::after { transform: rotate(-135deg); }
.expander__body { padding: 0 12px 12px; }

/* Меню действий «…»: одно меню на строку, всплывает поверх и не двигает раскладку. */
.menu { position: relative; display: inline-flex; }
.menu__toggle { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--muted); cursor: pointer; }
.menu__toggle:hover { background: var(--surface-2); color: var(--text); }
.menu__toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu[open] > .menu__toggle { background: var(--surface-2); color: var(--text); }
.menu__list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; min-width: 180px;
  display: flex; flex-direction: column; gap: 2px; padding: 4px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-md); }
.menu__item { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border: 0;
  border-radius: 7px; background: none; color: var(--text); font: inherit; font-size: 13.5px;
  text-align: left; cursor: pointer; }
.menu__item:hover { background: var(--surface-2); }

/* Компактные баннеры главной: одна строка, тело — по клику (UX-1). */
.banner { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.banner--warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 32%, transparent); }
.banner--info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.banner__summary { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px;
  cursor: pointer; font-size: 13.5px; color: var(--text); }
.banner__icon { flex: 0 0 auto; font-size: 15px; line-height: 1; }
.banner__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner__summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; flex: 0 0 auto;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
.banner[open] > .banner__summary::after { transform: rotate(-135deg); }
.banner__body { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0 14px 12px; }
.banner__note { flex: 1 1 260px; min-width: 0; font-size: 13px; color: var(--text-soft); }

/* Зона фокуса главной: приветствие, контекст дня и одно главное действие (UX-1). */
.home { gap: var(--space-4); }
.home__focus { display: flex; flex-direction: column; gap: var(--space-3); }
.home__head { align-items: center; }
.home__hello { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home__greeting { font-size: clamp(22px, 2.2vw, 30px); }
.home__next { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2px 14px; box-shadow: var(--shadow-sm); }
.home__next .attention__row { border-top: 0; padding: 8px 0; }
.weatherplace { position: relative; }
.weatherplace__summary { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;
  cursor: pointer; color: var(--accent); font-size: 13px; }
.weatherplace__form { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 0; }
.weatherplace__form .select { width: auto; min-width: 138px; max-width: 210px; }

/* Маршрутные предложения: одна карточка с переключателем «Сегодня/Завтра» (UX-1, HOME-2). */
.routecard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space-3) var(--space-4); box-shadow: var(--shadow-sm); }
.routecard__head { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.routecard__title { font-size: 16px; }
.routecard__tabs { display: inline-flex; gap: 2px; padding: 3px; margin-left: auto;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.routecard__tab { display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted);
  font: inherit; font-size: 13.5px; cursor: pointer; }
.routecard__tab.is-active { background: var(--accent-soft); color: var(--text); }
.routecard__panel { display: none; }
.routecard__panel.is-active { display: flex; flex-direction: column; gap: var(--space-2); padding-top: var(--space-2); }
.routecard__item { display: flex; align-items: flex-start; gap: var(--space-3); flex-wrap: wrap; }
.routecard__body { flex: 1 1 320px; min-width: 0; }
.routecard__item-title { font-size: 15px; }
.routecard__text { margin: 2px 0 0; font-size: 13.5px; color: var(--text-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.routecard__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.routecard__more { margin-top: 6px; }
.routecard__more .expander__body { padding-top: 8px; }

/* «Требует внимания»: единый список, чипы статуса, одно действие на строку (UX-1). */
.attention { padding: var(--space-3) var(--space-4); }
.attention__head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.attention__heading { font-size: 17px; }
.attention__links { margin-left: auto; display: inline-flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.attention__list { display: flex; flex-direction: column; }
.attention__row { display: flex; align-items: center; gap: var(--space-3); padding: 8px 0;
  border-top: 1px solid var(--line); flex-wrap: wrap; }
.attention__row:first-child, .attention__more .attention__row:first-child { border-top: 0; }
.attention__main { flex: 1 1 260px; min-width: 0; }
.attention__title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.attention__name { min-width: 0; }
.attention__meta { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.attention__actions { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.attention__more { margin-top: 6px; }
.attention__more .expander__body { padding-top: 4px; }

/* Компактные карточки главной: карта ресурсов, «год назад», кассовый разрыв (UX-1). */
.home__resources .card__head { margin-bottom: var(--space-2); gap: var(--space-2); }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.placechip { display: inline-flex; flex-direction: column; justify-content: center; gap: 0;
  min-height: 44px; padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); text-decoration: none; color: var(--text); font-size: 13.5px; line-height: 1.25; }
.placechip:hover { background: var(--accent-soft); border-color: var(--line-strong); }
.placechip__meta { font-size: 11.5px; color: var(--muted); }
.alert--compact { padding: 8px 12px; }
.home__rowcard { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: 10px 14px; }
.home__rowcard .card__head { margin: 0; }
.home__rowcard .card__title { margin: 0; font-size: 16px; }
.home__rowcard .yearago__list { flex: 1 1 auto; margin: 0; }
.home__proposals { margin: 0; }
.suggestionrow { align-items: center; padding: 10px 12px; }
.suggestionrow .list__title { white-space: normal; }
.hints__settings { margin: 0; }

/* Оболочка: компактная шапка на телефоне, меню и футер (UX-1). */
.infobar { padding: 10px clamp(12px, 2.4vw, 32px) 12px; }
@media (max-width: 760px) {
  .brand { gap: 6px; }
  .home { gap: var(--space-3); }
  .home__greeting { font-size: 22px; }
  .banner__text { white-space: normal; }
  .banner__summary { padding: 4px 12px; }
  .attention { padding: var(--space-3); }
  .attention__row { align-items: flex-start; }
  .attention__actions { margin-left: 0; }
  .routecard { padding: var(--space-3); }
  .routecard__tabs { margin-left: 0; width: 100%; }
  .routecard__tab { flex: 1 1 0; }
  .routecard__actions { width: 100%; }
  .routecard__text { -webkit-line-clamp: 3; }
  .counters { gap: 6px; }
  .counter { padding: 6px 8px; }
  .counter__value { font-size: 20px; }
  .counter__label { font-size: 11.5px; }
  .placechip { flex: 1 1 auto; }
}

/* ---- UX-1, второй слой: компактная главная до целевой высоты ≤1300 px (десктоп) ---- */
.page { padding-top: 20px; padding-bottom: 24px; }
.home { gap: var(--space-3); }
.home__hello { flex-direction: row; align-items: baseline; gap: 4px var(--space-4); flex-wrap: wrap; }
.home__greeting { font-size: clamp(24px, 2.2vw, 30px); margin: 0; }
.home__head { min-height: 44px; }
.btn { min-width: 44px; }
.link--tap { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }

/* Маршрутная карточка: заголовок, вкладки и текст в две компактные строки. */
.routecard { padding: 8px 14px; }
.routecard__head { min-height: 44px; }
.routecard__panel.is-active { padding-top: 2px; gap: 4px; }
.routecard__item { align-items: center; }
.routecard__item-title { font-size: 14.5px; margin: 0; }
.routecard__text { -webkit-line-clamp: 1; margin: 0; font-size: 13px; }

/* Баннеры, раскрытия: строка 44 px, тело — по клику. */
.banner__summary, .expander__summary { min-height: 44px; }
.banner__summary { padding: 0 12px; }
.banner__body { padding: 0 12px 10px; }
.banner__note { font-size: 12.5px; }
.expander__summary { padding: 0 12px; }

/* Шкала суток: без изменения разметки, только плотнее отступы. */
.rail { padding: 12px 16px; }
.rail__track { height: 48px; margin-top: 18px; }
.rail__item { top: 7px; min-width: 44px; }
.rail__scale { margin-top: 4px; }

/* Счётчики: четыре в строку, компактнее. */
.counters { gap: 8px; }
.counter { padding: 6px 10px; min-height: 56px; }
.counter__label { align-self: flex-start; }

/* «Требует внимания»: одна строка на задачу на десктопе, чипы и причина — в той же строке. */
.attention { padding: 8px 14px; }
.attention__head { min-height: 44px; }
.attention__row { min-height: 44px; padding: 2px 0; }
.attention__main { display: flex; align-items: baseline; gap: 8px; flex: 1 1 320px; min-width: 0; flex-wrap: nowrap; }
.attention__title { flex-wrap: nowrap; white-space: nowrap; }
.attention__name { overflow: hidden; text-overflow: ellipsis; }
.attention__meta { margin-top: 0; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention__actions { flex: 0 0 auto; }
.attention__more { margin-top: 4px; }

/* Карта ресурсов: одна строка чипов. */
.home__resources { padding: 10px 14px; }
.home__resources .card__head { margin-bottom: 4px; }
.placechip { flex-direction: row; align-items: center; gap: 8px; padding: 0 12px; }
.placechip__meta { font-size: 11.5px; }

/* «Год назад» — одна строка. */
.home__rowcard { padding: 2px 14px; min-height: 48px; }
.home__rowcard .yearago__item { border: 0; padding: 0; background: transparent; }
.home__rowcard .card__title { font-size: 15px; }

@media (max-width: 760px) {
  .page { padding-top: 14px; padding-bottom: 20px; }
  .attention__row { padding: 6px 0; }
  .attention__main { flex-wrap: wrap; flex-basis: 100%; }
  .attention__title { white-space: normal; flex-wrap: wrap; }
  .attention__name { overflow: visible; white-space: normal; }
  .attention__meta { white-space: normal; overflow: visible; flex-basis: 100%; }
  .attention__actions { width: 100%; justify-content: flex-end; }
  .routecard__text { -webkit-line-clamp: 2; }
  .home__rowcard { padding: 8px 12px; }
}

/* ---- UX-1, третий слой: добор целевой высоты главной (≤1300 px) без потери действий ---- */
.home { gap: 10px; }
.alert--compact { padding: 6px 12px; }
@media (max-width: 760px) {
  .attention__main { align-items: baseline; }
  .attention__actions { width: auto; margin-left: auto; }
  .attention__title { white-space: normal; }
  .attention__meta { white-space: normal; overflow: hidden; text-overflow: ellipsis; }
}

/* UX-1: нижний отступ страницы — компактнее (высота главной ≤1300 px). */
.page { padding-bottom: 18px; }

/* UX-1: запас по высоте главной (данные демо меняются) — компактнее служебные зоны. */
.home { gap: 9px; }
.page { padding-top: 16px; }
.routecard { padding: 6px 14px; }
.infobar { padding: 8px clamp(12px, 2.4vw, 32px) 10px; }

/* UX-1: у отдельно стоящих ссылок-действий цель ≥44 по обеим осям. */
.link--tap { min-width: 44px; padding: 0 6px; }

/* UX-1: телефон — шкала не пересекается с подписью «сейчас», строки внимания компактнее. */
@media (max-width: 760px) {
  .rail__track { margin-top: 26px; }
  .attention__main { flex: 1 1 60%; }
  .attention__meta { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .attention__actions { margin-left: auto; }
  .routecard__text { -webkit-line-clamp: 2; }
}

/* UX-1: поля и селекты в раскрытиях тоже не меньше 44 px по высоте. */
.input, .select, .textarea { min-height: 44px; }

/* UX-1: малые селекты (--sm) в раскрытиях сохраняют цель 44 px. */
.select.select--sm { min-height: 44px; height: 44px; }

/* Personal menu, anchored to the avatar */
.personal { position: relative; }
.accountbtn {
  position: relative;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.personal__badge {
  position: absolute;
  inset: 0 -2px auto auto;
  border: 2px solid var(--bg);
  border-radius: 20px;
  padding: 1px 4px;
  background: var(--accent-strong);
  color: var(--bg);
  font-size: 10px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.personal__panel {
  position: absolute;
  z-index: 5;
  inset: calc(100% + 8px) -4px auto auto;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--topbar-height) - 16px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.personal__panel[inert] {
  opacity: 0;
  transform: translateY(-5px);
  pointer-events: none;
  visibility: hidden;
}
.personal__view:not([hidden]) { display: grid; gap: 8px; animation: personal-appear var(--dur-fast) ease both; }
@keyframes personal-appear { from { opacity: 0; transform: translateY(3px); } }
.personal__profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.personal__profile:hover { background: var(--surface-2); }
.personal__profile small { display: block; color: var(--muted); }
.personal__theme {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 3px;
  gap: 2px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.personal__theme button, .personal__entry {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.personal__theme button[aria-pressed="true"] { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-sm); }
.personal__entry { display: flex; gap: 8px; align-items: center; text-align: start; padding: 0 6px; }
.personal__entry.personal__profile { padding: 6px; }
.personal__settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr)); gap: 4px; }
.personal__settings button { background: var(--surface-2); font-size: var(--text-secondary); }
.personal__settings button:hover { background: var(--surface-3); }
.personal__switch { width: 100%; border: 1px solid var(--line); }
.personal__switch[aria-checked="true"] > :last-child { color: var(--accent-strong); }
.personal__view p { margin: 0; overflow-wrap: anywhere; }
.personal__view .select { width: 100%; min-width: 0; }
.personal__entry:hover { background: var(--surface-2); }
.personal__entry > :last-child { margin-inline-start: auto; }
.personal__notification-count { color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.personal__view[data-account-inbox] .personal__list { max-height: min(43dvh, 340px); overflow: auto; overscroll-behavior: contain; }
.personal__list--recent .notifitem { grid-template-columns: 28px minmax(0, 1fr); gap: 8px; padding: 6px; }
.personal__list--recent .notifitem__body > p:not(.notifitem__title) { display: none; }
.personal__list--recent .notifitem__body { gap: 2px; }
.personal__list--recent .notifitem__title { position: relative; }
.personal__list--recent .notifitem__title .sr-only { inset-block-start: 0; }
.personal__list--recent .notifitem__title :is(a, button) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  line-height: 1.25;
}
.personal__recent-action {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  text-align: start;
  text-decoration: underline;
  cursor: pointer;
}
.personal__list .notifitem { overflow-wrap: anywhere; }
.personal__logout { border-top: 1px solid var(--line); }
.personal__logout button, .personal__read-all { padding-inline: 6px; justify-self: start; }
.personal__inbox-head { display: flex; gap: 4px; align-items: center; }
.personal__inbox-head h2 { margin: 0; font-size: 18px; }
@media (max-width: 760px) {
  .personal__panel { max-height: min(60dvh, 380px, calc(100dvh - var(--topbar-height) - 16px)); }
  .personal__notification-count::before { content: "· "; }
  .personal__view[data-account-inbox] .personal__list { max-height: clamp(88px, calc(60dvh - 128px), 252px); }
}
@media (max-width: 420px) {
  .personal__panel { right: -43px; }
}
@media (prefers-reduced-motion: reduce) {
  .personal__panel { transition: none; }
  .personal__view:not([hidden]) { animation: none; }
}

.personal__list .notifitem__title a { text-underline-offset: 3px; }
