/* ============================================================
       RESET & VARIABLES — DEEP TEAL & GOLD THEME
       ============================================================ */
:root {
    --primary-900: #022c22;
    --primary-800: #064e3b;
    --primary-700: #065f46;
    --primary-600: #059669;
    --primary-500: #10b981;
    --primary-400: #34d399;
    --primary-300: #6ee7b7;
    --primary-200: #a7f3d0;
    --primary-100: #d1fae5;
    --primary-50: #ecfdf5;
    --accent: #f59e0b;
    --danger: #dc2626;
    --success: #059669;
    --warning: #d97706;
    --bg: #f0f4f3;
    --surface: #ffffff;
    --surface-warm: #f4f9f7;
    --text: #0c1f1a;
    --text-secondary: #264d3f;
    --muted: #5a7a6e;
    --border: #d4e5df;
    --border-light: #e3f0ea;
    --shadow-sm: 0 1px 2px rgba(2, 44, 34, 0.06), 0 1px 4px rgba(2, 44, 34, 0.04);
    --shadow: 0 2px 8px rgba(2, 44, 34, 0.07), 0 4px 20px rgba(2, 44, 34, 0.04);
    --shadow-lg: 0 8px 30px rgba(2, 44, 34, 0.10), 0 12px 48px rgba(2, 44, 34, 0.05);
    --shadow-xl: 0 16px 56px rgba(2, 44, 34, 0.14);
    --sidebar-width: 280px;
    --topbar-height: 66px;
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ----- UTILITIES ----- */
.hidden {
    display: none !important;
}
.flex {
    display: flex;
}
.items-center {
    align-items: center;
}
.justify-between {
    justify-content: space-between;
}
.gap-1 {
    gap: 0.5rem;
}
.gap-2 {
    gap: 1rem;
}
.gap-3 {
    gap: 1.5rem;
}
.w-full {
    width: 100%;
}
.text-center {
    text-align: center;
}
.text-sm {
    font-size: 0.875rem;
}
.text-xs {
    font-size: 0.75rem;
}
.text-muted {
    color: var(--muted);
}
.font-semibold {
    font-weight: 600;
}
.font-bold {
    font-weight: 700;
}
.mt-1 {
    margin-top: 0.5rem;
}
.mt-2 {
    margin-top: 1rem;
}
.mb-1 {
    margin-bottom: 0.5rem;
}
.mb-2 {
    margin-bottom: 1rem;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ----- ANIMATIONS ----- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
@keyframes pulseRing {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.30);
    }
    50% {
        box-shadow: 0 0 0 14px rgba(16, 185, 129, 0);
    }
}

.animate-fade-up {
    animation: fadeUp 0.45s ease-out both;
}
.animate-fade {
    animation: fadeIn 0.3s ease-out both;
}

/* ----- SCROLLBAR ----- */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: var(--border-light);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: var(--primary-300);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-400);
}

/* ============================================================
       BUTTONS
       ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1.2;
    outline: none;
    text-decoration: none;
    letter-spacing: 0.01em;
}
.btn:active {
    transform: scale(0.97);
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-500) 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(6, 95, 70, 0.25);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(6, 95, 70, 0.32);
}

.btn-success {
    background: linear-gradient(135deg, #065f46 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(5, 150, 105, 0.25);
}
.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(5, 150, 105, 0.32);
}

.btn-warning {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--accent) 100%);
    color: #fff;
}
.btn-warning:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(5, 150, 105, 0.30);
}

.btn-danger {
    background: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(220, 38, 38, 0.30);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--primary-300);
}

.btn-ghost {
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
}

.btn-sm {
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
}
.btn-xs {
    padding: 0.3rem 0.7rem;
    font-size: 0.7rem;
    border-radius: 6px;
}
.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 6px;
}

/* ============================================================
       FORMS
       ============================================================ */
.form-group {
    margin-bottom: 1.25rem;
}
.form-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    font-family: var(--font);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.10);
}
.form-control:read-only {
    background: var(--bg);
    color: var(--muted);
}
.form-control.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}
.form-hint {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 0.2rem;
}
.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.3rem;
    font-weight: 700;
    display: none;
}
.form-error.show {
    display: block;
}

/* ============================================================
       LOGIN SCREEN
       ============================================================ */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #021a14 0%, #0a3328 40%, #164d3d 70%, #0c241c 100%);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}
