/* Theme toggle */
.theme-toggle {
    all: unset;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0.25rem;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.theme-toggle:hover {
    opacity: 1;
}
[data-theme="light"] .theme-icon-dark,
[data-theme="dark"] .theme-icon-light {
    display: none;
}
[data-theme="light"] .theme-icon-light,
[data-theme="dark"] .theme-icon-dark {
    display: inline;
}

/* Logo dark mode adaptation */
[data-theme="dark"] .nav-logo-icon {
    filter: brightness(2.5);
}

/* Skip link for keyboard/screen reader accessibility */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--pico-primary);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 9999;
    font-size: 0.9rem;
    text-decoration: none;
}
.skip-link:focus {
    top: 0;
}

/* 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 grid */
.vehicle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

/* Vehicle selection cards */
.vehicle-card {
    text-decoration: none;
    color: inherit;
}
.vehicle-card article {
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s;
    margin-bottom: 0;
}
.vehicle-card article:hover {
    transform: scale(1.02);
}
/* Outdate warning */
.outdate-warning {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* Seal expired notice */
.seal-expired-notice {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.seal-expired-notice span {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
}

/* New seal tag field - hidden by default, shown when section is unsealed */
.new-seal-tag {
    display: none;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 4px;
}
.new-seal-tag label {
    font-weight: bold;
    font-size: 0.85rem;
}
.new-seal-tag input {
    margin-top: 0.25rem;
}

/* Mark All Present button */
.mark-all-btn {
    width: auto !important;
    font-size: 0.8rem !important;
}

/* Previously missing item highlight */
.previously-missing {
    background: #fff8e1 !important;
}
.prev-missing-tag {
    display: inline-block;
    font-size: 0.7rem;
    color: #856404;
    background: #fff3cd;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 0.3rem;
    font-weight: bold;
    vertical-align: middle;
}

.vehicle-card .last-checkout,
.vehicle-card .last-checkout em {
    color: #999 !important;
    font-size: 0.75rem;
    margin: 0.25rem 0 0 0;
}

/* 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;
}

/* Compact inline actions for table cells */
.actions-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
}
.actions-cell form {
    display: inline;
    margin: 0;
}
.actions-cell button.link {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: inherit;
    color: var(--pico-primary);
    cursor: pointer;
    width: auto;
    text-decoration: underline;
}
.actions-cell button.link:hover {
    color: var(--pico-primary-hover);
}
.actions-cell button.link.secondary {
    color: var(--pico-secondary);
}
.actions-cell button.link.secondary:hover {
    color: var(--pico-secondary-hover);
}

/* 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;
}
.agency-logo-sm {
    height: 24px;
    width: 24px;
    object-fit: contain;
    border-radius: 4px;
    vertical-align: middle;
}
.agency-name-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 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);
}

/* Item properties */
.item-properties {
    margin-top: 0.25rem;
}
.prop-input {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.15rem;
}
.prop-label {
    font-size: 0.75rem;
    color: #666;
    min-width: 50px;
    margin-bottom: 0;
    font-weight: normal;
}
.prop-field {
    font-size: 0.8rem !important;
    padding: 0.15rem 0.3rem !important;
    max-width: 120px !important;
    height: 1.6rem !important;
    margin-bottom: 0 !important;
}
.prop-warning {
    background-color: #fff3cd !important;
    border-color: #ffc107 !important;
}
.prop-danger {
    background-color: #f8d7da !important;
    border-color: #dc3545 !important;
}
.prop-values {
    margin-top: 0.2rem;
}
.prop-value {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.3rem;
    background: #e9ecef;
}

/* Logo upload button */
.logo-upload-btn {
    width: auto !important;
    padding: 0.25rem 0.75rem !important;
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: #fff !important;
    white-space: nowrap;
}
.logo-upload-btn:hover {
    background: #218838 !important;
    border-color: #218838 !important;
}

/* Outline link styled as small button */
.outline-link {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid var(--pico-primary);
    border-radius: var(--pico-border-radius);
    color: var(--pico-primary);
    background: transparent;
    text-decoration: none;
    line-height: 1.4;
}
.outline-link:hover {
    background: var(--pico-primary);
    color: #fff;
}

/* Dashboard compact tables */
.dashboard-section table {
    font-size: 0.85rem;
}
.dashboard-section table th,
.dashboard-section table td {
    padding: 0.35rem 0.5rem !important;
    white-space: nowrap;
}
.dashboard-section table th:last-child,
.dashboard-section table td:last-child {
    width: 1%;
    white-space: nowrap;
}

/* Dashboard section header with button */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.section-header-row hgroup {
    margin-bottom: 0;
}
.section-header-row a[role="button"] {
    flex-shrink: 0;
    margin-top: 0.25rem;
}

/* Breadcrumbs */
.breadcrumbs {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    padding: 0;
}
.breadcrumbs a {
    color: var(--pico-primary);
    text-decoration: none;
}
.breadcrumbs a:hover {
    text-decoration: underline;
}
.breadcrumb-sep {
    color: #999;
    margin: 0 0.3rem;
}
.breadcrumb-current {
    color: var(--pico-muted-color);
}

/* Sort controls */
.sort-controls {
    display: inline-flex;
    gap: 0.15rem;
    vertical-align: middle;
}
.sort-group {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}
.sort-btn {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid #999;
    border-radius: 3px;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: center;
    line-height: 1;
    color: #555;
    background: transparent;
}
.sort-btn:hover {
    background: #e9e9e9;
    color: #333;
}
.sort-btn-disabled {
    opacity: 0.2;
    cursor: default;
    pointer-events: none;
}
.sortable-ghost {
    opacity: 0.4;
    background: #e2e3f1;
}
.drag-handle {
    cursor: grab;
    color: #999;
    font-size: 1rem;
    padding: 0 0.3rem;
    user-select: none;
}
.drag-handle:active {
    cursor: grabbing;
}

/* Crew member rows */
.crew-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.crew-row label {
    min-width: 60px;
    margin-bottom: 0;
    font-weight: 600;
    font-size: 0.85rem;
}
.crew-row select,
.crew-row input {
    margin-bottom: 0;
    flex: 1;
}

/* Submit bar with autosave status */
.submit-bar {
    position: sticky;
    bottom: 1rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Autosave status inline indicator */
.autosave-status {
    font-size: 0.8rem;
    color: #999;
    white-space: nowrap;
    transition: color 0.3s;
}
.autosave-status:empty {
    display: none;
}
.autosave-status-ok {
    color: #155724;
}
.autosave-status-error {
    color: #dc3545;
    font-weight: 600;
}

/* Draft notice banner */
.draft-notice {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* Draft cards on dashboard */
.draft-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    min-width: 160px;
}
.draft-card strong {
    font-size: 1rem;
}
.draft-card span {
    font-size: 0.85rem;
    color: #666;
}
.draft-card small {
    font-size: 0.75rem;
    color: #999;
}
.draft-card-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.4rem;
}


/* Submit button */
.submit-btn {
    width: 100%;
    margin-bottom: 0;
}

/* Checkout form input sizing */
.qty-input {
    width: 5ch !important;
    min-width: 5ch !important;
    margin: 0 !important;
    text-align: center;
    padding: 0.2rem !important;
    height: 2rem !important;
    -moz-appearance: textfield;
    box-sizing: border-box !important;
}
.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Note button */
button.note-btn,
button.note-btn[type=button] {
    all: unset;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    color: var(--pico-muted-color);
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    min-height: 2rem;
    min-width: 2.5rem;
    width: auto;
    padding: 0.25rem 0.5rem;
    box-sizing: border-box;
    white-space: nowrap;
    vertical-align: middle;
}
.checkout-table td {
    vertical-align: middle !important;
}
.actions-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.actions-row > * {
    margin: 0 !important;
    flex-shrink: 0;
}
button.note-btn:hover {
    border-color: var(--pico-primary);
    color: var(--pico-primary);
}
button.note-btn.has-note {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

/* Note modal */
.note-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.note-modal {
    background: var(--pico-background-color, #fff);
    border-radius: var(--pico-border-radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.note-modal h4 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}
.note-modal textarea {
    width: 100%;
    min-height: 100px;
    margin-bottom: 1rem;
}
.note-modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
.note-modal-actions button {
    margin-bottom: 0;
    padding: 0.4rem 1.2rem;
    font-size: 0.9rem;
}

/* Brand logo in nav */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    text-decoration: none;
}
.nav-brand .nav-logo-icon {
    width: 22px;
    height: 22px;
    margin-right: 0.1rem;
    position: relative;
    top: -1px;
}
.nav-brand strong {
    letter-spacing: -0.5px;
}
.nav-brand-tld {
    font-weight: 300;
    opacity: 0.5;
}
nav strong + small {
    color: var(--pico-muted-color);
    font-weight: normal;
}

/* Nav user info */
.nav-user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nav-logo {
    max-height: 28px;
    max-width: 80px;
    object-fit: contain;
}
.nav-agency {
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--pico-muted-color);
}
.nav-username {
    font-size: 0.75rem;
    line-height: 1.2;
}

/* Invitation banner */
.invitation-banner {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
    border-radius: var(--pico-border-radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.invitation-actions {
    display: flex;
    gap: 0.3rem;
}

/* Agency switcher */
.agency-switcher-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.agency-switch-btn {
    all: unset;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: var(--pico-border-radius);
}
.agency-switch-btn:hover {
    background: var(--pico-muted-border-color);
}
.agency-switch-option {
    all: unset;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.5rem 1rem;
    cursor: pointer;
    text-align: left;
    font-size: 0.85rem;
    color: #333;
    box-sizing: border-box;
}
.agency-switch-option:hover {
    background: #eee;
}
.agency-switch-option img {
    max-height: 20px;
    max-width: 50px;
    object-fit: contain;
}

/* Nav hamburger menu */
.nav-menu-wrap {
    position: relative;
}
.nav-menu-btn {
    background: transparent;
    border: 1px solid #555;
    border-radius: var(--pico-border-radius);
    color: #333;
    font-size: 1.3rem;
    padding: 0.2rem 0.6rem;
    cursor: pointer;
    line-height: 1;
    margin-bottom: 0;
}
.nav-menu-btn:hover {
    background: var(--pico-muted-border-color);
}
.nav-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.4rem;
    background: var(--pico-background-color, #fff);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 160px;
    z-index: 100;
    padding: 0.4rem 0;
}
.nav-dropdown.open {
    display: block;
}
.nav-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--pico-color);
    text-decoration: none;
    white-space: nowrap;
}
.nav-dropdown a:hover {
    background: var(--pico-muted-border-color);
}

/* Nav tighten on mobile */
@media (max-width: 768px) {
    nav ul li a[aria-label*="home"],
    nav ul li a[href="/"],
    .nav-brand {
        padding-left: 0;
        padding-right: 0;
        gap: 0.1rem !important;
        font-size: 0.85rem;
    }
    .nav-brand .nav-logo-icon {
        width: 20px;
        height: 20px;
        margin-right: 0.05rem;
    }
    nav ul li {
        padding: 0;
    }
    nav ul li a,
    nav ul li .theme-toggle {
        padding: 0.5rem 0.35rem;
    }
    nav ul li .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    .nav-user-info {
        gap: 0.25rem;
    }
    .nav-mailbox {
        font-size: 1rem;
        margin-right: 0.25rem;
    }
    .nav-username {
        display: none;
    }
}

/* Homepage sections */
.security-section {
    background: #f8f9fa;
    padding: 3rem 0;
}
[data-theme="dark"] .security-section {
    background: rgba(255, 255, 255, 0.03);
}

/* 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 {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}
.hero-actions a[role="button"] {
    background: #e94560;
    border-color: #e94560;
    color: #fff;
    font-size: 1.1rem;
    padding: 0.75rem 2.5rem;
    margin: 0;
}
.hero-actions a[role="button"]:hover {
    background: #c73a52;
    border-color: #c73a52;
}
/* Pricing cards */
.pricing-card {
    text-align: center;
    padding: 2rem 1.5rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
}
.pricing-card-featured {
    border: 2px solid var(--pico-primary);
    box-shadow: 0 4px 20px rgba(15, 52, 96, 0.12);
}
[data-theme="dark"] .pricing-card-featured {
    box-shadow: 0 4px 20px rgba(100, 160, 255, 0.1);
}
.pricing-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
}
.pricing-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--pico-color);
    margin: 0;
    line-height: 1.2;
}
.pricing-period {
    color: var(--pico-muted-color);
    margin: 0.25rem 0 1.25rem;
    font-size: 0.9rem;
}
.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    text-align: left;
    width: 100%;
    flex-grow: 1;
}
.pricing-features li {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
    font-size: 0.95rem;
}
.pricing-features li:last-child {
    border-bottom: none;
}

