/* ============================================================
   Всё на виду! — Components
   Общие компоненты: контейнер, nav, кнопки, карточки, бейджи,
   аватары, прогресс, чарт, footer, логотип, курсор, шум.
   Одинаково выглядят на всех страницах проекта.
   ============================================================ */

/* ===== КОНТЕЙНЕР ===== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad-x-mobile);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--pad-x-desktop);
  }
}

/* ===== СЕТКИ ===== */
.grid {
  display: grid;
  gap: var(--gap-card);
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stack {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  align-items: center;
}

/* ===== АМБИЕНТНЫЙ СВЕТ ===== */
.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: var(--z-ambient);
  animation: ambientFloat 22s ease-in-out infinite;
  will-change: transform;
}

@keyframes ambientFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.08); }
}

/* ===== ШУМ / ЗЕРНО ===== */
/* Два слоя: крупная фракция (как было) + мелкая, более плотная.
   Не перехватывает клики — pointer-events: none. */
.noise::before,
.noise::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-noise);
  background-repeat: repeat;
}

/* Крупное зерно */
.noise::before {
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  mix-blend-mode: var(--grain-blend);
}

/* Мелкое плотное зерно — «плёночность» */
.noise::after {
  opacity: var(--grain-opacity-fine);
  z-index: var(--z-grain);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  mix-blend-mode: var(--grain-blend);
}

/* ===== МАТОВОЕ СТЕКЛО ===== */
/* Плашки, подложки, табы, топбар — мутные, зерно под ними не просвечивает. */
.glass,
.tile,
.segmented,
.topbar,
.panel-menu,
.modal-panel,
.select {
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
}

.glass-strong {
  background-color: var(--glass-bg-strong);
  border-color: var(--glass-border-strong);
}

/* ===== КАСТОМНЫЙ КУРСОР ===== */
body.has-custom-cursor,
body.has-custom-cursor a,
body.has-custom-cursor button,
body.has-custom-cursor input,
body.has-custom-cursor textarea,
body.has-custom-cursor select,
body.has-custom-cursor label,
body.has-custom-cursor [role="button"] {
  cursor: none;
}

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: var(--z-cursor);
  border-radius: 50%;
  opacity: 0;
  transition: opacity var(--dur-fast) ease,
              width var(--dur-base) var(--ease-bounce),
              height var(--dur-base) var(--ease-bounce),
              background var(--dur-base) ease,
              border-color var(--dur-base) ease;
  will-change: transform;
  transform: translate(-50%, -50%);
}

body.no-custom-cursor .cursor-dot,
body.no-custom-cursor .cursor-ring {
  display: none;
}

.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
}

.cursor-ring {
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--accent-50);
}

.cursor-dot.is-visible,
.cursor-ring.is-visible {
  opacity: 1;
}

.cursor-ring.is-hover {
  width: 64px;
  height: 64px;
  border-color: var(--accent);
  background: var(--accent-08);
}

.cursor-dot.is-hover {
  background: var(--accent-2);
  box-shadow: 0 0 20px var(--accent-2);
}

.cursor-ring.is-click {
  width: 24px;
  height: 24px;
  border-color: var(--ink);
}

/* ===== ЛОГОТИП "ЖИВОЙ ГЛАЗ" ===== */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-eye {
  position: relative;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--glass-bg-strong);
  border: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color var(--dur-base) ease;
}

.brand:hover .brand-eye,
.brand:focus-visible .brand-eye {
  border-color: var(--accent);
}

.brand-eye-pupil {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-50);
  animation: eyeLook 6s ease-in-out infinite;
}

/* В светлой теме зрачок-«акцент» — графитовый и без свечения */
[data-theme="light"] .brand-eye-pupil {
  box-shadow: none;
}

@keyframes eyeLook {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(3px, -1px); }
  40% { transform: translate(-3px, 1px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(-1px, -2px); }
}

.brand-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  line-height: 1;
}

/* ===== NAV ===== */
.site-nav {
  position: relative;
  z-index: var(--z-nav);
  flex-shrink: 0;
}

.site-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding-block: var(--s-4);
}

