/* ============================================================
   app.css — ПОЛНАЯ ВЕРСИЯ
   ============================================================ */

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

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #333;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

#app {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ===== HEADER ===== */
header {
    background: #1976d2;
    color: white;
    padding: 12px 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-left .logo {
    font-size: 20px;
    line-height: 1;
}

header h1 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-right span {
    font-size: 12px;
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* ===== SAFE AREA ===== */
@supports (padding: max(0px)) {
    header {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
    .nav-tabs {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
    main {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
    footer {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
}

/* ===== NAV TABS ===== */
.nav-tabs {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 45px;
    z-index: 99;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.nav-tabs-content {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    gap: 4px;
    padding: 0 10px;
    overflow-x: auto;
}

.nav-tab {
    padding: 10px 14px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
    transition: all 0.2s;
}

.nav-tab:hover {
    color: #1976d2;
    background: #f5f7fa;
}

.nav-tab.active {
    color: #1976d2;
    border-bottom-color: #1976d2;
}

/* ===== BACK BUTTON ===== */
.back-button-wrapper {
    margin-top: 20px;
    display: flex;
    justify-content: flex-start;
}

/* ===== MAIN ===== */
main {
    max-width: 100%;
    margin: 10px 0;
    padding: 0 15px 20px;
    flex: 1;
}

/* ===== MESSAGE ===== */
.message {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ===== RECORD FORM ===== */
.record-form {
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ===== FORM GROUP ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 13px;
    color: #555;
}

/* ===== ТЕКСТОВЫЕ ПОЛЯ (базовый стиль) =====
   Раньше его не было: на мобильном логин/пароль рендерились браузерным
   дефолтом (мелкие). font-size:16px — чтобы iOS Safari не приближал экран. */
.form-group input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    color: #263238;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

.login-card .form-group input {
    padding: 14px;
}

/* ===== ПОЛЯ ===== */
#foremanInput,
#directionInput {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    background: white;
    transition: border-color 0.2s;
}

#foremanInput:focus,
#directionInput:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    background: white;
    appearance: auto;
    -webkit-appearance: auto;
    cursor: pointer;
}

select:focus {
    border-color: #1976d2;
    outline: none;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

select option {
    padding: 8px 12px;
}

/* ===== BUTTONS ===== */
.btn-submit {
    width: 100%;
    padding: 12px;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover {
    background: #1565c0;
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-photo {
    padding: 8px 14px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-photo:hover {
    background: #388e3c;
}

.btn-nav {
    padding: 8px 16px;
    background: #f5f7fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-nav:hover {
    background: #e8ebef;
    border-color: #bbb;
}

.btn-add-small {
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-add-small:hover {
    background: #388E3C;
}

.btn-remove-photo {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== PHOTO ===== */
.photo-section {
    margin-top: 4px;
}

.photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.photo-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #ddd;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.geo-info {
    margin-top: 8px;
    padding: 6px 10px;
    background: #f0f4f8;
    border-radius: 6px;
    font-size: 12px;
    color: #555;
}

.geo-info a {
    margin-left: 6px;
    color: #1976d2;
    text-decoration: none;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 12px 15px;
    color: #888;
    font-size: 12px;
    border-top: 1px solid #e0e0e0;
    background: white;
    margin-top: auto;
    flex-shrink: 0;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 15px;
}

.login-card {
    background: white;
    padding: 30px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.login-card h1 {
    text-align: center;
    color: #1976d2;
    font-size: 22px;
    margin-bottom: 4px;
}

.login-card h2 {
    text-align: center;
    font-size: 15px;
    color: #666;
    font-weight: normal;
    margin-bottom: 24px;
}

/* ===== FILTERS ===== */
.filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.filters .form-group {
    margin-bottom: 0;
    width: 100%;
}

.filters .btn-submit {
    width: 100%;
}

/* ===== RECORDS LIST ===== */
.records-list {
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.record-card {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.record-card:last-child {
    border-bottom: none;
}

.record-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.record-body {
    color: #666;
    font-size: 13px;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 30px 0;
}

/* ===== ADMIN TABS ===== */
.admin-tabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-btn {
    padding: 10px 16px;
    background: #f5f7fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== DIR TABS ===== */
.dir-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.dir-tab {
    padding: 6px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.dir-tab:hover {
    background: #e0e0e0;
}

.dir-tab.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    max-width: 95%;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-top: 0;
    font-size: 18px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 12px;
}

/* ============================================================ */
/* ===== СОТРУДНИКИ (компактно) ===== */
/* ============================================================ */

.employee-multi-select {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    background: white;
    max-width: 100%;
}

.employee-search-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.employee-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 150px;
    background: white;
    transition: border-color 0.2s;
}

.employee-search-input:focus {
    border-color: #1976d2;
    outline: none;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

.selected-count {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    padding: 4px 12px;
    background: #f5f7fa;
    border-radius: 4px;
}

.employee-checkbox-list {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    padding: 4px;
    background: #fafafa;
}

.employee-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.15s ease;
}

.employee-checkbox-item:hover {
    background: #e8f0fe;
}

.employee-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #1976d2;
}

.employee-checkbox-item span {
    font-size: 14px;
    color: #333;
}

.loading-employees,
.no-employees {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message {
    animation: fadeIn 0.3s ease;
}

.photo-item {
    animation: fadeIn 0.3s ease;
}

/* ============================================================ */
/* ===== КАСТОМНЫЕ ВЫПАДАЮЩИЕ СПИСКИ ===== */
/* ============================================================ */

.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    background: white;
    transition: border-color 0.2s;
}

.custom-select-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.custom-select-dropdown.open {
    display: block;
}

.custom-select-options {
    max-height: 200px;
    overflow-y: auto;
}

.custom-select-option {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    transition: background 0.15s ease;
}

.custom-select-option:hover {
    background: #e8f0fe;
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option.selected {
    background: #1976d2;
    color: white;
}

.custom-select-option.empty-message {
    color: #999;
    cursor: default;
    font-style: italic;
}

.custom-select-option.empty-message:hover {
    background: none;
}

/* ============================================================ */
/* ===== ТРИГГЕР ДЛЯ СОТРУДНИКОВ ===== */
/* ============================================================ */

.employee-trigger {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    transition: border-color 0.2s;
    user-select: none;
    min-height: 44px;
}

.employee-trigger:hover {
    border-color: #1976d2;
}

.employee-trigger:active {
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

.employee-placeholder {
    color: #999;
    flex: 1;
}

.employee-placeholder:not(:empty) {
    color: #333;
}

#employeeDropdown {
    max-height: 300px;
}

#employeeDropdown .employee-search-wrapper {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

#employeeDropdown .employee-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 150px;
    background: white;
}

#employeeDropdown .employee-search-input:focus {
    border-color: #1976d2;
    outline: none;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

#employeeDropdown .selected-count {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    padding: 4px 12px;
    background: #f5f7fa;
    border-radius: 4px;
}

#employeeDropdown .employee-checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
}

#employeeDropdown .employee-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.15s ease;
}

#employeeDropdown .employee-checkbox-item:hover {
    background: #e8f0fe;
}

#employeeDropdown .employee-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #1976d2;
}

#employeeDropdown .employee-checkbox-item span {
    font-size: 14px;
    color: #333;
}

/* ============================================================
   СТИЛИ ДЛЯ СТРАНИЦЫ "МОИ ЗАПИСИ"
   ============================================================ */

.my-records-tabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.my-records-tabs .tab-btn {
    padding: 10px 16px;
    background: #f5f7fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s;
}

.my-records-tabs .tab-btn.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

/* Агрегированные фильтры */
.aggregated-filters {
    flex-direction: column;
}

.aggregated-filters .form-group {
    margin-bottom: 8px;
    width: 100%;
}

.aggregated-filters select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

/* Статистика */
.aggregated-stats {
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-card {
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #1976d2;
}

/* ============================================================
   ТАБЛИЧНЫЙ ВЫВОД ДЛЯ "МОИХ ЗАПИСЕЙ"
   ============================================================ */

.records-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.table-header {
    display: grid;
    background: #f5f7fa;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 13px;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
    gap: 8px;
    grid-template-columns: 90px 110px 1fr 1fr 1.5fr 70px 45px;
}

.table-row {
    display: grid;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
    align-items: center;
    gap: 8px;
    transition: background 0.15s ease;
    grid-template-columns: 90px 110px 1fr 1fr 1.5fr 70px 45px;
}

.table-row:hover {
    background: #f8faff;
}

.table-row:last-child {
    border-bottom: none;
}

.th-date, .td-date {
    font-weight: 500;
}
.th-time, .td-time {
    font-size: 12px;
    color: #666;
}
.th-hours, .td-hours {
    text-align: right;
    font-weight: 600;
    color: #1976d2;
}
.th-photo, .td-photo {
    text-align: center;
    font-size: 16px;
}
.photo-link {
    text-decoration: none;
    color: #1976d2;
    font-size: 16px;
    transition: transform 0.2s;
}
.photo-link:hover {
    transform: scale(1.2);
}

.table-footer {
    padding: 10px 12px;
    background: #f8faff;
    font-size: 13px;
    color: #666;
    border-top: 1px solid #e0e0e0;
    text-align: right;
    font-weight: 500;
}

.loading-state {
    text-align: center;
    padding: 30px;
    color: #888;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    background: white;
    border-radius: 8px;
}

.empty-state.error {
    color: #d32f2f;
}

/* ============================================================
   МОДАЛЬНОЕ ОКНО ДЛЯ ФОТО
   ============================================================ */

.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
    overflow: auto; /* чтобы увеличенное фото можно было прокручивать */
}

.photo-modal.active {
    display: flex;
}

.photo-modal-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-modal-close {
    position: sticky;
    top: 4px;
    align-self: flex-end;
    color: white;
    font-size: 32px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    background: rgba(0,0,0,0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 2;
}

.photo-modal-close:hover {
    transform: rotate(90deg);
    background: rgba(255,255,255,0.2);
}

.photo-modal-image {
    max-width: 92vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    object-fit: contain;
    background: #1a1a1a;
    cursor: zoom-in; /* клик по фото = увеличить/уменьшить */
}

.photo-modal-image.zoomed {
    max-width: none;
    max-height: none;
    cursor: zoom-out;
}

.photo-modal-hint {
    color: #90a4ae;
    font-size: 12px;
    margin-top: 6px;
}

.photo-modal-info {
    margin-top: 12px;
    color: #ccc;
    font-size: 13px;
    text-align: center;
    background: rgba(0,0,0,0.6);
    padding: 8px 16px;
    border-radius: 6px;
    max-width: 90%;
}

.photo-modal-info a {
    color: #64b5f6;
    text-decoration: none;
}

.photo-modal-info a:hover {
    text-decoration: underline;
}

/* ============================================================
   ЕДИНАЯ НАВИГАЦИЯ (js/nav.js): бейдж ожидания + баннер обновления
   ============================================================ */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 9px;
    background: #f44336;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
}

.sw-update-banner {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: #263238;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    font-size: 14px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sw-update-banner button {
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
}

.sw-update-banner button:hover {
    background: #1565c0;
}

/* ============================================================
   ТАБЛИЦА СОТРУДНИКОВ (АДМИН-ПАНЕЛЬ)
   ============================================================ */

/* Обертка для таблицы с адаптивным скроллом */
.employees-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Скрываем скроллбар для красоты */
.employees-table-wrapper::-webkit-scrollbar {
    height: 6px;
}
.employees-table-wrapper::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}
.employees-table-wrapper::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}
.employees-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Колонки сотрудников */
.th-emp-num, .td-emp-num {
    min-width: 35px;
    text-align: center;
    font-weight: 600;
    color: #999;
    font-size: 12px;
}
.th-emp-name, .td-emp-name {
    min-width: 160px;
}
.th-emp-org, .td-emp-org {
    min-width: 100px;
}
.th-emp-spec, .td-emp-spec {
    min-width: 100px;
}
.th-emp-payment, .td-emp-payment {
    min-width: 100px;
}
.th-emp-salary, .td-emp-salary {
    min-width: 80px;
    text-align: right;
}
.th-emp-bonus, .td-emp-bonus {
    min-width: 80px;
    text-align: right;
}
.th-emp-attr, .td-emp-attr {
    min-width: 100px;
    font-size: 11px;
}
.th-emp-rate, .td-emp-rate {
    min-width: 85px;
    text-align: right;
    font-weight: 700;
    color: #1976d2;
}
.th-emp-active, .td-emp-active {
    min-width: 65px;
    text-align: center;
}
.th-emp-updated, .td-emp-updated {
    min-width: 120px;
    font-size: 11px;
    color: #666;
}
.th-emp-actions, .td-emp-actions {
    min-width: 44px;
    width: 44px;
    text-align: center;
    flex-shrink: 0;
}

/* Шапка сотрудников (12 колонок) — minmax + min-width: данные не режутся,
   узкие экраны скроллятся wrapper'ом (было: fr-колонки сплющивались и теряли текст) */
/* ============================================================
   ТАБЛИЦЫ АДМИН-ПАНЕЛИ: ШИРИНА УВЕЛИЧЕНА В 1,5 РАЗА
   min-width 1200px -> 1800px, минимальные ширины колонок
   умножены на 1,5 (40->60, 180->270, 120->180 и т.д.).
   Причина: прежних 1200px не хватало, текст в колонках
   «Организация», «Специализация», «Атрибут» обрезался.
   ============================================================ */
.table-header-employees {
    display: grid !important;
    grid-template-columns: 40px minmax(270px, 2fr) minmax(180px, 1.3fr) minmax(180px, 1.3fr) minmax(165px, 1.1fr) minmax(120px, 0.8fr) minmax(120px, 0.8fr) minmax(150px, 1fr) minmax(128px, 0.8fr) minmax(96px, 0.6fr) minmax(165px, 1fr) 48px !important;
    min-width: 1800px;
    gap: 6px !important;
    padding: 10px 14px !important;
    font-size: 12px !important;
    background: #f5f7fa !important;
    font-weight: 600 !important;
    color: #555 !important;
    border-bottom: 2px solid #e0e0e0 !important;
    align-items: center !important;
}

/* Строка сотрудников (12 колонок) — базовая для всех */
.table-row-employees {
    display: grid !important;
    grid-template-columns: 40px minmax(270px, 2fr) minmax(180px, 1.3fr) minmax(180px, 1.3fr) minmax(165px, 1.1fr) minmax(120px, 0.8fr) minmax(120px, 0.8fr) minmax(150px, 1fr) minmax(128px, 0.8fr) minmax(96px, 0.6fr) minmax(165px, 1fr) 48px !important;
    min-width: 1800px;
    gap: 6px !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    border-bottom: 1px solid #f0f0f0 !important;
    align-items: center !important;
    transition: background 0.15s ease !important;
}

.table-row-employees:hover {
    background: #f8faff !important;
}

.table-row-employees:last-child {
    border-bottom: none !important;
}

.td-emp-num {
    color: #999;
    font-weight: 600;
    font-size: 12px;
    text-align: center;
}

.td-emp-rate {
    font-weight: 700;
    color: #1976d2;
}

/* ============================================================
   КНОПКА ШЕСТЕРЕНКА ⚙️
   ============================================================ */

.btn-edit-gear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.2s, transform 0.3s;
    color: #888;
    line-height: 1;
}

.btn-edit-gear:hover {
    background: #f0f0f0;
    transform: rotate(60deg);
    color: #1976d2;
}

.btn-edit-gear:active {
    transform: rotate(120deg);
}

/* ============================================================
   АДАПТИВ
   ============================================================ */

/* Планшеты — сетка сотрудников не переопределяется: колонки не сжимаются ниже minmax,
   скролл обеспечивает .employees-table-wrapper */
@media (max-width: 1024px) {
    .btn-edit-gear {
        font-size: 16px;
    }
}

/* Мобилы — таблица сотрудников скроллится (не сплющивается), «Мои записи» — адаптив */
@media (max-width: 768px) {
    .employees-table-wrapper {
        margin: 0 -12px;
        padding: 0 12px;
    }
    .btn-edit-gear {
        font-size: 14px;
        padding: 2px 4px;
    }

    /* "Мои записи" — адаптив */
    .table-header {
        font-size: 11px;
        padding: 8px 10px;
        gap: 4px;
        grid-template-columns: 80px 80px 1fr 1fr 1fr;
    }
    .table-row {
        font-size: 12px;
        padding: 6px 10px;
        gap: 4px;
        grid-template-columns: 80px 80px 1fr 1fr 1fr;
    }
    .th-spec, .td-spec,
    .th-org, .td-org,
    .th-photo, .td-photo {
        display: none;
    }
    .th-time, .td-time {
        font-size: 10px;
    }
    .td-hours {
        text-align: right;
    }
}

/* Супер-мобилы */
@media (max-width: 480px) {
    .employees-table-wrapper {
        margin: 0 -8px;
        padding: 0 8px;
    }
    .btn-edit-gear {
        font-size: 12px;
        padding: 1px 3px;
    }

    /* "Мои записи" — карточки */
    .table-header {
        display: none;
    }
    .table-row {
        display: flex;
        flex-wrap: wrap;
        padding: 10px 12px;
        border-bottom: 1px solid #eee;
        gap: 4px 12px;
        background: white;
    }
    .table-row span {
        font-size: 13px;
    }
    .td-date {
        font-weight: 600;
        width: 100%;
        font-size: 14px !important;
        color: #1976d2;
    }
    .td-time {
        font-size: 11px;
        color: #888;
        width: 100%;
        order: 1;
        margin-top: -4px;
    }
    .td-employee {
        font-weight: 500;
        flex: 1;
        order: 2;
    }
    .td-hours {
        font-weight: 700;
        color: #1976d2;
        margin-left: auto;
        order: 3;
    }
    .td-direction {
        width: 100%;
        color: #555;
        font-size: 12px;
        order: 4;
    }
    .td-foreman {
        color: #555;
        font-size: 12px;
        flex: 1;
        order: 5;
    }
    .td-photo {
        order: 6;
        margin-left: auto;
    }
    .photo-link {
        font-size: 18px;
    }
}

/* ============================================================
   ДЕСКТОП (большие экраны)
   ============================================================ */

@media (min-width: 1800px) {
    .employees-table-wrapper {
        overflow-x: visible !important;
    }
    .btn-edit-gear {
        font-size: 20px;
        padding: 4px 8px;
    }
}

/* ============================================================
   ФИКС: ВЫРАВНИВАНИЕ СТРОК И ШЕСТЕРЕНКИ
   ============================================================ */

/* Принудительное выравнивание всех строк таблицы */
.table-row-employees {
    display: grid !important;
    align-items: center !important;
    min-height: 48px !important;
    height: auto !important;
    padding: 6px 14px !important;
}

/* Все ячейки — flex для вертикального выравнивания */
.table-row-employees > * {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    min-height: 36px !important;
}

/* Номер — по центру */
.td-emp-num {
    justify-content: center !important;
}

/* ФИО — слева */
.td-emp-name {
    justify-content: flex-start !important;
}

/* Организация, Специализация, Оплата — слева */
.td-emp-org,
.td-emp-spec,
.td-emp-payment,
.td-emp-attr {
    justify-content: flex-start !important;
}

/* Оклад, Бонус, Ставка — справа */
.td-emp-salary,
.td-emp-bonus,
.td-emp-rate {
    justify-content: flex-end !important;
}

/* Активен — по центру */
.td-emp-active {
    justify-content: center !important;
}

/* Обновлен — слева */
.td-emp-updated {
    justify-content: flex-start !important;
}

/* ===== ШЕСТЕРЕНКА — ПО ЦЕНТРУ ===== */
.td-emp-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    min-height: 48px !important;
    padding: 0 !important;
}

.btn-edit-gear {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 18px !important;
    line-height: 1 !important;
    border-radius: 50% !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.25s ease !important;
    color: #888 !important;
    flex-shrink: 0 !important;
}

.btn-edit-gear:hover {
    background: #e3f2fd !important;
    transform: rotate(60deg) scale(1.1) !important;
    color: #1976d2 !important;
}

.btn-edit-gear:active {
    transform: rotate(120deg) scale(0.95) !important;
}

/* ===== АДАПТИВ ===== */
@media (max-width: 768px) {
    .table-row-employees {
        min-height: 42px !important;
        padding: 4px 8px !important;
    }
    
    .table-row-employees > * {
        min-height: 30px !important;
    }
    
    .td-emp-actions {
        min-height: 42px !important;
    }
    
    .btn-edit-gear {
        width: 28px !important;
        height: 28px !important;
        font-size: 15px !important;
    }
}

@media (max-width: 480px) {
    .table-row-employees {
        min-height: 36px !important;
        padding: 3px 6px !important;
        flex-wrap: wrap !important;
    }
    
    .table-row-employees > * {
        min-height: 24px !important;
    }
    
    .td-emp-actions {
        min-height: 36px !important;
        margin-left: auto !important;
    }
    
    .btn-edit-gear {
        width: 24px !important;
        height: 24px !important;
        font-size: 13px !important;
    }
}

/* ===== ДЕСКТОП ===== */
@media (min-width: 1800px) {
    .table-row-employees {
        min-height: 52px !important;
        padding: 8px 18px !important;
    }
    
    .td-emp-actions {
        min-height: 52px !important;
    }
    
    .btn-edit-gear {
        width: 38px !important;
        height: 38px !important;
        font-size: 20px !important;
    }
}

/* ============================================================
   СТИЛИ ДЛЯ СТРАНИЦЫ "ОТЧЕТЫ"
   ============================================================ */

.reports-tabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.reports-tabs .tab-btn {
    padding: 10px 16px;
    background: #f5f7fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s;
}

.reports-tabs .tab-btn.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

/* Адаптив для десктопа */
@media (min-width: 769px) {
    .reports-tabs {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .reports-tabs .tab-btn {
        flex: 0 1 auto;
        padding: 12px 24px;
        font-size: 15px;
    }
}

/* ============================================================
   ТАБЛИЦА НАПРАВЛЕНИЙ (3 КОЛОНКИ)
   ============================================================ */

.table-header-directions {
    display: grid !important;
    grid-template-columns: 1.2fr 1.2fr 1.8fr !important;
    gap: 12px !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    background: #f5f7fa !important;
    font-weight: 600 !important;
    color: #555 !important;
    border-bottom: 2px solid #e0e0e0 !important;
    align-items: center !important;
}

.table-row-directions {
    display: grid !important;
    grid-template-columns: 1.2fr 1.2fr 1.8fr !important;
    gap: 12px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    border-bottom: 1px solid #f0f0f0 !important;
    align-items: center !important;
    transition: background 0.15s ease !important;
    min-height: 44px !important;
}

.table-row-directions:hover {
    background: #f8faff !important;
}

.table-row-directions:last-child {
    border-bottom: none !important;
}

.table-row-directions > * {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    min-height: 36px !important;
}

.td-dir-object {
    justify-content: flex-start !important;
    font-weight: 500;
    color: #1976d2;
}
.td-dir-spec {
    justify-content: flex-start !important;
    color: #555;
}
.td-dir-name {
    justify-content: flex-start !important;
    font-weight: 500;
}

/* ===== АДАПТИВ ===== */
@media (max-width: 768px) {
    .table-header-directions {
        grid-template-columns: 1fr 1fr 1.4fr !important;
        padding: 6px 10px !important;
        font-size: 11px !important;
        gap: 8px !important;
    }
    .table-row-directions {
        grid-template-columns: 1fr 1fr 1.4fr !important;
        padding: 6px 10px !important;
        font-size: 12px !important;
        gap: 8px !important;
        min-height: 38px !important;
    }
    .table-row-directions > * {
        min-height: 28px !important;
    }
}

@media (max-width: 480px) {
    .table-header-directions {
        grid-template-columns: 1fr 1fr 1.2fr !important;
        padding: 4px 6px !important;
        font-size: 10px !important;
        gap: 4px !important;
    }
    .table-row-directions {
        grid-template-columns: 1fr 1fr 1.2fr !important;
        padding: 4px 6px !important;
        font-size: 11px !important;
        gap: 4px !important;
        min-height: 32px !important;
    }
    .table-row-directions > * {
        min-height: 24px !important;
    }
}

/* Фиксация заголовков таблицы */
.table-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f5f7fa;
}

.table-header-employees {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f5f7fa;
}

/* ============================================================
   ПОЛЬЗОВАТЕЛИ (админ-панель): таблица + адаптив
   ============================================================ */

/* ---- Админ-панель: блоки таблиц скроллятся в двух направлениях,
       шапки колонок прикручены к верху блока (nav-вкладки и внутренняя
       шапка страницы при этом остаются видны, т.к. таблица не растёт
       выше экрана) ---- */
.employees-table-wrapper,
.users-table-wrapper,
#dirContent {
    max-height: max(360px, calc(100vh - 260px));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
.employees-table-wrapper::-webkit-scrollbar,
.users-table-wrapper::-webkit-scrollbar,
#dirContent::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}
.employees-table-wrapper::-webkit-scrollbar-thumb,
.users-table-wrapper::-webkit-scrollbar-thumb,
#dirContent::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}

/* шапка справочников — липкая внутри своего скролл-блока */
.table-header-directions {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* overflow:hidden у .records-table ломает sticky-шапки внутри скролл-блоков */
.employees-table-wrapper .records-table,
#dirContent .records-table {
    overflow: visible;
}
/* закруглённая шапка не должна «уезжать» под скругление */
.employees-table-wrapper .table-header-employees,
#dirContent .table-header-directions {
    border-radius: 8px 8px 0 0;
}
/* верхний скролл-бар не перекрывает строки: добавляем разделитель у шапки */
.employees-table-wrapper .table-header-employees,
#dirContent .table-header-directions {
    box-shadow: 0 2px 0 #e0e0e0;
}

/* таблица сотрудников шире блока (min-width 1200px) — не скрохлем хак с
   отрицательными полями на узких экранах, а нормальный скролл */
@media (max-width: 768px) {
    .employees-table-wrapper {
        margin: 0;
        padding: 0;
    }
}
@media (max-width: 480px) {
    .employees-table-wrapper {
        margin: 0;
        padding: 0;
    }
}

/* ---- */
.users-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.users-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate; /* sticky <th> корректно только с separate */
    border-spacing: 0;
    font-size: 13px;
}
.users-table th {
    background: #f5f7fa;
    color: #555;
    font-weight: 600;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}
.users-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.users-table tr:hover td { background: #f8faff; }
/* нумерация как в «Сотрудниках»: узкий столбец, ФИО — жирным */
.users-table th.col-num,
.users-table td.col-num {
    width: 40px;
    text-align: center;
    color: #90a4ae;
    font-weight: 600;
    white-space: nowrap;
}
.users-table td:nth-child(2) { font-weight: 600; }



/* ============================================================
   ИНДИКАТОР ПЕРЕХОДА МЕЖДУ СТРАНИЦАМИ
   Раньше каждая вкладка перезагружала документ — был виден «белый»
   промежуток, пока грузились HTML, стили и скрипты. Теперь переход
   делает роутер в js/nav.js, и полоса показывает, что идёт загрузка.
   Без неё на медленной сети кажется, что приложение зависло.
   ============================================================ */
.page-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: #2f6fed;
    box-shadow: 0 0 8px rgba(47, 111, 237, .6);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: width .18s ease, opacity .2s ease;
}
.page-progress.active {
    opacity: 1;
    width: 75%;
}
/* Полоса «заполняется» и гаснет — переход завершился. */
.page-progress.active::after {
    content: '';
    display: block;
    height: 100%;
    width: 100%;
    background: #2f6fed;
    animation: page-progress-finish .22s ease forwards;
}
@keyframes page-progress-finish {
    from { transform: translateX(-60%); }
    to   { transform: translateX(0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .page-progress, .page-progress.active::after { transition: none; animation: none; }
}


/* ============================================================
   СОГЛАСИЕ НА ОБРАБОТКУ ПЕРСОНАЛЬНЫХ ДАННЫХ
   Форма входа. Текст объёмный, поэтому он разбит на строки и
   ведёт на страницу политики. Подсказка под блоком исчезает,
   как только человек поставил галочку, — иначе она мешает.
   ============================================================ */
.consent-box {
    margin: 16px 0 4px;
    padding: 12px 12px 10px;
    background: #f5f7fa;
    border: 1px solid #dfe4ea;
    border-radius: 8px;
}
.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.45;
    color: #333;
    font-weight: normal;
    margin: 0;
}
.consent-label input[type="checkbox"] {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    accent-color: #1976d2;
    cursor: pointer;
}
.consent-label a {
    color: #1976d2;
    text-decoration: underline;
    word-break: break-word;
}
.consent-hint {
    display: block;
    margin-top: 8px;
    padding-left: 30px;
    font-size: 12px;
    color: #b26a00;
}
.consent-box.is-ok {
    background: #f1f8f1;
    border-color: #c8e0c8;
}
.consent-box.is-ok .consent-hint {
    display: none;
}

/* Кнопка входа заблокирована, пока не подтверждено согласие. */
.btn-submit:disabled {
    opacity: .55;
    cursor: not-allowed;
}
