/* ============================================================
   ВНИМАНИЕ: это МОДУЛЬ, а не самостоятельный файл.
   Стили приложения собираются в assets/css/style.css из
   assets/css/modules/*.css — правьте модули, а не собранный файл.
       сборка:  node tools/build_css.mjs
       проверка: node tools/build_css.mjs --check  (и проверка 6 в tools/check.php)
   ============================================================ */

/* ============================================================
   ТукДом — приложение
   Палитра: тёмно-зелёный #0d3b3a, персиковый #f0a080, кремовый #faf8f5
   ============================================================ */

/* ============================================================
   1. СБРОС, ПЕРЕМЕННЫЕ, АНИМАЦИИ
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* === Брендовая палитра ТукДом === */
    --brand-dark:    #0d3b3a;
    --brand-dark-2:  #15524f;
    --brand-peach:   #f0a080;
    --brand-peach-2: #e88b68;
    --brand-cream:   #faf8f5;
    --brand-mint:    #7fb8a8;

    /* Светлая тема (по умолчанию) */
    --primary: var(--brand-dark);
    --primary-hover: var(--brand-dark-2);
    --primary-soft: rgba(13, 59, 58, 0.12);
    --primary-tint: rgba(13, 59, 58, 0.08);

    --bg: var(--brand-cream);
    --card: #ffffff;
    --border: #e5e0d8;
    --text: #0d3b3a;
    --text-muted: #4a6b69;
    --success: #10b981;
    --danger: #ef4444;
    --row-even: #f4efe8;
    --row-hover: #ebe4da;
    --head-bg: #f2ede6;
    --shadow: 0 1px 3px rgba(13, 59, 58, 0.06);
    --shadow-lg: 0 4px 20px rgba(13, 59, 58, 0.10);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: .2s;
    --header-height: 61px;
    --content-padding: 24px;
    --log-card-bg: #f2ede6;
    --log-card-accent: var(--brand-dark);
}


html { height: 100%; }
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--primary);
}

/* Общие стили для ссылок (<a>) */
a:not([class*="btn"]):not([class*="tab"]):not([class*="badge"]) {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}
a:not([class*="btn"]):not([class*="tab"]):not([class*="badge"]):hover {
    color: var(--primary-hover);
}

/* ============================================================
   ПОЛЕ ВЫБОРА ЗНАЧЕНИЯ (SELECT) — базовый вид
   ============================================================ */
select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    padding: 8px 38px 8px 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a6b69' stroke-width='2.5' 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 14px center;
    transition: border-color var(--transition), box-shadow var(--transition);
}
select:hover {
    border-color: var(--primary);
}
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
select option,
select optgroup {
    background-color: var(--card);
    color: var(--text);
}

/* ============================================================
   ПОЛЕ ВЫБОРА ФАЙЛА — единый вид во всём приложении
   ============================================================
   Было: нативный виджет — серая системная кнопка «Выбрать файл» с чужим
   шрифтом, которая выбивалась из оформления (аватар в профиле, импорт CSV,
   фото счётчика в аренде). Кнопка внутри поля рисуется стандартным
   ::file-selector-button (Chrome 89+, Firefox 82+, Safari 14.1+), поэтому
   -webkit-дубль не нужен.

   Цвета — только переменные темы: иначе в тёмной теме кнопка осталась бы
   светлой, а поле — тёмным. Размеры кнопки — в em от шрифта поля, чтобы
   компактные поля (фото счётчика, 11px) не распирало.

   ⚠️ Конкретные блоки (.form-field, .import-field, .meter-photo-label) по
   специфичности перекрывают эти правила — там заданы только отступы,
   размеры шрифта и ширина, сам вид кнопки они не переопределяют. */

input[type="file"] {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 5px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}
input[type="file"]:hover { border-color: var(--primary); }
input[type="file"]:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 0.55em 1.1em;
    font-family: inherit;
    font-size: 1em;
    font-weight: 600;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
input[type="file"]::file-selector-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body > main { flex: 1 0 auto; }
.app-footer { flex-shrink: 0; }

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes saveSuccess {
    0% { background: rgba(16, 185, 129, 0.3); }
    100% { background: rgba(16, 185, 129, 0.1); }
}
@keyframes saveError {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}
@keyframes plan-pulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 2px 16px rgba(245, 158, 11, 0.8); }
}
@keyframes bannerSlideIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================================
   2. БАЗОВЫЕ ЭЛЕМЕНТЫ
   ============================================================ */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    max-width: 100%;
    overflow: hidden;
}
.card h3 {
    margin-bottom: 14px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin: 12px 0 4px;
    font-weight: 500;
}

/* Общие поля ввода */
.card input[type="text"],
.card input[type="email"],
.card input[type="password"],
.card input[type="number"],
.card textarea,
.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="password"],
.modal-content input[type="number"],
.modal-content textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.card textarea { resize: vertical; }
.modal-content textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}
.card input:focus, .card textarea:focus,
.modal-content input:focus, .modal-content textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Кнопки */
.btn-primary,
.card button {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
}
.btn-primary:hover,
.card button:hover {
    background: var(--primary-hover);
}

.card form > button:not(.btn-sm):not(.btn-delete-service):not(.btn-toggle-details):not(.meter-clear-btn),
.card form > .btn-primary:not(.btn-sm),
.card form > .btn-secondary:not(.btn-sm) {
    margin-top: 16px;
    width: auto;
}

.page-nav .btn-secondary,
.page-nav button {
    margin-top: 0;
    min-width: 0;
    width: auto;
}

.btn-secondary {
    padding: 8px 14px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background var(--transition), border-color var(--transition);
}
.btn-secondary:hover {
    border-color: var(--primary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    min-width: 0;
    width: auto;
}
.btn-success { background: #d1fae5 !important; color: #065f46 !important; }

.btn-danger,
.card button.btn-danger,
.family-actions button.btn-danger,
.family-inline-form button.btn-danger {
    background: #fee2e2 !important;
    color: #991b1b !important;
    border: none !important;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-danger:hover,
.card button.btn-danger:hover,
.family-actions button.btn-danger:hover {
    background: #fca5a5 !important;
    color: #991b1b !important;
}

.btn-danger svg {
    color: #991b1b;
}

.btn-danger-outline {
    padding: 6px 12px;
    background: #ef4444 !important;
    color: #ffffff;
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-danger-outline:hover {
    background: var(--danger);
    color: white;
}

.btn-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 11px;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
}
.btn-link:hover { color: var(--primary-hover); }

/* Навигация по странице */
.page-nav {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--content-padding) var(--content-padding) 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}
.page-nav-narrow {
    max-width: 1000px;
    padding: 24px 48px 0;
}

/* Алерты */
.alert {
    max-width: 1200px;
    margin: 16px auto;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* Ссылки внутри плашек. Общего правила для <a> в проекте нет, поэтому
   здесь они становились браузерными синими с подчёркиванием — на цветной
   плашке это и некрасиво, и плохо читается. Наследуем цвет плашки. */
.alert a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    border-radius: 3px;
}
.alert a:hover {
    text-decoration-thickness: 2px;
}
.alert a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}


/* ============================================================
   3. ШАПКА ПРИЛОЖЕНИЯ
   ============================================================ */
.app-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
    z-index: 100;
    width: 100%;
}
.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}
.brand {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: opacity .15s;
}
.brand:hover { opacity: 0.85; }
.app-header h1 { font-size: 18px; font-weight: 600; }
.user-menu { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Логотипы */
.logo-icon-img {
    height: 50px;
    width: auto;
    display: block;
    flex-shrink: 0;
    content: url('../icons/logo-icon.svg');
}


.logo-text-img {
    height: 50px;
    width: auto;
    max-width: 160px;
    display: block;
    flex-shrink: 0;
    align-self: flex-end;
    vertical-align: middle;
    object-fit: contain;
    object-position: center;
    margin-bottom: 0;
    content: url('../icons/logo-text.png');
}


.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    padding: 5px 12px;
    border-radius: 10px;
    transition: background var(--transition);
}
.user-badge:hover { background: var(--bg); }
.user-badge img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
    padding: 3px;
}

.btn-logout {
    color: var(--danger);
    text-decoration: none;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.1); }
.btn-logout svg { color: var(--danger); }

.btn-theme {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius);
    color: var(--text);
    transition: background var(--transition), border-color var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-theme:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================================
   ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ В ШАПКЕ (для незалогиненных)
   ============================================================ */
.header-theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, border-color .2s, transform .15s;
    min-width: 0;
    width: auto;
    margin: 0;
}
.header-theme-toggle:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}
.header-theme-toggle:active {
    transform: scale(0.94);
}
.header-theme-toggle svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* ============================================================
   ПЕРЕКЛЮЧАТЕЛЬ РЕЖИМА ВЛАДЕЛЬЦА (обычный / аренда)
   ============================================================
   Виден только владельцу и админу: у них тариф всегда Премиум, и без этого
   переключателя функций аренды они не видят (см. src/config/23-rental.php).
   Активный сегмент залит брендовым цветом, текст — цветом карточки: так
   читается и в светлой теме (тёмно-зелёный + белый), и в тёмной (мята +
   тёмный фон). */

.owner-mode-switch {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
}

.owner-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 11px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.owner-mode-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.owner-mode-icon svg {
    display: block;
    width: 15px;
    height: 15px;
}

.owner-mode-btn + .owner-mode-btn {
    border-left: 1px solid var(--border);
}

.owner-mode-btn:hover {
    color: var(--text);
}

.owner-mode-btn.is-active {
    background: var(--primary);
    color: var(--card);
}

.owner-mode-badge {
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid var(--primary);
    background: var(--primary-tint);
    color: var(--primary);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================================
   НАВИГАЦИЯ В ШАПКЕ (ДЕСКТОП)
   ============================================================ */
.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    margin-right: auto;
}

.header-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.header-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.header-nav-icon svg {
    display: block;
}

.header-nav-link:hover {
    background: var(--bg);
    color: var(--text);
}

.header-nav-link.active {
    background: var(--primary-tint);
    color: var(--primary);
    font-weight: 600;
}

@media (max-width: 900px) {
    .header-nav {
        display: none;
    }
}


/* ============================================================
   4. БЕЙДЖИ ТАРИФОВ
   ============================================================ */
.plan-badge-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: transform .15s, box-shadow .15s, opacity .15s;
    line-height: 1.1;
    min-height: 32px;
    white-space: nowrap;
    position: relative;
}
.plan-badge-btn:hover { transform: translateY(-1px); opacity: 0.95; }
.plan-badge-btn:active { transform: translateY(0); }

.plan-badge-label { display: block; }
.plan-badge-days {
    display: block;
    font-size: 9px;
    font-weight: 500;
    opacity: 0.85;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 1px;
}

.plan-badge-btn.plan-base {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.plan-badge-btn.plan-base:hover {
    background: var(--card);
    border-color: var(--text-muted);
}
.plan-badge-btn.plan-no_ads {
    background: linear-gradient(135deg, #0d3b3a, #1a5a56);
    color: white;
    box-shadow: 0 2px 8px rgba(13, 59, 58, 0.35);
}
.plan-badge-btn.plan-no_ads:hover { box-shadow: 0 4px 14px rgba(13, 59, 58, 0.5); }
.plan-badge-btn.plan-premium {
    background: linear-gradient(135deg, #f0a080, #e88b68);
    color: white;
    box-shadow: 0 2px 8px rgba(240, 160, 128, 0.4);
}
.plan-badge-btn.plan-premium:hover { box-shadow: 0 4px 14px rgba(240, 160, 128, 0.6); }
/* Тариф «Аренда» — старший: бирюзовый, в цвет бренда, но насыщеннее */
.plan-badge-btn.plan-rental {
    background: linear-gradient(135deg, #0d9488, #0f766e);
    color: white;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.4);
}
.plan-badge-btn.plan-rental:hover { box-shadow: 0 4px 14px rgba(13, 148, 136, 0.6); }
.plan-badge-btn.plan-expired { opacity: 0.55; filter: grayscale(0.7); }
.plan-badge-btn.plan-soon { animation: plan-pulse 2s ease-in-out infinite; }

/* Гарантируем контраст плашки тарифа при наведении (светлая тема) */
.plan-badge-btn.plan-base:hover {
    background: var(--card);
    color: var(--text);
    border-color: var(--text-muted);
}
.plan-badge-btn.plan-no_ads:hover, .plan-badge-btn.plan-premium:hover {
    color: #ffffff;
    background: linear-gradient(135deg, #f0a080, #e88b68);
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.plan-badge.plan-base {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.plan-badge.plan-no_ads {
    background: linear-gradient(135deg, #0d3b3a, #1a5a56);
    color: white;
}
.plan-badge.plan-premium {
    background: linear-gradient(135deg, #f0a080, #e88b68);
    color: white;
    box-shadow: 0 2px 8px rgba(240, 160, 128, 0.3);
}
.plan-badge.plan-rental {
    background: linear-gradient(135deg, #0d9488, #0f766e);
    color: white;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}
.plan-badge.plan-expired { opacity: 0.5; filter: grayscale(0.6); }

.role-crown {
    font-size: 14px;
    line-height: 1;
    margin-left: 2px;
    filter: drop-shadow(0 1px 2px rgba(245, 158, 11, 0.5));
}
.user-badge-icon { padding: 8px 10px !important; color: var(--primary); }
.user-badge-icon:hover { background: var(--primary-tint) !important; }

/* ============================================================
   5. ПАНЕЛЬ ЛИМИТОВ И БАННЕР
   ============================================================ */
.plan-usage-bar {
    background: var(--card);
    border-top: 1px solid var(--border);
    animation: slideDown .2s ease;
}
.plan-usage-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.plan-usage-item { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.plan-usage-label { color: var(--text-muted); }
.plan-usage-value {
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.plan-usage-cta {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #0d3b3a, #1a5a56);
    color: white;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s;
}
.plan-usage-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 59, 58, 0.4);
}

.plan-expire-banner {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    background: linear-gradient(135deg, #f0a080, #e88b68);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(240, 160, 128, 0.4);
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    animation: bannerSlideIn .4s cubic-bezier(.16,1,.3,1);
    max-width: 90%;
}
.plan-expire-banner strong { font-weight: 700; }
.plan-expire-cta {
    color: white;
    text-decoration: none;
    font-weight: 700;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: background .15s;
    white-space: nowrap;
}
.plan-expire-cta:hover { background: rgba(255, 255, 255, 0.3); }
.plan-expire-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
    opacity: 0.8;
    transition: opacity .15s;
}
.plan-expire-close:hover { opacity: 1; }

/* ============================================================
   6. КОНТЕЙНЕР И СЕТКИ
   ============================================================ */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--content-padding);
    width: 100%;
    overflow-x: clip;
}
.profile-grid {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--content-padding);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    flex: 1 0 auto;
    width: 100%;
    align-content: start;
    box-sizing: border-box;
}
@media (min-width: 1500px) {
    .profile-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
    .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .profile-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   7. АККАУНТЫ
   ============================================================ */
.account-tabs { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.account-tab {
    padding: 8px 18px;
    border: 2px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
    transition: opacity var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.account-tab:hover { opacity: 0.85; }
.account-tab.add-account { border-style: dashed; color: var(--text-muted); }

.accounts-list { display: flex; flex-direction: column; gap: 12px; }
.account-card {
    padding: 16px;
    position: relative;
    transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.account-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.account-row input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}
.account-meta { color: var(--text-muted); font-size: 13px; }

.account-card .drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 16px;
    padding: 8px 6px;
    margin-right: 4px;
    border-radius: 6px;
    user-select: none;
    transition: background .15s, color .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.account-card .drag-handle:hover { background: var(--bg); color: var(--text); }
.account-card .drag-handle:active { cursor: grabbing; }
.account-card.dragging {
    opacity: 0.4;
    border-color: var(--primary);
    box-shadow: 0 8px 30px var(--primary-soft);
}
.account-card.sortable-ghost {
    opacity: 0.3;
    background: var(--primary-tint);
    border-style: dashed;
    border-color: var(--primary);
}
.account-card.sortable-chosen {
    transform: scale(1.01);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

/* ============================================================
   8. СТАТИСТИКА
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow);
}
.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.stat-value { font-size: 22px; font-weight: 700; }
.stat-sub { font-size: 12px; color: var(--text-muted); }

.stat-card-revenue {
    text-decoration: none;
    color: inherit;
    position: relative;
    border-color: rgba(16, 185, 129, 0.3);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.05), var(--card));
    transition: transform .15s, border-color .15s, box-shadow .15s;
    cursor: pointer;
}
.stat-card-revenue:hover {
    transform: translateY(-2px);
    border-color: var(--success);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15);
}
.stat-card-revenue .stat-value { color: var(--success); font-size: 24px; }
.stat-card-revenue .stat-label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--success);
}
.stat-card-revenue .stat-label svg { flex-shrink: 0; }
.stat-card-arrow {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--success);
    opacity: 0;
    transition: opacity .15s, right .15s;
}
.stat-card-revenue:hover .stat-card-arrow { opacity: 1; right: 14px; }

.stat-card-accent {
    border-color: rgba(240, 160, 128, 0.4);
    background: linear-gradient(180deg, rgba(240, 160, 128, 0.08) 0%, var(--card) 100%);
}
.stat-card-baseline {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--card) 100%);
}
.stat-card-baseline .stat-value { color: #10b981; }

/* ============================================================
   9. ГРАФИКИ
   ============================================================ */
.chart-card { padding: 24px; min-height: 480px; }
.chart-container {
    position: relative;
    width: 100%;
    height: 420px;
    margin-top: 12px;
}
.chart-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.revenue-chart-card { min-height: 520px; }
.revenue-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.revenue-chart-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.revenue-chart-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.revenue-year-picker {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    font-weight: 600;
}
.revenue-chart-tabs {
    display: flex;
    gap: 4px;
    padding: 3px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.revenue-tab {
    background: none;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background .15s, color .15s;
    min-width: 0;
    font-family: inherit;
}
.revenue-tab:hover {
    background: var(--card) !important;
    color: var(--text) !important;
}
.revenue-tab.active,
.revenue-tab.active:hover {
    background: var(--card) !important;
    color: var(--primary) !important;
    box-shadow: var(--shadow);
}
.revenue-tab svg { width: 12px; height: 12px; flex-shrink: 0; }

.revenue-quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: var(--radius);
}
.revenue-quick-item { display: flex; flex-direction: column; gap: 4px; }
.revenue-quick-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}
.revenue-quick-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.revenue-quick-value.delta-up { color: var(--danger); }
.revenue-quick-value.delta-down { color: var(--success); }

/* ============================================================
   10. ТУЛБАР
   ============================================================ */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
    background: var(--card);
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.toolbar > a.btn-secondary,
.toolbar > a.btn-primary,
.toolbar > button.btn-secondary,
.toolbar > button.btn-primary {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 13px;
    margin: 0;
}

.toolbar form {
    margin: 0;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar form button {
    margin-top: 0;
    width: auto;
    min-width: 0;
}

.year-picker {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    position: relative;
}
.year-picker label {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}
.year-picker select {
    padding: 8px 38px 8px 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    line-height: 1.2;
    background-image: 
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: 
        calc(100% - 19px) center,
        calc(100% - 14px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    min-width: 100px;
}
.year-picker select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.search-box {
    flex: 1 1 140px;
    min-width: 120px;
    max-width: 280px;
}
.search-box input {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.export-buttons { display: flex; gap: 6px; flex: 0 0 auto; }
.stats-button { white-space: nowrap; padding: 8px 16px; font-weight: 500; }

/* 10.1. ТУЛБАР В 3 СТРОКИ */
.toolbar-stacked {
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
    align-items: stretch;
}
.toolbar-stacked .toolbar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 40px;
}

/* Строка 1 — главные действия: быстрый ввод, статистика, импорт и экспорт CSV */
.toolbar-stacked .toolbar-row-main > a {
    flex: 1 1 150px;
    width: auto;
    max-width: 220px;
    margin: 0;
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
}

/* Строка 2 — поиск, фильтр по категории, год и добавление услуги */
.toolbar-stacked .toolbar-row-filters {
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
/* Форма добавления услуги уходит к правому краю строки */
.toolbar-stacked .toolbar-row-filters .inline-form { margin-left: auto; }

/* Строка 3 — работа с данными и служебные переключатели */
.toolbar-stacked .toolbar-row-tools {
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
/* Кнопки этой строки растягиваются до одинаковой ширины */
.toolbar-stacked .toolbar-row-tools > a.btn-secondary,
.toolbar-stacked .toolbar-row-tools > button.btn-secondary,
.toolbar-stacked .toolbar-row-tools > .inline-form-undo {
    flex: 1 1 132px;
    width: auto;
    max-width: 220px;
    margin: 0;
    white-space: nowrap;
}
.toolbar-stacked .toolbar-row-tools > .inline-form-undo > button {
    flex: 1 1 auto;
    width: 100%;
}
/* Пара мелких кнопок-переключателей прижата вправо */
.toolbar-tools-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    margin-left: auto;
}
.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
    margin: 0 4px;
}
.toolbar .btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
}
.toolbar .inline-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    flex-wrap: nowrap;
    flex: 0 0 auto;
}
.toolbar .inline-form input[type="text"] {
    flex: 0 1 220px;
    min-width: 140px;
    max-width: 260px;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}
.toolbar .inline-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.toolbar .inline-form button {
    flex: 0 0 auto;
    margin-top: 0;
    min-width: 0;
    width: auto;
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 13px;
}
.inline-form-undo {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin: 0;
    flex-wrap: nowrap;
    flex: 0 0 auto;
}
.inline-form-undo button {
    flex: 0 0 auto;
    margin: 0;
    width: auto;
    min-width: 0;
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
}

/* Тулбар — мобильная версия */
@media (max-width: 900px) {
    .toolbar { padding: 10px 12px; gap: 8px; }
    .toolbar-stacked { padding: 10px 12px; gap: 10px; }
    .toolbar-stacked .toolbar-row { gap: 6px; }

    /* Строка 1 — по две кнопки в ряд, одинаковой ширины */
    .toolbar-stacked .toolbar-row-main > a {
        flex: 1 1 calc(50% - 3px);
        min-width: 0;
        max-width: calc(50% - 3px);
        padding: 9px 10px;
    }

    /* Строка 2 — поиск на всю ширину, фильтр и год в одну строку */
    .toolbar-stacked .toolbar-row-filters .search-box {
        flex: 1 1 100%;
        max-width: none;
        margin-left: 0;
    }
    .toolbar-stacked .toolbar-row-filters .category-filter {
        flex: 1 1 160px;
        min-width: 0;
    }
    .toolbar-stacked .toolbar-row-filters .category-filter select {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
    .toolbar-stacked .toolbar-row-filters .year-picker { flex: 0 0 auto; }
    .toolbar-stacked .toolbar-row-filters .inline-form:not(.inline-form-undo) {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
        margin-top: 2px;
    }
    .toolbar-stacked .toolbar-row-filters .inline-form:not(.inline-form-undo) input[type="text"] {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
        width: auto;
    }

    /* Строка 3 — тоже по две кнопки в ряд */
    .toolbar-stacked .toolbar-row-tools > a.btn-secondary,
    .toolbar-stacked .toolbar-row-tools > button.btn-secondary,
    .toolbar-stacked .toolbar-row-tools > .inline-form-undo {
        flex: 1 1 calc(50% - 3px);
        max-width: none;
        padding: 9px 10px;
    }
    .toolbar-tools-icons {
        flex: 0 0 auto;
        margin-left: 0;
    }

    .inline-form-undo button {
        padding: 8px 12px;
        font-size: 13px;
    }
    .toolbar .inline-form { flex-wrap: nowrap; gap: 6px; }
    .toolbar .inline-form input[type="text"] {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
        width: auto;
    }
    .toolbar .inline-form button {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* ============================================================
   11. ТАБЛИЦА РАСХОДОВ
   ============================================================ */
.table-wrapper {
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: auto;
    max-height: 75vh;
}
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-size: 13px;
}

/* Чекбокс и подпись в шапке первой колонки — выровнены по центру */
thead th.sticky-col {
    text-align: left;
    padding-left: 16px;
    white-space: nowrap;
    min-width: 200px;
    max-width: 260px;
    position: sticky;
    left: 0;
    top: 0;
    z-index: 20;
    vertical-align: middle;
}

thead th.sticky-col .select-all-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 8px 0 0;
    padding: 0;
    vertical-align: middle;
    height: 16px;
    cursor: pointer;
}

thead th.sticky-col .select-all-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
    display: block;
    flex-shrink: 0;
}

thead th.sticky-col .th-service-label {
    display: inline-block;
    vertical-align: middle;
    line-height: 16px;
    height: 16px;
    position: relative;
    top: -1px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--text);
    margin-left: 40px; /* сдвиг под иконку категории */
}

/* Sticky — на сам <thead> */
thead {
    position: sticky;
    top: 0;
    z-index: 10;
}
.service-cell-inner .select-all-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    height: 16px;
    cursor: pointer;
}
.service-cell-inner .select-all-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
    display: block;
}
/* Обычные <th> внутри — просто ячейки без sticky */
thead th {
    background: var(--head-bg);
    color: var(--text);
    font-weight: 600;
    padding: 10px 8px;
    text-align: center;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
    border-bottom: 2px solid var(--border);
    position: relative;
}


/* Чекбокс перед названием услуги — на одной линии с drag-handle */
td.sticky-col > .service-checkbox {
    display: inline-block;
    vertical-align: middle;
    margin: 0 8px 0 0;
    flex-shrink: 0;
}

/* Заголовок первой колонки — обычный, без flex */
td.sticky-col {
    text-align: left;
    padding: 8px 12px 8px 16px;
    background: var(--card);
    position: sticky;
    left: 0;
    z-index: 5;
    min-width: 200px;
    max-width: 260px;
    vertical-align: middle;
    overflow: hidden;
}
td.sticky-col > .service-checkbox,
td.sticky-col > .drag-handle,
td.sticky-col > .service-label {
    vertical-align: middle;
}

/* Внутренний flex-контейнер первой колонки:
   чекбокс + drag-handle слева, название переносится справа */
.service-cell-inner {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.service-cell-inner .service-checkbox,
.service-cell-inner .drag-handle {
    flex-shrink: 0;
    margin-top: 1px;
}

.service-cell-inner .service-label {
    flex: 1 1 auto;
    min-width: 0;
}

td {
    padding: 6px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
#expensesTable tbody tr:nth-child(odd) td { background: var(--card); }
#expensesTable tbody tr:nth-child(even) td { background: var(--row-even); }
#expensesTable tbody tr:nth-child(odd) td.sticky-col { background: var(--card); }
#expensesTable tbody tr:nth-child(even) td.sticky-col { background: var(--row-even); }
#expensesTable tbody tr:hover td,
#expensesTable tbody tr:hover td.sticky-col { background: var(--row-hover) !important; }
tbody tr:hover td.sticky-col { background: var(--row-hover) !important; }

.service-name { font-weight: 500; white-space: nowrap; }
.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    margin-right: 6px;
    user-select: none;
    font-size: 12px;
}
.drag-handle:active { cursor: grabbing; }

.service-label {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background var(--transition);
    user-select: none;
    -webkit-user-select: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    line-height: 1.3;
    max-width: 100%;
    vertical-align: middle;
}
.service-label:has(.service-name-input) {
    display: block;
    width: 100%;
    padding: 0;
    background: transparent;
}
.service-label:hover { background: var(--primary-tint); }
.service-label:active { opacity: 0.7; }

.service-name-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 3px 6px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    background: var(--card);
    color: var(--text);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-soft);
    box-sizing: border-box;
    display: block;
}
.service-name:has(.service-name-input),
.service-label:has(.service-name-input) { overflow: visible; }
td.sticky-col:has(.service-name-input) {
    overflow: visible;
    z-index: 30;
    position: relative;
}

.cell { position: relative; min-width: 75px; white-space: nowrap; }
.cell-form { margin: 0; }
.cell-form input[type="number"] {
    width: 100%;
    min-width: 70px;
    border: 1px solid transparent;
    text-align: center;
    background: transparent;
    padding: 6px 2px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.3px;
    border-radius: 6px;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    -moz-appearance: textfield;
}
.cell-form input[type="number"]:hover { background: var(--bg); }
.cell-form input[type="number"]:focus {
    outline: none;
    background: var(--card);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.cell-form input[type="number"]::-webkit-outer-spin-button,
.cell-form input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.note-icon {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.15;
    transition: opacity var(--transition), background var(--transition), color var(--transition);
    border-radius: 3px;
    color: var(--text-muted);
    z-index: 2;
}
.note-icon:hover { opacity: 1; background: var(--primary-tint); color: var(--primary); }
.note-icon.has-note { opacity: 0.9; color: var(--primary); }
.note-icon svg { pointer-events: none; }

.meter-icon {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.15;
    transition: opacity .15s, background .15s, color .15s;
    border-radius: 3px;
    color: var(--text-muted);
    z-index: 2;
}
.meter-icon:hover { opacity: 1; background: var(--primary-tint); color: var(--primary); }
.meter-icon.has-value { opacity: 0.5; color: var(--primary); }
.meter-icon svg { pointer-events: none; }

.row-total {
    background: var(--bg);
    font-weight: 600;
    color: var(--primary);
    padding: 6px 10px;
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.total-row td {
    background: var(--head-bg);
    font-weight: 700;
    padding: 12px 8px;
    border-top: 2px solid var(--border);
    white-space: nowrap;
    min-width: 75px;
    font-variant-numeric: tabular-nums;
}

/* Ячейка «ИТОГО» — sticky ТОЛЬКО по горизонтали (left: 0).
   Без top/bottom — чтобы не прилипала по вертикали. */
.total-row td.sticky-col {
    position: sticky;
    left: 0;
    z-index: 5;
	background: var(--head-bg);
}

/* Остальные ячейки строки «Итого» — обычные, без sticky */
.total-row td:not(.sticky-col) {
    position: static;
}

/* Пустая ячейка в футере (под чекбоксами услуг) — тот же фон, что и у строки */
.total-row td[data-simple-hide] {
    background: var(--head-bg) !important;
}

/* В простом режиме ячейка скрыта, но её место остаётся —
   закрашиваем фон всей строки, чтобы не было «дырки» */
body.simple-mode .total-row {
    background: var(--head-bg);
}
body.simple-mode .total-row td:last-child {
    background: var(--head-bg) !important;
}
body.simple-mode .total-row td {
    background: var(--head-bg);
}
body.simple-mode .total-row td[data-simple-hide] {
    background: var(--head-bg);
}
.total-row td.sticky-col { text-align: left; padding-left: 16px; }
.grand-total {
    color: var(--primary);
    font-size: 14px;
    white-space: nowrap;
    min-width: 100px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.year-total-col {
    white-space: nowrap;
    min-width: 100px;
    text-align: right;
    padding-right: 12px !important;
}
.delta-row td {
    background: var(--card);
    font-weight: 500;
    font-size: 12px;
    padding: 8px;
    white-space: nowrap;
    min-width: 75px;
    font-variant-numeric: tabular-nums;
}
.delta-row td.sticky-col { font-weight: 600; }
.delta-up { color: var(--danger); }
.delta-down { color: var(--success); }

.actions-col,
.actions-cell {
    width: 56px;
    min-width: 56px;
    max-width: 56px;
    text-align: center;
    padding: 4px 6px !important;
    white-space: nowrap;
}
.actions-col {
    padding-left: 6px !important;
}
.actions-cell .btn-delete-service,
.actions-cell .service-checkbox {
    display: inline-flex;
    vertical-align: middle;
    margin: 0;
}
.actions-cell .btn-delete-service { margin-right: 8px; }

/* Кнопка × в шапке месяца */
.month-header { position: relative; }
.month-header-name { display: inline-block; }
.month-clear-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s, background .15s, color .15s;
    min-width: 0;
    font-family: inherit;
    font-weight: 400;
}
thead th:hover .month-clear-btn { opacity: 0.5; }
.month-clear-btn:hover {
    opacity: 1 !important;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}
.month-clear-btn:active { transform: scale(0.92); }


/* Модалки очистки */
.clear-warning {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-left: 4px solid var(--danger);
    border-radius: var(--radius);
    margin-bottom: 16px;
    align-items: flex-start;
}
.clear-warning-icon {
    flex-shrink: 0;
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}
.clear-warning-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.clear-warning-text strong { color: var(--danger); font-weight: 700; }

#clearMonthModal .modal-content input[type="text"],
#clearYearModal .modal-content input[type="text"] {
    font-family: monospace;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
}
#clearMonthModal .modal-content input[type="text"]:focus,
#clearYearModal .modal-content input[type="text"]:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.clear-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    cursor: pointer;
    margin: 0 0 4px;
}
.clear-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--danger);
    flex-shrink: 0;
    cursor: pointer;
}
#clearMonthModal .btn-danger,
#clearYearModal .btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    transition: background .15s, opacity .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
#clearMonthModal .btn-danger:hover:not(:disabled),
#clearYearModal .btn-danger:hover:not(:disabled) { background: #dc2626; }
#clearMonthModal .btn-danger:disabled,
#clearYearModal .btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-clear-year:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-delete-service {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    opacity: 0.15;
    transition: opacity var(--transition), background var(--transition), transform .1s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--danger);
    min-width: 0;
    width: auto;
    margin-top: 0;
}
tbody tr:hover .btn-delete-service { opacity: 0.5; }
.btn-delete-service:hover { opacity: 1 !important; background: rgba(239, 68, 68, 0.15); }
.btn-delete-service:active { transform: scale(0.9); }

/* Автосохранение */
.cell-form input[type="number"].saving {
    background: var(--primary-soft);
    border-color: var(--primary) !important;
}
.cell-form input[type="number"].saved {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: #10b981 !important;
    animation: saveSuccess 0.4s ease;
}
.cell-form input[type="number"].save-error {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: #ef4444 !important;
    animation: saveError 0.4s ease;
}
.service-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
    margin: 0;
    flex-shrink: 0;
}
.select-all-label {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    cursor: pointer;
    vertical-align: middle;
}
.select-all-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0;
}
tr.row-selected td { background: var(--primary-tint) !important; }

