/* Flash messages */
[role="alert"] {
    padding: 0.75rem 1rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1rem;
}
.flash-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.flash-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Vehicle selection cards */
.vehicle-card {
    text-decoration: none;
    color: inherit;
}
.vehicle-card article {
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s;
}
.vehicle-card article:hover {
    transform: scale(1.02);
}

/* Area sections */
.area-section header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.area-section header h3 {
    margin-bottom: 0;
}

/* Checkout sections within an area (for kit sections) */
.checkout-section {
    margin-bottom: 1.5rem;
}
.checkout-section:last-child {
    margin-bottom: 0;
}
.section-heading {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

/* Detail sections */
.detail-section {
    margin-bottom: 1.5rem;
}
.detail-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Kit indicator */
.kit-indicator {
    font-size: 0.7em;
    color: var(--pico-muted-color);
    font-weight: normal;
    margin-left: 0.5rem;
}

/* Kit section preview in admin */
.kit-section-preview {
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 3px solid var(--pico-muted-border-color);
}
.kit-section-preview h4 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

/* Sealed area styling */
.sealed {
    opacity: 0.4;
    pointer-events: none;
}
.seal-controls {
    border: none;
    padding: 0;
    margin: 0 0 0.5rem 0;
}

/* Admin area header */
.area-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}
.area-header h3 {
    margin-bottom: 0;
    flex-grow: 1;
}
.area-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Button groups */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}
.button-group button,
.button-group a[role="button"] {
    margin-bottom: 0;
}

/* Inline form (kit apply) */
.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
}
.inline-form select {
    margin-bottom: 0;
    min-width: 200px;
}
.inline-form button {
    margin-bottom: 0;
    white-space: nowrap;
}

/* Small buttons */
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}

/* Inactive items */
.inactive-item {
    opacity: 0.5;
}

/* Kit badge */
.kit-badge {
    background: #e2e3f1;
    color: #383d6e;
}

/* ALS badge and divider */
.als-badge {
    background: #f8d7da;
    color: #721c24;
}
.als-divider {
    margin-top: 2rem;
    padding: 0.5rem 1rem;
    background: #f8d7da;
    color: #721c24;
    border-radius: var(--pico-border-radius);
    text-align: center;
}

/* Agency header with logo */
.agency-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.agency-logo {
    max-height: 60px;
    max-width: 150px;
    object-fit: contain;
}

/* Checksheet detail status badges */
.status-ok {
    color: #155724;
    font-weight: bold;
}
.status-missing {
    color: #721c24;
    font-weight: bold;
}
.item-missing {
    background: #fff3cd;
}
.sealed-badge {
    background: #cce5ff;
    color: #004085;
    padding: 0.75rem 1rem;
    border-radius: var(--pico-border-radius);
    text-align: center;
}

/* Checkout user info */
.checkout-user {
    margin-bottom: 1.5rem;
    color: var(--pico-muted-color);
}

/* Checkout meta (date field) */
.checkout-meta {
    max-width: 300px;
    margin-bottom: 1.5rem;
}

/* Detail meta */
.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--pico-card-background-color);
    border-radius: var(--pico-border-radius);
}

/* Submit button sticky on mobile */
.submit-btn {
    position: sticky;
    bottom: 1rem;
    width: 100%;
    z-index: 10;
}

/* Checkout form input sizing */
.qty-input {
    width: 70px;
    margin-bottom: 0;
}
.note-input {
    margin-bottom: 0;
}

/* Brand logo in nav */
nav strong {
    letter-spacing: -0.5px;
}
nav strong + small {
    color: var(--pico-muted-color);
    font-weight: normal;
}

/* Homepage hero */
.hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
    padding: 4rem 0;
    text-align: center;
    margin-bottom: 2rem;
}
.hero h1 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}
.hero-sub {
    color: rgba(255,255,255,0.8);
    font-size: 1.15rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}
.hero-actions a[role="button"] {
    background: #e94560;
    border-color: #e94560;
    color: #fff;
    font-size: 1.1rem;
    padding: 0.75rem 2.5rem;
}
.hero-actions a[role="button"]:hover {
    background: #c73a52;
    border-color: #c73a52;
}

