:root {
    --navy-950: #062440;
    --navy-900: #083153;
    --navy-800: #0d4169;
    --teal-700: #078a8e;
    --teal-600: #099ca0;
    --teal-100: #dff7f4;
    --blue-700: #2468b7;
    --blue-100: #e8f1ff;
    --green-700: #15803d;
    --green-100: #dcfce7;
    --amber-700: #b45309;
    --amber-100: #fff3d6;
    --red-700: #b91c1c;
    --red-100: #fee2e2;
    --slate-950: #0f172a;
    --slate-700: #334155;
    --slate-500: #64748b;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --white: #ffffff;
    --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    --radius: 8px;
    font-family: "Tahoma", "Noto Sans Thai", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--slate-50);
    color: var(--slate-950);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 18px 8px;
    background: linear-gradient(180deg, var(--navy-900), #04213d);
    color: var(--white);
}

.brand {
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 10px;
    align-items: center;
    padding: 0 10px 22px;
    line-height: 1.35;
}

    .brand strong {
        display: block;
        font-size: 16px;
        font-weight: 700;
    }

    .brand span {
        display: block;
        color: rgba(255, 255, 255, 0.72);
        font-size: 13px;
    }

.seal {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 2px solid rgba(255, 203, 92, 0.85);
    border-radius: 50%;
    color: #ffd36c;
    font-size: 12px;
    font-weight: 700;
}

.nav {
    display: grid;
    gap: 6px;
}

    .nav button,
    .collapse-button {
        display: grid;
        grid-template-columns: 28px 1fr;
        gap: 10px;
        align-items: center;
        width: 100%;
        border: 0;
        border-radius: var(--radius);
        padding: 12px 12px;
        background: transparent;
        color: rgba(255, 255, 255, 0.86);
        text-align: left;
        font-size: 14px;
        font-weight: 700;
    }

        .nav button:hover,
        .nav button.active {
            background: linear-gradient(90deg, var(--teal-600), #087b96);
            color: var(--white);
        }

    .nav .nav-icon {
        display: grid;
        place-items: center;
        width: 24px;
        height: 24px;
        color: currentColor;
    }

.collapse-button {
    margin-top: auto;
    color: rgba(255, 255, 255, 0.72);
}

.workspace {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    min-height: 72px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--slate-200);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}

.topbar-left,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.section-label {
    margin: 0 0 2px;
    color: var(--slate-500);
    font-size: 12px;
    font-weight: 700;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 24px;
    line-height: 1.2;
}

h2 {
    margin-bottom: 0;
    font-size: 20px;
}

h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

.searchbox {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(360px, 28vw);
    min-width: 210px;
    padding: 9px 12px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--slate-50);
    color: var(--slate-500);
}

    .searchbox input {
        width: 100%;
        border: 0;
        outline: 0;
        background: transparent;
        color: var(--slate-950);
        font-size: 13px;
    }

.icon-button,
.ghost-button,
.primary-button,
.danger-button,
.success-button {
    min-height: 38px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 700;
}

.icon-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 38px;
    border: 1px solid var(--slate-200);
    background: var(--white);
    color: var(--slate-700);
}

    .icon-button b {
        position: absolute;
        top: -7px;
        right: -7px;
        display: grid;
        place-items: center;
        min-width: 18px;
        height: 18px;
        padding: 0 4px;
        border-radius: 999px;
        background: #ef4444;
        color: white;
        font-size: 10px;
    }

.ghost-button {
    border: 1px solid var(--slate-300);
    background: var(--white);
    color: var(--blue-700);
    padding: 0 14px;
}

.primary-button,
.success-button {
    border: 1px solid transparent;
    background: var(--teal-600);
    color: var(--white);
    padding: 0 15px;
}

.danger-button {
    border: 1px solid #fecaca;
    background: #fff5f5;
    color: var(--red-700);
    padding: 0 15px;
}

.content {
    padding: 20px;
    padding-bottom: 96px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.panel,
.kpi-card {
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
}

.kpi-card {
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 14px;
    align-items: center;
    min-height: 112px;
    padding: 18px;
}

.kpi-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    color: var(--white);
    font-size: 28px;
}

.kpi-card strong {
    display: block;
    font-size: 34px;
    line-height: 1;
}

.kpi-card span {
    color: var(--slate-500);
    font-size: 13px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(520px, 1.15fr) minmax(420px, 0.85fr);
    gap: 16px;
    margin-bottom: 16px;
}

.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.panel {
    overflow: hidden;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    min-height: 58px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--slate-200);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--slate-500);
    font-size: 12px;
}

.segmented {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--slate-50);
}

    .segmented button {
        border: 0;
        border-right: 1px solid var(--slate-200);
        background: transparent;
        padding: 7px 10px;
        color: var(--slate-700);
        font-size: 12px;
    }

        .segmented button:last-child {
            border-right: 0;
        }

        .segmented button.active {
            background: var(--blue-100);
            color: var(--blue-700);
            font-weight: 700;
        }

.schedule {
    min-width: 680px;
}

.schedule-header,
.schedule-row {
    display: grid;
    grid-template-columns: 122px repeat(7, 1fr);
}

.schedule-header {
    border-bottom: 1px solid var(--slate-200);
    color: var(--slate-500);
    font-size: 12px;
}

    .schedule-header div,
    .vehicle-cell,
    .time-cell {
        min-height: 48px;
        padding: 10px;
        border-right: 1px solid var(--slate-200);
    }

        .schedule-header div:last-child,
        .time-cell:last-child {
            border-right: 0;
        }

.schedule-row {
    border-bottom: 1px solid var(--slate-200);
}

    .schedule-row:last-child {
        border-bottom: 0;
    }

.vehicle-cell {
    background: var(--slate-50);
}

    .vehicle-cell strong {
        display: block;
        font-size: 13px;
    }

    .vehicle-cell span {
        color: var(--slate-500);
        font-size: 11px;
    }

.time-cell {
    position: relative;
    min-height: 72px;
    background: linear-gradient(90deg, rgba(226, 232, 240, 0.55) 1px, transparent 1px);
    background-size: 50% 100%;
}

.booking {
    position: absolute;
    inset: 11px 6px auto;
    min-height: 48px;
    border: 1px solid;
    border-radius: 6px;
    padding: 7px 8px;
    font-size: 11px;
    line-height: 1.35;
}

    .booking strong {
        display: block;
        font-size: 11px;
    }

    .booking.approved {
        border-color: #86efac;
        background: #ecfdf5;
        color: #166534;
    }

    .booking.active {
        border-color: #93c5fd;
        background: #eff6ff;
        color: #1d4ed8;
    }

    .booking.pending {
        border-color: #fdba74;
        background: #fff7ed;
        color: #c2410c;
    }

.table-wrap {
    overflow: auto;
}