.bulk-actions-services {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--primary-tint);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    margin-bottom: 16px;
    animation: slideDown .2s ease;
    flex-wrap: wrap;
}
.bulk-actions-services .bulk-count {
    font-size: 13px;
    color: var(--text);
}
.bulk-actions-services .bulk-count strong {
    color: var(--primary);
    font-size: 15px;
}
.bulk-actions-services .btn-danger-outline { margin-left: auto; }

@media (max-width: 768px) {
    .month-clear-btn { opacity: 0.35; }
    .bulk-actions-services {
        flex-wrap: wrap;
        width: 100%;
        padding: 8px 12px;
    }
    .bulk-actions-services > button {
        flex: 1;
        font-size: 12px;
        padding: 6px 8px;
    }
    .bulk-actions-services .bulk-count {
        width: 100%;
        font-size: 12px;
    }
    .bulk-actions-services .btn-danger-outline { margin-left: 0; }
}

/* ============================================================
   12. ТОП УСЛУГ
   ============================================================ */
.top-services { display: flex; flex-direction: column; gap: 12px; }
.top-service-row {
    display: grid;
    grid-template-columns: 32px 160px 1fr auto;
    gap: 12px;
    align-items: center;
}
.top-service-rank {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 13px;
}
.top-service-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.top-service-bar {
    height: 24px;
    background: var(--bg);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}
.top-service-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--brand-peach) 100%);
    border-radius: 12px;
    transition: width .4s ease;
}
.top-service-total {
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   13. БЛОК "ПО МЕСЯЦАМ" — финальная версия с выравниванием
   ============================================================ */
.monthly-card {
    padding: 24px;
}

.monthly-block {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.monthly-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    table-layout: fixed;
}

/* ===== Заголовки ===== */
.monthly-table th {
    padding: 12px 14px;
    background: var(--bg);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    text-align: left;
}

.monthly-table th.monthly-col-sum,
.monthly-table th.monthly-col-delta {
    text-align: right;
    padding-right: 14px;
}

/* ===== Сетка колонок ===== */
.monthly-table th:nth-child(1),
.monthly-table td:nth-child(1) { width: auto; text-align: left; }

.monthly-table th:nth-child(2),
.monthly-table td:nth-child(2) { width: 260px; text-align: right; padding-right: 14px; }

.monthly-table th:nth-child(3),
.monthly-table td:nth-child(3) { width: 140px; text-align: right; padding-right: 14px; }

/* ===== Ячейки ===== */
.monthly-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}

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

/* Название месяца */
.monthly-cell-month { font-weight: 500; }
.monthly-month-name { display: inline-block; vertical-align: middle; }

.monthly-badge-current {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: var(--primary-tint);
    color: var(--primary);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

/* Сумма + бар */
.monthly-sum-row {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 6px;
}
.monthly-sum-value { font-weight: 600; color: var(--text); font-size: 15px; }
.monthly-sum-empty { color: var(--text-muted); opacity: 0.5; }
.monthly-sum-total { font-size: 17px; color: var(--primary); }

.monthly-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 6px;
    margin-left: auto;
    width: 100%;
    max-width: 240px;
    overflow: hidden;
}
.monthly-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--brand-peach) 100%);
    border-radius: 2px;
    transition: width .4s ease;
}

/* Δ */
.monthly-delta {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    min-width: 90px;
}
.monthly-delta.delta-up { color: var(--danger); }
.monthly-delta.delta-down { color: var(--success); }
.monthly-delta-empty { color: var(--text-muted); opacity: 0.5; }

/* Текущий месяц */
.monthly-row-current td { background: var(--primary-tint) !important; }

/* Пустой месяц */
.monthly-row-empty td { color: var(--text-muted); opacity: 0.65; }

/* Итоговая строка */
.monthly-table tfoot .total-row td {
    background: var(--bg);
    padding: 18px 14px;
    border-top: 2px solid var(--border);
    border-bottom: none;
    font-size: 15px;
    text-align: right;
}
.monthly-table tfoot .total-row td:nth-child(1) { text-align: left; }

/* Ховер */
.monthly-table tbody tr:hover td {
    background: var(--row-hover);
    transition: background .15s;
}

/* Мобильная */
@media (max-width: 600px) {
    .monthly-card { padding: 16px 12px; }
    .monthly-table td { padding: 12px 10px; }
    .monthly-sum-value { font-size: 14px; }
    .monthly-badge-current { display: none; }
    .monthly-bar { max-width: 100%; }
}

/* ============================================================
   14. МОДАЛКИ
   ============================================================ */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-content {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-content h3 {
    margin-bottom: 8px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}
.modal-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }
.modal-buttons { display: flex; gap: 10px; margin-top: 16px; }
.modal-buttons button {
    flex: 1;
    width: 100%;
    min-width: 0;
    margin-top: 0;
}

.copy-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.copy-row label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.copy-row select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
}
.copy-services-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 13px;
}
.copy-services-header label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}
.copy-services-header input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.services-count {
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.copy-services-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    margin-bottom: 16px;
    background: var(--card);
}
.copy-service-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background .15s;
    margin: 0;
}
.copy-service-item:hover { background: var(--bg); }
.copy-service-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.service-name-copy {
    flex: 1;
    color: var(--text);
    font-weight: 500;
}
.empty-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
}
.copy-service-item.empty .service-name-copy { color: var(--text-muted); }

/* ПУСТОЕ СОСТОЯНИЕ */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.empty-state-icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-tint);
    color: var(--primary);
    border-radius: 50%;
    margin-bottom: 8px;
}
.empty-state-icon svg { width: 36px; height: 36px; }
.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    text-align: center;
}
.empty-state-text {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
}

/* ============================================================
   15. ИМПОРТ CSV
   ============================================================ */
.import-card { max-width: 900px; margin: 0 auto; }
.import-info {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--text-muted);
}
.import-info ul { margin: 8px 0 12px 20px; padding: 0; }
.import-info li { margin-bottom: 4px; }
.import-info code {
    background: var(--card);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: var(--text);
}
.import-form { display: flex; flex-direction: column; gap: 16px; }
.import-row { display: grid; grid-template-columns: 2fr 1fr 2fr; gap: 16px; }
.import-field { display: flex; flex-direction: column; gap: 6px; }
.import-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}
.import-field input[type="file"],
.import-field input[type="number"],
.import-field select {
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
}
.import-field input[type="file"] { padding: 8px; cursor: pointer; }
.import-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.import-actions button { min-width: 140px; }

.preview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.preview-stat {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.preview-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.preview-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}
.preview-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-height: 500px;
}
.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.preview-table th {
    background: var(--bg);
    padding: 10px 8px;
    text-align: center;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    white-space: nowrap;
}
.preview-table td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.preview-table tbody tr:nth-child(even) td { background: var(--bg); }
.preview-service {
    text-align: left !important;
    font-weight: 500;
    background: var(--card) !important;
    position: sticky;
    left: 0;
}
.preview-empty { color: var(--text-muted); opacity: 0.4; }
.preview-total { font-weight: 700; color: var(--primary); }
.preview-actions {
    margin-top: 20px;
    padding: 16px;
    background: var(--primary-tint);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    text-align: center;
}

/* ============================================================
   16. СЧЁТЧИКИ
   ============================================================ */
.meters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
@media (max-width: 1100px) {
    .meters-grid { grid-template-columns: repeat(2, 1fr); }
}
.meter-card { padding: 24px; }
/* Поверка: цветная рамка карточки */
.meter-card--verify-soon { border-color: #f59e0b; }
.meter-card--verify-expired { border-color: var(--danger); }
/* Бейдж «Поверка скоро / просрочена» */
.meter-verify-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    border-radius: 999px;
    white-space: nowrap;
}
.meter-verify-badge svg { width: 12px; height: 12px; flex-shrink: 0; }
.meter-verify-badge.meter-verify-soon {
    color: #b45309;
    background: rgba(245, 158, 11, 0.14);
}
.meter-verify-badge.meter-verify-expired {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.14);
}
/* Баннер-предупреждение о поверке (сводка наверху страницы) */
.meter-verify-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 20px;
    background: rgba(245, 158, 11, 0.10);
    border: 1px solid rgba(245, 158, 11, 0.40);
    border-radius: var(--radius-lg);
}
.meter-verify-banner-icon {
    flex-shrink: 0;
    margin-top: 2px;
    color: #b45309;
}
.meter-verify-banner-body { flex: 1; min-width: 0; }
.meter-verify-banner-body > strong {
    display: block;
    font-size: 14px;
    color: #b45309;
}
.meter-verify-banner-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.meter-verify-banner-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
}
.meter-verify-banner-name { font-weight: 600; }
.meter-verify-banner-date { color: var(--text-muted); }
.meter-verify-banner-overdue { color: var(--danger); font-weight: 600; }
.meter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: nowrap;
}
.meter-header .meter-title { flex: 1; min-width: 0; }
.meter-header .meter-title h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.meter-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
}
.meter-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
}
.meter-title h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text);
}
.meter-meta-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 3px;
}
.meter-period-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    border-radius: 999px;
    white-space: nowrap;
}
.meter-period-status svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
}
.meter-period-status--done {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}
.meter-period-status--pending {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}
.meter-unit {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}
.meter-header-right .meter-unit { margin-right: 4px; }

.meter-edit-btn,
.meter-delete-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s, color .15s, opacity .15s, transform .1s;
    color: var(--text-muted) !important;
    min-width: 0 !important;
    line-height: 1;
    opacity: 0.5;
    box-shadow: none !important;
}
.meter-edit-btn svg,
.meter-delete-btn svg {
    display: block;
    pointer-events: none;
}
.meter-edit-btn:hover {
    opacity: 1;
    background: var(--primary-tint) !important;
    color: var(--primary) !important;
}
.meter-delete-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--danger) !important;
}
.meter-edit-btn:active,
.meter-delete-btn:active { transform: scale(0.9); }
.meter-card:hover .meter-edit-btn,
.meter-card:hover .meter-delete-btn { opacity: 0.75; }

@media (max-width: 768px) {
    .meter-header { flex-wrap: wrap; gap: 10px; }
    .meter-header-right { margin-left: auto; }
    .meter-edit-btn,
    .meter-delete-btn { width: 32px; height: 32px; opacity: 0.7; }
}

.meter-info {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}
.meter-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    color: var(--text);
}
.meter-info-row span:first-child { color: var(--text-muted); font-size: 13px; }
.meter-info-row span:last-child {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.meter-consumption {
    border-top: 1px dashed var(--border);
    margin-top: 4px;
    padding-top: 10px;
}
.meter-total {
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 10px;
    font-size: 16px;
}
.meter-total span:last-child { color: var(--primary); font-weight: 700; }
.meter-info-empty {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    padding: 8px 0;
    text-align: center;
}
/* Baseline — точка отсчёта счётчика */
.meter-baseline-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    vertical-align: middle;
    white-space: nowrap;
}
.meter-baseline-badge svg { width: 11px; height: 11px; }
.meter-baseline-row td {
    background: rgba(16, 185, 129, 0.06);
}
.meter-reading-actions {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.meter-reading-actions .btn-sm { min-width: 0; padding: 6px; }
.meter-info-row-baseline span:last-child {
    color: #10b981;
    font-weight: 600;
}
.meter-info-row-baseline span:last-child small {
    color: var(--text-muted);
    font-weight: 400;
}
.meter-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

/* Форма установки точки отсчёта — с подписью и разделителем сверху */
.meter-baseline-form {
    border-top: 1px dashed var(--border);
    padding-top: 14px;
}
.meter-baseline-form .meter-field label { text-transform: none; letter-spacing: 0; }
.meter-baseline-note {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Селекты в форме формул — общие стили, как у полей ввода */
.formula-form select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
    box-sizing: border-box;
}
.formula-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---------- Формулы производных услуг ---------- */
.formula-card-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}
.formula-card-head h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.formula-card-sub {
    font-size: 12px;
    color: var(--text-muted);
}
.formula-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.formula-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--primary-tint);
    border: 1px solid var(--primary-soft);
    border-radius: var(--radius);
}
.formula-item-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.formula-item-src {
    font-size: 13px;
    color: var(--text-muted);
}
.formula-form {
    border-top: 1px dashed var(--border);
    padding-top: 14px;
}
.formula-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 0.6fr;
    gap: 14px;
    align-items: stretch;
    margin-bottom: 12px;
}
.formula-form-grid .meter-field {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin-bottom: 0;
}
.formula-form-grid .meter-field label {
    min-height: 15px;
}
.formula-form-grid select[multiple] {
    min-height: 64px;
}

/* Аккордеон «Услуги по формуле» (свёрнут по умолчанию) */
details.formula-card summary.formula-card-head {
    cursor: pointer;
    list-style: none;
    user-select: none;
    position: relative;
    padding-right: 28px;
}
details.formula-card summary.formula-card-head::-webkit-details-marker {
    display: none;
}
details.formula-card summary.formula-card-head::after {
    content: '▾';
    position: absolute;
    top: 2px;
    right: 0;
    font-size: 14px;
    color: var(--text-muted);
    transition: transform .2s;
}
details.formula-card[open] summary.formula-card-head::after {
    transform: rotate(180deg);
}
details.formula-card summary.formula-card-head:hover h3 {
    color: var(--primary);
}

/* ---------- Блок «Показания счётчиков» (быстрый ввод + таблица) ---------- */
.meter-readings-panel {
    margin-bottom: 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow);
    padding: 20px;
}
.meter-readings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.meter-readings-head h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
}
.meter-readings-head h3 svg {
    color: var(--primary);
}
.meter-readings-period {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    padding: 4px 10px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border);
}

.meter-readings-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.meter-readings-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.3fr) minmax(100px, 0.9fr) minmax(180px, 1.4fr) minmax(90px, 0.8fr) minmax(100px, 0.9fr) minmax(110px, 1fr) 40px;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.meter-readings-row:hover {
    border-color: var(--primary-soft);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.meter-readings-name {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.meter-readings-name-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.meter-readings-name-inner svg {
    color: var(--primary);
    flex-shrink: 0;
}
.meter-readings-unit {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 500;
}
.meter-account-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}
.meter-account-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.meter-readings-empty-account {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 14px;
}
.meter-readings-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    justify-content: center;
}
.meter-readings-cell label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}
.meter-readings-cell > span {
    font-size: 13.5px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    min-height: 36px;
    display: flex;
    align-items: center;
}
.meter-readings-cell input {
    width: 100%;
    height: 36px;
    padding: 6px 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}
.meter-readings-cell input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.meter-readings-diff {
    font-weight: 600;
    color: var(--text);
}
.meter-readings-sum {
    font-weight: 700;
    font-size: 14px;
    color: var(--success, #16a34a);
}
.meter-muted { color: var(--text-muted) !important; }
.meter-zone-tag {
    display: inline-block;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    color: var(--primary);
    background: var(--primary-tint);
    padding: 3px 6px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.meter-zone-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    font-size: 13.5px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.meter-zone-line + .meter-zone-line { margin-top: 4px; }
.meter-zone-line > span { min-width: 0; }
.meter-zone-line input { flex: 1 1 auto; min-width: 0; }
.meter-readings-cell-sum {
    padding-left: 12px;
    border-left: 1px solid var(--border);
}
.meter-readings-cell-sum > span {
    padding-left: 0;
}
.meter-readings-cell-clear {
    align-items: center;
    justify-content: center;
}
.meter-clear-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    color: var(--danger, #dc2626);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.meter-clear-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.4);
    color: #ef4444;
}
.meter-readings-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}
.meter-readings-actions button {
    width: auto;
    justify-content: center;
    padding: 10px 20px;
    font-weight: 600;
}

@media (max-width: 900px) {
    .meter-readings-row {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 16px 14px;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: var(--radius, 8px);
    }
    .meter-readings-name {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border);
    }
    .meter-readings-cell {
        width: 100%;
    }
    .meter-readings-cell-zones {
        width: 100%;
    }
    .meter-readings-cell-sum {
        padding-left: 0;
        border-left: none;
        padding-top: 10px;
        border-top: 1px dashed var(--border);
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .meter-readings-cell-clear {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        padding-top: 6px;
    }
}

.formula-form-grid small {
    font-size: 11px;
    color: var(--text-muted);
}
.formula-form button {
    width: auto;
    justify-content: center;
}
@media (max-width: 768px) {
    .formula-form-grid {
        grid-template-columns: 1fr;
    }
}

.meter-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.meter-field label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}
.meter-field input {
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
.meter-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.meter-field-zone {
    padding-left: 12px;
    border-left: 2px solid var(--primary-tint);
}
.meter-form button.btn-primary { width: 100%; justify-content: center; }
.meter-history,
.meter-settings {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.meter-history summary,
.meter-settings summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    list-style: none;
    padding: 6px 0;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color .15s;
}
.meter-history summary:hover,
.meter-settings summary:hover { color: var(--primary); }
.meter-history summary::after,
.meter-settings summary::after {
    content: '▾';
    font-size: 12px;
    transition: transform .2s;
}
.meter-history[open] summary::after,
.meter-settings[open] summary::after { transform: rotate(180deg); }
.meter-history-empty {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    padding: 12px 0;
    text-align: center;
}
.meter-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 10px;
}
.meter-history-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
}
.meter-history-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}
.meter-history-table tr:last-child td { border-bottom: none; }
.meter-history-table th:last-child,
.meter-history-table td:last-child { text-align: right; width: 40px; }

