/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-w: 220px;
    --bg: #f4f6fb;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --primary: #4f46e5;
    --primary-light: #eef2ff;

    --blue: #3b82f6;
    --blue-bg: #eff6ff;
    --green: #22c55e;
    --green-bg: #f0fdf4;
    --purple: #a855f7;
    --purple-bg: #faf5ff;
    --orange: #f97316;
    --orange-bg: #fff7ed;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    padding: 24px 16px;
}

.sidebar-logo {
    padding: 0 8px 24px;
}

.sidebar-logo-img {
    width: 100%;
    max-width: 100px;
    height: auto;
    display: block;
}

.sidebar-nav { list-style: none; display: flex; flex-direction: column; gap: 4px; flex: 1; }

/* ── Project switcher ── */
.project-switcher { position: relative; margin: 0 0 14px; }
.project-switcher-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.project-switcher-toggle:hover,
.project-switcher.open .project-switcher-toggle { border-color: var(--primary); background: var(--primary-light); }
.project-switcher-icon { font-size: 1.05rem; }
.project-switcher-name { flex: 1; text-align: left; }
.project-switcher-arrow { font-size: 0.7rem; color: var(--muted); transition: transform 0.15s; }
.project-switcher.open .project-switcher-arrow { transform: rotate(180deg); }

.project-switcher-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    padding: 4px;
    z-index: 150;
}
.project-switcher.open .project-switcher-menu { display: block; }

.project-switcher-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}
.project-switcher-item:hover { background: var(--bg); }
.project-switcher-item--active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.project-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    margin: 0 0 14px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ── Project picker (standalone page) ── */
.project-pick-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}
.project-pick-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.06);
}
.project-pick-logo { text-align: center; margin-bottom: 20px; }
.project-pick-logo img { height: 60px; }
.project-pick-title { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 4px; }
.project-pick-sub { color: var(--muted); font-size: 0.9rem; text-align: center; margin-bottom: 28px; }

.project-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.project-pick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    background: var(--surface);
}
.project-pick-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79,70,229,0.1);
}
.project-pick-icon { font-size: 2.4rem; }
.project-pick-name { font-size: 1.05rem; font-weight: 700; }
.project-pick-logout {
    display: block;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    text-decoration: none;
    margin-top: 8px;
}
.project-pick-logout:hover { color: var(--primary); }

