body {
    font-family: 'Inter', sans-serif;
    background-color: #f1f5f9;
    margin: 0;
    padding: 0;
    color: #111;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-weight: 400;
}

.controls-wrapper {
    background: #0f2027;
    padding: 10px 15px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 100;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
}

.controls-wrapper h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    margin-right: 5px;
}

.controls-wrapper h2 a {
    color: #f59e0b;
    text-decoration: none;
    transition: color 0.2s;
}

.controls-wrapper h2 a:hover {
    color: #fbbf24;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.control-group label {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

input,
select {
    padding: 4px 8px;
    border: 1px solid #334155;
    border-radius: 4px;
    font-family: 'Inter';
    font-size: 12px;
    background: #1e293b;
    color: white;
    outline: none;
    height: 28px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

input:focus,
select:focus {
    border-color: #38bdf8;
}

.btn {
    border: none;
    padding: 0 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
    margin-top: 14px;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
}

.nav-buttons-container {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
}

.btn-nav {
    background: transparent;
    border: 1.5px solid;
}

.btn-nav.home {
    border-color: #84cc16;
    color: #a3e635;
}

.btn-nav.home:hover {
    background: #4d7c0f;
    color: white;
    border-color: #4d7c0f;
}

.btn-nav.db {
    border-color: #f59e0b;
    color: #fbbf24;
}

.btn-nav.db:hover {
    background: #b45309;
    color: white;
    border-color: #b45309;
}

.btn-nav.entry {
    border-color: #3b82f6;
    color: #60a5fa;
}

.btn-nav.entry:hover {
    background: #1d4ed8;
    color: white;
    border-color: #1d4ed8;
}

.btn-nav.pending {
    border-color: #e879f9;
    color: #d8b4fe;
}

.btn-nav.pending:hover {
    background: #9333ea;
    color: white;
    border-color: #9333ea;
}

.btn-nav.ts {
    border-color: #f43f5e;
    color: #fca5a5;
}

.btn-nav.ts:hover {
    background: #be123c;
    color: white;
    border-color: #be123c;
}

.edit-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1e293b;
    padding: 0 10px;
    border-radius: 15px;
    border: 1px solid #38bdf8;
    height: 26px;
    margin-top: 14px;
}

.edit-toggle-wrapper input {
    margin: 0;
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.edit-toggle-wrapper label {
    margin: 0;
    color: #38bdf8;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
}

.right-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.global-search {
    padding: 0 12px;
    border-radius: 15px;
    border: 1px solid #334155;
    background: #1e293b;
    color: white;
    font-size: 12px;
    width: 220px;
    height: 28px;
    box-sizing: border-box;
}

.export-wrapper {
    position: relative;
}

.export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    margin-top: 5px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 200;
    width: 220px;
}

.export-menu button {
    background: none;
    border: none;
    padding: 12px 15px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.export-menu button:hover {
    background: #f1f5f9;
    color: #2563eb;
}

.export-menu button:not(:last-child) {
    border-bottom: 1px solid #f1f5f9;
}

.loader {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: rotation 1s linear infinite;
    display: none;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 🟢 Excel Filter CSS */
.filter-icon {
    font-size: 14px;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: auto;
}

.filter-icon:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

.filter-icon.filter-active {
    color: #f59e0b !important;
    font-weight: bold;
}

.excel-filter-menu {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #cbd5e1;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    overflow: hidden;
    width: 240px;
    color: #111;
    flex-direction: column;
}

.excel-filter-search {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.excel-filter-search input {
    width: 100%;
    color: #000;
    background: #fff;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
    box-sizing: border-box;
}

.excel-filter-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 5px 0;
}

.filter-item {
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.1s;
}

.filter-item:hover {
    background: #f1f5f9;
}

.filter-item label {
    cursor: pointer;
    flex-grow: 1;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #1e293b;
}

.filter-item input[type="checkbox"] {
    width: auto;
    height: auto;
    margin: 0;
}

.excel-filter-actions {
    padding: 10px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    background: #f8fafc;
    gap: 10px;
}

.excel-filter-actions button {
    flex: 1;
    padding: 6px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 12px;
}

.btn-apply-filter {
    background: #2563eb;
    color: white;
}

.btn-clear-filter {
    background: #e2e8f0;
    color: #475569;
}

/* 🟢 Table Styles */
.table-container {
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: auto;
    flex: 1;
    background: white;
}

.ts-table {
    border-collapse: collapse;
    width: max-content;
    background: white;
    font-size: 12px;
    border: 1px solid #000;
    table-layout: auto;
    margin: 0;
}

.ts-table th,
.ts-table td {
    border: 1px solid #3b3e42;
    padding: 0;
    text-align: center;
    vertical-align: middle;
}

.ts-table thead th {
    background-color: #1e3a5f;
    color: white;
    font-weight: 600;
    position: sticky;
    z-index: 10;
}

.ts-table thead .sub-title-row th {
    font-size: 15px;
    padding: 10px;
    letter-spacing: 0.5px;
    z-index: 12;
    top: 0;
    background-color: #1e3a5f;
}

.col-header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    box-sizing: border-box;
    font-size: 11px;
    text-transform: uppercase;
}

.resizable-th {
    overflow: hidden;
    min-width: 100px;
    max-width: 400px;
    position: relative;
}

.resizer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    user-select: none;
    z-index: 15;
    transition: background 0.2s;
}

.resizer:hover,
.resizing {
    background-color: #38bdf8;
}

td {
    padding: 6px 8px;
    font-size: 12px;
    color: #111;
    word-wrap: break-word;
    white-space: normal;
    overflow-wrap: break-word;
    height: 24px;
}

.ts-table tbody tr {
    background-color: #ffffff;
}

.ts-table tbody tr:hover {
    background-color: #f1f5f9;
}

.th-filter-input {
    width: calc(100% - 8px);
    margin-top: 3px;
    padding: 3px;
    font-size: 10px;
    display: none;
    color: black;
    border: 1px solid #ccc;
    border-radius: 2px;
    background: white;
    outline: none;
    height: auto;
}

.day-header {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    height: 35px;
    font-size: 10px;
    padding: 2px !important;
    color: #e2e8f0;
}

.date-header {
    font-weight: 700;
    font-size: 12px;
    padding: 4px !important;
}

.col-no {
    width: 30px;
}

.col-type {
    min-width: 90px;
    cursor: context-menu;
    position: relative;
}

.col-mobile {
    min-width: 80px;
}

.col-site {
    min-width: 100px;
    cursor: context-menu;
    white-space: normal !important;
    max-width: 140px;
    position: relative;
}

.col-plate {
    min-width: 80px;
    cursor: context-menu;
    font-weight: bold;
    position: relative;
}

.col-day {
    width: 25px;
    font-weight: 600;
}

.col-summary {
    width: 55px;
    font-weight: 600;
    color: #000000 !important;
}

.wrap-cell {
    white-space: normal !important;
    word-wrap: break-word;
    text-align: left !important;
    padding-left: 8px !important;
}

.clickable-th {
    cursor: context-menu;
}

/* Editable Cells & Colors */
.editable-cell {
    outline: none;
    transition: background 0.2s;
    cursor: text;
}

.editable-cell:focus {
    background-color: #fef08a !important;
    box-shadow: inset 0 0 0 2px #eab308;
    color: #000 !important;
}

.cell-fri {
    background-color: #e0f2fe;
    color: #475569;
}

.code-b {
    background-color: #ef4444 !important;
    color: white !important;
    font-weight: bold;
}

.code-h {
    background-color: #f59e0b !important;
    color: #fff !important;
    font-weight: bold;
}

.code-id {
    background-color: #fde047 !important;
    color: #854d0e !important;
    font-weight: bold;
}

.code-np {
    background-color: #86efac !important;
    color: #14532d !important;
    font-weight: bold;
}

.code-nr {
    background-color: #e9a4a4 !important;
    color: #000000 !important;
    font-weight: bold;
}

.code-ab {
    background-color: #57ffc7 !important;
    color: #000000 !important;
    font-weight: bold;
}

.code-dc {
    background-color: #0ea5e9 !important;
    color: white !important;
    font-weight: bold;
}

.code-sc {
    background-color: #8b5cf6 !important;
    color: white !important;
    font-weight: bold;
}

.code-r {
    background-color: #f97316 !important;
    color: white !important;
    font-weight: bold;
}

.bg-normal-hr {
    background-color: #b5c4ba !important;
    color: #166534 !important;
}

.bg-ot-hr {
    background-color: #cfcec2 !important;
    color: #000000 !important;
}

.bg-total-hr {
    background-color: #ffffff !important;
    color: #000000 !important;
}

.bg-dist {
    background-color: #bed7f0 !important;
    color: #334155 !important;
}

.bg-mileage {
    background-color: #f8fafc !important;
    color: #475569 !important;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(3px);
}

.modal-box {
    background: white;
    padding: 25px;
    border-radius: 8px;
    width: 400px;
    max-width: 95%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.modal-header h3 {
    margin: 0;
    color: #0f172a;
    font-size: 16px;
    font-weight: 700;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #ef4444;
}

.modal-box label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 5px;
    display: block;
}

.modal-box select,
.modal-box input[type="text"],
.modal-box input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: 'Inter';
    font-size: 13px;
    color: #1e293b;
    background: #fff;
    box-sizing: border-box;
    outline: none;
    margin-bottom: 15px;
    height: auto;
}

.modal-box select:focus,
.modal-box input:focus {
    border-color: #2563eb;
}

@media print {
    body {
        background-color: white;
    }

    .controls-wrapper,
    .no-print {
        display: none !important;
    }

    .table-container {
        height: auto;
        overflow: visible;
        width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    .ts-table {
        border: 1px solid #000;
    }

    .ts-table th,
    .ts-table td {
        border: 1px solid #000;
        color: #000;
    }

    .ts-table thead th {
        position: static;
        background-color: #1e3a5f !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* 🟢 Plate Count Badge */
.plate-count {
    background: none;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 15px;
    height: 30px;
    box-sizing: border-box;
    margin-top: 8px;
    padding-left: 10px;
}

.plate-count span {
    background: none;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 15px;
    color: yellowgreen;
    font-weight: 700;
    padding-right: 10px;
}