.meter-modal-info {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 14px;
}
.meter-info-muted span:last-child {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}
.meter-loading,
.meter-error {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 4px 0;
}
.meter-error { color: #ef4444; }

.meter-linked-service {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.meter-linked-service strong {
    color: var(--text);
    font-weight: 600;
}
.meter-linked-service svg {
    flex-shrink: 0;
    color: var(--success);
}
.meter-linked-service-empty {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
}
.meter-linked-service-empty svg { color: #f59e0b; }

.meter-service-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
}
.meter-service-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ============================================================
   17. АНАЛИТИКА СЧЁТЧИКОВ
   ============================================================ */
.meter-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.meter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, border-color .15s;
}
.meter-tab:hover { background: var(--card); }
.meter-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.meter-tab svg { flex-shrink: 0; }

.forecast-card { border-left: 4px solid var(--primary); }
.forecast-content {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 8px 0;
}
.forecast-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: var(--primary-tint);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.forecast-icon svg { width: 36px; height: 36px; }
.forecast-text p {
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: 14px;
}
.forecast-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.mini-card {
    text-align: center;
    padding: 20px;
    margin-bottom: 0;
}
.mini-card-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 14px;
    background: var(--primary-tint);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.mini-card-icon svg { width: 28px; height: 28px; }
.mini-card-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: .5px;
    margin-bottom: 8px;
}
.mini-card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.mini-card-sub {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.anomalies-card {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.04) 0%, transparent 100%);
}
.anomalies-card h3 { color: #f59e0b; }
.anomalies-text {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 16px;
}
.anomalies-list { display: flex; flex-direction: column; gap: 8px; }
.anomaly-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 14px;
}
.anomaly-month { font-weight: 500; color: var(--text); }
.anomaly-value { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.anomaly-percent { color: #f59e0b; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Мини-спарклайн в карточке счётчика */
.meter-sparkline-wrap {
    margin: 10px 0 12px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.meter-sparkline-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.meter-sparkline-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 28px;
}

.meter-sparkline-bar {
    width: 8px;
    background: var(--border, #cbd5e1);
    border-radius: 2px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.meter-sparkline-bar:hover {
    transform: scaleY(1.15);
    background: var(--primary);
}

.meter-sparkline-bar.is-current {
    background: var(--primary);
}

/* ============================================================
   18. ПРОФИЛЬ
   ============================================================ */
.profile-card { text-align: center; }
.avatar-wrapper { margin-bottom: 16px; }
.avatar {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    object-fit: cover;
    border: 2px solid var(--border);
}
.profile-card h2 { font-size: 18px; margin-bottom: 4px; }
.username { color: var(--text-muted); font-size: 14px; margin-bottom: 8px; }
.meta { color: var(--text-muted); font-size: 12px; margin-top: 8px; }

.plan-preview {
    padding: 18px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--primary-tint) 0%, var(--card) 100%);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}
.plan-preview.plan-base { background: var(--bg); }
.plan-preview.plan-no_ads {
    background: linear-gradient(180deg, rgba(13, 59, 58, 0.08) 0%, var(--card) 100%);
    border-color: rgba(13, 59, 58, 0.3);
}
.plan-preview.plan-premium {
    background: linear-gradient(180deg, rgba(240, 160, 128, 0.1) 0%, var(--card) 100%);
    border-color: rgba(240, 160, 128, 0.3);
}
.plan-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
    flex-wrap: wrap;
}
.plan-preview-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.plan-preview-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.plan-preview-price span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}
.plan-preview-expires {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.plan-preview-btn {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

/* ============================================================
   ПРОФИЛЬ — БЛОК API
   ============================================================ */
.api-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.api-form {
    display: contents;
}

.api-btn {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    transition: background .15s, color .15s, border-color .15s;
}

/* Основная — Документация */
.api-btn-primary {
    background: var(--brand-dark);
    color: #ffffff;
    border-color: var(--brand-dark);
}
.api-btn-primary:hover {
    background: var(--brand-dark-2);
    color: #ffffff;
    border-color: var(--brand-dark-2);
}


/* Вторая — Перегенерировать */
.api-btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.api-btn-secondary:hover {
    background: var(--brand-dark);
    color: #ffffff;
    border-color: var(--brand-dark);
}


.api-btn svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    display: block;
}

/* ============================================================
   19. АДМИНКА
   ============================================================ */
.admin-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th,
.admin-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.admin-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}
.admin-table select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
}
.admin-table button,
.admin-table .btn-sm {
    margin-top: 0;
    width: auto;
    min-width: 0;
}
.admin-table-logs td[data-label="Детали"] {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card button.btn-link,
.admin-table button.btn-link {
    background: none !important;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: underline;
    min-width: 0;
    width: auto;
    height: auto;
    line-height: 1.4;
    box-shadow: none;
    cursor: pointer;
    font-family: inherit;
}
.card button.btn-link:hover,
.admin-table button.btn-link:hover {
    background: none !important;
    color: var(--primary-hover);
    text-decoration: underline;
}

.card button.status-badge,
.admin-table button.status-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    min-width: 0;
    width: auto;
    height: auto;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    line-height: 1;
    transition: background .15s;
}
.card button.status-badge:hover,
.admin-table button.status-badge:hover { background: rgba(16, 185, 129, 0.25); }
.card button.status-badge.status-blocked,
.admin-table button.status-badge.status-blocked {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}
.card button.status-badge.status-blocked:hover { background: rgba(239, 68, 68, 0.25); }

.admin-table button.btn-sm.btn-danger {
    background: #fee2e2;
    color: #991b1b;
    padding: 6px 10px;
    min-width: 0;
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
}
.admin-table button.btn-sm.btn-danger:hover { background: #fca5a5; }

.admin-table tbody tr { transition: background .15s; }
.admin-table tbody tr:hover { background: var(--row-hover); }
.admin-table tbody tr.row-self { background: var(--primary-tint); }
.admin-table tbody tr.row-self:hover { background: var(--primary-soft); }

.admin-table .inline-form-role select {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    font-family: inherit;
    cursor: pointer;
    width: auto;
    min-width: 100px;
}
.admin-table .plan-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-start;
}
.admin-table .plan-cell .btn-link { margin-top: 2px; }
.admin-table td[data-label="Статус"] { text-align: left; }
.admin-table td[data-label="Действия"] { text-align: center; }

.row-self { background: var(--primary-tint); }
.self-marker {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 4px;
}
.user-fullname {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}
.inline-form-role select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    font-family: inherit;
}

.admin-filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}
.admin-filters-wide {
    grid-template-columns: 1.5fr 1.2fr 1fr 1fr 1fr 1fr auto;
}
.filter-result {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.status-active { background: rgba(16, 185, 129, 0.15); color: #059669; }
.status-blocked { background: rgba(239, 68, 68, 0.15); color: #dc2626; }

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.role-viewer    { background: rgba(148, 163, 184, 0.15); color: #64748b; }
.role-user      { background: rgba(13, 59, 58, 0.15);    color: #0d3b3a; }
.role-moderator { background: rgba(127, 184, 168, 0.2);  color: #15524f; }
.role-admin     { background: rgba(240, 160, 128, 0.2);  color: #b04a2a; }
.role-owner {
    background: linear-gradient(135deg, #f0a080, #e88b68);
    color: white;
    box-shadow: 0 2px 8px rgba(240, 160, 128, 0.3);
}


.plan-modal-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.plan-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.plan-option:hover { border-color: var(--primary); background: var(--primary-tint); }
.plan-option input[type="radio"] { accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.plan-option:has(input[type="radio"]:checked) {
    border-color: var(--primary);
    background: var(--primary-tint);
}
.plan-option-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
}
.plan-option-price {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.modal-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================
   20. ИСТОРИЯ
   ============================================================ */
.filter-card { padding: 16px 20px; }
.filters-form {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
}
.filter-group select,
.filter-group input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
}
.filter-buttons { display: flex; gap: 8px; align-items: center; }

.history-day { margin-bottom: 28px; }
.history-day-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 12px;
    padding-left: 4px;
}
.history-day-count {
    background: var(--bg);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.history-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.history-item:has(.history-cb:checked) {
    border-color: var(--primary);
    background: var(--primary-tint);
}
.history-item:has(.history-cb:checked) .history-icon {
    background: var(--card);
    border-color: var(--primary);
}
.history-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background .15s;
}
.history-row:hover { background: var(--bg); }
.history-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 4px;
}
.history-cb {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}
.history-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    flex-shrink: 0;
}
.history-body { flex: 1; min-width: 0; }
.history-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 3px;
}
.history-title strong {
    font-weight: 600;
    color: var(--text);
}
.history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}
.history-action {
    background: var(--primary-tint);
    color: var(--primary);
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.history-action svg { width: 12px; height: 12px; }
.history-dot { opacity: 0.5; }
.history-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
.btn-toggle-details {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    min-width: 0;
    margin-top: 0;
}
.btn-toggle-details:hover { background: var(--bg); color: var(--text); }
.btn-undo {
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 13px;
    min-width: 0;
    margin-top: 0;
}
.btn-undo:hover {
    background: #d1fae5 !important;
    color: #065f46;
    border-color: #6ee7b7;
}
.history-details {
    border-top: 1px solid var(--border);
    background: var(--bg);
    padding: 12px 16px 16px;
    animation: slideDown .2s ease;
}
.details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 8px;
}
.details-table th,
.details-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.details-table th {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .3px;
    background: transparent;
}
.details-table td:last-child,
.details-table th:last-child { text-align: right; }
.details-table tr:last-child td { border-bottom: none; }
.cell-amount { font-variant-numeric: tabular-nums; font-weight: 500; }
.empty-value { color: var(--text-muted); font-style: italic; }
.cell-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    font-style: italic;
}
.details-hint {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}
.bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px;
    background: var(--primary-tint);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    animation: slideDown .2s ease;
}
.bulk-count { font-size: 13px; color: var(--text); }
.bulk-count strong { color: var(--primary); font-size: 15px; }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 13px;
    color: var(--text-muted);
}

.history-period {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 400;
}
.history-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.history-old {
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: line-through;
    text-decoration-color: rgba(148, 163, 184, 0.5);
}
.history-arrow {
    color: var(--text-muted);
    font-size: 13px;
}
.history-new {
    color: var(--primary);
    font-weight: 600;
}
.history-badge {
    display: inline-block;
    padding: 1px 8px;
    background: var(--primary-tint);
    color: var(--primary);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.history-time {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: var(--text-muted);
}

/* ============================================================
   21. ТАРИФЫ И ПОДПИСКИ
   ============================================================ */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    align-items: start;
    margin-bottom: 32px;
}
.price-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 28px 32px;
    position: relative;
    transition: transform .2s, box-shadow .2s, border-color .2s;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}
.price-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.price-card-featured {
    border-color: var(--primary);
    box-shadow: 0 8px 30px var(--primary-soft);
}
/* «Популярный» тариф — мягкое выделение, без тени: на странице тарифов
   выделенных карточек ровно две, и они не должны выглядеть одинаково */
.price-card-popular {
    border-color: var(--primary);
}
.price-badge-popular {
    background: linear-gradient(135deg, var(--brand-dark), var(--primary));
}

/* Четыре тарифа. Сетка и так на auto-fit, но четыре колонки выглядят
   ровнее, если задать их явно; карточки при этом уже, поэтому уменьшаем
   внутренние отступы и размер цены. */
@media (min-width: 1280px) {
    .pricing-grid-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 18px;
    }
    .pricing-grid-4 .price-card {
        padding: 40px 20px 28px;
    }
    .pricing-grid-4 .price-value {
        font-size: 38px;
    }
}
.price-card-current {
    border-color: var(--success);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.04), var(--card));
}
.price-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 5px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    box-shadow: 0 4px 12px var(--primary-soft);
}
.price-badge-current {
    background: var(--success);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}
.price-name {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}
.price-value {
    font-size: 44px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 32px;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.03em;
}
.price-value span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0;
}
/* Список возможностей тарифа — та же подача, что на лендинге:
   галочка/тире рисуются псевдоэлементом, иконки-спаны больше не нужны.
   Текст берётся из planFeatureList() (src/plans.php) — общий с index.php. */
.price-features { list-style: none; margin: 0 0 28px; padding: 0; flex: 1; }
.price-features li {
    padding: 10px 0 10px 26px;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    position: relative;
    line-height: 1.5;
}
.price-features li:last-child { border-bottom: none; }
.price-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 800;
}
.price-features li.feature-no {
    color: var(--text-muted);
    opacity: 0.65;
}
.price-features li.feature-no::before {
    content: '—';
    color: var(--text-muted);
    font-weight: 400;
}
.price-card .btn-primary,
.price-card .btn-secondary {
    width: 100%;
    justify-content: center;
    margin-top: auto;
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 10px;
}
.price-card .btn-secondary[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg);
    color: var(--text-muted);
}

.current-plan-card {
    position: relative;
    overflow: hidden;
    padding: 24px 28px;
    border: 1px solid var(--border);
    background: var(--card);
}
.current-plan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #94a3b8;
}
.current-plan-card.plan-free::before { background: #94a3b8; }
.current-plan-card.plan-plus::before {
    background: linear-gradient(90deg, #0d3b3a, #1a5a56);
}
.current-plan-card.plan-pro::before {
    background: linear-gradient(90deg, #f0a080, #e88b68);
}
.current-plan-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
    margin-top: 8px;
}
.current-plan-left { display: flex; flex-direction: column; gap: 6px; }
.current-plan-right h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    font-weight: 600;
}
.current-plan-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.current-plan-name {
    font-size: 24px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.current-plan-price {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.current-plan-price span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}
.current-plan-expires {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.current-plan-expires.soon {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.current-plan-expires.expired {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.current-plan-usage { padding-top: 4px; }
.current-plan-usage h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    font-weight: 600;
}
.usage-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    align-items: center;
    margin-bottom: 12px;
}
.usage-row:last-child { margin-bottom: 0; }
.usage-label { font-size: 13px; color: var(--text); }
.usage-value {
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}
.usage-infinity { color: var(--primary); font-size: 16px; font-weight: 800; }
.usage-bar {
    grid-column: 1 / -1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.usage-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width .3s ease;
}
.usage-warning .usage-bar-fill { background: #f59e0b; }
.usage-critical .usage-bar-fill { background: var(--danger); }
.current-plan-cancel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.btn-link-danger {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 6px 12px;
    font-family: inherit;
    border-radius: 6px;
    transition: color .15s, background .15s;
}
.btn-link-danger:hover { color: var(--danger); background: rgba(239, 68, 68, 0.08); }
.pricing-header { text-align: center; margin: 32px 0 24px; }
.pricing-header h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}
.pricing-header p { color: var(--text-muted); font-size: 16px; }
.plan-expires-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}
/* Информационный блок под карточками тарифов (upgrade.php).
   Раньше здесь была одна серая плашка .pricing-note с тремя строками
   мелкого текста по центру — читалось плохо. Теперь три плитки
   с иконкой, заголовком и пояснением. */
.pricing-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    max-width: 1100px;
    margin: 32px auto 0;
}
.pricing-info-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: left;
    transition: transform .2s, border-color .2s, box-shadow .2s;
}
.pricing-info-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.pricing-info-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: var(--bg);
    color: var(--text-muted);
}
.pricing-info-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.pricing-info-body strong {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
}
.pricing-info-body span {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-muted);
}
.pricing-info-body a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}
.pricing-info-body a:hover { text-decoration: underline; }

.pricing-info-card-ok { border-color: rgba(16, 185, 129, 0.28); }
.pricing-info-card-ok .pricing-info-icon {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}
.pricing-info-card-warn { border-color: rgba(245, 158, 11, 0.32); }
.pricing-info-card-warn .pricing-info-icon {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}
.pricing-info-card-info { border-color: rgba(59, 130, 246, 0.28); }
.pricing-info-card-info .pricing-info-icon {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}
html[data-theme="dark"] .pricing-info-card-warn .pricing-info-icon { color: #fbbf24; }
html[data-theme="dark"] .pricing-info-card-info .pricing-info-icon { color: #60a5fa; }

@media (max-width: 700px) {
    .pricing-info { grid-template-columns: 1fr; }
}

.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .15s;
}
.faq-item[open] { border-color: var(--primary); }
.faq-item summary {
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    list-style: none;
    position: relative;
    padding-right: 44px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '+';
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: 300;
    color: var(--text-muted);
    transition: transform .2s;
}
.faq-item[open] summary::after { content: '−'; color: var(--primary); }
.faq-item p {
    padding: 0 18px 16px;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 14px;
    margin: 0;
}

.upgrade-support {
    text-align: center;
    padding: 24px;
    font-size: 14px;
    color: var(--text-muted);
}
.upgrade-support a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.upgrade-support a:hover { text-decoration: underline; }

.pay-period-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.pay-period {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: 13px;
    position: relative;
}
.pay-period:hover { border-color: var(--primary); background: var(--primary-tint); }
.pay-period input[type="radio"] { accent-color: var(--primary); cursor: pointer; }
.pay-period:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-tint);
    font-weight: 600;
}
.pay-discount {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    color: var(--success);
    background: rgba(16, 185, 129, 0.15);
    padding: 2px 6px;
    border-radius: 6px;
}
.pay-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 14px;
}
.pay-total strong {
    font-size: 20px;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.pay-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.plan-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.plan-stat {
    display: block;
    padding: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: transform .15s, border-color .15s, box-shadow .15s;
    position: relative;
    overflow: hidden;
}
.plan-stat:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}
.plan-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.plan-stat-price { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.plan-stat-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
    color: var(--text);
}
.plan-stat-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.plan-stat-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.plan-stat-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width .4s ease;
}
.plan-stat-base    .plan-stat-bar-fill { background: #94a3b8; }
.plan-stat-no_ads  .plan-stat-bar-fill { background: #0d3b3a; }
.plan-stat-premium .plan-stat-bar-fill { background: linear-gradient(90deg, #f0a080, #e88b68); }
.plan-stat-rental  .plan-stat-bar-fill { background: linear-gradient(90deg, #0d9488, #0f766e); }

.plan-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.plan-summary-item { display: flex; flex-direction: column; gap: 4px; }
.plan-summary-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.plan-summary-value {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.plan-summary-value.value-warning { color: #f59e0b; }
.plan-summary-value.value-success { color: var(--success); }
.plan-summary-action { justify-content: flex-end; align-items: flex-end; }

.plan-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.plan-date {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.plan-date-soon { color: #f59e0b; font-weight: 600; }
.plan-date-expired { color: var(--danger); font-weight: 600; }

/* ============================================================
   22. БИЛИНГ
   ============================================================ */
.billing-active-card {
    position: relative;
    overflow: hidden;
    padding: 24px 28px;
    border: 2px solid var(--success);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.05), var(--card));
}
.billing-active-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10b981, #059669);
}
.billing-active-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: center;
    margin-top: 8px;
}
.billing-active-left { display: flex; flex-direction: column; gap: 8px; }
.billing-active-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.billing-active-badge { display: flex; align-items: center; gap: 8px; }
.billing-active-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.billing-active-price span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}
.billing-active-right { display: flex; justify-content: flex-end; }
.billing-active-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    width: 100%;
    max-width: 360px;
}
.billing-active-date { display: flex; flex-direction: column; gap: 4px; }
.billing-active-date-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.billing-active-date strong {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.billing-active-days { font-size: 12px; color: var(--text-muted); }

.billing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.billing-header h3 { margin: 0; }
.billing-table td { vertical-align: middle; }
.billing-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.billing-amount {
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.billing-period {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.billing-period-sep { color: var(--text-muted); font-size: 11px; }
.billing-table tr.row-current { background: rgba(16, 185, 129, 0.05); }
.billing-table tr.row-current:hover { background: rgba(16, 185, 129, 0.1); }
.status-refunded { background: rgba(245, 158, 11, 0.15); color: #92400e; }
.status-pending  { background: rgba(59, 130, 246, 0.15); color: #1e40af; }

.billing-info {
    max-width: 700px;
    margin: 24px auto;
    padding: 16px 20px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
}
.billing-info p {
    margin: 6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.billing-info a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.billing-info a:hover { text-decoration: underline; }

/* ============================================================
   23. АДМИН-БИЛИНГ
   ============================================================ */
.billing-id {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
}
.billing-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}
.billing-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.billing-user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.3;
}
.billing-user-login {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

.top-payers-list { display: flex; flex-direction: column; gap: 14px; }
.top-payer-row {
    display: grid;
    grid-template-columns: 32px 1fr 2fr auto;
    gap: 14px;
    align-items: center;
}
.top-payer-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.top-payer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.top-payer-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.top-payer-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.top-payer-total { text-align: right; white-space: nowrap; }
.top-payer-amount {
    font-weight: 700;
    font-size: 15px;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.top-payer-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   24. ФУТЕР
   ============================================================ */
.app-footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding: 20px 0;
    font-size: 13px;
    color: var(--text-muted);
}
.footer-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
}
.footer-copy {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.footer-links { display: flex; gap: 8px; flex-wrap: wrap; }
.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: background .15s, color .15s;
}
.footer-links a:hover { background: var(--bg); color: var(--primary); }
.footer-links a svg { flex-shrink: 0; }
.footer-links-secondary {
    border-left: 1px solid var(--border);
    padding-left: 12px;
}
.footer-links-third {
    border-left: none;
    padding-left: 0;
}
.footer-links-secondary a { color: var(--text-muted); }


.login-page .app-footer {
    margin-top: 0;
    border-top: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    padding: 15px 0;
    width: 100%;
}
.login-page .app-footer .footer-inner { justify-content: center; }
.login-page .app-footer .footer-links { display: none; }

.footer-version {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
    cursor: help;
}
.footer-version a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
}
.footer-version a:hover { opacity: 1; color: var(--primary); }

/* ============================================================
   МОБИЛЬНАЯ НИЖНЯЯ НАВИГАЦИЯ (BOTTOM NAV)
   ============================================================ */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 900px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(56px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--card);
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        z-index: 990;
        justify-content: space-around;
        align-items: center;
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        height: 100%;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 11px;
        font-weight: 500;
        transition: color var(--transition);
        padding: 4px 2px;
    }

    .mobile-nav-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
    }

    .mobile-nav-icon svg {
        width: 20px;
        height: 20px;
    }

    .mobile-nav-label {
        line-height: 1.1;
        white-space: nowrap;
    }

    .mobile-nav-item:hover,
    .mobile-nav-item:active {
        color: var(--text);
    }

    .mobile-nav-item.active {
        color: var(--primary);
        font-weight: 600;
    }

    /* Отступ для контента снизу, чтобы не перекрывался баром */
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }
}


/* ============================================================
   25. ПОЛИТИКА
   ============================================================ */
/* Ширина — 1240px: у блока сайта есть только два размера (широкий — во весь
   контейнер 1600px, узкий — ровно 1240px), промежуточных быть не должно.
   Так же сделано у блоков лэндинга (см. PLAN.md, «Две ширины»). */
.privacy-doc {
    max-width: 1240px;
    margin: 24px auto;
    padding: 40px 48px;
    line-height: 1.7;
    flex: 1 0 auto;
}
.privacy-header {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.privacy-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.privacy-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}
.privacy-section { margin-bottom: 28px; }
.privacy-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    margin-top: 8px;
}
.privacy-section p { margin-bottom: 12px; color: var(--text); }
.privacy-section ul { margin: 12px 0 16px 0; padding-left: 22px; color: var(--text); }
.privacy-section li { margin-bottom: 8px; line-height: 1.6; }
.privacy-section strong { color: var(--text); font-weight: 600; }
.privacy-section a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.privacy-section a:hover { text-decoration: underline; }
.privacy-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0 20px;
}
.privacy-footer-note {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
}
.doc-back {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   26. DANGER ZONE
   ============================================================ */
.danger-zone {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.03) 0%, transparent 100%);
    position: relative;
}
.danger-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ef4444, #f87171);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.danger-zone h3 { color: #ef4444; margin-bottom: 16px; }
.danger-zone-text {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 12px;
}
.danger-zone-text:last-of-type { margin-bottom: 24px; }
.danger-zone-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.danger-zone-link:hover { text-decoration: underline; }

