/* CSS Variables - project design tokens */
/*
 * Breakpoint system (unified):
 *   @media (max-width: 480px)   — small phones
 *   @media (max-width: 768px)   — tablets / narrow
 *   @media (max-width: 900px)   — table compact (font/padding)
 *   @media (max-width: 1100px)  — table column hiding
 *   @media (min-width: 769px)   — wider-than-tablet (complement)
 *   @media (min-width: 1101px)  — extra-wide (centering)
 */
:root {
    --bg-main: #0a0e17;
    --bg-card: #1e2832;
    --bg-input: #151c26;
    --border: #2a3441;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #60a5fa;
    --text-primary: #e6e6e6;
    --text-secondary: #b8c3d1;
    --text-muted: #8b96a5;
    --text-dim: #6b7280;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --warning: #f59e0b;
    --purple: #a78bfa;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg-main) url('/static/fone.jpg') center / cover no-repeat;
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
}
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(10,14,23,0.4);
    pointer-events: none;
    z-index: 0;
}
body > * { position: relative; z-index: 1; }

.top-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px;
}
.top-bar .title { font-weight: 600; color: var(--text-primary); font-size: 18px; }
.top-bar .right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-bar .user { color: var(--text-secondary); font-size: 14px; }

.nav-link {
    padding: 6px 14px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-xs);
    font-size: 13px;
    transition: background 0.15s;
}
.nav-link:hover { background: var(--accent-hover); }
.nav-link.active { background: var(--accent-hover); }

.logout-btn {
    padding: 6px 14px;
    background: var(--danger-hover);
    color: #fecaca;
    text-decoration: none;
    border-radius: var(--radius-xs);
    font-size: 13px;
    transition: background 0.15s;
}
.logout-btn:hover { background: #991b1b; }

.content { padding: 0 20px 20px; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.card-header {
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border);
    margin-bottom: 15px;
}

.page-title { font-size: 24px; font-weight: 600; color: var(--text-primary); }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table thead {
    position: sticky;
    top: 0;
    z-index: 3;
}
table th {
    background: var(--bg-input);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--accent);
    white-space: nowrap;
}
table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}
table td input, table td select { width: 100%; box-sizing: border-box; }
table td input[type="date"] { min-width:0; }
table tbody tr:nth-child(even) td { background: rgba(21,28,38,0.4); }
table tbody tr:hover td { background: var(--border); }
table tbody tr { transition: background .1s; }
table td .btn-sm { padding: 4px 10px; font-size: 11px; }
table .badge { font-size: 10px; padding: 2px 8px; }
table .actions { display: flex; gap: 4px; white-space: nowrap; align-items: center; }

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    color-scheme: dark;
    transition: border-color .2s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-light);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    display: inline-block;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger-hover); color: #fecaca; }