.login-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 25% 20%, rgba(16, 185, 129, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 80%, rgba(245, 158, 11, 0.08) 0%, transparent 45%);
    pointer-events: none;
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
    z-index: 1;
    animation: modalPop 0.5s ease-out;
    backdrop-filter: blur(2px);
}

.login-header {
    background: linear-gradient(135deg, #f0f9f6 0%, #d4f5e8 100%);
    padding: 2.5rem 2rem 1.5rem;
    text-align: center;
    position: relative;
}
.login-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--accent));
    border-radius: 2px;
}
.login-logo-container {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary-600), var(--accent));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 28px rgba(16, 185, 129, 0.28);
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
}
.login-header h1 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-800);
    letter-spacing: -0.01em;
}
.login-header p {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.4rem;
    font-weight: 500;
}

.login-body {
    padding: 2rem;
}

.login-input-group {
    position: relative;
    margin-bottom: 1.25rem;
}
.login-input-group input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: #fff;
    transition: var(--transition);
    color: var(--text);
}
.login-input-group input:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.08);
}
.login-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: var(--muted);
    pointer-events: none;
}

.login-btn {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-500) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 18px rgba(6, 95, 70, 0.25);
    margin-top: 0.25rem;
    letter-spacing: 0.02em;
}
.login-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(6, 95, 70, 0.35);
}
.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-xs);
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    display: none;
    align-items: flex-start;
    gap: 0.5rem;
}
.login-error-box.show {
    display: flex;
}
.login-error-box .text {
    font-size: 0.85rem;
    color: #991b1b;
    font-weight: 700;
}

.login-info-box {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-xs);
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    display: none;
    align-items: flex-start;
    gap: 0.5rem;
}
.login-info-box.show {
    display: flex;
}
.login-info-box .text {
    font-size: 0.85rem;
    color: var(--primary-800);
    font-weight: 600;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--muted);
}
.login-footer a {
    color: var(--primary-500);
    font-weight: 700;
    text-decoration: none;
}

/* Driver Acknowledge section inside login */
.driver-ack-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-light);
}
.driver-ack-section .signature-box {
    padding: 0.75rem;
}
.driver-ack-section .signature-canvas {
    height: 140px;
}

/* ============================================================
       TOPBAR
       ============================================================ */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-700) 45%, var(--primary-600) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(2, 44, 34, 0.18);
    backdrop-filter: blur(4px);
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.topbar-brand .brand-icon {
    font-size: 1.5rem;
    font-weight: 900;
    background: rgba(255, 255, 255, 0.12);
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
}
.topbar-brand h1 {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-role {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.badge-custodian {
    background: rgba(245, 158, 11, 0.25);
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.20);
}

/* ============================================================
       SIDEBAR
       ============================================================ */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem;
    z-index: 90;
    overflow-y: auto;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.7rem 1rem;
    margin: 0.15rem 0;
    border-radius: var(--radius-xs);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}
.sidebar-item:hover {
    background: var(--surface-warm);
    color: var(--primary-700);
}
.sidebar-item.active {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: var(--primary-700);
    border-left-color: var(--primary-500);
}
.sidebar-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}
.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 0.75rem 1rem;
}
.sidebar-footer {
    margin-top: auto;
    padding: 1rem;
    text-align: center;
    font-size: 0.65rem;
    color: var(--muted);
    border-top: 1px solid var(--border-light);
}

/* ============================================================
       BOTTOM NAV (mobile)
       ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    display: none;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.bottom-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    height: 100%;
    color: var(--muted);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    border-top: 3px solid transparent;
    transition: var(--transition);
    cursor: pointer;
    padding: 0 0.25rem;
}
.bottom-item.active {
    color: var(--primary-700);
    border-top-color: var(--primary-500);
}
.bottom-icon {
    font-size: 1.3rem;
    line-height: 1;
}

/* ============================================================
       MAIN CONTENT
       ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    padding: 1.75rem 2rem 2rem;
    animation: fadeIn 0.3s ease-out;
}

/* ============================================================
       CARDS (Dashboard)
       ============================================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.status-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}
.status-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    opacity: 0;
    transition: opacity 0.3s;
}
.status-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border);
}
.status-card.active-card::before {
    background: linear-gradient(90deg, var(--primary-400), var(--primary-300));
    opacity: 1;
}
.status-card.pending-card::before {
    background: linear-gradient(90deg, var(--accent), var(--primary-500));
    opacity: 1;
}
.status-card.process-card::before {
    background: linear-gradient(90deg, var(--primary-300), var(--accent));
    opacity: 1;
}
.status-card.completed-card::before {
    background: linear-gradient(90deg, #059669, #f59e0b);
    opacity: 1;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.6rem;
}
.card-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.card-icon {
    font-size: 1.4rem;
}
.card-count {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-700);
    line-height: 1;
    letter-spacing: -0.02em;
}
.card-footer {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.4rem;
    font-weight: 500;
}

/* ============================================================
       SECTION HEADER
       ============================================================ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.section-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-800);
    letter-spacing: -0.01em;
}

/* ============================================================
       ENTRY LIST
       ============================================================ */