.btn-delete-account {
    padding: 12px 24px;
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-delete-account:hover {
    background: #ef4444;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}
.btn-delete-account:active { transform: translateY(0); }

.delete-confirm-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 12px 0 4px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    cursor: pointer;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 8px;
}
.delete-confirm-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: #ef4444;
    flex-shrink: 0;
    cursor: pointer;
}

/* ============================================================
   27. ГОРЯЧИЕ КЛАВИШИ
   ============================================================ */
.hotkeys-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 16px 0;
}
.hotkeys-section h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}
.hotkey-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
}
.hotkey-row span { color: var(--text-muted); margin-left: 8px; }
kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    min-width: 28px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}


/* ============================================================
   28. ИКОНКИ SVG
   ============================================================ */
.btn-primary svg,
.btn-secondary svg,
.card button svg,
.user-badge svg,
.btn-theme svg,
.btn-logout svg,
.btn-delete-service svg,
.btn-undo svg,
.note-icon svg,
.history-icon svg,
button svg,
a.btn-secondary svg,
.btn-danger-outline svg {
    vertical-align: middle;
    flex-shrink: 0;
}
.btn-primary svg:not(:only-child),
.btn-secondary svg:not(:only-child),
.card button svg:not(:only-child),
.btn-danger-outline svg:not(:only-child) {
    margin-right: 4px;
    margin-top: -2px;
}
.user-badge svg,
.btn-theme svg,
.btn-logout svg {
    display: block;
    margin: 0;
}
.btn-delete-service svg,
.btn-toggle-details svg,
.btn-undo svg {
    margin: 0;
    vertical-align: middle;
}
.history-icon svg { color: var(--primary); }
.btn-toggle-details .arrow {
    display: inline-flex;
    transition: transform .2s;
}
.btn-toggle-details .arrow svg { transition: transform .2s; }
.btn-toggle-details .arrow.rotated svg { transform: rotate(180deg); }

/* ============================================================
   29. МЕДИАЗАПРОСЫ
   ============================================================ */
@media (min-width: 601px) and (max-width: 768px) {
    .monthly-table { font-size: 13px; }
    .monthly-table th,
    .monthly-table td { padding: 10px 6px; }
}

@media (max-width: 768px) {
    :root {
        --header-height: 145px;
        --content-padding: 12px;
    }

    .card { padding: 16px 12px; }
    .toolbar { padding: 10px; gap: 8px; }
    .profile-grid { padding: 12px 12px 16px; }
    .login-container { padding: 24px; }
    .export-buttons { flex-wrap: wrap; }

    .header-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 14px;
        gap: 12px;
    }
    .brand {
        justify-content: flex-start;
        padding-bottom: 4px;
        border-bottom: none;
        gap: 8px;
    }
    .logo-icon-img { height: 44px; }
    .logo-text-img { height: 60px; max-width: 140px; }
    .user-menu {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 8px;
        width: 100%;
        padding-top: 10px;
        border-top: 1px solid var(--border);
    }
    .user-menu > * {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 44px;
        padding: 0;
        margin: 0;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 10px;
        text-decoration: none;
        color: var(--text);
        transition: background .15s, transform .1s;
    }
    .user-menu > *:active { transform: scale(0.96); }
    .user-menu > *:hover { background: var(--card); }
    .user-badge img { width: 26px; height: 26px; border-width: 1px; padding: 2px; }
    .user-badge span { display: none; }
    .owner-mode-switch {
        display: inline-flex;
        width: 100%;
        height: 44px;
        padding: 0;
        margin: 0;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 10px;
        overflow: hidden;
    }
    .owner-mode-switch .owner-mode-btn {
        flex: 1 1 50%;
        height: 100%;
        padding: 0;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        border: none;
        border-radius: 0;
    }
    .owner-mode-switch .owner-mode-btn + .owner-mode-btn {
        border-left: 1px solid var(--border);
    }
    .owner-mode-switch .owner-mode-text {
        display: none;
    }
    .owner-mode-switch .owner-mode-icon svg {
        width: 18px;
        height: 18px;
    }
    .btn-logout {
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--danger);
    }

    .plan-badge-btn { padding: 4px 10px; font-size: 10px; min-height: 28px; }
    .plan-badge-days { font-size: 8px; }
    .role-crown { font-size: 12px; }
    .plan-usage-inner { padding: 10px 14px; gap: 12px; }
    .plan-usage-cta { margin-left: 0; width: 100%; justify-content: center; }
    .plan-expire-banner {
        top: auto;
        bottom: 12px;
        left: 12px;
        right: 12px;
        transform: none;
        font-size: 13px;
        padding: 10px 14px;
        gap: 10px;
    }
    .plan-expire-cta { padding: 5px 10px; font-size: 12px; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-value { font-size: 18px; }

    .chart-card { padding: 16px 12px 20px; min-height: 420px; }
    .chart-container { height: 380px; margin-top: 16px; }
    .revenue-chart-header { flex-direction: column; align-items: stretch; }
    .revenue-chart-controls { justify-content: space-between; }
    .revenue-quick-stats { grid-template-columns: 1fr 1fr; }
    .revenue-quick-value { font-size: 16px; }

    .top-service-row {
        grid-template-columns: 28px 1fr auto;
        grid-template-areas:
            "rank name total"
            "rank bar bar";
        gap: 8px;
    }
    .top-service-rank { grid-area: rank; }
    .top-service-name { grid-area: name; }
    .top-service-bar { grid-area: bar; }
    .top-service-total { grid-area: total; }

    .btn-delete-service { opacity: 0.4; }
    .actions-col,
    .actions-cell { width: 40px; min-width: 40px; max-width: 40px; }
    thead th.sticky-col,
    td.sticky-col { position: sticky; left: 0; }

    .cell-form input[type="number"] {
        font-size: 11px;
        padding: 6px 1px;
        min-width: 60px;
    }
    .cell { min-width: 65px; }
    .row-total,
    .grand-total { min-width: 80px; padding: 6px; font-size: 12px; }
    .total-row td { min-width: 65px; padding: 10px 4px; font-size: 12px; }
    .year-total-col { min-width: 85px; }
    .btn-primary svg,
    .btn-secondary svg { width: 14px; height: 14px; }
    .cell-form input[type="number"].saved,
    .cell-form input[type="number"].save-error { animation-duration: 0.3s; }

    .copy-row { grid-template-columns: 1fr; }
    .copy-services-list { max-height: 200px; }

    .filters-form { grid-template-columns: 1fr; }
    .filter-buttons { flex-direction: row; }
    .filter-buttons > * { flex: 1; }
    .bulk-actions { flex-wrap: wrap; width: 100%; padding: 8px 12px; }
    .bulk-actions > button { flex: 1; font-size: 12px; padding: 6px 8px; }
    .bulk-count { width: 100%; font-size: 12px; }

    .app-footer { margin-top: 24px; padding: 16px 0; }
    .footer-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 0 12px;
    }
    .footer-links { justify-content: center; }
    .footer-links a { padding: 6px 10px; font-size: 12px; }
    .footer-links a span { display: none; }
    .footer-links-secondary {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--border);
        padding-top: 12px;
        width: 100%;
        justify-content: center;
    }
    .footer-links-third {
        border-top: none;
        padding-top: 0;
    }
    .footer-copy { justify-content: center; flex-direction: column; gap: 2px; }
    .footer-version { margin-left: 0; }

    .privacy-doc { padding: 24px 20px; margin: 12px; }
    .privacy-header h1 { font-size: 22px; }
    .privacy-section h2 { font-size: 16px; }
    .privacy-section ul { padding-left: 18px; }
    .page-nav-narrow { padding: 12px 20px 0; }
    .page-nav { gap: 8px; }
    .page-nav .btn-secondary,
    .page-nav button {
        flex: 1 1 auto;
        justify-content: center;
    }
    .doc-back { margin-bottom: 16px; }

    .empty-state { padding: 40px 16px; }
    .empty-state-icon { width: 60px; height: 60px; }
    .empty-state-icon svg { width: 28px; height: 28px; }
    .empty-state-title { font-size: 16px; }
    .empty-state-text { font-size: 13px; }

    .pricing-grid { grid-template-columns: 1fr; gap: 32px; }
    .price-card { padding: 32px 20px 24px; }
    .price-value { font-size: 36px; margin-bottom: 24px; }
    .price-features li { font-size: 13px; padding: 8px 0; }
    .current-plan-card { padding: 18px 16px; }
    .current-plan-layout { grid-template-columns: 1fr; gap: 20px; }
    .current-plan-price { font-size: 26px; }
    .pricing-header h1 { font-size: 24px; }
    .pricing-header p { font-size: 14px; }
    .pay-period-options { grid-template-columns: 1fr; }

    .admin-filters { grid-template-columns: 1fr; }
    .admin-filters-wide { grid-template-columns: 1fr; }
    .plan-stats-grid { grid-template-columns: 1fr; }
    .plan-stat-value { font-size: 24px; }
    .plan-summary { grid-template-columns: 1fr 1fr; }
    .plan-summary-action {
        grid-column: 1 / -1;
        justify-content: stretch;
        align-items: stretch;
    }
    .plan-summary-action button { width: 100%; justify-content: center; }
    .btn-delete-account { width: 100%; justify-content: center; }

    .import-row { grid-template-columns: 1fr; }
    .import-actions { flex-direction: column-reverse; }
    .import-actions button { width: 100%; }
    .preview-table-wrapper { max-height: 400px; }

    .meters-grid { grid-template-columns: 1fr; }
    .meter-card { padding: 20px 16px; }
    .meter-title h3 { font-size: 16px; }
    .forecast-content { flex-direction: column; text-align: center; }
    .forecast-value { font-size: 24px; }
    .anomaly-item { grid-template-columns: 1fr auto; gap: 8px; }
    .anomaly-value { grid-column: 1 / -1; font-size: 13px; text-align: left; }
    .meter-tabs { width: 100%; }

    .hotkey-row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .hotkey-row span { margin-left: 0; font-size: 13px; }

    .billing-active-card { padding: 18px 16px; }
    .billing-active-inner { grid-template-columns: 1fr; gap: 20px; }
    .billing-active-right { justify-content: flex-start; }
    .billing-active-dates { max-width: 100%; }
    .billing-active-price { font-size: 24px; }
    .billing-header { flex-direction: column; align-items: stretch; }
    .billing-header .btn-secondary { justify-content: center; }
    .billing-table thead { display: none; }
    .billing-table tbody,
    .billing-table tr,
    .billing-table td { display: block; }
    .billing-table tr,
    .billing-table tr:nth-child(odd),
    .billing-table tr:nth-child(even) {
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 14px 16px;
    }
    .billing-table tr:last-child { margin-bottom: 0; }
    .billing-table tr.row-current {
        border-color: var(--success);
        border-left-width: 4px;
    }
    .billing-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 6px 0;
        border: none;
        text-align: right;
    }
    .billing-table td + td { border-top: 1px dashed var(--border); }
    .billing-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: .4px;
        flex-shrink: 0;
        text-align: left;
        min-width: 90px;
        padding-top: 2px;
    }
    .billing-table .billing-period { justify-content: flex-end; }

    .top-payer-row {
        grid-template-columns: 28px 1fr auto;
        grid-template-areas:
            "rank user total"
            "rank bar bar";
        gap: 8px;
    }
    .top-payer-row .top-service-rank { grid-area: rank; }
    .top-payer-user { grid-area: user; }
    .top-payer-row .top-service-bar { grid-area: bar; }
    .top-payer-total { grid-area: total; }
}

@media (max-width: 600px) {
    .monthly-block { overflow-x: hidden; width: 100%; }
    .monthly-table,
    .monthly-table thead,
    .monthly-table tbody,
    .monthly-table tfoot { display: block; width: 100%; }
    .monthly-table thead { display: none; }
    .monthly-table tr {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "month total"
            "delta delta";
        gap: 4px 12px;
        align-items: center;
        width: 100%;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 12px 14px;
    }
    .monthly-table tr:last-child { margin-bottom: 0; }
    .monthly-table td {
        display: block;
        width: auto !important;
        padding: 0;
        border: none;
        text-align: left;
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
    }
    .monthly-table td:nth-child(1) { grid-area: month; font-size: 15px; font-weight: 600; }
    .monthly-table td:nth-child(2) { grid-area: total; font-size: 15px; font-weight: 600; color: var(--primary); text-align: right; }
    .monthly-table td:nth-child(3) { grid-area: delta; font-size: 12px; text-align: right; opacity: 0.85; }
    .monthly-table tfoot tr { background: var(--head-bg); border: 2px solid var(--primary); }
    .monthly-table tfoot tr td:nth-child(1) { font-size: 16px; color: var(--primary); }
    .monthly-table tfoot tr td:nth-child(2) { font-size: 16px; }

    .history-row { flex-wrap: wrap; gap: 10px; padding: 12px; }
    .history-icon { width: 36px; height: 36px; }
    .history-body { flex: 1 1 calc(100% - 50px); }
    .history-title { font-size: 13px; }
    .history-meta { font-size: 11px; }
    .history-actions { width: 100%; justify-content: flex-end; }
    .btn-undo { flex: 1; }
    .btn-toggle-details { flex-shrink: 0; }
    .details-table th,
    .details-table td { padding: 6px 8px; font-size: 12px; }
    .pagination { flex-wrap: wrap; gap: 10px; }

    .admin-table-logs { display: block; width: 100%; padding: 0; margin: 0; }
    .admin-table-logs thead { display: none; }
    .admin-table-logs tbody { display: block; width: 100%; padding: 0; margin: 0; }
    .admin-table-logs tr,
    .admin-table-logs tr:nth-child(odd),
    .admin-table-logs tr:nth-child(even) {
        display: block;
        width: 100%;
        background: var(--log-card-bg);
        border: 1px solid var(--border);
        border-left: 4px solid var(--log-card-accent);
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 14px 16px;
        box-sizing: border-box;
    }
    .admin-table-logs tr:last-child { margin-bottom: 0; }
    .admin-table-logs td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 16px;
        padding: 6px 0;
        border: none;
        white-space: normal;
        word-break: break-word;
        font-size: 13px;
        line-height: 1.4;
        max-width: 100%;
        text-align: right;
        box-sizing: border-box;
    }
    .admin-table-logs td + td { border-top: 1px dashed var(--border); }
    .admin-table-logs td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: .4px;
        flex-shrink: 0;
        min-width: 90px;
        text-align: left;
        padding-top: 1px;
    }
    .admin-table-logs td[data-label="Детали"] { max-width: 100%; overflow: visible; text-overflow: clip; }

    .admin-table-users thead { display: none; }
    .admin-table-users tbody,
    .admin-table-users tr,
    .admin-table-users td { display: block; }
    .admin-table-users tr,
    .admin-table-users tr:nth-child(odd),
    .admin-table-users tr:nth-child(even) {
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 14px 16px;
    }
    .admin-table-users td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 6px 0;
        border: none;
        text-align: right;
        white-space: normal;
        background: transparent !important;
    }
    .admin-table-users td + td { border-top: 1px dashed var(--border); }
    .admin-table-users td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: .4px;
        flex-shrink: 0;
        text-align: left;
    }
    .plan-cell { align-items: flex-end; }
}

@media (max-width: 480px) {
    .chart-container { height: 360px; }
    #expensesChart { font-size: 9px; }
}

/* ============================================================
   УПРАВЛЕНИЕ РОЛЯМИ
   ============================================================ */
.roles-info {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 12px;
}
.roles-info:last-child { margin-bottom: 0; }
.roles-info code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    color: var(--text);
}
.role-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.role-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    transition: all .15s;
}
.role-tab:hover { border-color: var(--primary); background: var(--bg); }
.role-tab.active { border-color: var(--primary); background: var(--primary-tint); }
.role-tab-count {
    background: var(--bg);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.role-tab.active .role-tab-count { background: var(--primary); color: white; }

.roles-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.roles-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.roles-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}
.permission-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin: 0;
}
.permission-item:hover { border-color: var(--primary); background: var(--primary-tint); }
.permission-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.permission-item:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); }
.permission-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}
.permission-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.3;
}
.permission-key {
    font-family: monospace;
    font-size: 10px;
    color: var(--text-muted);
    background: transparent;
    padding: 0;
    line-height: 1.2;
    word-break: break-all;
}
.role-form-actions {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.role-form-actions .btn-primary { min-width: 160px; }
.role-form-actions .btn-secondary { min-width: 200px; }

.matrix-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.permissions-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.permissions-matrix th,
.permissions-matrix td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
}
.permissions-matrix thead th {
    background: var(--bg);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .3px;
    position: sticky;
    top: 0;
    z-index: 2;
}
.permissions-matrix .matrix-perm-col {
    text-align: left;
    min-width: 220px;
    background: var(--card);
    position: sticky;
    left: 0;
    z-index: 1;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
}
.permissions-matrix thead .matrix-perm-col { z-index: 3; background: var(--bg); }
.permissions-matrix .matrix-role-col { min-width: 110px; }
.permissions-matrix tbody tr:hover td { background: var(--row-hover); }
.permissions-matrix tbody tr:hover .matrix-perm-col { background: var(--row-hover); }
.matrix-perm-label {
    font-weight: 500;
    color: var(--text);
    font-size: 13px;
    margin-bottom: 2px;
}
.matrix-perm-key {
    font-family: monospace;
    font-size: 10px;
    color: var(--text-muted);
    background: transparent;
    padding: 0;
}
.matrix-yes {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}
.matrix-no { color: var(--text-muted); opacity: 0.4; font-size: 16px; }


/* ============================================================
   БАННЕР «СЕРВИС В РАЗРАБОТКЕ»
   ============================================================ */
/* Фон непрозрачный: см. пояснение в landing.css — полупрозрачная плашка
   теряла контраст над цветными секциями. */
.dev-banner {
    background: #fdf1d8;
    border-bottom: 1px solid rgba(180, 83, 9, 0.30);
    font-size: 13px;
    line-height: 1.45;
    color: #6b4406;
}
.dev-banner-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dev-banner-inner svg {
    flex-shrink: 0;
    color: #b45309;
}

/* ============================================================
   БАННЕР ПОДТВЕРЖДЕНИЯ EMAIL
   ============================================================ */
.email-verify-banner {
    background: linear-gradient(135deg, rgba(13, 59, 58, 0.06), rgba(240, 160, 128, 0.06));
    border-bottom: 1px solid rgba(240, 160, 128, 0.3);
    animation: slideDown .3s ease;
}
.email-verify-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.email-verify-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-tint);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.email-verify-text {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    line-height: 1.4;
}
.email-verify-text strong { color: var(--text); font-weight: 700; font-size: 14px; }
.email-verify-text span { color: var(--text-muted); }
.email-verify-text em { font-style: normal; font-weight: 600; color: var(--text); }
.email-verify-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.email-verify-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, transform .1s;
    min-width: 0;
    width: auto;
    margin-top: 0;
}
.email-verify-btn:hover { background: var(--primary-hover); }
.email-verify-btn:active { transform: scale(0.97); }
.email-verify-btn:disabled { opacity: 0.7; cursor: wait; }
.email-verify-btn-success { background: var(--success) !important; }
.email-verify-close {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    margin-top: 0;
    min-width: 0;
}
.email-verify-close:hover { background: var(--bg); color: var(--text); }

@media (max-width: 768px) {
    .permissions-grid { grid-template-columns: 1fr; }
    .roles-header { flex-direction: column; align-items: stretch; }
    .roles-actions > * { flex: 1; justify-content: center; }
    .role-form-actions { flex-direction: column-reverse; }
    .role-form-actions > * { width: 100%; justify-content: center; }
    .permissions-matrix .matrix-perm-col { min-width: 160px; }
    .permissions-matrix .matrix-role-col { min-width: 80px; padding: 8px 6px; }
    .permissions-matrix thead th { font-size: 10px; }
    .matrix-perm-label { font-size: 12px; }
    .email-verify-inner { padding: 12px 14px; gap: 10px; align-items: flex-start; }
    .email-verify-icon { width: 32px; height: 32px; }
    .email-verify-icon svg { width: 16px; height: 16px; }
    .email-verify-text { font-size: 12px; min-width: 0; flex: 1 1 100%; }
    .email-verify-text strong { font-size: 13px; }
    .email-verify-actions { width: 100%; justify-content: space-between; }
    .email-verify-btn { flex: 1; padding: 10px 14px; }
    .email-verify-close { width: 36px; height: 36px; }
}

/* ============================================================
   ЗАБЫЛИ ПАРОЛЬ
   ============================================================ */
.forgot-password-row {
    text-align: right;
    margin: -4px 0 4px;
    padding-right: 4px;
}
.forgot-password-link {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color .15s;
}
.forgot-password-link:hover { color: var(--primary-hover); text-decoration: underline; }

/* ============================================================
   ИКОНКИ ТАРИФОВ
   ============================================================ */
.plan-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1;
}
.plan-icon svg { display: block; }
.plan-icon-plan_premium svg,
.plan-icon-premium svg { filter: drop-shadow(0 1px 3px rgba(240, 160, 128, 0.4)); }
.plan-icon-no_ads svg { filter: drop-shadow(0 1px 3px rgba(13, 59, 58, 0.4)); }
.plan-badge-btn .plan-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    vertical-align: middle;
}
.plan-badge-btn .plan-badge-icon svg { display: block; width: 14px; height: 14px; }
.plan-preview-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}
.plan-preview-icon svg { display: block; }

#addMeterModal .modal-content select,
#editMeterModal .modal-content select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: 
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: 
        calc(100% - 18px) center,
        calc(100% - 13px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 36px;
}
#addMeterModal .modal-content select:focus,
#editMeterModal .modal-content select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ============================================================
   ТОСТЫ
   ============================================================ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 40px);
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    line-height: 1.4;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity .3s ease, transform .3s cubic-bezier(.16, 1, .3, 1);
    max-width: 100%;
    word-break: break-word;
}
.toast.toast-show { opacity: 1; transform: translateX(0); }
.toast.toast-hiding { opacity: 0; transform: translateX(100%); }
.toast.toast-success { border-left-color: #10b981; }
.toast.toast-error { border-left-color: #ef4444; }
.toast.toast-warning { border-left-color: #f59e0b; }
.toast.toast-info { border-left-color: var(--primary); }
.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}
.toast-success .toast-icon { color: #10b981; }
.toast-error .toast-icon   { color: #ef4444; }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info .toast-icon    { color: var(--primary); }
.toast-text { flex: 1; min-width: 0; }
.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity .15s;
    border-radius: 4px;
    margin-top: 1px;
}
.toast-close:hover { opacity: 1; }

@media (max-width: 600px) {
    .toast-container {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
        max-width: none;
        width: auto;
    }
    .toast { transform: translateY(100%); }
    .toast.toast-show { transform: translateY(0); }
    .toast.toast-hiding { transform: translateY(100%); }
}

/* Форма добавления счёта — inline */
.inline-form input[type="text"] {
    flex: 1 1 200px;
    width: auto;
    min-width: 150px;
}
.inline-form input[type="color"] { flex-shrink: 0; }
.inline-form button { flex-shrink: 0; }

/* ============================================================
   СКЕЛЕТОНЫ ЗАГРУЗКИ ГРАФИКОВ
   ============================================================ */
.chart-skeleton {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 8px;
    padding: 30px 20px 40px;
    pointer-events: none;
    opacity: 1;
    transition: opacity .3s ease;
}
.chart-skeleton.chart-skeleton-hiding { opacity: 0; }
.chart-skeleton-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--primary-soft) 0%, var(--border) 100%);
    border-radius: 6px 6px 0 0;
    animation: skeleton-pulse 1.6s ease-in-out infinite;
    min-width: 8px;
    max-width: 60px;
}
.chart-skeleton-bar:nth-child(1)  { height: 45%; animation-delay: 0s; }
.chart-skeleton-bar:nth-child(2)  { height: 62%; animation-delay: .08s; }
.chart-skeleton-bar:nth-child(3)  { height: 38%; animation-delay: .16s; }
.chart-skeleton-bar:nth-child(4)  { height: 78%; animation-delay: .24s; }
.chart-skeleton-bar:nth-child(5)  { height: 55%; animation-delay: .32s; }
.chart-skeleton-bar:nth-child(6)  { height: 82%; animation-delay: .40s; }
.chart-skeleton-bar:nth-child(7)  { height: 47%; animation-delay: .48s; }
.chart-skeleton-bar:nth-child(8)  { height: 68%; animation-delay: .56s; }
.chart-skeleton-bar:nth-child(9)  { height: 41%; animation-delay: .64s; }
.chart-skeleton-bar:nth-child(10) { height: 74%; animation-delay: .72s; }
.chart-skeleton-bar:nth-child(11) { height: 59%; animation-delay: .80s; }
.chart-skeleton-bar:nth-child(12) { height: 66%; animation-delay: .88s; }

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 0.9; }
}
.chart-container { position: relative; }