.official-report-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
    padding: 18px;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    background: linear-gradient(135deg, #f8fafc 0%, #ecfeff 100%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

    .official-report-hero span {
        display: inline-block;
        margin-bottom: 6px;
        color: var(--teal-700);
        font-size: 12px;
        font-weight: 800;
    }

    .official-report-hero h2 {
        margin: 0;
        color: var(--navy-950);
        font-size: 24px;
        line-height: 1.2;
    }

    .official-report-hero p {
        margin: 6px 0 0;
        color: var(--slate-600);
        font-size: 13px;
    }

.official-report-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.official-form-panel {
    margin-bottom: 18px;
    --official-accent: #0f766e;
    --official-soft: #f0fdfa;
    --official-header: #ccfbf1;
    --official-row: #ffffff;
    border-top: 4px solid var(--official-accent);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.official-theme-request {
    --official-accent: #1d4ed8;
    --official-soft: #eff6ff;
    --official-header: #dbeafe;
}

.official-theme-trip {
    --official-accent: #047857;
    --official-soft: #ecfdf5;
    --official-header: #d1fae5;
}

.official-theme-fuel {
    --official-accent: #b45309;
    --official-soft: #fffbeb;
    --official-header: #fde68a;
}

.official-theme-register {
    --official-accent: #4338ca;
    --official-soft: #eef2ff;
    --official-header: #e0e7ff;
}

.official-theme-history {
    --official-accent: #6d28d9;
    --official-soft: #f5f3ff;
    --official-header: #ede9fe;
}

.official-theme-annual {
    --official-accent: #0f766e;
    --official-soft: #f0fdfa;
    --official-header: #ccfbf1;
}

.official-form-panel .panel-head {
    background: linear-gradient(90deg, var(--official-soft), #ffffff 72%);
    border-radius: 8px 8px 0 0;
    margin: -1px -1px 0;
    padding: 14px 16px;
}

    .official-form-panel .panel-head h3 {
        color: var(--official-accent);
    }

.official-table table {
    min-width: 1120px;
    border-color: #94a3b8;
}

.official-table th {
    white-space: nowrap;
    background: var(--official-header);
    color: #0f172a;
    border-color: #94a3b8;
}

.official-table td {
    vertical-align: top;
    border-color: #cbd5e1;
}

.official-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.official-table tbody tr:hover td {
    background: var(--official-soft);
}

.official-signature {
    margin: 28px 8px 4px auto;
    width: min(420px, 100%);
    text-align: center;
    color: #0f172a;
    line-height: 1.9;
}

    .official-signature p {
        margin: 2px 0;
    }

.fuel-efficiency-grid {
    display: grid;
    grid-template-columns: minmax(320px, 1.1fr) minmax(280px, .9fr);
    gap: 16px;
    margin-bottom: 18px;
}

.fuel-efficiency-form {
    display: grid;
    gap: 16px;
}

.fuel-efficiency-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.fuel-efficiency-form-grid label:last-child {
    grid-column: 1 / -1;
}

.fuel-efficiency-result-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.fuel-efficiency-result-bar > div {
    padding: 14px 16px;
    border: 1px solid #fcd34d;
    border-radius: 12px;
    background: linear-gradient(180deg, #fffdf5, #fff7dd);
}

.fuel-efficiency-result-bar span,
.fuel-efficiency-result-bar small {
    display: block;
    color: #92400e;
}

.fuel-efficiency-result-bar strong {
    display: block;
    margin: 6px 0 2px;
    font-size: 28px;
    color: #7c2d12;
}

.fuel-efficiency-instruction {
    display: grid;
    gap: 12px;
    color: #334155;
    line-height: 1.75;
}

.fuel-efficiency-instruction ol {
    margin: 0;
    padding-left: 22px;
}

.fuel-efficiency-example {
    padding: 14px 16px;
    border-radius: 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.fuel-efficiency-example p {
    margin: 6px 0 0;
}

.fuel-efficiency-preview-panel .panel-head {
    align-items: flex-start;
}

.fuel-efficiency-paper hr {
    margin: 18px 0 12px;
    border: 0;
    border-top: 1px dashed #94a3b8;
}

.fuel-efficiency-paper .indent {
    padding-left: 52px;
}

.fuel-efficiency-sign {
    margin-top: 30px;
}

.fuel-efficiency-view-filters label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.fuel-efficiency-view-filters input[type="radio"] {
    min-height: auto;
    min-width: auto;
    padding: 0;
}

.approval-modal-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100%;
    height: min(90dvh, 860px);
    max-height: calc(100dvh - 28px);
    overflow: hidden;
    padding: 0;
}

    .approval-modal-panel .modal-head {
        position: sticky;
        top: 0;
        z-index: 2;
        padding: 16px 18px;
        border-bottom: 1px solid var(--slate-200);
        background: #fff;
    }

.approval-modal-body {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(620px, 1fr) minmax(330px, 380px);
    gap: 16px;
    overflow: hidden;
    padding: 16px;
    background: #f6f9fc;
}

.approval-modal-panel .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 0;
    padding: 12px 18px;
    border-top: 1px solid var(--slate-200);
    background: rgba(255, 255, 255, .96);
}

.approval-document-frame {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 6px;
    border: 1px solid #d8e2ee;
    border-radius: 10px;
    background: #edf4fb;
}

.approval-signing-panel {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 14px;
    border: 1px solid #d8e2ee;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

    .approval-signing-panel h3 {
        margin: 0;
        font-size: 17px;
    }

.approval-paper {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 20px 28px;
    background: #fff;
    border: 1px solid #d6dee8;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .08);
    color: #111827;
    font-family: "TH Sarabun PSK", "Sarabun", "Tahoma", sans-serif;
    font-size: clamp(15px, 1.05vw, 18px);
    line-height: 1.3;
}

    .approval-paper .form-no,
    .approval-paper .right {
        text-align: right;
    }

    .approval-paper h3,
    .approval-paper .center {
        text-align: center;
    }

    .approval-paper h3 {
        margin: 0;
        font-size: clamp(17px, 1.45vw, 20px);
    }

    .approval-paper p {
        margin: 4px 0;
    }

    .approval-paper .indent {
        padding-left: 38px;
    }

    .approval-paper p span:not(.paper-check) {
        display: inline-block;
        min-width: 120px;
        max-width: 100%;
        padding: 0 6px;
        border-bottom: 1px dotted #111827;
        vertical-align: baseline;
    }

.approval-paper-sign {
    margin: 14px 0 12px auto;
    width: min(330px, 100%);
    text-align: center;
}

.approval-paper-boxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid #64748b;
}

    .approval-paper-boxes > div {
        min-height: 128px;
        padding: 9px;
    }

        .approval-paper-boxes > div + div {
            border-left: 1px solid #64748b;
        }

.paper-check {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin: 0 8px -2px 16px;
    border: 1px solid #64748b;
    text-align: center;
    line-height: 15px;
}

.director-signature-preview {
    min-height: 46px;
    margin: 6px auto 3px;
    color: #64748b;
    text-align: center;
}

    .director-signature-preview img {
        max-width: 180px;
        max-height: 58px;
        object-fit: contain;
    }

.signature-tools {
    display: grid;
    gap: 9px;
    grid-template-columns: 1fr;
    padding: 10px;
    border: 1px solid #d8e2ee;
    border-radius: 8px;
    background: #f8fafc;
}

    .signature-tools canvas {
        grid-column: 1 / -1;
        width: 100%;
        max-width: none;
        height: 150px;
        border: 1px dashed #94a3b8;
        border-radius: 8px;
        background: #fff;
        touch-action: none;
    }

    .signature-tools .inline-actions {
        grid-column: 1 / -1;
    }

.official-approval-sign {
    width: 100%;
    max-width: 220px;
    margin: auto;
    text-align: center;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal !important;
    line-height: 1.25;
}

    .official-approval-sign img {
        max-width: 110px;
        max-height: 42px;
        object-fit: contain;
    }

    .approval-signer-title,
    .official-approval-sign span {
        font-size: 9px !important;
        line-height: 1.1 !important;
    }

    .official-approval-sign strong,
    .official-approval-sign b {
        display: block;
        font-size: 11px !important;
        line-height: 1.1 !important;
        font-weight: 600 !important;
    }
    .official-approval-sign strong,
    .official-approval-sign b {
        display: block;
        font-size: 11px;
        line-height: 1.1;
        font-weight: 600;
    }

.signed-form-panel {
    border-color: #bfdbfe;
}

.director-command-hero {
    display: grid;
    grid-template-columns: 1fr minmax(150px, 220px);
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
    padding: 24px;
    border: 1px solid #d7e3f0;
    border-radius: 12px;
    background: linear-gradient(115deg, #0f172a 0%, #14532d 62%, #0f766e 100%);
    color: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .14);
}

    .director-command-hero h2 {
        margin: 4px 0 8px;
        font-size: clamp(24px, 2.6vw, 38px);
        line-height: 1.15;
        letter-spacing: 0;
    }

    .director-command-hero .section-label,
    .director-command-hero span {
        color: #dbeafe;
    }

.director-approval-count {
    display: grid;
    place-items: center;
    min-height: 132px;
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 10px;
    background: rgba(255,255,255,.12);
}

    .director-approval-count strong {
        font-size: 54px;
        line-height: 1;
    }

.director-kpis {
    margin-bottom: 18px;
}

.director-calendar-panel,
.director-approval-panel {
    margin-top: 18px;
}

.director-approval-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 16px;
}

.director-approval-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid #d8e2ee;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

.approval-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

    .approval-card-head strong,
    .approval-card-head span {
        display: block;
    }

    .approval-card-head span {
        margin-top: 3px;
        color: #475569;
    }

.approval-mini-form {
    height: 245px;
    overflow: hidden;
    border: 1px solid #d6dee8;
    border-radius: 8px;
    background: #f8fafc;
}

    .approval-mini-form .approval-paper {
        width: 760px;
        transform: scale(.42);
        transform-origin: top left;
        margin: 0;
        box-shadow: none;
        border: 0;
    }

.director-approval-card .metric-list {
    font-size: 13px;
}

@media (max-width: 820px) {
    .director-command-hero {
        grid-template-columns: 1fr;
    }

    .director-approval-grid {
        grid-template-columns: 1fr;
    }

    .approval-mini-form {
        height: 220px;
    }

        .approval-mini-form .approval-paper {
            transform: scale(.36);
        }
}

@media (max-width: 760px) {
    .approval-modal-panel {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .approval-modal-body {
        display: block;
        overflow: auto;
        padding: 10px;
    }

    .approval-document-frame {
        overflow: visible;
        padding: 4px;
        border-radius: 8px;
    }

    .approval-signing-panel {
        margin-top: 10px;
        padding: 12px;
        overflow: visible;
    }

    .approval-paper {
        width: 100%;
        padding: 12px;
        font-size: 14px;
        line-height: 1.28;
    }

        .approval-paper h3 {
            font-size: 16px;
        }

        .approval-paper .indent {
            padding-left: 0;
        }

        .approval-paper p span:not(.paper-check) {
            min-width: 74px;
            padding: 0 4px;
        }

    .approval-paper-boxes {
        grid-template-columns: 1fr;
    }

        .approval-paper-boxes > div + div {
            border-left: 0;
            border-top: 1px solid #64748b;
        }

    .signature-tools {
        grid-template-columns: 1fr;
    }

        .signature-tools canvas {
            height: 140px;
        }
}

.sheet-form {
    background: linear-gradient(#e5e7eb 1px, transparent 1px), linear-gradient(90deg, #e5e7eb 1px, transparent 1px), #fff;
    background-size: 32px 22px;
    border: 1px solid #d7dee8;
    padding: 0 0 18px;
}

.sheet-title {
    text-align: center;
    font-weight: 800;
    font-size: 20px;
    line-height: 1.2;
    color: #020617;
}

.sheet-subtitle {
    text-align: center;
    color: #16a34a;
    font-size: 13px;
    line-height: 1.2;
    margin-bottom: 2px;
}

.sheet-meta {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-top: 1px solid #d7dee8;
    border-bottom: 1px solid #d7dee8;
    background: rgba(255, 255, 255, .72);
}

    .sheet-meta span {
        min-height: 32px;
        padding: 4px 8px;
        border-right: 1px solid #d7dee8;
    }

        .sheet-meta span:last-child {
            border-right: 0;
        }

.form-4-table th {
    background: #d8eaf7;
    text-align: center;
    vertical-align: middle;
}

.form-4-table td {
    background: #fff2cc;
}

.form-4-table .calc-cell {
    background: #e7e6e6;
    text-align: center;
}

.form-4-table .number-cell {
    text-align: right;
}

.form-4-table .total-row td {
    background: #d9ead3;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
    font-size: 12px;
}

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--slate-200);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--slate-500);
    font-size: 11px;
    font-weight: 700;
}

tbody tr:hover {
    background: var(--slate-50);
}

.status-chip,
.priority-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

    .status-chip.available,
    .priority-chip.normal {
        background: var(--green-100);
        color: var(--green-700);
    }

    .status-chip.active {
        background: var(--blue-100);
        color: var(--blue-700);
    }

    .status-chip.pending,
    .priority-chip.fast {
        background: var(--amber-100);
        color: var(--amber-700);
    }

    .status-chip.danger,
    .priority-chip.urgent {
        background: var(--red-100);
        color: var(--red-700);
    }

.inline-actions {
    display: flex;
    gap: 8px;
}

.tiny-button {
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    background: var(--white);
    padding: 5px 8px;
    color: var(--slate-700);
    font-size: 11px;
    font-weight: 700;
}

    .tiny-button.approve {
        border-color: #99f6e4;
        color: var(--teal-700);
    }

    .tiny-button.reject {
        border-color: #fecaca;
        color: var(--red-700);
    }

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

    .filters input,
    .filters select,
    label input,
    label select,
    label textarea {
        min-height: 38px;
        border: 1px solid var(--slate-300);
        border-radius: var(--radius);
        background: var(--white);
        padding: 8px 10px;
        color: var(--slate-950);
        outline-color: var(--teal-600);
    }

    .filters input {
        min-width: 280px;
    }

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

.metric-list,
.alert-list,
.doc-list {
    display: grid;
    gap: 10px;
    padding: 14px 16px 16px;
}

.list-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--slate-200);
}

    .list-row:last-child {
        border-bottom: 0;
    }

    .list-row strong {
        display: block;
        font-size: 13px;
    }

    .list-row span {
        color: var(--slate-500);
        font-size: 12px;
    }

.progress {
    height: 10px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--slate-200);
}

    .progress i {
        display: block;
        height: 100%;
        border-radius: inherit;
        background: var(--teal-600);
    }

.chart {
    height: 180px;
    padding: 16px;
}

    .chart svg {
        width: 100%;
        height: 100%;
    }

.stat-band {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--slate-200);
    margin-bottom: 16px;
}

    .stat-band div {
        padding: 14px;
        background: var(--white);
    }

    .stat-band strong {
        display: block;
        font-size: 22px;
    }

    .stat-band span {
        color: var(--slate-500);
        font-size: 12px;
    }

.modal {
    width: min(760px, calc(100vw - 28px));
    border: 0;
    padding: 0;
    border-radius: 10px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

    .modal::backdrop {
        background: rgba(15, 23, 42, 0.42);
    }

.approval-modal {
    width: min(1280px, calc(100vw - 48px));
    max-width: none;
    max-height: calc(100dvh - 28px);
    overflow: hidden;
}

.modal-panel {
    padding: 0;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--slate-200);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 18px 20px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--slate-700);
    font-size: 12px;
    font-weight: 700;
}

    label.wide {
        grid-column: 1 / -1;
    }

    label.check-row {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 40px;
        padding: 10px 12px;
        border: 1px solid var(--slate-200);
        border-radius: var(--radius);
        background: var(--slate-50);
        color: var(--slate-700);
    }

        label.check-row input {
            width: auto;
            margin: 0;
        }

.system-config-panel {
    max-width: 1120px;
}

.system-config-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px;
}

    .system-config-form .wide {
        grid-column: 1 / -1;
    }

.required {
    color: var(--red-700);
}

.config-section {
    display: grid;
    gap: 12px;
    margin-top: 8px;
    padding-top: 18px;
    border-top: 1px solid var(--slate-200);
}

    .config-section h4 {
        margin: 0;
        font-size: 18px;
    }

