* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", Arial, sans-serif;
    color: #17202a;
    background: #f6f7f9;
}

button,
input,
a {
    font: inherit;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1:focus {
    outline: none;
}

.receipt-shell {
    min-height: 100vh;
    background: var(--tenant-bg, #f6f7f9);
    color: var(--tenant-text, #17202a);
    font-family: var(--tenant-font-family, "Segoe UI", Arial, sans-serif);
}

.brand-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px clamp(18px, 4vw, 56px);
    background: var(--tenant-surface, #ffffff);
    border-bottom: 4px solid var(--tenant-accent, #e11d48);
}

.brand-identity {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 18px;
}

.brand-bar p,
.receipt-toolbar p {
    color: var(--tenant-muted, #5c6670);
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: uppercase;
}

.brand-bar h1 {
    margin-top: 2px;
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    font-weight: 750;
}

.brand-mark {
    display: grid;
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    place-items: center;
    border: 1px solid var(--tenant-border, #d9dee3);
    border-radius: var(--tenant-control-radius, 8px);
    background: var(--tenant-brandmark-bg, #ffffff);
    color: var(--tenant-brandmark-text, var(--tenant-primary, #0f766e));
    font-weight: 800;
}

.brand-mark img {
    max-width: 44px;
    max-height: 44px;
}

.language-switcher {
    position: relative;
    flex: 0 0 auto;
}

.language-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 78px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--tenant-border, #cdd5dd);
    border-radius: var(--tenant-control-radius, 8px);
    background: var(--tenant-surface, #ffffff);
    color: var(--tenant-primary, #0f766e);
    cursor: pointer;
    font-weight: 750;
}

.language-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.language-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    display: grid;
    min-width: 190px;
    padding: 6px;
    border: 1px solid var(--tenant-border, #cdd5dd);
    border-radius: var(--tenant-panel-radius, 8px);
    background: var(--tenant-surface, #ffffff);
    box-shadow: 0 16px 42px rgb(23 32 42 / 16%);
}

.language-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #17202a;
    cursor: pointer;
    text-align: left;
}

.language-menu button:hover,
.language-menu button.active {
    background: #edf7f5;
    color: var(--tenant-primary, #0f766e);
}

.language-menu button span {
    display: inline-grid;
    width: 34px;
    height: 26px;
    place-items: center;
    border: 1px solid #d9dee3;
    border-radius: 6px;
    color: inherit;
    font-size: 0.78rem;
    font-weight: 800;
}

.receipt-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 28px;
    width: min(980px, calc(100% - 32px));
    margin: 28px auto 48px;
    align-items: start;
}

.lookup-panel,
.receipt-panel,
.empty-state {
    background: var(--tenant-surface, #ffffff);
    border: 1px solid var(--tenant-border, #d9dee3);
    border-radius: var(--tenant-panel-radius, 8px);
}

.lookup-panel {
    width: min(100%, 560px);
    padding: 22px;
}

.visual-lookup-panel {
    overflow: visible;
}

.lookup-panel h2,
.receipt-toolbar h2 {
    font-size: 1.18rem;
}

.lookup-panel form,
.lookup-form {
    display: grid;
    gap: 18px;
    margin-top: 20px;
}

.mode-segments {
    margin-bottom: 2px;
}

.ticket-entry {
    position: relative;
    container-type: inline-size;
    width: min(100%, 440px);
    margin-inline: auto;
    font-family: Arial, Helvetica, sans-serif;
}

.ticket-entry img {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
}

.ticket-number-field,
.ticket-carpark,
.ticket-datetime-value,
.ticket-language {
    position: absolute;
    font-family: Arial, Helvetica, sans-serif;
    font-size: clamp(13px, 5cqw, 23px);
    line-height: 1;
    color: #111111;
}

.ticket-number-field {
    left: 16.5%;
    top: 36.8%;
    width: 70%;
    height: 3.8%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #111111;
    font-size: clamp(12px, 4.4cqw, 19px);
    font-weight: 500;
    letter-spacing: -0.6px;
    line-height: 1;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

    .ticket-number-field::placeholder {
        color: #9ca3af;
        opacity: 1;
    }

    .ticket-number-field.ticket-mask {
        color: #9ca3af;
    }

    .ticket-number-field.ticket-filled {
        color: #111111;
    }

.ticket-number-field:focus,
.parking-time-input:focus {
    outline: 2px solid var(--tenant-accent, #e11d48);
    outline-offset: 2px;
}

.ticket-carpark {
    left: 23.2%;
    top: 41.4%;
    width: 52%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-datetime-value {
    left: 23.2%;
    top: 44.4%;
    width: 47.5%;
    height: 3.4%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgb(255 255 255 / 88%);
    color: #111111;
    font-family: Arial, Helvetica, sans-serif;
    font-size: inherit;
    line-height: 1;
}

.ticket-language {
    left: 73.5%;
    top: 44.4%;
}

.plate-entry {
    display: grid;
    min-height: 260px;
    place-items: center;
    padding: 28px 6px;
}

.eu-plate {
    display: grid;
    grid-template-columns: 15% 1fr;
    container-type: inline-size;
    width: min(100%, 440px);
    aspect-ratio: 5 / 1;
    overflow: hidden;
    border: 4px solid #121212;
    border-radius: 10px;
    background: #f8f8f8;
    box-shadow: 0 12px 32px rgb(23 32 42 / 14%);
}

.eu-plate:focus-within {
    box-shadow:
        0 0 0 3px color-mix(in srgb, var(--tenant-primary, #0f766e) 20%, transparent),
        0 12px 32px rgb(23 32 42 / 14%);
}

.eu-band {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: center;
    justify-items: center;
    padding: 6px 4px;
    background: #064aa2;
    color: #f7d34a;
    font-size: clamp(8px, 2.4vw, 14px);
    line-height: 1;
}

.eu-band strong {
    grid-column: 1 / -1;
    color: #ffffff;
    font-size: clamp(12px, 3.1vw, 18px);
}

.plate-field {
    width: 100%;
    height: calc(100% - 8px);
    min-width: 0;
    min-height: 0;
    padding: 4px 12px 2px;
    border: 0;
    background: transparent;
    color: #111111;
    font-family: "Arial Narrow", Arial, Helvetica, sans-serif;
    font-size: min(var(--plate-font-size, 56px), 13.2cqw, 56px);
    font-weight: 800;
    letter-spacing: 0;
    line-height: normal;
    text-align: center;
    text-transform: uppercase;
}

.plate-field:placeholder-shown {
    padding: 4px 12px 2px;
    font-size: min(40px, 9cqw);
}

.plate-field::placeholder {
    color: #a3aab2;
    opacity: 1;
}

.plate-field:focus {
    outline: none;
}

.plate-field:focus::placeholder {
    color: transparent;
}

.parking-time-step {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--tenant-border, #cdd5dd);
    border-radius: var(--tenant-panel-radius, 8px);
    background: #f9fafb;
}

.parking-time-step label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--tenant-text, #2c3440);
    font-size: 0.95rem;
    font-weight: 650;
}

.parking-time-step label span {
    color: #687480;
    font-size: 0.76rem;
    font-weight: 750;
    text-transform: uppercase;
}

.field-group {
    display: grid;
    gap: 8px;
}

.field-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #2c3440;
    font-size: 0.95rem;
    font-weight: 650;
}

.field-group label span {
    color: #687480;
    font-size: 0.76rem;
    font-weight: 650;
    text-transform: uppercase;
}

.field-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--tenant-border, #b8c1ca);
    border-radius: var(--tenant-control-radius, 6px);
    background: #ffffff;
    color: #17202a;
}

.field-input:focus {
    border-color: var(--tenant-primary, #0f766e);
    outline: 3px solid color-mix(in srgb, var(--tenant-primary, #0f766e) 18%, transparent);
}

.lookup-segments {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--tenant-border, #cdd5dd);
    border-radius: var(--tenant-panel-radius, 8px);
    background: #eef1f4;
}

.lookup-segments button {
    min-height: 40px;
    border: 0;
    border-radius: var(--tenant-control-radius, 6px);
    background: transparent;
    color: #2c3440;
    cursor: pointer;
    font-weight: 650;
}

.lookup-segments button.active {
    background: var(--tenant-primary, #0f766e);
    color: var(--tenant-button-text, #ffffff);
}

.lookup-segments button:disabled {
    color: #8a949e;
    cursor: not-allowed;
}

.primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border: 0;
    border-radius: var(--tenant-control-radius, 6px);
    background: var(--tenant-primary, #0f766e);
    color: var(--tenant-button-text, #ffffff);
    cursor: pointer;
    font-weight: 750;
}

.primary-action:disabled {
    background: #8fa29f;
    cursor: wait;
}

.status-message {
    margin-top: 18px;
    padding: 12px;
    border-left: 4px solid var(--tenant-primary, #0f766e);
    background: #edf7f5;
    color: #134e4a;
    border-radius: 6px;
}

.status-message.warning {
    border-left-color: var(--tenant-accent, #e11d48);
    background: #fff1f3;
    color: #881337;
}

.receipt-panel {
    width: min(100%, 560px);
    min-height: 0;
    overflow: hidden;
    scroll-margin-top: 24px;
}

.receipt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 82px;
    padding: 18px 20px;
    border-bottom: 1px solid #e2e6ea;
}

.receipt-canvas {
    display: grid;
    min-height: clamp(460px, 72vh, 820px);
    place-items: center;
    padding: 0;
    background: #f5f7f9;
}

.icon-button {
    display: inline-grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--tenant-border, #cdd5dd);
    border-radius: var(--tenant-control-radius, 8px);
    background: var(--tenant-surface, #ffffff);
    color: var(--tenant-primary, #0f766e);
    text-decoration: none;
}

.icon-button svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.transaction-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid #e2e6ea;
    background: #f9fafb;
}

.transaction-row {
    display: grid;
    gap: 3px;
    min-height: 72px;
    padding: 10px;
    border: 1px solid var(--tenant-border, #cdd5dd);
    border-radius: var(--tenant-control-radius, 6px);
    background: var(--tenant-surface, #ffffff);
    color: #17202a;
    text-align: left;
    cursor: pointer;
}

.transaction-row.active {
    border-color: var(--tenant-primary, #0f766e);
    box-shadow: inset 0 0 0 1px var(--tenant-primary, #0f766e);
}

.transaction-row span,
.transaction-row small {
    color: #687480;
}

.transaction-row strong {
    overflow-wrap: anywhere;
    font-size: 1rem;
}

.pdf-frame {
    display: block;
    width: 100%;
    height: clamp(460px, 72vh, 820px);
    border: 0;
    border-radius: 0;
    background: var(--tenant-surface, #ffffff);
    box-shadow: none;
}

.empty-state {
    display: grid;
    min-height: 360px;
    place-items: center;
    padding: 28px;
    text-align: center;
}

.receipt-empty-state {
    width: min(100%, 420px);
    min-height: 0;
    aspect-ratio: 0.58;
    box-shadow: 0 16px 36px rgb(23 32 42 / 10%);
}

.empty-state h1,
.empty-state h3 {
    font-size: 1.1rem;
}

.validation-message,
.validation-errors {
    color: #b42318;
    font-size: 0.9rem;
}

.blazor-error-boundary {
    padding: 1rem;
    color: white;
    background: #b32121;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

#blazor-error-ui {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    display: none;
    padding: 12px 16px;
    border-radius: 8px;
    background: #b32121;
    color: #ffffff;
}

#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
    color: #ffffff;
}

@media (max-width: 880px) {
    .brand-bar {
        align-items: flex-start;
        padding: 18px;
    }

    .brand-identity {
        align-items: flex-start;
    }

    .language-toggle {
        min-width: 64px;
        padding-inline: 10px;
    }

    .receipt-workbench {
        grid-template-columns: 1fr;
        justify-items: stretch;
        width: calc(100% - 24px);
        margin: 12px auto;
    }

    .lookup-panel {
        padding: 18px;
    }

    .receipt-panel {
        min-height: 520px;
    }

    .receipt-canvas {
        min-height: 72vh;
        padding: 0;
    }

    .pdf-frame {
        width: 100%;
        height: 72vh;
    }

    .plate-entry {
        min-height: 210px;
        padding-block: 18px;
    }

    .eu-plate {
        width: min(100%, 420px);
    }

    .plate-field {
        height: calc(100% - 12px);
        padding: 7px 10px 1px;
        font-size: min(var(--plate-font-size, 52px), 12.8cqw, 52px);
    }

    .plate-field:placeholder-shown {
        padding: 7px 10px 1px;
        font-size: min(34px, 9.5cqw);
    }

    .parking-time-step {
        overflow: hidden;
        padding: 12px;
    }

    .parking-time-input {
        padding-inline: 10px;
        font-size: 0.95rem;
    }
}