/* ============================================================
   CHANGELOG
   ============================================================ */
/* Ширина — 1240px, как у .privacy-doc и узких блоков лэндинга: два размера
   блока, широкий (контейнер 1600px) и узкий (1240px). */
.changelog-doc {
    max-width: 1240px;
    margin: 24px auto;
    padding: 40px 48px;
    flex: 1 0 auto;
}
.changelog-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border);
}
.changelog-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.changelog-header h1 svg { color: var(--primary); flex-shrink: 0; }
.changelog-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
}
.changelog-subtitle strong { color: var(--primary); font-weight: 700; }
.changelog-owner-note {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--primary-tint);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 20px;
}
.changelog-owner-note svg { color: var(--primary); flex-shrink: 0; }
.changelog-owner-note a { color: var(--primary); font-weight: 600; text-decoration: none; }
.changelog-owner-note a:hover { text-decoration: underline; }
.changelog-owner-note strong { color: var(--text); }
.changelog-release {
    margin-bottom: 40px;
    padding: 24px;
    background: var(--bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    position: relative;
    transition: border-color .15s;
}
.changelog-release-current {
    border-color: var(--primary);
    background: linear-gradient(180deg, var(--primary-tint) 0%, var(--bg) 40%);
}
.changelog-release-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
    flex-wrap: wrap;
}
.changelog-version-row { display: flex; align-items: center; gap: 10px; }
.changelog-version {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.changelog-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.changelog-badge-current { background: var(--primary); color: white; }
.changelog-date {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.changelog-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 20px;
}
.changelog-changes { display: flex; flex-direction: column; gap: 20px; }
.changelog-group h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.changelog-group h3 svg { flex-shrink: 0; }
.changelog-group-added h3   { color: #10b981; }
.changelog-group-fixed h3   { color: #3b82f6; }
.changelog-group-changed h3 { color: #f59e0b; }
.changelog-group-removed h3 { color: #ef4444; }
.changelog-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.changelog-group li {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    padding-left: 20px;
    position: relative;
}
.changelog-group li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
}
.changelog-group-added li::before   { background: #10b981; opacity: 0.7; }
.changelog-group-fixed li::before   { background: #3b82f6; opacity: 0.7; }
.changelog-group-changed li::before { background: #f59e0b; opacity: 0.7; }
.changelog-group-removed li::before { background: #ef4444; opacity: 0.7; }
.changelog-footer {
    margin-top: 40px;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.changelog-footer svg { flex-shrink: 0; }
.changelog-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.changelog-footer a:hover { text-decoration: underline; }

@media (max-width: 768px) {
    .changelog-doc { padding: 24px 20px; margin: 12px; }
    .changelog-header h1 { font-size: 22px; }
    .changelog-header h1 svg { width: 22px; height: 22px; }
    .changelog-release { padding: 18px 16px; }
    .changelog-version { font-size: 18px; }
    .changelog-title { font-size: 15px; }
    .changelog-group li { font-size: 13px; }
}

/* ============================================================
   РЕГУЛЯРНЫЕ ПЛАТЕЖИ
   ============================================================ */
.recurring-list { display: flex; flex-direction: column; gap: 10px; }
.recurring-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    transition: border-color .15s, opacity .15s;
}
.recurring-item:hover { border-color: var(--primary); }
.recurring-item-inactive { opacity: 0.55; }
.recurring-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.recurring-item-color {
    width: 4px;
    height: 36px;
    border-radius: 2px;
    flex-shrink: 0;
}
.recurring-item-info { flex: 1; min-width: 0; }
.recurring-item-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.recurring-item-name small {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 13px;
}
.recurring-item-period { font-size: 12px; color: var(--text-muted); }
.recurring-item-period em { font-style: normal; color: var(--text); font-weight: 500; }
.recurring-item-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.recurring-item-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}
.recurring-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    max-height: 240px;
    overflow-y: auto;
}
.recurring-checkbox-all {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 13px;
}
.recurring-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background .1s;
}
.recurring-checkbox:hover { background: var(--card); }
.recurring-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.recurring-overwrite {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}
.recurring-overwrite input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}


.recurring-item-warning {
    border-color: rgba(245, 158, 11, 0.4);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.05) 0%, var(--bg) 50%);
}
.recurring-item-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    vertical-align: middle;
}

.recurring-item-hint {
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.recurring-service-select,
.recurring-select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
    transition: border-color .15s, box-shadow .15s;
    line-height: 1.4;
    min-height: 44px;
}

.recurring-service-select:hover,
.recurring-select:hover { border-color: var(--primary); }
.recurring-service-select:focus,
.recurring-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.recurring-service-select optgroup,
.recurring-select optgroup {
    background: var(--card);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 0;
    font-style: normal;
}
.recurring-service-select option,
.recurring-select option {
    background: var(--card);
    color: var(--text);
    font-size: 14px;
    padding: 8px 12px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}
.recurring-service-select option:disabled,
.recurring-select option:disabled {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.5;
}
@media (max-width: 600px) {
    .recurring-item-main { flex-wrap: wrap; }
    .recurring-item-amount { font-size: 16px; }
    .recurring-item-actions { flex-direction: column; }
    .recurring-item-actions button,
    .recurring-item-actions form { width: 100%; }
    .recurring-item-actions .btn-sm { width: 100%; justify-content: center; }
    .recurring-select { font-size: 16px; padding: 12px 36px 12px 14px; }
}

/* ============================================================
   ПРОСТОЙ РЕЖИМ
   ============================================================ */
body.simple-mode [data-simple-hide] { display: none !important; }
body.simple-mode .container { padding-top: 8px; }
body.simple-mode .table-wrapper { max-height: calc(100vh - 180px); }
body.simple-mode .toolbar-stacked {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 12px;
    gap: 6px;
}
/* В простом режиме все три строки схлопываются в одну — лишние элементы скрыты */
body.simple-mode .toolbar-row { display: contents; }
body.simple-mode .toolbar-row-main > a,
body.simple-mode .toolbar-row-tools > a.btn-secondary,
body.simple-mode .toolbar-row-tools > button.btn-secondary,
body.simple-mode .toolbar-row-tools > .inline-form-undo {
    flex: 0 1 auto;
    max-width: none;
}
body.simple-mode .toolbar-tools-icons { margin-left: auto; }
body.simple-mode .toolbar-divider { display: none; }
body.simple-mode .cell-form input[type="number"] { font-size: 14px; padding: 8px 4px; }
body.simple-mode thead th { font-size: 13px; }
body.simple-mode .total-row td { padding: 14px 8px; font-size: 14px; }
body.simple-mode .grand-total { font-size: 16px; }
#simpleModeToggle.active {
    background: var(--primary-tint);
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================================
   СТРАНИЦА ПОМОЩИ (help.php)
   ============================================================ */
.help-header {
    text-align: center;
    margin-bottom: 32px;
    padding: 20px 0;
}

.help-header h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text);
}

.help-header h1 svg {
    color: var(--primary);
    flex-shrink: 0;
}

.help-header p {
    color: var(--text-muted);
    font-size: 16px;
}

/* Оглавление */
.help-toc {
    margin-bottom: 40px;
}

.help-toc h3 {
    margin-bottom: 16px;
    font-size: 16px;
}

.help-toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.help-toc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, border-color .15s, transform .1s;
}

.help-toc-item:hover {
    background: var(--primary-tint);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateX(2px);
}

.help-toc-item svg {
    color: var(--primary);
    flex-shrink: 0;
}

/* Раздел */
.help-section {
    margin-bottom: 40px;
    scroll-margin-top: 80px;
}

.help-section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.help-section-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-tint);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.help-section-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}

/* Пункты */
.help-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.help-item {
    padding: 20px 24px;
    background: var(--bg);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
    transition: background .15s;
}

.help-item:hover {
    background: var(--primary-tint);
}

.help-item h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.help-item p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
}

/* Поддержка */
.help-support {
    text-align: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, var(--primary-tint) 0%, var(--card) 100%);
}

.help-support h3 {
    justify-content: center;
    font-size: 18px;
    margin-bottom: 8px;
}

.help-support p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Мобильная версия */


/* ============================================================
   СКРЫТЫЕ УСЛУГИ
   ============================================================ */

/* Кнопка «Скрыть» в строке услуги */
.btn-hide-service {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    opacity: 0.15;
    transition: opacity var(--transition), background var(--transition), transform .1s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    min-width: 0;
    width: auto;
    margin-top: 0;
    margin-right: 4px;
}
tbody tr:hover .btn-hide-service { opacity: 0.5; }
.btn-hide-service:hover { 
    opacity: 1 !important; 
    background: var(--primary-tint); 
    color: var(--primary); 
}
.btn-hide-service:active { transform: scale(0.9); }

/* Панель скрытых услуг */
.hidden-services {
    margin-top: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0;
    overflow: hidden;
}
.hidden-services summary {
    padding: 14px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background .15s, color .15s;
    user-select: none;
}
.hidden-services summary::-webkit-details-marker { display: none; }
.hidden-services summary::after {
    content: '▾';
    margin-left: auto;
    font-size: 12px;
    transition: transform .2s;
}
.hidden-services[open] summary::after { transform: rotate(180deg); }
.hidden-services summary:hover {
    background: var(--bg);
    color: var(--text);
}
.hidden-services summary svg { 
    color: var(--text-muted); 
    flex-shrink: 0;
}
.hidden-services-count {
    background: var(--bg);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.hidden-services-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
}
.hidden-service-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px dashed var(--border);
}
.hidden-service-item:last-child { border-bottom: none; }
.hidden-service-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hidden-service-item form { margin: 0; flex-shrink: 0; }
.hidden-service-item .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 6px 12px;
}

/* Мобильная версия */


/* ============================================================
   МОДАЛКА СКРЫТИЯ УСЛУГИ
   ============================================================ */
.hide-service-info {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    background: var(--primary-tint);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    margin-bottom: 16px;
    align-items: flex-start;
}
.hide-service-info-icon {
    flex-shrink: 0;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}
.hide-service-info-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}

.hide-service-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    cursor: pointer;
    margin: 0 0 4px;
}
.hide-service-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--primary);
    flex-shrink: 0;
    cursor: pointer;
}

#hideServiceModal .btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    transition: background .15s, opacity .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
#hideServiceModal .btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}
#hideServiceModal .btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* ============================================================
   СЕЛЕКТ СМЕНЫ РОЛИ В СЕМЕЙНОМ СПИСКЕ
   ============================================================ */
.family-inline-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
    gap: 4px;
}
/* ============================================================
   КНОПКА «⋮» И ВЫПАДАЮЩЕЕ МЕНЮ ДЕЙСТВИЙ
   ============================================================ */
.btn-actions-menu {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--text-muted);
    opacity: 0.4;
    transition: opacity .15s, background .15s, color .15s, transform .1s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    width: auto;
    margin: 0;
}
tbody tr:hover .btn-actions-menu { opacity: 0.85; }
.btn-actions-menu:hover {
    opacity: 1 !important;
    background: var(--primary-tint);
    color: var(--primary);
}
.btn-actions-menu:active { transform: scale(0.92); }
@media (max-width: 768px) {
    .help-header h1 {
        font-size: 24px;
        gap: 8px;
    }
    .help-header h1 svg {
        width: 22px;
        height: 22px;
    }
    .help-header p {
        font-size: 14px;
    }
    .help-toc-grid {
        grid-template-columns: 1fr;
    }
    .help-section-header h2 {
        font-size: 18px;
    }
    .help-section-icon {
        width: 38px;
        height: 38px;
    }
    .help-section-icon svg {
        width: 20px;
        height: 20px;
    }
    .help-item {
        padding: 14px 16px;
    }
    .hidden-service-item {
        padding: 10px 16px;
    }
    .hidden-services summary {
        padding: 12px 16px;
        font-size: 13px;
    }
    .btn-actions-menu { opacity: 0.7; padding: 8px 10px; }
}

.service-menu {
    position: fixed;
    z-index: 2000;
    min-width: 200px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    animation: slideDown .15s ease;
}
.service-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    text-align: left;
    transition: background .15s, color .15s;
    min-width: 0;
    margin: 0;
}
.service-menu-item svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: color .15s;
}
.service-menu-item:hover {
    background: var(--bg);
}
.service-menu-item:hover svg { color: var(--primary); }

.service-menu-item-danger { color: var(--danger); }
.service-menu-item-danger svg { color: var(--danger); }
.service-menu-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}
.service-menu-item-danger:hover svg { color: var(--danger); }

/* ============================================================
   УВЕДОМЛЕНИЯ В ПРОФИЛЕ
   ============================================================ */
.notification-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    margin: 0 0 8px;
    transition: border-color .15s, background .15s;
}
.notification-option:hover {
    border-color: var(--primary);
    background: var(--primary-tint);
}

/* Последняя карточка перед кнопкой — без нижнего отступа */
.notification-option:last-of-type {
    margin-bottom: 12px;
}
.notification-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--primary);
    flex-shrink: 0;
    cursor: pointer;
}
.notification-option-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.notification-option-text strong {
    font-size: 13.5px;
    color: var(--text);
    font-weight: 600;
    line-height: 1.3;
}
.notification-option-text span {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ============================================================
   ИНСТРУКЦИЯ ПОЛЬЗОВАТЕЛЯ (guide.php)
   Контент разделов — готовый HTML, собранный из GUIDE.md
   ============================================================ */
.guide-section {
    scroll-margin-top: 80px;
}

.guide-html {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
}

.guide-html h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 24px 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-html h3:first-child {
    margin-top: 0;
}

.guide-html h3::before {
    content: '';
    width: 4px;
    height: 16px;
    border-radius: 2px;
    background: var(--primary);
    flex-shrink: 0;
}

.guide-html p {
    margin: 0 0 12px;
    color: var(--text);
}

.guide-html ul {
    margin: 8px 0 16px;
    padding-left: 22px;
    color: var(--text);
}

.guide-html li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.guide-html strong {
    color: var(--text);
    font-weight: 600;
}

.guide-html a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.guide-html a:hover {
    text-decoration: underline;
}

.guide-html table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 20px;
    font-size: 13.5px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.guide-html table th,
.guide-html table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.guide-html table th {
    background: var(--head-bg, var(--primary-tint));
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
}

.guide-html table tr:last-child td {
    border-bottom: none;
}

.guide-html table tr:nth-child(even) td {
    background: var(--row-hover, var(--bg));
}

.guide-html code {
    font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
    font-size: 12.5px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 6px;
    color: var(--primary);
    white-space: nowrap;
}

.guide-html pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 12px 0 20px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
}

.guide-html pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text);
    white-space: pre;
}

.guide-html blockquote {
    margin: 12px 0 20px;
    padding: 12px 16px;
    background: var(--primary-tint);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    color: var(--text);
}

@media (max-width: 720px) {
    .guide-html table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    .guide-html h3 {
        font-size: 14px;
    }
}

/* ============================================================
   КАТЕГОРИИ УСЛУГ
   ============================================================ */

/* ============================================================
   КАТЕГОРИИ УСЛУГ
   ============================================================ */

/* Сворачиваемый блок */
.account-services-details {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    overflow: hidden;
}

.account-services-details > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: background .15s, color .15s;
}
.account-services-details > summary::-webkit-details-marker { display: none; }
.account-services-details > summary::after {
    content: '▾';
    margin-left: auto;
    font-size: 11px;
    transition: transform .2s;
    color: var(--text-muted);
}
.account-services-details[open] > summary::after { transform: rotate(180deg); }
.account-services-details > summary:hover {
    background: var(--primary-tint);
    color: var(--primary);
}
.account-services-details > summary:hover svg { color: var(--primary); }

.account-services-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 6px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Список услуг — таблицей */
.account-services-categories {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
    background: var(--card);
}

.account-service-row {
    display: grid;
    grid-template-columns: 1fr 150px;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-bottom: 1px dashed var(--border);
    transition: background .15s;
}
.account-service-row:last-child { border-bottom: none; }
.account-service-row:hover { background: var(--primary-tint); }

.account-service-name {
    font-size: 13px;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Селект категории */
.family-role-select {
    padding: 8px 36px 8px 14px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    color: var(--text);
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color .15s, box-shadow .15s;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    min-width: 150px;
}

.family-role-select:hover {
    border-color: var(--primary);
}

.family-role-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}


.service-category {
    width: 100%;
    padding: 6px 32px 6px 10px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    color: var(--text);
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: 
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: 
        calc(100% - 17px) center,
        calc(100% - 12px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.service-category:hover {
    border-color: var(--primary);
    background-color: var(--card);
}
.service-category:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
    background-color: var(--card);
}

/* Мобильная версия */


/* ============================================================
   ДОНАТ-ГРАФИК ПО КАТЕГОРИЯМ (stats.php)
   ============================================================ */


/* Скелетон для донат-графика: центрируем полоски */
.chart-skeleton-donut {
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 40px;
}
.chart-skeleton-donut .chart-skeleton-bar {
    max-width: 40px;
    border-radius: 6px;
}

/* Сообщение «Нет данных» */
.chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* Мобильная версия */
@media (max-width: 768px) {
    .account-service-row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 10px 12px;
    }
    .account-service-name {
        font-size: 13px;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    .service-category {
        font-size: 13px;
        padding: 8px 30px 8px 12px;
    }
    .account-services-categories {
        padding: 10px 12px;
    }
    .account-services-categories > div {
        flex-wrap: wrap;
        gap: 6px;
    }
    .account-services-categories .service-name {
        flex: 1 1 100%;
        white-space: normal;
        overflow: visible;
    }
    .service-category {
        width: 100%;
        min-width: 0;
    }
    .chart-card .chart-container.chart-container-donut {
        height: 340px;
    }
}
/* Эмодзи-иконки в селектах категорий */
.service-category option {
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.4;
}
/* Цветная точка категории перед названием в списке услуг */
.account-service-row .service-category {
    /* базово без изменений */
}

/* HTML-легенда донат-графика с SVG-иконками */
/* HTML-легенда донат-графика с SVG-иконками */
.chart-card .chart-container.chart-container-donut {
    position: relative;
    width: 100%;
    max-width: 520px;
    min-height: 420px;
    height: auto;
    margin: 0 auto;
}
.chart-container-donut #categoryChart {
    display: block;
    width: 100% !important;
    height: 360px !important;
    max-height: 360px;
}
.chart-container-donut #categoryChart {
    display: block;
    width: 100% !important;
    height: 360px !important;
    max-height: 360px;
}
.cat-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px 20px;
    margin: 16px 0 0;
    padding: 0 12px;
}
.cat-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 6px 4px;
    border-radius: 8px;
    transition: background .15s;
}
.cat-legend-item:hover { background: var(--primary-tint); }
.cat-legend-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cat-legend-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}
.cat-legend-label {
    flex: 1;
    color: var(--text);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cat-legend-value {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .cat-legend {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .cat-legend-item { font-size: 12px; }
}
/* Цветная точка категории в списке услуг */
.category-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 8px;
    vertical-align: middle;
    box-shadow: 0 0 0 2px var(--card);
    transition: background .2s;
}

.account-service-name {
    display: inline-flex;
    align-items: center;
    gap: 0;
    min-width: 0;
}
/* Иконка категории в главной таблице app.php */
.service-cell-inner .category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border-radius: 4px;
    opacity: 0.9;
    transition: opacity .15s, transform .1s;
}
.service-cell-inner .category-icon:hover {
    opacity: 1;
    transform: scale(1.15);
}
.service-cell-inner .category-icon svg {
    display: block;
    width: 14px;
    height: 14px;
}

/* Цветные иконки категорий в фильтре тулбара */
.category-filter {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
.category-filter select {
    padding: 8px 38px 8px 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: 
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: 
        calc(100% - 19px) center,
        calc(100% - 14px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    transition: border-color .15s, box-shadow .15s;
    min-width: 150px;
    max-width: 200px;
}
.category-filter select:hover { border-color: var(--primary); }
.category-filter select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.category-filter-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    pointer-events: none;
}
.category-filter-icon svg {
    display: block;
    width: 16px;
    height: 16px;
}
@media (max-width: 900px) {
    .category-filter { flex: 1 1 auto; }
    .category-filter select { width: 100%; max-width: none; }
}
/* ============================================================
   ТОП-3 ВЫРОСШИХ КАТЕГОРИЙ (stats.php)
   ============================================================ */
.category-growth-card {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.03) 0%, var(--card) 100%);
}
.category-growth-card h3 {
    color: var(--text);
}
.category-growth-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin: -8px 0 16px;
}
.category-growth-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.category-growth-item {
    display: grid;
    grid-template-columns: 28px 32px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s, transform .1s;
}
.category-growth-item:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}
.category-growth-rank {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.category-growth-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.category-growth-icon svg {
    display: block;
    width: 20px;
    height: 20px;
}
.category-growth-body {
    min-width: 0;
}
.category-growth-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.category-growth-meta {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.category-growth-arrow {
    opacity: 0.5;
    font-size: 11px;
}
.category-growth-delta {
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

@media (max-width: 600px) {
    .category-growth-item {
        grid-template-columns: 26px 28px 1fr;
        grid-template-areas:
            "rank icon name"
            "rank icon meta"
            "delta delta delta";
        gap: 8px;
    }
    .category-growth-rank { grid-area: rank; }
    .category-growth-icon { grid-area: icon; }
    .category-growth-body { grid-area: name; }
    .category-growth-meta { grid-area: meta; }
    .category-growth-delta {
        grid-area: delta;
        text-align: right;
        font-size: 16px;
    }
}
/* ============================================================
   СЕЛЕКТ КАТЕГОРИИ В ФОРМЕ ДОБАВЛЕНИЯ УСЛУГИ
   ============================================================ */
.toolbar .inline-form select {
    flex: 0 0 auto;
    padding: 8px 30px 8px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 14px) center,
        calc(100% - 9px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    transition: border-color .15s, box-shadow .15s;
    min-width: 100px;
    max-width: 140px;
}
.toolbar .inline-form select:hover {
    border-color: var(--primary);
}
.toolbar .inline-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

@media (max-width: 900px) {
    .toolbar .inline-form select {
        min-width: 90px;
        max-width: 120px;
        font-size: 12px;
        padding: 8px 26px 8px 8px;
    }
}
/* ============================================================
   ПОВЕРКА СЧЁТЧИКА
   ============================================================ */
.meter-field-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.meter-info-row.meter-verify-soon { color: #f59e0b; }
.meter-info-row.meter-verify-soon span:last-child {
    color: #f59e0b;
    font-weight: 600;
}
.meter-info-row.meter-verify-soon small {
    color: #f59e0b;
    font-weight: 500;
}

.meter-info-row.meter-verify-expired { color: var(--danger); }
.meter-info-row.meter-verify-expired span:last-child {
    color: var(--danger);
    font-weight: 700;
}
.meter-info-row.meter-verify-expired small {
    color: var(--danger);
    font-weight: 600;
}
/* Компактное описание в карточке уведомлений */
.card .meta,
.card .username {
    font-size: 12.5px;
    line-height: 1.4;
}

.card > p {
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 12px;
    color: var(--text-muted);
}
/* ============================================================
   ПРОФИЛЬ — НОВАЯ КОМПОНОВКА
   ============================================================ */
.profile-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--content-padding);
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
    width: 100%;
    box-sizing: border-box;
    flex: 1 0 auto;
}

/* ---------- Левая колонка ---------- */
.profile-aside {
    position: sticky;
    top: calc(var(--header-height) + 16px);
}

.profile-card-new {
    text-align: center;
    padding: 24px 20px 20px;
    margin-bottom: 0;
}

.profile-avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.profile-avatar-lg {
    width: 100px;
    height: 100px;
    border-radius: 18px;
    object-fit: cover;
    border: 2px solid var(--border);
}

.profile-name {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 2px;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}

.profile-handle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 10px;
}

.profile-email {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 16px;
    padding: 5px 12px;
    background: var(--bg);
    border-radius: 8px;
    max-width: 100%;
    word-break: break-all;
}
.profile-email svg { flex-shrink: 0; opacity: 0.7; }

.profile-meta-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.profile-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.profile-meta-label {
    color: var(--text-muted);
}

.profile-meta-value {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.plan-meta-value {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.profile-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-quick-btn {
    width: 100%;
    justify-content: center;
    margin: 0 !important;
}

/* ---------- Правая колонка ---------- */
.profile-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

/* ---------- Секции (аккордеон) ---------- */
.profile-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.profile-section[open] {
    border-color: var(--primary);
    box-shadow: 0 4px 16px var(--primary-soft);
}

.profile-section > summary {
    display: grid;
    grid-template-columns: 32px 1fr auto 12px;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: background .15s;
    font-weight: 500;
    min-height: 56px;
    line-height: 1;
    position: relative;
}
.profile-section > summary::-webkit-details-marker { display: none; }
.profile-section > summary:hover {
    background: var(--bg);
}
.profile-section[open] > summary {
    border-bottom: 1px solid var(--border);
}


.profile-section-icon svg {
    display: block;
    width: 16px;
    height: 16px;
    margin: 0;
}

.profile-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    align-self: center;
}

.profile-section-hint {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    padding: 3px 10px;
    background: var(--bg);
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    align-self: center;
    justify-self: end;
}

.profile-section > summary::after {
    content: '▾';
    font-size: 11px;
    color: var(--text-muted);
    transition: transform .2s;
    line-height: 1;
    text-align: center;
    align-self: center;
    justify-self: center;
}
.profile-section[open] > summary::after {
    transform: rotate(180deg);
}
.profile-section-body {
    padding: 18px;
    animation: slideDown .2s ease;
}

.profile-section-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0 0 14px;
}
.profile-section-desc strong { color: var(--text); }

.profile-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.profile-link:hover { text-decoration: underline; }

/* Danger секция */
.profile-section-danger[open] {
    border-color: rgba(239, 68, 68, 0.4);
}
.profile-section-danger .profile-section-icon {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}
.profile-section-danger .profile-section-hint {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

/* ---------- Формы ---------- */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.form-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0;
}

/* Поля формы. Список типов перечислен явно: раньше здесь были только
   text/email/password/file, поэтому url и tel в разделе «Оплата аренды»
   (ссылка СБП и телефон), а также date/number в условиях договора
   оставались без оформления — выглядели как поля по умолчанию. */
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="url"],
.form-field input[type="tel"],
.form-field input[type="search"],
.form-field input[type="date"],
.form-field input[type="number"],
.form-field input[type="file"],
.form-field select,
.form-field textarea {
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    box-sizing: border-box;
}
.form-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3' 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 14px center;
    padding-right: 38px;
}
.form-field textarea {
    resize: vertical;
    min-height: 72px;
    line-height: 1.5;
}
.form-field input[type="file"] {
    padding: 7px;
    cursor: pointer;
    font-size: 13px;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
/* Числовые поля (день начисления, день авто-выставления) — компактнее:
   «на всю ширину» им не нужно, а стрелки должны помещаться */
.form-field input[type="number"] {
    max-width: 140px;
}
.form-field input[type="url"]:invalid:not(:placeholder-shown) {
    border-color: #fca5a5;
}

.form-field-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 2px;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.form-actions-inline {
    align-items: center;
}
.form-actions .btn-primary,
.form-actions .btn-secondary {
    margin: 0;
}

/* ---------- API-блок ---------- */
.api-token-box {
    margin-bottom: 14px;
}
.api-token-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.api-token-field {
    width: 100%;
    font-family: monospace;
    font-size: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    resize: vertical;
    min-height: 56px;
    cursor: pointer;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    box-sizing: border-box;
    line-height: 1.4;
    word-break: break-all;
}
.api-token-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.api-token-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin: 6px 0 0;
    line-height: 1.4;
}
.api-token-hint strong { color: var(--text); }