.help-text {
    margin: 0;
    color: var(--slate-500);
    font-size: 12px;
}

.config-updated {
    padding: 12px 14px;
    border-radius: var(--radius);
    background: #06b6d4;
    color: var(--white);
    font-weight: 700;
}

textarea {
    resize: vertical;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--slate-200);
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 40;
    transform: translateY(20px);
    opacity: 0;
    max-width: 360px;
    border-radius: var(--radius);
    background: var(--navy-950);
    color: var(--white);
    padding: 12px 14px;
    box-shadow: var(--shadow);
    transition: 0.2s ease;
    pointer-events: none;
}

    .toast.show {
        transform: translateY(0);
        opacity: 1;
    }

.empty-state {
    padding: 34px 16px;
    text-align: center;
    color: var(--slate-500);
}

.app-shell.collapsed {
    grid-template-columns: 74px minmax(0, 1fr);
}

    .app-shell.collapsed .brand {
        grid-template-columns: 1fr;
    }

        .app-shell.collapsed .brand div:not(.seal),
        .app-shell.collapsed .nav button span:last-child,
        .app-shell.collapsed .collapse-button span:last-child {
            display: none;
        }

    .app-shell.collapsed .nav button,
    .app-shell.collapsed .collapse-button {
        grid-template-columns: 1fr;
        justify-items: center;
    }

@media (max-width: 1180px) {
    .kpi-grid,
    .bottom-grid,
    .module-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .app-shell,
    .app-shell.collapsed {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        z-index: 30;
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

        .sidebar.open {
            transform: translateX(0);
        }

    .topbar,
    .topbar-left,
    .topbar-actions {
        align-items: stretch;
    }

    .topbar {
        flex-direction: column;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }

    .searchbox {
        width: 100%;
        min-width: 100%;
    }

    .kpi-grid,
    .bottom-grid,
    .module-grid,
    .stat-band,
    .form-grid {
        grid-template-columns: 1fr;
    }

    label.wide {
        grid-column: auto;
    }

    .content {
        padding: 14px;
        padding-bottom: 118px;
    }
}

.auth-locked {
    filter: blur(1px);
    pointer-events: none;
    user-select: none;
}

.auth-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(15, 23, 42, 0.56);
    backdrop-filter: blur(8px);
}

.auth-card {
    width: min(460px, 100%);
    display: grid;
    gap: 14px;
    border: 1px solid var(--slate-200);
    border-radius: 10px;
    background: var(--white);
    padding: 22px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.auth-title span {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--navy-900);
    color: #ffd36c;
    font-weight: 800;
    margin-bottom: 10px;
}

.auth-title h2 {
    margin-bottom: 6px;
}

.auth-title p, .demo-users {
    color: var(--slate-500);
    font-size: 12px;
    line-height: 1.55;
}

.auth-tabs {
    width: 100%;
}

    .auth-tabs button {
        flex: 1;
    }

.auth-submit {
    width: 100%;
    justify-content: center;
}

    .auth-submit:disabled {
        opacity: .72;
        cursor: wait;
    }

.auth-inline-message {
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: #eff6ff;
    color: var(--blue-700);
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

    .auth-inline-message.error {
        border-color: #fecaca;
        background: #fef2f2;
        color: var(--red-700);
    }

.session-chip {
    position: fixed;
    z-index: 9;
    right: 18px;
    top: 84px;
    bottom: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 36px);
    border: 1px solid var(--slate-200);
    border-radius: 10px;
    background: var(--white);
    padding: 10px;
    box-shadow: var(--shadow);
}

    .session-chip span {
        display: grid;
        gap: 2px;
        min-width: 0;
    }

    .session-chip small {
        color: var(--slate-500);
        font-size: 11px;
    }

.member-drawer {
    position: fixed;
    z-index: 75;
    right: 18px;
    top: 148px;
    bottom: auto;
    width: min(760px, calc(100vw - 36px));
    max-height: min(620px, calc(100vh - 170px));
    overflow: auto;
    border: 1px solid var(--slate-200);
    border-radius: 10px;
    background: var(--white);
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

@media (max-width: 820px) {
    .session-chip {
        top: auto;
        bottom: 12px;
        z-index: 8;
    }

    .pretrip-panel .modal-actions {
        padding-bottom: 96px;
    }
}

@media (max-width: 640px) {
    .session-chip {
        left: 12px;
        right: 12px;
        flex-wrap: wrap;
    }

    .member-drawer {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 92px;
        width: auto;
        max-height: min(620px, calc(100vh - 116px));
    }
}

.fuel-modal {
    width: min(980px, calc(100vw - 28px));
}

.fuel-form-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    max-height: min(68vh, 720px);
    overflow: auto;
}

    .fuel-form-grid input[type="file"] {
        padding: 9px;
    }

@media (max-width: 760px) {
    .fuel-form-grid {
        grid-template-columns: 1fr;
    }
}

.progress-list {
    display: grid;
    gap: 12px;
    padding: 14px 16px 16px;
}

.progress-card {
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--white);
    padding: 14px;
}

.progress-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

    .progress-card-head strong {
        display: block;
        font-size: 14px;
    }

    .progress-card-head span {
        color: var(--slate-500);
        font-size: 12px;
        line-height: 1.5;
    }

.request-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 6px;
}

    .request-steps div {
        position: relative;
        display: grid;
        justify-items: center;
        gap: 6px;
        color: var(--slate-500);
        font-size: 11px;
        font-weight: 700;
        text-align: center;
    }

        .request-steps div::before {
            content: "";
            position: absolute;
            top: 14px;
            left: -50%;
            width: 100%;
            height: 2px;
            background: var(--slate-200);
            z-index: 0;
        }

        .request-steps div:first-child::before {
            display: none;
        }

    .request-steps i {
        position: relative;
        z-index: 1;
        display: grid;
        place-items: center;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: var(--slate-200);
        color: var(--slate-700);
        font-style: normal;
    }

    .request-steps .done {
        color: var(--teal-700);
    }

        .request-steps .done::before, .request-steps .done i {
            background: var(--teal-600);
            color: var(--white);
        }

.driver-rating-card select, .driver-rating-card textarea {
    width: 100%;
}

@media (max-width: 640px) {
    .request-steps {
        grid-template-columns: 1fr 1fr;
    }

        .request-steps div::before {
            display: none;
        }

    .progress-card-head {
        display: grid;
    }
}

.executive-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 18px;
    align-items: center;
    min-height: 180px;
    margin-bottom: 16px;
    padding: 24px;
    border: 1px solid #d7e4f5;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(9, 156, 160, 0.12), transparent 34%), linear-gradient(115deg, #ffffff 0%, #eef6ff 58%, #f3fbf8 100%);
    box-shadow: var(--shadow);
}

    .executive-hero h2 {
        max-width: 760px;
        margin: 0 0 10px;
        font-size: 30px;
        line-height: 1.18;
        color: var(--navy-950);
    }

    .executive-hero span {
        display: block;
        max-width: 700px;
        color: var(--slate-500);
        line-height: 1.65;
    }

.hero-meter {
    --pct: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    width: 148px;
    height: 148px;
    justify-self: end;
    border-radius: 50%;
    background: conic-gradient(var(--teal-600) calc(var(--pct) * 1%), #dbeafe 0);
    color: var(--navy-950);
    position: relative;
}

    .hero-meter::after {
        content: "";
        position: absolute;
        inset: 13px;
        border-radius: 50%;
        background: white;
        box-shadow: inset 0 0 0 1px var(--slate-200);
    }

    .hero-meter strong, .hero-meter span {
        position: relative;
        z-index: 1;
    }

    .hero-meter strong {
        font-size: 28px;
    }

    .hero-meter span {
        max-width: 80px;
        text-align: center;
        font-size: 11px;
        line-height: 1.35;
    }

.graphic-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.graphic-kpi {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 12px;
    align-items: center;
    min-height: 104px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--white);
    padding: 16px;
    box-shadow: var(--shadow);
}

.graphic-kpi-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    color: white;
    font-size: 22px;
}

.graphic-kpi.green .graphic-kpi-icon {
    background: var(--green-700);
}

.graphic-kpi.amber .graphic-kpi-icon {
    background: #d97706;
}

.graphic-kpi.blue .graphic-kpi-icon {
    background: var(--blue-700);
}

.graphic-kpi.red .graphic-kpi-icon {
    background: var(--red-700);
}

.graphic-kpi span, .graphic-kpi small {
    color: var(--slate-500);
    font-size: 12px;
    font-weight: 700;
}

.graphic-kpi strong {
    display: block;
    margin: 2px 0;
    font-size: 30px;
    line-height: 1;
}

.dashboard-visual-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) 320px minmax(360px, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.command-panel, .fleet-panel, .fuel-panel {
    min-height: 330px;
}

.request-bars {
    display: grid;
    gap: 13px;
    padding: 16px;
}

.request-bar div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 7px;
}

.request-bar span {
    color: var(--slate-500);
    font-size: 12px;
    font-weight: 700;
}

.request-bar strong {
    font-size: 18px;
}

.request-bar i {
    display: block;
    height: 10px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--slate-200);
}

.request-bar b {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.request-bar.green b {
    background: var(--green-700);
}

.request-bar.amber b {
    background: #d97706;
}

.request-bar.red b {
    background: var(--red-700);
}

.quick-list {
    display: grid;
    gap: 8px;
    padding: 0 16px 16px;
}

    .quick-list button {
        display: grid;
        grid-template-columns: 108px 1fr auto;
        gap: 10px;
        align-items: center;
        border: 1px solid var(--slate-200);
        border-radius: var(--radius);
        background: var(--slate-50);
        padding: 10px;
        text-align: left;
    }

        .quick-list button span {
            color: var(--slate-500);
            font-size: 12px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

.fleet-donut-wrap {
    display: grid;
    place-items: center;
    gap: 16px;
    padding: 18px 16px;
}

.fleet-donut {
    --a: 0;
    --b: 0;
    display: grid;
    place-items: center;
    align-content: center;
    width: 178px;
    height: 178px;
    border-radius: 50%;
    background: conic-gradient(var(--green-700) calc(var(--a) * 1%), var(--blue-700) 0 calc((var(--a) + var(--b)) * 1%), var(--red-700) 0);
    position: relative;
}

    .fleet-donut::after {
        content: "";
        position: absolute;
        inset: 18px;
        border-radius: 50%;
        background: var(--white);
    }

    .fleet-donut strong, .fleet-donut span {
        position: relative;
        z-index: 1;
    }

    .fleet-donut strong {
        font-size: 34px;
        line-height: 1;
    }

    .fleet-donut span {
        color: var(--slate-500);
        font-size: 12px;
    }

.donut-legend {
    display: grid;
    gap: 9px;
    width: 100%;
}

    .donut-legend span {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        color: var(--slate-700);
        font-size: 12px;
    }

    .donut-legend i {
        width: 9px;
        height: 9px;
        border-radius: 50%;
        margin-right: auto;
    }

.green-dot {
    background: var(--green-700);
}

.blue-dot {
    background: var(--blue-700);
}

.red-dot {
    background: var(--red-700);
}

.graphic-chart {
    height: 230px;
}

.progress.labeled {
    margin: 0 16px 16px;
}

.dashboard-lower-grid {
    display: grid;
    grid-template-columns: minmax(560px, 1.35fr) minmax(340px, 0.65fr);
    gap: 16px;
}

.infographic-panel {
    margin: 16px 0;
}

    .infographic-panel .panel-head {
        align-items: center;
    }

.infographic-preview {
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--slate-50);
    overflow: hidden;
}

    .infographic-preview svg {
        display: block;
        width: 100%;
        height: auto;
    }

.visual-alerts .list-row {
    border-radius: var(--radius);
    padding: 10px;
    border: 1px solid var(--slate-200);
    background: var(--slate-50);
}

@media (max-width: 1180px) {
    .dashboard-visual-grid, .dashboard-lower-grid {
        grid-template-columns: 1fr;
    }

    .graphic-kpi-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 760px) {
    .executive-hero {
        grid-template-columns: 1fr;
    }

    .hero-meter {
        justify-self: start;
    }

    .executive-hero h2 {
        font-size: 24px;
    }

    .graphic-kpi-grid {
        grid-template-columns: 1fr;
    }

    .quick-list button {
        grid-template-columns: 1fr;
    }
}

.assignment-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
}