/* ── User project access pills / rows ── */
.user-project-roles {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.user-project-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px 2px 4px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface);
}
.user-project-pill .upp-project {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.user-project-pill .upp-role { font-weight: 600; color: var(--text); }
.user-project-pill--none .upp-role { color: var(--muted); font-style: italic; }
.user-project-pill--admin     .upp-role { color: #1d4ed8; }
.user-project-pill--inspector .upp-role { color: #15803d; }
.user-project-pill--external  .upp-role { color: #64748b; }

.project-access-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.project-access-row:last-child { border-bottom: none; }
.project-access-name { flex: 1; font-weight: 600; font-size: 0.9rem; }
.project-access-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    font-size: 0.85rem;
    min-width: 140px;
}

.no-access-box { text-align: center; padding: 20px 8px; }
.no-access-icon { font-size: 3rem; display: block; margin-bottom: 12px; opacity: 0.7; }
.no-access-box h1 { font-size: 1.2rem; margin-bottom: 8px; }
.no-access-box p { color: var(--muted); font-size: 0.9rem; margin-bottom: 20px; }

/* ── Sidebar user block ── */
.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    gap: 8px;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--muted);
}

.lang-toggle {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
}
.lang-toggle:hover { color: var(--primary); }
.sidebar-change-pw {
    font-size: 0.68rem;
    color: var(--primary);
    text-decoration: none;
}
.sidebar-change-pw:hover { text-decoration: underline; }

.logout-btn {
    font-size: 1.1rem;
    color: var(--muted);
    text-decoration: none;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.logout-btn:hover { color: #ef4444; background: #fee2e2; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover { background: var(--bg); color: var(--text); }
.sidebar-nav a.active { background: var(--primary-light); color: var(--primary); }
.nav-icon { font-size: 1rem; }

/* ── Main ── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title { font-size: 1.25rem; font-weight: 600; flex: 1; }

.content { padding: 28px 32px; display: flex; flex-direction: column; gap: 24px; }

/* ── Stat Cards ── */
.stats-section { margin-bottom: 6px; }
.stats-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-icon { font-size: 1.2rem; }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.7rem; color: var(--muted); }

.stat-card--blue  { border-left: 3px solid var(--blue);   background: var(--blue-bg); }
.stat-card--green { border-left: 3px solid var(--green);  background: var(--green-bg); }
.stat-card--purple{ border-left: 3px solid var(--purple); background: var(--purple-bg); }
.stat-card--orange{ border-left: 3px solid var(--orange); background: var(--orange-bg); }

/* ── Summary Strip ── */
.summary-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.8rem;
}
.summary-strip .summary-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
}
.summary-strip .summary-group-title {
    font-weight: 700;
    color: var(--text);
    margin-right: 2px;
}
.summary-strip .summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    background: var(--bg);
    color: var(--muted);
}
.summary-strip .summary-pill .pill-label {
    font-weight: 400;
    color: var(--muted);
}
.summary-pill--total     { background: var(--blue-bg);   color: var(--blue); }
.summary-pill--excavator { background: #fff3e0; color: #e65100; }
.summary-pill--bulldozer { background: #e8f5e9; color: #2e7d32; }
.summary-pill--lowbed    { background: #f3e5f5; color: #6a1b9a; }
.summary-pill--fuel      { background: #fff7ed; color: #c2410c; }
.summary-pill--completed { background: #dcfce7; color: #166534; }
.summary-pill--skipped   { background: #fee2e2; color: #991b1b; }

/* ── Card ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 { font-size: 1rem; font-weight: 600; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }

.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }

.order-id { font-weight: 600; color: var(--primary); }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge--delivered  { background: #dcfce7; color: #166534; }
.badge--shipped    { background: #dbeafe; color: #1e40af; }
.badge--processing { background: #fef9c3; color: #854d0e; }
.badge--pending    { background: #fee2e2; color: #991b1b; }

/* ── Machine Tags ── */
.machine-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.machine-tag--excavator { background: #fff3e0; color: #e65100; }
.machine-tag--bulldozer { background: #e8f5e9; color: #2e7d32; }
.machine-tag--lowbed    { background: #f3e5f5; color: #6a1b9a; }
.machine-tag--truck     { background: #e0f2fe; color: #075985; }

.mode-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.mode-tag--operated     { background: #e8f5e9; color: #2e7d32; }
.mode-tag--standby      { background: #fff8e1; color: #f57f17; }
.mode-tag--maintenance  { background: #e3f2fd; color: #1565c0; }
.mode-tag--general      { background: #f3e5f5; color: #7b1fa2; }

/* ── Shift tags ── */
.shift-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.shift-tag--morning { background: #fef3c7; color: #92400e; }
.shift-tag--evening { background: #ddd6fe; color: #5b21b6; }

.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-tag--completed { background: #dcfce7; color: #166534; }
.status-tag--skipped   { background: #fee2e2; color: #991b1b; }

/* ── Radio pill row (used in shift form) ── */
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: none;
    letter-spacing: normal;
}
.radio-pill input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}
.radio-pill:has(input:checked) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}
.radio-pill:hover { border-color: var(--primary); }

/* ── Audit badges ── */
.audit-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.audit-badge--create       { background: #e8f5e9; color: #2e7d32; }
.audit-badge--update       { background: #e3f2fd; color: #1565c0; }
.audit-badge--delete       { background: #ffebee; color: #c62828; }
.audit-badge--login        { background: #f3e5f5; color: #6a1b9a; }
.audit-badge--login_failed { background: #fff3e0; color: #e65100; }
.audit-badge--logout       { background: #f5f5f5; color: #616161; }

/* ── Role badges ── */
.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.role-badge--super_admin { background: #ede9fe; color: #5b21b6; }
.role-badge--admin       { background: #dbeafe; color: #1d4ed8; }
.role-badge--inspector   { background: #dcfce7; color: #15803d; }
.role-badge--external    { background: #f1f5f9; color: #64748b; }

/* ── Table footer total ── */
.total-row td {
    border-top: 2px solid var(--border);
    padding-top: 12px;
    background: var(--bg);
}

.entry-id { font-weight: 600; color: var(--primary); }

/* ── Tracking values ── */
.tracking-value { font-variant-numeric: tabular-nums; }
.tracking-unit  { font-size: 0.7rem; color: var(--muted); margin-left: 1px; }

/* ── Filter Bar ── */
.filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
}

.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-group select,
.filter-group input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color 0.15s;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
    border-color: var(--primary);
}

.checkbox-dropdown {
    position: relative;
}

.checkbox-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text);
    background: var(--bg);
    cursor: pointer;
    min-width: 180px;
    transition: border-color 0.15s;
    white-space: nowrap;
}

.checkbox-dropdown-toggle:hover,
.checkbox-dropdown.open .checkbox-dropdown-toggle {
    border-color: var(--primary);
}

.checkbox-dropdown-toggle .cdd-arrow {
    font-size: 0.6rem;
    opacity: 0.5;
    transition: transform 0.15s;
}

.checkbox-dropdown.open .cdd-arrow {
    transform: rotate(180deg);
}

.checkbox-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 200;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    padding: 6px 0;
    min-width: 200px;
    max-height: 220px;
    overflow-y: auto;
}

.checkbox-dropdown.open .checkbox-dropdown-panel {
    display: block;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    font-size: 0.875rem;
    color: var(--text);
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s;
}

.checkbox-item:hover {
    background: var(--hover, rgba(0,0,0,0.04));
}

.checkbox-item input[type="checkbox"] {
    accent-color: var(--primary);
    cursor: pointer;
    width: 15px;
    height: 15px;
}

.filter-group input:disabled,
.filter-group select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.filter-divider {
    font-size: 0.8rem;
    color: var(--muted);
    padding-bottom: 8px;
    font-style: italic;
}

.filter-active-label {
    display: inline-block;
    margin-left: 10px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 999px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border, #e5e7eb);
}
.pagination__btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
    background: transparent;
    border: 1px solid var(--primary);
    text-decoration: none;
    transition: opacity 0.15s, background 0.15s;
}
.pagination__btn:hover { background: var(--primary-light); }
.pagination__btn--disabled {
    color: var(--muted);
    border-color: var(--border, #e5e7eb);
    cursor: not-allowed;
    pointer-events: none;
}
.pagination__info {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}

.default-drivers {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}
.default-drivers__row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}
.default-drivers__shift {
    color: var(--muted);
    font-size: 0.75rem;
    min-width: 70px;
}
.default-drivers__name {
    font-weight: 500;
}
.default-drivers .btn {
    margin-top: 4px;
    align-self: flex-start;
}

/* ── Test/staging banner ─────────────────────────────────────────────
   Banner is fixed at viewport top. We push every other layout element
   down by --test-banner-h via the .has-test-banner class on <body>.    */
.has-test-banner { --test-banner-h: 28px; }
.has-test-banner { padding-top: var(--test-banner-h); }
.has-test-banner .sidebar { top: var(--test-banner-h); height: calc(100vh - var(--test-banner-h)); }
.has-test-banner .roster-toolbar { top: var(--test-banner-h); }

.test-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--test-banner-h, 28px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 12px;
    background: repeating-linear-gradient(45deg, #fef08a, #fef08a 12px, #fde68a 12px, #fde68a 24px);
    color: #78350f;
    font-size: 0.72rem;
    font-weight: 600;
    border-bottom: 2px solid #f59e0b;
    box-sizing: border-box;
    line-height: 1;
}
.test-banner__pill {
    background: #f59e0b;
    color: #fff;
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.08em;
    font-size: 0.65rem;
    flex: 0 0 auto;
}
.test-banner__text {
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media print {
    .test-banner { display: none; }
    .has-test-banner { padding-top: 0; }
    .has-test-banner .sidebar { top: 0; height: 100vh; }
}

/* ── Lightweight typeahead dropdown ── */
.typeahead-list {
    position: fixed;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
    max-height: 240px;
    overflow-y: auto;
    z-index: 10000;
    -webkit-overflow-scrolling: touch;
}
.typeahead-list[hidden] { display: none; }
.typeahead-item {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.typeahead-item:hover,
.typeahead-item.is-active {
    background: var(--primary-light);
    color: var(--primary);
}

/* ── Dashboard filter (Boffa): single pill row + collapsible custom range ── */
.dash-filter {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 4px;
}
.dash-filter__pills {
    display: flex;
    gap: 4px;
    background: var(--bg);
    padding: 4px;
    border-radius: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.dash-filter__pills::-webkit-scrollbar { display: none; }
.range-pill {
    flex: 0 0 auto;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    border: none;
    background: transparent;
    border-radius: 7px;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s, background 0.15s;
    font-family: inherit;
}
.range-pill:hover { color: var(--text); }
.range-pill.is-active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.range-pill--toggle::before { content: "📅 "; }

.dash-filter__custom {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dash-filter__custom[hidden] { display: none; }
.dash-filter__custom input[type="date"] {
    flex: 1 1 130px;
    min-width: 0;
    padding: 8px 10px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}
.dash-filter__custom input[type="date"]:focus { border-color: var(--primary); }
.dash-filter__custom .btn { flex: 0 0 auto; }

/* ── KPI hero cards ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
@media (min-width: 720px) {
    .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
}
.kpi-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 2px;
    align-items: center;
    position: relative;
    overflow: hidden;
    min-width: 0;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
@media (min-width: 720px) { .kpi-card { padding: 16px 18px; column-gap: 12px; border-radius: 14px; } }
.kpi-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06); }
.kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--kpi-accent, var(--primary));
    border-radius: 14px 14px 0 0;
}
.kpi-card--blue   { --kpi-accent: #3b82f6; }
.kpi-card--orange { --kpi-accent: #f97316; }
.kpi-card--green  { --kpi-accent: #10b981; }
.kpi-card--purple { --kpi-accent: #8b5cf6; }
.kpi-card__icon {
    grid-row: span 2;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: color-mix(in srgb, var(--kpi-accent) 14%, transparent);
    color: var(--kpi-accent);
    border-radius: 8px;
}
.kpi-card__label {
    grid-column: 2;
    align-self: end;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kpi-card__value {
    grid-column: 2;
    align-self: start;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (min-width: 480px) {
    .kpi-card__label { font-size: 0.7rem; }
    .kpi-card__value { font-size: 1.4rem; }
}
@media (min-width: 720px) {
    .kpi-card__icon { width: 36px; height: 36px; font-size: 1.1rem; }
    .kpi-card__label { font-size: 0.72rem; letter-spacing: 0.06em; }
    .kpi-card__value { font-size: 1.7rem; }
}

/* ── Dashboard analytics (Boffa) ── */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (min-width: 900px) {
    .analytics-grid { grid-template-columns: 1fr 1fr; }
}
.analytics-bars {
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.analytics-bar {
    display: grid;
    grid-template-columns: minmax(80px, 1fr) 1.5fr auto;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    min-width: 0;
}
@media (min-width: 720px) {
    .analytics-bar { grid-template-columns: minmax(110px, 1fr) 2fr auto; }
}
.analytics-bar__label {
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.analytics-bar__track {
    height: 10px;
    background: var(--bg);
    border-radius: 5px;
    overflow: hidden;
}
.analytics-bar__fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}
.analytics-bar__fill--skip { background: #ef4444; }
.analytics-bar__fill--zone { background: #4f46e5; }
.analytics-bar__value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    min-width: 56px;
    text-align: right;
}

/* ── Roster grid (Boffa daily entry) ── */
.roster-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    background: var(--bg);
    padding: 8px;
    border-radius: 10px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.roster-nav-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary);
    background: #fff;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    text-decoration: none;
    user-select: none;
}
.roster-nav-btn:hover { background: var(--primary-light); }
.roster-date-form { flex: 1 1 auto; }
.roster-date-input {
    width: 100%;
    height: 40px;
    padding: 0 10px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    background: #fff;
}

.roster-stats {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.roster-stat {
    flex: 1 1 0;
    min-width: 90px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 8px;
    text-align: center;
    border: 1px solid transparent;
}
.roster-stat--done    { background: #dcfce7; color: #166534; border-color: #86efac; }
.roster-stat--skipped { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.roster-stat--pending { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }

.roster-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.roster-truck {
    background: #fff;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 10px;
}
.roster-truck__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.roster-truck__desc {
    font-size: 0.75rem;
    color: var(--muted);
}

.roster-cells {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.roster-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    min-height: 88px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.05s, box-shadow 0.15s;
}
.roster-cell:active { transform: scale(0.98); }
.roster-cell:hover  { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.roster-cell--empty     { background: #f8fafc; border-style: dashed; }
.roster-cell--completed { background: #f0fdf4; border-color: #86efac; }
.roster-cell--skipped   { background: #fef2f2; border-color: #fca5a5; }

.roster-cell__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.roster-cell__shift { white-space: nowrap; }
.roster-cell__badge {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}
.roster-cell__badge--done    { background: #16a34a; }
.roster-cell__badge--skipped { background: #dc2626; }

.roster-cell__body { display: flex; flex-direction: column; gap: 2px; }
.roster-cell__driver {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text, #1e293b);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.roster-cell__driver--default { color: var(--muted); font-weight: 500; }
.roster-cell__metric {
    font-size: 0.78rem;
    color: var(--text, #1e293b);
    font-variant-numeric: tabular-nums;
}
.roster-cell__metric--prompt {
    color: var(--primary);
    font-weight: 500;
    font-size: 0.72rem;
}
.roster-cell__fuel { color: var(--muted); font-weight: normal; }

.roster-form-actions {
    flex-wrap: wrap;
    gap: 8px;
}

@media (min-width: 720px) {
    .roster-truck { padding: 14px 16px; }
    .roster-cell { min-height: 96px; padding: 12px; }
    .roster-cell__driver { font-size: 0.9rem; }
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: 12px;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.modal--sm { max-width: 420px; }

.delete-modal-body { padding: 16px 20px; }
.delete-modal-body p { margin: 0 0 8px; font-size: 0.95rem; }
.delete-modal-detail { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.delete-modal-actions { display: flex; gap: 12px; justify-content: center; padding: 12px 20px 20px; }

.btn-sm { padding: 4px 12px; font-size: 0.78rem; }

.btn-icon {
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--bg);
    color: var(--muted);
    border: 1px solid var(--border);
    transition: all 0.15s;
}
.btn-icon:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.btn-icon--danger:hover { background: #fee2e2; color: #d32f2f; border-color: #fca5a5; }

.row-actions { white-space: nowrap; display: flex; gap: 4px; }

.tracking-active { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tracking-badge {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 600;
}

.btn-danger {
    background: #d32f2f;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.btn-danger:hover { background: #b71c1c; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1rem; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--muted);
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

/* ── Entry Form ── */
.entry-form-card { max-width: 860px; }

.entry-form { padding: 24px 20px; display: flex; flex-direction: column; gap: 24px; }

.form-row { display: flex; flex-wrap: wrap; column-gap: 20px; row-gap: 24px; }

.form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }

.form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input,
.form-group select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus { border-color: var(--primary); }

.form-group input:disabled { opacity: 0.6; cursor: not-allowed; }

.form-actions { display: flex; gap: 12px; padding-top: 4px; }

.form-alert {
    margin: 0 20px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-top: 16px;
}
.form-alert--success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.form-alert--error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.page-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.4s ease;
}
.page-toast--success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.page-toast.hide { opacity: 0; }

.btn-edit {
    background: none;
    border: 1px solid #93c5fd;
    color: #3b82f6;
    padding: 5px 7px;
    border-radius: 6px;
    line-height: 0;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-edit:hover { background: #eff6ff; }

.btn-delete {
    background: none;
    border: 1px solid #fca5a5;
    color: #ef4444;
    padding: 5px 7px;
    border-radius: 6px;
    line-height: 0;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-delete:hover { background: #fee2e2; }

/* ── Login page ── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.login-logo img { height: 48px; width: auto; }

.login-title {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
    margin-bottom: 28px;
}

.login-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.login-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-field { display: flex; flex-direction: column; gap: 6px; }

.login-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.login-field input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color 0.15s;
}

.login-field input:focus { border-color: var(--primary); }

.login-btn { width: 100%; justify-content: center; padding: 11px; font-size: 0.95rem; margin-top: 4px; }

/* ── Mobile Nav Toggle ── */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text);
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ── Responsive ── */
@media screen and (max-width: 768px) {
    .menu-toggle { display: block; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 100;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content { margin-left: 0; }

    .topbar {
        padding: 14px 16px;
        display: flex;
        align-items: center;
        gap: 12px;
    }
    .page-title { font-size: 1.1rem; }

    .content { padding: 16px; gap: 16px; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    /* Hide less critical columns on mobile to prevent horizontal scroll */
    .col-index { display: none; }
    .col-machine-id { display: none; }
    .col-operator { display: none; }
    .col-site { display: none; }

    .card { overflow-x: hidden; }
    .data-table { width: 100%; }
    .data-table td, .data-table th { white-space: normal; }

    /* Total row: flex layout so hours aligns regardless of colspan */
    .total-row { display: flex; border-top: 2px solid var(--border); }
    .total-row td { display: flex; align-items: center; border: none; padding: 10px 8px 4px; background: var(--bg); }
    .total-row td:first-child { flex: 1; }
    .total-row td:nth-child(2) { white-space: nowrap; }
    .total-row td:nth-child(3) { display: none; }

    .card-header { flex-wrap: wrap; gap: 8px; }

    .filter-form { flex-direction: column; align-items: stretch; gap: 10px; }
    .filter-group select,
    .filter-group input[type="date"] { width: 100%; }
    .filter-divider { padding-bottom: 0; }

    /* ── Expenses / Shifts: hide table, show cards ── */
    .expense-cards { display: flex; flex-direction: column; gap: 10px; }
    .expense-table-card { display: none; }

    /* Shifts table: hide secondary columns on tablet/desktop fallback */
    .col-shift-fuel, .col-shift-note { display: none; }

    /* Summary strip: vertical on mobile */
    .summary-strip { flex-direction: column; gap: 6px; }
    .summary-group { width: 100%; justify-content: space-between; }

    /* Modal: full-width on mobile */
    .modal { max-width: calc(100vw - 32px); max-height: 85vh; }
    .modal .form-row { flex-direction: column; gap: 12px; }
    .modal .form-group { min-width: 0; }
    .modal .form-actions { flex-direction: column; }
    .modal .form-actions .btn { width: 100%; justify-content: center; }
}

/* ── Print ── */
.print-header { display: none; }
.print-summary { display: none; }
.print-summary-section-label { display: none; }
.print-footer-note { display: none; }
.print-signatories { display: none; }
.print-bottom-block { display: none; }
.print-machine-summary { display: none; }

@media print {
    @page {
        size: A4 landscape;
        margin: 1.5cm 1.8cm;
    }

    body { background: #fff; font-size: 11px; color: #000; }
    .sidebar, .topbar, .card-header, .no-print { display: none !important; }
    .col-index { display: table-cell !important; }
    .col-machine-id { display: none !important; }
    .col-operator { display: table-cell !important; }
    .col-site { display: table-cell !important; }
    .col-fuel { display: table-cell !important; }
    .main-content { margin-left: 0; }
    .content { padding: 0; }
    .card { border: none; border-radius: 0; box-shadow: none; }

    #printable-area {
        display: flex;
        flex-direction: column;
        min-height: 180mm;
    }

    /* ── Print Header ── */
    .print-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 12px;
        margin-bottom: 6px;
        border-bottom: 3px solid #1a1a2e;
    }

    .print-logo { height: 52px; width: auto; }

    .print-header-right {
        text-align: right;
    }
    .print-report-title {
        font-size: 16px;
        font-weight: 700;
        color: #1a1a2e;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        margin-bottom: 4px;
    }
    .print-meta {
        font-size: 9.5px;
        color: #555;
        line-height: 1.6;
    }

    /* ── Summary boxes ── */
    .print-summary-section-label {
        display: block;
        font-size: 9px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #666;
        margin-top: 10px;
        margin-bottom: 2px;
    }
    .print-summary {
        display: flex;
        gap: 12px;
        margin: 4px 0;
    }
    .print-summary-box {
        flex: 1;
        border: 1px solid #ccc;
        border-radius: 4px;
        padding: 8px 12px;
        text-align: center;
    }
    .print-summary-box .ps-label {
        font-size: 8.5px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #666;
        display: block;
        margin-bottom: 2px;
    }
    .print-summary-box .ps-value {
        font-size: 14px;
        font-weight: 700;
        color: #1a1a2e;
    }

    .ps-excavator { background: #fff3e0 !important; border-color: #e65100 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .ps-excavator .ps-label { color: #e65100 !important; }
    .ps-excavator .ps-value { color: #e65100 !important; }

    .ps-bulldozer { background: #e8f5e9 !important; border-color: #2e7d32 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .ps-bulldozer .ps-label { color: #2e7d32 !important; }
    .ps-bulldozer .ps-value { color: #2e7d32 !important; }

    .ps-lowbed { background: #f3e5f5 !important; border-color: #6a1b9a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .ps-lowbed .ps-label { color: #6a1b9a !important; }
    .ps-lowbed .ps-value { color: #6a1b9a !important; }

    .ps-fuel { background: #e3f2fd !important; border-color: #1565c0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .ps-fuel .ps-label { color: #1565c0 !important; }
    .ps-fuel .ps-value { color: #1565c0 !important; }

    /* ── Table ── */
    .data-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 8px;
        margin-top: 4px;
        table-layout: auto;
    }

    .data-table thead tr {
        background: #1a1a2e !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .data-table th {
        padding: 5px 4px;
        font-size: 7px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: #fff !important;
        background: #1a1a2e !important;
        border: none;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .data-table td {
        padding: 4px 4px;
        border-bottom: 1px solid #e0e0e0;
        color: #000;
    }

    .data-table tbody tr:nth-child(even) td {
        background: #f7f7f7 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .data-table tbody tr:hover { background: transparent; }

    .total-row td {
        border-top: 2px solid #1a1a2e;
        background: #eef2ff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 8px;
    }

    /* ── Machine tags in print ── */
    .machine-tag {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border-radius: 999px;
        padding: 1px 5px;
        font-weight: 700;
        font-size: 7px;
    }
    .machine-tag--excavator { background: #fff3e0 !important; color: #e65100 !important; }
    .machine-tag--bulldozer { background: #e8f5e9 !important; color: #2e7d32 !important; }
    .machine-tag--lowbed    { background: #f3e5f5 !important; color: #6a1b9a !important; }
    .mode-tag { padding: 1px 5px; border-radius: 999px; font-size: 7px; font-weight: 600; }
    .mode-tag--operated { background: #e8f5e9 !important; color: #2e7d32 !important; }
    .mode-tag--standby  { background: #fff8e1 !important; color: #f57f17 !important; }

    /* ── Per-machine summary ── */
    .print-machine-summary {
        display: block;
        text-align: right;
        margin: 14px 0 0;
        page-break-inside: avoid;
        break-inside: avoid;
        page-break-before: auto;
    }

    .pms-table {
        margin-left: auto;
        border: 1px solid #ccc;
    }

    .pms-title {
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #1a1a2e;
        margin-bottom: 6px;
        text-align: right;
    }

    .pms-table {
        width: auto;
        min-width: 320px;
        border-collapse: collapse;
        font-size: 9.5px;
        margin-left: auto;
    }

    .pms-table th {
        background: #1a1a2e !important;
        color: #fff !important;
        padding: 6px 10px;
        font-size: 8px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        text-align: left;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .pms-table td {
        padding: 5px 10px;
        border-bottom: 1px solid #e0e0e0;
    }

    .pms-table .pms-total td {
        border-top: 2px solid #1a1a2e;
        background: #1a1a2e !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 7px 10px;
        font-size: 10px;
    }

    /* ── Signatories page break rules ── */
    .print-new-page-lg {
        page-break-before: always;
        break-before: page;
    }
    .print-bottom-block {
        display: block;
        margin-top: auto;
        padding-top: 40px;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .print-signatories {
        display: flex;
        justify-content: space-around;
        align-items: flex-end;
        margin-bottom: 16px;
    }
    .print-signatory {
        text-align: center;
        width: 38%;
    }
    .print-stamp {
        height: 80px;
        width: auto;
        margin-bottom: 8px;
    }
    .print-signatory-line {
        border-top: 1px solid #333;
        margin-bottom: 6px;
    }
    .print-signatory-name {
        font-size: 9px;
        font-weight: 700;
        text-transform: uppercase;
    }
    .print-signatory-title {
        font-size: 8.5px;
        color: #555;
    }
    .print-signatory-date {
        font-size: 8.5px;
        color: #333;
        margin-top: 8px;
    }

    /* ── Footer note ── */
    .print-footer-note {
        display: flex;
        margin-top: 16px;
        padding-top: 8px;
        border-top: 1px solid #ccc;
        font-size: 8.5px;
        color: #888;
        justify-content: space-between;
    }
}

@media print and (max-width: 768px) {
    .print-new-page-sm {
        page-break-before: always;
        break-before: page;
    }
}

/* ── Expense section header ── */
.expense-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.expense-section-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

/* ── Table scroll wrapper ── */
.table-scroll { overflow-x: auto; }

/* ── Expense mobile cards (hidden on desktop) ── */
.expense-cards { display: none; }

.expense-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.expense-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.expense-card-amount {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.expense-card-body {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.expense-card-date {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 500;
}
.expense-card-type {
    font-size: 0.8rem;
    color: var(--text);
    font-weight: 500;
}
.expense-card-desc {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.4;
}
.expense-card-actions {
    display: flex;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
    margin-top: 2px;
}
.expense-card-actions .btn-icon {
    flex: 1;
    justify-content: center;
    font-size: 0.78rem;
    padding: 6px 10px;
}

/* ── Expense summary pills ── */
.summary-pill--maintenance { background: #e3f2fd; color: #1565c0; }
.summary-pill--general     { background: #f3e5f5; color: #7b1fa2; }

/* ── Expense description column ── */
.expense-desc {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

/* ── Empty state ── */
.empty-state {
    padding: 48px 20px !important;
    text-align: center;
}
.empty-state-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}
.empty-state-icon { font-size: 2rem; opacity: 0.5; }

/* ── Utility classes ── */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
