* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #f4f4f5;
    color: #1a1a1a;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: #111827;
    color: #fff;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
}

.app-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.header-actions .nav-icon-link {
    width: 38px;
    height: 38px;
    border: none;
}

.header-actions .nav-icon-link svg {
    width: 18px;
    height: 18px;
}

.nav-sync {
    position: relative;
    background: #1f2937;
    cursor: pointer;
    opacity: 1;
}

.nav-sync:disabled {
    opacity: 0.6;
    cursor: default;
}

.sync-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    display: inline-block;
    background: #f59e0b;
    color: #111827;
    border-radius: 999px;
    min-width: 16px;
    text-align: center;
    padding: 1px 4px;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1.4;
}

.app-main {
    flex: 1;
    padding: 16px;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
}

.screen-title {
    font-size: 1.3rem;
    margin: 8px 0 16px;
}

/* Page title — icon badge beside the heading text. Shared across
   Entry/Exit/Summary so the header design stays consistent. */
.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 18px;
}

.icon-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #111827;
    color: #fff;
    box-shadow: 0 2px 6px rgba(17,24,39,0.25);
}

.icon-badge.letter {
    font-weight: 800;
    font-size: 1.2rem;
    font-family: Georgia, 'Times New Roman', serif;
}

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

.page-title-text {
    font-size: 1.35rem;
    font-weight: 700;
}

/* Entry form — large tap targets, one-thumb friendly */
.entry-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.entry-form label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    margin-top: 10px;
}

.field-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.vehicle-type-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: #b22222;
    background: #fdf0f0;
    border-radius: 999px;
    padding: 2px 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.optional-tag {
    font-weight: 400;
    color: #9ca3af;
    text-transform: none;
}

.entry-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.entry-input-row .big-input {
    flex: 1;
}

.icon-only-btn {
    flex-shrink: 0;
    width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

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

.big-input {
    font-size: 1.4rem;
    padding: 14px;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    width: 100%;
}

.big-input.locked-input {
    background: #f3f4f6;
    color: #6b7280;
}

/* Visually forces caps as the attendant types; the actual submitted value
   is uppercased in JS on input (site.js) and again server-side as a
   safety net, so it's consistent regardless of client capability. */
.uppercase-input {
    text-transform: uppercase;
}

/* Vehicle type selector — icon-only, single-select. Firebrick marks the
   active type, gray marks the rest; no text labels by design. */
.vehicle-type-selector {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin: 4px 0 2px;
}

.vehicle-type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 10px;
    color: #9ca3af;
    cursor: pointer;
}

.vehicle-type-btn svg {
    width: 24px;
    height: 24px;
}

.vehicle-type-btn.active {
    color: #b22222;
    border-color: #b22222;
    background: #fdf0f0;
}

/* Daily stats table */
.daily-stats {
    margin-top: 22px;
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 10px;
}

.stats-date-label {
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 170px;
    text-align: center;
}

.stats-nav-btn {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #374151;
}

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