.assignment-list {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.assignment-side {
    display: grid;
    gap: 16px;
    align-content: start;
}

.assignment-card {
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    padding: 14px;
}

.assignment-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

    .assignment-card-head strong {
        display: block;
        font-size: 15px;
    }

    .assignment-card-head span {
        color: var(--slate-500);
        font-size: 12px;
    }

.assignment-detail {
    display: grid;
    grid-template-columns: 1.2fr 1.1fr 0.7fr;
    gap: 10px;
    margin-bottom: 12px;
}

    .assignment-detail div {
        border: 1px solid var(--slate-200);
        border-radius: 6px;
        background: var(--white);
        padding: 10px;
    }

    .assignment-detail span, .assignment-suggest span {
        display: block;
        color: var(--slate-500);
        font-size: 11px;
        font-weight: 700;
    }

    .assignment-detail strong {
        display: block;
        margin-top: 4px;
        font-size: 13px;
    }

    .assignment-detail small {
        display: block;
        margin-top: 3px;
        color: var(--slate-500);
        font-size: 11px;
    }

.assignment-suggest {
    display: grid;
    gap: 5px;
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 6px;
    background: var(--blue-100);
}

.assignment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

@media (max-width: 1100px) {
    .assignment-grid {
        grid-template-columns: 1fr;
    }

    .assignment-detail {
        grid-template-columns: 1fr;
    }
}

.pretrip-panel .metric-list {
    border-bottom: 1px solid var(--slate-200);
}

.pretrip-form {
    display: grid;
    gap: 0;
}

.inspection-checklist {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 12px;
    padding: 18px 20px;
}

.inspection-item {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
    min-height: 84px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--slate-50);
    padding: 12px;
    color: var(--slate-950);
}

.inspection-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--slate-700);
}

.inspection-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

    .inspection-options label {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-height: 32px;
        border: 1px solid var(--slate-200);
        border-radius: 6px;
        background: var(--white);
        padding: 5px 9px;
        color: var(--slate-700);
        font-size: 12px;
        font-weight: 700;
        cursor: pointer;
    }

    .inspection-options input {
        width: 16px;
        height: 16px;
        accent-color: var(--teal-600);
    }

.inspection-detail {
    display: none;
    gap: 6px;
    color: var(--slate-700);
    font-size: 12px;
    font-weight: 800;
}

    .inspection-detail.show {
        display: grid;
    }

    .inspection-detail textarea {
        width: 100%;
        min-height: 58px;
        resize: vertical;
        border: 1px solid #f59e0b;
        border-radius: 6px;
        background: #fffbeb;
        padding: 8px;
        font-family: inherit;
        font-size: 13px;
    }

.vehicle-photo-section {
    display: grid;
    gap: 10px;
}

.vehicle-photo-title {
    color: var(--slate-700);
    font-size: 12px;
    font-weight: 800;
}

.vehicle-photo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 10px;
}

.vehicle-photo-field {
    display: grid;
    gap: 8px;
    min-height: 142px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--slate-50);
    padding: 12px;
}

    .vehicle-photo-field strong {
        color: var(--slate-700);
        font-size: 13px;
    }

.vehicle-photo-picker {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 48px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: var(--blue-700);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    overflow: hidden;
    cursor: pointer;
}

    .vehicle-photo-picker:hover {
        background: #dbeafe;
    }

    .vehicle-photo-picker input {
        position: absolute;
        width: 1px;
        height: 1px;
        opacity: 0;
        overflow: hidden;
        clip-path: inset(50%);
        pointer-events: none;
    }

.vehicle-photo-field small {
    color: var(--slate-500);
    font-size: 11px;
    line-height: 1.45;
}

.vehicle-photo-selected {
    display: block;
    min-height: 18px;
    color: var(--amber-700);
    font-size: 11px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

    .vehicle-photo-selected.has-file {
        color: var(--green-700);
    }

.vehicle-photo-link {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    width: fit-content;
    max-width: 100%;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: #eff6ff;
    color: var(--blue-700);
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
    overflow-wrap: anywhere;
}

    .vehicle-photo-link:hover {
        background: #dbeafe;
    }

    .vehicle-photo-link[hidden] {
        display: none;
    }

.receipt-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    min-height: 44px;
    border: 1px dashed #bfdbfe;
    border-radius: 8px;
    background: #f8fbff;
    padding: 10px;
}

.receipt-preview-empty {
    color: var(--slate-500);
    font-size: 12px;
    font-weight: 700;
}

.receipt-preview-item {
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    background: var(--white);
    padding: 8px;
}

    .receipt-preview-item img {
        width: 58px;
        height: 58px;
        object-fit: cover;
        border-radius: 6px;
        border: 1px solid var(--slate-200);
    }

.receipt-file-badge {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 6px;
    border: 1px solid var(--slate-200);
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 800;
}

.receipt-preview-item strong {
    display: block;
    color: var(--slate-950);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.receipt-preview-item span {
    display: block;
    margin-top: 3px;
    color: var(--slate-500);
    font-size: 11px;
}

.warning-text {
    color: #b45309 !important;
    font-weight: 800;
}

@media (max-width: 960px) {
    .inspection-checklist {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 960px) {
    .vehicle-photo-grid {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }
}

@media (max-width: 640px) {
    .inspection-checklist {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .vehicle-photo-grid {
        grid-template-columns: 1fr;
    }
}



.google-login-wrap {
    display: grid;
    justify-items: center;
    margin-top: 12px;
}

.auth-note {
    margin-top: 12px;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    background: var(--slate-50);
    padding: 10px 12px;
    color: var(--slate-600);
    font-size: 12px;
    text-align: center;
}


.member-drawer .panel-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--white);
}

.member-editor {
    display: grid;
    gap: 12px;
    margin: 12px;
    padding: 14px;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    background: #f8fafc;
}

.member-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 12px;
}

.member-check {
    align-content: end;
    grid-template-columns: auto 1fr;
    display: grid;
    align-items: center;
    gap: 8px;
    min-height: 66px;
}

    .member-check input {
        width: auto;
    }

.member-drawer .tiny-button[disabled] {
    opacity: .45;
    cursor: not-allowed;
}

@media (max-width: 760px) {
    .member-form-grid {
        grid-template-columns: 1fr;
    }
}

.report-filters label {
    display: grid;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--slate-700);
}

.report-month-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 12px;
    padding: 14px 16px 16px;
}

.report-month-card {
    display: grid;
    gap: 10px;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    background: var(--white);
    padding: 12px;
}

    .report-month-card strong {
        display: block;
        font-size: 14px;
    }

    .report-month-card span {
        color: var(--slate-500);
        font-size: 12px;
    }

.report-bars {
    display: grid;
    gap: 6px;
}

    .report-bars i {
        display: block;
        height: 8px;
        border-radius: 999px;
        background: var(--slate-100);
        overflow: hidden;
    }

    .report-bars b {
        display: block;
        height: 100%;
        border-radius: inherit;
        background: var(--teal-600);
    }

    .report-bars .fuel b {
        background: #f59e0b;
    }

.metric-list.compact {
    padding: 0;
    gap: 4px;
}

@media (max-width: 980px) {
    .report-month-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 640px) {
    .report-month-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .official-report-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .official-report-actions {
        justify-content: flex-start;
    }

    .fuel-efficiency-grid,
    .fuel-efficiency-form-grid,
    .fuel-efficiency-result-bar {
        grid-template-columns: 1fr;
    }

    .fuel-efficiency-paper .indent {
        padding-left: 0;
    }
}

.fuel-fiscal-filter label {
    display: grid;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--slate-700);
}

/* =========================================================
   Responsive Approval Modal Fix — mobile / tablet / desktop
   2026-06-08
   ใช้สำหรับหน้าผู้บริหาร: ลงนามใบขออนุญาตใช้รถราชการ
   ========================================================= */

/* Desktop: จอคอมให้ดูเอกสารซ้าย / ลงนามขวา */
.approval-modal {
    width: min(1280px, calc(100vw - 48px)) !important;
    max-width: none !important;
    max-height: calc(100dvh - 28px) !important;
    overflow: hidden !important;
}

.approval-modal-panel {
    height: min(92dvh, 900px) !important;
    max-height: calc(100dvh - 28px) !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    overflow: hidden !important;
}

.approval-modal-body {
    display: grid !important;
    grid-template-columns: minmax(0, 1.6fr) minmax(340px, .7fr) !important;
    gap: 16px !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 16px !important;
}

.approval-document-frame,
.approval-signing-panel {
    min-height: 0 !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.approval-paper {
    width: min(760px, 100%) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-wrap: break-word !important;
}

.approval-signing-panel {
    max-width: 100% !important;
}

.signature-tools canvas,
#signaturePad {
    width: 100% !important;
    max-width: 100% !important;
    height: 150px !important;
    touch-action: none !important;
}

.director-signature-preview img,
.official-approval-sign img {
    max-width: 100% !important;
    object-fit: contain !important;
}

/* iPad / Tablet แนวตั้ง: เปลี่ยนเป็นเอกสารบน ลงนามล่าง */
@media (min-width: 761px) and (max-width: 1100px) {
    .approval-modal {
        width: min(960px, calc(100vw - 24px)) !important;
        max-height: calc(100dvh - 20px) !important;
    }

    .approval-modal-panel {
        height: calc(100dvh - 20px) !important;
        border-radius: 12px !important;
    }

    .approval-modal-body {
        grid-template-columns: 1fr !important;
        grid-template-rows: minmax(420px, 1fr) auto !important;
        gap: 12px !important;
        overflow: auto !important;
        padding: 12px !important;
    }

    .approval-document-frame {
        max-height: 58dvh !important;
    }

    .approval-signing-panel {
        max-height: none !important;
    }

    .approval-paper {
        width: 100% !important;
        padding: 18px 22px !important;
        font-size: 16px !important;
    }

        .approval-paper h3 {
            font-size: 18px !important;
        }

    .signature-tools canvas,
    #signaturePad {
        height: 150px !important;
    }
}