.entry-list {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-light);
}
.entry-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    gap: 1rem;
}
.entry-item:last-child {
    border-bottom: none;
}
.entry-item:hover {
    background: var(--surface-warm);
}
.entry-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    flex: 1;
}
.entry-id {
    font-weight: 800;
    color: var(--primary-700);
    font-size: 0.9rem;
}
.entry-desc {
    font-size: 0.8rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.entry-tags {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
}
.entry-tag {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: #ecfdf5;
    color: var(--primary-700);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.entry-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.entry-status {
    padding: 0.3rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.status-submitted {
    background: #ecfdf5;
    color: var(--primary-700);
}
.status-approved {
    background: #d1fae5;
    color: #065f46;
}
.status-completed {
    background: #e8f0e6;
    color: #2d6a2d;
}
.status-rejected {
    background: #fef2f2;
    color: #991b1b;
}

/* ============================================================
       FORM CONTAINER
       ============================================================ */
.form-container {
    max-width: 960px;
    margin: 0 auto;
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    animation: fadeUp 0.4s ease-out;
}
.form-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-800);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary-400);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.form-full {
    grid-column: 1 / -1;
}

/* ============================================================
       SIGNATURE
       ============================================================ */
.signature-box {
    border: 2px dashed var(--border);
    border-radius: var(--radius-xs);
    padding: 1rem;
    text-align: center;
    background: var(--bg);
    transition: var(--transition);
}
.signature-box:hover {
    border-color: var(--primary-400);
    background: var(--surface-warm);
}
.signature-canvas {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: crosshair;
    width: 100%;
    height: 180px;
    touch-action: none;
}
.signature-label {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.6rem;
    font-weight: 500;
}
.signature-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.6rem;
}

/* ============================================================
       MODAL
       ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 28, 22, 0.50);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(6px);
}
.modal-overlay.active {
    display: flex;
}
.modal-box {
    background: var(--surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: modalPop 0.3s ease;
    border: 1px solid var(--border-light);
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-warm);
}
.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary-800);
}
.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    background: var(--surface-warm);
}

/* ============================================================
       TRACKER (Detail)
       ============================================================ */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}
.detail-main {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    border: 1px solid var(--border-light);
    animation: fadeUp 0.4s ease-out;
}
.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.tracker-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border-light);
}
.tracker-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary-800);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.tracker-step {
    display: flex;
    gap: 0.75rem;
    position: relative;
    padding-bottom: 1.25rem;
}
.tracker-step:last-child {
    padding-bottom: 0;
}
.tracker-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 12px;
    top: 30px;
    width: 2px;
    height: calc(100% - 10px);
    background: var(--border-light);
}
.tracker-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    flex-shrink: 0;
    z-index: 1;
    color: #fff;
    font-weight: 700;
    transition: var(--transition);
}
.tracker-dot.done {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}
.tracker-dot.active {
    background: var(--accent);
    animation: pulseRing 2s infinite;
}
.tracker-info h4 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
}
.tracker-info p {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 500;
}
.tracker-time {
    font-size: 0.65rem;
    color: #7a9e8e;
    margin-top: 0.2rem;
    font-weight: 500;
}
.tracker-progress {
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.tracker-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-400), var(--accent));
    border-radius: 2px;
    transition: width 0.6s ease;
}

/* ============================================================
       PRINT
       ============================================================ */