/* ---------- Мобильный ---------- */
@media (max-width: 900px) {
    .profile-page {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 12px;
    }
    .profile-aside {
        position: static;
    }
    .profile-card-new {
        padding: 20px 16px;
    }
    .profile-avatar-lg {
        width: 80px;
        height: 80px;
        border-radius: 14px;
    }
    .profile-name { font-size: 16px; }
    
    .profile-section > summary {
        padding: 10px 14px;
        gap: 10px;
        min-height: 50px;
    }
    .profile-section-title { font-size: 13px; }
    .profile-section-hint { font-size: 11px; padding: 2px 8px; }
    .profile-section-body { padding: 14px; }
    
    .form-row-2 {
        grid-template-columns: 1fr;
    }
    .form-actions .btn-primary,
    .form-actions .btn-secondary {
        flex: 1;
        justify-content: center;
    }
}

/* Уведомления в новой компоновке — компактнее */
.profile-section .notification-option {
    padding: 10px 12px;
    margin-bottom: 8px;
}
.profile-section .notification-option:last-of-type {
    margin-bottom: 4px;
}
.profile-section .notification-option-text strong {
    font-size: 13px;
}
.profile-section .notification-option-text span {
    font-size: 12px;
}

/* Выбор режима владельца (обычный / аренда) — те же строки, что у уведомлений,
   поэтому достаточно radio вместо checkbox и небольшого отступа между ними */
.owner-mode-choice .notification-option input[type="radio"] {
    accent-color: var(--primary);
}
.owner-mode-choice .notification-option {
    cursor: pointer;
}
/* Жёсткое выравнивание иконки внутри секции */
.profile-section-icon svg {
    display: block !important;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin: 0 !important;
    position: static !important;
    transform: none !important;
}
/* Корона рядом с тарифом — визуально опустить */
.profile-meta-value.plan-meta-value .plan-icon svg {
    transform: translateY(1px);
}

.profile-meta-value.plan-meta-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}

.profile-meta-value.plan-meta-value > span:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
/* ============================================================
   МОДАЛКА СОЗДАНИЯ ПОЛЬЗОВАТЕЛЯ
   ============================================================ */
.modal-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}
.modal-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0;
}
.modal-field input[type="text"],
.modal-field input[type="email"],
.modal-field select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}
.modal-field input:focus,
.modal-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.modal-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    cursor: pointer;
    margin: 4px 0 0;
}
.modal-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--primary);
    flex-shrink: 0;
    cursor: pointer;
}

/* ============================================================
   Профиль: раздел «Оплата аренды»
   ============================================================ */

.payment-group {
    margin: 0 0 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.payment-group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.payment-group .form-row-2 {
    margin-bottom: 0;
}

.payment-group .form-field:last-child {
    margin-bottom: 0;
}

/* ============================================================
   СЕМЕЙНЫЙ ДОСТУП
   ============================================================ */
.family-list { display: flex; flex-direction: column; gap: 8px; }

.family-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s;
}
.family-item:hover { border-color: var(--primary); }
.family-item-owner { background: var(--primary-tint); border-color: var(--primary); }
.family-item-pending { opacity: 0.75; }
.family-item-declined, .family-item-removed { opacity: 0.55; }

.family-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.family-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    color: var(--text-muted);
}

.family-info { flex: 1; min-width: 0; }
.family-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.family-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    word-break: break-all;
}

.family-role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.family-role-owner  { background: var(--primary); color: #fff; }
.family-role-editor { background: rgba(16,185,129,.15); color: #059669; }
.family-role-viewer { background: rgba(148,163,184,.2); color: #64748b; }

.family-status {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.family-status-active   { background: rgba(16,185,129,.15); color: #059669; }
.family-status-pending  { background: rgba(245,158,11,.15); color: #b45309; }
.family-status-declined { background: rgba(239,68,68,.12); color: #dc2626; }
.family-status-removed  { background: rgba(148,163,184,.15); color: #64748b; }

.family-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.family-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
    text-align: center;
    padding: 16px;
}

/* Переключатель в шапке */
.family-switch-form { margin: 0; display: inline-flex; }
.family-switch-select {
    padding: 6px 32px 6px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 17px) center,
        calc(100% - 12px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    max-width: 180px;
}
.family-switch-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}


/* ============================================================
   PWA — баннер установки
   ============================================================ */
.pwa-banner {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    max-width: 520px;
    width: calc(100% - 32px);
    animation: pwaBannerIn .4s cubic-bezier(.16, 1, .3, 1);
}

@keyframes pwaBannerIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pwa-banner-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.pwa-banner-icon img { display: block; border-radius: 10px; }

.pwa-banner-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.35;
}
.pwa-banner-text strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.pwa-banner-text span {
    font-size: 12px;
    color: var(--text-muted);
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.pwa-banner-actions .btn-primary {
    padding: 8px 16px;
    font-size: 13px;
    margin: 0;
    min-width: 0;
    white-space: nowrap;
}
.pwa-banner-close {
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.pwa-banner-close:hover {
    background: var(--bg);
    color: var(--text);
}

@media (max-width: 600px) {
    .family-item { flex-wrap: wrap; }
    .family-actions { width: 100%; justify-content: flex-end; }
    .family-switch-select { max-width: 130px; font-size: 12px; }
    .pwa-banner {
        flex-wrap: wrap;
        bottom: 12px;
        padding: 10px 12px;
        gap: 10px;
    }
    .pwa-banner-text { flex: 1 1 calc(100% - 56px); }
    .pwa-banner-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .pwa-banner-actions .btn-primary { flex: 1; }
}

/* ============================================================
   PWA — офлайн-индикатор
   ============================================================ */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #f59e0b;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    animation: pwaBannerIn .3s ease;
}
.offline-indicator svg {
    display: block;
    width: 14px;
    height: 14px;
}

/* ============================================================
   PWA — плашка «данные из кэша»
   ============================================================
   Показывается, когда service worker отдал страницу из кэша, а не из
   сети: суммы на экране могут быть вчерашними, и об этом надо сказать
   прямо, а не делать вид, что данные свежие.
   ============================================================ */
.cache-notice {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 401;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(92vw, 520px);
    padding: 6px 10px 6px 14px;
    background: #0d3b3a;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 12px rgba(13, 59, 58, 0.35);
    animation: pwaBannerIn .3s ease;
}
.cache-notice svg {
    display: block;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}
.cache-notice span {
    min-width: 0;
}
.cache-notice button {
    flex: 0 0 auto;
    background: none;
    border: 0;
    color: #ffffff;
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
    cursor: pointer;
    opacity: .8;
}
.cache-notice button:hover {
    opacity: 1;
}

/* Офлайн-индикатор встаёт ниже, чтобы плашки не наезжали друг на друга */
body.has-cache-notice .offline-indicator {
    top: 32px;
}

@media print {
    .cache-notice {
        display: none !important;
    }
}

/* ============================================================
   PWA — кнопка установки в шапке
   ============================================================ */
#pwaInstallBtn {
    /* Наследует стили .btn-theme */
    color: var(--primary);
}
#pwaInstallBtn:hover {
    color: var(--primary-hover);
}
/* ============================================================
   СУРБ — рекламные блоки
   ============================================================ */
.ad-block {
    margin: 8px 0;
}
.ad-block a {
    text-decoration: none;
}
.ad-block a:hover {
    text-decoration: underline;
}

/* Скрывать блоки при печати */
@media print {
    .ad-block {
        display: none !important;
    }
}
/* ============================================================
   СУРБ — контейнер для header-баннера
   Оборачивает блок в .container, чтобы не растягивался
   ============================================================ */
.ad-container {
    padding-top: var(--content-padding);
    padding-bottom: 0;
}

.ad-container .ad-block {
    margin: 0;
}

/* Мобильная версия — уменьшаем отступ */

/* ============================================================
   СУРБ — контейнер для footer-баннера
   Не используем .footer-inner: он flex — сжимает одиночный блок
   ============================================================ */
.ad-footer-wrap {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}

.ad-footer-wrap .ad-block {
    margin: 0;
}

.ad-footer-wrap .ad-block > div {
    width: 100%;
    box-sizing: border-box;
}
.ad-block a {
    text-decoration: none;
    cursor: pointer;
}
/* Мобильная версия */

/* Мобильная версия */
@media (max-width: 768px) {
    .ad-container {
        padding-top: 12px;
    }
    .ad-footer-wrap {
        padding: 0 12px 12px;
        margin-bottom: 12px;
    }
    .ad-footer-inner {
        padding-bottom: 12px;
        margin-bottom: 12px;
    }
}
/* ============================================================
   СУРБ — inline-баннер в контенте
   ============================================================ */
main.container .ad-block[data-ad-id] {
    margin: 20px 0;
}
/* ============================================================
   БЫСТРЫЙ ВВОД (quick.php) — версия 1.0
   ============================================================ */

/* ---------- Карточки статистики ---------- */
.quick-stats {
    margin-bottom: 20px;
}

.quick-stat {
    position: relative;
    overflow: hidden;
}

.quick-value-success {
    color: var(--success) !important;
}

.quick-value-danger {
    color: var(--danger) !important;
}

/* ---------- Фильтры ---------- */
.quick-filters-card {
    padding: 16px 20px;
    margin-bottom: 16px;
}

.quick-filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 12px;
    align-items: end;
}

.quick-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.quick-filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0;
}

.quick-filter-group input[type="text"],
.quick-filter-group select {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}

.quick-filter-group input:focus,
.quick-filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Мобилка — фильтры в столбик */
@media (max-width: 900px) {
    .quick-filters {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 600px) {
    .quick-filters {
        grid-template-columns: 1fr;
    }
}

/* ---------- Панель массовых действий ---------- */
.quick-bulk-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: var(--primary-tint);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
    animation: slideDown .2s ease;
}

.quick-bulk-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin: 0;
    user-select: none;
}

.quick-bulk-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.quick-bulk-info {
    font-size: 13px;
    color: var(--text-muted);
}

.quick-bulk-info strong {
    color: var(--primary);
    font-size: 15px;
}

.quick-bulk-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex-wrap: wrap;
}

/* Мобилка */
@media (max-width: 700px) {
    .quick-bulk-bar {
        gap: 10px;
        padding: 10px 12px;
    }
    .quick-bulk-actions {
        width: 100%;
        margin-left: 0;
        justify-content: stretch;
    }
    .quick-bulk-actions > * {
        flex: 1;
    }
}

/* ---------- Таблица начислений ---------- */
.quick-table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow-x: auto;         /* ← вместо hidden — даёт горизонтальный скролл, если не влезает */
    overflow-y: visible;
    margin-bottom: 16px;
    width: 100%;              /* ← растягиваем на всю ширину родителя */
    box-sizing: border-box;   /* ← padding/border не увеличивают ширину */
}

.quick-table {
    width: 100%;
    min-width: 800px;         /* ← минимум, чтобы не сжималась слишком сильно */
    border-collapse: collapse;
    font-size: 14px;
}

.quick-table thead th {
    padding: 12px 14px;
    text-align: left;
    background: var(--head-bg);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.quick-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}

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

.quick-table tbody tr:hover {
    background: var(--row-hover);
}

.quick-table td {
    padding: 12px 14px;
    vertical-align: middle;
}

/* Колонки */
.quick-col-check,
.quick-cell-check {
    width: 40px;
    text-align: center;
    padding-left: 16px !important;
    padding-right: 4px !important;
}

.quick-row-check {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
}

.quick-col-num,
.quick-cell-num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Явно выравниваем заголовки числовых колонок по правому краю —
   чтобы совпадали с данными. Это перебивает `text-align: left`
   из общего правила `.quick-table thead th`. */
.quick-table thead th.quick-col-num {
    text-align: right;
}

/* Колонка действий — тоже по правому краю */
.quick-table thead th.quick-col-actions {
    text-align: right;
}

/* Чекбокс-колонка — по центру */
.quick-table thead th.quick-col-check {
    text-align: center;
}

/* Колонка «Показание» — заголовок и данные по центру */
.quick-table thead th.quick-col-reading {
    text-align: center;
}
.quick-cell-reading {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.quick-col-actions,
.quick-cell-actions {
    width: 100px;
    text-align: right;
    white-space: nowrap;
}

.quick-cell-period {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
}

/* Услуга / объект */
.quick-cell-main {
    min-width: 200px;
}

.quick-service-name {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
    line-height: 1.3;
}

.quick-service-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.3;
}

.quick-account-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--card);
}

.quick-service-note {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 3px;
    line-height: 1.3;
}

/* Оплачено — кнопка-ссылка */
.quick-paid-link,
.quick-paid-empty {
    background: none;
    border: none;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.quick-paid-link {
    color: var(--success);
}

.quick-paid-link:hover {
    background: rgba(16, 185, 129, 0.1);
}

.quick-paid-empty {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12px;
    border: 1px dashed var(--border);
}

.quick-paid-empty:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-tint);
}

/* Долг */
.quick-debt {
    color: var(--danger);
    font-weight: 600;
}

.quick-muted {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Плановая дата */
.quick-due-btn,
.quick-due-empty {
    background: none;
    border: none;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
    transition: background .15s, color .15s;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.quick-due-btn {
    color: var(--text);
    font-weight: 500;
}

.quick-due-btn:hover {
    background: var(--primary-tint);
    color: var(--primary);
}

.quick-due-empty {
    color: var(--text-muted);
    font-size: 12px;
    border: 1px dashed var(--border);
}

.quick-due-empty:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-tint);
}
/* Заголовки «Плановая дата» и «Статус» — по левому краю,
   чтобы совпадали с данными */
.quick-table thead th.quick-col-due,
.quick-table thead th.quick-col-status {
    text-align: left;
}

/* Данные в этих колонках — тоже по левому краю */
.quick-table tbody td.quick-cell-due,
.quick-table tbody td.quick-cell-status {
    text-align: left;
}
/* Чуть больше отступов в ячейках */
.quick-table thead th,
.quick-table tbody td,
.quick-table tfoot td {
    padding-top: 14px;
    padding-bottom: 14px;
}

/* ---------- Итоговая строка (tfoot) ---------- */
.quick-table tfoot td {
    background: var(--head-bg);
    border-top: 2px solid var(--border);
    font-weight: 700;
    vertical-align: middle;
}
.quick-total-row td.quick-cell-period {
    color: var(--text);
    font-size: 14px;
}
.quick-total-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: normal;
}
/* ---------- Статусы ---------- */
.quick-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.4;
}

.quick-status-success {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.quick-status-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.quick-status-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.quick-status-info {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

.quick-status-muted {
    background: var(--bg);
    color: var(--text-muted);
}


/* ---------- Кнопки-иконки в строке ---------- */
.quick-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0 2px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s, transform .1s;
    vertical-align: middle;
}

.quick-btn-icon svg {
    display: block;
    width: 16px;
    height: 16px;
}

.quick-btn-icon:hover {
    background: var(--primary-tint);
    color: var(--primary);
}

.quick-btn-icon:active {
    transform: scale(0.92);
}

.quick-btn-pay {
    color: var(--success);
}

.quick-btn-pay:hover {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.quick-btn-danger {
    color: var(--text-muted);
}

.quick-btn-danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

/* ---------- Счётчик под таблицей ---------- */
.quick-count-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin: 12px 0;
}

.quick-count-info strong {
    color: var(--text);
    font-weight: 700;
}

/* ---------- Модалка: поля 2 в ряд ---------- */
.modal-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 500px) {
    .modal-row-2 {
        grid-template-columns: 1fr;
    }
}

/* ---------- Модалка оплат ---------- */
.quick-payments-content {
    max-width: 560px;
}

.quick-pay-info {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.quick-pay-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 5px 0;
    font-size: 14px;
}

.quick-pay-info-row span:first-child {
    color: var(--text-muted);
    font-size: 13px;
}

.quick-pay-info-row strong {
    font-variant-numeric: tabular-nums;
}

.quick-pay-list {
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 8px 0;
    border-top: 1px dashed var(--border);
    border-bottom: 1px dashed var(--border);
}

/* Список внесённых оплат: у каждой строки кнопка «Удалить»,
   чтобы можно было отменить ошибочную оплату (и вместе с ней —
   неверный статус начисления, который считается по оплатам). */
.quick-pay-list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 0 2px 6px;
}

.quick-pay-count {
    background: var(--bg);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

.quick-pay-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 9px 2px;
    border-bottom: 1px dashed var(--border);
}

.quick-pay-row:last-of-type {
    border-bottom: none;
}

.quick-pay-row-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.quick-pay-row-main strong {
    font-size: 14.5px;
    font-variant-numeric: tabular-nums;
}

.quick-pay-row-meta {
    font-size: 12.5px;
    color: var(--text-muted);
}

.quick-pay-row-note {
    font-size: 12.5px;
    color: var(--text-muted);
    font-style: italic;
    overflow-wrap: anywhere;
}

.quick-pay-del {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.quick-pay-del:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

.quick-pay-hint,
.quick-pay-loading,
.quick-pay-error {
    text-align: center;
    font-size: 13px;
    padding: 12px 0;
    color: var(--text-muted);
    font-style: italic;
}

.quick-pay-error {
    color: var(--danger);
    font-style: normal;
}

.quick-pay-subtitle {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    margin: 16px 0 12px;
}

@media (max-width: 900px) {
    /* Сбрасываем min-width — таблица теперь карточки */
    .quick-table {
        min-width: 0;
    }

    /* Убираем горизонтальный скролл у обёртки */
    .quick-table-wrap {
        overflow-x: visible;
        border: none;
        background: transparent;
        box-shadow: none;
    }

    .quick-table thead {
        display: none;
    }

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

    /* ============================================
       КАРТОЧКА НАЧИСЛЕНИЯ
       ============================================ */
    .quick-table tr {
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 0;
        position: relative;
        overflow: hidden;
    }

    .quick-table tbody tr:last-child {
        margin-bottom: 0;
    }

    /* Итоговая карточка в мобильном виде */
    .quick-table tfoot {
        margin-top: 16px;
    }
    .quick-table tfoot .quick-total-row {
        background: var(--head-bg);
        border: 2px solid var(--primary);
        box-shadow: var(--shadow);
    }
    .quick-table tfoot .quick-total-row td.quick-cell-period {
        background: var(--primary);
        color: #ffffff;
        padding: 8px 16px;
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.05em;
        justify-content: center;
        border-bottom: none;
    }
    .quick-table tfoot .quick-total-row td.quick-cell-period strong {
        color: #ffffff;
    }
    .quick-table tfoot .quick-total-row td.quick-cell-main {
        display: none !important;
    }
    .quick-table tfoot .quick-total-row td.quick-cell-check,
    .quick-table tfoot .quick-total-row td.quick-cell-reading,
    .quick-table tfoot .quick-total-row td.quick-cell-due,
    .quick-table tfoot .quick-total-row td.quick-cell-status,
    .quick-table tfoot .quick-total-row td.quick-cell-actions {
        display: none !important;
    }

    .quick-table td {
        padding: 10px 16px;
        border: none;
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        font-size: 13px;
        line-height: 1.4;
    }

    /* Метка слева, значение справа */
    .quick-table td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 0.03em;
        flex: 0 0 auto;
        text-align: left;
        line-height: 1.4;
    }

    /* Значения — правый край */
    .quick-table td > *:last-child,
    .quick-table td:not(:has(::before)) {
        text-align: right;
    }

    /* Разделители между строками данных */
    .quick-table td + td {
        border-top: 1px dashed var(--border);
    }

    /* ============================================
       ШАПКА КАРТОЧКИ: чекбокс + период + услуга
       ============================================ */
/* Чекбокс — в левом верхнем углу, с отступом */
.quick-table td.quick-cell-check {
    position: absolute;
    top: 14px;
    left: 16px;
    padding: 0 !important;
    width: auto !important;
    display: flex;
    justify-content: flex-start;
    z-index: 2;
}
.quick-cell-check::before {
    display: none;
}

.quick-cell-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Специфичность выше, чем у td.quick-cell-period без @media */
.quick-table td.quick-cell-period {
    display: flex;
    justify-content: flex-end;
    padding: 14px 16px 8px 48px;
    border-bottom: 1px dashed var(--border);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    min-height: 32px;
    width: auto;           /* ← перебиваем width:100px */
    max-width: none;
    box-sizing: border-box;
}
.quick-table td.quick-cell-period::before {
    display: none;
}

    /* Услуга + объект — крупным блоком */
    .quick-cell-main {
        display: block !important;
        text-align: left !important;
        padding: 8px 16px 12px !important;
    }
    .quick-cell-main::before {
        display: none;
    }

    .quick-cell-main .quick-service-name {
        font-size: 16px;
        font-weight: 700;
        line-height: 1.3;
    }

    .quick-cell-main .quick-service-meta {
        margin-top: 4px;
        font-size: 12px;
    }

    /* ============================================
       ЧИСЛОВЫЕ ПОЛЯ
       ============================================ */
    .quick-cell-num {
        text-align: right;
    }
    .quick-cell-num > *:last-child {
        text-align: right;
    }

    /* ============================================
       ПЛАН-ДАТА И СТАТУС
       ============================================ */
    .quick-cell-due,
    .quick-cell-status {
        text-align: right;
    }
    .quick-cell-due::before,
    .quick-cell-status::before {
        text-align: left;
    }

    /* ============================================
       ДЕЙСТВИЯ (кнопки) — во всю ширину
       ============================================ */
    .quick-cell-actions {
        display: flex !important;
        justify-content: flex-end !important;
        align-items: center;
        gap: 8px;
        padding: 10px 16px !important;
        background: var(--bg);
        border-top: 1px solid var(--border) !important;
    }
    .quick-cell-actions::before {
        content: '' !important;
        display: none;
    }

    .quick-btn-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: var(--card);
        border: 1px solid var(--border);
    }

    .quick-btn-icon svg {
        width: 18px;
        height: 18px;
    }

    .quick-btn-icon:hover,
    .quick-btn-icon:active {
        background: var(--primary-tint);
        border-color: var(--primary);
    }
}
/* ============================================================
   БЫСТРЫЙ ВВОД — выравнивание заголовков и данных
   ============================================================ */

/* Общие правила для таблицы */
.quick-table th,
.quick-table td {
    vertical-align: middle;
}

/* Период — слева */
.quick-table th:nth-child(2),
.quick-table td.quick-cell-period {
    text-align: left;
}

/* Объект / услуга — слева */
.quick-table th:nth-child(3),
.quick-table td.quick-cell-main {
    text-align: left;
}