@media (min-width: 768px) {
  .site-nav-inner {
    padding-block: var(--s-5);
  }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.nav-links a {
  transition: color var(--dur-base) ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--ink);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.nav-login {
  font-size: var(--fs-sm);
  color: var(--muted);
  transition: color var(--dur-base) ease;
}

.nav-login:hover,
.nav-login:focus-visible {
  color: var(--ink);
}

/* ===== КНОПКИ ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--h-btn-md);
  padding-inline: var(--s-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--r-md);
  white-space: nowrap;
  transition: background-color var(--dur-base) ease,
              border-color var(--dur-base) ease,
              color var(--dur-base) ease,
              box-shadow var(--dur-base) ease;
  text-decoration: none;
  line-height: 1;
}

.btn-sm {
  min-height: var(--h-btn-sm);
  padding-inline: var(--s-4);
  font-size: var(--fs-xs);
  border-radius: var(--r-sm);
}

.btn-lg {
  min-height: var(--h-btn-lg);
  padding-inline: var(--s-8);
  font-size: 15px;
}

@media (min-width: 1024px) {
  .btn-lg {
    min-height: var(--h-btn-xl);
    padding-inline: var(--s-12);
    font-size: 18px;
  }
}

.btn-accent {
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid transparent;
  box-shadow: 0 0 0 0 var(--accent-glow), var(--glow-accent);
}

.btn-accent:hover,
.btn-accent:focus-visible {
  box-shadow: 0 0 0 4px var(--accent-15), var(--glow-accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--muted);
  background: var(--accent-08);
}

.btn-secondary {
  background: var(--glass-bg);
  color: var(--ink);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(18px) saturate(var(--glass-saturate));
  backdrop-filter: blur(18px) saturate(var(--glass-saturate));
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: var(--accent-25);
  background: var(--glass-bg-strong);
}

/* Резиновость */
.rubber {
  transition: transform var(--dur-slow) var(--ease-bounce),
              background var(--dur-base) ease,
              box-shadow var(--dur-slow) ease,
              border-color var(--dur-base) ease,
              color var(--dur-base) ease;
  will-change: transform;
}

.rubber:hover {
  transform: scaleX(1.03) scaleY(0.97);
}

.rubber:active {
  transform: scaleX(0.98) scaleY(1.02);
  transition-duration: 0.1s;
}

/* ===== БЕЙДЖ / ПИЛЮЛЯ ===== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: var(--fs-2xs);
  font-weight: 500;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-08);
  border: 1px solid var(--accent-20);
  width: fit-content;
}

.pill-dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.pill-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Чипы-метки внутри карточек */
.chip {
  display: inline-block;
  font-size: var(--fs-2xs);
  color: var(--muted);
  background: var(--line-50);
  border-radius: 4px;
  padding: 4px 8px;
  white-space: nowrap;
}

/* ===== ФОРМЫ ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}

.field-label {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.field-label .req {
  color: var(--accent-2);
}

.field-hint {
  font-size: var(--fs-2xs);
  color: var(--muted-2);
  line-height: 1.4;
}

.input {
  width: 100%;
  min-height: var(--h-btn-md);
  padding: 0 var(--s-4);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: var(--fs-sm);
  transition: border-color var(--dur-base) ease, box-shadow var(--dur-base) ease, background var(--dur-base) ease;
}

.input::placeholder {
  color: var(--muted-2);
}

.input:hover {
  border-color: var(--line-strong);
}

/* Поле даты не должно обрезать значение */
.input[type="date"] {
  min-width: 0;
  padding-right: 40px;
  font-variant-numeric: tabular-nums;
}

.input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
}

.input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.input:focus {
  outline: none;
  border-color: var(--accent-25);
  box-shadow: 0 0 0 3px var(--accent-08);
  background: var(--glass-bg);
}

.input[aria-invalid="true"] {
  border-color: rgba(255, 107, 107, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.08);
}

.input-wrap {
  position: relative;
  display: flex;
}

.input-wrap .input {
  padding-right: 44px;
}

.input-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--muted);
  transition: color var(--dur-base) ease, background var(--dur-base) ease;
}

.input-toggle:hover,
.input-toggle:focus-visible {
  color: var(--ink);
  background: var(--line-50);
}

.input-toggle svg {
  width: 18px;
  height: 18px;
}

.field-error {
  font-size: var(--fs-2xs);
  color: var(--danger);
  line-height: 1.4;
  display: none;
}

.field-error.is-visible {
  display: block;
}

/* Чекбокс */
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.5;
  cursor: pointer;
  min-width: 0;
}

.check input {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--bg);
  cursor: pointer;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease;
  position: relative;
}

.check input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.check input:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.check a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.check a:hover {
  color: var(--accent);
}

