/**
 * LogBook Pro - Design System & Modern Responsive Stylesheet
 * Self-contained, offline-first, dark mode aesthetic
 */

:root {
    --bg-base: #0a0f1d;
    --bg-surface: #111a2e;
    --bg-surface-elevated: #16223d;
    --bg-glass: rgba(19, 28, 49, 0.75);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(0, 240, 144, 0.35);

    --accent-emerald: #00f090;
    --accent-emerald-glow: rgba(0, 240, 144, 0.25);
    --accent-cyan: #00d2ff;
    --accent-purple: #a855f7;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-sub: #64748b;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 9999px;

    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
    --shadow-glow: 0 0 25px var(--accent-emerald-glow);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    --font-mono: "SF Mono", "Roboto Mono", Menlo, Consolas, Monaco, monospace;
}

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

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 80px; /* Space for mobile bottom bar */
}

@media (min-width: 768px) {
    .app-layout {
        padding-bottom: 2rem;
    }
}

/* Top Navigation Bar */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 15, 29, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-glass);
    padding: 0.75rem 1.25rem;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(0, 240, 144, 0.2), rgba(0, 210, 255, 0.2));
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-emerald);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.accent-badge {
    background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 0.8rem;
    font-weight: 800;
    border: 1px solid var(--border-highlight);
    padding: 0 4px;
    border-radius: 4px;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.nav-links {
    display: none;
    align-items: center;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .nav-links {
        display: flex;
    }
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    transition: color 0.2s ease;
}

.nav-item svg {
    width: 18px;
    height: 18px;
}

.nav-item:hover, .nav-item.active {
    color: var(--accent-emerald);
}

.btn-primary-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #00f090, #00b4d8);
    color: #06141d;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 4px 15px rgba(0, 240, 144, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary-nav:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 240, 144, 0.45);
}

.btn-primary-nav svg {
    width: 16px;
    height: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
}

.pulse-dot {
    box-shadow: 0 0 0 0 rgba(0, 240, 144, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 240, 144, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(0, 240, 144, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 240, 144, 0); }
}

/* Main Container */
.main-content {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

@media (min-width: 768px) {
    .main-content {
        padding: 2rem 1.5rem;
    }
}

/* Page Intro Header */
.page-intro-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .page-intro-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

.text-muted { color: var(--text-muted); }
.text-xs { font-size: 0.75rem; }
.text-emerald { color: var(--accent-emerald); }
.text-purple { color: var(--accent-purple); }
.text-amber { color: var(--accent-amber); }

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #00f090, #00c6ff);
    color: #051923;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 240, 144, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 240, 144, 0.4);
}

.btn-primary.btn-large {
    padding: 0.85rem 1.75rem;
    font-size: 1.05rem;
    width: 100%;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-secondary:hover {
    background: #1c2b4d;
}

.btn-outline, .btn-outline-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover, .btn-outline-sm:hover {
    border-color: var(--accent-emerald);
    color: var(--accent-emerald);
}

.btn-accent {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #f43f5e, #fb7185);
    color: #fff;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.35);
}

.pulse-attention {
    animation: bounceSlow 2s infinite;
}

@keyframes bounceSlow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Active Trip Banner */
.active-trip-card {
    position: relative;
    background: linear-gradient(135deg, rgba(20, 32, 58, 0.9), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(0, 240, 144, 0.4);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px -10px rgba(0, 240, 144, 0.2);
    overflow: hidden;
}

.active-trip-glow {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(0, 240, 144, 0.2) 0%, rgba(0, 0, 0, 0) 70%);
    pointer-events: none;
}

.active-trip-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 240, 144, 0.15);
    border: 1px solid var(--accent-emerald);
    color: var(--accent-emerald);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.live-dot {
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.trip-timer-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
}

.trip-timer-display svg {
    width: 20px;
    height: 20px;
    color: var(--accent-emerald);
}