.hero-actions .hero-btn-outline {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.6);
    color: #fff;
    margin: 0;
}
.hero-actions .hero-btn-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: #fff;
}

/* 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);
}

/* History cards (mobile) */
.history-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 0.75rem 1rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    margin-bottom: 0.5rem;
}
.history-card:hover {
    border-color: var(--pico-primary);
}
.history-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}
.history-card-top strong {
    font-size: 1rem;
}
.history-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--pico-muted-color);
    font-size: 0.85rem;
}

/* Mobile-only elements (hidden on desktop by default) */
.show-mobile {
    display: none;
}

/* 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 log mobile cards */
.audit-card {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
}
.audit-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
}
.audit-card-user {
    font-weight: 600;
    font-size: 0.85rem;
}
.audit-card-detail {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.15rem;
    word-break: break-word;
}

.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-action-draft { background: #e2e3e5; color: #383d41; }
.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 */
/* Mailbox icon */
.nav-mailbox {
    position: relative;
    text-decoration: none;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    margin-right: 0.5rem;
    color: inherit;
}
.nav-mailbox:hover {
    opacity: 0.7;
}
.nav-badge {
    position: absolute;
    top: 0px;
    right: -8px;
    background: #dc3545;
    color: #fff;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
}

/* Questions */
.question-card {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e0e0e0;
}
.question-card:last-of-type {
    border-bottom: none;
}
.question-card.question-resolved {
    opacity: 0.6;
}
.question-header {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}
.question-date {
    color: #999;
    font-size: 0.8rem;
}
.question-replies {
    margin-left: 1rem;
    padding-left: 0.75rem;
    border-left: 2px solid #dee2e6;
    margin-top: 0.5rem;
}
.question-reply {
    padding: 0.3rem 0;
}
.question-reply p {
    margin: 0.15rem 0 0 0;
}
.question-reply-count {
    background: #e9ecef;
    color: #555;
    font-size: 0.75rem;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 0.3rem;
}
.badge-open {
    background: #fff3cd;
    color: #856404;
    font-size: 0.75rem;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 0.3rem;
    font-weight: bold;
}
.badge-resolved {
    background: #d4edda;
    color: #155724;
    font-size: 0.75rem;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 0.3rem;
    font-weight: bold;
}

.addendum-entry {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e0e0e0;
}
.addendum-entry:last-of-type {
    border-bottom: none;
}
.addendum-meta {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}
.addendum-entry p {
    margin: 0;
}

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

/* Offline banner */
.offline-banner {
    background: #e67e22;
    color: #fff;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1rem;
}

/* Pending offline submission cards */
.pending-card {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .offline-banner {
    background: #a55a14;
}

/* Cookie consent banner */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--pico-card-background-color);
    border-top: 1px solid var(--pico-muted-border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 9999;
    font-size: 0.9rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

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

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

/* Prevent horizontal overflow on mobile */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}
.checkout-table {
    width: 100%;
    table-layout: fixed;
}
.checkout-table th {
    white-space: nowrap;
}

@media (max-width: 768px) {
    table {
        font-size: 0.9rem;
    }
    .col-expected {
        display: none;
    }
    /* Function check status uses col-expected but must stay visible */
    .checkout-table .col-fc-status {
        display: table-cell !important;
        white-space: nowrap;
        font-size: 0.85rem;
    }
    .checkout-table .col-qty {
        width: 50px;
        text-align: center;
        display: table-cell !important;
    }
    .checkout-table .col-qty .qty-input {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
    }
    .detail-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Hide/show on mobile */
    .hide-mobile {
        display: none !important;
    }
    .show-mobile {
        display: block !important;
    }

    /* Hide table headers on mobile - use compact row layout */
    .checkout-table thead {
        display: none;
    }
    .checkout-table {
        table-layout: auto;
    }
    .checkout-table td {
        padding: 0.3rem 0.25rem;
        vertical-align: middle;
    }
    .checkout-table .col-present {
        width: 32px;
    }
    .checkout-table .col-note,
    .checkout-table .col-actions {
        width: 40px;
        text-align: center;
    }
}

/* ===========================
   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-expected { width: 50px; text-align: center; }
    .checkout-table .col-qty { width: 55px; text-align: center; }
    .checkout-table .col-note { width: 50px; text-align: center; }
    .checkout-table .col-actions { width: 50px; text-align: center; }

    /* Submit bar: not full width on desktop */
    .submit-bar {
        position: static;
    }
    .submit-btn {
        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: 5ch;
        min-width: 5ch;
        padding: 0.3rem 0.4rem;
    }

    /* Nav text sizing */
    nav {
        font-size: 0.9rem;
    }
    .nav-user {
        font-size: 0.75rem;
    }
}

