* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #212529;
    --muted: #6c757d;
    --border: #dee2e6;
    --nav-height: 56px;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

body.modal-open {
    overflow: hidden;
}

/* --- Navbar --- */
.navbar {
    background: linear-gradient(135deg, #1a237e, #0d47a1);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: var(--nav-height);
    gap: 8px;
}

.nav-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.view-mode-btn {
    display: none;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: white;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-height: 36px;
    font-family: inherit;
}

.view-mode-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.view-mode-btn[aria-pressed="true"] {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

.nav-logo {
    width: auto;
    height: 44px;
    max-width: 132px;
    border-radius: 8px;
    background: #fff;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.nav-brand-text {
    white-space: nowrap;
    line-height: 1.15;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: 0.3s;
}

.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.nav-links {
    display: flex;
    gap: 4px;
    padding: 0 12px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-links a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.2s;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-links a:hover,
.nav-links a:active {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* --- Layout --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 12px 32px;
}

@media (max-width: 768px) {
    html {
        font-size: 18px;
    }

    body {
        font-size: 1rem;
        -webkit-font-smoothing: antialiased;
    }

    .nav-brand {
        font-size: 1.05rem;
    }

    .nav-logo {
        height: 40px;
        max-width: 112px;
    }

    .nav-brand-text {
        font-size: 0.95rem;
    }

    .container {
        padding: 12px 10px calc(92px + env(safe-area-inset-bottom, 0));
    }

    .navbar .nav-links:not(.open) {
        display: none;
    }

    .nav-top {
        padding: 0 12px;
    }

    .page-header-mobile {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 14px;
    }

    .page-header-mobile h2 {
        font-size: 1.35rem;
    }

    .btn-sm-mobile-hide {
        display: none;
    }

    .mobile-form {
        padding: 14px;
        border-radius: 14px;
    }

    .form-section {
        margin-bottom: 20px;
        padding-bottom: 16px;
        border-bottom: 1px solid var(--border);
    }

    .form-section:last-of-type {
        border-bottom: none;
    }

    .form-section-title {
        font-size: 1rem;
        font-weight: 600;
        color: var(--primary);
        margin-bottom: 8px;
    }

    .section-hint {
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 8px;
    }

    .input-large,
    .select-large,
    .search-input {
        font-size: 18px !important;
        min-height: 54px;
        padding: 14px 16px;
    }

    .hint, .section-hint {
        font-size: 0.92rem;
        line-height: 1.45;
    }

    .form-section-title {
        font-size: 1.1rem;
        font-weight: 700;
    }

    .autocomplete-list {
        font-size: 1rem;
    }

    .ac-item {
        padding: 14px 16px !important;
        min-height: 56px;
    }

    .ac-item strong {
        font-size: 1.05rem;
    }

    .btn {
        font-size: 1rem;
        min-height: 50px;
    }

    .btn-lg {
        font-size: 1.1rem;
        min-height: 56px;
        font-weight: 600;
    }

    .bottom-nav-item {
        font-size: 0.75rem;
    }

    .bottom-nav-icon {
        font-size: 1.35rem;
    }

    .vehicle-info-card {
        background: #f0f7ff;
        border: 1px solid #b6d4fe;
        border-radius: 10px;
        padding: 12px 14px;
        margin-top: 10px;
    }

    .info-row {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        font-size: 0.92rem;
        border-bottom: 1px solid rgba(0,0,0,0.06);
    }

    .info-row:last-child {
        border-bottom: none;
    }

    .info-row span {
        color: var(--muted);
    }

    .rate-badge {
        margin-top: 10px;
        padding: 10px 14px;
        background: #d1e7dd;
        color: #0f5132;
        border-radius: 8px;
        font-weight: 600;
        font-size: 0.95rem;
        text-align: center;
    }

    .scan-details {
        border: 1px dashed var(--border);
        border-radius: 10px;
        padding: 0;
        background: #fafbfc;
    }

    .scan-summary {
        padding: 14px 16px;
        font-weight: 500;
        cursor: pointer;
        list-style: none;
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    .scan-summary::-webkit-details-marker {
        display: none;
    }

    .scan-details[open] .scan-summary {
        border-bottom: 1px solid var(--border);
    }

    .scan-details .photo-section {
        border: none;
        margin: 0;
    }

    .photo-buttons-stack {
        flex-direction: column;
        width: 100%;
    }

    .form-row-horizontal {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .form-row-horizontal .form-group {
        margin-bottom: 0;
    }

    .btn-block-mobile {
        width: 100%;
        display: flex;
    }

    .photo-buttons .btn {
        flex: 1;
        min-width: 0;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .card {
        padding: 16px;
        min-height: 72px;
    }

    .bottom-nav-item.active {
        color: var(--primary);
        font-weight: 600;
        background: #f0f4ff;
    }

    .bottom-nav-primary.active {
        background: #e3f2fd;
    }

    .form-actions-sticky {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(56px + env(safe-area-inset-bottom, 0));
        background: linear-gradient(transparent, var(--bg) 20%);
        padding: 12px 10px 10px;
        margin: 0;
        z-index: 50;
    }

    .form-actions-sticky .btn {
        box-shadow: 0 4px 14px rgba(13, 110, 253, 0.35);
    }

    .mobile-form .form-actions-sticky {
        margin: 0 -14px -14px;
        padding-left: 14px;
        padding-right: 14px;
    }

    .data-table td {
        padding-left: 38%;
        font-size: 0.9rem;
    }

    .data-table td::before {
        width: 34%;
        font-size: 0.72rem;
    }

    .filter-bar .btn,
    .form-actions .btn,
    .page-header .btn {
        width: 100%;
    }

    .receipt-actions .btn {
        min-height: 52px;
        font-size: 1rem;
    }

    @media (max-width: 520px) {
        .form-row-horizontal {
            grid-template-columns: 1fr;
        }
    }
}

/* Desktop: vehicle info card */
.vehicle-info-card {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 10px;
}

.form-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.scan-details {
    border: 1px dashed #ced4da;
    border-radius: 10px;
    overflow: hidden;
}

.scan-summary {
    padding: 12px 14px;
    cursor: pointer;
    background: #f8f9fa;
    font-weight: 500;
}

.rate-badge {
    margin-top: 8px;
    padding: 8px 12px;
    background: #e3f2fd;
    border-radius: 6px;
    font-weight: 600;
    color: #1565c0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.9rem;
}

.info-row span {
    color: var(--muted);
}

.btn-block-mobile {
    width: auto;
}

.vehicle-select-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.vehicle-manual-panel {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.amount-readonly {
    background: #e9ecef;
    color: #212529;
}

@media (max-width: 768px) {
    .vehicle-select-modes {
        grid-template-columns: 1fr;
    }
}

html.mobile-view .vehicle-select-modes {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 520px) {
    html.mobile-view .vehicle-select-modes {
        grid-template-columns: 1fr;
    }
}

.plate-check-msg {
    margin-top: 6px;
    font-size: 0.88rem;
    line-height: 1.35;
}

.plate-ok-msg {
    color: #198754;
}

.plate-bad-msg {
    color: #b02a37;
    font-weight: 600;
}

.plate-pending-msg {
    color: var(--muted, #6c757d);
}

input.plate-ok,
.search-input.plate-ok {
    border-color: #198754 !important;
    box-shadow: 0 0 0 2px rgba(25, 135, 84, 0.15);
}

input.plate-bad,
.search-input.plate-bad {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.15);
}

/* Car number + add */
.plate-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.plate-row .search-input,
.plate-row .input-large {
    flex: 1;
    min-width: 0;
}

.btn-add-vehicle {
    flex: 0 0 48px;
    width: 48px;
    height: auto;
    min-height: 48px;
    border: 2px solid var(--primary, #0d6efd);
    border-radius: 10px;
    background: #fff;
    color: var(--primary, #0d6efd);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-add-vehicle:hover,
.btn-add-vehicle:focus {
    background: #e7f1ff;
}

.btn-add-vehicle.active {
    background: var(--primary, #0d6efd);
    color: #fff;
}

.new-vehicle-panel {
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed var(--border, #dee2e6);
    border-radius: 10px;
    background: #fafbfc;
}

.ac-item span {
    font-size: 0.85rem;
    color: var(--muted, #6c757d);
}

.ac-item.ac-add {
    background: #eef7ff;
}

/* Autocomplete */
.autocomplete-wrap {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 100;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 0 0 10px 10px;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.ac-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-bottom: 1px solid #eee;
    background: white;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.ac-item:active,
.ac-item.ac-active {
    background: #e3f2fd;
}

.ac-item strong {
    font-size: 1rem;
    color: var(--text);
}

.ac-item span {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 2px;
}

.ac-empty {
    padding: 14px;
    color: var(--muted);
    font-size: 0.9rem;
}

.input-large {
    font-size: 1rem;
}

.select-large {
    font-size: 1rem;
}

.search-input {
    background: #f8f9fa;
}

.hero h1 {
    font-size: clamp(1.4rem, 4vw, 2rem);
    margin-bottom: 8px;
}

.hero > p {
    color: var(--muted);
    margin-bottom: 24px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.card {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
}

.card:active {
    transform: scale(0.98);
}

.card h3 {
    margin-bottom: 6px;
    color: var(--primary);
    font-size: 1.05rem;
}

.card p {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.dash-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0 8px;
}

.dash-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px 16px;
}

@media (max-width: 768px) {
    .dash-two {
        grid-template-columns: 1fr;
    }
}

.status-void {
    color: #b02a37;
    font-weight: 700;
}

.row-void td {
    opacity: 0.72;
    text-decoration: line-through;
}

.row-void td.actions,
.row-void td:last-child {
    text-decoration: none;
    opacity: 1;
}

.void-box {
    background: #fff5f5;
    border: 1px solid #f1aeb5;
    border-radius: 10px;
    padding: 12px;
    margin-top: 12px;
}

.card-primary {
    border-color: var(--primary);
    background: linear-gradient(135deg, #e3f2fd, #ffffff);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h2 {
    font-size: clamp(1.2rem, 3.5vw, 1.5rem);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    min-height: 44px;
    touch-action: manipulation;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    min-height: 36px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* --- Tables --- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.data-table {
    width: 100%;
    background: var(--card);
    border-collapse: collapse;
    min-width: 600px;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 0.78rem;
    font-weight: 500;
}

.badge-success {
    background: #d1e7dd;
    color: #0f5132;
}

.badge-muted {
    background: #e9ecef;
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
}

/* --- Forms --- */
.form-card {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    max-width: 560px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
}

.form-card-wide {
    max-width: 100%;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    min-height: 48px;
    -webkit-appearance: none;
    appearance: none;
    background: white;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%236c757d' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}

.readonly-field {
    background: #f8f9fa !important;
    color: var(--muted);
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    background: var(--card);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.filter-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 140px;
}

.result-count {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 12px;
}

.hint {
    color: var(--muted);
    font-size: 0.82rem;
    margin-top: 6px;
}

.hint a {
    color: var(--primary);
}

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.alert-error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: var(--card);
    border-radius: 12px;
    border: 1px dashed var(--border);
}

.empty-state p {
    color: var(--muted);
    margin-bottom: 16px;
}

.muted {
    color: var(--muted);
}

/* --- Photo / Scan --- */
.photo-section {
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.plate-scan-section {
    background: #f8fbff;
    border-color: #b6d4fe;
}

.photo-section video,
.photo-section img {
    max-width: 100%;
    max-height: 280px;
    border-radius: 8px;
    margin-bottom: 12px;
    object-fit: contain;
}

.photo-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.scan-status {
    font-size: 0.88rem;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 6px;
}

.scan-status.loading {
    background: #fff3cd;
    color: #664d03;
}

.scan-status.success {
    background: #d1e7dd;
    color: #0f5132;
}

.scan-status.warning {
    background: #fff3cd;
    color: #664d03;
}

.scan-status.error {
    background: #f8d7da;
    color: #842029;
}

.detected-plate {
    margin-top: 8px;
    padding: 8px 12px;
    background: #e3f2fd;
    border-radius: 6px;
    font-weight: 600;
    color: #1565c0;
    font-size: 0.95rem;
}

/* --- Bottom navigation (mobile) --- */
.bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
        z-index: 999;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 4px 10px;
        text-decoration: none;
        color: var(--muted);
        font-size: 0.68rem;
        min-height: 56px;
        gap: 2px;
    }

    .bottom-nav-icon {
        font-size: 1.25rem;
        line-height: 1;
    }

    .bottom-nav-primary {
        color: var(--primary);
        font-weight: 600;
    }

    .bottom-nav-item:active {
        background: #f0f4ff;
    }
}

/* --- Photo thumbnails & modal --- */
.photo-thumb-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.photo-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border);
}

.photo-thumb-label {
    font-size: 0.72rem;
    color: var(--primary);
    text-decoration: underline;
}

.clickable-photo {
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.clickable-photo:active {
    border-color: var(--primary);
}

.photo-modal[hidden] {
    display: none !important;
}

.photo-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
}

.photo-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.75);
}

.photo-modal-content {
    position: relative;
    background: white;
    border-radius: 14px;
    padding: 16px;
    max-width: 100%;
    width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

.photo-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    min-width: 44px;
    min-height: 44px;
}

.photo-modal-content img {
    width: 100%;
    max-height: 55vh;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 12px;
}

.photo-modal-title {
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 1rem;
}

.photo-modal-status {
    margin-top: 10px;
    font-size: 0.85rem;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
}

.photo-modal-status.loading { background: #fff3cd; color: #664d03; }
.photo-modal-status.success { background: #d1e7dd; color: #0f5132; }
.photo-modal-status.error { background: #f8d7da; color: #842029; }

.section-title {
    font-size: 1rem;
    margin: 8px 0 16px;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.receipt-card {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}

.receipt-preview {
    text-align: center;
    margin-bottom: 20px;
}

.receipt-preview h3 {
    margin-bottom: 6px;
}

.receipt-details {
    width: 100%;
    margin: 12px 0;
    font-size: 0.9rem;
}

.receipt-details td {
    padding: 6px 4px;
    text-align: left;
}

.receipt-details td:last-child {
    text-align: right;
}

.receipt-photo {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 12px;
}

.receipt-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-whatsapp {
    background: #25d366;
    color: white;
    border-color: #25d366;
}

.btn-whatsapp:active {
    background: #1da851;
}

/* Sticky submit on mobile car-in */
@media (max-width: 768px) {
    .form-actions-sticky {
        position: sticky;
        bottom: calc(64px + env(safe-area-inset-bottom, 0));
        background: var(--bg);
        padding: 12px 0;
        margin: 0 -4px;
        z-index: 10;
    }

    .data-table td[data-label="Photo"] {
        padding-left: 14px;
        flex-direction: column;
        align-items: flex-start;
    }

    .data-table td[data-label="Photo"]::before {
        position: static;
        width: auto;
        margin-bottom: 6px;
    }
}

/* --- Mobile: hamburger nav --- */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
        min-width: 44px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        z-index: 2;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        padding: 0 12px 12px;
        gap: 2px;
        width: 100%;
        background: linear-gradient(180deg, #0d47a1, #1a237e);
        border-top: 1px solid rgba(255,255,255,0.12);
        max-height: min(70vh, 520px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .navbar .nav-links.open {
        display: flex;
    }

    .nav-links a {
        border-radius: 8px;
        padding: 12px 16px;
    }

    .nav-user-chip {
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 12px 16px;
        margin-bottom: 4px;
        border-radius: 8px;
        background: rgba(255,255,255,0.12);
    }

    .nav-user-chip strong {
        font-size: 1rem;
        font-weight: 700;
    }

    .nav-user-chip span {
        font-size: 0.8rem;
        opacity: 0.9;
    }

    .nav-logout {
        margin-top: 6px;
        background: rgba(220, 53, 69, 0.35) !important;
        font-weight: 700;
    }

    .nav-brand .role-badge {
        display: none;
    }

    .nav-brand-text {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 42vw;
    }

    .page-header .btn {
        flex: 1;
        min-width: 120px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .btn {
        width: 100%;
    }

    /* Card-style table rows on mobile */
    .data-table {
        min-width: unset;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        margin-bottom: 12px;
        border: 1px solid var(--border);
        border-radius: 10px;
        overflow: hidden;
        background: var(--card);
    }

    .data-table td {
        border-bottom: 1px solid #f0f0f0;
        padding: 10px 14px;
        padding-left: 42%;
        position: relative;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .data-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 14px;
        width: 38%;
        font-weight: 600;
        font-size: 0.78rem;
        color: var(--muted);
        text-transform: uppercase;
    }

    .data-table td.actions {
        padding-left: 14px;
        justify-content: flex-start;
    }

    .data-table td.actions::before {
        display: none;
    }

    .table-wrap {
        box-shadow: none;
        overflow-x: visible;
    }
}

@media (min-width: 769px) {
    .view-mode-btn {
        display: inline-flex;
        align-items: center;
    }

    .nav-toggle {
        display: none !important;
    }

    .nav-user-chip {
        display: none;
    }

    .nav-logout {
        margin-left: 4px;
        background: rgba(220, 53, 69, 0.28);
        font-weight: 600;
    }

    .navbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 24px;
        height: var(--nav-height);
    }

    .nav-top {
        padding: 0;
        height: auto;
        flex: 0;
    }

    .nav-links {
        display: flex !important;
        padding: 0;
        overflow-x: visible;
    }
}