.print-area {
    display: none;
}
@media print {
    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        height: 100%;
    }
    body * {
        visibility: hidden;
    }
    .print-area,
    .print-area * {
        visibility: visible;
    }
    .print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        display: block !important;
        margin: 0;
        padding: 0;
    }
    .no-print {
        display: none !important;
    }
}
.print-form {
    border: none;
    padding: 0.75rem 1rem;
    max-width: 100%;
    margin: 0 auto;
    background: #fff;
    font-family: "Century Gothic", Arial, sans-serif;
    box-sizing: border-box;
}
.print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1.5px solid #000;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}
.print-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.print-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}
.print-title {
    font-size: 16pt;
    font-weight: 800;
    text-transform: uppercase;
}
.print-meta {
    font-size: 9pt;
    font-weight: 700;
}
.print-entry-number {
    font-size: 9pt;
    font-weight: 700;
    margin-top: 0.25rem;
}
.print-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.print-field {
    flex: 1;
    border-bottom: 1px solid #333;
    padding-bottom: 0.15rem;
}
.print-field label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.15rem;
}
.print-field-value {
    font-size: 0.85rem;
    min-height: 1.1rem;
}
.print-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1.5px solid #000;
    padding-top: 0.75rem;
}
.print-sig-box {
    text-align: center;
}
.print-sig-line {
    border-bottom: 1px solid #000;
    height: 64px;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.print-sig-line img {
    max-height: 38px;
}
.print-sig-label {
    font-size: 0.65rem;
    font-weight: 700;
}

/* ============================================================
       LOADING & TOAST
       ============================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
    backdrop-filter: blur(4px);
}
.loading-overlay.active {
    display: flex;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.loading-text {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
}

.toast {
    position: fixed;
    top: 80px;
    right: 24px;
    padding: 0.9rem 1.5rem;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    z-index: 400;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.toast.show {
    transform: translateX(0);
}
.toast-success {
    background: linear-gradient(135deg, #065f46, #059669);
}
.toast-error {
    background: linear-gradient(135deg, #991b1b, #dc2626);
}
.toast-info {
    background: linear-gradient(135deg, var(--primary-600), var(--accent));
}
.toast-warning {
    background: linear-gradient(135deg, var(--accent), #d97706);
}

/* ============================================================
       CONFIRM DIALOG
       ============================================================ */
.confirm-dialog {
    position: fixed;
    inset: 0;
    background: rgba(2, 28, 22, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 250;
    padding: 1rem;
    backdrop-filter: blur(4px);
}
.confirm-dialog.active {
    display: flex;
}
.confirm-box {
    background: var(--surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
    box-shadow: var(--shadow-xl);
    animation: modalPop 0.25s ease;
    border: 1px solid var(--border-light);
}
.confirm-box h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-800);
    margin-bottom: 0.6rem;
}
.confirm-box p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ============================================================
       EMPTY STATE
       ============================================================ */
.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--muted);
    font-weight: 500;
}
.empty-state-icon {
    font-size: 2.8rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}
.empty-state-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
}

/* ============================================================
       RESPONSIVE
       ============================================================ */
@media (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
        margin-bottom: 72px;
    }
    .bottom-nav {
        display: flex;
    }
    .topbar-brand h1 {
        display: none;
    }
    .cards-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.875rem;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .detail-layout {
        grid-template-columns: 1fr;
    }
    .entry-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }
    .entry-right {
        width: 100%;
        justify-content: space-between;
    }
    .login-card {
        max-width: 100%;
        border-radius: var(--radius-sm);
    }
    .login-body {
        padding: 1.5rem;
    }
    .login-header {
        padding: 1.75rem 1.5rem 1.25rem;
    }
    .form-container {
        padding: 1.25rem;
    }
    .detail-main {
        padding: 1.25rem;
    }
    .modal-box {
        max-width: 100%;
        margin: 0.5rem;
        border-radius: var(--radius-sm);
    }
}

@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
    .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.9rem;
    }
    .topbar {
        padding: 0 1rem;
    }
    .topbar-brand .brand-icon {
        font-size: 1.2rem;
        padding: 0.1rem 0.4rem;
    }
    .badge-role {
        font-size: 0.55rem;
        padding: 0.15rem 0.5rem;
    }
    .section-title {
        font-size: 1.1rem;
    }
    .card-count {
        font-size: 1.8rem;
    }
}

/* ============================================================
       MISC FIXES
       ============================================================ */