/* Числовые колонки — справа */
.quick-table th.quick-col-num,
.quick-table td.quick-cell-num {
    text-align: right;
}

/* Плановая дата — по центру */
.quick-table th.quick-col-due,
.quick-table td.quick-cell-due {
    text-align: center;
}

/* Статус — по центру */
.quick-table th.quick-col-status,
.quick-table td.quick-cell-status {
    text-align: center;
}

/* Показание — по центру (заголовок и данные) */
.quick-table th.quick-col-reading,
.quick-table td.quick-cell-reading {
    text-align: center;
}

/* Действия — справа */
.quick-table th.quick-col-actions,
.quick-table td.quick-cell-actions {
    text-align: right;
}

/* Чекбокс — по центру */
.quick-table th.quick-col-check,
.quick-table td.quick-cell-check {
    text-align: center;
}
/* Ограничиваем ширину колонки «Объект / услуга» — только для десктопа */
@media (min-width: 901px) {
    .quick-table th:nth-child(3),
    .quick-table td.quick-cell-main {
        max-width: 280px;
        min-width: 200px;
    }

    /* Период — узкий, только для десктопа */
    .quick-table th:nth-child(2),
    .quick-table td.quick-cell-period {
        width: 100px;
        white-space: nowrap;
    }
}
/* ============================================================
   БЫСТРЫЙ ВВОД — стилизация input[type="date"]
   ============================================================ */

/* Все поля даты внутри quick.php и модалок */
.quick-filters-card input[type="date"],
#quickExpenseModal input[type="date"],
#quickPaymentsModal input[type="date"],
#quickDueModal input[type="date"],
#quickBulkDueModal input[type="date"] {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    /* Убираем системные стили Safari/Chrome */
    appearance: none;
    -webkit-appearance: none;
}

/* Иконка календаря справа — красивая */
.quick-filters-card input[type="date"]::-webkit-calendar-picker-indicator,
#quickExpenseModal input[type="date"]::-webkit-calendar-picker-indicator,
#quickPaymentsModal input[type="date"]::-webkit-calendar-picker-indicator,
#quickDueModal input[type="date"]::-webkit-calendar-picker-indicator,
#quickBulkDueModal input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: 6px;
    opacity: 0.55;
    transition: opacity .15s;
    /* Перекрашиваем иконку под тему */
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") no-repeat center;
            mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask-size: contain;
            mask-size: contain;
}

.quick-filters-card input[type="date"]:hover::-webkit-calendar-picker-indicator,
#quickExpenseModal input[type="date"]:hover::-webkit-calendar-picker-indicator,
#quickPaymentsModal input[type="date"]:hover::-webkit-calendar-picker-indicator,
#quickDueModal input[type="date"]:hover::-webkit-calendar-picker-indicator,
#quickBulkDueModal input[type="date"]:hover::-webkit-calendar-picker-indicator {
    opacity: 1;
}

/* Фокус */
.quick-filters-card input[type="date"]:focus,
#quickExpenseModal input[type="date"]:focus,
#quickPaymentsModal input[type="date"]:focus,
#quickDueModal input[type="date"]:focus,
#quickBulkDueModal input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}


/* Пустое поле (placeholder) — серый */
input[type="date"]:not(:focus):invalid::-webkit-datetime-edit-text,
input[type="date"]:not(:focus):invalid::-webkit-datetime-edit-month-field,
input[type="date"]:not(:focus):invalid::-webkit-datetime-edit-day-field,
input[type="date"]:not(:focus):invalid::-webkit-datetime-edit-year-field {
    color: var(--text-muted);
}

/* Firefox — своя иконка */
input[type="date"]::-moz-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    filter: invert(0);
}


html[data-theme="light"] input[type="date"] {
    color-scheme: light;
}

/* ============================================================
   БЕЙДЖ ОПЛАТЫ — в правом нижнем углу ячейки
   ============================================================ */

.pay-badge {
    position: absolute;
    bottom: 3px;
    right: 7px;
    top: auto;
    left: auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    z-index: 3;
    cursor: help;
    transition: transform .15s, opacity .15s;
    opacity: 0.25;
    font-size: 0;
    line-height: 0;
    color: transparent;
    user-select: none;
    pointer-events: auto;

}
/* Переплата — синяя точка с плюсом.
   Плюс — это ТЕКСТ внутри бейджа (в разметке стоит «+»), а не псевдоэлементы:
   раньше он рисовался ещё и через ::before/::after, и получалось два плюса.
   В легенде бейдж не absolute, поэтому псевдоэлементы уезжали к чужому
   предку — «плюс не в том месте». */
.pay-badge-overpaid {
    background: #3b82f6;
    color: #ffffff;
    font-size: 7px;
    font-weight: 800;
    line-height: 1;
    width: 8px;
    height: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    opacity: 0.85;
    box-sizing: border-box;
}

.pay-badge:hover {
    transform: scale(1.35);
    transform-origin: center;
    opacity: 1;
}

.pay-badge-paid    { background: #10b981; }
.pay-badge-partial { background: #f59e0b; }
.pay-badge-overdue {
    background: #ef4444;
    opacity: 0.5;
    animation: pay-badge-pulse 2s ease-in-out infinite;
}

/* Не оплачено (есть план-дата) — серый контурный кружок */
.pay-badge-unpaid {
    background: transparent;
    border: 2px solid #94a3b8;
    width: 10px;
    height: 10px;
    padding: 0;
    opacity: 0.55;
    box-sizing: border-box;
}
/* ============================================================
   ЛЕГЕНДА БЕЙДЖЕЙ ОПЛАТЫ (app.php)
   ============================================================ */
.pay-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin: 12px 4px 20px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12.5px;
    color: var(--text-muted);
}

.pay-legend-title {
    font-weight: 600;
    color: var(--text);
    margin-right: 4px;
}

.pay-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* В легенде бейдж — не absolute, а обычный inline-элемент */
.pay-legend-item .pay-badge {
    position: static;
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    opacity: 1;
    cursor: default;
}

.pay-legend-item .pay-badge-overpaid {
    width: 12px;
    height: 12px;
    font-size: 9px;
}

.pay-legend-item .pay-badge-unpaid {
    width: 10px;
    height: 10px;
}

/* Мобильная версия */

/* ============================================================
   ЛЕГЕНДА СТАТУСОВ (quick.php)
   ============================================================ */
.quick-status-legend {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
}

.quick-status-legend > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: background .15s, color .15s;
}
.quick-status-legend > summary::-webkit-details-marker { display: none; }
.quick-status-legend > summary::after {
    content: '▾';
    margin-left: auto;
    font-size: 11px;
    transition: transform .2s;
}
.quick-status-legend[open] > summary::after {
    transform: rotate(180deg);
}
.quick-status-legend > summary:hover {
    background: var(--primary-tint);
    color: var(--primary);
}
.quick-status-legend[open] > summary {
    border-bottom: 1px solid var(--border);
}

.quick-status-legend-body {
    padding: 14px 16px;
}

.quick-status-legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px 20px;
}

.quick-status-legend-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

.quick-status-legend-item .quick-status {
    flex-shrink: 0;
    margin-top: 1px;
}

@media (max-width: 600px) {
    .pay-legend {
        gap: 8px 14px;
        padding: 8px 12px;
        font-size: 12px;
    }
    .pay-legend-title {
        width: 100%;
    }
    .quick-status-legend-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
.pay-badge-unpaid:hover { opacity: 1; }

@keyframes pay-badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50%      { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

/* В простом режиме — скрываем */
body.simple-mode .pay-badge {
    display: none;
}

/* Мобилка */
@media (max-width: 768px) {
    .pay-badge {
        width: 10px;
        height: 10px;
        bottom: 2px;
        right: 2px;
    }
}
/* ============================================================
   СУРБ — пользовательские баннеры с адаптацией под тему
   ============================================================ */
.ad-custom-banner {
    padding: 12px 16px;
    background: #eef6ff;
    border: 1px solid #cfe3ff;
    border-radius: 10px;
    margin: 8px 0;
    font-size: 14px;
    color: #0d3b3a;
    line-height: 1.4;
}
.ad-custom-banner a {
    color: #0a66c2;
    font-weight: 600;
    text-decoration: none;
}
.ad-custom-banner a:hover {
    text-decoration: underline;
}


/* ============================================================
   СУРБ — переключение рекламных блоков по теме
   ============================================================ */
.ad-theme-switch {
    margin: 8px 0;
}

/* По умолчанию показываем светлый */
.ad-theme-dark {
    display: none;
}

/* ============================================================
   ПОКАЗАНИЕ СЧЁТЧИКА В ФОРМЕ НАЧИСЛЕНИЯ
   ============================================================ */
.quick-meter-hint {
    padding: 8px 12px;
    background: var(--primary-tint);
    border: 1px solid var(--primary-soft);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-muted);
    margin: 12px 0;
}
.quick-meter-hint:empty { display: none; }

.quick-meter-zone {
    padding-left: 12px;
    border-left: 2px solid var(--primary-tint);
}

.quick-reading {
    font-size: 13px;
    color: var(--text);
}



/* ============================================================
   Онбординг-мастер: 3 шага (счётчики → тарифы → поверка)
   onboarding.php
   ============================================================ */

.onboarding {
    max-width: 620px;
    margin: 0 auto;
}

/* Сообщение над мастером (например, «Email подтверждён» после verify.php) —
   по ширине карточки мастера, а не на весь контейнер */
.onb-flash {
    max-width: 620px;
    margin: 0 auto 16px;
}

.onboarding-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 28px;
}

.onboarding-head h1 {
    font-size: 22px;
    margin-bottom: 4px;
}

.onboarding-head p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Степпер */
.onboarding-steps {
    display: flex;
    list-style: none;
    gap: 8px;
    margin: 0 0 24px;
    padding: 0;
}

.onboarding-steps li {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    position: relative;
    padding-bottom: 16px;
    white-space: nowrap;
}

.onboarding-steps li::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 5px;
    height: 2px;
    background: var(--border);
}

.onb-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    background: var(--border);
    color: var(--text-muted);
    flex-shrink: 0;
}

.onboarding-steps li.is-active { color: var(--text); font-weight: 600; }
.onboarding-steps li.is-active .onb-step-num { background: var(--primary); color: #fff; }
.onboarding-steps li.is-done .onb-step-num { background: var(--success); color: #fff; }
.onboarding-steps li.is-done::after,
.onboarding-steps li.is-active::after { background: var(--primary); }

/* Шаги */
.onboarding-step { display: none; }
.onboarding-step.is-active { display: block; }
.onboarding-step h2 { font-size: 17px; margin-bottom: 4px; }

.onb-sub {
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Общие элементы строк */
.onb-icon {
    display: inline-flex;
    color: var(--primary);
    flex-shrink: 0;
}
.onb-name { font-weight: 500; }
.onb-unit { color: var(--text-muted); font-size: 12px; margin-left: auto; }

.onb-row-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.onb-row-head .onb-name { font-weight: 600; }

/* Шаг 1: список счётчиков */
.onboarding-meters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.onboarding-meter {
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.onboarding-keep {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
}

.onboarding-keep input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.onboarding-add {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.onboarding-add select {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

/* Шаги 2–3: поля */
.onboarding-tariffs,
.onboarding-verify {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.onboarding-tariff,
.onboarding-verify-row {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    transition: opacity var(--transition);
}

.onboarding-tariff.is-muted,
.onboarding-verify-row.is-muted {
    opacity: 0.45;
}

.onb-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.onb-field {
    flex: 1;
    min-width: 120px;
}

.onb-field label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.onb-field input[type="text"],
.onb-field input[type="date"],
.onb-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.onb-field input:focus,
.onb-field select:focus,
.onboarding-add select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Навигация */
.onboarding-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.onb-nav-spacer { flex: 1; }

/* Атрибут hidden сам по себе кнопки НЕ прячет: авторское правило
   .btn-primary { display: inline-flex } сильнее браузерного
   [hidden] { display: none }. Из-за этого на третьем шаге рядом
   с «Готово» оставалась кнопка «Далее» (и на загрузке были видны обе). */
.onboarding-nav [hidden] { display: none !important; }

/* ============================================================
   Мастер внутри meters.php — свёрнутый блок
   ============================================================ */

.wizard-card {
    margin-bottom: 20px;
    padding: 0;
    overflow: hidden;
}

.wizard-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    list-style: none;
    font-size: 14px;
    color: var(--text);
}
.wizard-summary::-webkit-details-marker { display: none; }
.wizard-summary:hover .wizard-summary-text strong { color: var(--primary); }

.wizard-summary-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
}

.wizard-summary-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.wizard-summary-text strong {
    font-weight: 600;
    transition: color .15s;
}
.wizard-summary-text span {
    font-size: 12.5px;
    color: var(--text-muted);
}

.wizard-summary-chevron {
    margin-left: auto;
    display: inline-flex;
    color: var(--text-muted);
    transition: transform .2s;
}
.wizard-card[open] .wizard-summary-chevron { transform: rotate(90deg); }

.wizard-body {
    padding: 0 18px 18px;
    border-top: 1px solid var(--border);
}
/* Внутри уже есть карточка страницы — вторую рамку убираем */
.wizard-body .onboarding { max-width: none; }
.wizard-body .onboarding-card {
    background: none;
    border: none;
    box-shadow: none;
    padding: 18px 0 0;
}

@media (max-width: 520px) {
    .onboarding-card { padding: 18px; }
    .onboarding-steps li { font-size: 12px; gap: 5px; }
    .onboarding-add { flex-direction: column; }
    .onb-field { min-width: 100%; }
    .onboarding-nav { flex-wrap: wrap; }
    .onb-nav-spacer { display: none; }
    .onboarding-nav .btn-primary,
    .onboarding-nav .btn-secondary { flex: 1; }
}
/* ============================================================
   Аренда: страница управления и квитанция
   ============================================================ */

/* Селекты «Квитанция за» на странице аренды */
.rental-form-select {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.rental-form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Форма генерации квитанции */
.rental-invoice-form button.btn-primary {
    margin-top: 0 !important;
}

/* Бейдж статуса арендатора на странице аренды */
.rental-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    vertical-align: middle;
}
.rental-status-badge.is-active {
    background: #d1fae5;
    color: #065f46;
}
.rental-status-badge.is-pending {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* --- Статусы договора --- */
.rental-status-badge.is-muted {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-weight: 500;
}
.rental-status-badge.is-approaching {
    background: #fef3c7;
    color: #92400e;
}
.rental-status-badge.is-soon {
    background: #ffe4e6;
    color: #9f1239;
}
.rental-status-badge.is-expired {
    background: #fee2e2;
    color: #991b1b;
}

/* --- Статусы квитанции --- */
.rental-status-badge.is-issued {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-weight: 500;
}
.rental-status-badge.is-claimed {
    background: #fef3c7;
    color: #92400e;
}
.rental-status-badge.is-confirmed {
    background: #d1fae5;
    color: #065f46;
}
.rental-status-badge.is-canceled {
    background: var(--bg);
    color: var(--text-muted);
    text-decoration: line-through;
}

/* ============================================================
   Сводка сверху страницы аренды
   ============================================================ */

.rental-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.rental-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.rental-summary-warn {
    color: #92400e;
    text-decoration: none;
    font-weight: 600;
}
.rental-summary-warn:hover {
    text-decoration: underline;
}

.rental-summary-ok {
    color: #0f7a5a;
}

/* ============================================================
   Карточка объекта аренды
   ============================================================ */

.rental-card {
    margin-bottom: 16px;
}

.rental-tenant-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 13.5px;
    color: var(--text);
}

.rental-muted {
    color: var(--text-muted);
}

.rental-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.rental-inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.rental-inline-form input[type="email"],
.rental-inline-form input[type="text"] {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.rental-inline-form input[type="email"]:focus,
.rental-inline-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ============================================================
   Раскрывающиеся блоки: условия договора, квитанции
   ============================================================ */

.rental-details {
    margin: 0 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.rental-details > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    list-style: none;
    user-select: none;
}

.rental-details > summary::-webkit-details-marker {
    display: none;
}

.rental-details > summary::after {
    content: "";
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform 0.15s ease;
}

.rental-details[open] > summary::after {
    transform: rotate(-135deg);
}

.rental-details > summary:hover {
    color: var(--primary);
}

.rental-lease-form,
.rental-invoice-list {
    padding: 4px 14px 14px;
}

.rental-lease-form .form-field {
    margin-bottom: 12px;
}

.rental-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0 12px;
    font-size: 13.5px;
    cursor: pointer;
}

.rental-check input {
    margin-top: 3px;
    flex: 0 0 auto;
}

.rental-auto-day {
    max-width: 220px;
}

/* --- Список квитанций --- */

.rental-invoice-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rental-invoice-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    font-size: 13.5px;
    transition: background 0.15s ease;
}

.rental-invoice-row:hover {
    background: var(--primary-soft);
}

.rental-invoice-period {
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.rental-invoice-sum {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}

.rental-invoice-date {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 12.5px;
}

/* ============================================================
   Памятка жильца
   ============================================================ */

.rental-memo-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rental-memo-block {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.rental-memo-block-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.rental-memo-block-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    word-break: break-word;
}

.rental-memo-updated {
    font-size: 12.5px;
}

.rental-lease-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================================
   Фото счётчика от арендатора
   ============================================================ */

.meter-photo-line {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meter-photo-label {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--text-muted);
    cursor: pointer;
}

/* Поле выбора файла — общий вид из 01-base.css, но здесь оно самое узкое
   место приложения: колонка показаний ≈ 190px. Поэтому даём ему отдельную
   строку внутри подписи и уменьшаем шрифт — кнопка «Выбрать файл» считается
   в em и ужимается вместе с ним, иначе она распирала бы ячейку. */
.meter-photo-label input[type="file"] {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
    padding: 3px;
    font-size: 11px;
}

.meter-photo-actions-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.meter-photo-preview-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--primary);
    background: var(--primary-tint, rgba(127, 184, 168, 0.12));
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: var(--radius-sm, 6px);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.meter-photo-preview-link:hover {
    background: var(--primary-soft, rgba(127, 184, 168, 0.18));
    border-color: var(--primary);
    text-decoration: none;
}
.meter-photo-preview-link svg {
    flex-shrink: 0;
}

.meter-photo-delete-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
}

.meter-photo-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 11.5px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.meter-photo-delete-btn:hover {
    color: var(--danger, #dc2626);
    background: rgba(220, 38, 38, 0.1);
}
.meter-photo-delete-btn svg {
    flex-shrink: 0;
}

/* Модалка просмотра фото счётчика */
.meter-photo-modal-content {
    max-width: 680px;
    width: 100%;
}

.meter-photo-modal-img-wrap {
    margin: 12px 0 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 70vh;
    overflow: hidden;
}

.meter-photo-modal-img {
    max-width: 100%;
    max-height: calc(70vh - 16px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: calc(var(--radius) - 2px);
}

/* ============================================================
   Плашка «вы в аренде» / «вы арендатор объекта» (app.php)
   ============================================================
   Раньше это была одна строка текста, к которой ссылки приклеивались
   через margin-left — на цветной плашке читалось плохо. Теперь статус
   слева, действия справа отдельными «таблетками». */

.rental-scope-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}

.rental-scope-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
    line-height: 1.45;
}

.rental-scope-status svg {
    flex: 0 0 auto;
}

.rental-scope-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.rental-scope-actions a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(30, 64, 175, 0.25);
    color: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease;
}

.rental-scope-actions a svg {
    flex: 0 0 auto;
}

.rental-scope-actions a:hover {
    background: #fff;
    border-color: currentColor;
}

.rental-scope-actions a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ============================================================
   Переключатель «Мой аккаунт / аренда» в шапке
   ============================================================ */

.rental-scope-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.rental-scope-switch select {
    appearance: none;
    padding: 7px 34px 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--card);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3' 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 14px center;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    max-width: 200px;
    text-overflow: ellipsis;
    transition: border-color .15s, box-shadow .15s;
}

.rental-scope-switch select:hover {
    border-color: var(--primary);
}

.rental-scope-switch select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.rental-scope-switch.is-active select {
    border-color: var(--primary);
    background-color: var(--primary-tint);
}

@media (max-width: 640px) {
    .rental-scope-switch select {
        max-width: 130px;
        padding-left: 9px;
        font-size: 12.5px;
    }
}

/* ============================================================
   Экран «Аренда входит в тариф „Аренда“»
   ============================================================ */

.rental-plan-required {
    text-align: left;
}

.rental-plan-required-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.14), rgba(13, 148, 136, 0.06));
    color: #0d9488;
}

.rental-plan-required h3 {
    justify-content: flex-start;
    margin-bottom: 8px;
}

.rental-plan-required-list {
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.rental-plan-required-list li {
    position: relative;
    padding-left: 24px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}

.rental-plan-required-list li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #0d9488;
}

.rental-plan-required-note {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

.rental-plan-required-warn {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}

.rental-plan-required-warn svg {
    flex: 0 0 auto;
    margin-top: 2px;
}

html[data-theme="dark"] .rental-plan-required-icon {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.28), rgba(13, 148, 136, 0.12));
    color: #5eead4;
}

/* ============================================================
   МАСТЕР «ЗАПОЛНИТЬ МЕСЯЦ» (quick_month.php)
   ============================================================
   Один шаг — одна услуга: показание, начисление, оплата. Экранов три:
   настройка (что заполняем), шаг, итог. Стили намеренно опираются на
   существующие классы (.card, .form-field, .btn-*), здесь только то, чего
   в них нет: прогресс, «таблетки» шагов, список услуг и итоговые блоки.

   Цвета — только переменные темы: иначе в тёмной теме блоки остались бы
   светлыми. */

/* ---------- Общее ---------- */

.qm-card {
    padding: 20px;
    margin-bottom: 16px;
}

.qm-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.qm-title svg { color: var(--primary); flex-shrink: 0; }

.qm-text {
    margin: 0 0 14px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-muted);
    max-width: 760px;
}

.qm-muted { color: var(--text-muted); }

.qm-sub {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-muted);
}

.qm-hint {
    font-weight: 400;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-left: 4px;
}

.qm-account-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

/* ---------- Экран настройки ---------- */

.qm-setup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 200px));
    gap: 12px 16px;
    margin-bottom: 18px;
}

.qm-pick-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.qm-pick-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.qm-pick-actions { display: flex; gap: 14px; }

.qm-pick-actions .btn-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
}

.qm-pick-list {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
}

.qm-pick-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    transition: border-color var(--transition);
}

.qm-pick-item:hover { border-color: var(--primary); }

/* Услуга, по которой всё заполнено, — приглушённая: отмечать её обычно не нужно */
.qm-pick-item.is-done { background: var(--card); }
.qm-pick-item.is-done .qm-pick-name { color: var(--text-muted); }

.qm-pick-item label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    margin: 0;
}

.qm-pick-item input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

.qm-pick-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.qm-pick-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

.qm-pick-hint {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* ---------- Прогресс и «таблетки» шагов ---------- */

.qm-progress { margin-bottom: 14px; }

.qm-progress-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.qm-progress-text {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.qm-progress-month {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.qm-progress-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    overflow: hidden;
}

.qm-progress-bar > span {
    display: block;
    height: 100%;
    background: var(--primary);
    transition: width var(--transition);
}

.qm-chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
}

.qm-chip a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: border-color var(--transition), color var(--transition);
}

.qm-chip a:hover { border-color: var(--primary); color: var(--text); }

.qm-chip.is-current a {
    border-color: var(--primary);
    color: var(--text);
    font-weight: 700;
}

.qm-chip.is-saved a {
    border-color: var(--success);
    color: var(--success);
}

.qm-chip.is-skipped a {
    border-style: dashed;
    color: var(--text-muted);
}

/* На узком экране в «таблетке» остаётся только значок/номер */
@media (max-width: 600px) {
    .qm-chip-name { display: none; }
}

/* ---------- Шаг ---------- */

.qm-step-card { padding: 20px; }

.qm-step-head { margin-bottom: 16px; }

.qm-form .form-row-2 { margin-bottom: 0; }

.qm-label-with-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.qm-label-with-action label {
    margin-bottom: 0;
}

.qm-fill-paid-btn {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--primary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity var(--transition);
}

.qm-fill-paid-btn:hover {
    opacity: 0.8;
}

.qm-meter {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    padding: 14px;
    margin-bottom: 16px;
}

.qm-meter-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.qm-meter-title svg { color: var(--primary); flex-shrink: 0; }

.qm-meter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.qm-calc {
    margin: 12px 0 0;
    font-size: 12.5px;
    color: var(--text-muted);
}

.qm-calc.is-value {
    color: var(--primary);
    font-weight: 600;
}

.qm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* «Сохранить и дальше» — главное действие шага, прижимаем вправо */
.qm-actions .qm-save { margin-left: auto; }
.qm-actions .qm-skip { color: var(--text-muted); }

@media (max-width: 600px) {
    .qm-actions { flex-direction: column-reverse; align-items: stretch; }
    .qm-actions .qm-save { margin-left: 0; }
    .qm-actions a, .qm-actions button { justify-content: center; }
}

/* ---------- Итог ---------- */

.qm-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.qm-summary-block {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--bg);
}