.stats-table-wrap {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.stats-table th, .stats-table td {
    text-align: center;
    padding: 8px 4px;
}

.stats-table thead th {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.stats-table thead th svg {
    width: 18px;
    height: 18px;
    color: #6b7280;
}

.stats-row-label {
    text-align: left !important;
    font-weight: 600;
    color: #374151;
    padding-left: 12px !important;
    white-space: nowrap;
}

.stats-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #f3f4f6;
}

.stats-total-row td {
    font-weight: 700;
    background: #f9fafb;
}

.primary-btn, .secondary-btn {
    display: inline-block;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 16px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    margin-top: 16px;
    text-decoration: none;
}

.primary-btn {
    background: #16a34a;
    color: #fff;
    width: 100%;
}

.secondary-btn {
    background: #e5e7eb;
    color: #111827;
    width: 100%;
}

.action-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.primary-btn:disabled {
    opacity: 0.7;
    cursor: default;
}

/* Header-level "Scan to Exit" icon button, top-right aligned next to the
   Vehicle Exit page title. */
.page-title-action {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: #16a34a;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(22,163,74,0.3);
    text-decoration: none;
}

.page-title-action svg {
    width: 20px;
    height: 20px;
}

.print-status {
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.print-status.success {
    background: #dcfce7;
    color: #166534;
}

.print-status.error {
    background: #fee2e2;
    color: #991b1b;
}

.error-box {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.empty-state {
    color: #6b7280;
    text-align: center;
    padding: 40px 0;
}

/* Ticket list (Exit / Summary) */
.ticket-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ticket-row {
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ticket-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.plate {
    font-size: 1.15rem;
    font-weight: 700;
}

.zone, .entry-time, .runtime {
    font-size: 0.8rem;
    color: #6b7280;
}

.runtime {
    font-variant-numeric: tabular-nums;
}

.fee-amount {
    font-weight: 700;
    color: #16a34a;
    font-variant-numeric: tabular-nums;
}

.exit-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
}

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

.icon-btn-pay {
    background: #16a34a;
}

.icon-btn-qr {
    background: #6b7280;
}

.icon-btn-free {
    background: #2563eb;
}

/* Summary cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.summary-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px 6px 12px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.summary-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    margin-bottom: 6px;
}

.summary-card-icon svg {
    width: 16px;
    height: 16px;
}

.icon-transactions {
    background: #eef2ff;
    color: #4f46e5;
}

.icon-parked {
    background: #eff6ff;
    color: #2563eb;
}

.icon-collected {
    background: #ecfdf5;
    color: #16a34a;
}

.summary-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
}

.summary-label {
    display: block;
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 2px;
}

/* Daily Report sections */
.report-section {
    margin-bottom: 18px;
}

.report-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
    margin: 0 0 8px;
}

.chart-wrap {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
}

.chart-icon svg {
    width: 18px;
    height: 18px;
}

.chart-track {
    flex: 1;
    height: 10px;
    background: #f3f4f6;
    border-radius: 999px;
    overflow: hidden;
}

.chart-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.2s ease;
}

.chart-value {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 64px;
    text-align: right;
}

/* Nav — icon-only, each item color-coded for fast visual scanning without
   reading labels. Lives in the header's top-right action area. */
.nav-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    color: #fff;
    text-decoration: none;
    opacity: 0.55;
    transition: opacity 0.15s, transform 0.1s;
}

.nav-icon-link svg {
    width: 22px;
    height: 22px;
}

.nav-icon-link:active {
    transform: scale(0.94);
}