/* Индикатор надёжности пароля */
.strength {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.strength-bar {
  flex: 1;
  height: 3px;
  border-radius: var(--r-pill);
  background: var(--line);
  transition: background var(--dur-base) ease;
}

.strength-bar.is-on:nth-child(1) { background: var(--danger); }
.strength-bar.is-on:nth-child(2) { background: var(--accent-2); }
.strength-bar.is-on:nth-child(3) { background: var(--accent); }
.strength-bar.is-on:nth-child(4) { background: var(--accent); }

.strength.is-weak .strength-bar.is-on { background: var(--danger); }
.strength.is-mid .strength-bar.is-on { background: var(--accent-2); }
.strength.is-strong .strength-bar.is-on { background: var(--accent); }

/* ===== СЕГМЕНТЫ (табы) ===== */
.segmented {
  display: flex;
  padding: 4px;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  position: relative;
}

.segmented[hidden] {
  display: none;
}

.segmented button,
.segmented a {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding-inline: var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  transition: background var(--dur-base) ease, color var(--dur-base) ease;
}

.segmented button:hover,
.segmented a:hover {
  color: var(--ink);
}

.segmented [aria-selected="true"],
.segmented .is-active {
  background: var(--glass-bg);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ===== УВЕДОМЛЕНИЯ ===== */
.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--fs-xs);
  line-height: 1.5;
  border: 1px solid transparent;
}

.notice[hidden] {
  display: none;
}

.notice svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.notice--error {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.08);
  border-color: rgba(255, 107, 107, 0.25);
}

.notice--ok {
  color: var(--accent);
  background: var(--accent-08);
  border-color: var(--accent-20);
}

.notice--info {
  color: var(--ink);
  background: var(--glass-bg);
  border-color: var(--line);
}

.notice--info strong {
  color: var(--accent);
  font-weight: 600;
}

/* ===== РАЗДЕЛИТЕЛЬ ===== */
.divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--fs-2xs);
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  margin-block: var(--s-1);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ===== СПИННЕР ===== */
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== КАРТОЧКА / TILE ===== */
.tile {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: border-color var(--dur-slow) ease,
              transform var(--dur-slow) var(--ease-bounce),
              box-shadow var(--dur-slow) ease;
}

.tile--interactive:hover,
.tile--interactive:focus-within {
  border-color: var(--accent-25);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

/* ===== АВАТАРЫ ===== */
.ava {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  border: 2.5px solid var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--on-accent);
  margin-left: -8px;
  transition: transform var(--dur-base) ease;
}

.ava:first-child {
  margin-left: 0;
}

.ava:hover {
  transform: translateY(-4px);
  z-index: 10;
}

.ava-stack {
  display: flex;
  align-items: center;
}

/* ===== ПРОГРЕСС-БАР ===== */
.progress {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
}

@media (min-width: 768px) {
  .progress {
    height: 8px;
  }
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: progressGrow 1.6s var(--ease-out) forwards;
}

@keyframes progressGrow {
  to { width: var(--w, 0%); }
}

/* ===== МИНИ-ЧАРТ ===== */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  width: 100%;
  height: 24px;
}

@media (min-width: 768px) {
  .chart {
    height: 32px;
  }
}

.chart-bar {
  flex: 1;
  min-width: 0;
  border-radius: 2px 2px 0 0;
  transform-origin: bottom;
  animation: barGrow 1s var(--ease-out) backwards;
}

@keyframes barGrow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

/* ===== БЕЙДЖИ СТАТУСА ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-plate-label);
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.4;
}

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge--ok {
  color: var(--accent);
  background: var(--accent-08);
  border-color: var(--accent-20);
}

.badge--warn {
  color: var(--accent-2);
  background: var(--accent-2-10);
  border-color: rgba(255, 138, 71, 0.25);
}

.badge--muted {
  color: var(--muted);
  background: var(--line-50);
  border-color: var(--line);
}

.badge--violet {
  color: var(--accent-3);
  background: var(--accent-3-10);
  border-color: rgba(184, 167, 255, 0.22);
}

.badge--danger {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.08);
  border-color: rgba(255, 107, 107, 0.22);
}

/* ===== ТАБЛИЦА ===== */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* Не даём min-width таблицы раздувать grid/flex-родителя */
  contain: paint;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-table);
  min-width: 560px;
}

.data-table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--fs-plate-label);
  font-weight: 400;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 var(--s-4) var(--s-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line-50);
  color: var(--ink);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background var(--dur-fast) ease;
}

.data-table tbody tr:hover {
  background: var(--accent-08);
}

.data-table .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.data-table th.num {
  text-align: right;
}

/* Мобильный режим: таблица превращается в список карточек,
   суммы всегда видны — без горизонтального скролла */