/* Mobile: เต็มจอ อ่านง่าย เลื่อนขึ้นลง ไม่โดนตัด */
@media (max-width: 760px) {
    .approval-modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow: hidden !important;
    }

    .approval-modal-panel {
        width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr) auto !important;
    }

        .approval-modal-panel .modal-head {
            padding: 12px 14px !important;
            align-items: flex-start !important;
        }

            .approval-modal-panel .modal-head h2 {
                font-size: 22px !important;
                line-height: 1.15 !important;
            }

            .approval-modal-panel .modal-head .section-label {
                font-size: 13px !important;
            }

    .approval-modal-body {
        display: grid !important;
        grid-template-columns: 1fr !important;
        grid-auto-rows: auto !important;
        gap: 10px !important;
        overflow: auto !important;
        padding: 10px !important;
        background: #f6f9fc !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .approval-document-frame {
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        overflow: auto !important;
        padding: 6px !important;
        border-radius: 10px !important;
    }

    .approval-paper {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 12px 10px !important;
        font-size: 14px !important;
        line-height: 1.35 !important;
        box-shadow: none !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

        .approval-paper h3 {
            font-size: 16px !important;
            line-height: 1.25 !important;
        }

        .approval-paper p {
            margin: 5px 0 !important;
        }

        .approval-paper .indent {
            padding-left: 0 !important;
        }

        .approval-paper p span:not(.paper-check) {
            min-width: 64px !important;
            max-width: 100% !important;
            padding: 0 3px !important;
        }

    .approval-paper-sign {
        width: 100% !important;
        margin: 12px 0 !important;
    }

    .approval-paper-boxes {
        grid-template-columns: 1fr !important;
    }

        .approval-paper-boxes > div {
            min-height: 110px !important;
            padding: 8px !important;
        }

            .approval-paper-boxes > div + div {
                border-left: 0 !important;
                border-top: 1px solid #64748b !important;
            }

    .paper-check {
        margin-left: 8px !important;
        margin-right: 5px !important;
    }

    .approval-signing-panel {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
        padding: 12px !important;
        margin: 0 !important;
        border-radius: 10px !important;
        box-shadow: none !important;
    }

        .approval-signing-panel h3 {
            font-size: 18px !important;
        }

    .signature-tools {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        padding: 10px !important;
    }

        .signature-tools label {
            display: grid !important;
            grid-template-columns: 28px 1fr !important;
            align-items: center !important;
            gap: 8px !important;
            min-height: 36px !important;
        }

        .signature-tools input[type="radio"] {
            width: 22px !important;
            height: 22px !important;
        }

        .signature-tools canvas,
        #signaturePad {
            height: 130px !important;
        }

    .director-signature-preview {
        min-height: 110px !important;
    }

        .director-signature-preview img {
            max-height: 110px !important;
        }

    .signature-tools .inline-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

        .signature-tools .inline-actions button {
            width: 100% !important;
            min-height: 42px !important;
        }

    .approval-modal-panel .modal-actions {
        position: sticky !important;
        bottom: 0 !important;
        display: grid !important;
        grid-template-columns: 1fr 1.3fr !important;
        gap: 10px !important;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) !important;
        background: rgba(255, 255, 255, .98) !important;
    }

        .approval-modal-panel .modal-actions button {
            width: 100% !important;
            min-height: 44px !important;
            font-size: 15px !important;
        }
}

/* มือถือจอแคบมาก */
@media (max-width: 380px) {
    .approval-modal-panel .modal-head h2 {
        font-size: 19px !important;
    }

    .approval-paper {
        font-size: 13px !important;
    }

        .approval-paper h3 {
            font-size: 15px !important;
        }

    .signature-tools .inline-actions {
        grid-template-columns: 1fr !important;
    }
}


/* =========================================================
   Mobile / Tablet Navigation Visibility Fix — all roles
   2026-06-08
   แก้ปัญหามือถือไม่เห็นเมนูรับงาน/เมนูอื่น ๆ
   ========================================================= */
@media (max-width: 820px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden !important;
    }

    .app-shell,
    .app-shell.collapsed {
        display: block !important;
        grid-template-columns: none !important;
        min-height: 100dvh !important;
    }

        /* จากเดิม sidebar ถูกซ่อนไว้ด้านซ้าย ทำให้ผู้ใช้มือถือไม่เห็นเมนูอื่น */
        .sidebar,
        .app-shell.collapsed .sidebar {
            position: sticky !important;
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            z-index: 60 !important;
            width: 100% !important;
            height: auto !important;
            max-height: none !important;
            transform: none !important;
            display: block !important;
            padding: 8px 8px 10px !important;
            border-radius: 0 !important;
            overflow-x: auto !important;
            overflow-y: hidden !important;
            -webkit-overflow-scrolling: touch !important;
            box-shadow: 0 8px 22px rgba(15, 23, 42, .16) !important;
        }

            .sidebar.open {
                transform: none !important;
            }

    .brand {
        display: none !important;
    }

    .collapse-button {
        display: none !important;
    }

    .nav,
    #mainNav {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 2px 2px 4px !important;
        scrollbar-width: thin !important;
        -webkit-overflow-scrolling: touch !important;
    }

        .nav button,
        .app-shell.collapsed .nav button {
            flex: 0 0 auto !important;
            width: auto !important;
            min-width: 122px !important;
            max-width: 190px !important;
            min-height: 42px !important;
            display: inline-flex !important;
            grid-template-columns: none !important;
            justify-content: flex-start !important;
            align-items: center !important;
            gap: 8px !important;
            padding: 9px 12px !important;
            border-radius: 12px !important;
            white-space: nowrap !important;
            text-overflow: ellipsis !important;
            overflow: hidden !important;
            font-size: 13px !important;
            line-height: 1.15 !important;
        }

        .nav .nav-icon,
        .app-shell.collapsed .nav .nav-icon {
            width: 22px !important;
            height: 22px !important;
            min-width: 22px !important;
            display: inline-grid !important;
        }

        .app-shell.collapsed .nav button span:last-child,
        .nav button span:last-child {
            display: inline !important;
            min-width: 0 !important;
            overflow: hidden !important;
            text-overflow: ellipsis !important;
        }

    .workspace {
        width: 100% !important;
        min-width: 0 !important;
    }

    .topbar {
        position: sticky !important;
        top: 58px !important;
        z-index: 50 !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        padding: 10px 12px !important;
        background: rgba(255, 255, 255, .97) !important;
    }

    .menu-toggle {
        display: none !important;
    }

    .topbar-left {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 2px !important;
    }

        .topbar-left h1,
        #pageTitle {
            font-size: clamp(24px, 8vw, 34px) !important;
            line-height: 1.08 !important;
            margin: 0 !important;
        }

    .topbar-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 64px !important;
        gap: 8px !important;
        align-items: stretch !important;
    }

        .topbar-actions .searchbox {
            grid-column: 1 / 2 !important;
            width: 100% !important;
            min-width: 0 !important;
        }

        .topbar-actions .icon-button {
            grid-column: 2 / 3 !important;
            width: 100% !important;
            min-width: 0 !important;
        }

        .topbar-actions .ghost-button,
        .topbar-actions .primary-button {
            width: 100% !important;
            min-height: 46px !important;
            padding: 10px !important;
            font-size: 15px !important;
        }

        .topbar-actions .ghost-button {
            grid-column: 1 / 2 !important;
        }

        .topbar-actions .primary-button {
            grid-column: 2 / 3 !important;
        }

    .content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px !important;
        padding-bottom: 112px !important;
        overflow-x: hidden !important;
    }

    .card,
    .panel,
    .module-card,
    .dashboard-card,
    .request-card,
    .assignment-card,
    .maintenance-card,
    .driver-card,
    .vehicle-card,
    .document-card,
    .report-card {
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .table-wrap,
    .data-table-wrap,
    .report-table-wrap {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    table {
        min-width: 680px;
    }

    .modal,
    dialog.modal {
        width: 100vw !important;
        max-width: 100vw !important;
        padding: 0 !important;
    }

    .modal-panel {
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr) auto !important;
        overflow: hidden !important;
    }

        .modal-panel > .form-grid,
        .modal-body,
        .modal-content-scroll {
            overflow: auto !important;
            -webkit-overflow-scrolling: touch !important;
        }

    .form-grid,
    .fuel-form-grid,
    .member-form-grid,
    .report-month-grid,
    .assignment-grid,
    .assignment-detail,
    .inspection-checklist,
    .vehicle-photo-grid {
        grid-template-columns: 1fr !important;
    }

    .modal-actions,
    .modal-panel .modal-actions {
        position: sticky !important;
        bottom: 0 !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) !important;
        background: rgba(255,255,255,.98) !important;
        z-index: 5 !important;
    }

        .modal-actions button,
        .modal-panel .modal-actions button {
            width: 100% !important;
            min-height: 44px !important;
        }

    .session-chip {
        left: 10px !important;
        right: 10px !important;
        bottom: 10px !important;
        z-index: 70 !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        gap: 8px !important;
        align-items: center !important;
    }
}

@media (min-width: 821px) and (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 220px minmax(0, 1fr) !important;
    }

    .topbar-actions {
        flex-wrap: wrap !important;
    }

    .searchbox {
        min-width: 280px !important;
    }

    .content {
        padding: 16px !important;
        padding-bottom: 80px !important;
    }

    .kpi-grid,
    .bottom-grid,
    .module-grid,
    .stat-band {
        grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
    }
}

@media (max-width: 430px) {
    .nav button,
    .app-shell.collapsed .nav button {
        min-width: 110px !important;
        max-width: 150px !important;
        font-size: 12px !important;
        padding: 8px 10px !important;
    }

    .topbar-actions {
        grid-template-columns: minmax(0, 1fr) 56px !important;
    }

        .topbar-actions .ghost-button,
        .topbar-actions .primary-button {
            font-size: 14px !important;
        }
}


/* Inspection save result: keep submitted data visible after saving */
.inspection-save-result {
    margin-top: 18px;
    border: 1px solid rgba(9, 156, 160, 0.35);
    border-radius: 16px;
    background: linear-gradient(180deg, #f0fdfa, #ffffff);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.inspection-save-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(9, 156, 160, 0.18);
}

    .inspection-save-result-head strong {
        display: block;
        color: #075985;
        font-size: 18px;
    }

    .inspection-save-result-head span {
        display: block;
        margin-top: 4px;
        color: #64748b;
        font-size: 13px;
    }

.inspection-result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 16px 18px 18px;
}

    .inspection-result-grid > div {
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #fff;
        padding: 12px;
    }

        .inspection-result-grid > div.wide {
            grid-column: 1 / -1;
        }

    .inspection-result-grid span {
        display: block;
        color: #64748b;
        font-size: 13px;
        margin-bottom: 6px;
    }

    .inspection-result-grid strong {
        display: block;
        color: #0f172a;
        line-height: 1.5;
    }

    .inspection-result-grid small {
        color: #b45309;
        font-weight: 700;
    }

@media (max-width: 720px) {
    .inspection-save-result-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .inspection-result-grid {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .inspection-save-result-head strong {
        font-size: 16px;
    }
}


/* ===== SKK vehicle alert color dashboard patch ===== */
.vehicle-alert-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4,minmax(160px,1fr));
    gap: 12px;
}

.vehicle-alert-kpi {
    border: 1px solid #e2e8f0;
    border-left: 8px solid #94a3b8;
    border-radius: 12px;
    padding: 14px 16px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15,23,42,.06);
}

    .vehicle-alert-kpi strong {
        display: block;
        font-size: 30px;
        line-height: 1;
        color: #0f172a;
    }

    .vehicle-alert-kpi span {
        display: block;
        margin-top: 6px;
        color: #475569;
        font-weight: 700;
    }

    .vehicle-alert-kpi.normal {
        background: #f0fdf4;
        border-left-color: #16a34a;
    }

    .vehicle-alert-kpi.tax {
        background: #fefce8;
        border-left-color: #eab308;
    }

    .vehicle-alert-kpi.oil {
        background: #fff7ed;
        border-left-color: #f97316;
    }

    .vehicle-alert-kpi.critical {
        background: #fef2f2;
        border-left-color: #dc2626;
    }