.qm-summary-ok { border-left: 3px solid var(--success); }
.qm-summary-skip { border-left: 3px solid var(--border); }

.qm-summary-head {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.qm-summary-ok .qm-summary-head svg { color: var(--success); }

.qm-summary-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.qm-summary-list li {
    font-size: 13px;
    color: var(--text);
}

.qm-summary-block .qm-muted {
    font-size: 12.5px;
    margin: 0;
}
/* ============================================================
   26. НОВЫЙ ДАШБОРД (DASHBOARD HUB)
   ============================================================ */

.dashboard-page {
    padding-bottom: 80px;
}

.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* Верхняя панель: приветствие + селектор периода */
.dashboard-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.dashboard-greeting {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

/* Период и селектор объектов */
.dashboard-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.dash-account-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 4px 0 10px;
    box-shadow: var(--shadow-sm);
    height: 42px;
}

.dashboard-account-select {
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    padding: 6px 36px 6px 4px !important;
    font-weight: 600 !important;
    font-size: 13.5px !important;
    color: var(--text) !important;
    max-width: 220px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
}

.dashboard-account-select:focus {
    outline: none !important;
}

.dashboard-period-picker {
    display: inline-flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    box-shadow: var(--shadow-sm);
}

.period-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: calc(var(--radius) - 2px);
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
}

.period-nav-btn:hover {
    background: var(--bg);
}

.period-current-label {
    font-weight: 600;
    font-size: 14.5px;
    padding: 0 12px;
    color: var(--text);
    min-width: 130px;
    text-align: center;
}

/* Smart Action Bar (срочные алерты) */
.smart-action-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.smart-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    animation: fadeIn .3s ease;
}

.smart-alert--urgent {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.smart-alert--warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.smart-alert--info {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.smart-alert-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.smart-alert-btn {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: var(--card);
    color: inherit;
    border: 1px solid currentColor;
    transition: opacity .15s, transform .15s;
    white-space: nowrap;
}

.smart-alert-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* KPI Карточки сводки */
.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.kpi-card--chart {
    padding-bottom: 12px;
}

.kpi-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-label {
    font-size: 13.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--primary);
}

.kpi-value-wrap {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.kpi-main-val {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.kpi-trend {
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.kpi-trend--up { color: #ef4444; }
.kpi-trend--down { color: #10b981; }
.kpi-trend--neutral { color: var(--text-muted); }

/* Sparkline micro-bars */
.sparkline-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 40px;
    margin-top: 4px;
    padding-top: 4px;
}

.sparkline-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: 4px;
}

.sparkline-bar {
    width: 100%;
    background: var(--primary-tint);
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    transition: height .3s ease, background-color .2s ease;
}

.sparkline-col.is-current .sparkline-bar {
    background: var(--primary);
}

.sparkline-col:hover .sparkline-bar {
    filter: brightness(0.9);
}

.sparkline-lbl {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.kpi-footer {
    font-size: 12.5px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 2px;
}

.kpi-footer strong {
    color: var(--text);
}

/* Сетка контента: 2 колонки */
.dashboard-main-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    .expense-item-row {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }
    .expense-item-left {
        flex: 1 1 100%;
    }
    .expense-item-right {
        width: 100%;
        justify-content: space-between;
        padding-top: 8px;
        border-top: 1px dashed var(--border);
    }
    .expense-item-amount {
        font-size: 15px;
    }
}

/* Блоки дашборда */
.dash-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.dash-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dash-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.dash-card-action {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.dash-card-action:hover {
    text-decoration: underline;
}

.dash-card-body {
    padding: 20px;
}

/* Инлайн-ввод счётчиков */
.meter-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.meter-quick-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    transition: border-color .15s;
}

.meter-quick-card:focus-within {
    border-color: var(--primary);
}

.meter-quick-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meter-quick-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.meter-quick-status {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.meter-status--done {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.meter-status--pending {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.meter-quick-prev {
    font-size: 12px;
    color: var(--text-muted);
}

.meter-input-row {
    display: flex;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

.meter-input-row input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.meter-input-row button,
.meter-input-row button.btn-meter-save {
    flex: 0 0 auto;
    flex-shrink: 0;
    box-sizing: border-box;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: var(--primary);
    color: var(--card);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.meter-calc-hint {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* Список начислений и оплат */
.expenses-filter-tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.expenses-tabs-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.expense-tab-btn {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .15s;
}

.expense-tab-btn.active {
    background: var(--primary-tint);
    color: var(--primary);
}

.btn-add-expense-quick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}

.btn-add-expense-quick:hover {
    background: var(--primary-tint);
    border-color: var(--primary);
}

.expenses-table-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Свайп по карточке счёта (Swipe to pay) */
.expense-swipe-wrap {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--radius) - 2px);
    background: #10b981;
    user-select: none;
    -webkit-user-select: none;
}

.expense-swipe-bg {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    padding-left: 20px;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
    z-index: 1;
    pointer-events: none;
    opacity: 0.95;
}

.expense-swipe-bg .swipe-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.expense-item-row {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    gap: 12px;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s ease;
    touch-action: pan-y;
}

.expense-item-row.is-swiping {
    transition: none !important;
}

.expense-item-row.swiped-paid {
    transform: translateX(100%);
    transition: transform 0.3s ease-out !important;
}

.expense-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.expense-item-cat {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    color: var(--primary);
    flex-shrink: 0;
}

.expense-item-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.expense-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.expense-item-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.expense-item-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.expense-item-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    text-align: right;
    white-space: nowrap;
}

.expense-pay-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}

.expense-pay-btn:hover {
    background: var(--primary);
    color: var(--card);
    border-color: var(--primary);
}

.expense-pay-btn.is-paid {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-color: transparent;
    cursor: default;
}

/* Мобильные зоны клика и touch targets (Этап 6.1) */
@media (max-width: 640px) {
    .meter-quick-grid {
        grid-template-columns: 1fr;
    }
    .meter-quick-card {
        padding: 14px 12px;
        gap: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    .meter-input-row {
        display: flex;
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
        align-items: stretch;
    }
    .meter-input-row input {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
        height: 48px;
        font-size: 16px;
        padding: 0 12px;
        font-weight: 700;
        border-radius: 8px;
        letter-spacing: 0.5px;
        box-sizing: border-box;
    }
    .meter-input-row button.btn-meter-save {
        flex: 0 0 48px;
        width: 48px;
        min-width: 48px;
        max-width: 48px;
        height: 48px;
        padding: 0;
        border-radius: 8px;
        font-size: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }
    .meter-input-row button.btn-meter-save svg {
        width: 20px;
        height: 20px;
    }
}

/* Модальное окно быстрого добавления начисления */
.quick-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

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

.quick-modal-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
}

.quick-modal.is-open .quick-modal-card {
    transform: translateY(0) scale(1);
}

.quick-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.quick-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.quick-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.quick-modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.quick-modal-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quick-type-tabs {
    display: flex;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    gap: 4px;
}

.quick-type-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    border-radius: calc(var(--radius) - 2px);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.quick-type-tab.active {
    background: var(--card);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.quick-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-field-group label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.quick-field-group input,
.quick-field-group select,
.quick-field-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.quick-field-group input:focus,
.quick-field-group select:focus,
.quick-field-group textarea:focus {
    border-color: var(--primary);
    outline: none;
}

.quick-presets-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.quick-preset-chip {
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.quick-preset-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.quick-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}

.quick-toggle-label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--card);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Telegram Синхронизация Card */
.tg-sync-banner {
    background: linear-gradient(135deg, rgba(34, 158, 217, 0.1) 0%, rgba(34, 158, 217, 0.03) 100%);
    border: 1px solid rgba(34, 158, 217, 0.3);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

/* PWA Виджет Установки на Дашборде */
.pwa-install-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.pwa-install-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.pwa-install-icon img {
    border-radius: 8px;
    display: block;
}

.pwa-install-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.pwa-install-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
}

.pwa-install-desc {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.3;
}

.pwa-card-install-btn {
    padding: 6px 12px;
    font-size: 12.5px;
    white-space: nowrap;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.tg-sync-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tg-sync-title {
    font-size: 14.5px;
    font-weight: 600;
    color: #229ed9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tg-sync-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* Инсайт месяца */
.insight-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.insight-icon {
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.insight-text {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text);
}

.insight-text strong {
    color: var(--primary);
}
/**
 * ============================================================
 *  Модуль 27: Telegram WebApp (Mini App) UI Anpassungen
 * ============================================================
 *  Оптимизация внешнего вида приложения при запуске внутри Telegram.
 *  - Плавная адаптация отступов для мобильного вьюпорта
 *  - Использование нативных цветов Telegram themeParams
 *  - Скрытие дублирующих элементов (кнопки установки PWA и т.д.)
 *  - Компактный вид шапки и панелей
 * ============================================================
 */

/* Скрытие баннеров PWA и промо-установок внутри Telegram Mini App */
.is-telegram-webapp .pwa-banner,
.is-telegram-webapp .pwa-install-btn,
.is-telegram-webapp .header-install-btn,
.is-telegram-webapp .tg-status-widget {
    display: none !important;
}

/* Компактный заголовок в Telegram WebApp */
.is-telegram-webapp .site-header {
    padding-top: max(8px, env(safe-area-inset-top));
}

/* Улучшенная прокрутка внутри Telegram Mini App */
.is-telegram-webapp body {
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

/* Оптимизация мобильной нижней навигации в Telegram */
.is-telegram-webapp .mobile-bottom-nav {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}

/* Telegram theme colors integration */
[data-theme="dark"].is-telegram-webapp {
    --bg-page: var(--tg-theme-bg-color, #0f172a);
    --text: var(--tg-theme-text-color, #f1f5f9);
}

/* Оффлайн плашка синхронизации показаний */
.offline-sync-badge {
    position: fixed;
    bottom: 74px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #f8fafc;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 9999;
}

.offline-sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    animation: offlinePulse 1.5s infinite;
}

@keyframes offlinePulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}
/* ============================================================
   90. ТЁМНАЯ ТЕМА — всё в одном месте (Этап 3)
   ============================================================
   Здесь собраны все правила html[data-theme="dark"] из остальных модулей:
   они были разбросаны по 22 файлам и мешали правкам.

   Модуль идёт последним (префикс 90) осознанно. Тёмные правила перекрывают
   светлые не порядком, а специфичностью: в селекторе есть лишний атрибут
   html[data-theme="dark"], поэтому он строго сильнее обычного селектора.
   Порядок между тёмными правилами сохранён таким же, как был.

   Перенос проверен: набор правил до и после совпадает полностью.
   ============================================================ */

html[data-theme="dark"] {
    --primary: var(--brand-mint);
    --primary-hover: #a8dadc;
    --primary-soft: rgba(127, 184, 168, 0.18);
    --primary-tint: rgba(127, 184, 168, 0.12);

    --bg: #0a1f1e;
    --card: #13312f;
    --border: #1e4844;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --row-even: #173a37;
    --row-hover: #1e4844;
    --head-bg: #1e4844;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.3);
    --log-card-bg: #0f2a28;
    --log-card-accent: var(--brand-mint);
}

html[data-theme="dark"] input[type="date"] { color-scheme: dark; }

html[data-theme="dark"] .alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.4);
}

html[data-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.4);
}

html[data-theme="dark"] .logo-icon-img {
    content: url('../icons/logo-icon-light.svg');
}

/* Тёмная тема — светлая надпись логотипа */
html[data-theme="dark"] .logo-text-img {
    content: url('../icons/logo-text-light.png');
}

/* В тёмной теме — мятная с тёмным текстом */
html[data-theme="dark"] .api-btn-primary {
    background: var(--brand-mint);
    border-color: var(--brand-mint);
}

html[data-theme="dark"] .api-btn-primary:hover {
    background: #a8dadc;
    border-color: #a8dadc;
}

html[data-theme="dark"] .api-btn-secondary:hover {
    background: #a8dadc;
    border-color: var(--brand-mint);
}

html[data-theme="dark"] .role-user      { background: rgba(127, 184, 168, 0.2); color: #a8dadc; }

html[data-theme="dark"] .role-moderator { background: rgba(168, 218, 220, 0.2); color: #7fb8a8; }

html[data-theme="dark"] .role-admin     { background: rgba(240, 160, 128, 0.2); color: #f0a080; }

html[data-theme="dark"] kbd {
    background: #173a37;
    border-color: #2a5a55;
}

html[data-theme="dark"] .recurring-item-badge {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

html[data-theme="dark"] .recurring-service-select,
html[data-theme="dark"] .recurring-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
}

/* В тёмной теме primary — мятный, поэтому текст тёмный */
html[data-theme="dark"] #hideServiceModal .btn-primary {
    color: #0a1f1e;
}

html[data-theme="dark"] .family-role-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
}

html[data-theme="dark"] .quick-status-success { color: #10b981; }

html[data-theme="dark"] .quick-status-warning { color: #fbbf24; }

html[data-theme="dark"] .quick-status-danger  { color: #f87171; }

html[data-theme="dark"] .quick-status-info    { color: #60a5fa; }

/* Плейсхолдер-подсказка в тёмной теме */
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-text,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-month-field,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-day-field,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-year-field {
    color: var(--text);
}

html[data-theme="dark"] input[type="date"]::-moz-calendar-picker-indicator {
    filter: invert(0.85);
}

/* Цветовая схема для нативного календаря */
html[data-theme="dark"] input[type="date"] {
    color-scheme: dark;
}

/* Тёмная тема */
html[data-theme="dark"] .ad-custom-banner {
    background: #1a2f4a;
    border-color: #2d4a6b;
    color: #e2e8f0;
}

html[data-theme="dark"] .ad-custom-banner a {
    color: #60a5fa;
}

/* Если тёмная тема — показываем тёмный, скрываем светлый */
html[data-theme="dark"] .ad-theme-light {
    display: none;
}

html[data-theme="dark"] .ad-theme-dark {
    display: block;
}

/* Баннер «сервис в разработке» — непрозрачный тёмный вариант
   (светлый задан в 16-account-ui.css) */
html[data-theme="dark"] .dev-banner {
    background: #33270f;
    border-bottom-color: rgba(245, 158, 11, 0.45);
    color: #fde9c8;
}

html[data-theme="dark"] .dev-banner-inner svg {
    color: #f59e0b;
}

/* Аренда: бейджи статусов и блоки (светлые заданы в 24-rental.css) */
html[data-theme="dark"] .rental-status-badge.is-active,
html[data-theme="dark"] .rental-status-badge.is-confirmed {
    background: rgba(16, 185, 129, 0.18);
    color: #6ee7b7;
}

html[data-theme="dark"] .rental-status-badge.is-pending,
html[data-theme="dark"] .rental-status-badge.is-issued,
html[data-theme="dark"] .rental-status-badge.is-muted {
    background: rgba(148, 163, 184, 0.14);
    color: var(--text-muted);
    border-color: var(--border);
}

html[data-theme="dark"] .rental-status-badge.is-claimed,
html[data-theme="dark"] .rental-status-badge.is-approaching {
    background: rgba(245, 158, 11, 0.18);
    color: #fcd34d;
}

html[data-theme="dark"] .rental-status-badge.is-soon,
html[data-theme="dark"] .rental-status-badge.is-expired {
    background: rgba(244, 63, 94, 0.18);
    color: #fda4af;
}

html[data-theme="dark"] .rental-summary-warn {
    color: #fcd34d;
}

html[data-theme="dark"] .rental-summary-ok {
    color: #6ee7b7;
}

/* Плашка аренды: «таблетки»-ссылки на тёмном фоне */
html[data-theme="dark"] .rental-scope-actions a {
    background: rgba(148, 163, 184, 0.16);
    border-color: rgba(147, 197, 253, 0.35);
}

html[data-theme="dark"] .rental-scope-actions a:hover {
    background: rgba(148, 163, 184, 0.28);
    border-color: currentColor;
}

html[data-theme="dark"] .rental-scope-switch select {
    background-color: var(--bg);
}

/* ============================================================
   ПЕЧАТЬ И ПЕЧАТНЫЙ ОТЧЁТ
   ============================================================
   Здесь две вещи:

   1. Экранные стили печатного отчёта (export_print.php) — он должен
      выглядеть документом и на экране, и на бумаге.
   2. Правила @media print: что выкинуть со всех страниц при печати
      (шапка, подвал, реклама, панели) и как вести себя таблице.

   PDF получается средствами браузера: «Печать → Сохранить как PDF».
   Своей PDF-библиотеки в проекте нет, а на хостинге нет ни одного
   конвертера и ни одного шрифта — поэтому текст отдаём браузеру:
   он делает векторный PDF с нормальной кириллицей.
   ============================================================ */

/* ---------- Экран: отчёт как документ ---------- */

.print-page {
    background: #eceae6;
    padding: 24px 0 48px;
    min-height: 100vh;
}

.print-toolbar {
    max-width: 1100px;
    margin: 0 auto 16px;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.print-toolbar-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.print-toolbar .print-toolbar-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    line-height: 1.4;
}

.print-report {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 36px 28px;
    background: #fff;
    color: #16211f;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    line-height: 1.45;
}

/* ---------- Шапка документа ---------- */

.print-head {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--brand-dark);
    margin-bottom: 18px;
}

.print-head-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.print-head-logo img {
    height: 50px;
    width: auto;
    display: block;
}

.print-head-titles {
    flex: 1 1 auto;
    min-width: 0;
}

.print-head-titles h1 {
    margin: 0 0 2px;
    font-size: 19px;
    line-height: 1.25;
    color: var(--brand-dark);
}

.print-head-titles p {
    margin: 0;
    font-size: 12.5px;
    color: #5a6b69;
}

.print-head-meta {
    flex: 0 0 auto;
    text-align: right;
    font-size: 11.5px;
    color: #5a6b69;
    line-height: 1.5;
}

/* ---------- Таблица ---------- */

.print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
    margin-bottom: 18px;
}

.print-table th,
.print-table td {
    border: 1px solid #d8d3cb;
    padding: 4px 6px;
    text-align: right;
    white-space: nowrap;
}

.print-table thead th {
    background: #f2ede6;
    color: var(--brand-dark);
    font-weight: 600;
    text-align: center;
}

.print-table th.print-col-name,
.print-table td.print-col-name {
    text-align: left;
    white-space: normal;
    min-width: 130px;
}

.print-table tbody tr:nth-child(even) td {
    background: #fbf9f7;
}

.print-table td.print-zero {
    color: #b6b0a8;
}

.print-table tfoot td,
.print-table tfoot th {
    background: #f2ede6;
    font-weight: 700;
    color: var(--brand-dark);
}

.print-table .print-total-col {
    background: #f7f3ee;
    font-weight: 600;
}

/* ---------- Сводка ---------- */

.print-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    padding: 12px 14px;
    background: #f8f6f3;
    border: 1px solid #e5e0d8;
    border-radius: var(--radius);
    margin-bottom: 18px;
}

.print-summary-item {
    min-width: 130px;
}

.print-summary-item dt {
    margin: 0 0 1px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #7d8a88;
}

.print-summary-item dd {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--brand-dark);
}

/* ---------- Задолженность ---------- */

.print-debts {
    margin-bottom: 18px;
}

.print-debts h2 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #a33a2a;
}

.print-debts table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
}

.print-debts th,
.print-debts td {
    border: 1px solid #e3c9c3;
    padding: 4px 6px;
    text-align: left;
}

.print-debts th {
    background: #fbeeeb;
    color: #8c3325;
}

.print-debts td.print-num {
    text-align: right;
    white-space: nowrap;
}

.print-debts .print-overdue {
    color: #b3341f;
    font-weight: 600;
}

/* ---------- Подвал документа ---------- */

.print-foot {
    margin-top: 16px;
    padding-top: 10px;
    border-top: 1px solid #e5e0d8;
    font-size: 11px;
    color: #7d8a88;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.print-empty {
    padding: 24px;
    text-align: center;
    color: #7d8a88;
    font-size: 13px;
}

/* ---------- Оплата в квитанции аренды ---------- */

.print-pay {
    margin-bottom: 18px;
}

.print-pay h2 {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--brand-dark);
}

.print-pay-body {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 14px;
    background: #f8f6f3;
    border: 1px solid #e5e0d8;
    border-radius: var(--radius);
}

.print-pay-qr {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #e5e0d8;
    border-radius: var(--radius);
    padding: 8px;
}

.print-pay-qr svg {
    display: block;
    width: 132px;
    height: 132px;
}

.print-pay-qr-label {
    font-size: 10.5px;
    color: #7d8a88;
    text-align: center;
    max-width: 132px;
    line-height: 1.3;
}

.print-pay-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    line-height: 1.55;
    color: #33403e;
}

.print-pay-strong {
    margin: 0 0 6px;
}

.print-pay-details {
    margin: 0 0 6px;
    white-space: pre-wrap;
}

.print-pay-link {
    margin: 0 0 6px;
    word-break: break-all;
}

.print-pay-hint {
    margin: 6px 0 0;
    font-size: 11px;
    color: #7d8a88;
    line-height: 1.45;
}

/* ---------- Статус оплаты в панели квитанции ---------- */

.print-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.print-status-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
}

.print-status-desc {
    color: var(--text-muted);
    font-size: 12.5px;
}

.print-status-amount {
    margin-left: auto;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.print-status-is-issued .print-status-main    { color: var(--text-muted); }
.print-status-is-claimed .print-status-main   { color: #92400e; }
.print-status-is-confirmed .print-status-main { color: #0f7a5a; }
.print-status-is-canceled .print-status-main  { color: #991b1b; }

.print-paybar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.print-paybar-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.print-paybar-label {
    font-size: 13px;
    color: var(--text-muted);
}

.print-paybar-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    min-width: 180px;
}

.print-paybar-amount {
    min-width: 120px;
    max-width: 160px;
    font-variant-numeric: tabular-nums;
}

.print-paybar-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.print-toolbar-flash {
    align-self: stretch;
    margin: 0;
}

/* ---------- Депозит и договор ---------- */

.print-deposit {
    margin-bottom: 18px;
    padding: 12px 14px;
    background: #f4f7f6;
    border: 1px solid #d9e3e0;
    border-radius: var(--radius);
}

.print-deposit h2 {
    margin: 0 0 6px;
    font-size: 14px;
    color: var(--brand-dark);
}

.print-deposit-line {
    margin: 0 0 4px;
    font-size: 14px;
}

.print-deposit-note {
    margin: 0 0 4px;
    font-size: 12px;
    color: #33403e;
}

.print-deposit-hint,
.print-lease {
    margin: 6px 0 0;
    font-size: 11px;
    color: #7d8a88;
    line-height: 1.45;
}

.print-lease {
    margin: 0 0 18px;
}

/* ---------- Печать ---------- */

@page {
    size: A4 landscape;
    margin: 10mm;
}

@media print {
    /* Ничего лишнего на бумаге: шапка, подвал, реклама, панели, плашки */
    .app-header,
    .app-footer,
    .landing-footer,
    .toolbar,
    .account-tabs,
    .bulk-actions-services,
    .ad-block,
    .ad-footer-wrap,
    .ad-container,
    .toast-container,
    .pwa-banner,
    .offline-indicator,
    .cache-notice,
    .no-print,
    .print-toolbar {
        display: none !important;
    }

    html,
    body {
        background: #fff !important;
        color: #000 !important;
    }

    .container,
    .print-page {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        min-height: 0 !important;
    }

    .print-report {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        font-size: 10pt;
    }

    .print-head {
        border-bottom-color: #000 !important;
    }

    .print-head-titles h1,
    .print-summary-item dd,
    .print-table tfoot td,
    .print-table tfoot th,
    .print-table thead th {
        color: #000 !important;
    }

    .print-table {
        font-size: 8.5pt;
    }

    .print-table th,
    .print-table td {
        border-color: #999 !important;
        padding: 3px 4px;
    }

    .print-table thead th,
    .print-table tfoot td,
    .print-table tfoot th {
        background: #eee !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-table tbody tr:nth-child(even) td,
    .print-table .print-total-col {
        background: transparent !important;
    }

    /* Заголовок таблицы повторяется на каждой странице, строка не рвётся */
    .print-table thead {
        display: table-header-group;
    }

    .print-table tfoot {
        display: table-footer-group;
    }

    .print-table tr,
    .print-summary,
    .print-debts tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-summary {
        background: transparent !important;
        border-color: #999 !important;
    }

    /* Оплата, депозит, договор — не рвём по страницам, фон убираем */
    .print-pay-body,
    .print-deposit {
        break-inside: avoid;
        page-break-inside: avoid;
        background: transparent !important;
        border-color: #999 !important;
    }

    .print-pay-qr {
        border-color: #999 !important;
    }

    .print-pay h2,
    .print-deposit h2,
    .print-pay-strong,
    .print-deposit-line {
        color: #000 !important;
    }

    .print-pay-hint,
    .print-pay-qr-label,
    .print-deposit-hint,
    .print-lease {
        color: #444 !important;
    }

    .print-debts th {
        background: #f3e4e0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    a {
        color: inherit !important;
        text-decoration: none !important;
    }

    /* Ссылки в тексте печатаем с адресом — иначе они бесполезны на бумаге */
    .print-link-full::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #555;
    }
}
