/* Invoice Keeper в стиле личного кабинета my.aeza.ru: тёмная тема, сайдбар 266px, наклонные заголовки, оранжевый акцент.
   Значения цветов, радиусов и анимаций сняты с темы aeza (colorsV2 dark, borderRadius, motion-переходы). */

/* ---------- шрифты (свои файлы: CSP панели не пускает внешние) ---------- */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-italic-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/jetbrains-mono-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- токены ---------- */

/* Каждый цвет задан парой light-dark(светлая, тёмная) из палитр aeza (colorsV2 light и dark).
   Тема по умолчанию следует настройке системы, выбор в сайдбаре ставит data-theme на <html>. */
:root {
  color-scheme: light dark;
  --sidebar-w: 266px;

  --bg: light-dark(#f4f4f4, #000000);           /* interface.mainBackground */
  --page: light-dark(#ffffff, #131313);         /* pagecontent.background */
  --page-2: light-dark(#ffffff, #1a1a1a);       /* pagecontent.background2 */
  --block: light-dark(#f4f4f4, #1f1f1f);        /* interface.primaryBlock */
  --block-hover: light-dark(#e8e8e8, #363636);  /* button.secondaryHover */
  --row-hover: light-dark(#f7f7f7, #1a1a1a);
  --input: light-dark(#e8e8e8, #252525);
  --input-hover: light-dark(#dedede, #2b2b2b);
  --stroke: light-dark(#dddddd, #2c2c2c);
  --line: light-dark(#ececec, #1f1f1f);
  --panel-line: light-dark(#e1e1e1, #282828);   /* userPanel.border */

  --title: light-dark(#000000, #ffffff);
  --text: light-dark(#585858, #bbbbbb);
  --subtitle: light-dark(#919191, #666666);
  --subtext: light-dark(#626262, #626262);
  --passive: light-dark(#b9b8b8, #3d3d3d);
  --label: light-dark(#626262, #a2a2a2);
  --icon: light-dark(#a6a6a6, #616161);

  --hover: light-dark(rgb(0 0 0 / 0.08), rgb(255 255 255 / 0.15));
  --active: light-dark(#e5e5e5, rgb(255 255 255 / 0.1));
  --tab-selected: light-dark(#ffffff, #585757);
  --tab-shadow: light-dark(rgb(0 0 0 / 0.08), transparent);
  --idle: light-dark(#b1b1b1, #585757);         /* точка «не оплачено», рамка выбранного дня */

  --btn: light-dark(#e8e8e8, #2b2b2b);
  --btn-text: light-dark(#585858, #e3e3e3);
  --btn-hover: light-dark(#dedede, #363636);
  --btn-click: light-dark(#e8e8e8, #262626);
  --btn-off-text: light-dark(#a6a6a6, #616161);
  --btn-main: light-dark(#1f1f1f, #f2f2f2);
  --btn-main-text: light-dark(#f3f3f3, #131313);
  --btn-main-hover: light-dark(#000000, #ffffff);
  --btn-main-hover-text: light-dark(#ffffff, #000000);
  --btn-main-click: light-dark(#626262, #a5a5a5);
  --cta: light-dark(#000000, #ffffff);          /* colors.button.mainAction */
  --cta-text: light-dark(#ffffff, #000000);

  --orange: #ff7a00;
  --green: #73da39;
  --red: #ff4757;
  --blue: #4cc6f1;
  --hold: #c97528;
  --focus: #0a84ff;
  /* те же цвета для текста: на белом яркие оттенки плохо читаются */
  --green-ink: light-dark(#23851a, #73da39);
  --red-ink: light-dark(#e0283a, #ff4757);
  --orange-ink: light-dark(#d46600, #ffa24d);
  --blue-ink: light-dark(#1387b8, #4cc6f1);
  --purple-ink: light-dark(#874691, #c39bd3);
  --hold-ink: light-dark(#a0591c, #e39b58);

  --shape: light-dark(#e0e0e0, #333333);        /* skeleton.baseColor */
  --shape-2: light-dark(#f0f0f0, #4d4d4d);      /* skeleton.highlightColor */
  --arrow-bg: light-dark(#ffffff, #121212);
  --arrow-line: light-dark(#e1e1e1, #000000);
  --toast-bg: light-dark(#ffffff, #1f1f1f);
  --flag-ring: light-dark(rgb(0 0 0 / 0.1), rgb(255 255 255 / 0.08));
  --backdrop: light-dark(rgb(0 0 0 / 0.35), rgb(0 0 0 / 0.7));

  --shadow-xl: 0 8px 32px light-dark(rgb(0 0 0 / 0.12), rgb(0 0 0 / 0.4)), 0 4px 16px light-dark(rgb(0 0 0 / 0.06), rgb(0 0 0 / 0.3));
  --shadow-pop: 0 0 2px light-dark(rgb(0 0 0 / 0.12), rgb(0 0 0 / 0.24)), 0 0 24px light-dark(rgb(0 0 0 / 0.1), rgb(0 0 0 / 0.14));
  --shadow-toast: 0 3px 10px light-dark(rgb(0 0 0 / 0.1), rgb(0 0 0 / 0.35)), 0 3px 3px light-dark(rgb(0 0 0 / 0.05), rgb(0 0 0 / 0.2));
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-std: cubic-bezier(0.4, 0, 0.2, 1);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- основа ---------- */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.2; color: var(--title); }
p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
code { font-family: "JetBrains Mono", ui-monospace, monospace; }

::selection { background: rgb(255 122 0 / 0.35); color: var(--title); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

* { scrollbar-width: thin; scrollbar-color: #808080 transparent; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--subtitle); }
.noscript { padding: 24px; text-align: center; color: var(--title); }

/* ---------- иконки ---------- */

.ic { flex: none; display: block; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- анимации (как в кабинете aeza) ---------- */

@keyframes rise-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes title-in { from { opacity: 0; transform: translateX(-24px) skew(-10deg); } }
@keyframes auth-in { from { opacity: 0; transform: translateY(100px); } }
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%, 75% { transform: rotate(1deg); }
  50% { transform: rotate(-1deg); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes skeleton { to { transform: translateX(100%); } }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  border: 0; border-radius: 12px;
  background: var(--btn); color: var(--btn-text);
  font-size: 14px; font-weight: 500; line-height: 1.5;
  cursor: pointer; white-space: nowrap; text-decoration: none; user-select: none;
  position: relative;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.btn:hover { background: var(--btn-hover); color: var(--title); }
.btn:active { background: var(--btn-click); transform: translateY(1px); }
.btn:disabled { background: var(--btn-click); color: var(--btn-off-text); cursor: not-allowed; transform: none; }
.btn .ic { width: 18px; height: 18px; }

.btn-primary { background: var(--btn-main); color: var(--btn-main-text); }
.btn-primary:hover { background: var(--btn-main-hover); color: var(--btn-main-hover-text); }
.btn-primary:active { background: var(--btn-main-click); color: var(--btn-main-hover-text); }
.btn-primary:disabled { background: var(--btn-main-click); color: var(--btn-off-text); }

/* оранжевая кнопка действия: как «Пополнить» в кабинете */
.btn-accent { background: var(--orange); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--orange); color: #fff; opacity: 0.9; transform: translateY(-1px); }
.btn-accent:active { background: var(--orange); transform: none; }
.btn-accent:disabled { background: var(--orange); color: #fff; opacity: 0.6; }

.btn-danger { color: var(--red-ink); }
.btn-danger:hover { background: rgb(255 71 87 / 0.14); color: var(--red-ink); }
.btn-danger.btn-primary { background: var(--red); color: #fff; }
.btn-danger.btn-primary:hover { background: #ff5e6c; color: #fff; }

.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--hover); color: var(--title); }

.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; min-height: 56px; border-radius: 16px; font-size: 16px; }

/* кнопка ждёт ответа сервера: текст прячется, крутится кольцо */
.btn.is-busy { color: transparent; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid #8a8a8a; border-bottom-color: transparent; border-radius: 50%;
  animation: spin 1s linear infinite;
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: none;
  color: var(--title); line-height: 0; cursor: pointer; transition: opacity 0.2s;
}
.icon-btn:hover { opacity: 0.75; }
.icon-btn .ic { width: 22px; height: 22px; }

/* наклонная оранжевая плашка: «б+» в кабинете, у нас роль */
.skew-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 8px; border: 0; border-radius: 4px;
  background: var(--orange); color: #fff;
  font-size: 15px; line-height: 22px; font-style: italic; font-weight: 600; white-space: nowrap;
  transform: skewX(-10deg); transition: transform 0.2s ease-in-out;
}
.skew-badge:hover { transform: skewX(-10deg) scale(1.03); }

/* ---------- формы ---------- */

.field { display: grid; gap: 8px; margin-bottom: 16px; min-width: 0; }
.field > span { font-size: 14px; font-weight: 500; color: var(--label); }
.field .hint { font-size: 12px; line-height: 16px; color: var(--subtitle); font-weight: 400; }

input, select {
  width: 100%; min-height: 48px; padding: 12px 16px;
  background: var(--input); color: var(--title);
  border: 1px solid transparent; border-radius: 16px;
  caret-color: var(--orange);
  transition: border-color 0.2s var(--ease-std), background-color 0.2s var(--ease-std);
}
input::placeholder { color: var(--subtitle); opacity: 1; }
input:hover, select:hover { background: var(--input-hover); }
input:focus, select:focus { outline: none; border-color: var(--orange); background: var(--input-hover); }
input:disabled, select:disabled { opacity: 0.6; cursor: not-allowed; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; }
input[type="file"] { padding: 10px 12px; }
input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 6px 12px; border: 0; border-radius: 10px; background: var(--btn); color: var(--btn-text); cursor: pointer;
}

/* автозаполнение Chrome не перекрашивает поле в свой цвет */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--title);
  -webkit-box-shadow: inset 0 0 0 1000px var(--input);
  caret-color: var(--orange);
  transition: background-color 9999s ease-out 0s;
}

select {
  appearance: none; padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
select option { background: var(--block); color: var(--title); }

.form-error {
  margin: 0 0 16px; padding: 12px 16px; border-radius: 12px;
  background: rgb(255 71 87 / 0.12); color: var(--red-ink); font-size: 14px;
  animation: fade-in 0.2s ease-out;
}
.form-error:empty { display: none; }

/* поле пароля с «глазом» */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-toggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 36px; height: 36px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--subtitle); cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.pw-toggle:hover { color: var(--title); background: var(--hover); }
.pw-toggle[aria-pressed="true"] { color: var(--orange); }
.pw-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- вход ---------- */

.auth {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 72px 16px 24px; background: var(--bg); position: relative;
}
.auth-tools { position: absolute; top: 16px; right: 16px; left: 16px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.auth-tools .picker { width: 200px; }
.auth-card { display: flex; gap: 16px; padding: 16px; animation: auth-in 1s var(--ease-io) both; }
.auth-panel {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  width: 350px; min-height: 540px; padding: 24px;
  background: var(--page-2); border-radius: 16px;
}
.auth-promo .brand { position: relative; z-index: 1; }
.auth-promo-text { position: relative; z-index: 1; display: grid; gap: 20px; }
.auth-promo h2 {
  justify-self: start; font-size: 40px; font-weight: 700; line-height: 1.1; text-transform: lowercase;
  transform: skew(-10deg); opacity: 0.2;
}
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: var(--text); font-size: 14px; line-height: 20px; }
.auth-points .ic { width: 20px; height: 20px; color: var(--orange); stroke-width: 2; }
/* треугольник «play» на фоне левой панели, как на экране входа aeza */
.auth-shape { position: absolute; right: -70px; top: 70px; width: 300px; height: 330px; color: var(--block); }
.auth-shape path { fill: currentColor; }
.auth-form h1 { font-size: 24px; line-height: 32px; text-transform: lowercase; }
.auth-form .lead { margin: 8px 0 24px; color: var(--subtitle); font-size: 14px; }
.auth-form form { display: flex; flex-direction: column; flex: 1; }
.auth-form .btn-block { margin-top: auto; background: var(--cta); color: var(--cta-text); transition: opacity 0.2s var(--ease-io); }
.auth-form .btn-block:hover { opacity: 0.8; background: var(--cta); color: var(--cta-text); }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; flex: none; display: block; border-radius: 8px; }
.brand-name { font-weight: 600; font-size: 16px; color: var(--title); }

/* ---------- каркас: сайдбар и рабочая область ---------- */

.shell { min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed; top: 0; left: 0; z-index: 1000;
  width: var(--sidebar-w); height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 24px;
  padding: 24px 12px 24px 24px;
  background: var(--bg); font-weight: 500; line-height: 24px;
  overflow-x: hidden; overflow-y: auto;
}

.user-panel { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--panel-line); border-radius: 24px; flex: none; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; min-width: 0; color: var(--title); }
.user-row:first-child { border-bottom: 1px solid var(--panel-line); }
.user-login { font-size: 18px; line-height: 24px; font-style: italic; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-today { display: flex; flex-direction: column; min-width: 0; }
.user-today small { font-size: 12px; line-height: 16px; color: var(--subtitle); font-weight: 400; }
.user-today b { font-size: 24px; line-height: 32px; font-weight: 700; white-space: nowrap; }
.user-row .skew-badge { font-size: 14px; line-height: 20px; }

.nav { display: flex; flex-direction: column; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 12px; border: 0; border-radius: 16px;
  background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none;
  cursor: pointer; transition: background-color 0.2s, color 0.2s;
}
.nav-item .ic { width: 20px; height: 20px; color: var(--icon); transition: color 0.2s; }
.nav-item:hover { background: var(--hover); color: var(--title); }
.nav-item:hover .ic { color: var(--title); }
.nav-item[aria-current="page"] { background: var(--active); color: var(--title); }
.nav-item[aria-current="page"] .ic { color: var(--title); }

.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side-links { display: flex; flex-direction: column; }

/* блок «Добавить платёж» */
.add-block { display: flex; width: 100%; border-radius: 12px; background: var(--page); overflow: hidden; }
.add-block button {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px; border: 0; background: none; color: var(--title); font: inherit; cursor: pointer;
  transition: background-color 0.2s;
}
.add-block button:hover { background: var(--hover); }
.add-block button:hover .ic { animation: wiggle 0.5s ease-in-out; }
.add-block .ic { width: 20px; height: 20px; color: var(--orange); stroke-width: 2; }

.side-logo { display: flex; align-items: center; gap: 10px; padding: 12px; color: var(--icon); font-size: 13px; font-weight: 500; }
.side-logo img { width: 32px; height: 32px; border-radius: 8px; }

.main { margin-left: var(--sidebar-w); padding: 24px 12px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 16px; }

.mobile-bar { display: none; }
.scrim { display: none; }

/* ---------- страница ---------- */

.page {
  flex: 1; display: flex; flex-direction: column; gap: 32px; min-width: 0;
  padding: clamp(16px, 4vw, 64px);
  background: var(--page); border-radius: 12px;
}
.page > * { animation: rise-in 0.5s var(--ease-io) both; }
.page > :nth-child(2) { animation-delay: 0.05s; }
.page > :nth-child(3) { animation-delay: 0.1s; }
.page > :nth-child(4) { animation-delay: 0.15s; }
.page > :nth-child(n + 5) { animation-delay: 0.2s; }

.page > .page-head { display: flex; flex-direction: column; gap: 12px; animation: none; }
.page-title {
  display: inline-block; align-self: flex-start;
  font-size: clamp(2.5rem, 3.5vw, 4.5rem); line-height: 1.2; font-weight: 700; color: var(--title);
  text-transform: lowercase; transform: skew(-10deg); opacity: 0.2;
  animation: title-in 0.6s var(--ease-io) both;
}
.page-lead { max-width: 820px; font-size: 14px; line-height: 20px; color: var(--subtitle); animation: fade-in 0.6s ease-out 0.15s both; }
.page-lead::first-letter { text-transform: uppercase; }

.section { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.section-title { font-size: clamp(1.125rem, 1.8vw, 1.75rem); line-height: 1.2; font-weight: 700; color: var(--title); text-transform: lowercase; }

/* ---------- плитки итогов ---------- */

.summary { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.tile {
  position: relative; display: flex; flex-direction: column; gap: 16px; min-width: 0;
  padding: 16px; background: var(--block); border-radius: 16px;
  transition: transform 0.3s ease-in-out, background-color 0.3s ease-in-out;
}
.tile:hover { transform: translateY(-4px); }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-transform: lowercase; color: var(--title); font-size: 14px; line-height: 16px; }
.tile-head .muted { color: var(--subtext); }
.tile-arrow {
  display: inline-flex; padding: 4px; border: 1px solid var(--arrow-line); border-radius: 50%;
  background: var(--arrow-bg); color: var(--title); transition: transform 0.3s ease-in-out;
}
.tile-arrow .ic { width: 14px; height: 14px; stroke-width: 2; }
.tile:hover .tile-arrow { transform: translateX(4px); }
.tile-amount { font-size: 32px; line-height: 40px; font-weight: 700; color: var(--title); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.tile-sub { font-size: 14px; line-height: 20px; color: var(--subtitle); }
/* шкала по суммам: оплачено, ждёт оплаты, просрочено. Отрезки вырастают слева по очереди (задержка 0.1 с, как у рядов
   на плитках aeza), при наведении шкала становится толще, а строки легенды расходятся */
.share { display: grid; gap: 14px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--stroke); }
.share-bar {
  display: block; width: 100%; height: 10px; border-radius: 6px; overflow: hidden; background: var(--shape);
  transition: height 0.3s ease-in-out;
}
.tile:hover .share-bar { height: 18px; }
.share-bar rect { transform-box: fill-box; transform-origin: left center; animation: share-grow 0.6s var(--ease-io) 0.2s both; }
.share-bar rect:nth-child(2) { animation-delay: 0.3s; }
.share-bar rect:nth-child(3) { animation-delay: 0.4s; }
@keyframes share-grow { from { transform: scaleX(0); } }
.seg-paid { fill: var(--green); }
.seg-due, .seg-left { fill: var(--idle); }
.seg-overdue { fill: var(--red); }
.seg-empty { fill: var(--shape); }

.share-legend { display: grid; gap: 4px; font-size: 14px; transition: gap 0.3s ease-in-out; }
.tile:hover .share-legend { gap: 8px; }
.share-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 3.2em; align-items: center; gap: 8px; }
.share-name { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text); }
.share-name::before {
  content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--idle);
  transition: transform 0.3s ease-in-out;
}
.share-row.paid .share-name::before { background: var(--green); }
.share-row.overdue .share-name::before { background: var(--red); }
.tile:hover .share-name::before { transform: scale(1.35); }
.share-sum { text-align: right; color: var(--title); }
.share-row.paid.has .share-sum { color: var(--green-ink); }
.share-row.overdue.has .share-sum { color: var(--red-ink); font-weight: 600; }
.share-pct { text-align: right; font-size: 13px; color: var(--subtitle); }

/* оранжевый стикер, как «free!» и «-40% off» на плитках услуг */
.sticker {
  position: absolute; top: -10px; right: 16px; z-index: 2;
  padding: 4px 10px; border-radius: 6px; background: var(--orange); color: #fff;
  font-size: 14px; line-height: 20px; font-style: italic; font-weight: 500;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.1);
  transform: rotate(-3deg); transition: transform 0.3s ease-in-out;
}
.tile:hover .sticker { transform: rotate(4deg) scale(1.05); }

progress {
  display: block; width: 100%; height: 4px; border: 0; border-radius: 8px; overflow: hidden;
  background: var(--shape); accent-color: var(--green); appearance: none;
}
progress::-webkit-progress-bar { background: var(--shape); }
progress::-webkit-progress-value { background: var(--green); border-radius: 8px; }
progress::-moz-progress-bar { background: var(--green); border-radius: 8px; }

/* ---------- фильтры ---------- */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.toolbar .grow { flex: 1; }
.toolbar select { width: auto; min-height: 40px; padding-block: 6px; border-radius: 12px; font-size: 14px; }
.toolbar .search { width: 240px; min-height: 40px; padding: 8px 16px; border-radius: 12px; font-size: 14px; }

.seg { display: inline-flex; flex-wrap: wrap; padding: 4px; gap: 4px; background: var(--block); border-radius: 12px; }
.seg button {
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 6px 12px; border-radius: 8px;
  color: var(--text); font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-color 0.2s, color 0.2s;
}
.seg button:hover { color: var(--title); background: var(--active); }
.seg button[aria-pressed="true"] { background: var(--tab-selected); color: var(--title); box-shadow: 0 1px 2px var(--tab-shadow); }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { width: 18px; min-height: 18px; height: 18px; padding: 0; accent-color: var(--orange); cursor: pointer; }
.on-date input { width: auto; min-height: 40px; padding: 6px 12px; border-radius: 12px; font-size: 14px; }

/* ---------- таблицы ---------- */

.table-card { border-radius: 16px; background: var(--page); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-feature-settings: "tnum", "kern"; }
th {
  padding: 8px 16px; text-align: left; white-space: nowrap;
  color: var(--subtext); border-bottom: 1px solid var(--line);
  font-size: clamp(0.8125rem, 1vw, 1rem); font-weight: 500; line-height: 1.5; letter-spacing: 0.025em;
}
td {
  padding: 12px 16px; vertical-align: middle; color: var(--title);
  border-bottom: 1px solid var(--line);
  font-size: clamp(0.875rem, 1vw, 1rem); line-height: 1.5;
}
tbody tr { transition: background-color 0.2s; }
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: 0; }
th.right, td.right { text-align: right; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }

.th-sort {
  appearance: none; border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; color: inherit; letter-spacing: inherit; transition: color 0.2s;
}
.th-sort:hover, .th-sort.active { color: var(--title); }
.th-sort:active { transform: translateY(1px); }
.th-sort .arrow { margin-left: 6px; opacity: 0.7; }

/* подсветка строк, как у сгруппированных услуг: полоса слева и лёгкий фон */
tr.row-overdue { background: rgb(255 71 87 / 0.06); }
tr.row-overdue:hover { background: rgb(255 71 87 / 0.1); }
tr.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
tr.row-soon, tr.row-late { background: rgb(255 122 0 / 0.06); }
tr.row-soon:hover, tr.row-late:hover { background: rgb(255 122 0 / 0.1); }
tr.row-soon td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
tr.row-deleted { opacity: 0.5; }
tr.clickable { cursor: pointer; }

.cell-title { font-weight: 500; color: var(--title); }
.cell-sub { font-size: 13px; line-height: 18px; color: var(--subtitle); white-space: nowrap; }
.cell-sub.bad { color: var(--red-ink); }
.amount { font-weight: 500; white-space: nowrap; }

/* статус: точка и подпись, как «● работает» */
.badge { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--title); font-size: 14px; line-height: 20px; }
.badge::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--idle); }
.badge.paid::before { background: var(--green); }
.badge.soon::before { background: var(--orange); }
.badge.late::before { background: var(--hold); }
.badge.overdue { color: var(--red-ink); }
.badge.overdue::before { background: var(--red); box-shadow: 0 0 0 4px rgb(255 71 87 / 0.18); }
.badge.planned::before { background: transparent; border: 2px dashed var(--idle); }

.empty { padding: 48px 20px; text-align: center; color: var(--subtitle); font-style: italic; font-size: 14px; }
.empty::before { content: "📋"; display: block; font-size: 2rem; font-style: normal; margin-bottom: 8px; opacity: 0.5; }
.empty strong { display: block; color: var(--title); font-size: 16px; font-style: normal; margin-bottom: 4px; }

/* ---------- скелетон загрузки ---------- */

.skeleton { position: relative; display: block; overflow: hidden; border-radius: 8px; background: var(--shape); }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, var(--shape) 0%, var(--shape-2) 50%, var(--shape) 100%);
  animation: skeleton 1.5s ease-in-out infinite;
}
.sk-page { display: flex; flex-direction: column; gap: 16px; }
.page > .sk-page { gap: 24px; animation: fade-in 0.3s ease-out both; }
.sk-title { width: 260px; max-width: 70%; height: 56px; transform: skew(-10deg); opacity: 0.35; }
.sk-tiles { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.sk-tile { height: 200px; border-radius: 16px; }
.sk-line { height: 40px; }

/* ---------- формы в разделах ---------- */

.inline-form { padding: 24px 24px 8px; background: var(--block); border-radius: 16px; }
.inline-form h3 { font-size: 18px; margin-bottom: 16px; text-transform: lowercase; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.form-grid .btn { margin-bottom: 16px; min-height: 48px; }

/* ---------- модальные окна: появление масштабом 0.9 → 1 за 0.3 с ---------- */

dialog {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--stroke); border-radius: 24px;
  background: var(--page); color: var(--text); box-shadow: var(--shadow-xl);
  opacity: 0; transform: scale(0.9);
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}
dialog[open] { opacity: 1; transform: scale(1); }
@starting-style { dialog[open] { opacity: 0; transform: scale(0.9); } }
dialog::backdrop {
  background: rgb(0 0 0 / 0);
  transition: background-color 0.3s ease-in-out, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}
dialog[open]::backdrop { background: var(--backdrop); }
@starting-style { dialog[open]::backdrop { background: rgb(0 0 0 / 0); } }

dialog form, .rc-dialog { padding: 24px; }
dialog h2 { font-size: 24px; line-height: 32px; letter-spacing: -0.02em; margin-bottom: 8px; }
dialog .desc { margin: 0 0 20px; color: var(--subtitle); font-size: 14px; line-height: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }

/* чеки и ссылки */
dialog:has(.rc-dialog) { width: min(580px, calc(100vw - 32px)); }
.rc-dialog { max-height: calc(100vh - 48px); overflow-y: auto; }
.rc-list { display: grid; gap: 8px; margin-bottom: 20px; }
.rc-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--block); }
.rc-kind { font-size: 12px; font-weight: 600; text-transform: lowercase; padding: 2px 8px; border-radius: 6px; background: var(--btn); color: var(--btn-text); }
.rc-kind.file { background: rgb(115 218 57 / 0.14); color: var(--green-ink); }
.rc-name { font-weight: 500; color: var(--title); text-decoration: none; overflow-wrap: anywhere; }
.rc-name:hover { color: var(--orange-ink); text-decoration: underline; }
.rc-forms { display: grid; gap: 16px; margin-bottom: 8px; }
.rc-form { padding: 16px 16px 4px; background: var(--block); border-radius: 16px; }
.rc-form h3 { font-size: 16px; margin-bottom: 12px; text-transform: lowercase; }
.rc-form .btn { margin-bottom: 12px; }

/* ---------- уведомления: вылет сверху, как react-hot-toast ---------- */

#toasts {
  position: fixed; top: 16px; left: 50%; z-index: 9999; transform: translateX(-50%);
  display: grid; gap: 8px; justify-items: center; width: max-content; max-width: calc(100vw - 32px); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 380px; padding: 10px 14px;
  border-radius: 12px; background: var(--toast-bg); color: var(--title); font-size: 14px; font-weight: 500; line-height: 1.3;
  box-shadow: var(--shadow-toast);
  pointer-events: auto; will-change: transform;
  animation: toast-in 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}
.toast.leaving { animation: toast-out 0.4s cubic-bezier(0.06, 0.71, 0.55, 1) forwards; }
@keyframes toast-in { from { transform: translate3d(0, -200%, 0) scale(0.6); opacity: 0.5; } to { transform: none; opacity: 1; } }
@keyframes toast-out { from { transform: translate3d(0, 0, -1px) scale(1); opacity: 1; } to { transform: translate3d(0, -150%, -1px) scale(0.6); opacity: 0; } }

/* значок в уведомлении: кружок «выпрыгивает», галочка дорисовывается */
.toast-icon {
  position: relative; flex: none; width: 20px; height: 20px; border-radius: 10px;
  opacity: 0; transform: scale(0) rotate(45deg);
  animation: icon-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s forwards;
}
.toast-icon.ok { background: #61d345; }
.toast-icon.ok::after {
  content: ""; position: absolute; left: 6px; bottom: 6px; width: 6px; height: 10px; box-sizing: border-box;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff; opacity: 0;
  animation: check-draw 0.2s ease-out 0.2s forwards;
}
.toast-icon.error { background: #ff4b4b; }
.toast-icon.error::before, .toast-icon.error::after {
  content: ""; position: absolute; left: 4px; bottom: 9px; width: 12px; height: 2px; border-radius: 3px; background: #fff; opacity: 0;
}
.toast-icon.error::before { animation: bar-in 0.15s ease-out 0.15s forwards; }
.toast-icon.error::after { animation: bar-in-90 0.15s ease-out 0.18s forwards; }
@keyframes icon-pop { from { transform: scale(0) rotate(45deg); opacity: 0; } to { transform: scale(1) rotate(45deg); opacity: 1; } }
@keyframes check-draw { 0% { height: 0; width: 0; opacity: 0; } 40% { height: 0; width: 6px; opacity: 1; } 100% { height: 10px; opacity: 1; } }
@keyframes bar-in { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bar-in-90 { from { transform: scale(0) rotate(90deg); opacity: 0; } to { transform: scale(1) rotate(90deg); opacity: 1; } }

/* ---------- выбор языка и темы: пункт сайдбара со всплывающим списком ---------- */

.picker { position: relative; }
.picker-current { display: flex; align-items: center; gap: 10px; min-width: 0; white-space: nowrap; }
.picker-current .ic { width: 18px; height: 18px; color: var(--icon); }
.flag { flex: none; display: block; width: 18px; height: 18px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 1px var(--flag-ring); }
.picker-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 20;
  display: grid; gap: 2px; padding: 6px;
  background: var(--page-2); border-radius: 16px; box-shadow: var(--shadow-pop);
  opacity: 0; transform: scale(0.95) translateY(8px); transform-origin: bottom center;
  visibility: hidden; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, visibility 0s linear 0.2s;
}
.picker.down .picker-menu { top: calc(100% + 8px); bottom: auto; transform: scale(0.95) translateY(-8px); transform-origin: top center; }
.picker.open .picker-menu { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.picker-option {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px;
  background: none; color: var(--text); font: inherit; font-size: 15px; text-align: left; cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.picker-option:hover { background: var(--hover); color: var(--title); }
.picker-option[aria-checked="true"] { color: var(--title); }
.picker-option > .ic { width: 18px; height: 18px; color: var(--icon); }
.picker-option .tick { width: 16px; height: 16px; margin-left: auto; color: var(--orange); stroke-width: 2.5; }
.auth-tools .nav-item { background: var(--page-2); }
.auth-tools .nav-item:hover { background: var(--block-hover); }

/* смена темы: цвета плавно перетекают, как при переключении в кабинете */
:root.theme-fade, :root.theme-fade *, :root.theme-fade *::before, :root.theme-fade *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ---------- календарь и бюджет ---------- */

.cal-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cal-title { font-size: 20px; min-width: 170px; text-align: center; text-transform: lowercase; }
.month-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.mini-card { gap: 6px; }
.mini-card .tile-amount { font-size: 24px; line-height: 32px; }
.mini-card progress { margin-top: 6px; }

.cal-card { padding: 12px; background: var(--block); border-radius: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-wd { text-align: center; font-size: 13px; font-weight: 500; color: var(--subtext); text-transform: lowercase; padding: 4px 0; }
.cal-cell {
  appearance: none; display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 96px;
  padding: 8px; border: 1px solid transparent; border-radius: 12px;
  background: var(--page); color: var(--text); text-align: left; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.cal-cell.blank { background: transparent; cursor: default; }
.cal-cell:hover:not(.blank) { background: var(--block-hover); }
.cal-cell.selected { border-color: var(--idle); background: var(--page-2); }
.cal-cell.today .cal-day { background: var(--orange); color: #fff; font-style: italic; transform: skewX(-10deg); border-radius: 4px; }
.cal-day { display: grid; place-items: center; min-width: 26px; height: 24px; padding: 0 4px; align-self: flex-start; font-size: 14px; font-weight: 600; color: var(--title); }
.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.chip {
  display: block; padding: 1px 8px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; font-weight: 500; background: var(--btn); color: var(--btn-text);
}
.chip.paid { background: rgb(115 218 57 / 0.14); color: var(--green-ink); }
.chip.late { background: rgb(201 117 40 / 0.2); color: var(--hold-ink); }
.chip.overdue { background: rgb(255 71 87 / 0.16); color: var(--red-ink); }
.chip.planned { background: transparent; border: 1px dashed var(--passive); color: var(--text); }
.chip.more { background: transparent; color: var(--subtitle); padding-left: 2px; }
.dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.dot.paid { background: var(--green); }
.dot.late { background: var(--hold); }
.dot.overdue { background: var(--red); }
.dot.planned { background: transparent; border: 1.5px solid var(--idle); }

.day-box { padding: 16px; background: var(--block); border-radius: 16px; }
.day-box h3 { font-size: 18px; margin-bottom: 12px; }
.day-list { display: grid; gap: 8px; }
.day-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px; background: var(--page); color: var(--title);
  animation: rise-in 0.3s ease-out both;
}
.day-item.overdue { box-shadow: inset 3px 0 0 var(--red); }
.day-item.planned { background: transparent; border: 1px dashed var(--passive); }
.day-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- журнал ---------- */

.actor { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--btn); color: var(--btn-text); }
.actor.admin { background: rgb(255 122 0 / 0.16); color: var(--orange-ink); }
.actor.telegram { background: rgb(76 198 241 / 0.16); color: var(--blue-ink); }
.actor.max { background: rgb(155 89 182 / 0.22); color: var(--purple-ink); }
.actor.system { background: transparent; color: var(--subtitle); }
.actor.anonymous { background: rgb(255 71 87 / 0.14); color: var(--red-ink); }
.act.bad { color: var(--red-ink); font-weight: 500; }
.details-cell { max-width: 420px; overflow-wrap: anywhere; color: var(--text); }
.more-wrap { text-align: center; }
.more-wrap[hidden] { display: none; }

/* ---------- мессенджеры ---------- */

.msg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.msg-card { gap: 12px; }
.msg-card.is-linked { box-shadow: inset 0 0 0 1px rgb(115 218 57 / 0.3); }
.msg-card .tile-head { text-transform: none; }
.msg-card h3 { font-size: 18px; }
.msg-card p { font-size: 14px; color: var(--text); }
.msg-card b { color: var(--title); }
.msg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.msg-badge + .msg-badge { margin-left: 8px; }
.msg-alt { margin: 16px 0 8px; font-size: 13px; color: var(--subtitle); }
.msg-command { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; background: var(--input); border-radius: 12px; }
.msg-command code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; color: var(--title); }
.msg-wait { margin-top: 16px; font-size: 14px; }
.msg-wait::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--shape-2); border-top-color: var(--orange); border-radius: 50%; animation: spin 1s linear infinite;
}
.msg-wait.done::before { display: none; }

/* ---------- средние экраны ---------- */

@media (max-width: 1439px) {
  .page { padding: clamp(16px, 2vw, 32px); }
}

@media (max-width: 1279px) {
  th { padding-inline: 12px; }
  td { padding: 10px 12px; }
  td.actions .btn + .btn { margin-left: 4px; }
  .btn-sm { padding-inline: 10px; }
}

/* ---------- планшет и телефон: сайдбар выезжает слева ---------- */

@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w))); opacity: 0; visibility: hidden;
    transition: transform 0.3s linear, opacity 0.3s linear, visibility 0s linear 0.3s;
    padding-top: 16px;
  }
  .shell.nav-open .sidebar { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 999;
    background: rgb(0 0 0 / 0.4); opacity: 0; pointer-events: none; transition: opacity 0.3s linear;
  }
  .shell.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; padding: 16px; }
  .mobile-bar { display: flex; align-items: center; gap: 16px; }
  .mobile-bar .icon-btn .ic { width: 28px; height: 28px; }
  .page { padding: 16px; }
}

@media (max-width: 860px) {
  .auth-tools { flex-wrap: nowrap; }
  .auth-tools .picker { flex: 1 1 0; width: auto; min-width: 0; max-width: 200px; }
  .auth-tools .picker-toggle > .ic { display: none; }
  .auth-promo { display: none; }
  .auth-card { padding: 0; }
  .auth-panel { width: min(350px, calc(100vw - 32px)); min-height: 460px; }
}

@media (max-width: 720px) {
  .page { gap: 24px; }
  .summary { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -16px; padding: 12px 16px 8px; scrollbar-width: none; }
  .summary::-webkit-scrollbar { display: none; }
  .tile { flex: 0 0 min(80%, 280px); scroll-snap-align: start; }
  .toolbar .search { width: 100%; }
  .seg button { padding: 6px 10px; font-size: 13px; }

  .cal-cell { min-height: 54px; padding: 4px; align-items: center; }
  .cal-chips { display: none; }
  .cal-dots { display: flex; justify-content: center; }
  .cal-grid { gap: 4px; }
  .cal-day { align-self: center; }
  .day-item { grid-template-columns: 1fr auto; }
  .day-actions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }

  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  td { padding: 4px 0; border: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; text-align: right; }
  td::before { content: attr(data-label); color: var(--subtext); font-size: 13px; font-weight: 500; text-align: left; flex: none; }
  td.title-cell { display: block; text-align: left; padding-bottom: 8px; }
  td.title-cell::before { display: none; }
  td.actions { justify-content: flex-end; padding-top: 10px; flex-wrap: wrap; }
  td.actions::before { display: none; }
  tr.row-overdue td:first-child, tr.row-soon td:first-child { box-shadow: none; }
  tr.row-overdue { box-shadow: inset 3px 0 0 var(--red); }
  tr.row-soon { box-shadow: inset 3px 0 0 var(--orange); }

  /* модальное окно на телефоне выезжает снизу */
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 24px 24px 0 0; transform: translateY(100%); }
  dialog[open] { transform: none; }
  @starting-style { dialog[open] { transform: translateY(100%); } }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .toast-icon, .toast-icon::before, .toast-icon::after { opacity: 1; }
  .toast-icon { transform: rotate(45deg); }
}

/* ---------- помощь ---------- */

.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.help-card { gap: 12px; }
.help-card h3 { display: flex; align-items: center; gap: 10px; color: var(--title); font-size: 16px; line-height: 20px; font-weight: 600; }
.help-card h3 .ic { width: 20px; height: 20px; color: var(--orange); }
.help-card p { flex: 1; color: var(--subtitle); font-size: 14px; line-height: 20px; }
.help-card .btn { align-self: flex-start; }
.help-note { color: var(--subtext); }
.help-links { display: flex; flex-direction: column; gap: 6px; }
.help-links a { color: var(--orange-ink); font-size: 14px; line-height: 20px; text-decoration: none; overflow-wrap: anywhere; }
.help-links a:hover { text-decoration: underline; }
.help-rules { display: grid; gap: 10px; margin: 0; padding: 16px; list-style: none; background: var(--block); border-radius: 16px; }
.help-rules li { position: relative; padding-left: 20px; color: var(--title); font-size: 14px; line-height: 20px; }
.help-rules li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
.faq { display: flex; flex-direction: column; overflow: hidden; background: var(--block); border-radius: 16px; }
.faq-item + .faq-item { border-top: 1px solid var(--line); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px;
  color: var(--title); font-size: 15px; line-height: 20px; font-weight: 500; cursor: pointer; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--orange-ink); }
.faq-item summary .ic { width: 18px; height: 18px; color: var(--subtext); transition: transform 0.3s ease-in-out; }
.faq-item[open] summary .ic { transform: rotate(90deg); }
.faq-answer { padding: 0 16px 16px; color: var(--subtitle); font-size: 14px; line-height: 22px; }