.vehicle-alert-row {
    transition: background .18s ease, box-shadow .18s ease;
}

    .vehicle-alert-row.vehicle-alert-normal {
        background: #fff;
    }

    .vehicle-alert-row.vehicle-alert-tax {
        background: #fefce8 !important;
        box-shadow: inset 7px 0 0 #eab308;
    }

    .vehicle-alert-row.vehicle-alert-oil {
        background: #fff7ed !important;
        box-shadow: inset 7px 0 0 #f97316;
    }

    .vehicle-alert-row.vehicle-alert-critical {
        background: #fef2f2 !important;
        box-shadow: inset 7px 0 0 #dc2626;
    }

        .vehicle-alert-row.vehicle-alert-tax:hover,
        .vehicle-alert-row.vehicle-alert-oil:hover,
        .vehicle-alert-row.vehicle-alert-critical:hover {
            filter: saturate(1.05);
        }

.vehicle-alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 5px 10px;
    font-weight: 800;
    line-height: 1.2;
}

.vehicle-alert-badge-oil::before {
    content: "🟠";
}

.vehicle-alert-badge-tax::before {
    content: "🟡";
}

.vehicle-alert-detail {
    display: inline-block;
    margin-top: 4px;
}

.alert-row.amber {
    background: #fff7ed;
    border-left: 6px solid #f97316;
}

.alert-row.red {
    background: #fef2f2;
    border-left: 6px solid #dc2626;
}