/* ===========================
   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;
    }
}

/* ===========================
   Dark mode color overrides
   =========================== */

[data-theme="dark"] .flash-success { background: #1a3a2a; color: #8fd4a4; border-color: #2d5e3e; }
[data-theme="dark"] .flash-error { background: #3a1a1e; color: #e89ca4; border-color: #5e2d34; }
[data-theme="dark"] .flash-warning { background: #3a3018; color: #e8d08c; border-color: #5e4e2d; }
[data-theme="dark"] .outdate-warning,
[data-theme="dark"] .seal-expired-notice { background: #3a1a1e; color: #e89ca4; border-color: #5e2d34; }
[data-theme="dark"] .previously-missing { background: #2e2a18 !important; }
[data-theme="dark"] .prev-missing-tag { background: #3a3018; color: #e8d08c; }
[data-theme="dark"] .item-missing { background: #2e2a18; }
[data-theme="dark"] .als-badge { background: #3a1a1e; color: #e89ca4; }
[data-theme="dark"] .als-divider { background: #3a1a1e; color: #e89ca4; }
[data-theme="dark"] .prop-warning { background-color: #2e2a18 !important; border-color: #5e4e2d !important; }
[data-theme="dark"] .prop-danger { background-color: #3a1a1e !important; border-color: #5e2d34 !important; }
[data-theme="dark"] button.note-btn.has-note { background: #2e2a18; border-color: #5e4e2d; color: #e8d08c; }
[data-theme="dark"] .audit-action-login { background: #1a3a2a; color: #8fd4a4; }
[data-theme="dark"] .audit-action-logout { background: #2a2a2e; color: #aaa; }
[data-theme="dark"] .audit-action-checksheet { background: #1a2a3a; color: #8cb8e8; }
[data-theme="dark"] .audit-action-user { background: #2e2a18; color: #e8d08c; }
[data-theme="dark"] .audit-action-vehicle { background: #1a2e2e; color: #8cd4d8; }
[data-theme="dark"] .audit-action-agency { background: #1e1e30; color: #a8a8d8; }
[data-theme="dark"] .badge-open { background: #2e2a18; color: #e8d08c; }
[data-theme="dark"] .badge-resolved { background: #1a3a2a; color: #8fd4a4; }
[data-theme="dark"] .onboarding-card { background: #16213e; border-color: #0f3460; }
[data-theme="dark"] .onboarding-card p,
[data-theme="dark"] .onboarding-steps li p { color: #aab; }
[data-theme="dark"] .invitation-banner { background: #16213e; border-color: #0f3460; }