.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scrollable-modal-body {
    max-height: 60vh;
    overflow-y: auto;
}
.gap-0\.5 {
    gap: 0.25rem;
}
.gap-1 {
    gap: 0.5rem;
}
.gap-2 {
    gap: 1rem;
}
.flex-wrap {
    flex-wrap: wrap;
}
.items-start {
    align-items: flex-start;
}
.flex-1 {
    flex: 1;
}
.min-w-0 {
    min-width: 0;
}
.relative {
    position: relative;
}

        /* ============================================================
               ANALYSIS CHART — CANVAS + RESPONSIVE
               ============================================================ */
        .chart-wrapper {
            position: relative;
            width: 100%;
            height: 300px;
            background: #ffffff;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border-light);
            overflow: hidden;
        }

        .chart-wrapper canvas {
            width: 100% !important;
            height: 100% !important;
            display: block;
        }

        .chart-legend {
            display: flex;
            justify-content: center;
            gap: 1.5rem;
            margin-top: 0.75rem;
            flex-wrap: wrap;
            font-size: 0.75rem;
            font-weight: 600;
            color: var(--text-secondary);
        }

        .chart-legend-item {
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }

        .chart-legend-dot {
            display: inline-block;
            width: 12px;
            height: 12px;
            border-radius: 3px;
        }

        .chart-legend-dot.bar-dot {
            background: linear-gradient(180deg, var(--primary-400), var(--primary-600));
        }

        .chart-legend-dot.line-dot {
            background: #c0392b;
            width: 18px;
            height: 3px;
            border-radius: 2px;
        }

        /* 5-card grid — responsive */
        .cards-grid.analysis-cards {
            grid-template-columns: repeat(5, 1fr);
        }

        @media (max-width: 1024px) {
            .cards-grid.analysis-cards {
                grid-template-columns: repeat(3, 1fr);
            }
        }

        @media (max-width: 768px) {
            .cards-grid.analysis-cards {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 480px) {
            .cards-grid.analysis-cards {
                grid-template-columns: 1fr;
            }
        }

        /* Small tweak for vehicle history liter badge */
        .entry-tag.liter-tag {
            background: #e3f0e8;
            color: #1a6a3a;
        }

        
        /* ===== PRINT STYLES (fix for Analysis vs Request) ===== */
        @media print {
            body * {
                visibility: hidden;
            }
            .print-area,
            .print-area * {
                visibility: visible !important;
            }
            .print-area {
                position: fixed !important;
                left: 0 !important;
                top: 0 !important;
                width: 100% !important;
                height: 100% !important;
                overflow: visible !important;
                background: #fff !important;
                padding: 1.5rem !important;
                z-index: 9999 !important;
                display: block !important;
                margin: 0 !important;
                border: none !important;
                box-shadow: none !important;
                border-radius: 0 !important;
            }
            .print-area .print-header {
                display: flex !important;
                justify-content: space-between !important;
                align-items: center !important;
                border-bottom: 2px solid #0a2540 !important;
                padding-bottom: 0.75rem !important;
                margin-bottom: 1.25rem !important;
            }
            .print-area .print-header-left .print-title {
                font-size: 1.5rem !important;
                font-weight: 800 !important;
                color: #0a2540 !important;
            }
            .print-area .print-header-left .print-meta {
                font-size: 0.7rem !important;
                color: #5a7a6e !important;
            }
            .print-area .print-header-right {
                text-align: right !important;
            }
            .print-area .print-header-right .print-entry-number {
                font-size: 0.85rem !important;
                font-weight: 700 !important;
                color: #0a2540 !important;
                background: #e3f0ea !important;
                padding: 0.2rem 0.6rem !important;
                border-radius: 4px !important;
                margin-top: 0.2rem !important;
            }
            .print-area .print-row {
                display: flex !important;
                gap: 1rem !important;
                margin-bottom: 0.75rem !important;
                flex-wrap: wrap !important;
            }
            .print-area .print-field {
                flex: 1 !important;
                min-width: 140px !important;
            }
            .print-area .print-field label {
                font-size: 0.6rem !important;
                font-weight: 700 !important;
                text-transform: uppercase !important;
                letter-spacing: 0.03em !important;
                color: #5a7a6e !important;
                display: block !important;
                margin-bottom: 0.15rem !important;
            }
            .print-area .print-field .print-field-value {
                font-size: 0.9rem !important;
                font-weight: 600 !important;
                color: #0a2540 !important;
                border-bottom: 1px solid #dce8e2 !important;
                padding: 0.1rem 0 !important;
            }
            .print-area .print-signatures {
                display: flex !important;
                gap: 1.5rem !important;
                margin-top: 1.25rem !important;
                flex-wrap: wrap !important;
                border-top: 1px solid #dce8e2 !important;
                padding-top: 1.25rem !important;
            }
            .print-area .print-sig-box {
                flex: 1 !important;
                min-width: 120px !important;
                text-align: center !important;
            }
            .print-area .print-sig-line {
                height: 60px !important;
                border-bottom: 1px solid #0a2540 !important;
                display: flex !important;
                align-items: flex-end !important;
                justify-content: center !important;
                margin-bottom: 0.25rem !important;
            }
            .print-area .print-sig-line img {
                max-height: 50px !important;
                max-width: 100% !important;
            }
            .print-area .print-sig-label {
                font-size: 0.6rem !important;
                font-weight: 700 !important;
                color: #5a7a6e !important;
                text-transform: uppercase !important;
                letter-spacing: 0.03em !important;
            }

            /* Analysis print specific */
            .print-area .analysis-print-title {
                font-size: 1.6rem !important;
                font-weight: 800 !important;
                color: #0a2540 !important;
                text-align: center !important;
                margin-bottom: 0.25rem !important;
            }
            .print-area .analysis-print-sub {
                text-align: center !important;
                font-size: 0.75rem !important;
                color: #5a7a6e !important;
                margin-bottom: 1.25rem !important;
            }
            .print-area .analysis-cards-grid {
                display: grid !important;
                grid-template-columns: repeat(3, 1fr) !important;
                gap: 0.75rem !important;
                margin-bottom: 1.25rem !important;
            }
            .print-area .analysis-stat-card {
                background: #f6faf8 !important;
                border: 1px solid #dce8e2 !important;
                border-radius: 6px !important;
                padding: 0.6rem 0.8rem !important;
                text-align: center !important;
            }
            .print-area .analysis-stat-card .stat-label {
                font-size: 0.55rem !important;
                font-weight: 700 !important;
                text-transform: uppercase !important;
                letter-spacing: 0.03em !important;
                color: #5a7a6e !important;
            }
            .print-area .analysis-stat-card .stat-value {
                font-size: 1.25rem !important;
                font-weight: 800 !important;
                color: #0a2540 !important;
            }
            .print-area .analysis-table-wrap {
                margin-top: 1rem !important;
                border-top: 1px solid #dce8e2 !important;
                padding-top: 1rem !important;
            }
            .print-area .analysis-table-wrap h4 {
                font-size: 0.8rem !important;
                font-weight: 700 !important;
                color: #0a2540 !important;
                margin-bottom: 0.5rem !important;
            }
            .print-area .analysis-table {
                width: 100% !important;
                border-collapse: collapse !important;
                font-size: 0.7rem !important;
            }
            .print-area .analysis-table th {
                background: #e3f0ea !important;
                color: #0a2540 !important;
                font-weight: 700 !important;
                padding: 0.3rem 0.5rem !important;
                text-align: left !important;
                border: 1px solid #c8dcc8 !important;
            }
            .print-area .analysis-table td {
                padding: 0.25rem 0.5rem !important;
                border: 1px solid #dce8e2 !important;
            }
            .print-area .analysis-table .abnormal {
                background: #fef2f2 !important;
                color: #dc2626 !important;
                font-weight: 700 !important;
            }
            .print-area .chart-img-wrap {
                text-align: center !important;
                margin: 0.75rem 0 !important;
            }
            .print-area .chart-img-wrap img {
                max-width: 100% !important;
                border: 1px solid #dce8e2 !important;
                border-radius: 6px !important;
            }

            .no-print {
                display: none !important;
            }
            .sidebar,
            .bottom-nav,
            .topbar,
            #toast,
            #loadingOverlay,
            .modal-overlay,
            .confirm-dialog,
            .pwa-install-banner,
            .pwa-install-fab,
            .ios-install-hint {
                display: none !important;
            }
            .main-content {
                padding: 0 !important;
                margin: 0 !important;
                max-width: 100% !important;
            }
            #viewDashboard,
            #viewNew,
            #viewDetail,
            #viewArchive,
            #viewAnalysis {
                display: none !important;
            }
        }