.nav-icon-link.active {
    opacity: 1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.nav-entry { background: #16a34a; }
.nav-exit { background: #2563eb; }
.nav-summary { background: #7c3aed; }

/* Active page always shows at full strength even without the .active
   shadow variant, so the current section is unmistakable at a glance. */
.nav-icon-link.active.nav-entry,
.nav-icon-link.active.nav-exit,
.nav-icon-link.active.nav-summary {
    opacity: 1;
}

/* Receipt — simulates a 58mm thermal ticket (≈219px at 96dpi) */
.receipt {
    background: #fff;
    width: 58mm;
    margin: 0 auto 20px;
    padding: 10px 6px;
    font-family: "Courier New", monospace;
    font-size: 0.82rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.receipt-header {
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.3;
    margin-bottom: 8px;
}

.receipt-ticket-number {
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.receipt-row-single {
    text-align: center;
    padding: 2px 0;
    word-break: break-word;
}

.receipt-divider {
    border-top: 1px dashed #000;
    margin: 8px 0;
}

.receipt-tear-line {
    border-top: 1px solid #000;
    margin: 10px 0 8px;
}

.receipt-qr {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 8px 0;
    text-align: center;
}

.receipt-note {
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.4;
}

.receipt-tear-space {
    height: 28px;
}

/* Print loading / result states */
.print-loading, .print-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    text-align: center;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #e5e7eb;
    border-top-color: #16a34a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.result-icon {
    width: 44px;
    height: 44px;
    line-height: 44px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
}

.print-result p {
    font-weight: 600;
    color: #166534;
}

/* Print rules — only the receipt block prints */
@media print {
    /* Continuous-roll thermal paper has no fixed page length — telling the
       browser the page height is "auto" (not Letter/A4's ~11in default)
       stops it from splitting one receipt into two printed pages. Without
       this, anything past the default page height gets pushed onto a
       second page, which reprints from wherever the break landed. */
    @page {
        size: 58mm auto;
        margin: 0;
    }

    .no-print, .app-header {
        display: none !important;
    }

    html, body, .app-main {
        margin: 0;
        padding: 0;
        max-width: none;
        height: auto;
    }

    .receipt {
        box-shadow: none;
        margin: 0;
        width: 100%;
        page-break-inside: avoid;
        break-inside: avoid;
    }
}

/* Device activation gate — one-time per device. #appShell gets blurred
   and locked behind the overlay until the correct key is entered. */
#appShell.blurred {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

body.activation-locked {
    overflow: hidden;
}

.activation-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(17, 24, 39, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.activation-overlay[hidden] {
    display: none;
}

.activation-card {
    background: #fff;
    border-radius: 16px;
    padding: 28px 22px;
    width: 100%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.activation-badge {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    margin: 0 auto 14px;
}

.activation-badge svg {
    width: 26px;
    height: 26px;
}

.activation-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0 0 6px;
}

.activation-subtext {
    font-size: 0.82rem;
    color: #6b7280;
    margin: 0 0 16px;
    line-height: 1.4;
}

.activation-input {
    text-align: center;
    letter-spacing: 1px;
    font-size: 1.05rem;
}

.activation-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 8px;
}

.activation-input-row .activation-input {
    flex: 1;
    margin-bottom: 0;
}

.activation-toggle-btn {
    background: #f3f4f6;
    color: #374151;
}

.activation-toggle-btn svg {
    width: 20px;
    height: 20px;
}

.activation-input-error {
    border-color: #dc2626 !important;
}

.activation-error {
    display: block;
    color: #dc2626;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.activation-submit-btn {
    width: 100%;
    background: #111827;
    color: #fff;
}

/* QR Scanning modal (Scanning.cshtml) — reuses the activation overlay's
   blurred backdrop treatment but with its own card/content. */
.scanning-overlay {
    background: rgba(17, 24, 39, 0.75);
}

.scanning-card {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.scanning-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.scanning-header .icon-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.scanning-header .icon-badge svg {
    width: 17px;
    height: 17px;
}

.scanning-title {
    font-weight: 700;
    font-size: 1rem;
    flex: 1;
}

.scanning-close-btn {
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    cursor: pointer;
    flex-shrink: 0;
}

.scanning-close-btn svg {
    width: 16px;
    height: 16px;
}

.scanning-viewport {
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.scanning-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanning-frame {
    position: absolute;
    inset: 12%;
    border: 3px solid #16a34a;
    border-radius: 16px;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.scanning-status {
    text-align: center;
    font-size: 0.82rem;
    color: #6b7280;
    margin: 12px 0 2px;
}

/* ---------- Internal pages menu (double-tap logo) ---------- */

.internal-pages-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(17, 24, 39, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.internal-pages-overlay[hidden] {
    display: none;
}

.internal-pages-card {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 28px 22px 22px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.internal-pages-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #f3f4f6;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.internal-pages-close svg {
    width: 16px;
    height: 16px;
}

.internal-pages-close:hover {
    background: #e5e7eb;
    color: #111827;
}

.internal-pages-badge {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    margin: 0 auto 14px;
    background: #111827;
    color: #fff;
}

.internal-pages-badge svg {
    width: 24px;
    height: 24px;
}

.internal-pages-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0 0 4px;
    color: #111827;
}

.internal-pages-subtext {
    font-size: 0.82rem;
    color: #6b7280;
    margin: 0 0 18px;
    line-height: 1.4;
}

.internal-pages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.internal-page-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: #111827;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.internal-page-item:hover,
.internal-page-item:active {
    background: #f9fafb;
    border-color: #d1d5db;
}

.internal-page-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #eef2f7;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
}

.internal-page-icon svg {
    width: 19px;
    height: 19px;
}

.internal-page-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.internal-page-name {
    font-size: 0.92rem;
    font-weight: 700;
}

.internal-page-desc {
    font-size: 0.76rem;
    color: #6b7280;
}
