/**
 * ============================================
 * APP.CSS — КОРПОРАТИВНЫЕ СТИЛИ V16.3 (ОПТИМИЗИРОВАНА)
 * ============================================
 * 
 * 🔥 ОПТИМИЗАЦИЯ V16.3:
 * - Удалены неиспользуемые классы
 * - Объединены дублирующиеся медиа-запросы
 * - Убраны дублирующиеся CSS-правила
 * - Снижена избыточная специфичность
 * - Экономия: ~140 строк, ~3.5 KB
 * ============================================
 */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ===== Подзаголовок главной ===== */
.offer-sub { font-size: 1rem; font-weight: 400; color: var(--text-secondary); margin: 10px auto 22px; max-width: 560px; line-height: 1.5; text-align: center; }

/* ========== ВРЕМЕННО: ПРЕВЬЮ ВАРИАНТОВ UI + СИСТЕМА ГЛИФОВ (удалить после выбора) ========== */
.agro-icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.btn .agro-icon { width: 16px; height: 16px; }
.btn .agro-icon + span { margin-left: 6px; }

.ui-preview { margin-top: 14px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg-secondary); }
.ui-preview-title { font-weight: 700; font-size: 0.98rem; color: var(--text-primary); margin-bottom: 2px; }
.ui-preview-sub { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 12px; }
.ui-preview-card { margin-bottom: 12px; }
.ui-preview-card:last-child { margin-bottom: 0; }
.ui-preview-label { font-size: 0.84rem; font-weight: 600; color: var(--brand-dark); margin-bottom: 2px; }
.ui-preview-note { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 8px; }
.ui-preview-thumb { height: 56px; border-radius: 10px; background: linear-gradient(135deg, var(--brand-light), var(--brand-dark)); opacity: 0.18; margin-bottom: 10px; }
.ui-preview-status { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 0.8rem; color: var(--text-secondary); align-items: center; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; margin-right: 5px; vertical-align: middle; }
.dot-success { background: #2e7d32; }
.dot-warning { background: #f9a825; }
.dot-danger { background: #c62828; }
[data-theme="dark"] .dot-success { background: #66bb6a; }
[data-theme="dark"] .dot-warning { background: #ffd54f; }
[data-theme="dark"] .dot-danger { background: #ef5350; }

/* ========== ПЕРЕМЕННЫЕ ========== */
:root {
    --brand: #2d6a4f;
    --brand-dark: #1b4d3a;
    --brand-light: #40916c;
    --bg: #f6f6f2;
    --bg-secondary: #fafaf7;
    --card: #ffffff;
    --text-primary: #1c251d;
    --text-secondary: #333333;
    --text-muted: #666666;
    --border: #d8d4c8;
    --border-light: #e7e5dc;
    --shadow: rgba(0,0,0,0.06);
    --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
    --radius: 12px;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
}

/* ========== ТЁМНАЯ ТЕМА ========== */
[data-theme="dark"] {
    --bg: #121212;
    --bg-secondary: #2a2a2a;
    --card: #1e1e1e;
    --text-primary: #e8e8e0;
    --text-secondary: #d0d0d0;
    --text-muted: #a0a0a0;
    --border: #8a7a6a;
    --border-light: #4a4a4a;
    --shadow: rgba(255,255,255,0.03);
}

html { font-size: 18px; }

/* ========== ЭКРАН ЗАГРУЗКИ (без «мигания» экрана входа при F5) ========== */
.app-loading {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: var(--bg);
}
.app-loading-logo {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--brand);
    letter-spacing: -0.3px;
}
.app-loading-bar {
    width: 120px;
    height: 4px;
    border-radius: 4px;
    background: rgba(45, 106, 79, 0.15);
    overflow: hidden;
}
.app-loading-bar span {
    display: block;
    width: 40%;
    height: 100%;
    border-radius: 4px;
    background: var(--brand);
    animation: app-loading-slide 1.1s ease-in-out infinite;
}
@keyframes app-loading-slide {
    0% { transform: translateX(-110%); }
    100% { transform: translateX(310%); }
}
[data-theme="dark"] .app-loading { background: var(--bg); }

body {
    background: var(--bg);
    font-family: var(--font);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ============================================
   ОСНОВНОЙ КОНТЕЙНЕР — ЕДИНАЯ ШИРИНА 580px
   ============================================ */

#app {
    width: 100%;
    max-width: 580px !important;
    background: transparent;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    padding: 0 16px;
}

#appBlock {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* ============================================
   ЕДИНАЯ СИСТЕМА КЛАССОВ
   ============================================ */

.text-h2 { font-size: 1.5rem; font-weight: 700; }
.text-h3 { font-size: 1.3rem; font-weight: 700; }
.text-title { font-size: 1rem; font-weight: 700; }
.text-body { font-size: 1rem; font-weight: 400; }
.text-small { font-size: 0.9rem; font-weight: 400; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-semibold { font-weight: 600; }
.text-base { font-size: 1rem; }
.text-base-bold { font-size: 1rem; font-weight: 700; }
.text-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.text-decoration-underline { text-decoration: underline; }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }
.m-sm { margin: var(--space-sm); }
.m-md { margin: var(--space-md); }
.m-lg { margin: var(--space-lg); }
.m-xl { margin: var(--space-xl); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.my-md { margin-top: var(--space-md); margin-bottom: var(--space-md); }
.mt-4 { margin-top: var(--space-xs); }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: var(--space-sm); }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: var(--space-md); }
.mt-16 { margin-top: var(--space-lg); }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: var(--space-md); }
.p-4 { padding: var(--space-xs); }
.p-6 { padding: 6px; }
.p-8 { padding: var(--space-sm); }
.p-10 { padding: 10px; }
.p-12 { padding: var(--space-md); }
.p-16 { padding: var(--space-lg); }
.p-24 { padding: var(--space-xl); }
.pt-12 { padding-top: var(--space-md); }
.pb-8 { padding-bottom: var(--space-sm); }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 12px; }
.gap-md { gap: var(--space-sm); }
.gap-lg { gap: var(--space-md); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.w-full { width: 100%; }

.bg-green { background: var(--field-green); }
.bg-muted { background: var(--bg-secondary); }
.bg-done { background: #e8f5e9; }
.bg-cancelled { background: #f5f5f5; }

.border-top { border-top: 1px solid var(--border-light); }
.border-bottom { border-bottom: 1px solid var(--border-light); }
.border-left { border-left: 1px solid var(--border-light); }
.border-right { border-right: 1px solid var(--border-light); }
.border-bottom-2 { border-bottom: 2px solid var(--border-light); }

.overflow-auto { overflow-y: auto; }
.nowrap { white-space: nowrap; }
.full-width { grid-column: 1 / -1; }
.radius-8 { border-radius: var(--radius); }
.radius-6 { border-radius: 6px; }
.cursor-pointer { cursor: pointer; }

/* ============================================
   КНОПКИ
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
    min-height: 42px;
    transition: opacity 0.2s, background 0.2s, transform 0.12s ease, box-shadow 0.15s ease;
}
.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--brand-light); outline-offset: 2px; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 3px rgba(45,106,79,0.25); }
.btn-primary:hover { box-shadow: 0 3px 8px rgba(45,106,79,0.3); }
.btn-secondary { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-light); }
.btn-danger { background: #c62828; color: #fff; }
.btn-warning { background: #e67e00; color: #fff; }
.btn-outline { background: rgba(45, 106, 79, 0.06); border: 1px solid var(--brand-light); color: var(--brand); }
.btn-outline:hover { background: rgba(45, 106, 79, 0.12); border-color: var(--brand); }

/* Компактная кнопка-контур в корпоративном зелёном стиле (не только в футере) */
.btn-outline-small {
    width: auto;
    background: rgba(45, 106, 79, 0.06);
    border: 1px solid var(--brand-light);
    color: var(--brand);
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    min-height: 34px;
    transition: opacity 0.2s, background 0.2s, border-color 0.2s;
}
.btn-outline-small:hover { background: rgba(45, 106, 79, 0.12); border-color: var(--brand); color: var(--brand-dark); }
[data-theme="dark"] .btn-outline-small { background: rgba(45, 106, 79, 0.25); border-color: var(--brand-light); color: #8fc4a7; }
[data-theme="dark"] .btn-outline-small:hover { background: rgba(45, 106, 79, 0.38); border-color: var(--brand-light); }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; min-height: 30px; width: 100%; }
.btn-full {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 600;
    min-height: 48px;
    text-align: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-full:hover { opacity: 0.9; }
.btn-outline.btn-full { border: 1px solid var(--border-light); }
.btn-outline.btn-full:hover { background: var(--bg); border-color: var(--border); }

.card-actions { display: flex; flex-direction: column; gap: var(--space-sm); margin-top: 10px; margin-bottom: 10px; }
.card-actions .btn { width: 100%; }
.card-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); margin-top: 10px; }
.card-actions-grid .btn { width: 100%; }
/* Вертикальный аккордеон карточки поля (Обзор/Аналитика/Добавить работу/История работ) */
.field-card-sec { margin-top: 8px; }
.field-card-tab, .field-card-go { display: block; width: 100%; text-align: center; }
.field-card-tab-on { background: var(--brand, #1b6b3a); border-color: var(--brand, #1b6b3a); color: #fff; }
.field-card-pane { animation: accordion-in .25s ease; margin-top: 4px; }
.field-card-name { margin-bottom: 2px; }
/* Единый размер кнопок в карточке поля (секции, футер) — без разнобоя шрифта */
.field-card-tab,
.field-card-go,
.field-card-foot .btn { font-size: 0.88rem; }
.field-works-inline { border-top: 1px solid var(--border-light, #e6ede9); margin-top: 8px; padding-top: 8px; }
/* Компактная история работ: отступы и фото — как в остальных окнах, шрифты стандартные */
.field-works-inline .card { margin-bottom: 6px; }
.field-works-inline .card-body { padding: 10px 12px; overflow-wrap: anywhere; }
.field-works-inline .card-body .text-title { word-break: break-word; }
.field-works-inline .photo-preview { max-height: 90px; }
/* Мобильный-first: список полей — узкая колонка, одинакова и на телефоне, и на ПК */
#fieldsList { max-width: 720px; margin: 0 auto; width: 100%; }
#fieldsList .card-body { overflow-wrap: anywhere; }
#fieldsList .text-title { word-break: break-word; }
/* Единый размер кнопок в карточках (вариант 2: без разнобоя шрифта) */
.card-actions-grid .btn,
.card-actions .btn { font-size: 0.88rem; min-height: 40px; padding: 8px 12px; }
/* ПРАВИЛО КНОПОК (владелец): чётное — 2 в ряд; нечётное (3,5,7…) — пары + последняя во всю ширину */
.card-actions-grid .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* Миниатюра поля в карточке: свежий спутниковый снимок или плашка-ожидание */
.field-thumb { width: 100%; height: 220px; border-radius: 10px; overflow: hidden; margin-bottom: 10px; background: var(--bg-secondary); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px; }
.field-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.field-thumb-empty { border: 1px dashed var(--border-light); }
.field-thumb-icon { font-size: 1.8rem; }
.field-thumb-hint { font-size: 0.8rem; color: var(--text-muted); text-align: center; padding: 0 8px; }

/* ===== ДЕБИТОРКА / ВНЕШНИЕ ДОЛГИ: скрепка документа + ширина текста ===== */
.debtor-row { align-items: flex-start; }
.debtor-main { flex: 1; min-width: 0; }
.debtor-main .text-title { word-break: break-word; }
.debtor-side { flex-shrink: 0; text-align: right; }
.doc-clip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--border-light, #dde6e0);
    color: var(--text-muted, #5b7a6c);
    padding: 0;
    line-height: 1;
}
.doc-clip.has-doc { border-color: var(--brand, #2d6a4f); color: var(--brand, #2d6a4f); background: rgba(45,106,79,0.06); }
.doc-clip svg { width: 18px; height: 18px; }
.doc-clip:hover { background: rgba(45,106,79,0.08); }
.grid-2 .btn { width: 100%; }

/* ============================================
   ШАПКА
   ============================================ */

#header {
    background: var(--brand);
    color: #fff;
    padding: 1.2rem 1rem 0.8rem 1rem;
    text-align: center;
    margin: 0 -16px 16px -16px;
}

.header-main { font-size: 1.6rem; font-weight: 700; color: #fff; letter-spacing: 0.5px; margin-bottom: 2px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.header-brand { font-size: 1.1rem; font-weight: 400; color: rgba(255,255,255,0.85); margin-bottom: 6px; }
.header-tagline { font-size: 1.05rem; opacity: 0.85; margin-top: 4px; color: rgba(255,255,255,0.85); font-weight: 500; letter-spacing: 0.3px; }
.phone-link { margin-top: var(--space-sm); }
.phone-link a { color: #fff; text-decoration: none; font-size: 1rem; }

.header-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.15); min-height: 44px; }
.demo-badge { background: #ff9800; color: #1e2a1e; font-size: 0.85rem; font-weight: 700; padding: 4px 14px; border-radius: 40px; display: inline-block; flex-shrink: 0; }
.notifications-btn { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); border-radius: 30px; cursor: pointer; padding: 4px 14px 4px 10px; color: #fff; font-size: 0.95rem; transition: background 0.2s; min-height: 34px; flex-shrink: 0; }
.notifications-btn:hover { background: rgba(255,255,255,0.2); }
.admin-header-actions { display: flex; gap: 8px; align-items: center; }
.help-icon-static { position: static; }
.notifications-btn.admin { background: rgba(45,106,79,0.08); border-color: var(--border-light); color: var(--text); }
/* Хелп-модалка — без инлайнов. */
.help-divider { width: 60px; margin: 0 auto 16px auto; border-top: 2px solid var(--border); }
.help-body { color: var(--text-primary); line-height: 1.7; }
.help-list { list-style: disc; padding-left: 20px; margin: 0; }
/* Статус качества продукции — без инлайнов (тон из getQualityStatus). */
.q-status-pos { color: #2d6a4f; }
.q-status-warn { color: #e67e00; }
[data-theme="dark"] .q-status-pos { color: #7fd09a; }
[data-theme="dark"] .q-status-warn { color: #ffab4d; }
.notif-icon { font-size: 1.1rem; line-height: 1; }
.app-header-bottom .notif-count { position: absolute; top: -2px; right: -2px; background: #c62828; color: #fff; border-radius: 50%; min-width: 16px; height: 16px; font-size: 0.6rem; font-weight: 700; line-height: 16px; text-align: center; padding: 0 3px; }

.app-header-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; margin-bottom: 12px; border-bottom: 1px solid var(--border); min-height: 56px; }
.header-user-info { display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1.3; }
.header-user-name { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-user-role { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-divider { width: 1px; align-self: stretch; background: var(--border); flex-shrink: 0; }
.header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.header-icon-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; flex-shrink: 0; transition: background 0.15s, color 0.15s; }
.header-icon-btn:hover { background: var(--border-light); color: var(--text-primary); }
[data-theme="dark"] .header-icon-btn { color: var(--text-muted); }
[data-theme="dark"] .header-icon-btn:hover { background: var(--border-light); color: var(--text-primary); }

/* ===== ВРЕМЕННО: ВИТРИНА ВАРИАНТОВ ШАПКИ (A/B/C) ===== */
.hp { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 14px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg-secondary); }
.hp-title { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.hp-card { border: 1px solid var(--border-light); border-radius: 12px; overflow: hidden; background: var(--card); }
.hp-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; min-height: 56px; }
.hp-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.hp-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.hp-btn:hover { background: var(--border-light); color: var(--text-primary); }
.hp-dot { width: 8px; height: 8px; border-radius: 50%; background: #c62828; position: relative; top: -12px; left: -8px; flex-shrink: 0; }
.hp-label { font-size: 0.78rem; color: var(--text-muted); padding: 6px 14px 8px; border-top: 1px solid var(--border-light); }
/* A */
.hp-left-a { min-width: 0; }
.hp-a-line { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* B */
.hp-left-b { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hp-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
.hp-b-meta { min-width: 0; }
.hp-b-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-b-sub { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* C */
.hp-left-c { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.hp-c-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-c-sub { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-divider { width: 1px; align-self: stretch; background: var(--border); flex-shrink: 0; margin: 0 2px; }
[data-theme="dark"] .hp-btn { color: var(--text-muted); }
[data-theme="dark"] .hp-btn:hover { background: var(--border-light); color: var(--text-primary); }
/* Кнопки шапки приложения — на светлом фоне приложения (не белые на белом) */
.app-header-bottom .notifications-btn,
.app-header-bottom .header-mini-btn { background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-primary); }
.app-header-bottom .notifications-btn:hover,
.app-header-bottom .header-mini-btn:hover { background: var(--border-light); }
[data-theme="dark"] .app-header-bottom .notifications-btn,
[data-theme="dark"] .app-header-bottom .header-mini-btn { background: var(--bg-secondary); border-color: var(--border-light); color: var(--text-primary); }

/* ============================================
   МОДАЛЬНЫЕ ОКНА
   ============================================ */

.skeleton-loader {
    background: linear-gradient(90deg, var(--border-light) 25%, #f0efe9 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.header-mini-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 30px;
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    padding: 8px 12px;
    cursor: pointer;
    min-height: 34px;
    transition: background 0.2s, transform 0.12s;
}
.header-mini-btn:hover { background: rgba(255,255,255,0.22); }
.header-mini-btn:active { transform: scale(0.95); }

/* ===== Дебиторка: структурированные строки карточек ===== */
.debtor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.debtor-lines { display: flex; flex-direction: column; gap: 4px; }
.debtor-line { display: flex; gap: 8px; font-size: 0.85rem; line-height: 1.4; }
.debtor-key { color: var(--text-muted); flex-shrink: 0; min-width: 86px; }
.debtor-val { color: var(--text-primary); word-break: break-word; }

/* ===== Продажи: вкладки «Клиенты» / «Отгрузки» ===== */
.sales-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.sales-tab {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.sales-tab:hover { background: rgba(45, 106, 79, 0.06); }
.sales-tab-active, .sales-tab-active:hover { background: var(--brand); border-color: var(--brand); color: #fff !important; }

/* Статусы: оплачено — зелёный, долг — красный (цвет текста) */
.debtor-status { font-weight: 600; }
.debtor-status.debtor-green { color: #2e7d32; }
.debtor-status.debtor-red { color: #c62828; }
.debtor-status.debtor-yellow { color: #b26a00; }
[data-theme="dark"] .debtor-status.debtor-green { color: #66bb6a; }
[data-theme="dark"] .debtor-status.debtor-red { color: #ef5350; }
.client-contact-link {
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.client-contact-link:hover { text-decoration: underline; }
.client-email-link { white-space: normal; overflow-wrap: anywhere; }
.client-contacts { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }

/* Длинные поля в карточке/модалке: метка сверху, значение на всю ширину (для мобильного) */
.debtor-block { margin-top: 8px; }
.debtor-block:first-child { margin-top: 0; }
.debtor-block-label { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 2px; }
.debtor-block-val { font-size: 0.9rem; color: var(--text-primary); word-break: break-word; overflow-wrap: anywhere; }

/* Почта в модалке: без подписи, прижата к правому краю */
.client-line-email-right { justify-content: flex-end; }
.client-line-email-right .debtor-val { text-align: right; margin-left: auto; max-width: 100%; }
.nowrap-links { display: flex; flex-wrap: nowrap; align-items: center; overflow-x: auto; gap: 2px; min-width: 0; }
.nowrap-links a { white-space: nowrap; }
.debtor-val.nowrap-links { white-space: nowrap; }
.debtor-detail { display: flex; flex-direction: column; gap: 6px; }
.debtor-amount { font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.debtor-status { font-weight: 600; }

/* ===== Структурированные строки карточек (поля, сотрудники и др.) ===== */
.field-lines { display: flex; flex-direction: column; gap: 3px; }
.field-line { display: flex; gap: 8px; font-size: 0.85rem; line-height: 1.35; }
.field-key { color: var(--text-muted); flex-shrink: 0; min-width: 70px; }
.field-val { color: var(--text-primary); word-break: break-word; }

/* ===== Панель zoom графиков (кнопки +/−/Сброс) ===== */
.chart-zoombar { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }
.chart-zoombar .btn { min-height: 34px; font-size: 0.95rem; padding: 4px 14px; }

.report-table th, .report-table td { font-variant-numeric: tabular-nums; }
.debtor-amount, .kpi-card .v, .sum-card .v { font-variant-numeric: tabular-nums; }

/* Планшет/ПК: колонка чуть шире — «как на смартфоне», но с воздухом */
@media (min-width: 768px) {
    #app { max-width: 720px !important; padding: 0 24px; }
}
@media (min-width: 1200px) {
    #app { max-width: 760px !important; }
}

.modal-box {
    background: var(--card);
    padding: var(--space-lg) var(--space-lg) 20px var(--space-lg);
    max-width: 580px;
    width: 100%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    color: var(--text-primary);
    margin: 0 auto;
    box-sizing: border-box;
}
.modal-box * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.modal-title { font-size: 1.3rem; text-align: center; margin-bottom: 14px; color: var(--text-primary); }
.modal-body { flex: 1; }
.modal-footer { display: flex; gap: 10px; margin-top: auto; padding-top: 14px; flex-shrink: 0; }
.modal-footer .btn { flex: 1; }

#fieldModal, #expenseModal, #planModal, #actionModal,
#photoAfterModal, #editModal, #addEmployeeModal,
#equipmentModal, #repairModal, #notificationsModal,
#mapEditorModal,
.employee-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: var(--space-sm);
}

.modal-box {
    border: 1px solid var(--border-light);
    box-shadow: 0 12px 48px rgba(0,0,0,0.16);
}

#notificationsModal .modal-box {
    max-width: 580px;
    border: 2px solid var(--border);
}
#notificationsModal .notifications-list { 
    max-height: 50vh; 
    overflow-y: auto; 
    margin-bottom: var(--space-md); 
    padding: var(--space-xs) 0; 
}

/* На ПК — фиксированная ширина 580px */
@media (min-width: 768px) {
    .modal-box {
        min-width: 580px;
        width: 580px;
    }
}

/* На мобильных — 95% */
@media (max-width: 480px) {
    .modal-box {
        min-width: auto;
        width: 100%;
        max-width: 100%;
        padding: var(--space-md) var(--space-md) var(--space-lg) var(--space-md);
        border-radius: var(--space-sm);
    }
    #notificationsModal .modal-box {
        max-width: 100%;
        width: 100%;
    }
}

/* ============================================
   РЕДАКТОР КОНТУРА ПОЛЯ НА КАРТЕ (П6)
   ============================================ */
/* Режимы модалки (фикс №5, 10.09.2026): СМАРТФОН (<768px) — иммерсивно на весь
   экран: модалка 100vh/100dvh, карта занимает всё свободное место между
   заголовком/подсказкой и панелью точек/кнопками. ДЕСКТОП (>=768px) — обычная
   центрированная модалка «как у остальных» (ширина 580px, как у всех), высота под карту
   min(90vh, 900px), рамка и скругление.
   Размер карты с контейнером синхронизирует boundaryMap.js непрерывно, пока
   модалка открыта (а не первые 4 секунды): на смартфонах контейнер «доезжает»
   до финальной высоты позже — после скрытия адресной строки, дозагрузки шрифтов,
   поворота экрана; CDP-эмуляция этого не воспроизводит, отсюда «карта маленькая
   в углу» на реальном телефоне при нормальном окне модалки. */
@media (min-width: 768px) {
    #mapEditorModal {
        align-items: center;
        justify-content: center;
        padding: var(--space-sm);
        overflow-y: auto;
    }
    #mapEditorModal .modal-box {
        position: relative;
        width: 580px;
        max-width: 580px;
        height: min(90vh, 900px);
        max-height: none;
        margin: auto;
        border-radius: 12px;
        border: 1px solid var(--border-light);
        box-shadow: 0 12px 48px rgba(0, 0, 0, 0.16);
        padding: var(--space-md) var(--space-lg) var(--space-sm);
    }
}
@media (max-width: 767px) {
    #mapEditorModal {
        align-items: stretch;
        padding: 0;
        overflow-y: auto;
    }
    #mapEditorModal .modal-box {
        position: relative;
        width: 100%;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        margin: 0;
        border-radius: 0;
        border: none;
        padding: calc(var(--space-sm) + 6px) var(--space-md) var(--space-sm);
    }
}
/* Собственный canvas-рендерер (10.09.2026): карта рисуется на <canvas>, который
   ВСЕГДА равен фактическому размеру контейнера .boundary-map-wrap (размер читается
   через ResizeObserver). Баг «карта маленькая в углу» здесь невозможен. */
.boundary-map-wrap .boundary-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
    background: #2b2b2b;
}
.boundary-map-wrap .boundary-canvas:active { cursor: grabbing; }
/* Заголовок, подсказка, тулбар и футер НЕ сжимаются; карта — единственный
   «дышащий» элемент колонки (flex: 1 1 auto ниже) и сама подстраивается. */
#mapEditorModal .modal-box > :not(.boundary-map-stage):not(.modal-close) { flex-shrink: 0; }
.boundary-map-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 240px;
    width: 100%;
    margin: 8px 0 6px;
    z-index: 0;
}
/* Карта заполняет сцену на 100% (размер читается через ResizeObserver) — «в углу» невозможна. */
.boundary-map-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    z-index: 0;
}
/* Плавающий блок масштаба «+/−» как в лучших картах (Google Maps / Яндекс). */
.boundary-zoom {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
}
.btn-zoom {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.94);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
    color: #222;
    cursor: pointer;
    user-select: none;
}
.btn-zoom:active { background: rgba(230, 230, 230, 0.96); }
.boundary-map-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
}
.boundary-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}
.boundary-toolbar .btn { min-height: 34px; }
/* Ручной ввод точек по координатам — структурированная панель под картой. */
.boundary-manual {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 10px;
    background: var(--bg-secondary);
}
.boundary-manual .form-input { width: 100%; max-width: none; }
.boundary-manual .btn { min-height: 34px; }
.boundary-pts-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.boundary-pts-title { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); }
.boundary-pts-count { font-size: 0.8rem; color: var(--text-muted); }
/* Список всех точек контура в доп-блоке (двусторонняя синхронизация с картой). */
.boundary-pts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
}
.boundary-pts-empty { font-size: 0.8rem; color: var(--text-muted); }
.boundary-pt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-secondary);
    cursor: pointer;
}
.boundary-pt-n {
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}
.boundary-pt-c {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text-primary);
    font-family: monospace;
}
.boundary-pt-del {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 6px;
}
.boundary-pt-del:hover { color: #b3261e; background: rgba(0, 0, 0, 0.05); }
/* Поле ввода координат (одна строка) + кнопка «Добавить точку» + список точек. */

/* Переключатель подложки «Спутник / Схема» в редакторе контура (09.09.2026): спутник
   Esri World Imagery — подложка по умолчанию (границы полей видно лучше всего), схема
   OSM — по кнопке. Кнопки-пилюли компактны и не съедают высоту карты. */
.basemap-switch {
    display: inline-flex;
    gap: 4px;
    margin-right: 2px;
}
.basemap-switch .btn { padding: 4px 10px; min-height: 30px; font-size: 0.78rem; }
.basemap-switch .btn.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.basemap-switch .btn.is-active:hover { opacity: 0.92; }
.boundary-count {
    margin-left: auto;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.boundary-count.is-ready { color: #2d6a4f; }
.boundary-count.is-short { color: #b07d2b; }
/* Секция «Контур поля» в единой модалке поля */
.boundary-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 10px;
}
.boundary-status { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }
.boundary-status.is-set { color: #2d6a4f; }
@media (max-width: 600px) {
    #mapEditorModal .modal-box { padding: calc(var(--space-sm) + 2px) 8px var(--space-sm); }
    #mapEditorModal h3 { margin-bottom: 8px; }
    #mapEditorModal .boundary-map-hint { margin-bottom: 4px; }
}

/* ============================================
   УВЕДОМЛЕНИЯ
   ============================================ */

.notification-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background 0.2s; }
.notification-item:hover { background: var(--bg-secondary); }
.notification-item.unread { background: var(--bg-secondary); border-left: 3px solid var(--brand); }
.notification-item .notif-icon { font-size: 1.4rem; flex-shrink: 0; }
.notification-item .notif-content { flex: 1; min-width: 0; }
.notification-item .notif-title { font-weight: 700; font-size: 1.1rem; color: var(--text-primary); }
.notification-item .notif-message { font-size: 1rem; color: var(--text-secondary); margin-top: 2px; }
.notification-item .notif-date { font-size: 0.9rem; color: var(--text-muted); margin-top: var(--space-xs); }
.notification-item .notif-read { font-size: 0.7rem; color: var(--text-muted); flex-shrink: 0; margin-top: 2px; }
.notification-item .notif-read.read { color: var(--brand); }

.notification-critical { background: rgba(198,40,40,0.08) !important; border-left: 4px solid #c62828 !important; }
.notification-reminder { background: rgba(230,126,0,0.06) !important; border-left: 4px solid #e67e00 !important; }
[data-theme="dark"] .notification-critical { background: rgba(198,40,40,0.15) !important; }
[data-theme="dark"] .notification-reminder { background: rgba(230,126,0,0.10) !important; }

.notif-dismiss-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.8rem; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; transition: color 0.2s; line-height: 1; }
.notif-dismiss-btn:hover { color: #c62828; }
[data-theme="dark"] .notif-dismiss-btn { color: #a0a0a0; }
[data-theme="dark"] .notif-dismiss-btn:hover { color: #ef5350; }

.notif-snooze-btn { background: none; border: 1px solid var(--border-light); color: var(--text-muted); cursor: pointer; font-size: 0.7rem; padding: 2px 8px; border-radius: 4px; flex-shrink: 0; transition: all 0.2s; line-height: 1; }
.notif-snooze-btn:hover { border-color: var(--brand); color: var(--brand); }
[data-theme="dark"] .notif-snooze-btn { border-color: #4a4a4a; color: #a0a0a0; }
[data-theme="dark"] .notif-snooze-btn:hover { border-color: #40916c; color: #40916c; }

/* ============================================
   ФОРМЫ
   ============================================ */

.form-label { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); display: block; margin-bottom: var(--space-xs); }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    margin-bottom: var(--space-md);
    min-height: 38px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--brand-light);
    box-shadow: 0 0 0 3px rgba(64,145,108,0.15);
    background: var(--card);
}
.form-textarea { min-height: 60px; resize: vertical; }
.form-group { margin-bottom: var(--space-md); }

[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #2a2a2a; color: #e8e8e0; border-color: #4a4a4a; }
[data-theme="dark"] input::placeholder, [data-theme="dark"] textarea::placeholder { color: #888888; }
[data-theme="dark"] .form-label { color: #d0d0d0; }
[data-theme="dark"] .form-input, [data-theme="dark"] .form-select, [data-theme="dark"] .form-textarea { background: #2a2a2a; color: #e8e8e0; border-color: #4a4a4a; }

/* ============================================
   ИНФО-БЛОКИ
   ============================================ */

.info-box { padding: var(--space-md); border-radius: var(--radius); margin-bottom: 14px; font-size: 0.95rem; border-left: 4px solid var(--brand); }
.info-success { background: #e8f5e9; border-left-color: #2d6a4f; }
.info-warning { background: #fff3e0; border-left-color: #e67e00; }
.info-danger { background: #ffebee; border-left-color: #c62828; }
.info-muted { background: var(--bg-secondary); border-left-color: var(--text-muted); }

[data-theme="dark"] .modal-box .info-box { background: #2a2a2a; color: #e8e8e0; }
[data-theme="dark"] .modal-box .info-box .text-muted { color: #a0a0a0; }
[data-theme="dark"] .modal-box .info-box.info-success { background: #1a3a2a; border-left-color: #2d6a4f; }
[data-theme="dark"] .modal-box .info-box.info-danger { background: #3a1a1a; border-left-color: #c62828; }
[data-theme="dark"] .modal-box .info-box.info-warning { background: #3a3a1a; border-left-color: #e67e00; }

/* ============================================
   КАРТОЧКИ
   ============================================ */

.card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: var(--space-sm);
    background: var(--card);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.07);
    transform: translateY(-1px);
    border-color: var(--border);
}
.card-body { padding: var(--space-lg); line-height: 1.2; }
[data-theme="dark"] .card { border-color: #3a3a3a; box-shadow: none; }
[data-theme="dark"] .card:hover { border-color: #4a4a4a; box-shadow: 0 4px 14px rgba(0,0,0,0.4); }
[data-theme="dark"] .card-body { background: #1e1e1e; }

/* ============================================
   БЕЙДЖИ
   ============================================ */

.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; background: #e0e0e0; color: #666; }
.badge-critical { background: #c62828; color: #fff; }
.badge-high { background: #e67e00; color: #fff; }
.badge-medium { background: #f9a825; color: #1e2a1e; }
.badge-low { background: #2d6a4f; color: #fff; }

[data-theme="dark"] .badge { background: #3a3a3a; color: #d0d0d0; }
[data-theme="dark"] .badge-critical { background: #c62828; color: #fff; }
[data-theme="dark"] .badge-high { background: #e67e00; color: #fff; }
[data-theme="dark"] .badge-medium { background: #f9a825; color: #1e2a1e; }
[data-theme="dark"] .badge-low { background: #2d6a4f; color: #fff; }

/* ============================================
   СТАТУСЫ
   ============================================ */

.status-critical { color: #c62828; font-weight: 600; }
.status-warning { color: #e67e00; font-weight: 600; }
.status-success { color: #2d6a4f; font-weight: 600; }
.status-muted { color: var(--text-muted); font-weight: 600; }
.status-pending { color: #999; }
.status-in_progress { color: #e67e00; }
.status-done { color: #2d6a4f; }
.status-cancelled { color: #999; }
.status-overdue { color: #c62828; }
.status-working { color: #2d6a4f; }
.status-repair { color: #c62828; }
.status-waiting { color: #e67e00; }

[data-theme="dark"] .status-muted { color: #a0a0a0; }
[data-theme="dark"] .status-pending { color: #a0a0a0; }
[data-theme="dark"] .status-in_progress { color: #e67e00; }
[data-theme="dark"] .status-done { color: #2d6a4f; }
[data-theme="dark"] .status-cancelled { color: #a0a0a0; }
[data-theme="dark"] .status-overdue { color: #c62828; }
[data-theme="dark"] .status-working { color: #2d6a4f; }
[data-theme="dark"] .status-repair { color: #c62828; }
[data-theme="dark"] .status-waiting { color: #e67e00; }

/* ============================================
   СПИСКИ
   ============================================ */

.list-item { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 0.9rem; color: var(--text-secondary); }
.list-item:last-child { border-bottom: none; }
[data-theme="dark"] .list-item { color: #d0d0d0; border-color: #4a4a4a; }
[data-theme="dark"] .list-item .text-muted { color: #a0a0a0; }

/* ============================================
   ФОТО
   ============================================ */

.photo-preview { max-width: 100%; max-height: 120px; border-radius: var(--radius); border: 1px solid var(--border-light); object-fit: contain; }
.photo-preview-sm { max-width: 60px; max-height: 60px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border-light); object-fit: cover; }
.photo-preview-sm:hover { border-color: var(--brand); }
[data-theme="dark"] .photo-preview { border-color: #4a4a4a; }
[data-theme="dark"] .photo-preview-sm { border-color: #4a4a4a; }

/* ============================================
   АККОРДЕОНЫ
   ============================================ */

.accordion-section { margin: 0 -16px; background: transparent; overflow: hidden; }
.accordion-section + .accordion-section { border-top: 1px solid var(--border-light); }

.accordion-header {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-secondary);
    cursor: pointer;
    border-radius: 0;
    margin: 0;
    border: none;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}
.accordion-header:hover { background: var(--bg); }
.accordion-header h2 { grid-column: 2; justify-self: center; color: var(--brand); font-size: 1.4rem; font-weight: 700; margin: 0; text-align: center; letter-spacing: 0.3px; }
.accordion-header .accordion-icon { grid-column: 3; justify-self: end; font-size: 1rem; transition: transform 0.25s ease; color: var(--brand); }
.accordion-content { padding: var(--space-lg) 20px; background: transparent; animation: accordion-in 0.22s ease; transition: max-height 0.25s ease; overflow: hidden; }
@keyframes accordion-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

/* ===== Плашка склада продукции: название + кнопка «Подробнее» ===== */
.storage-plate { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.storage-plate .btn-outline-small {
    width: auto;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}
.storage-plate .btn-outline-small:hover { background: rgba(255, 255, 255, 0.28); }

/* ===== Свёрнутые блоки внутри аккордеона (дебиторка/внешние долги/расходы/отчёты) ===== */
.nested-section { margin-top: 12px; }
.nested-section-header {
    display: grid;
    grid-template-columns: 32px 1fr 32px;
    align-items: center;
    padding: 12px 14px;
    background: rgba(45, 106, 79, 0.05);
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.nested-section-header:hover { background: rgba(45, 106, 79, 0.1); }
.nested-section-header h4 {
    grid-column: 2;
    justify-self: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand);
    margin: 0;
    text-align: center;
    letter-spacing: 0.3px;
}
.nested-section-header .accordion-icon {
    grid-column: 3;
    justify-self: end;
    font-size: 0.95rem;
    color: var(--brand);
    transition: transform 0.25s ease;
}
.nested-section-body { padding: 10px 2px 0; transition: max-height 0.25s ease; overflow: hidden; }
[data-theme="dark"] .nested-section-header { background: rgba(64, 145, 108, 0.12); }
[data-theme="dark"] .nested-section-header:hover { background: rgba(64, 145, 108, 0.2); }

[data-theme="dark"] .accordion-header { background: #1a1a1a; border-color: #4a4a4a; }
[data-theme="dark"] .accordion-header:hover { background: #2a2a2a; }
[data-theme="dark"] .accordion-header h2 { color: #40916c; }
[data-theme="dark"] .accordion-header .accordion-icon { color: #40916c; }
[data-theme="dark"] .accordion-section + .accordion-section { border-color: #4a4a4a; }

.nested-accordion-section { margin: 0 0 1rem 0; background: transparent; overflow: hidden; }
.nested-accordion-header { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 0; background: transparent; cursor: pointer; border-bottom: 2px solid var(--border-light); }
.nested-accordion-header h4 { font-size: 1.1rem; font-weight: 600; margin: 0; color: var(--text-primary); display: flex; align-items: center; gap: 10px; justify-content: center; }
.nested-accordion-icon { font-size: 1rem; transition: transform 0.2s; color: var(--brand); }
.nested-accordion-content { padding: 1rem 0; background: transparent; transition: max-height 0.25s ease; overflow: hidden; }
[data-theme="dark"] .nested-accordion-header { border-color: #4a4a4a; }
[data-theme="dark"] .nested-accordion-header h4 { color: #e8e8e0; }
[data-theme="dark"] .nested-accordion-icon { color: #40916c; }

/* ===== ЕДИНЫЙ help-icon (без дубля) ===== */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--brand);
    color: #ffffff;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1;
}
.help-icon:hover {
    background: var(--brand-dark);
    transform: scale(1.05);
}

.accordion-header .help-icon { grid-column: 1; justify-self: start; }

/* ===== ОТЧЁТЫ (Этап A-FRONT, AF2) ===== */
.report-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.report-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border-light);
    border-radius: 20px;
    background: var(--bg-secondary, rgba(45,106,79,0.06));
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.report-chip:hover {
    background: var(--brand, #2d6a4f);
    border-color: var(--brand, #2d6a4f);
    color: #fff;
}
.report-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.report-table th {
    text-align: left;
    padding: 10px 12px;
    background: rgba(45,106,79,0.08);
    color: var(--text-primary);
    font-weight: 700;
    white-space: nowrap;
}
.report-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
.report-table tbody tr:nth-child(even) { background: rgba(45,106,79,0.04); }
.report-table tbody tr:hover { background: rgba(45,106,79,0.09); }

/* ===== ДЕБИТОРКА (постоянный блок в «Финансы и аналитика») ===== */
.debtor-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.debtor-main { min-width: 0; flex: 1 1 auto; }
.debtor-side { text-align: right; }
.debtor-amount { font-weight: 700; font-size: 1.05rem; color: var(--text-primary); }
.debtor-status { font-size: 0.85rem; margin-top: 2px; }
.debtor-total { color: #c62828; }
.card.debtor-red { border-left: 4px solid #c62828; }
.card.debtor-yellow { border-left: 4px solid #f9a825; }
.card.debtor-green { border-left: 4px solid #2e7d32; }
.card.debtor-neutral { border-left: 4px solid #9e9e9e; }
.debtor-pay { font-size: 0.8rem; padding: 6px 12px; }
.report-season {
    padding: 6px 10px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-secondary, #ffffff);
    color: var(--text-primary);
    font-size: 0.9rem;
}
.sat-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 130px;
    overflow-x: auto;
    padding: 8px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: rgba(45,106,79,0.03);
}
.hybrid-badge {
    display: inline-block;
    background: rgba(45,106,79,0.12);
    border: 1px solid rgba(45,106,79,0.3);
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 0.8rem;
    color: var(--text-primary);
}

/* ============================================
   ТИПОГРАФИКА
   ============================================ */

h1 { font-size: 1.6rem; font-weight: 700; margin: 0; text-align: center; }
h2 { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--brand); text-align: center; }
h3 { font-size: 1.2rem; font-weight: 600; margin: 0 0 12px 0; color: var(--brand); text-align: center; }
h4 { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--text-primary); text-align: center; }
h5 { font-size: 1rem; font-weight: 600; margin: 0; color: var(--text-secondary); text-align: center; }
p, li, span, label, input, select, textarea, button, div { font-size: 1rem; line-height: 1.6; }
.small-text { font-size: 0.9rem; }

/* ============================================
   АВТОРИЗАЦИЯ
   ============================================ */

#authBlock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    margin: 0 -16px;
    padding-bottom: env(safe-area-inset-bottom);
    background:
        linear-gradient(180deg, rgba(45, 106, 79, 0.07) 0%, rgba(45, 106, 79, 0) 45%),
        var(--bg);
}

/* ===== ЛОГОТИП ГЛАВНОЙ (главный элемент, крупнее слогана) ===== */
.auth-logo {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-align: center;
    margin: clamp(1.5rem, 7vw, 2.5rem) 0 10px;
}

/* ===== СЛОГАН (вторичный, меньше логотипа) ===== */
.offer-title {
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    text-align: center;
    text-wrap: balance;
    margin: 0 24px clamp(1.4rem, 5vw, 2.2rem);
    max-width: 520px;
}

/* Плавное появление главной */
@keyframes auth-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.auth-logo, .offer-title, .auth-container { animation: auth-fade 0.5s ease both; }

.auth-container {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    padding: 26px 22px;
    margin: 0 0 var(--space-lg);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    border: 1px solid var(--border-light);
}
.auth-tabs { display: flex; gap: var(--space-md); margin-bottom: 24px; }
.auth-tab { flex: 1; padding: var(--space-md); background: transparent; color: var(--text-secondary); border: 1px solid var(--border-light); font-size: 1.1rem; width: auto; cursor: pointer; border-radius: var(--radius); }
.auth-tab.active { background: var(--brand); color: #fff; }
.auth-form h2 { font-size: 1.35rem; margin: 0 0 20px; text-align: center; color: var(--text-primary); letter-spacing: -0.01em; }
.auth-form .form-input { margin-bottom: 14px; text-align: center; }
.auth-form .form-input::placeholder { text-align: center; }
.auth-form .btn { margin-top: 6px; }

/* ===== ПОДРАЗДЕЛЫ ВНУТРИ АККОРДЕОНА «ПОЛЯ» (спутник + события) ===== */
.sub-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}
.sub-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.demo-access-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-light); }
.demo-divider { text-align: center; margin-bottom: var(--space-lg); }
.demo-divider span { font-size: 1rem; font-weight: 700; letter-spacing: 1px; color: var(--brand); background: var(--card); padding: 0 var(--space-lg); }
.demo-buttons { display: flex; flex-direction: column; gap: 10px; }
.demo-btn { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 14px; padding: var(--space-lg) 20px; background: var(--bg-secondary); border: 2px solid var(--border-light); border-radius: 12px; cursor: pointer; width: 100%; transition: all 0.2s; }
.demo-btn:hover { background: #e8f5e9; border-color: var(--brand); transform: translateY(-2px); }
.demo-icon { font-size: 1.8rem; flex-shrink: 0; }
.demo-label { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); text-align: center; }

[data-theme="dark"] .demo-btn:hover { background: #1a3a2a; }

.auth-footer-bottom { margin-top: 10px; padding: 20px; text-align: center; background: var(--bg-secondary); border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light); font-size: 0.95rem; color: var(--text-muted); }
.auth-footer-bottom a { color: var(--brand); text-decoration: none; }

/* ============================================
   ПОГОДА
   ============================================ */

.weather-card { margin-bottom: 1.2rem; padding: 1.2rem; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--radius); }
.weather-header { text-align: center; margin-bottom: 14px; }
.weather-header h3 { font-size: 1.3rem; font-weight: 700; margin: 0; color: var(--text-primary); }

.weather-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1rem;
}
.weather-row:last-child { border-bottom: none; }
.weather-row-left { display: flex; align-items: center; gap: 10px; }
.weather-row-icon { font-size: 1.8rem; }
.weather-row-day { font-weight: 600; }
.weather-row-right { display: flex; align-items: center; gap: 16px; }
.weather-row-temp { font-weight: 600; }

[data-theme="dark"] .weather-row { border-bottom-color: #4a4a4a; }
[data-theme="dark"] .weather-row-day { color: #e8e8e0; }
[data-theme="dark"] .weather-row-temp { color: #e8e8e0; }

.weather-container { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Правило «2 дня в строку + 3-й внизу по центру» (решение владельца) */
.weather-day-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.weather-day-card { flex: 1; text-align: center; padding: 14px; background: rgba(255,255,255,0.6); border-radius: var(--radius); }
.weather-extra { font-size: 0.85rem; color: var(--text-muted); margin-top: 3px; }
.weather-day-name { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.weather-icon { font-size: 0.9rem; font-weight: 600; color: var(--brand); min-height: 20px; line-height: 1.2; margin: var(--space-sm) 0; overflow-wrap: break-word; }
.weather-temp { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.weather-tip { font-size: 1rem; margin-top: 1rem; padding: 10px; background: rgba(255,255,255,0.6); text-align: center; border-radius: var(--radius); }
.emulation-note { font-size: 0.85rem; color: var(--text-muted); text-align: center; margin-top: 10px; padding-top: var(--space-sm); border-top: 1px solid var(--border-light); }

[data-theme="dark"] .weather-card { background: #1e1e1e; border-color: #4a4a4a; }
[data-theme="dark"] .weather-day-card { background: #2a2a2a; color: #e8e8e0; }
[data-theme="dark"] .weather-day-card .weather-day-name { color: #a0a0a0; }
[data-theme="dark"] .weather-day-card .weather-temp { color: #e8e8e0; }
[data-theme="dark"] .weather-tip { background: #2a2a2a; color: #e8e8e0; border: 1px solid #4a4a4a; }
[data-theme="dark"] .weather-header h3 { color: #e8e8e0; }
[data-theme="dark"] .emulation-note { color: #a0a0a0; border-color: #4a4a4a; }

/* ============================================
   АНАЛИТИКА
   ============================================ */

#filterStatus { display: none !important; }

.season-select-wrapper { display: flex; justify-content: center; align-items: center; padding: var(--space-sm) 0 var(--space-md) 0; border-bottom: 1px solid var(--border-light); margin-bottom: var(--space-md); }
.season-select-wrapper select { padding: var(--space-sm) var(--space-lg); font-size: 1rem; border-radius: 6px; border: 1px solid var(--border-light); background: var(--bg-secondary); min-height: 40px; color: var(--text-primary); text-align: center; text-align-last: center; cursor: pointer; min-width: 120px; }
[data-theme="dark"] .season-select-wrapper select { background: #2a2a2a; color: #e8e8e0; border-color: #4a4a4a; }

.analytics-card-field { margin-bottom: 1.2rem; padding: 1rem 1.2rem; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--radius); }
.analytics-card-header { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.analytics-card-header h3 { font-size: 1.2rem; font-weight: 700; margin: 0; color: var(--text-primary); display: flex; align-items: center; gap: 10px; justify-content: center; text-align: center; }
.analytics-card-content { font-size: 1rem; }

.finance-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-md); margin-bottom: 0.5rem; }
.finance-card { background: var(--bg-secondary); padding: 14px; text-align: center; border-radius: var(--radius); }
.finance-card .label { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.finance-card .value { font-size: 1.4rem; font-weight: 700; color: var(--brand); }

/* ============================================
   ДАШБОРДЫ
   ============================================ */

.dashboard-card { margin-bottom: var(--space-lg); }
.dashboard-card .card-body { padding: var(--space-lg); }
.dashboard-title { font-size: 1.2rem; font-weight: 700; text-align: center; color: var(--brand); margin-bottom: var(--space-lg); }
[data-theme="dark"] .dashboard-title { color: #40916c; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.stats-grid .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }

.stat-card { background: var(--bg-secondary); padding: var(--space-md) var(--space-sm); border-radius: var(--radius); text-align: center; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.stat-card.stat-critical .stat-value { color: #c62828; }
.stat-card.stat-success .stat-value { color: #2d6a4f; }
.stat-card.stat-warning .stat-value { color: #e67e00; }

[data-theme="dark"] .stat-card { background: #2a2a2a; }
[data-theme="dark"] .stat-card .stat-value { color: #e8e8e0; }

.dashboard-details { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); margin-top: var(--space-md); }
.dashboard-details .detail-block { background: var(--bg-secondary); padding: var(--space-md); border-radius: var(--radius); }
.detail-block .detail-title { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-sm); padding-bottom: 6px; border-bottom: 1px solid var(--border-light); }
.detail-block .detail-item { display: flex; justify-content: space-between; padding: var(--space-xs) 0; font-size: 0.95rem; color: var(--text-primary); }
.detail-block .detail-item .value { font-weight: 600; }

[data-theme="dark"] .dashboard-details .detail-block { background: #2a2a2a; }
[data-theme="dark"] .detail-block .detail-title { color: #d0d0d0; }
[data-theme="dark"] .detail-block .detail-item { color: #e8e8e0; }

.dashboard-list { margin-top: var(--space-md); padding-top: var(--space-md); border-top: 1px solid var(--border-light); }
.dashboard-list .list-title { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-sm); }
.dashboard-list .list-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 0.95rem; border-bottom: 1px solid var(--border-light); }
.dashboard-list .list-item:last-child { border-bottom: none; }
.dashboard-list .list-item .progress-bar { flex: 1; height: 6px; background: var(--border-light); border-radius: 4px; margin: 0 10px; overflow: hidden; }
.dashboard-list .list-item .progress-bar .progress-fill { height: 100%; border-radius: 4px; background: var(--brand); }

.dashboard-total { margin-top: var(--space-md); padding: 10px var(--space-md); background: var(--bg-secondary); border-radius: var(--radius); display: flex; justify-content: space-between; font-weight: 700; font-size: 1.05rem; }
[data-theme="dark"] .dashboard-total { background: #2a2a2a; }

/* ============================================
   ПОДВАЛ
   ============================================ */

#footer { margin-top: auto; text-align: center; padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); background: var(--brand); color: #fff; margin: 0 -16px; }
.footer-buttons { display: flex; gap: 14px; margin-bottom: 18px; justify-content: center; flex-wrap: wrap; }
.footer-buttons .btn-outline-small { background: transparent; color: #ffffff; border: 1.5px solid rgba(255,255,255,0.4); width: auto; padding: var(--space-sm) 18px; font-size: 0.95rem; border-radius: var(--radius); cursor: pointer; min-height: 40px; transition: all 0.25s ease; font-weight: 500; letter-spacing: 0.3px; }
.footer-buttons .btn-outline-small:hover { background: rgba(255,255,255,0.15); border-color: #ffffff; transform: translateY(-2px); }
.footer-buttons .btn-outline-small:active { transform: translateY(0px); background: rgba(255,255,255,0.25); }
.footer-buttons .btn-outline-small:last-child { border-color: rgba(255,150,150,0.35); }
.footer-buttons .btn-outline-small:last-child:hover { border-color: #ff6b6b; background: rgba(255,100,100,0.15); }
#themeToggleBtn { border-color: rgba(255,255,255,0.3) !important; }
#themeToggleBtn:hover { border-color: #ffd700 !important; background: rgba(255,215,0,0.15) !important; }

[data-theme="dark"] .footer-buttons .btn-outline-small { border-color: rgba(255,255,255,0.2); }
[data-theme="dark"] .footer-buttons .btn-outline-small:hover { background: rgba(255,255,255,0.05); }

.footer-info { font-size: 0.95rem; opacity: 0.95; line-height: 1.6; }
.footer-info p { margin: 6px 0; }
.footer-contacts a { color: #fff; text-decoration: none; font-size: 0.95rem; }

/* ============================================
   TOAST — ВСПЛЫВАЮЩИЕ УВЕДОМЛЕНИЯ
   ============================================ */

.toast-notification,
body > .toast-notification {
    position: fixed !important;
    top: 24px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: var(--brand, #2d6a4f) !important;
    color: #ffffff !important;
    padding: var(--space-md, 12px) 28px !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    z-index: 10005 !important;
    max-width: 90% !important;
    text-align: center !important;
    border-radius: 30px !important;
    transition: all 0.3s ease !important;
    border: 3px solid #ffffff !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.2) !important;
}
.toast-notification.warning { background: #e67e00 !important; }
.toast-notification.success { background: var(--brand, #2d6a4f) !important; }
.toast-notification.error { background: #c62828 !important; }

[data-theme="dark"] .toast-notification,
[data-theme="dark"] body > .toast-notification {
    background: #2a2a2a !important;
    border-color: var(--border, #8a7a6a) !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6) !important;
}
[data-theme="dark"] .toast-notification.warning { background: #8a5a00 !important; }
[data-theme="dark"] .toast-notification.success { background: #1a3a2a !important; }
[data-theme="dark"] .toast-notification.error { background: #3a1a1a !important; }

/* ============================================
   ГАЛЕРЕЯ ФОТО
   ============================================ */

.photo-gallery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.92);
    z-index: 10002;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.photo-gallery-image { max-width: 95%; max-height: 85vh; border-radius: var(--radius); object-fit: contain; transition: opacity 0.3s; cursor: default; }
.photo-gallery-info { color: #fff; text-align: center; padding: 10px 20px; font-size: 0.9rem; opacity: 0.8; background: rgba(0,0,0,0.5); border-radius: var(--radius); margin: 10px; }
.photo-gallery-info .count { opacity: 0.6; margin-left: var(--space-md); }
.photo-gallery-nav { display: flex; gap: 20px; padding: 10px 20px; align-items: center; width: 100%; justify-content: center; }
.photo-gallery-nav button { padding: var(--space-md) 20px; font-size: 1.5rem; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3); border-radius: var(--radius); color: #fff; cursor: pointer; transition: background 0.2s; }
.photo-gallery-nav button:hover { background: rgba(255,255,255,0.2); }
.photo-gallery-nav .close-btn { font-size: 1rem; padding: var(--space-md) 24px; }

[data-theme="dark"] .photo-gallery-info { background: rgba(0,0,0,0.7); }

/* ============================================
   КАПЧА
   ============================================ */

.captcha-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}
.captcha-modal { background: var(--card); max-width: 400px; width: 90%; margin: 20px; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.captcha-header { background: var(--brand); color: #fff; padding: 15px; text-align: center; }
.captcha-header h3 { margin: 0; color: #fff; font-size: 1.2rem; }
.captcha-body { padding: 20px; }
.captcha-description { margin-bottom: 15px; font-size: 0.9rem; color: var(--text-primary); }
.captcha-hint { margin-bottom: 20px; font-size: 0.85rem; color: var(--text-muted); }
.captcha-example { background: var(--bg-secondary); padding: 20px; text-align: center; border-radius: var(--radius); margin-bottom: 20px; }
.captcha-example .question { font-size: 2rem; font-weight: 700; color: var(--brand); }

.captcha-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); margin-bottom: 20px; }
.captcha-options button { padding: 15px; font-size: 1.3rem; font-weight: 700; background: var(--brand); color: #fff; border: none; border-radius: var(--radius); cursor: pointer; transition: background 0.2s, transform 0.1s; }
.captcha-options button:hover { background: var(--brand-dark); transform: scale(1.02); }
.captcha-options button:active { transform: scale(0.95); }
.captcha-cancel-btn { width: 100%; padding: var(--space-md); background: #ccc; color: #333; border: none; border-radius: var(--radius); font-size: 0.9rem; cursor: pointer; transition: background 0.2s; }
.captcha-cancel-btn:hover { background: #bbb; }
.captcha-attempts { margin-top: 15px; font-size: 0.7rem; color: var(--text-muted); text-align: center; }
.captcha-escape-hint { margin-top: 5px; font-size: 0.65rem; color: var(--text-muted); text-align: center; }

[data-theme="dark"] .captcha-modal { background: #1e1e1e; }
[data-theme="dark"] .captcha-description { color: #e8e8e0; }
[data-theme="dark"] .captcha-hint { color: #a0a0a0; }
[data-theme="dark"] .captcha-example { background: #2a2a2a; }
[data-theme="dark"] .captcha-example .question { color: #40916c; }
[data-theme="dark"] .captcha-cancel-btn { background: #3a3a3a; color: #d0d0d0; }
[data-theme="dark"] .captcha-cancel-btn:hover { background: #4a4a4a; }

/* ============================================
   ДОКУМЕНТЫ
   ============================================ */

.doc-thumb { max-width: 60px; max-height: 60px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border-light); object-fit: cover; flex-shrink: 0; }
.doc-thumb:hover { border-color: var(--brand); }
.doc-name { font-size: 0.9rem; font-weight: 500; color: var(--text-primary); word-break: break-word; flex: 1; }
.doc-date { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }
.doc-delete { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 0 4px; flex-shrink: 0; transition: color 0.2s; }
.doc-delete:hover { color: #c62828; }
.debtor-doc-item { display: flex; align-items: center; gap: var(--space-sm); padding: 6px var(--space-sm); background: var(--bg-secondary); border-radius: 6px; margin-bottom: var(--space-xs); }

[data-theme="dark"] .doc-name { color: #e8e8e0; }
[data-theme="dark"] .doc-date { color: #a0a0a0; }
[data-theme="dark"] .doc-delete { color: #a0a0a0; }
[data-theme="dark"] .doc-delete:hover { color: #c62828; }
[data-theme="dark"] .debtor-doc-item { background: #2a2a2a; }

/* ============================================
   СКРЫТИЕ КНОПКИ УВЕДОМЛЕНИЙ НА ЛОГИНЕ
   ============================================ */

#authBlock .header-bottom .notifications-btn,
#authBlock #notificationsBtn { display: none !important; }
#appBlock .header-bottom .notifications-btn,
#appBlock #notificationsBtn { display: flex !important; }
#adminBlock .header-bottom .notifications-btn,
#adminBlock #notificationsBtn { display: flex !important; }
.admin-header-actions { display: flex; align-items: center; gap: var(--space-md); }
#adminNotificationsBtn { display: flex !important; }

/* ============================================
   ПРОИЗВОДСТВЕННАЯ АНАЛИТИКА
   ============================================ */

.production-list { display: flex; flex-direction: column; gap: 4px; }
.production-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.95rem;
    flex-wrap: wrap;
    gap: 4px 8px;
}
.production-item-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.production-item-right { font-weight: 600; white-space: nowrap; }

/* ============================================
   ФЛОАТ-КНОПКА «СВЕРНУТЬ ВСЁ»
   ============================================ */

.floating-collapse-btn {
    display: none;
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    width: 56px !important;
    height: 56px !important;
    min-height: 56px !important;
    min-width: 56px !important;
    border-radius: 50% !important;
    background: var(--brand, #2d6a4f) !important;
    color: #ffffff !important;
    border: 3px solid #ffffff !important;
    font-size: 1.4rem !important;
    cursor: pointer !important;
    box-shadow: 0 4px 16px rgba(45,106,79,0.35), 0 8px 24px rgba(0,0,0,0.2) !important;
    transition: all 0.3s ease !important;
    z-index: 9999 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    line-height: 1 !important;
}
.floating-collapse-btn:hover {
    background: var(--brand-dark, #1b4d3a) !important;
    transform: scale(1.08) !important;
    box-shadow: 0 6px 24px rgba(45,106,79,0.5) !important;
}
.floating-collapse-btn:active { transform: scale(0.92) !important; }

.floating-collapse-btn .tooltip {
    position: absolute;
    right: 68px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.floating-collapse-btn:hover .tooltip { opacity: 1; }

[data-theme="dark"] .floating-collapse-btn {
    background: #2a2a2a !important;
    border-color: var(--border, #8a7a6a) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5) !important;
}
[data-theme="dark"] .floating-collapse-btn:hover { background: #3a3a3a !important; }
[data-theme="dark"] .floating-collapse-btn .tooltip { background: rgba(0,0,0,0.9); }

/* ============================================
   АДАПТИВНОСТЬ (ОБЪЕДИНЕННАЯ)
   ============================================ */

@media (max-width: 480px) {
    .header-main { font-size: 1.2rem; }
    .header-brand { font-size: 0.95rem; }
    .header-tagline { font-size: 0.85rem; }
    .demo-btn { padding: 14px 16px; gap: var(--space-md); }
    .demo-icon { font-size: 1.5rem; }
    .demo-label { font-size: 1rem; }
    .date-range-filter { flex-direction: column; align-items: stretch; }
    .date-range-filter input { width: 100%; }
    .finance-grid { grid-template-columns: 1fr 1fr; }
    .footer-buttons { flex-direction: column; gap: 10px; }
    .btn-outline-small { width: 100%; }
    .analytics-card-header { flex-direction: column; }
    .weather-container { flex-direction: column; }
    
    .accordion-header { padding: var(--space-md) var(--space-md); grid-template-columns: 32px 1fr 32px; }
    .accordion-header .help-icon { width: 24px; height: 24px; font-size: 12px; }
    .accordion-header h2 { font-size: 1.1rem; }
    .accordion-header .accordion-icon { font-size: 0.85rem; }
    
    .employee-card .employee-stats { flex-direction: column; gap: var(--space-xs); }
    .employee-card .employee-stats span { white-space: normal; }
    .employee-detail-modal { padding: var(--space-lg); max-width: 100%; width: 100%; min-height: 50vh; }
    .employee-detail-header { flex-direction: column; align-items: center; text-align: center; }
    .employee-detail-header h3 { text-align: center; }
    .employee-bad-actions .action-card { padding: var(--space-sm) 10px; }
    
    .modal-box { min-height: 50vh; padding: var(--space-md) var(--space-md) var(--space-lg) var(--space-md); max-height: 95vh; width: 100%; border-radius: var(--space-sm); }
    .floating-collapse-btn { bottom: 16px; right: 16px; width: 48px; height: 48px; min-height: 48px; min-width: 48px; font-size: 1.2rem; }
    
    .modal-actions { flex-wrap: wrap; }
    .modal-actions button { flex: 1 1 100%; min-height: 48px; font-size: 1rem; }
    
    .timeline-content .event-card { padding: 10px var(--space-md); font-size: 0.95rem; }
    .timeline-content .event-card .event-photos img { max-width: 50px; max-height: 50px; }
    .timeline-header { padding: 10px 14px; }
    .timeline-header span { font-size: 0.95rem; }
    
    .card-actions-grid { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stats-grid .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .dashboard-details { grid-template-columns: 1fr; }
    .stat-card .stat-value { font-size: 1.2rem; }
    
    .admin-tabs-compact { gap: 3px; padding: 3px 6px; }
    .admin-tabs-compact .auth-tab { padding: 3px 4px; font-size: 0.7rem; min-height: 24px; }
    .admin-header-compact .text-muted { font-size: 0.7rem; }
    .admin-header-compact .btn-sm { padding: 1px 10px; min-height: 24px; font-size: 0.7rem; }
    
    .production-item { flex-direction: column; align-items: stretch; text-align: center; padding: 8px 10px; }
    .production-item-left { justify-content: center; flex-wrap: wrap; }
    .production-item-right { white-space: normal; text-align: center; }
    
    @media (max-width: 380px) {
        .mode-toggle-btn { font-size: 0.75rem !important; padding: 6px 10px !important; }
        .date-range-filter label { font-size: 0.8rem; min-width: 70px; }
        .date-range-filter input, .date-range-filter select { font-size: 0.85rem; padding: var(--space-sm); min-height: 36px; }
        .accordion-header { padding: 10px 10px; grid-template-columns: 28px 1fr 28px; }
        .accordion-header .help-icon { width: 20px; height: 20px; font-size: 10px; }
        .accordion-header h2 { font-size: 0.95rem; }
        .card-actions-grid { grid-template-columns: 1fr 1fr; gap: var(--space-xs); }
        .stats-grid { grid-template-columns: 1fr 1fr; gap: var(--space-xs); }
        .stats-grid .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
        .stat-card .stat-value { font-size: 1.1rem; }
        .stat-card .stat-label { font-size: 0.75rem; }
    }
}

@media (min-width: 768px) {
    /* Модалки */
    .modal-box { min-width: 580px; width: 580px; }
    
    /* Страница */
    #app {
        max-width: 580px !important;
        margin: 0 auto;
        padding: 0;
        background: transparent;
        border-radius: var(--radius);
        overflow: hidden;
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    }
    #header { margin: 0 !important; border-radius: var(--radius) var(--radius) 0 0; }
    #footer { margin: 0 !important; border-radius: 0 0 var(--radius) var(--radius); }
    #authBlock { margin: 0 !important; padding: 0 20px 20px 20px; max-width: 100%; }
    #appBlock { padding: 0 16px 16px 16px; max-width: 100%; }
    #appBlock .accordion-section { margin: 0 !important; }
    .auth-logo { margin-top: clamp(1.2rem, 5vw, 2rem); }
    .auth-container { padding: 24px 18px; }
    .demo-buttons { gap: 8px; }
}

/* ============================================
   ГРУППИРОВКА УВЕДОМЛЕНИЙ
   ============================================ */

.notif-group { margin-bottom: var(--space-lg); }
.notif-group:last-child { margin-bottom: 0; }

.notif-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px 6px 4px;
    border-bottom: 2px solid var(--brand);
    margin-bottom: var(--space-sm);
    background: transparent;
}
.notif-group-icon { font-size: 1.2rem; flex-shrink: 0; }
/* Три цветных кружка + нейтральный (единственные разрешённые индикаторы) */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; flex-shrink: 0; }
.dot-red { background: #d93025; }
.dot-yellow { background: #f9ab00; }
.dot-green { background: #188038; }
.dot-neutral { background: #9aa0a6; }
.notif-group-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); flex: 1; }
.notif-group-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 1px 10px;
    border-radius: 12px;
    flex-shrink: 0;
}
.notif-group-items { display: flex; flex-direction: column; gap: 2px; padding-left: 4px; }

[data-theme="dark"] .notif-group-header { border-bottom-color: #40916c; }
[data-theme="dark"] .notif-group-title { color: #e8e8e0; }
[data-theme="dark"] .notif-group-count { background: #2a2a2a; color: #a0a0a0; }

/* ============================================
   НАСТРОЙКИ УВЕДОМЛЕНИЙ (ГАЛКИ ДИРЕКТОРА)
   ============================================ */

.notif-prefs { padding: 4px 2px; }
.notif-prefs-header {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.notif-prefs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: var(--space-lg);
}
.notif-prefs-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    background: var(--bg-secondary);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.notif-prefs-item:hover {
    border-color: var(--brand);
    background: var(--bg-primary);
}
.notif-prefs-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--brand);
    flex-shrink: 0;
}
.notif-prefs-label {
    font-size: 0.95rem;
    color: var(--text-primary);
    user-select: none;
}
.notif-prefs-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding-top: 4px;
}
[data-theme="dark"] .notif-prefs-item { background: #232323; border-color: #3a3a3a; }
[data-theme="dark"] .notif-prefs-item:hover { border-color: #40916c; background: #2a2a2a; }
[data-theme="dark"] .notif-prefs-label { color: #e8e8e0; }

/* ============================================
   3 ЦВЕТА ДЛЯ УВЕДОМЛЕНИЙ
   ============================================ */

/* ——— АВТОР — ЗЕЛЁНЫЙ ——— */
.role-author-label { color: #2d6a4f !important; font-weight: 700 !important; }
[data-theme="dark"] .role-author-label { color: #66bb6a !important; }

/* ——— ИСПОЛНИТЕЛЬ — КРАСНЫЙ ——— */
.role-assignee-label { color: #c62828 !important; font-weight: 700 !important; }
[data-theme="dark"] .role-assignee-label { color: #ef5350 !important; }

/* ——— СТАТУСЫ ——— */
.status-label { font-weight: 700 !important; color: var(--text-primary) !important; }
.status-waiting { color: #f9a825 !important; font-weight: 700 !important; }
.status-working { color: #f9a825 !important; font-weight: 700 !important; }
.status-done { color: #2d6a4f !important; font-weight: 700 !important; }
.status-overdue { color: #c62828 !important; font-weight: 700 !important; }

[data-theme="dark"] .status-waiting { color: #fdd835 !important; }
[data-theme="dark"] .status-working { color: #fdd835 !important; }
[data-theme="dark"] .status-done { color: #66bb6a !important; }
[data-theme="dark"] .status-overdue { color: #ef5350 !important; }

/* ============================================
   АДМИН-ПАНЕЛЬ — КОМПАКТНЫЙ РЕНДЕР
   ============================================ */

.admin-tabs-compact {
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 8px;
}
.admin-tabs-compact .auth-tab {
    flex: 1;
    padding: 4px 6px;
    font-size: 0.8rem;
    min-height: 28px;
    border-radius: 4px;
    text-align: center;
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.admin-tabs-compact .auth-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.admin-tabs-compact .auth-tab .badge { font-size: 0.55rem; padding: 1px 5px; margin-left: 3px; }

.admin-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 10px;
}
.admin-header-compact .text-muted { font-size: 0.8rem; }
.admin-header-compact .btn-sm { padding: 2px 12px; min-height: 28px; font-size: 0.8rem; width: auto; }

/* ============================================
   🔥 ЦЕНТРОВКА ОДНОСТРОЧНЫХ КНОПОК АНАЛИТИКИ
   ============================================ */

.btn.analytics-report-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 10px 16px !important;
    min-height: 44px !important;
    width: 100% !important;
}
.analytics-report-btn .report-title {
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    display: inline-block !important;
    width: 100% !important;
    text-align: center !important;
}
.report-contour-title {
    text-align: center !important;
    display: block !important;
    width: 100% !important;
    margin-top: 20px !important;
    margin-bottom: var(--space-sm) !important;
    padding-bottom: 6px !important;
    border-bottom: 1px solid var(--border-light) !important;
}
[data-theme="dark"] .report-contour-title { border-bottom-color: var(--border-light) !important; }

/* ============================================
   ФИКС МОДАЛКИ УВЕДОМЛЕНИЙ
   ============================================ */

#notificationsModal .modal-box {
    background: var(--card, #ffffff) !important;
    border: 2px solid var(--border-light, #d4b896) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-radius: 12px !important;
    padding: var(--space-lg, 16px) !important;
    color: var(--text-primary, #1e2a1e) !important;
}
#notificationsModal .modal-title {
    font-size: 1.3rem !important;
    font-weight: 700 !important;
    color: var(--brand, #2d6a4f) !important;
    border-bottom: 2px solid var(--border-light, #d4b896) !important;
    padding-bottom: 10px !important;
    margin-bottom: 16px !important;
    text-align: center !important;
}
#notificationsModal .notification-item {
    background: #ffffff !important;
    color: var(--text-primary, #1e2a1e) !important;
    border-bottom: 1px solid var(--border-light, #d4b896) !important;
}
#notificationsModal .notification-item:hover { background: var(--bg-secondary, #f8f8f5) !important; }
#notificationsModal .notif-title { color: var(--text-primary, #1e2a1e) !important; font-weight: 600 !important; }
#notificationsModal .notif-message { color: var(--text-secondary, #333333) !important; }
#notificationsModal .notification-critical { background: rgba(198, 40, 40, 0.08) !important; border-left: 4px solid #c62828 !important; }
#notificationsModal .notification-critical .notif-title { color: #c62828 !important; }
#notificationsModal {
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
}

[data-theme="dark"] #notificationsModal .modal-box {
    background: #1e1e1e !important;
    border-color: #4a4a4a !important;
    color: #e8e8e0 !important;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6) !important;
}
[data-theme="dark"] #notificationsModal .modal-title {
    color: #40916c !important;
    border-bottom-color: #4a4a4a !important;
}
[data-theme="dark"] #notificationsModal .notification-item {
    background: #1e1e1e !important;
    color: #e8e8e0 !important;
    border-bottom-color: #4a4a4a !important;
}
[data-theme="dark"] #notificationsModal .notif-title { color: #e8e8e0 !important; }
[data-theme="dark"] #notificationsModal .notif-message { color: #d0d0d0 !important; }
[data-theme="dark"] #notificationsModal .notification-critical { background: rgba(198, 40, 40, 0.15) !important; }
/* ================================================================
   Этап A-FRONT (AF5): подсветка полей с ошибкой валидации (HTTP 422)
   ================================================================ */
.form-error {
    border-color: #c62828 !important;
    box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.15);
}

/* ================================================================
   ДИЗАЙН-ПАКЕТ (согласовано владельцем): модалки, аккордеоны отчётов, диаграммы
   ================================================================ */

/* Крестик закрытия во всех модалках */
.modal-box { position: relative; }
.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: 0;
    font-size: 1.05rem;
    color: var(--text-muted, #666);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    z-index: 5;
}
.modal-close:hover { background: rgba(0,0,0,0.07); }

/* Форма-модалка (shared/ui/formModal.js): шапка с запасом под крестик. */
.form-modal-head { position: relative; }
.form-modal-title { padding: 0 40px; margin-bottom: 4px; }
.form-modal-sub { padding: 0 40px; margin-bottom: 14px; color: var(--text, #22303a); font-size: 0.875rem; font-weight: 600; }
/* Глобально: заголовки/подзаголовки в модалках не заходят под крестик справа. */
.modal-box .text-title.text-center,
.modal-box .text-muted.text-sm.text-center { padding-left: 36px; padding-right: 36px; }
/* Заголовок премиальных модалок поля (САТ/Анализ/Спутник) — запас под крестик. */
.fm-head { padding: 0 40px; }
/* Единая ширина модалки (десктоп 580, мобильный 100%). */
.modal-box { min-width: 0; }

/* Заголовки разделов по центру */
.section-title-center {
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary, #1f3d2e);
}

/* Карточки-аккордеоны отчётов (раскрытие под кнопкой, индикатор +/−) */
.report-acc { overflow: hidden; }
.report-acc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 14px;
    cursor: pointer;
    user-select: none;
}
.report-acc-head:hover { background: rgba(45,106,79,0.05); }
.report-acc-ind {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand, #2d6a4f);
    min-width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.report-acc-body {
    padding: 0 14px 14px;
    border-top: 1px solid var(--border-light, #e6ede9);
}
/* Плавное открытие отчёта (как в дорогих продуктах) */
.report-acc-body.report-open { animation: reportFade 0.28s ease; }
@keyframes reportFade {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Контейнеры диаграмм (Chart.js) */
.chart-box {
    margin: 12px 0;
    padding: 10px;
    border: 1px solid var(--border-light, #e6ede9);
    border-radius: 10px;
    background: var(--bg-secondary, #f7faf8);
}
.chart-box-title {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted, #5b7a6c);
    margin-bottom: 6px;
}
.chart-canvas { width: 100% !important; height: 210px !important; }
/* ===== Легенда графика «Анализ поля»: тапабельные кнопки-переключатели (v68) ===== */
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chart-legend-item {
    flex: 1 1 150px; min-width: 0; min-height: 34px;
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; border: 1px solid var(--c, var(--border-light, #e6ede9)); border-radius: 8px;
    background: var(--bg-secondary, #f7faf8); color: var(--text-main, #22303a);
    font-size: 0.75rem; cursor: pointer; transition: background .12s ease, opacity .12s ease;
    -webkit-tap-highlight-color: transparent; user-select: none;
}
.chart-legend-item:hover { background: rgba(27, 108, 168, 0.08); }
.chart-legend-item:active { transform: scale(0.98); }
.chart-legend-box { width: 12px; height: 12px; border-radius: 3px; background: var(--c); border: 1px solid var(--c); flex: 0 0 auto; }
.chart-legend-label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; line-height: 1.2; }
.chart-legend-item.is-off { opacity: 0.55; }
.chart-legend-item.is-off .chart-legend-label { text-decoration: line-through; }
.chart-legend-item.is-off .chart-legend-box { background: transparent; }

/* ===== Сводка индексов «Анализ поля» (дашборд по последнему снимку) ===== */
.indices-row { display: flex; flex-wrap: wrap; gap: 8px; }
.indices-chip {
    flex: 1 1 96px; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
    padding: 8px 6px; border: 1px solid var(--c, var(--border-light, #e6ede9)); border-radius: 10px;
    background: var(--bg-secondary, #f7faf8);
}
.indices-chip-name { font-weight: 600; font-size: 0.75rem; color: var(--c, #22303a); }
.indices-chip-val { font-size: 0.95rem; font-weight: 700; color: var(--text-main, #22303a); }
.indices-chip-meaning { font-size: 0.68rem; color: var(--text-muted, #5b7a6c); }


/* ===== ��������� �������� (���������) ===== */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-row { display: flex; align-items: center; gap: 10px; background: var(--bg-secondary); border: 1px solid var(--border-light); border-radius: 10px; padding: 8px; }
.doc-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-light); cursor: zoom-in; flex-shrink: 0; }
.doc-date { font-size: 0.78rem; color: var(--text-muted); flex: 1; }
.doc-delete { flex-shrink: 0; }

/* ================================================================
   РАБОТЫ ПО ПОЛЮ: вкладки Операции/Задачи (30.08.2026)
   ================================================================ */
.works-tabs { display: flex; gap: 8px; }
.works-tab { flex: 1; }
.works-tab-active { border-color: var(--brand, #1b6b3a); color: var(--brand, #1b6b3a); font-weight: 600; }
.works-pane-hidden { display: none; }

/* ================================================================
   ПРЕМИАЛЬНЫЕ МОДАЛКИ ПОЛЯ (САТ / Спутник / Анализ)
   ================================================================ */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.badge-success { background: #2d6a4f; color: #fff; }
.badge-primary { background: #1b6ca8; color: #fff; }
.badge-secondary { background: #7a857d; color: #fff; }
.badge-warning { background: #e67e00; color: #fff; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.kpi-card { background: rgba(45, 106, 79, 0.07); border: 1px solid rgba(45, 106, 79, 0.22); border-radius: 14px; padding: 10px 12px; text-align: center; }
[data-theme="dark"] .kpi-card { background: rgba(45, 106, 79, 0.20); border-color: rgba(127, 203, 161, 0.3); }
.kpi-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; }
.kpi-value { font-size: 1.15rem; font-weight: 800; color: var(--text, #1e2a1e); font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.kpi-warn { color: #b8860b; }
.kpi-crit { color: #c62828; }
.kpi-pos { color: #2d6a4f; }
.kpi-neg { color: #c62828; }
.kpi-muted { color: var(--text-muted); }
[data-theme="dark"] .kpi-warn { color: #ffb703; }
[data-theme="dark"] .kpi-crit, [data-theme="dark"] .kpi-neg { color: #ff7a7a; }
[data-theme="dark"] .kpi-pos { color: #7fcba1; }

.progress-wrap { width: 100%; }
.progress-track { height: 10px; border-radius: 8px; background: rgba(120, 140, 150, 0.25); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #f2a541, #d97b29); border-radius: 8px; }
.progress-fill-open { background: linear-gradient(90deg, #4c9a6b, #2d6a4f); }
.progress-labels { display: flex; justify-content: space-between; gap: 8px; font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }
.progress-labels span { white-space: nowrap; }

.phases-block { display: flex; flex-direction: column; gap: 4px; }
.phase-row { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(120, 140, 150, 0.28); background: rgba(120, 140, 150, 0.06); }
.phase-mark-wrap { width: 24px; text-align: center; }
.phase-mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 800; font-size: 0.85rem; }
.phase-mark-done { background: #2d6a4f; color: #fff; }
[data-theme="dark"] .phase-mark-done { background: #7fcba1; color: #142014; }
.phase-mark-cur { background: rgba(45,106,79,0.18); color: #2d6a4f; border: 2px solid #2d6a4f; }
[data-theme="dark"] .phase-mark-cur { color: #7fcba1; border-color: #7fcba1; }
.phase-mark-next { background: rgba(27,108,168,0.16); color: #1b6ca8; border: 2px dashed #1b6ca8; }
[data-theme="dark"] .phase-mark-next { color: #8ec7ec; border-color: #8ec7ec; }
.phase-cur { border-color: #2d6a4f; background: rgba(45, 106, 79, 0.14); }
.phase-next { border-style: dashed; }
.phase-name { font-size: 0.875rem; font-weight: 600; min-width: 0; overflow-wrap: break-word; }
.phase-sat { font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; }
.phase-past { opacity: 0.6; }

/* Модалка «САТ»: паспорт-таблица поля + крупный заголовок (читаемость). */
/* Единый стиль названия модалки (H1) во ВСЕХ модалках — через CSS, без инлайнов. */
#editModal .modal-box h3.text-title.text-center { font-size: 1.25rem; color: var(--text); }
.sat-passport { border: 1px solid var(--border-light); border-radius: 14px; overflow: hidden; margin-bottom: 16px; background: var(--bg-secondary); }
.sat-prow { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border-light); align-items: center; }
.sat-prow:last-child { border-bottom: 0; }
.sat-prow-label { font-size: 0.875rem; color: var(--text-muted); }
.sat-prow-value { font-size: 1.05rem; font-weight: 700; color: var(--text); text-align: right; }
.sat-prow-value .form-input { width: 100%; padding: 6px 10px; font-weight: 600; text-align: right; }
/* ===== Компактный паспорт карточки поля (вариант A, решение владельца) ===== */
.sat-passport-compact { max-width: 460px; }
.sat-passport-compact .sat-prow { grid-template-columns: minmax(90px, auto) 1fr; }
.sat-passport-compact .sat-prow-value { font-size: 0.9rem; font-weight: 500; text-align: right; }
/* ===== Модалка «Обработка»: секции и поля ===== */
.form-section { margin-bottom: 18px; }
.form-section.is-hidden { display: none; }
.form-section-title { font-size: 0.875rem; font-weight: 700; color: var(--text, #22303a); margin-bottom: 8px; }
/* Глобальное скрытие: любой элемент с .is-hidden прячется (используется мастером «Обработка»,
   блоком #opStep3Content и #opSubTypeWrap). !important защищает от перекрытия display-правилами. */
.is-hidden { display: none !important; }
/* Плавное появление блоков мастера (Уточнение → Данные) */
.op-reveal { animation: opReveal .28s ease; }
@keyframes opReveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* ===== Мастер «Обработка» (пошаговый) ===== */
.op-wizard { position: relative; }
.op-progress { font-size: 0.78rem; font-weight: 700; color: var(--brand, #1b6b3a); background: rgba(27, 107, 58, 0.08); border: 1px solid var(--border-light, #e6ede9); border-radius: 20px; padding: 6px 12px; margin-bottom: 14px; text-align: center; letter-spacing: 0.01em; }
.op-step-panel { min-height: 90px; }
.op-nav { display: flex; gap: 8px; align-items: center; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border-light, #e6ede9); }
.op-nav .btn { flex: 1 1 auto; }
/* ===== Чипсы выбора типа (группы и уточнения) ===== */
.op-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.op-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-light, #e6ede9); background: var(--bg-secondary, #f7faf8); color: var(--text, #22303a); border-radius: 20px; padding: 8px 12px; font-size: 0.85rem; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: border-color .12s ease, background .12s ease; }
.op-chip-count { font-size: 0.72rem; color: var(--text-muted, #5b7a6c); background: rgba(0,0,0,0.04); border-radius: 10px; padding: 0 6px; }
.op-chip.is-on { border-color: var(--brand, #1b6b3a); background: rgba(27, 107, 58, 0.08); font-weight: 600; }
.op-type-badge { display: inline-block; font-size: 0.82rem; font-weight: 700; color: var(--brand, #1b6b3a); background: rgba(27, 107, 58, 0.08); border-radius: 20px; padding: 4px 12px; margin-bottom: 12px; }
.op-type-badge.is-hidden { display: none !important; }
/* ===== Аккордеон секций (вариант A/AC) ===== */
.op-accordion { border: 1px solid var(--border-light, #e6ede9); border-radius: 12px; margin-bottom: 10px; overflow: hidden; background: #fff; }
.op-acc-head { display: flex; justify-content: space-between; align-items: center; width: 100%; background: var(--bg-secondary, #f7faf8); border: none; padding: 12px 14px; font-size: 0.9rem; font-weight: 700; color: var(--text, #22303a); cursor: pointer; text-align: left; }
.op-acc-arrow { font-size: 0.8rem; color: var(--text-muted, #5b7a6c); }
.op-acc-body { display: none; padding: 12px 14px; }
.op-accordion.is-open .op-acc-body { display: block; }
.op-accordion.is-hidden { display: none !important; }
/* ===== Расширенные поля (вариант C) ===== */
.op-advanced { margin-top: 12px; padding-top: 4px; }
/* ===== Сводка (sticky) ===== */
.op-summary { font-size: 0.85rem; color: var(--text, #22303a); background: rgba(27, 107, 58, 0.06); border: 1px solid var(--border-light, #e6ede9); border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; }
/* ===== «Вывески» вариантов в окне поля ===== */
.op-signboard { border: 1px solid var(--border-light, #e6ede9); border-radius: 12px; padding: 10px; background: var(--bg-secondary, #f7faf8); }
.op-signboard-title { font-size: 0.78rem; font-weight: 700; color: var(--text-muted, #5b7a6c); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.op-signboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.op-signboard-grid .btn { width: 100%; font-size: 0.82rem; padding: 8px 6px; }



/* Иерархия H1>H2>H3 в модалке САТ: метрики и заголовки секций НЕ больше заголовка модалки. */
.mw-section .kpi-value { font-size: 1rem; }
.mw-section .section-title-center { font-size: 1.05rem; }
/* Шкала спелости САТ с насечками каждые 500°. */
.scale-map { width: 100%; }
.scale-track { overflow: visible; height: 12px; margin-top: 6px; }
.scale-marks { position: relative; height: 40px; }
.scale-mark { position: absolute; top: 0; transform: translateX(-50%); text-align: center; font-size: 0.8rem; line-height: 1.15; color: var(--text-muted); white-space: nowrap; }
.scale-mark b { font-weight: 700; color: var(--text); }
.scale-ticks { position: relative; height: 7px; margin-top: 2px; }
.scale-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(120,140,150,0.45); transform: translateX(-50%); }
.scale-tick-maj { width: 2px; background: rgba(120,140,150,0.8); }
.scale-nums { position: relative; height: 16px; margin-top: 2px; }
.scale-num { position: absolute; transform: translateX(-50%); font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
/* Листалка баров «Прирост тепла» (‹ ›) — как фото в «Спутнике». */
.bars-pager { display: flex; align-items: center; gap: 8px; }
.bars-nav { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-light); background: var(--bg-secondary); color: var(--text-muted); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.bars-nav:hover { background: rgba(45,106,79,0.14); border-color: var(--brand, #1b6b3a); color: var(--text); }
.bars-nav:disabled { opacity: 0.3; cursor: default; }
.bars-pager .premium-bars { flex: 1 1 auto; min-width: 0; }
/* Графики «Анализа поля»: белая карточка, переключатель диапазона, панель. */
.chart-card { border: 1px solid var(--border-light); border-radius: 14px; padding: 12px 14px; background: var(--bg-secondary); }
.chart-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chart-card .works-tabs { width: 100%; }
.chart-card .works-tabs .works-tab { flex: 1 1 0; min-width: 0; }
.chart-range { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.chart-range-btn { flex: 1 1 0; min-width: 0; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-light); background: var(--bg-secondary); font-size: 0.75rem; color: var(--text-muted); cursor: pointer; }
.chart-range-btn.is-on { border-color: var(--brand, #1b6b3a); background: rgba(45,106,79,0.15); color: var(--brand, #1b6b3a); font-weight: 700; }
.chart-title { text-align: center; }
.chart-canvas { position: relative; height: 200px; min-width: 0; }
.chart-canvas canvas { width: 100% !important; height: 100% !important; }
/* Блок здоровья-«резюме» (низ модалки «Анализ поля») — аккуратное выравнивание. */
.health-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.health-status { font-size: 1rem; }
.health-summary { margin-top: 10px; font-size: 0.875rem; line-height: 1.5; color: var(--text); }
.health-alerts { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }


/* Модалка «САТ»: разделы-карточки + шкала с маркером (10.09.2026). */
.mw-section { border: 1px solid var(--border-light); border-radius: 12px; padding: 10px 12px;
    background: var(--bg-secondary); margin-top: 12px; }
.mw-section:first-of-type { margin-top: 0; }
.mw-status { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; }
.progress-track { position: relative; }
.progress-marker { position: absolute; top: 0; left: 0; transform: translateX(-50%);
    width: 3px; height: 100%; background: var(--brand, #1b6b3a);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.7); pointer-events: none; }
[data-theme="dark"] .progress-marker { box-shadow: 0 0 0 2px rgba(20,32,20,0.7); }

/* Модалка на мобильном: верхняя привязка + прокрутка оверлея (ничего не режется),
   блоки САТ/Анализ компактнее (герой меньше, отступы уже). */
@media (max-width: 767px) {
    #editModal { align-items: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    #editModal .modal-box { max-height: none; width: 100%; }
    .mw-section { padding: 8px 10px; margin-top: 10px; }
    .mw-status { margin-bottom: 4px; }
}
/* Ничего не вылезает по горизонтали за края экрана. */
#editModal { overflow-x: hidden; }
.modal-box { min-width: 0; }
.premium-bars { max-width: 100%; min-width: 0; }
.premium-bar-col { min-width: 0; }
.premium-bar-date { white-space: normal; text-align: center; }
.progress-labels { flex-wrap: wrap; gap: 2px 8px; }

.health-card { border-radius: 14px; padding: 12px 14px; border: 1px solid rgba(120, 140, 150, 0.28); background: rgba(120, 140, 150, 0.07); }
.health-normal { border-color: rgba(45, 106, 79, 0.45); background: rgba(45, 106, 79, 0.10); }
.health-warning { border-color: rgba(230, 126, 0, 0.55); background: rgba(230, 126, 0, 0.10); }
.health-critical { border-color: rgba(198, 40, 40, 0.55); background: rgba(198, 40, 40, 0.10); }
.health-rec { margin-top: 8px; font-size: 0.85rem; background: rgba(255, 255, 255, 0.6); border-radius: 8px; padding: 8px 10px; }
[data-theme="dark"] .health-rec { background: rgba(255, 255, 255, 0.08); }

.premium-bars { display: flex; gap: 3px; align-items: flex-end; height: 130px; overflow-x: auto; padding-bottom: 2px; }
.premium-bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1 1 0; min-width: 18px; height: 100%; }
.premium-bar { width: 100%; max-width: 26px; border-radius: 4px 4px 0 0; }
.bar-pos, .bar-var { background: linear-gradient(180deg, #4c9a6b, #2d6a4f); }
.bar-zero { background: rgba(120, 140, 150, 0.35); }
.premium-bar-date { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; margin-top: 3px; }
.premium-bar-val { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); line-height: 1; margin-bottom: 2px; white-space: nowrap; }
[data-theme="dark"] .premium-bar-val { color: rgba(232,240,232,0.6); }

.sat-date-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sat-date-tab { padding: 4px 10px; font-size: 0.78rem; }
.sat-date-tab-on { border-color: var(--brand, #1b6b3a) !important; background: rgba(45, 106, 79, 0.15); color: var(--brand, #1b6b3a); font-weight: 700; }
.sat-mode-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sat-mode-tab { padding: 4px 12px; font-size: 0.8rem; min-width: 52px; }
.sat-mode-tab-on { border-color: var(--brand, #1b6b3a) !important; background: rgba(45, 106, 79, 0.15); color: var(--brand, #1b6b3a); font-weight: 700; }
.sat-quality { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sat-legend-text { font-size: 0.78rem; color: var(--text-muted); line-height: 1.35; }
.sat-layout { display: flex; gap: 14px; }
.sat-img-wrap { flex: 1 1 60%; position: relative; min-width: 0; }
.sat-img { width: 100%; border-radius: 14px; border: 1px solid rgba(120, 140, 150, 0.3); display: block; min-height: 150px; background: rgba(120, 140, 150, 0.1); object-fit: contain; }
.sat-noimg { width: 100%; height: 170px; display: flex; align-items: center; justify-content: center; border-radius: 14px; border: 1px dashed rgba(120, 140, 150, 0.45); color: var(--text-muted); font-size: 0.85rem; }
.sat-date-label { position: absolute; left: 10px; bottom: 10px; background: rgba(0, 0, 0, 0.58); color: #fff; font-size: 0.72rem; padding: 3px 10px; border-radius: 10px; }
.sat-info { flex: 1 1 40%; min-width: 150px; }

@media (max-width: 560px) {
    .kpi-row { grid-template-columns: 1fr 1fr; }
    .sat-layout { flex-direction: column; }
    .sat-img { min-height: 120px; }
}

/* ================================================================
   ФИНАЛЬНАЯ МОДАЛКА «Спутник» (вариант B, утверждён 02.09.2026).
   Вариант A и A/B-механизм удалены.
   ================================================================ */
.mt-12 { margin-top: 12px; }
.sat-mode-tab-off { opacity: 0.45; border-style: dashed; }
/* --- Фото-герой снимка со стрелками листания дат --- */
.satB-hero { position: relative; width: 100%; max-width: 480px; margin: 0 auto; aspect-ratio: 1 / 1;
    border-radius: 14px; overflow: hidden; background: rgba(120, 140, 150, 0.12);
    border: 1px solid rgba(120, 140, 150, 0.22); }
.satB-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.satB-photo-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
    width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; font-weight: 700; line-height: 1; padding: 0 0 3px; cursor: pointer;
    color: #16202a; background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(120, 140, 150, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22); transition: background 0.15s, border-color 0.15s, color 0.15s; }
.satB-photo-arrow:hover { background: #ffffff; border-color: var(--brand, #1b6b3a); color: var(--brand, #1b6b3a); }
.satB-photo-arrow-left { left: 8px; }
.satB-photo-arrow-right { right: 8px; }
[data-theme="dark"] .satB-photo-arrow { color: #e8f0e8; background: rgba(16, 24, 30, 0.88); border-color: rgba(150, 180, 160, 0.35); }

/* --- Вариант B: режимы + описание режима + легенда цветов --- */
.satB-modes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.satB-modeinfo { margin-top: 12px; padding: 10px 12px 8px; border: 1px solid rgba(45, 106, 79, 0.16);
    border-radius: 14px; background: rgba(45, 106, 79, 0.05); }
[data-theme="dark"] .satB-modeinfo { border-color: rgba(140, 200, 160, 0.18); background: rgba(45, 106, 79, 0.12); }
.satB-modeinfo-label { display: inline-block; padding: 2px 9px; border-radius: 999px;
    background: rgba(45, 106, 79, 0.14); color: var(--brand, #2d6a4f); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.5px; }
[data-theme="dark"] .satB-modeinfo-label { color: #9fe0bd; }
.satB-modeinfo-title { margin-top: 7px; font-size: 1rem; font-weight: 800; color: var(--text); }
.satB-modeinfo-text { margin-top: 3px; font-size: 0.875rem; line-height: 1.4; color: var(--text); opacity: 0.82; }
.satB-modeinfo-why { margin-top: 5px; font-size: 0.875rem; line-height: 1.4; color: var(--text); }
.satB-modeinfo-why b { color: var(--brand, #2d6a4f); }
[data-theme="dark"] .satB-modeinfo-why b { color: #9fe0bd; }
.satB-colorlegend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 9px; }
.satB-colorlegend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem;
    line-height: 1.35; color: var(--text-muted); }
.satB-colorlegend-item i { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14); }
.satB-colorlegend .lg-red { background: #d84c4c; }
.satB-colorlegend .lg-yellow { background: #e0bb3a; }
.satB-colorlegend .lg-green { background: #2f9e63; }
.satB-colorlegend .lg-tan { background: #c9a35f; }
.satB-colorlegend .lg-amber { background: #eaa21a; }
.satB-colorlegend .lg-blue { background: #2f6fed; }
.satB-colorlegend .lg-gray { background: #8a97a3; }
/* Янтарный контур поля (утверждён 06.09.2026): сердцевина #FFB200, тёмно-коричневая окантовка. */
.satB-colorlegend .lg-line { width: 16px; height: 7px; border-radius: 4px; box-shadow: none;
    border: 1px solid #402800; background: #ffb200; }

/* --- Медиана индекса (компактная строка в описании режима) --- */
.satB-median { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px;
    padding: 7px 11px; border-radius: 10px; background: rgba(45, 106, 79, 0.1);
    border: 1px solid rgba(45, 106, 79, 0.18); font-size: 0.86rem; font-weight: 600; color: var(--text); }
[data-theme="dark"] .satB-median { background: rgba(45, 106, 79, 0.18); border-color: rgba(127, 203, 161, 0.3); }
.satB-median-val { font-weight: 800; font-variant-numeric: tabular-nums; }
.satB-median-hint { flex: 1 1 100%; align-self: flex-start; margin-top: 3px; padding-top: 6px;
    border-top: 1px dashed rgba(45, 106, 79, 0.28); font-size: 0.75rem; font-weight: 500;
    line-height: 1.4; color: var(--text-muted); }
[data-theme="dark"] .satB-median-hint { border-top-color: rgba(140, 200, 160, 0.28); color: rgba(232, 240, 232, 0.78); }

/* --- Примечание «цвет только на поле» --- */
.satB-paintnote { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed rgba(120, 140, 150, 0.35); font-size: 0.75rem; color: var(--text-muted); line-height: 1.3; }
.satB-paintnote .lg-line-dot { width: 16px; height: 6px; border-radius: 3px; flex: 0 0 auto;
    border: 1px solid #402800; background: #ffb200; box-shadow: none; }

/* --- Выбор даты: сразу под фото (стрелки + до 3 кнопок дат с точкой качества) --- */
.satB-dates-nav { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.satB-nav-btn { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; padding: 0 0 3px;
    font-size: 1.25rem; font-weight: 700; line-height: 1; color: var(--text);
    background: rgba(120, 140, 150, 0.08); border: 1px solid rgba(120, 140, 150, 0.32);
    transition: background 0.15s, border-color 0.15s; }
.satB-nav-btn:hover { background: rgba(45, 106, 79, 0.14); border-color: var(--brand, #1b6b3a); }
.satB-nav-btn:disabled { opacity: 0.3; cursor: default; }
.satB-dates { flex: 1 1 auto; display: flex; gap: 6px; min-width: 0; }
.satB-date { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 4px; border-radius: 999px; border: 1px solid rgba(120, 140, 150, 0.28);
    background: transparent; color: var(--text-muted); font-size: 0.875rem; font-weight: 700;
    cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.satB-date:hover { background: rgba(45, 106, 79, 0.1); border-color: rgba(45, 106, 79, 0.5); color: var(--text); }
.satB-date-on { background: var(--brand, #1b6b3a); border-color: var(--brand, #1b6b3a); color: #ffffff; }
[data-theme="dark"] .satB-date-on { background: #2d6a4f; border-color: #2d6a4f; }
.satB-date-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.satB-date-on .satB-date-dot { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55); }
.dot-clean { background: var(--brand, #2d6a4f); }
.dot-part { background: #e67e22; }
.dot-cloud { background: #7d8a94; }
.dot-na { background: rgba(120, 140, 150, 0.45); }

/* Уровни видимости сцены — цвет текста подписи «видно N%». */
.satB-q-clean { color: var(--brand, #2d6a4f); }
.satB-q-part { color: #cf6d00; }
.satB-q-cloud { color: #7d8a94; }
.satB-q-na { color: var(--text-muted); }
[data-theme="dark"] .satB-q-clean { color: #7fd09a; }
[data-theme="dark"] .satB-q-part { color: #ffab4d; }
[data-theme="dark"] .satB-q-cloud { color: #9aa7b0; }

/* Финальная раскладка выбора дат (утверждена 06.09.2026): вариант 1 —
   широкие кнопки-столбики «дата / точка 12px + видно N%». Вариант 3 удалён. */
.satB-date.satB-date-stack { flex-direction: column; gap: 2px; padding: 7px 8px 6px; border-radius: 13px; line-height: 1.2; }
.satB-date-stack .satB-date-d { font-size: 1rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.2px; }
.satB-date-stack .satB-date-q { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.satB-date.satB-date-on.satB-date-stack .satB-date-q { color: rgba(255, 255, 255, 0.95); }

@media (max-width: 560px) {
    .satB-hero { max-width: none; }

    /* Защита от глобального .btn-outline-small { width:100% } (медиа 480px):
       кнопки-режимы и стрелки листания должны оставаться компактными в ряд,
       иначе блоки уезжают за правый край модалки на телефоне. */
    .satB-modes .btn-outline-small { width: auto !important; }
    .satB-modes .sat-mode-tab { flex: 1 1 auto; min-width: 0; }
}

/* Контейнер-обёртка модалки (внутри оверлея) занимает ВСЮ ширину оверлея,
   чтобы широкий контент (например, бары/шкала САТ) не растягивал рамку модалки
   за пределы экрана и не делал её шире остальных. */
#fieldModal > div, #expenseModal > div, #planModal > div, #actionModal > div,
#photoAfterModal > div, #editModal > div, #addEmployeeModal > div,
#equipmentModal > div, #repairModal > div, #notificationsModal > div,
#mapEditorModal > div, .employee-modal > div {
    width: 100%; min-width: 0; max-width: 100%;
}

/* Контент модалок не вылезает по горизонтали (без !important). */
.modal-box { overflow-x: hidden; min-width: 0; }
.modal-box .mw-section, .modal-box .kpi-row, .modal-box .progress-wrap,
.modal-box .progress-labels, .modal-box .premium-bars {
    min-width: 0; max-width: 100%;
}

/* ===== Список «Что вносим» — карточки в едином стиле продукта (.card), пустое состояние ===== */
.op-mix-empty { color: var(--text-muted, #8a9691); font-size: 0.8rem; padding: 12px 12px; border: 1px dashed var(--border-light, #e6ede9); border-radius: 10px; text-align: center; }
.sep { margin: 0 5px; color: var(--text-muted, #9aa5a0); }