.btn-danger:hover { background: #991b1b; }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--border); color: var(--text-primary); }
.btn-filter {
    background: #1e3a5f;
    color: #93c5fd;
    border: 1px solid var(--accent);
}
.btn-filter:hover { background: var(--accent-hover); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 500;
}
.badge-green { background: #166534; color: #86efac; }
.badge-blue { background: #1e3a5f; color: #93c5fd; }
.badge-red { background: #7f1d1d; color: #fecaca; }
.badge-amber { background: #451a03; color: #fcd34d; }
.badge-orange { background: #f97316; color: white; padding: 2px 8px; border-radius: var(--radius-xs); font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-teal { background: #134e4a; color: #5eead4; }
.badge-purple { background: #4c1d95; color: #c4b5fd; }
.badge-gray { background: var(--border); color: var(--text-muted); }

.flash {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 14px;
}
.flash.error { background: #7f1d1d; color: #fecaca; border-left: 4px solid var(--danger); }
.flash.info { background: #1e3a5f; color: #93c5fd; border-left: 4px solid var(--accent); }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
/* grid-2 collapse moved to @media (max-width:768px) section below */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.stat-card .stat-value { font-size: 32px; font-weight: 700; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); }
.stat-card-full { grid-column: 1 / -1; }

.stat-cards-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-weight: 500; font-size: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    text-decoration: none;
}
.pagination a { background: var(--border); color: var(--text-secondary); }
.pagination a:hover { background: var(--accent); color: white; }
.pagination .current { background: var(--accent); color: white; }

@media (max-width: 768px) {
    .top-bar { flex-direction: column; align-items: stretch; gap: 12px; margin: 10px; padding: 12px; }
    .top-bar .title { text-align: center; font-size: 16px; }
    .top-bar .right { flex-wrap: wrap; justify-content: center; gap: 6px; }
    .top-bar .right .user { width: 100%; text-align: center; font-size: 13px; }
    .nav-link, .logout-btn { flex: 1 1 calc(50% - 3px); min-width: 100px; text-align: center; padding: 8px 10px; }
    .content { padding: 0 10px 10px; }
    .form-row { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-card .stat-value { font-size: 24px; }
    .stat-card .stat-label { font-size: 12px; }
}
@media (max-width: 480px) {
    table { font-size: 12px; }
    table th, table td { padding: 6px 8px; }
    .chart-container { height: 200px !important; }
    .collapse-body-inner { padding: 12px; }
    .collapse-header { padding: 10px 12px; }
    .chart-card { padding: 12px; }
    .stat-value { font-size: 18px !important; }
    .rank-name { font-size: 10px; }
    .stat-card { padding: 8px; }
    .stat-card .stat-label { font-size: 10px; }
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 20px;
    max-width: 100%;
}
.chart-container {
    width: 100%;
    height: 280px;
    max-width: 100%;
    overflow: hidden;
}
.apexcharts-canvas { max-width: 100% !important; }
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ===== Dashboard-specific styles (moved from dashboard.html inline) ===== */
.chart-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.title-icon {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.chart-card.ranking-card { height: auto; min-height: 260px; }

/* Ranking */
.rank-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(42,52,65,0.3);
    animation: slideUp 0.3s ease forwards;
    opacity: 0;
    transform: translateY(8px);
}
@keyframes slideUp {
    to { opacity: 1; transform: translateY(0); }
}
.rank-row:nth-child(1) { animation-delay: 0s; }
.rank-row:nth-child(2) { animation-delay: 0.04s; }
.rank-row:nth-child(3) { animation-delay: 0.08s; }
.rank-row:nth-child(4) { animation-delay: 0.12s; }
.rank-row:nth-child(5) { animation-delay: 0.16s; }
.rank-row:nth-child(6) { animation-delay: 0.2s; }
.rank-row:nth-child(7) { animation-delay: 0.24s; }
.rank-row:nth-child(8) { animation-delay: 0.28s; }
.rank-row:nth-child(9) { animation-delay: 0.32s; }
.rank-row:nth-child(10) { animation-delay: 0.36s; }
.rank-row:last-child { border-bottom: none; }
.rank-num { width: 22px; flex-shrink: 0; text-align: center; font-size: 12px; }
.medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    color: white;
}
.medal.gold { background: linear-gradient(135deg,var(--warning),#d97706); box-shadow: 0 0 8px rgba(245,158,11,0.4); }
.medal.silver { background: linear-gradient(135deg,var(--text-muted),var(--text-dim)); box-shadow: 0 0 8px rgba(156,163,175,0.3); }
.medal.bronze { background: linear-gradient(135deg,var(--warning),var(--danger)); box-shadow: 0 0 8px rgba(212,130,74,0.3); }
.rank-plain { color: var(--text-dim); font-weight: 500; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { display: block; color: var(--text-secondary); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.rank-bar-track { width: 100%; height: 5px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.rank-bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg,var(--purple),#c4b5fd); transition: width 0.6s ease; }
.rank-count { color: var(--text-primary); font-weight: 600; font-size: 12px; width: 32px; text-align: right; flex-shrink: 0; }

.chart-subtitle { font-size:12px; color:var(--text-dim); font-weight:400; margin-left:4px; }

.period-group { display:flex; gap:4px; }
.period-btn {
    padding: 4px 10px; border-radius: var(--radius-xs); font-size: 12px;
    text-decoration: none; color: var(--text-muted); background: var(--bg-input);
    border: 1px solid var(--border); transition: all 0.15s;
}
.period-btn:hover { background: var(--border); color: var(--text-primary); }
.period-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}
.table-wrap::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 40px;
    background: linear-gradient(to right, transparent, var(--bg-card));
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s;
}
.table-wrap.is-scrollable::after { opacity: 1; }
.table-wrap table { min-width: 600px; }
.table-wrap th, .table-wrap td { white-space: nowrap; }
.table-wrap td .badge { white-space: nowrap; }

.table-wrap td.sticky-right,
.table-wrap th.sticky-right {
    position: sticky;
    right: 0;
    z-index: 2;
}
.table-wrap td.sticky-right { background: var(--bg-card); }
.table-wrap td.sticky-right::before,
.table-wrap th.sticky-right::before {
    content: '';
    position: absolute;
    left: -20px; top: 0; bottom: 0;
    width: 20px;
    background: linear-gradient(to right, transparent, var(--bg-card));
    pointer-events: none;
}
.table-wrap tr:hover td.sticky-right { background: var(--border); }
.table-wrap tr:hover td.sticky-right::before { background: linear-gradient(to right, transparent, var(--border)); }

@media (max-width: 900px) {
    .table-wrap th, .table-wrap td { padding: 6px 8px; font-size: 12px; }
    .table-wrap th a { font-size: 11px; }
    .table-wrap .badge { font-size: 10px; padding: 2px 6px; }

}
@media (max-width: 1100px) { .col-optional { display:none; } }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: end; }
.filters .filter-group { display: flex; flex-direction: column; gap: 4px; }
.filters .filter-group label { font-size: 11px; color: var(--text-muted); }
.filters input, .filters select { width: auto; min-width: 140px; padding: 8px 10px; font-size: 13px; }

/* salary grid — two tables side by side on desktop */
.salary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

.actions { display: flex; gap: 8px; }
.actions a { color: var(--accent-light); text-decoration: none; font-size: 13px; }
.actions a:hover { text-decoration: underline; }
.actions .delete { color: var(--danger); }

.footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
}
.footer a { color: var(--accent-light); text-decoration: none; }

/* ===== Desktop/Mobile toggle ===== */
.desktop-only { display: block; }
.mobile-only { display: none; }
@media (max-width:768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; flex-direction:column; gap:8px; }
}

/* ===== Modal overlay ===== */
.modal-overlay {
    display:none; position:fixed; top:0; left:0; right:0; bottom:0;
    background:rgba(0,0,0,0.6); z-index:1000;
    align-items:center; justify-content:center; padding:16px;
}
.modal-overlay.open { display:flex; }
.modal-window {
    background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg);
    padding:20px; width:100%; max-width:480px; max-height:90vh; overflow-y:auto;
}
.modal-title { font-weight:600; font-size:16px; margin-bottom:14px; color:var(--text-primary); }
.modal-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:16px; flex-wrap:wrap; }
@media (max-width:768px) {
    .modal-window { max-width:100%; border-radius:var(--radius-md); margin:auto 8px; }
}

/* ===== Moved from template inline @media (unified breakpoints) ===== */

/* --- 480px: small phones --- */
@media (max-width:480px) {
    .salary-table .calc-row td { padding:6px 8px; font-size:12px; }
    .salary-table .qty-cell { font-size:12px; }
    .salary-table .row-label { font-size:13px; }
    .tech-log-tabs .tab { font-size:11px; padding:10px 2px; }
    .tech-log-works td { font-size:10px; }
    .collapse-header .period-btn { padding: 2px 6px; font-size: 10px; }
    .collapse-header .period-group { gap: 2px; }
    .stat-value { font-size: 20px !important; }
}

/* --- 768px: tablets / narrow --- */
@media (max-width:768px) {
    /* grid-2 collapse (was @media 600px) */
    .grid-2 { grid-template-columns: 1fr; }
    /* dashboard charts (was 700px) */
    .charts-grid { grid-template-columns: 1fr; }
    /* salary card compact */
    .salary-calc-card { padding:12px; }
    .salary-calc-card .calc-header { flex-direction:column; align-items:stretch; gap:8px; }
    .salary-calc-card .calc-header strong { text-align:center; }
    .salary-calc-card .calc-header #autoCalcBtn { width:100%; }
    .salary-table .calc-row td { padding:8px 10px; }
    .salary-table .calc-row td:first-child { border-left-width:2px; }
    .val-cell span[data-field], .extra-line span[data-field] { min-height:28px; display:inline-block; padding:2px 4px; }
    .total-value { font-size:16px; }
    .due-value { font-size:14px; }
    .action-row td { display:flex; flex-direction:row; gap:6px; flex-wrap:wrap; }
    .action-row td button, #addReceiptBtn, #saveCalcBtn { flex:none; padding:6px 10px; font-size:12px; white-space:nowrap; }
    #receiptsTable td, #calcTable td { font-size:13px; }
    #receiptsTable, #calcTable { min-width:0; width:100%; table-layout:auto; }
    #receiptsTable th, #receiptsTable td, #calcTable th, #calcTable td { white-space:normal; word-break:break-word; }
    #receiptsTable th:nth-child(1), #receiptsTable td:nth-child(1) { width:35%; }
    #receiptsTable th:nth-child(2), #receiptsTable td:nth-child(2) { width:22%; }
    #receiptsTable th:last-child, #receiptsTable td:last-child { width:36px; }
    #calcTable th:nth-child(1), #calcTable td:nth-child(1) { width:40%; }
    #calcTable th:nth-child(2), #calcTable td:nth-child(2) { width:35%; }
    #calcTable th:nth-child(3), #calcTable td:nth-child(3) { width:25%; }
    .salary-grid .card .table-wrap { overflow-x:visible; }
    .salary-grid .card .table-wrap table { min-width:0; }
    /* driver-cards filter pills (was 700px) */
    .pill { min-height:30px; padding:3px 10px; font-size:12px; gap:4px; }
    .filter-actions { flex-direction:row; flex-wrap:wrap; gap:6px; }
    .filter-actions .btn, .filter-actions .btn-reset, .mobile-excel { flex:1; min-width:0; justify-content:center; min-height:38px; font-size:13px; padding:6px 10px; }
    .mobile-excel { margin-left:0; }
    /* planner modal inputs */
    .planner-modal-field input,
    .planner-modal-field select,
    .planner-modal-field textarea { min-height:44px; font-size:16px; }
    /* verification mobile cards */
    .verif-card {
        background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-md);
        padding:12px;
    }
    .verif-card:active { transform:scale(0.98); }
    .verif-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
    /* tachographs mobile cards */
    .tacho-card {
        background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-md);
        padding:12px;
    }
    .tacho-card:active { transform:scale(0.98); }
    .tacho-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
    /* tech-log mobile cards */
    .ledger-card {
        background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-md);
        padding:12px; display:flex; flex-direction:column; gap:6px;
    }
    .ledger-card:active { transform:scale(0.98); }
    .lcard-header { display:flex; justify-content:space-between; align-items:center; }
    .lcard-date { font-weight:600; font-size:14px; }
    .lcard-body { font-size:13px; color:var(--text-secondary); }
    .lm-modal-body { font-size:14px; display:flex; flex-direction:column; gap:6px; }
    .lm-modal-body .lm-row { display:flex; justify-content:space-between; padding:4px 0; border-bottom:1px solid var(--border); }
    .lm-modal-body .lm-label { color:var(--text-dim); font-size:12px; }
    .wcard {
        background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-md);
        padding:10px; display:flex; flex-direction:column; gap:6px;
    }
    .wcard-header { display:flex; align-items:center; gap:6px; }
    .wcard-body { display:flex; flex-direction:column; gap:4px; }
    .wcard-row { display:flex; align-items:center; gap:4px; }
    .wcard input { background:var(--bg-input); border:1px solid var(--border); border-radius:4px; padding:8px 10px; color:var(--text-primary); font-size:14px; color-scheme:dark; }
    .wcard input:focus { border-color:var(--accent); outline:none; }
    .wcard input[type="checkbox"] { width:20px; height:20px; accent-color:var(--accent); }
    .wcard-footer { display:flex; justify-content:flex-end; }
    .wcard .wcard-amount { font-size:15px; }
    /* tech-log compact (was 700px) */
    #tabWorks .card, #tabMoney .card { padding:8px !important; }
    #worksTable { font-size:11px !important; }
    #worksTable td, #ledgerTable td { white-space:nowrap; padding:4px; }
    .tabs { position:sticky; top:0; z-index:10; }
    #worksTable thead th, #ledgerTable thead th { position:sticky; top:41px; z-index:9; }
    .tabs .tab { font-size:13px; padding:10px 4px; }
}

/* --- 900px: table compact --- */
@media (max-width:900px) {
    /* driver-cards table */
    .dc-wrap table { min-width:100%; }
    .dc-wrap th, .dc-wrap td { white-space:nowrap; }
    .dc-wrap th a { font-size:10px; }
    /* salary grid collapse */
    .salary-grid { grid-template-columns:1fr; }
}

/* --- 769-1100px: chart grid 2 columns --- */
@media (min-width:769px) and (max-width:1100px) {
    .charts-grid { grid-template-columns: 1fr 1fr; }
}

/* --- min-width complements --- */
@media (min-width:769px) {
    .dt-works .chk-col { width:36px; }
    .dt-works .num-col { width:65px; }
    .dt-ledger .num-col { width:100px; }
    #tabMoney .card { max-width:700px; margin:0 auto; }

    /* tech-log: works + money side by side */
    .techlog-desktop-grid {
        display: flex !important;
        gap: 12px;
        align-items: flex-start;
    }
    .techlog-desktop-grid .techlog-works-col {
        flex: 1;
        min-width: 0;
        max-width: 65%;
    }
    .techlog-desktop-grid .techlog-money-col {
        width: auto;
        min-width: 380px;
        flex-shrink: 0;
    }
    .techlog-tabs-bar { display: none !important; }
}
@media (min-width:1101px) {
    .tab-content .card { max-width:1200px; margin:0 auto; }
}

/* ===== Collapsible sections (tacho + verif widgets) ===== */
.collapse-section {
    margin-top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: visible;
}
.collapse-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.collapse-header:hover {
    background: rgba(42,52,65,0.4);
}
.collapse-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    color: var(--text-dim);
    flex-shrink: 0;
}
.collapse-arrow.open {
    transform: rotate(90deg);
}
.collapse-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}
.collapse-body.open {
    max-height: 2000px;
}
.collapse-body-inner {
    padding: 18px;
}
.collapse-header .period-group {
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ===== Row tooltip (employee name on hover) ===== */
.row-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    background: #1e293b;
    color: #e6e6e6;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    border: 1px solid #2a3441;
    display: none;
}