/* Features grid */
.features {
    padding-bottom: 3rem;
}
.features article {
    text-align: center;
}
.features h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.features p {
    font-size: 0.95rem;
    color: var(--pico-muted-color);
}

/* Audit log */
.audit-table {
    font-size: 0.85rem;
}
.audit-time {
    white-space: nowrap;
    color: #666;
    font-size: 0.8rem;
}
.audit-ip {
    font-family: monospace;
    font-size: 0.75rem;
    color: #888;
}
.audit-detail {
    max-width: 400px;
    word-break: break-word;
}
.audit-action {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.audit-action-login { background: #d4edda; color: #155724; }
.audit-action-logout { background: #e2e3e5; color: #383d41; }
.audit-action-checksheet { background: #cce5ff; color: #004085; }
.audit-action-user { background: #fff3cd; color: #856404; }
.audit-action-vehicle { background: #d1ecf1; color: #0c5460; }
.audit-action-agency { background: #e2e3f1; color: #383d6e; }
.audit-action-kit { background: #f5e6ff; color: #5a2d82; }
.audit-login_failed { background: #fff5f5; }

/* Import panels (toggled by button) */
.import-panel {
    margin: 0.75rem 0 1rem;
    padding: 0.75rem 1rem;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
}
.import-panel small {
    display: block;
    margin-top: 0.5rem;
    color: var(--pico-muted-color);
}

/* Detail actions */
.detail-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    opacity: 0.6;
}

/* ===========================
   Mobile-first defaults
   =========================== */

@media (max-width: 768px) {
    table {
        font-size: 0.9rem;
    }
    .col-expected {
        display: none;
    }
    .note-input {
        min-width: 80px;
    }
    .detail-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ===========================
   Desktop enhancements (> 992px)
   =========================== */

@media (min-width: 992px) {
    /* Smaller base text on desktop */
    :root {
        --pico-font-size: 14px;
    }
    body {
        font-size: 14px;
    }
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.15rem; }
    h4 { font-size: 1rem; }

    table {
        font-size: 0.875rem;
    }

    /* Wider container for desktop */
    main.container {
        max-width: 1200px;
    }

    /* Admin dashboard: side-by-side sections */
    .dashboard-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    .dashboard-grid .dashboard-section:first-child {
        grid-column: 1 / -1;
    }

    /* Checkout form table columns */
    .checkout-table {
        width: 100%;
    }
    .checkout-table .col-present { width: 60px; text-align: center; }
    .checkout-table .col-item { width: auto; }
    .checkout-table .col-qty { width: 80px; }
    .checkout-table .col-expected { width: 80px; text-align: center; }
    .checkout-table .col-note { width: 220px; }

    /* Submit button: not full width on desktop */
    .submit-btn {
        position: static;
        width: auto;
        min-width: 250px;
    }

    /* Vehicle cards */
    .vehicle-card article {
        min-height: 100px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .vehicle-card article h3 {
        font-size: 1.1rem;
    }

    .filter-form {
        max-width: 900px;
    }

    .checkout-meta {
        max-width: none;
        display: flex;
        gap: 2rem;
        align-items: end;
    }

    .detail-meta {
        justify-content: space-between;
        font-size: 0.9rem;
    }

    /* Compact form inputs on desktop */
    input, select, textarea {
        padding: 0.4rem 0.6rem;
    }
    .qty-input {
        width: 65px;
        padding: 0.3rem 0.4rem;
    }

    /* Nav text sizing */
    nav {
        font-size: 0.9rem;
    }
    nav li small {
        font-size: 0.8rem;
    }
}

/* ===========================
   Wide desktop (> 1400px)
   =========================== */

@media (min-width: 1400px) {
    main.container {
        max-width: 1400px;
    }

    .dashboard-grid {
        grid-template-columns: 2fr 1fr 1fr;
    }
    .dashboard-grid .dashboard-section:first-child {
        grid-column: 1;
    }
}