@media (max-width: 767px) {
  .data-table {
    min-width: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody,
  .data-table tbody tr,
  .data-table tbody td {
    display: block;
    width: 100%;
  }

  .data-table tbody tr {
    position: relative;
    padding: var(--s-4);
    border-bottom: 1px solid var(--line-50);
  }

  .data-table tbody tr:last-child {
    border-bottom: none;
  }

  .data-table tbody td {
    padding: 0 0 6px;
    border: none;
  }

  .data-table tbody td:last-child {
    padding-bottom: 0;
  }

  .data-table tbody td.num {
    text-align: left;
    font-size: var(--fs-body);
    padding-top: 2px;
  }

  /* Скрываем колонку «Сбор» на мобилке — она повторяется у всех строк */
  .data-table tbody td[data-col="fund"] {
    display: none;
  }

  .data-table tbody td[data-col="status"] {
    padding-bottom: 2px;
  }
}

.data-table .dim {
  color: var(--muted);
}

/* ===== ПУСТОЕ СОСТОЯНИЕ ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--s-3);
  padding: var(--s-12) var(--s-4);
  color: var(--muted);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg-strong);
  border: 1px solid var(--line);
  color: var(--muted);
}

.empty-state-icon svg {
  width: 22px;
  height: 22px;
}

.empty-state-title {
  color: var(--ink);
  font-weight: 600;
  font-size: var(--fs-body);
}

.empty-state-text {
  font-size: var(--fs-xs);
  max-width: 320px;
  line-height: 1.5;
}

/* ===== МОДАЛКА ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(5, 5, 4, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) ease, visibility var(--dur-base) ease;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

@media (min-width: 768px) {
  .modal {
    align-items: center;
    padding: var(--s-6);
  }
}

.modal-panel {
  background: var(--glass-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  transform: translateY(16px);
  transition: transform var(--dur-base) var(--ease-out);
  overflow: hidden;
}

@media (min-width: 768px) {
  .modal-panel {
    border-radius: var(--r-xl);
    max-height: calc(100vh - 96px);
  }
}

.modal.is-open .modal-panel {
  transform: none;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-5) var(--s-3);
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .modal-head {
    padding: var(--s-6) var(--s-6) var(--s-3);
  }
}

.modal-title {
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  line-height: 1.2;
}

.modal-subtitle {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: 2px;
}

.modal-close {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  margin-left: auto;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: var(--line-50);
  color: var(--ink);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 0 var(--s-5) var(--s-5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

@media (min-width: 768px) {
  .modal-body {
    padding: 0 var(--s-6) var(--s-6);
  }
}

.modal-foot {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-5) var(--s-5);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--glass-bg);
}

@media (min-width: 768px) {
  .modal-foot {
    flex-direction: row;
    justify-content: flex-end;
    padding: var(--s-4) var(--s-6) var(--s-6);
  }
}

.modal-foot .btn {
  width: 100%;
}

@media (min-width: 768px) {
  .modal-foot .btn {
    width: auto;
    min-width: 140px;
  }
}

body.modal-open {
  overflow: hidden;
}

/* ===== TOAST ===== */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  width: min(100% - 32px, 420px);
  pointer-events: none;
}

@media (min-width: 992px) {
  .toast-region {
    bottom: var(--s-6);
    left: auto;
    right: var(--s-6);
    transform: none;
  }
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--glass-bg-strong);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-card-hover);
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--ink);
  pointer-events: auto;
  animation: toastIn 0.35s var(--ease-out);
}

.toast.is-leaving {
  animation: toastOut 0.25s ease forwards;
}

.toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast--ok svg { color: var(--accent); }
.toast--error svg { color: var(--danger); }
.toast--info svg { color: var(--accent-3); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

/* ===== ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ ===== */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(18px) saturate(var(--glass-saturate));
  backdrop-filter: blur(18px) saturate(var(--glass-saturate));
  flex-shrink: 0;
}

.theme-toggle-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  color: var(--muted);
  transition: color var(--dur-base) ease, background var(--dur-base) ease;
}

.theme-toggle-btn:hover {
  color: var(--ink);
}

.theme-toggle-btn svg {
  width: 16px;
  height: 16px;
}

.theme-toggle-btn[aria-pressed="true"] {
  color: var(--on-accent);
  background: var(--accent);
}