.active-trip-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .active-trip-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .active-trip-details-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.trip-detail-cell {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.detail-val {
    font-size: 1.05rem;
    font-weight: 600;
}

.sub-label {
    font-size: 0.8rem;
    color: var(--text-sub);
    margin-top: 0.25rem;
}

.active-trip-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-text-danger {
    background: none;
    border: none;
    color: var(--accent-rose);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem;
    text-decoration: underline;
}

.btn-delete-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.32rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-delete-sm:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
    color: #fee2e2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-delete-sm svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-wrapper svg { width: 24px; height: 24px; }
.icon-blue { background: rgba(0, 210, 255, 0.12); color: var(--accent-cyan); }
.icon-emerald { background: rgba(0, 240, 144, 0.12); color: var(--accent-emerald); }
.icon-purple { background: rgba(168, 85, 247, 0.12); color: var(--accent-purple); }
.icon-amber { background: rgba(245, 158, 11, 0.12); color: var(--accent-amber); }

.stat-meta { display: flex; flex-direction: column; }
.stat-title { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-unit { font-size: 0.95rem; font-weight: 600; color: var(--text-muted); }
.stat-sub { font-size: 0.75rem; color: var(--text-sub); }

/* Section Card & Table */
.section-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.data-table th {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges & Tags */
.badge-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-business { background: rgba(0, 240, 144, 0.12); color: var(--accent-emerald); border: 1px solid rgba(0, 240, 144, 0.3); }
.badge-personal { background: rgba(168, 85, 247, 0.12); color: var(--accent-purple); border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-commute { background: rgba(0, 210, 255, 0.12); color: var(--accent-cyan); border: 1px solid rgba(0, 210, 255, 0.3); }
.badge-emerald { background: rgba(0, 240, 144, 0.2); color: var(--accent-emerald); }
.badge-active { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }

.badge-status {
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
}

.badge-success { background: #064e3b; color: #6ee7b7; }
.badge-warning { background: #78350f; color: #fde68a; cursor: pointer; }
.badge-muted { background: #1e293b; color: #94a3b8; }
.badge-photo {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.75rem;
}

.reg-pill {
    display: inline-block;
    background: #0f172a;
    border: 1px solid #334155;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #e2e8f0;
}

/* Forms */
.form-page-container {
    max-width: 900px;
    margin: 0 auto;
}

.form-header-bar {
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    transition: color 0.15s ease;
}

.back-link:hover { color: var(--accent-emerald); }
.back-link svg { width: 16px; height: 16px; }

.glass-form-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-card);
}

.form-sections-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .form-sections-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

.form-label.required::after {
    content: " *";
    color: var(--accent-rose);
}

.form-control {
    width: 100%;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px rgba(0, 240, 144, 0.15);
}

/* Radio Pills */
.trip-type-radios {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.radio-pill {
    cursor: pointer;
}

.radio-pill input { display: none; }
.radio-pill .pill-content {
    display: block;
    text-align: center;
    padding: 0.6rem 0.5rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.radio-pill input:checked + .pill-content {
    background: rgba(0, 240, 144, 0.15);
    border-color: var(--accent-emerald);
    color: var(--accent-emerald);
}

/* Odometer Scanner Widget inside Form */
.odometer-scanner-box {
    background: linear-gradient(145deg, rgba(22, 34, 61, 0.6), rgba(15, 23, 42, 0.8));
    border: 1px solid rgba(0, 240, 144, 0.3);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.odometer-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.odometer-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #090e1c;
    border: 1px solid #233554;
    border-radius: var(--radius-md);
    padding: 0.4rem 0.6rem;
}

.odometer-number {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-emerald);
    background: transparent;
    border: none;
    outline: none;
    flex: 1;
}

.odometer-unit-badge {
    color: var(--text-sub);
    font-weight: 700;
    font-size: 0.9rem;
    padding-right: 0.5rem;
}

.btn-scan-trigger {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #00f090, #00d2ff);
    color: #031525;
    border: none;
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 240, 144, 0.3);
    transition: transform 0.15s ease;
}

.btn-scan-trigger:hover {
    transform: scale(1.02);
}

.btn-scan-trigger svg { width: 18px; height: 18px; }

.scanner-thumbnail-row {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.odo-thumb-img {
    width: 64px;
    height: 38px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--accent-emerald);
}

/* Distance Calculator Card */
.distance-calculator-card {
    background: linear-gradient(135deg, rgba(22, 34, 61, 0.7), rgba(12, 19, 36, 0.9));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.calc-subtitle { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; }
.calc-formula { font-size: 0.75rem; color: var(--text-sub); margin-top: 0.2rem; }

.calc-result-box {
    margin: 1.5rem 0;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
}

.calc-value {
    font-family: var(--font-mono);
    font-size: 3.2rem;
    font-weight: 800;
    color: var(--accent-emerald);
    line-height: 1;
}

.calc-unit { font-size: 1.25rem; font-weight: 700; color: var(--text-muted); }
.calc-feedback-msg { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.odometer-delta-timeline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    border-radius: var(--radius-md);
}

.delta-node { display: flex; flex-direction: column; align-items: center; }
.node-title { font-size: 0.7rem; color: var(--text-sub); text-transform: uppercase; }
.node-val { font-family: var(--font-mono); font-weight: 700; color: var(--text-main); }
.delta-connector { display: flex; align-items: center; color: var(--accent-emerald); }

.form-footer-actions {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

/* Trip Summary Box */
.trip-summary-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .trip-summary-box {
        grid-template-columns: repeat(4, 1fr);
    }
}

.summary-item { display: flex; flex-direction: column; }
.summary-item .label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }

/* Filter Card */
.filter-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.filter-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: flex-end;
}

@media (min-width: 640px) {
    .filter-form-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .filter-form-grid {
        grid-template-columns: repeat(5, 1fr) auto;
    }
}

.filter-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.filter-actions-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary-sm {
    background: var(--accent-emerald);
    color: #031525;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-text-sm {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: underline;
}

.logbook-stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.settings-nav-pills {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: var(--bg-surface-elevated);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

button.stat-pill {
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.stat-pill:hover {
    background: #1c2b4d;
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.stat-pill:active {
    transform: translateY(0);
}

.stat-pill.active-pill,
.stat-pill.active {
    background: rgba(0, 240, 144, 0.16) !important;
    border-color: var(--accent-emerald) !important;
    color: var(--accent-emerald) !important;
    font-weight: 700;
    box-shadow: 0 0 16px rgba(0, 240, 144, 0.35), inset 0 0 8px rgba(0, 240, 144, 0.08) !important;
}

.stat-pill.active-pill:hover,
.stat-pill.active:hover {
    background: rgba(0, 240, 144, 0.24) !important;
    color: #34d399 !important;
    box-shadow: 0 0 20px rgba(0, 240, 144, 0.5) !important;
}

.stat-pill .label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ==========================================================================
   CAMERA SCANNER MODAL & VIEW FINDER HUD
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 16, 0.95);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.scanner-container {
    width: 100%;
    max-width: 540px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.scanner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-glass);
}

.scanner-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.scanner-badge-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(0, 240, 144, 0.15);
    color: var(--accent-emerald);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-badge-icon svg { width: 20px; height: 20px; }

.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
}

.close-modal-btn:hover { color: #fff; }
.close-modal-btn svg { width: 22px; height: 22px; }

/* Viewport & Viewfinder Reticle */
.scanner-viewport {
    position: relative;
    width: 100%;
    height: 360px;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scannerVideo,
.scanner-viewport-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #0b1329;
}

.target-box-guide {
    position: absolute;
    width: 76%;
    height: 80px;
    border: 1px dashed rgba(0, 240, 144, 0.4);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.corner-bracket {
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: var(--accent-emerald);
    border-style: solid;
}

.corner-bracket.top-left { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.corner-bracket.top-right { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.corner-bracket.bottom-left { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.corner-bracket.bottom-right { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }

.target-laser-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-emerald), transparent);
    box-shadow: 0 0 8px var(--accent-emerald);
    animation: laserScan 2s infinite ease-in-out;
}

@keyframes laserScan {
    0%, 100% { top: 10%; opacity: 0.4; }
    50% { top: 90%; opacity: 1; }
}

.target-hint {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--accent-emerald);
    text-shadow: 0 0 4px #000;
    margin-top: 45px;
}

/* Spinner Overlay */
.scanner-processing {
    position: absolute;
    inset: 0;
    background: rgba(9, 14, 28, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
}

.scanner-processing.hidden { display: none; }

.spinner-ring {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(0, 240, 144, 0.2);
    border-top-color: var(--accent-emerald);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Viewfinder Controls */
.scanner-controls {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 1.25rem;
    background: var(--bg-surface-elevated);
}

.scanner-btn-secondary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
}

.scanner-btn-secondary svg { width: 22px; height: 22px; }
.scanner-btn-secondary:hover { color: #fff; }

.scanner-btn-capture {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid #fff;
    padding: 4px;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.scanner-btn-capture:active {
    transform: scale(0.92);
}

.capture-inner-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent-emerald);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--accent-emerald-glow);
}

/* Verification Sheet */
.scanner-verification-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--accent-emerald);
    padding: 1.25rem;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: slideUp 0.25s ease-out;
}

.scanner-verification-sheet.hidden { display: none; }

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.sheet-preview-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.crop-preview-box {
    position: relative;
    width: 130px;
    height: 70px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-glass);
    flex-shrink: 0;
    background: #000;
}

.crop-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-badge {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(0, 0, 0, 0.7);
    font-size: 0.6rem;
    padding: 1px 4px;
    border-radius: 2px;
    color: var(--text-muted);
}

.reading-input-box {
    flex: 1;
}

.reading-input-box label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

.reading-value-display {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.large-digit-input {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-emerald);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--accent-emerald);
    border-radius: var(--radius-sm);
    padding: 0.2rem 0.5rem;
}

.confidence-text {
    display: block;
    font-size: 0.7rem;
    color: var(--text-sub);
    margin-top: 0.3rem;
}

.sheet-actions {
    display: flex;
    gap: 0.75rem;
}

.sheet-actions button {
    flex: 1;
    padding: 0.75rem;
}

/* Mobile Bottom Navigation */
.bottom-mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: rgba(10, 15, 29, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0.5rem 1rem;
}

@media (min-width: 768px) {
    .bottom-mobile-nav { display: none; }
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
}

.mobile-nav-link svg { width: 22px; height: 22px; }
.mobile-nav-link.active { color: var(--accent-emerald); }

.action-fab-link {
    transform: translateY(-16px);
}

.fab-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00f090, #00c6ff);
    color: #031525;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 240, 144, 0.4);
    border: 3px solid var(--bg-base);
}

.fab-circle svg { width: 26px; height: 26px; }

/* Alert Boxes */
.alert-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-danger {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid var(--accent-rose);
    color: #fecdd3;
}

.alert-danger svg { width: 20px; height: 20px; color: var(--accent-rose); flex-shrink: 0; }

/* Print Stylesheet for Tax Reports */
@media print {
    .top-nav, .bottom-mobile-nav, .header-actions, .filter-card, .btn-outline-sm, .badge-photo, .scanner-controls {
        display: none !important;
    }
    body { background: #fff !important; color: #000 !important; }
    .section-card, .data-table, .data-table th, .data-table td {
        background: #fff !important;
        color: #000 !important;
        border-color: #ddd !important;
    }
    .reg-pill { border: 1px solid #000; color: #000; background: none; }
}

/* ==========================================================================
   DRIVER PIN & BIOMETRIC AUTH MODAL & KEYPAD
   ========================================================================== */
.auth-modal-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 240, 144, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding: 1.5rem;
    text-align: center;
}

.auth-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin-bottom: 1.25rem;
}

.auth-modal-header .close-modal-btn {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
}

.auth-avatar-ring {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 240, 144, 0.2), rgba(0, 210, 255, 0.2));
    border: 2px solid var(--accent-emerald);
    color: var(--accent-emerald);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    box-shadow: 0 0 15px var(--accent-emerald-glow);
}

.auth-avatar-ring svg { width: 28px; height: 28px; }

.active-driver-badge-display {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.driver-code-pill {
    background: #090e1c;
    border: 1px solid #334155;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-emerald);
    font-weight: 700;
}

/* PIN Display Dots */
.pin-display-group {
    margin-bottom: 1rem;
}

.pin-dots-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.pin-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #334155;
    background: transparent;
    transition: all 0.15s ease;
}

.pin-dot.filled {
    background: var(--accent-emerald);
    border-color: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-emerald);
    transform: scale(1.1);
}

.auth-error-hint {
    font-size: 0.8rem;
    color: var(--accent-rose);
    margin-bottom: 0.75rem;
    min-height: 1.2rem;
}

.auth-error-hint.hidden { visibility: hidden; }

/* Numeric Keypad */
.numeric-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.keypad-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    height: 54px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.1s ease, transform 0.1s ease, border-color 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.keypad-btn:active {
    background: #1e2c4d;
    transform: scale(0.95);
    border-color: var(--accent-emerald);
}

.keypad-btn.btn-clear {
    color: var(--accent-amber);
    font-size: 1.1rem;
}

.keypad-btn.btn-back {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Biometric Trigger */
.biometric-login-option {
    border-top: 1px solid var(--border-glass);
    padding-top: 1rem;
}

.btn-biometric-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: rgba(0, 210, 255, 0.1);
    border: 1px solid rgba(0, 210, 255, 0.3);
    color: var(--accent-cyan);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-biometric-trigger:hover {
    background: rgba(0, 210, 255, 0.2);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.25);
}

.biometric-icon-pulse svg {
    width: 22px;
    height: 22px;
    animation: biometricPulse 2s infinite ease-in-out;
}

@keyframes biometricPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}

/* Switch Toggles & Security Cards */
.security-setup-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.security-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.security-card-header h4 { font-size: 0.95rem; font-weight: 700; }

.switch-control-label {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.switch-control-label input { display: none; }

.switch-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #233554;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
    transition: background 0.2s ease;
    margin-top: 2px;
}

.switch-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
}

.switch-control-label input:checked + .switch-slider {
    background: var(--accent-emerald);
}

.switch-control-label input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.switch-text-group {
    display: flex;
    flex-direction: column;
}

.switch-text-group strong {
    font-size: 0.9rem;
    font-weight: 600;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* Driver Selection Chips in Auth Modal */
.driver-chips-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.driver-chip-btn {
    background: var(--bg-surface-elevated);
    border: 1.5px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.35rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-main);
}

.driver-chip-btn:hover {
    border-color: var(--accent-emerald);
    transform: translateY(-2px);
}

.driver-chip-btn.active {
    background: rgba(0, 240, 144, 0.12);
    border-color: var(--accent-emerald);
    box-shadow: 0 0 15px rgba(0, 240, 144, 0.35);
}

.chip-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent-emerald);
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.3rem;
    border: 1px solid rgba(0, 240, 144, 0.3);
}

.chip-name {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
}

.chip-code {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.pin-driver-hint {
    font-size: 0.8rem;
    color: var(--accent-emerald);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* Dedicated Login Screen Styles */
.login-screen-container {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
}

.login-card-standalone {
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 35px rgba(0, 210, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 2.25rem 1.75rem;
    text-align: center;
}

.login-card-standalone .auth-modal-header {
    margin-bottom: 1.5rem;
}

.login-card-standalone .auth-avatar-ring {
    width: 68px;
    height: 68px;
    margin: 0 auto 1rem auto;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.2), rgba(0, 240, 144, 0.2));
    border: 2px solid var(--accent-emerald);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-emerald);
    box-shadow: 0 0 20px rgba(0, 240, 144, 0.35);
}

.pulse-glow {
    animation: pulse-ring 2.5s infinite;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(0, 240, 144, 0.5); }
    70% { box-shadow: 0 0 0 14px rgba(0, 240, 144, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 240, 144, 0); }
}

/* Strictly enforce removal of Settings tab from APK client */
#tabNavSettings,
#viewSettings,
a[id="tabNavSettings"],
a[onclick*="settings"] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
