/* ============================================================
   ЭКОЛОГИЧЕСКАЯ ОТЧЁТНОСТЬ — ЕДИНЫЙ ФАЙЛ СТИЛЕЙ
   ============================================================ */

/* === СБРОС И БАЗОВЫЕ === */


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

main { flex: 1; width: 100%; }

.page-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f5f7fa;
    color: #1e2b3a;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 16px;
}

main { flex: 1; }

/* === НАВИГАЦИЯ === */
.navbar {
    background: #ffffff;
    border-bottom: 2px solid #dce3ea;
    padding: 1rem 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    position: relative;
    z-index: 100;
}
.nav-left {
    display: flex;
    align-items: center;
    gap: 1.8rem;
    flex-wrap: wrap;
}
.logo {
    font-weight: 600;
    font-size: 1.4rem;
    color: #1e4a5f;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-decoration: none;
}
.nav-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;          /* ← выравнивание в ряду */
}
.nav-btn {
    background: #eef2f6;
    border: 1px solid #cbd5e1;
    height: 44px;                 /* ← фиксированная высота для ВСЕХ */
    padding: 0 1.4rem;            /* вертикальные отступы больше не нужны */
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    color: #1e3a5f;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
}
.nav-btn:hover { background: #d9e2ec; border-color: #9bb0c4; }
.nav-btn.active { background: #1e4a5f; color: white; border-color: #1e4a5f; }

/* === НАВБАР: ВЫПАДАЮЩИЕ МЕНЮ === */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    min-width: 260px;
    overflow: hidden;
    z-index: 101;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu .dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 1px solid #f0f4f8;
    color: #1e3a5f;
    text-decoration: none;
    font-size: 0.95rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}
.nav-dropdown-menu .dropdown-item:last-child { border-bottom: none; }
.nav-dropdown-menu .dropdown-item:hover { background: #f5f7fa; }

/* === ПРОФИЛЬ В НАВБАРЕ === */
.auth-container { position: relative; }
.profile-btn {
    background: #1e4a5f;
    color: white;
    border: none;
    padding: 0.55rem 1.4rem;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 160px;
    justify-content: center;
    text-decoration: none;
    font-family: inherit;
}
.profile-btn:hover { background: #12303e; }

.dropdown-menu-profile {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(30, 74, 95, 0.15);
    border: 1px solid #eef2f6;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 101;
}
.dropdown-menu-profile.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.user-header { padding: 20px; border-bottom: 1px solid #f0f4f8; background: #fafbfc; }
.user-name { font-size: 1.1rem; font-weight: 600; color: #1e2b3a; }
.section-label {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px;
    color: #8a9ba8; margin: 16px 20px 8px; font-weight: 600;
}
.menu-select {
    width: calc(100% - 40px); margin: 0 20px 16px; padding: 10px 12px;
    border: 1px solid #dce3ea; border-radius: 8px; font-size: 0.9rem;
    color: #1e2b3a; background: white; cursor: pointer;
}
.menu-footer { padding: 12px 20px; border-top: 1px solid #f0f4f8; display: flex; flex-direction: column; gap: 8px; }
.menu-link {
    display: block; padding: 10px 12px; color: #1e2b3a; text-decoration: none;
    border-radius: 8px; font-size: 0.9rem; font-weight: 500; transition: background 0.2s;
}
.menu-link:hover { background: #f5f7fa; }
.menu-link.logout { color: #c0392b; }
.menu-link.logout:hover { background: #fdf2f2; }

/* === КОНТЕЙНЕР И ОСНОВНОЙ КОНТЕНТ === */
.container, .main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* === ЗАГОЛОВКИ === */
h1 { font-size: 1.8rem; color: #1e3a5f; margin-bottom: 1rem; }
h2 { font-size: 1.4rem; color: #1e3a5f; margin: 2rem 0 1rem; }
h3 { font-size: 1.2rem; color: #1e3a5f; margin-bottom: 0.8rem; }
h4 { font-size: 1.05rem; color: #2c3e50; margin: 1.5rem 0 0.8rem; }

.subtitle { color: #7f8c8d; margin-bottom: 1.2rem; }

/* === ГЛАВНАЯ СТРАНИЦА === */
.hero-text { text-align: center; margin-bottom: 2.5rem; }
.hero-text h1 { font-size: 2.4rem; font-weight: 600; color: #1e3a5f; margin-bottom: 1.5rem; }
.message-box {
    background: #ffffff; border-left: 6px solid #2d6a8f; padding: 1.3rem 2rem;
    margin: 0 auto 1.2rem auto; max-width: 800px; border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03); text-align: left;
}
.big-buttons-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.8rem; width: 100%; margin: 1.5rem 0 2.5rem;
}
.big-action-btn {
    background: #ffffff; border: 2px solid #bdd3e0; border-radius: 24px;
    padding: 2rem 1.5rem; font-size: 1.2rem; font-weight: 600; color: #1e3a5f;
    text-align: center; cursor: pointer; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease; display: flex; flex-direction: column;
    align-items: center; gap: 1rem; min-height: 160px; justify-content: center;
    text-decoration: none; font-family: inherit;
}
.big-action-btn:hover {
    background: #f8fafc; border-color: #6f9bb8;
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.08); transform: translateY(-3px);
}
.info-block {
    background: #eef4f8; border-radius: 18px; padding: 1.8rem 2rem;
    max-width: 900px; width: 100%; margin-top: 1.5rem; border: 1px solid #cbdde9;
}

/* === КАРТОЧКИ === */
.card {
    background: white; border-radius: 16px; padding: 1.8rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04); margin-bottom: 1.5rem;
    border: 1px solid #f0f4f8;
}
.card-value { font-size: 2.5em; font-weight: bold; color: #1e4a5f; margin: 10px 0; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* === ТАБЛИЦЫ === */
.table {
    width: 100%; border-collapse: collapse; background: white;
    border-radius: 12px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    margin: 1.2rem 0; font-size: 0.9rem;
}
.table th {
    background: #1e4a5f; color: white; padding: 12px 14px;
    text-align: left; font-weight: 600; font-size: 0.85rem;
}
.table td { padding: 10px 14px; border-bottom: 1px solid #f0f4f8; }
.table tr:last-child td { border-bottom: none; }
.table-striped tbody tr:nth-child(even) { background: #fafbfc; }
.table tbody tr:hover { background: #f0f7fd; }

/* Отчётные таблицы */
.report-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.report-table th, .report-table td {
    border: 1px solid #999; padding: 4px 6px; text-align: center; vertical-align: middle;
}
.report-table th { background: #f0f0f0; font-size: 11px; }
.report-table td { white-space: normal; word-break: break-word; max-width: 300px; }
.group-row td { background: #e8e8e8; font-weight: bold; text-align: left; }
.table-wrap { overflow-x: auto; margin-bottom: 10px; }

/* === ФОРМЫ === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 500; color: #1e3a5f; font-size: 0.9rem; }
.form-input, .form-group input, .form-group select {
    width: 100%; padding: 10px 14px; border: 1px solid #dce3ea;
    border-radius: 8px; font-size: 0.95rem; font-family: inherit;
    transition: border-color 0.2s; background: white;
}
.form-input:focus, .form-group input:focus, .form-group select:focus {
    outline: none; border-color: #1e4a5f;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

/* === КНОПКИ === */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 22px; border: none; border-radius: 30px;
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s; text-decoration: none; gap: 8px; font-family: inherit;
}
.btn-primary { background: #1e4a5f; color: white; }
.btn-primary:hover { background: #12303e; transform: translateY(-1px); }
.btn-secondary { background: #eef2f6; color: #1e3a5f; border: 1px solid #cbd5e1; }
.btn-secondary:hover { background: #d9e2ec; }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-small { padding: 5px 12px; font-size: 0.8rem; }

/* === ЧЕКБОКСЫ === */
.checkbox-list {
    max-height: 300px; overflow-y: auto;
    border: 1px solid #ddd; border-radius: 8px; padding: 12px; background: white;
}
.checkbox-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 0;
}
.checkbox-item input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; }
.select-all-label {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 0; cursor: pointer;
}
.select-all-label input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; }

/* === БЕЙДЖИ === */
.badge {
    display: inline-block; padding: 4px 10px; border-radius: 12px;
    font-size: 0.75em; font-weight: 600;
}
.badge-uploaded { background: #ffeaa7; color: #d63031; }
.badge-parsed { background: #dfe6e9; color: #2d3436; }
.badge-confirmed { background: #55efc4; color: #00b894; }
.badge-reported { background: #74b9ff; color: #0984e3; }
.badge-duplicate {
    display: inline-block; background: #e74c3c; color: white;
    padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: bold;
    margin-left: 6px; vertical-align: middle;
}

/* === ИНФО-БЛОКИ === */
.info-box {
    background: #e8f4fd; border-left: 4px solid #1e4a5f;
    padding: 18px; margin: 20px 0; border-radius: 0 8px 8px 0;
}
.info-box h3 { margin-bottom: 12px; color: #1e3a5f; }
.info-box ul { margin-left: 20px; }
.info-box li { margin-bottom: 6px; }
.empty-message { color: #7f8c8d; font-style: italic; padding: 20px; text-align: center; }

/* === СЕКЦИИ СТРАНИЦ === */
.upload-section, .report-form, .references-section {
    background: white; border-radius: 12px; padding: 1.5rem;
    margin: 1.2rem 0; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #f0f4f8;
}
.declaration-info {
    background: white; padding: 1.2rem; border-radius: 12px;
    margin: 1.2rem 0; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.actions { margin-top: 20px; }

/* === ПРОФИЛЬ === */
.profile-grid { display: flex; flex-direction: column; gap: 20px; max-width: 700px; }
.profile-card {
    background: white; padding: 1.5rem; border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.profile-card h3 { margin-bottom: 15px; color: #2c3e50; }
.profile-row { padding: 4px 0; font-size: 14px; }
.profile-empty { font-size: 14px; color: #aaa; font-style: italic; }
.profile-edit-form .form-group { margin-bottom: 12px; }
.profile-edit-form label { display: block; margin-bottom: 4px; font-size: 13px; color: #555; }
.profile-edit-form input { width: 100%; padding: 9px; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; }
.profile-edit-form input:focus { outline: none; border-color: #1e4a5f; }
.profile-edit-form .form-row { display: flex; gap: 12px; }
.profile-edit-form .form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 10px; margin-top: 15px; }

/* === ПОДВАЛ === */
.footer {
    background: #ffffff; padding: 1.5rem 2rem; text-align: center;
    font-size: 0.9rem; color: #6b7b89; border-top: 1px solid #dce3ea; margin-top: auto;
}
.footer-legal { margin-top: 6px; font-size: .82rem; }
.footer-legal a { color: #6b7b89; }
.menu-badge {
    display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px;
    background: #c0392b; color: #fff; font-size: .75rem; text-align: center; line-height: 18px;
}

/* === СБРОС БД / АДМИН === */
.reset-message { margin-bottom: 20px; }
.reset-message .reset-success {
    background: #d4edda; color: #155724; padding: 15px 20px;
    border-radius: 6px; border-left: 4px solid #28a745; font-size: 15px;
}
.reset-message .reset-error {
    background: #f8d7da; color: #721c24; padding: 15px 20px;
    border-radius: 6px; border-left: 4px solid #dc3545; font-size: 15px;
}
.admin-section { border-left-color: #e74c3c !important; margin-top: 30px; }
.admin-section h2 { color: #e74c3c; }
.admin-buttons { display: flex; gap: 10px; margin: 15px 0; flex-wrap: wrap; }
.admin-hint { color: #7f8c8d; font-size: 0.9em; margin-top: 10px; }

/* === СТРОКИ ДУБЛИКАТОВ / ПОДСВЕТКА === */
.row-duplicate { background-color: #fdecea !important; }
.row-duplicate:hover { background-color: #f8d7d4 !important; }
.row-diff-org, .row-diff-year { background-color: #fff3cd !important; }
.row-diff-org:hover, .row-diff-year:hover { background-color: #ffeaa7 !important; }
.row-duplicate.row-diff-org, .row-duplicate.row-diff-year { background-color: #fdecea !important; }
.cell-highlight-org { font-weight: bold; color: #c0392b; }
.cell-highlight-year { font-weight: bold; color: #c0392b; }
.excluded-row { background: #f5f5f5 !important; color: #999; text-decoration: line-through; }
.excluded-row td { color: #999; }

/* === АЛЕРТЫ === */
.alerts-section { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; border-left: 4px solid; }
.alert-warning { background: #fff8e1; border-left-color: #f39c12; color: #7a5200; }
.alert strong { color: #c0392b; }

/* === ОВЕРЛЕЙ ЗАГРУЗКИ === */
#loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.loading-box {
    background: white; padding: 40px 50px; border-radius: 12px;
    text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.spinner {
    width: 50px; height: 50px; border: 5px solid #e0e0e0;
    border-top-color: #1e4a5f; border-radius: 50%;
    animation: spin 1s linear infinite; margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 18px; font-weight: bold; color: #1e4a5f; margin-bottom: 8px; }
.loading-sub { font-size: 13px; color: #888; }

/* === ПЕЧАТЬ === */
@media print {
    .navbar, .footer, .no-print, .btn { display: none !important; }
    .print-only-title { display: block !important; }
    .table-wrap { overflow: visible; }
    @page { size: A4 landscape; margin: 7mm; }
    body { font-size: 7pt; }
    .report-table { table-layout: fixed; width: 100%; font-size: 6pt; border-collapse: collapse; }
    .report-table th, .report-table td {
        white-space: normal !important; word-break: break-word;
        padding: 1mm 0.5mm; border: 0.2mm solid #000; vertical-align: top;
    }
    .report-table th { font-size: 5.5pt; background: #eee !important; -webkit-print-color-adjust: exact; }
    .group-row td { background: #ddd !important; -webkit-print-color-adjust: exact; font-size: 6pt; }
    h3 { font-size: 10pt; margin-top: 8px; }
    h4 { font-size: 8pt; margin-top: 5px; }
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 700px) {
    .navbar { flex-direction: column; padding: 1rem; gap: 0.8rem; }
    .nav-left { flex-direction: column; align-items: stretch; gap: 0.8rem; }
    .nav-buttons { width: 100%; justify-content: center; }
    .auth-container { width: 100%; }
    .profile-btn { width: 100%; }
    .dropdown-menu-profile { width: 100%; right: auto; left: 0; }
    .hero-text h1 { font-size: 1.8rem; }
    .big-action-btn { font-size: 1.1rem; padding: 1.5rem 1rem; }
    .table { font-size: 0.8rem; }
    .table th, .table td { padding: 8px 10px; }
    .form-row { grid-template-columns: 1fr; }
}

/* === СЕТКА КАРТОЧЕК (для rop и аналогичных) === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* === ИНФО-СЕКЦИЯ === */
.info-section { margin-top: 1.5rem; }
.info-section ul { margin-left: 20px; line-height: 1.8; }

/* === МОДАЛЬНОЕ ОКНО АВТОРИЗАЦИИ === */
.auth-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(30, 42, 58, 0.55);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.auth-modal-overlay.open {
    display: flex;
    animation: authFadeIn 0.2s ease;
}
.auth-modal-card {
    position: relative;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    width: 380px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: authSlideUp 0.25s ease;
}
.auth-modal-card h2 {
    font-size: 1.25rem;
    margin: 0 0 10px;
    color: #1e3a5f;
    text-align: center;
}
.auth-modal-subtitle {
    text-align: center;
    font-size: 0.9rem;
    color: #556b7c;
    margin-bottom: 20px;
}
.auth-modal-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    border: none;
    border-radius: 50%;
    background: #eef2f6;
    color: #556b7c;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}
.auth-modal-close:hover { background: #d9e2ec; color: #1e3a5f; }
.auth-modal-skip {
    text-align: center;
    font-size: 12px;
    color: #9aa8b5;
    margin-top: 14px;
}
.auth-modal-card a { color: #1e4a5f; }
@keyframes authFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes authSlideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }