/* ═══════════════════════════════════════════════════════════════════════
   TimeTrack Web — главный файл стилей
   Цветовая палитра совпадает с PyQt6-версией:
     #4a6274  — шапка (тёмно-серо-синий)
     #3a5060  — кнопки шапки / наведение
     #eef2f7  — фон страницы
     #cad8e0  — кнопки навигации (светло-голубой)
     #2c4050  — текст кнопок навигации
     #c8e1cc  — кнопки «приход» / подтверждение (зелёный)
     #2d5a35  — текст зелёных кнопок
     #c95b5b  — кнопки «уход» / удаление (красный)
     white    — фон карточек
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Сброс и базовые настройки ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.btn-icon-edit, .btn-icon-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
}
.btn-icon-edit:hover {
    background: #e8f1ff;
    color: #2980b9;
    transform: scale(1.1);
}
.btn-icon-delete:hover {
    background: #fde8e8;
    color: #c95b5b;
    transform: scale(1.1);
}
.btn-icon-edit svg, .btn-icon-delete svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}


footer {
    flex-shrink: 0;  /* запрещаем футеру сжиматься */
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    font-size: 13px;
}
footer a {
    color: #4a6274;
    text-decoration: none;
    margin: 0 10px;
}
footer a:hover {
    text-decoration: underline;
}


/* Стили для всплывающих подсказок */
[draggable=true] {
    cursor: help;
}

/* Кастомный tooltip (для браузеров, которые поддерживают) */
td[title], th[title] {
    cursor: help;
    border-bottom: 1px dotted #999;
}

/* Подсветка при наведении */
tr:hover td[title] {
    background-color: #fff8e6;
}

/* Стили для информации о выплате */
.shift-payment-info {
    margin-top: 4px;
    font-size: 11px;
    background: #e8f6ee;
    border-radius: 4px;
    padding: 2px 6px;
    display: inline-block;
    cursor: help;
}
.shift-payment-info.paid {
    background: #e8f6ee;
    color: #2d5a35;
}
.shift-payment-info.waiting {
    background: #fdf6e3;
    color: #856404;
}

/* Стили для информации о выплате в календаре */
.cal-day-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
    min-height: 20px;
    flex-wrap: wrap;
}

.cal-day-num {
    font-size: 13px;
    font-weight: bold;
    color: #2c3e50;
    flex-shrink: 0;
}

.cal-paid-badge {
    font-size: 12px;
    flex-shrink: 0;
    cursor: help;
}

.cal-paid-amount {
    font-size: 10px;
    font-weight: bold;
    color: #27ae60;
    flex-shrink: 0;
    background: #e8f6ee;
    padding: 0 4px;
    border-radius: 3px;
}

.cal-day-right {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    margin-left: auto;
}

.cal-colleagues {
    font-size: 10px;
    color: #4a6274;
    white-space: nowrap;
    overflow: hidden;
    flex: 1 1 0;
    min-width: 0;
    max-width: 80px;
    cursor: pointer;
    display: block;
}
.cal-colleagues:hover {
    color: #2c3e50;
    text-decoration: underline;
}

.cal-workers-chip {
    background: #4a6274;
    color: white;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 10px;
    cursor: pointer;
    font-weight: bold;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}
.cal-workers-chip:hover {
    background: #3a5060;
}

.cal-assign-btn {
    font-size: 12px;
    cursor: pointer;
    opacity: .65;
    transition: .15s;
    flex-shrink: 0;
    line-height: 1;
}
.cal-assign-btn:hover {
    opacity: 1;
}

/* Информация о выплате в карточке смены */
.shift-payment-info {
    margin-top: 4px;
    font-size: 11px;
    border-radius: 4px;
    padding: 2px 6px;
    display: inline-block;
    cursor: help;
    font-weight: 500;
}
.shift-payment-info.paid {
    background: #e8f6ee;
    color: #2d5a35;
    border: 1px solid #a8d8ba;
}
.shift-payment-info.waiting {
    background: #fdf6e3;
    color: #856404;
    border: 1px solid #ffc107;
}

/* Обновлённые стили для ячейки */
.cal-cell {
    min-height: 90px;
    border-radius: 6px;
    padding: 4px 6px;
    border: 2px solid transparent;
    position: relative;
    font-size: 12px;
    transition: .15s;
    overflow: hidden;
}

.shift-item { 
    font-size: 11px; 
    padding: 6px 8px; 
    border-radius: 4px; 
    margin-bottom: 4px; 
    cursor: pointer; 
    transition: .15s;
    border-left: 3px solid transparent;
    line-height: 1.4;
}
.shift-item:hover { 
    filter: brightness(0.95); 
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cal-assign-btn {
    font-size: 11px;
    color: #2980b9;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    background: #e8f1ff;
    border: 1px dashed #2980b9;
    margin-bottom: 4px;
    display: inline-block;
    transition: .15s;
    font-weight: 500;
}
.cal-assign-btn:hover {
    background: #2980b9;
    color: white;
    border: 1px solid #2980b9;
}

.shift-name { 
    font-weight: bold; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    font-size: 12px;
}
.shift-time { 
    font-size: 10px; 
    color: #555; 
    font-weight: 500;
}
.shift-payment {
    font-size: 10px;
    font-weight: 600;
    margin-top: 1px;
}
.shift-actual-in {
    font-size: 9px;
    color: #27ae60;
    font-weight: 500;
}
.shift-actual-out {
    font-size: 9px;
    color: #c95b5b;
    font-weight: 500;
}

.shift-paid { 
    background: #e8f6ee; 
    border-left-color: #2d5a35; 
}
.shift-unpaid { 
    background: #fff8e6; 
    border-left-color: #f39c12; 
}
.shift-penalty { 
    background: #fde8e8; 
    border-left-color: #c95b5b; 
}
.shift-planned { 
    background: #e8f1ff; 
    border-left-color: #2980b9; 
}

/* Для карточки смены в календаре */
.cal-day {
    min-height: 90px;
    border-radius: 6px;
    padding: 6px 8px;
    border: 1px solid #e9ecef;
    background: white;
    overflow-y: auto;
    max-height: 300px;
}

/* Стили для детализации бонусов и штрафов в модальном окне */
.payment-details-list {
    margin-top: 4px;
    padding-left: 4px;
}
.payment-detail-item {
    font-size: 12px;
    padding: 2px 0;
    padding-left: 16px;
}
.payment-detail-item.bonus {
    color: #27ae60;
}
.payment-detail-item.penalty {
    color: #c95b5b;
}
.payment-detail-item .comment {
    color: #888;
    font-size: 11px;
}

/* Стили для чисел в прошедших днях */
.cal-cell.past-work .cal-day-num,
.cal-cell.past-empty .cal-day-num {
    color: #999;
}

/* Обновлённые стили для фактического времени */
.cal-actual {
    margin-top: 2px;
    font-size: 10px;
}

.cal-shift-info {
    margin-top: 2px;
    font-size: 11px;
    color: #495057;
    font-weight: bold;
}

/* Стили для дат с выплатой */
.cal-cell .cal-paid-amount {
    background: #e8f6ee;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: bold;
    color: #27ae60;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;

    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    background-color: #eef2f7;
    color: #333;
    min-height: 100vh;
}

/* ── Логин ──────────────────────────────────────────────────────────────── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #3a5060 0%, #4a6274 50%, #5a7284 100%);
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px 36px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.login-header { text-align: center; margin-bottom: 28px; }

.login-title {
    font-size: 22px;
    font-weight: bold;
    color: #2c4050;
    margin-bottom: 6px;
}

.login-subtitle { font-size: 14px; color: #6c757d; }

.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus { border-color: #4a6274; }

.login-error {
    background: #fde8e8;
    color: #c95b5b;
    border: 1px solid #c95b5b;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background-color: #4a6274;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-login:hover { background-color: #3a5060; }
.btn-login:disabled { background-color: #aec0cc; cursor: not-allowed; }

/* ── Шапка (top-bar) ────────────────────────────────────────────────────── */
.top-bar {
    background-color: #4a6274;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left, .top-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar-center {
    flex: 1;
    text-align: center;
}

.btn-topbar {
    background-color: #3a5060;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0 20px;
    height: 36px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-topbar:hover { background-color: #506878; }

.user-info {
    color: white;
    font-size: 14px;
    font-weight: bold;
    padding: 0 15px;
}

.clock {
    color: white;
    font-size: 14px;
    font-family: monospace;
    padding: 0 15px;
    background-color: #3a5060;
    border-radius: 6px;
    height: 36px;
    display: flex;
    align-items: center;
}

.btn-logout {
    background-color: #c95b5b;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0 20px;
    height: 36px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-logout:hover { background-color: #b04848; }

/* ── Навигационная полоса ────────────────────────────────────────────────── */
.nav-bar {
    background-color: #eef2f7;
    border-bottom: 1px solid #dee2e6;
    padding: 10px 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    position: relative;
}

.btn-nav {
    background-color: #cad8e0;
    color: #2c4050;
    border: none;
    border-radius: 6px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-nav:hover { background-color: #aec0cc; }
.btn-nav.active { background-color: #4a6274; color: white; }

.notif-badge {
    color: #2980b9;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    margin-top: -8px;
    margin-left: -2px;
}

/* ── Основной контент ───────────────────────────────────────────────────── */
.main-content {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    flex: 1 0 auto;
}

.page-title {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 24px;
}

/* ── Главная страница — карточка отметки ────────────────────────────────── */
.page-dashboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding-top: 20px;
}

.attendance-card {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    padding: 30px 40px;
    width: 100%;
    max-width: 700px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.attendance-title {
    font-size: 22px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 18px;
}

.last-attendance {
    font-size: 16px;
    color: #495057;
    padding: 14px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 22px;
}

.attendance-buttons {
    display: flex;
    gap: 20px;
}

.btn-checkin, .btn-checkout {
    flex: 1;
    padding: 18px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.btn-checkin {
    background-color: #c8e1cc;
    color: #2d5a35;
}
.btn-checkin:hover:not(:disabled) { background-color: #a8cdb0; }

.btn-checkout {
    background-color: #c95b5b;
    color: white;
}
.btn-checkout:hover:not(:disabled) { background-color: #b04848; }

.btn-checkin:disabled, .btn-checkout:disabled {
    background-color: #d6d6d6;
    color: #888;
    cursor: not-allowed;
}

.nav-buttons-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-nav-card {
    background-color: #cad8e0;
    color: #2c4050;
    border-radius: 6px;
    padding: 12px 26px;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s;
    min-width: 130px;
    text-align: center;
}

.btn-nav-card:hover { background-color: #aec0cc; }

/* ── Общие кнопки ───────────────────────────────────────────────────────── */
.btn-primary {
    background-color: #4a6274;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-primary:hover { background-color: #3a5060; }

.btn-success {
    background-color: #c8e1cc;
    color: #2d5a35;
    border: none;
    border-radius: 6px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-success:hover { background-color: #a8cdb0; }

.btn-danger {
    background-color: #c95b5b;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-danger:hover { background-color: #b04848; }

.btn-secondary {
    background-color: #cad8e0;
    color: #2c4050;
    border: none;
    border-radius: 6px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-secondary:hover { background-color: #aec0cc; }

/* ── Таблицы ────────────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    font-size: 14px;
}

.data-table th {
    background-color: #f8f9fa;
    padding: 12px 14px;
    font-weight: bold;
    border: 1px solid #dee2e6;
    text-align: left;
    color: #495057;
}

.data-table td {
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

.data-table tr:hover td { background-color: #f5f8fa; }

/* Цвета уведомлений */
.notif-critical  td { background-color: #fde8e8; }
.notif-warning   td { background-color: #fdf6e3; }
.notif-important td { background-color: #e8f1ff; }
.notif-info      td { background-color: #e8f5ea; }

/* ── Модальные окна ─────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 900;
}

.modal-overlay.active { display: block; }

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 100%;
    /* max-width: 660px;*/
    max-width: 60vw; 
    padding: 0 16px;
}

.modal.active { display: block; }

.modal-dialog {
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    overflow: hidden;
}

.modal-sm  { max-width: 340px; margin: 0 auto; }
.modal-md  { max-width: 560px; margin: 0 auto; }
.modal-lg  { max-width: 800px; margin: 0 auto; }
.modal-xl  { max-width: 1050px; margin: 0 auto; }

.modal-header {
    padding: 16px 20px;
    background-color: #4a6274;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header-success { background-color: #c8e1cc; }
.modal-header-warning { background-color: #f5deb3; }
.modal-header-error   { background-color: #fde8e8; }

.modal-title {
    font-size: 16px;
    font-weight: bold;
    color: white;
    margin: 0;
}

.modal-header-success .modal-title,
.modal-header-warning .modal-title { color: #2c4050; }
.modal-header-error .modal-title   { color: #c95b5b; }

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 14px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #dee2e6;
}

.attendance-card {
    display: none;  /* по умолчанию скрыта */
}

/* ── Пин-код ────────────────────────────────────────────────────────────── */
.pin-label {
    font-size: 14px;
    font-weight: bold;
    color: #495057;
    margin-bottom: 10px;
}

.pin-input {
    width: 100%;
    padding: 12px;
    font-size: 22px;
    letter-spacing: 8px;
    text-align: center;
    border: 2px solid #3498db;
    border-radius: 8px;
    font-family: monospace;
    outline: none;
}

.pin-input:focus { border-color: #2980b9; }

.pin-error {
    color: #c95b5b;
    font-size: 13px;
    margin-top: 8px;
}

.btn-confirm {
    background-color: #c8e1cc;
    color: #2d5a35;
    border: none;
    border-radius: 6px;
    padding: 9px 22px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-confirm:hover { background-color: #a8cdb0; }
.btn-confirm:disabled { background-color: #aaa; cursor: not-allowed; }

.btn-cancel {
    background-color: #c95b5b;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 9px 22px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-cancel:hover { background-color: #b04848; }

/* ── Формы ──────────────────────────────────────────────────────────────── */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-col  { flex: 1; min-width: 200px; }

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ── Карточки / панели ──────────────────────────────────────────────────── */
.card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.card-title {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

/* ── Алерты (flash-сообщения) ───────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #e8f5ea; color: #2d5a35; border: 1px solid #c8e1cc; }
.alert-error   { background: #fde8e8; color: #c95b5b; border: 1px solid #c95b5b; }
.alert-warning { background: #fdf6e3; color: #856404; border: 1px solid #ffc107; }
.alert-info    { background: #e8f1ff; color: #2980b9; border: 1px solid #2980b9; }

/* ── Поисковая строка + фильтры ─────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.search-input {
    padding: 8px 14px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    min-width: 260px;
    outline: none;
}
.search-input:focus { border-color: #4a6274; }

/* ── Статус-бейджи ──────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}
.badge-active   { background: #c8e1cc; color: #2d5a35; }
.badge-inactive { background: #f0f0f0; color: #666; }
.badge-paid     { background: #c8e1cc; color: #2d5a35; }
.badge-unpaid   { background: #fde8e8; color: #c95b5b; }
.badge-pending  { background: #fdf6e3; color: #856404; }

/* ── Вкладки (tabs) ─────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 20px;
    gap: 2px;
}

.tab-btn {
    padding: 10px 22px;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    background-color: #f8f9fa;
    color: #495057;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.15s;
    flex: 1;
    text-align: center;
}

.tab-btn:hover { background-color: #e9ecef; }

.tab-btn.active {
    background-color: #cad8e0;
    color: #2c4050;
    border-bottom: 2px solid #cad8e0;
    margin-bottom: -2px;
}

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

/* ── Спиннер загрузки ───────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #dee2e6;
    border-top-color: #4a6274;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* ── Адаптивность ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .main-content { padding: 16px; }
    .attendance-card { padding: 20px; }
    .attendance-buttons { flex-direction: column; }
    .nav-buttons-row { flex-direction: column; align-items: center; }
    .form-row { flex-direction: column; }
    .top-bar { height: auto; flex-wrap: wrap; padding: 10px; gap: 8px; }
    .modal { max-width: 98vw; }
}

/* ── Скроллбар (Webkit) ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #aec0cc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4a6274; }

/* ── УМЕНЬШЕНИЕ ШРИФТА НА МОБИЛЬНЫХ ───────────────────────────────────── */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    .main-content {
        font-size: 14px;
        padding: 12px 10px;
    }
    .page-title {
        font-size: 18px;
        margin-bottom: 14px;
    }
    /* Таблицы */
    .data-table {
        font-size: 13px;
    }
    .data-table th,
    .data-table td {
        padding: 6px 8px;
    }
    /* Карточки */
    .card {
        padding: 12px;
        font-size: 13px;
    }
    .card-title {
        font-size: 15px;
    }
    /* Формы и поля ввода */
    .form-input,
    .form-select,
    select.form-input,
    input.form-input {
        font-size: 14px;
        padding: 8px 10px;
    }
    .form-label {
        font-size: 13px;
    }
    /* Кнопки */
    .btn-primary,
    .btn-success,
    .btn-danger,
    .btn-secondary,
    .btn-confirm,
    .btn-cancel {
        font-size: 13px;
        padding: 8px 14px;
    }
    /* Заголовки модальных окон */
    .modal-title {
        font-size: 16px;
    }
    .modal-body {
        font-size: 14px;
        padding: 12px 14px;
    }
    /* Календарь (ячейки) */
    .cal-cell,
    .cal-day {
        font-size: 11px;
        padding: 4px;
    }
    .cal-day-num {
        font-size: 13px;
    }
    .cal-shift-info {
        font-size: 10px;
    }
    .cal-actual {
        font-size: 9px;
    }
    /* Детали смены */
    .shift-detail-grid {
        font-size: 13px;
        gap: 4px 10px;
    }
    .shift-detail-grid .lbl {
        font-size: 12px;
    }
    .shift-detail-grid .val {
        font-size: 13px;
    }
    /* Уведомления */
    .notif-msg {
        font-size: 13px;
    }
    .notif-card .notif-body {
        font-size: 13px;
    }
    .notif-card .notif-type {
        font-size: 13px;
    }
    .notif-card .notif-date {
        font-size: 11px;
    }
    /* Легенды, подписи */
    .legend-item {
        font-size: 11px;
    }
    .legend-dot {
        width: 12px;
        height: 12px;
    }
    /* Итоговые панели */
    .totals-bar {
        font-size: 13px;
        padding: 10px 12px;
    }
    .total-chip .tc-label {
        font-size: 10px;
    }
    .total-chip .tc-value {
        font-size: 14px;
    }
    /* Поля поиска */
    .search-input {
        font-size: 14px;
        padding: 8px 12px;
    }
    /* Кнопка навигации */
    .btn-nav {
        font-size: 13px;
        padding: 8px 14px;
    }
    /* Детали выплат */
    .detail-shifts-table {
        font-size: 12px;
    }
    .detail-shifts-table th,
    .detail-shifts-table td {
        padding: 4px 6px;
    }
    .pay-info-value {
        font-size: 13px;
    }
    .pay-total-value {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 13px;
    }
    .main-content {
        font-size: 13px;
        padding: 8px 6px;
    }
    .page-title {
        font-size: 16px;
    }
    .data-table {
        font-size: 12px;
    }
    .data-table th,
    .data-table td {
        padding: 4px 6px;
    }
    .card {
        padding: 10px;
        font-size: 12px;
    }
    .form-input,
    select.form-input,
    input.form-input {
        font-size: 13px;
        padding: 6px 8px;
    }
    .btn-primary,
    .btn-success,
    .btn-danger,
    .btn-secondary,
    .btn-confirm,
    .btn-cancel {
        font-size: 12px;
        padding: 6px 10px;
    }
    .modal-title {
        font-size: 14px;
    }
    .modal-body {
        font-size: 13px;
    }
    .cal-cell,
    .cal-day {
        font-size: 10px;
        padding: 3px;
    }
    .cal-day-num {
        font-size: 11px;
    }
    .cal-shift-info {
        font-size: 9px;
    }
    .cal-actual {
        font-size: 8px;
    }
    .shift-detail-grid {
        font-size: 12px;
    }
    .shift-detail-grid .lbl {
        font-size: 11px;
    }
    .shift-detail-grid .val {
        font-size: 12px;
    }
    .notif-msg {
        font-size: 12px;
    }
    .notif-card .notif-body {
        font-size: 12px;
    }
    .notif-card .notif-type {
        font-size: 12px;
    }
    .legend-item {
        font-size: 10px;
    }
    .totals-bar {
        font-size: 12px;
        padding: 8px 10px;
    }
    .total-chip .tc-value {
        font-size: 13px;
    }
    .btn-nav {
        font-size: 12px;
        padding: 6px 10px;
    }
    .detail-shifts-table {
        font-size: 11px;
    }
    .detail-shifts-table th,
    .detail-shifts-table td {
        padding: 3px 4px;
    }
    .pay-info-value {
        font-size: 12px;
    }
    .pay-total-value {
        font-size: 14px;
    }
}

/* ── ПОЛНАЯ АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ ────────────────────────── */
@media (max-width: 768px) {
    /* Общие настройки – всё должно быть резиновым */
    * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        margin: 0;
        padding: 0;
        height: 100%;
        width: 100%;

    }

    .main-content {
        padding: 8px 6px !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }

    /* Все таблицы – с горизонтальной прокруткой и переносом слов */
    .table-responsive,
    .data-table,
    .payroll-table,
    .log-table,
    .detail-shifts-table,
    .ref-table,
    .users-table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        white-space: nowrap !important;
        font-size: 12px !important;
    }

    .data-table th,
    .data-table td,
    .payroll-table th,
    .payroll-table td,
    .log-table th,
    .log-table td,
    .detail-shifts-table th,
    .detail-shifts-table td,
    .ref-table th,
    .ref-table td,
    .users-table th,
    .users-table td {
        padding: 4px 6px !important;
        font-size: 11px !important;
        word-break: break-word !important;
        white-space: normal !important;
    }

    /* Карточки и панели */
    .card {
        padding: 10px !important;
        margin-bottom: 10px !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }

    .settings-group {
        padding: 10px !important;
        max-width: 100% !important;
    }

    .settings-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 4px !important;
        margin-bottom: 8px !important;
    }
    .settings-row label {
        flex: unset !important;
        width: 100% !important;
        font-size: 12px !important;
    }
    .settings-row input[type="number"],
    .settings-row input[type="text"],
    .settings-row input[type="time"] {
        width: 100% !important;
        max-width: 100% !important;
        padding: 6px 8px !important;
        font-size: 13px !important;
    }

    /* Модальные окна */
    .modal {
        padding: 0 8px !important;
        max-width: 100% !important;
    }
    .modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px auto !important;
    }
    .modal-body {
        padding: 10px 12px !important;
        max-height: 60vh !important;
        overflow-y: auto !important;
    }
    .modal-footer {
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding: 8px 12px !important;
    }
    .modal-footer button {
        flex: 1 !important;
        min-width: calc(50% - 6px) !important;
        padding: 8px 10px !important;
        font-size: 13px !important;
    }

    /* Формы */
    .form-row {
        flex-direction: column !important;
        gap: 8px !important;
    }
    .form-col {
        min-width: 100% !important;
    }
    .form-input,
    select.form-input,
    input.form-input {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 14px !important;
        padding: 8px 10px !important;
        min-height: 40px !important;
    }
    .form-label {
        font-size: 13px !important;
    }

    /* Кнопки */
    .btn-primary,
    .btn-success,
    .btn-danger,
    .btn-secondary,
    .btn-confirm,
    .btn-cancel {
        font-size: 13px !important;
        padding: 8px 12px !important;
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
        min-height: 40px !important;
    }

    /* Вкладки */
    .admin-tabs {
        flex-direction: column !important;
        align-items: stretch !important;
        border-bottom: none !important;
        gap: 4px !important;
    }
    .admin-tab {
        border: 1px solid #dee2e6 !important;
        border-radius: 6px !important;
        padding: 8px 12px !important;
        text-align: center !important;
        font-size: 13px !important;
        flex: unset !important;
        margin-bottom: 2px !important;
    }
    .admin-tab.active {
        background: #cad8e0 !important;
        border-bottom: 1px solid #dee2e6 !important;
        margin-bottom: 2px !important;
    }

    /* Строки в inline-edit (подразделения, должности) */
    .inline-edit {
        flex-wrap: wrap !important;
        gap: 4px !important;
    }
    .inline-edit input {
        flex: 1 1 100% !important;
        min-width: 100% !important;
        padding: 4px 6px !important;
        font-size: 12px !important;
    }
    .inline-edit button {
        flex: 1 !important;
        min-width: 30px !important;
        padding: 4px 6px !important;
        font-size: 12px !important;
    }

    /* Поля добавления подразделений/должностей */
    #tab-departments > div:first-child,
    #tab-positions > div:first-child {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
    }
    #tab-departments > div:first-child input,
    #tab-positions > div:first-child input {
        max-width: 100% !important;
        width: 100% !important;
        flex: unset !important;
    }
    #tab-departments > div:first-child button,
    #tab-positions > div:first-child button {
        width: 100% !important;
    }
    
}