@media (max-width:900px) {
    .vehicle-alert-kpi-grid {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
}

@media (max-width:560px) {
    .vehicle-alert-kpi-grid {
        grid-template-columns: 1fr;
    }
}


/* ===== SKK A4 approval form layout fix: ให้พอดี A4 ===== */
.approval-paper {
    width: min(760px,100%) !important;
    padding: 14px 22px !important;
    font-size: 15px !important;
    line-height: 1.16 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
}

    .approval-paper h3 {
        font-size: 18px !important;
        line-height: 1.18 !important;
        margin: 0 0 3px !important;
    }

    .approval-paper p {
        margin: 2px 0 !important;
    }

    .approval-paper .indent {
        padding-left: 30px !important;
    }

    .approval-paper p span:not(.paper-check) {
        min-width: 92px !important;
        padding: 0 4px !important;
    }

.approval-paper-sign {
    margin: 8px 0 7px auto !important;
    width: min(300px,100%) !important;
    line-height: 1.14 !important;
}

.approval-paper-boxes {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
}

    .approval-paper-boxes > div {
        min-height: 112px !important;
        padding: 7px 8px !important;
        line-height: 1.14 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

.director-signature-preview {
    min-height: 30px !important;
    margin: 4px auto 1px !important;
}

    .director-signature-preview img {
        max-width: 120px !important;
        max-height: 34px !important;
    }

.approval-signer-title {
    line-height: 1.12 !important;
}

.allocator-block {
    margin-top: 3px !important;
    line-height: 1.12 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 8mm;
    }

    body {
        margin: 0 !important;
        background: #fff !important;
    }

    .approval-paper {
        width: 100% !important;
        box-shadow: none !important;
        border: 0 !important;
        padding: 0 !important;
        font-size: 15.5pt !important;
        line-height: 1.12 !important;
        page-break-before: avoid !important;
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

        .approval-paper h3 {
            font-size: 18pt !important;
            line-height: 1.14 !important;
            margin: 0 0 2pt !important;
        }

        .approval-paper p {
            margin: 2pt 0 !important;
        }

        .approval-paper .indent {
            padding-left: 28pt !important;
        }

        .approval-paper p span:not(.paper-check) {
            min-width: 90pt !important;
            padding: 0 3pt !important;
        }

    .approval-paper-sign {
        margin: 6pt 0 5pt auto !important;
        width: 245pt !important;
        line-height: 1.12 !important;
    }

    .approval-paper-boxes {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

        .approval-paper-boxes > div {
            min-height: 104pt !important;
            padding: 6pt 7pt !important;
            line-height: 1.12 !important;
        }

    .director-signature-preview {
        min-height: 26pt !important;
        margin: 3pt auto 1pt !important;
    }

        .director-signature-preview img {
            max-width: 118pt !important;
            max-height: 30pt !important;
        }

    .approval-signer-title, .allocator-block {
        line-height: 1.08 !important;
    }
}

/* ===== SKK OFFICIAL THAI TYPOGRAPHY FIX: ปรับเฉพาะตัวอักษรตามรูปแบบราชการ ไม่แตะข้อมูล ===== */
.approval-paper {
    font-family: "TH Sarabun New","TH Sarabun PSK","Sarabun","Tahoma",sans-serif !important;
    font-size: 16.5pt !important;
    font-weight: 400 !important;
    line-height: 1.18 !important;
    color: #111 !important;
    letter-spacing: 0 !important;
}

    .approval-paper .form-no,
    .approval-paper .right {
        font-size: 13pt !important;
        font-weight: 400 !important;
    }

    .approval-paper h3 {
        font-family: "TH Sarabun New","TH Sarabun PSK","Sarabun","Tahoma",sans-serif !important;
        font-size: 21pt !important;
        font-weight: 700 !important;
        line-height: 1.08 !important;
        margin: 0 0 2pt !important;
        color: #07172f !important;
    }

    .approval-paper .center {
        font-size: 16.5pt !important;
        font-weight: 400 !important;
        line-height: 1.12 !important;
    }

    .approval-paper p {
        font-size: 16.5pt !important;
        font-weight: 400 !important;
        line-height: 1.16 !important;
        margin: 1.5pt 0 !important;
    }

        .approval-paper p span:not(.paper-check) {
            font-weight: 600 !important;
            border-bottom: 1px dotted #333 !important;
            padding: 0 3pt !important;
            line-height: 1.05 !important;
        }

.approval-paper-sign {
    font-size: 16pt !important;
    font-weight: 400 !important;
    line-height: 1.12 !important;
    margin: 5pt 0 4pt auto !important;
}

.approval-paper-boxes {
    font-size: 15.5pt !important;
    line-height: 1.12 !important;
    border: 1px solid #6b7280 !important;
}

    .approval-paper-boxes > div {
        font-size: 15.5pt !important;
        font-weight: 400 !important;
        line-height: 1.12 !important;
        min-height: 98pt !important;
        padding: 5pt 7pt !important;
    }

    .approval-paper-boxes strong,
    .approval-paper-boxes b {
        font-weight: 700 !important;
    }

.director-signature-preview {
    min-height: 24pt !important;
    margin: 2pt auto 0 !important;
}

    .director-signature-preview img {
        max-width: 112pt !important;
        max-height: 27pt !important;
    }

.approval-signer-title,
.allocator-block {
    font-size: 14.5pt !important;
    font-weight: 400 !important;
    line-height: 1.08 !important;
    margin-top: 1pt !important;
}

    .allocator-block strong,
    .allocator-block b {
        font-size: 15.5pt !important;
        font-weight: 700 !important;
    }

.paper-check {
    width: 11pt !important;
    height: 11pt !important;
    line-height: 10pt !important;
    margin: 0 4pt -1pt 7pt !important;
    font-size: 10pt !important;
}

@media print {
    .approval-paper {
        font-family: "TH Sarabun New","TH Sarabun PSK","Sarabun","Tahoma",sans-serif !important;
        font-size: 16pt !important;
        font-weight: 400 !important;
        line-height: 1.13 !important;
    }

        .approval-paper .form-no,
        .approval-paper .right {
            font-size: 12.5pt !important;
        }

        .approval-paper h3 {
            font-size: 20pt !important;
            line-height: 1.05 !important;
            margin: 0 0 1pt !important;
        }

        .approval-paper .center {
            font-size: 16pt !important;
            line-height: 1.08 !important;
        }

        .approval-paper p {
            font-size: 16pt !important;
            line-height: 1.11 !important;
            margin: 1pt 0 !important;
        }

            .approval-paper p span:not(.paper-check) {
                font-weight: 600 !important;
                border-bottom: 1px dotted #333 !important;
                padding: 0 2.5pt !important;
            }

    .approval-paper-sign {
        font-size: 15.5pt !important;
        line-height: 1.08 !important;
        margin: 4pt 0 3pt auto !important;
    }

    .approval-paper-boxes {
        font-size: 15pt !important;
        line-height: 1.08 !important;
    }

        .approval-paper-boxes > div {
            font-size: 15pt !important;
            line-height: 1.08 !important;
            min-height: 93pt !important;
            padding: 4.5pt 6pt !important;
        }

    .director-signature-preview {
        min-height: 22pt !important;
        margin: 2pt auto 0 !important;
    }

        .director-signature-preview img {
            width: 220px !important;
            max-width: 220px !important;
            height: auto !important;
            max-height: 85px !important;
            object-fit: contain !important;
        }

    .approval-signer-title, .allocator-block {
        font-size: 14pt !important;
        line-height: 1.05 !important;
    }

        .allocator-block strong, .allocator-block b {
            font-size: 15pt !important;
            font-weight: 700 !important;
        }
}


/* ===== โลโก้หน่วยงานเฉพาะหัวกระดาษแบบ 3 ===== */
.official-header-logo {
    text-align: center;
    margin: 0 0 4px;
    line-height: 1;
}

    .official-header-logo img {
        width: 100px;
        height: auto;
        display: block;
        margin: 0 auto;
        object-fit: contain;
    }

@media print {
    .official-header-logo {
        margin: 0 0 3pt !important;
    }

        .official-header-logo img {
            width: 100pt !important;
            height: auto !important;
        }
}

/* =========================================================
   SKK Government Cars UI Refresh v30
   - ปรับเฉพาะหน้าแสดงผล / Login / หน้าผู้ใช้งาน
   - ไม่แตะ logic, API, SQL
   ========================================================= */
:root {
  --skk-bg-soft: #f6f9fc;
  --skk-card-border: rgba(148, 163, 184, .28);
  --skk-card-shadow: 0 16px 38px rgba(15, 23, 42, .08);
  --skk-card-shadow-hover: 0 22px 54px rgba(15, 23, 42, .12);
  --skk-focus: 0 0 0 4px rgba(20, 184, 166, .18);
}

body {
  background:
    radial-gradient(circle at top right, rgba(20,184,166,.08), transparent 32rem),
    radial-gradient(circle at 12% 10%, rgba(37,99,235,.07), transparent 26rem),
    var(--skk-bg-soft);
}

.workspace {
  background: transparent;
}

.topbar {
  min-height: 78px;
  border-bottom: 1px solid rgba(203, 213, 225, .72);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .035);
}

.section-label {
  letter-spacing: .02em;
}

h1 {
  font-size: clamp(24px, 2vw, 30px);
  font-weight: 800;
  color: #0f172a;
}

.content {
  padding: 24px;
  animation: skkFadeIn .22s ease-out;
}

@keyframes skkFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar {
  box-shadow: 10px 0 26px rgba(2, 6, 23, .10);
}

.brand {
  padding-top: 6px;
  padding-bottom: 24px;
}

.seal {
  background: rgba(255, 211, 108, .08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10);
}

.nav {
  gap: 8px;
}

.nav button,
.collapse-button {
  border-radius: 14px;
  transition: transform .15s ease, background .15s ease, color .15s ease;
}

.nav button:hover,
.nav button.active {
  transform: translateX(2px);
  box-shadow: 0 10px 22px rgba(8, 156, 160, .24);
}

.searchbox,
.icon-button,
.ghost-button,
.primary-button,
.danger-button,
.success-button,
input,
select,
textarea {
  border-radius: 12px !important;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  box-shadow: var(--skk-focus);
}

.primary-button {
  background: linear-gradient(135deg, #089da1, #0f766e);
  box-shadow: 0 10px 22px rgba(15, 118, 110, .20);
}

.primary-button:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.ghost-button:hover,
.icon-button:hover {
  background: #f8fafc;
  border-color: #93c5fd;
}

.panel,
.kpi-card,
.session-chip,
.member-panel,
.modal-panel {
  border: 1px solid var(--skk-card-border) !important;
  box-shadow: var(--skk-card-shadow) !important;
}

.panel:hover,
.kpi-card:hover {
  box-shadow: var(--skk-card-shadow-hover) !important;
}

.panel {
  overflow: hidden;
}

.panel-head,
.card-head,
.modal-head {
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.table-wrap,
.panel table {
  border-radius: 0 0 14px 14px;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  background: #f8fafc;
  color: #475569;
  font-weight: 800;
  border-bottom: 1px solid #e2e8f0;
}

tbody tr {
  transition: background .14s ease;
}

tbody tr:hover {
  background: #f8fbff;
}

tbody td {
  vertical-align: top;
}

.badge,
.status-badge,
.priority-badge {
  border-radius: 999px !important;
  font-weight: 800;
  padding-inline: 10px !important;
}

/* ---------- Login / Before login ---------- */
.auth-locked {
  filter: blur(1.5px) saturate(.9);
}

.auth-backdrop {
  background:
    linear-gradient(135deg, rgba(2, 6, 23, .62), rgba(8, 49, 83, .42)),
    radial-gradient(circle at 20% 10%, rgba(255, 211, 108, .22), transparent 22rem),
    radial-gradient(circle at 90% 30%, rgba(20, 184, 166, .30), transparent 24rem) !important;
  backdrop-filter: blur(7px);
  padding: 22px;
}

.auth-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.72) !important;
  border-radius: 22px !important;
  box-shadow: 0 28px 90px rgba(2, 6, 23, .30) !important;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 7px;
  background: linear-gradient(90deg, #ffd36c, #14b8a6, #2563eb);
}

.auth-title {
  text-align: center;
  margin-bottom: 16px;
}

.auth-title span {
  width: 58px !important;
  height: 58px !important;
  margin: 0 auto 10px;
  border-radius: 18px !important;
  background: linear-gradient(135deg, #083153, #0d4169) !important;
  box-shadow: 0 12px 30px rgba(8, 49, 83, .28);
}

.auth-title h2 {
  font-size: 26px !important;
  font-weight: 900 !important;
}

.auth-tabs {
  background: #eef6ff !important;
  border: 1px solid #dbeafe !important;
  border-radius: 14px !important;
  padding: 4px !important;
}

.auth-tabs button {
  border-radius: 11px !important;
}

.auth-tabs button.active {
  background: #ffffff !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .12);
}

.auth-card label {
  color: #334155;
  font-weight: 800;
}

.auth-card input,
.auth-card select {
  margin-top: 6px;
  min-height: 46px;
  border: 1px solid #cbd5e1;
  background: #fbfdff;
}

.auth-submit {
  min-height: 48px;
  margin-top: 8px;
  font-size: 15px;
}

.auth-note {
  border-radius: 12px;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0;
  color: #475569 !important;
}

.auth-inline-message.error {
  border-radius: 12px;
}

.session-chip {
  border-radius: 16px !important;
  background: rgba(255,255,255,.96) !important;
  backdrop-filter: blur(10px);
}

/* ---------- User pages ---------- */
.kpi-grid {
  gap: 18px;
}

.kpi-card {
  border-radius: 18px !important;
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.kpi-icon {
  border-radius: 18px !important;
  box-shadow: inset 0 -10px 24px rgba(255,255,255,.14);
}

.kpi-card strong {
  letter-spacing: -.04em;
}

.panel {
  border-radius: 18px !important;
  background: rgba(255,255,255,.94);
}

.panel-head {
  padding: 18px 20px !important;
}

.panel-head h2,
.panel-head h3 {
  font-weight: 900;
}

.empty-state,
.panel-empty {
  padding: 36px 18px !important;
  color: #64748b !important;
}

/* Request table: easier to read */
#content table td:first-child,
#content table th:first-child {
  padding-left: 16px;
}

#content table td:last-child,
#content table th:last-child {
  padding-right: 16px;
}

/* Calendar month cells */
.calendar-month,
.month-calendar,
.calendar-grid {
  border-radius: 16px;
  overflow: hidden;
}

.calendar-day,
.month-day {
  min-height: 96px;
  background: #fff;
}

.calendar-day:hover,
.month-day:hover {
  background: #f0fdfa;
}

/* Better dialogs */
dialog.modal::backdrop,
.modal::backdrop {
  background: rgba(15, 23, 42, .55) !important;
  backdrop-filter: blur(5px);
}

.modal-panel {
  border-radius: 22px !important;
  overflow: hidden;
}

.form-grid label {
  font-weight: 800;
  color: #334155;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  min-height: 44px;
  background: #fbfdff;
}

.toast {
  border-radius: 14px !important;
  box-shadow: 0 18px 48px rgba(2, 6, 23, .24) !important;
}

@media (max-width: 960px) {
  .content { padding: 16px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .searchbox { width: min(100%, 360px); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 82vw; max-width: 300px; transform: translateX(-102%); transition: transform .18s ease; }
  body.menu-open .sidebar { transform: translateX(0); }
  .topbar { min-height: auto; padding: 12px; }
  .topbar-left { width: 100%; }
  .topbar-actions { width: 100%; justify-content: stretch; }
  .searchbox { width: 100%; min-width: 0; order: 1; }
  .ghost-button, .primary-button { flex: 1; }
  .kpi-grid { grid-template-columns: 1fr; }
  .auth-card { width: min(100%, 430px) !important; }
}
/* ปรับเฉพาะ Popup ตรวจสภาพรถ */
.modal .modal-panel {
  width: min(96vw, 980px);
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 22px;
}

.modal .inspection-grid,
.modal .checklist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.modal .form-grid {
  gap: 14px;
}

/* iPad / Tablet */
@media (max-width: 1024px) {
  .modal .modal-panel {
    width: 94vw;
    max-height: 90vh;
  }

  .modal .inspection-grid,
  .modal .checklist-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* มือถือ */
@media (max-width: 640px) {
  .modal {
    padding: 0;
  }

  .modal .modal-panel {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 18px 18px 0 0;
    overflow-y: auto;
  }

  .modal .modal-head {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
  }

  .modal .inspection-grid,
  .modal .checklist-grid,
  .modal .form-grid {
    grid-template-columns: 1fr;
  }

  .modal .modal-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 12px;
  }

  .modal input,
  .modal select,
  .modal textarea,
  .modal button {
    font-size: 16px;
  }
}

/* =========================================================
   FIX: Responsive popup ตรวจสภาพรถ ก่อน/หลังเดินทาง
   เฉพาะ popup ที่มี .pretrip-panel เท่านั้น
   ========================================================= */

/* ตัว dialog เอง ไม่ใช่ .modal-panel */
dialog.modal:has(.pretrip-panel),
.modal:has(.pretrip-panel) {
  width: min(96vw, 1040px) !important;
  max-width: 1040px !important;
  max-height: 92dvh !important;
  height: auto !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 22px !important;
}

/* กล่องเนื้อหาใน popup ตรวจสภาพ */
dialog.modal:has(.pretrip-panel) .pretrip-panel,
.modal:has(.pretrip-panel) .pretrip-panel {
  max-height: 92dvh !important;
  overflow-y: auto !important;
  border-radius: 22px !important;
  box-shadow: none !important;
}

/* หัว popup ติดด้านบนเวลาเลื่อน */
dialog.modal:has(.pretrip-panel) .panel-head,
.modal:has(.pretrip-panel) .panel-head {
  position: sticky !important;
  top: 0 !important;
  z-index: 8 !important;
  background: #fff !important;
}

/* Desktop / Notebook: 3 คอลัมน์พอดีตา */
dialog.modal:has(.pretrip-panel) .inspection-checklist,
.modal:has(.pretrip-panel) .inspection-checklist {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 12px !important;
  padding: 16px 18px !important;
}

dialog.modal:has(.pretrip-panel) .form-grid,
.modal:has(.pretrip-panel) .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  padding: 16px 18px !important;
}

dialog.modal:has(.pretrip-panel) .vehicle-photo-grid,
.modal:has(.pretrip-panel) .vehicle-photo-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

/* ปุ่มล่างติดด้านล่าง มองเห็นตลอด */
dialog.modal:has(.pretrip-panel) .modal-actions,
.modal:has(.pretrip-panel) .modal-actions {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 8 !important;
  background: rgba(255,255,255,.96) !important;
  backdrop-filter: blur(8px);
}

/* iPad / Tablet */
@media (max-width: 1024px) {
  dialog.modal:has(.pretrip-panel),
  .modal:has(.pretrip-panel) {
    width: 94vw !important;
    max-width: 94vw !important;
    max-height: 90dvh !important;
  }

  dialog.modal:has(.pretrip-panel) .inspection-checklist,
  .modal:has(.pretrip-panel) .inspection-checklist {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  dialog.modal:has(.pretrip-panel) .vehicle-photo-grid,
  .modal:has(.pretrip-panel) .vehicle-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* มือถือ: เต็มจอ ใช้งานง่าย ไม่โดนตัดด้านขวา */
@media (max-width: 640px) {
  dialog.modal:has(.pretrip-panel),
  .modal:has(.pretrip-panel) {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  dialog.modal:has(.pretrip-panel) .pretrip-panel,
  .modal:has(.pretrip-panel) .pretrip-panel {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
  }

  dialog.modal:has(.pretrip-panel) .inspection-checklist,
  dialog.modal:has(.pretrip-panel) .form-grid,
  dialog.modal:has(.pretrip-panel) .vehicle-photo-grid,
  .modal:has(.pretrip-panel) .inspection-checklist,
  .modal:has(.pretrip-panel) .form-grid,
  .modal:has(.pretrip-panel) .vehicle-photo-grid {
    grid-template-columns: 1fr !important;
    padding: 12px !important;
  }

  dialog.modal:has(.pretrip-panel) .inspection-item,
  .modal:has(.pretrip-panel) .inspection-item {
    min-height: auto !important;
    padding: 12px !important;
  }

  dialog.modal:has(.pretrip-panel) input,
  dialog.modal:has(.pretrip-panel) select,
  dialog.modal:has(.pretrip-panel) textarea,
  dialog.modal:has(.pretrip-panel) button,
  .modal:has(.pretrip-panel) input,
  .modal:has(.pretrip-panel) select,
  .modal:has(.pretrip-panel) textarea,
  .modal:has(.pretrip-panel) button {
    font-size: 16px !important;
  }

  dialog.modal:has(.pretrip-panel) .modal-actions,
  .modal:has(.pretrip-panel) .modal-actions {
    padding: 12px !important;
  }
}


/* =========================================================
   SIDEBAR RESTORE / BEAUTY FIX — safe
   แก้เฉพาะเมนูด้านซ้าย ไม่แตะ popup / pdf / api / content
   หลักการ: sidebar หลักไม่เลื่อนทั้งก้อน ให้เลื่อนเฉพาะรายการเมนู (#mainNav)
   ========================================================= */
@media (min-width: 821px) {
  .app-shell {
    grid-template-columns: 248px minmax(0, 1fr) !important;
  }

  .app-shell.collapsed {
    grid-template-columns: 74px minmax(0, 1fr) !important;
  }

  .sidebar,
  .app-shell.collapsed .sidebar {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    right: auto !important;
    z-index: 20 !important;
    width: auto !important;
    max-width: none !important;
    height: 100vh !important;
    max-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 18px 8px !important;
    overflow: hidden !important;
    transform: none !important;
    border-radius: 0 !important;
    background: linear-gradient(180deg, var(--navy-900), #04213d) !important;
    box-shadow: 10px 0 26px rgba(2, 6, 23, .10) !important;
  }

  .brand {
    display: grid !important;
    grid-template-columns: 46px 1fr !important;
    gap: 10px !important;
    align-items: center !important;
    flex: 0 0 auto !important;
    padding: 6px 10px 18px !important;
    min-height: 68px !important;
  }

  .app-shell.collapsed .brand {
    grid-template-columns: 1fr !important;
    justify-items: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .app-shell.collapsed .brand div:not(.seal) {
    display: none !important;
  }

  .nav,
  #mainNav {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    display: grid !important;
    align-content: start !important;
    gap: 6px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 2px 4px 8px 0 !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(255,255,255,.42) transparent !important;
  }

  .nav::-webkit-scrollbar,
  #mainNav::-webkit-scrollbar {
    width: 6px !important;
  }

  .nav::-webkit-scrollbar-track,
  #mainNav::-webkit-scrollbar-track {
    background: transparent !important;
  }

  .nav::-webkit-scrollbar-thumb,
  #mainNav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.26) !important;
    border-radius: 999px !important;
  }

  .nav button,
  .app-shell.collapsed .nav button {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 42px !important;
    height: auto !important;
    display: grid !important;
    grid-template-columns: 28px minmax(0,1fr) !important;
    justify-items: stretch !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    white-space: normal !important;
    text-align: left !important;
    line-height: 1.25 !important;
    font-size: 14px !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
  }

  .nav button:hover,
  .nav button.active {
    background: linear-gradient(90deg, var(--teal-600), #087b96) !important;
    color: #fff !important;
    transform: translateX(2px) !important;
    box-shadow: 0 10px 22px rgba(8, 156, 160, .22) !important;
  }

  .nav .nav-icon,
  .app-shell.collapsed .nav .nav-icon {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    display: grid !important;
    place-items: center !important;
  }

  .app-shell.collapsed .nav button {
    grid-template-columns: 1fr !important;
    justify-items: center !important;
    padding: 11px 0 !important;
  }

  .app-shell.collapsed .nav button span:last-child {
    display: none !important;
  }

  .collapse-button {
    flex: 0 0 auto !important;
    margin-top: 8px !important;
    width: 100% !important;
    min-height: 38px !important;
    display: grid !important;
    grid-template-columns: 28px 1fr !important;
    align-items: center !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    overflow: hidden !important;
  }

  .app-shell.collapsed .collapse-button {
    grid-template-columns: 1fr !important;
    justify-items: center !important;
    padding: 10px 0 !important;
  }

  .app-shell.collapsed .collapse-button span:last-child {
    display: none !important;
  }
}

/* ===== OVERVIEW DASHBOARD BALANCE FIX 2026-06-20 ===== */
/* ===== OVERVIEW DASHBOARD BALANCE FIX 2026-06-20 =====
   แก้เฉพาะหน้า Dashboard ภาพรวม: .executive-hero / .graphic-kpi / .infographic / .dashboard-visual
   ไม่แตะ Sidebar, Popup, PDF, API
========================================================= */

/* พื้นที่ Dashboard ให้สมดุล ไม่ยืดฟุ้งเกินไปบนจอใหญ่ */
.content:has(.executive-hero) {
  max-width: 1560px !important;
  margin: 0 auto !important;
}

/* Hero ด้านบน: กะทัดรัดขึ้นแต่ยังเด่น */
.executive-hero {
  min-height: 150px !important;
  padding: 22px 26px !important;
  border-radius: 16px !important;
  grid-template-columns: minmax(0, 1fr) 160px !important;
  gap: 20px !important;
}

.executive-hero h2 {
  font-size: clamp(26px, 2.15vw, 38px) !important;
  line-height: 1.2 !important;
  margin-bottom: 8px !important;
}

.executive-hero span {
  font-size: 15px !important;
  line-height: 1.65 !important;
}

.hero-meter {
  width: 138px !important;
  height: 138px !important;
}

.hero-meter strong {
  font-size: 34px !important;
  font-weight: 900 !important;
}

.hero-meter span {
  font-size: 12px !important;
  line-height: 1.35 !important;
}

/* KPI 4 ช่อง: ขนาดอ่านง่ายและช่องไฟเท่ากัน */
.graphic-kpi-grid {
  grid-template-columns: repeat(4, minmax(190px, 1fr)) !important;
  gap: 16px !important;
  margin-bottom: 18px !important;
}

.graphic-kpi {
  min-height: 110px !important;
  padding: 18px !important;
  border-radius: 14px !important;
  grid-template-columns: 54px minmax(0, 1fr) !important;
}

.graphic-kpi-icon {
  width: 54px !important;
  height: 54px !important;
  border-radius: 14px !important;
  font-size: 24px !important;
}

.graphic-kpi span,
.graphic-kpi small {
  font-size: 13px !important;
  line-height: 1.35 !important;
}

.graphic-kpi strong {
  font-size: 36px !important;
  line-height: 1 !important;
  color: #0f172a !important;
  font-weight: 900 !important;
}

/* Infographic preview: ไม่ให้กินพื้นที่ทั้งหน้าเกินไป */
.infographic-panel {
  margin: 18px 0 !important;
  border-radius: 16px !important;
}

.infographic-panel .panel-head {
  min-height: 66px !important;
  padding: 16px 20px !important;
}

.infographic-panel .panel-head h3 {
  font-size: 18px !important;
}

.infographic-preview {
  max-height: 560px !important;
  overflow: auto !important;
  padding: 18px !important;
  background: linear-gradient(180deg, #f8fafc, #eef6ff) !important;
}

.infographic-preview svg {
  width: 100% !important;
  min-width: 920px !important;
  max-width: 1280px !important;
  margin: 0 auto !important;
  border-radius: 18px !important;
}

/* กริดล่าง 3 กล่อง: อ่านง่าย ไม่แน่น */
.dashboard-visual-grid {
  grid-template-columns: minmax(420px, 1.15fr) minmax(300px, .8fr) minmax(420px, 1.05fr) !important;
  gap: 18px !important;
  align-items: stretch !important;
}

.command-panel,
.fleet-panel,
.fuel-panel {
  min-height: 360px !important;
  border-radius: 16px !important;
}

.dashboard-visual-grid .panel-head {
  min-height: 64px !important;
  padding: 16px 18px !important;
}

.dashboard-visual-grid .panel-head h3 {
  font-size: 18px !important;
}

/* สถานะคำขอใช้รถ: ตัวเลขชัด */
.request-bars {
  gap: 14px !important;
  padding: 18px !important;
}

.request-bar div {
  margin-bottom: 8px !important;
}

.request-bar span {
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #334155 !important;
}

.request-bar strong {
  font-size: 30px !important;
  font-weight: 900 !important;
  color: #0f172a !important;
  min-width: 44px !important;
  text-align: right !important;
}

.request-bar i {
  height: 16px !important;
  border-radius: 999px !important;
  background: #e2e8f0 !important;
}

.quick-list {
  padding: 0 18px 18px !important;
}

.quick-list button {
  min-height: 54px !important;
  border-radius: 12px !important;
  background: #f8fafc !important;
}

.quick-list button strong {
  font-size: 17px !important;
}

/* สถานะยานพาหนะ */
.fleet-donut-wrap {
  gap: 18px !important;
  padding: 20px 18px !important;
}

.fleet-donut {
  width: 190px !important;
  height: 190px !important;
}

.fleet-donut strong {
  font-size: 40px !important;
  font-weight: 900 !important;
  color: #0f172a !important;
}

.fleet-donut span {
  font-size: 13px !important;
}

.donut-legend span {
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #334155 !important;
}

.donut-legend strong {
  font-size: 24px !important;
  font-weight: 900 !important;
  color: #0f172a !important;
}

.donut-legend i {
  width: 12px !important;
  height: 12px !important;
}

/* กราฟน้ำมัน */
.graphic-chart {
  height: 250px !important;
  padding: 12px 18px !important;
}

.progress.labeled {
  height: 18px !important;
  margin: 2px 20px 22px !important;
  background: #e2e8f0 !important;
}

.progress.labeled i {
  min-width: 4px !important;
  background: linear-gradient(90deg, #0f766e, #0ea5a4) !important;
}

/* กริดล่าง */
.dashboard-lower-grid {
  grid-template-columns: minmax(560px, 1.25fr) minmax(340px, .75fr) !important;
  gap: 18px !important;
}

.dashboard-lower-grid .panel {
  border-radius: 16px !important;
}

/* Notebook / จอกลาง */
@media (max-width: 1280px) {
  .graphic-kpi-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
  }

  .dashboard-visual-grid,
  .dashboard-lower-grid {
    grid-template-columns: 1fr !important;
  }

  .command-panel,
  .fleet-panel,
  .fuel-panel {
    min-height: auto !important;
  }

  .fleet-donut-wrap {
    grid-template-columns: 240px minmax(0, 1fr) !important;
    align-items: center !important;
  }
}

/* Tablet */
@media (max-width: 900px) {
  .executive-hero {
    grid-template-columns: 1fr !important;
  }

  .hero-meter {
    justify-self: start !important;
  }

  .infographic-preview {
    max-height: 480px !important;
    padding: 12px !important;
  }

  .infographic-preview svg {
    min-width: 860px !important;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .content:has(.executive-hero) {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .executive-hero {
    padding: 18px !important;
    border-radius: 14px !important;
  }

  .executive-hero h2 {
    font-size: 24px !important;
  }

  .graphic-kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .graphic-kpi {
    min-height: 96px !important;
  }

  .infographic-panel .panel-head {
    display: grid !important;
    align-items: start !important;
  }

  .infographic-panel .inline-actions {
    justify-content: stretch !important;
  }

  .infographic-panel .inline-actions button {
    flex: 1 1 auto !important;
  }

  .request-bar strong {
    font-size: 26px !important;
  }

  .fleet-donut-wrap {
    grid-template-columns: 1fr !important;
  }
}


/* =========================================================
   FIX: แสดงปุ่ม OCR / บันทึกผลตรวจสภาพรถบนมือถือเท่านั้น
   จุดแก้เฉพาะหน้า pretrip/posttrip inspection
   ========================================================= */
.pretrip-mobile-actions {
    display: none;
}

@media (max-width: 640px) {
    .content:has(.pretrip-panel) {
        padding-bottom: 132px !important;
    }

    .pretrip-panel {
        overflow: visible !important;
    }

    .pretrip-panel .pretrip-form {
        display: grid !important;
        gap: 0 !important;
    }

    .pretrip-panel .pretrip-mobile-actions {
        position: sticky !important;
        top: 0 !important;
        z-index: 50 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 10px !important;
        margin: 0 !important;
        padding: 10px 14px !important;
        border-top: 0 !important;
        border-bottom: 1px solid var(--slate-200) !important;
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08) !important;
    }

    .pretrip-panel .pretrip-mobile-actions button {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        min-height: 46px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 12px !important;
        font-size: 14px !important;
        white-space: nowrap !important;
    }

    .pretrip-panel .pretrip-mobile-actions .primary-button {
        font-size: 13px !important;
    }

    .pretrip-panel .pretrip-desktop-actions {
        display: none !important;
    }
}