/* Однокнопочная версия для тесных мест */
.theme-toggle-single {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(18px) saturate(var(--glass-saturate));
  backdrop-filter: blur(18px) saturate(var(--glass-saturate));
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.theme-toggle-single:hover,
.theme-toggle-single:focus-visible {
  color: var(--ink);
  border-color: var(--line-strong);
}

.theme-toggle-single svg {
  width: 17px;
  height: 17px;
}

/* Иконки: в светлой теме показываем «ночь», в тёмной — «солнце» */
[data-theme="light"] .icon-for-dark,
[data-theme="dark"] .icon-for-light {
  display: none;
}
[data-theme="dark"] .icon-for-dark,
[data-theme="light"] .icon-for-light {
  display: block;
}

/* ===== STAT / KPI КАРТОЧКА ===== */
.stat {
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: var(--fs-plate-label);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  font-weight: 600;
  font-size: var(--fs-plate-big);
  line-height: 1.1;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 768px) {
  .stat-value {
    font-size: var(--fs-plate-hero);
  }
}

.stat-value .unit {
  font-size: 0.6em;
  color: var(--muted);
  font-weight: 400;
  margin-left: 2px;
}

.stat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: var(--s-1);
  min-width: 0;
}

.stat--accent .stat-value { color: var(--accent); }

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s-1);
}

.stat-icon svg {
  width: 16px;
  height: 16px;
}

.stat-icon--lime { background: var(--accent-08); color: var(--accent); }
.stat-icon--orange { background: var(--accent-2-10); color: var(--accent-2); }
.stat-icon--violet { background: var(--accent-3-10); color: var(--accent-3); }
.stat-icon--muted { background: var(--line-50); color: var(--muted); }

/* ===== FOOTER ===== */
.site-footer {
  position: relative;
  z-index: var(--z-nav);
  flex-shrink: 0;
  width: 100%;
  border-top: 1px solid var(--line-60);
  margin-top: auto;
}

.site-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding-block: var(--s-5);
}

@media (min-width: 768px) {
  .site-footer-inner {
    flex-direction: row;
    gap: var(--s-6);
    padding-block: var(--s-6);
  }
}

.footer-copy {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-xs);
  color: var(--muted);
  order: 2;
}

@media (min-width: 768px) {
  .footer-copy {
    order: 1;
  }
}

.footer-copy-mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-copy-mark::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--s-2) var(--s-4);
  font-size: var(--fs-xs);
  color: var(--muted);
  order: 1;
}

@media (min-width: 768px) {
  .footer-links {
    gap: var(--s-2) var(--s-6);
    font-size: var(--fs-xs);
    order: 2;
  }
}

.footer-links a {
  transition: color var(--dur-base) ease;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--ink);
}

.footer-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-2xs);
  font-family: var(--font-mono);
  color: var(--muted);
  order: 3;
}

.footer-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ===== ПОЯВЛЕНИЕ ===== */
.fade {
  opacity: 0;
  transform: translateY(24px);
  animation: fadeUp 1s var(--ease-out) forwards;
}

.fade-1 { animation-delay: 0.05s; }
.fade-2 { animation-delay: 0.12s; }
.fade-3 { animation-delay: 0.22s; }
.fade-4 { animation-delay: 0.32s; }
.fade-5 { animation-delay: 0.42s; }
.fade-6 { animation-delay: 0.52s; }
.fade-7 { animation-delay: 0.62s; }
.fade-8 { animation-delay: 0.72s; }

@keyframes fadeUp {
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fade {
    opacity: 1 !important;
    transform: none !important;
  }
  .brand-eye-pupil {
    animation: none !important;
  }
  .pill-dot::after {
    animation: none !important;
  }
  body.has-custom-cursor,
  body.has-custom-cursor a,
  body.has-custom-cursor button,
  body.has-custom-cursor input {
    cursor: auto;
  }
  .cursor-dot,
  .cursor-ring {
    display: none !important;
  }
}

/* Поле-константа (сбор в модалке доп. взноса) */
.input--static {
  display: flex;
  align-items: center;
  background: var(--accent-06);
  border-color: var(--accent-20);
  color: var(--ink);
  font-weight: 600;
  cursor: default;
  user-select: none;
}

/* ===== ЧЕКИ: загрузка в модалке расхода ===== */
.receipts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.receipt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.receipt-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--glass-bg);
  font-size: var(--fs-xs);
  min-width: 0;
}

.receipt-item--pending {
  border-style: dashed;
  border-color: var(--accent-30);
}

.receipt-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  color: var(--accent);
}

.receipt-icon svg {
  width: 16px;
  height: 16px;
}

.receipt-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.receipt-size {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  flex-shrink: 0;
}

.receipt-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--s-4);
  border-radius: var(--r-md);
  border: 1.5px dashed var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease, background var(--dur-fast) ease;
}

.receipt-drop:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: var(--accent-06);
}

.receipt-drop svg {
  color: var(--accent);
}

.receipt-hint {
  font-size: 10px;
  color: var(--muted-2);
  line-height: 1.4;
}

.receipt-pending:empty {
  display: none;
}
