:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --ink: #16181d;
    --muted: #687182;
    --line: #dfe4ea;
    --accent: #0f766e;
    --accent-dark: #0b5f59;
    --danger: #b42318;
    --shadow: 0 16px 45px rgba(22, 24, 29, 0.08);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.lock-screen {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.16), rgba(217, 119, 6, 0.11)),
        var(--bg);
    display: flex;
    min-height: 100vh;
    padding: 24px;
}

.pin-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 0 auto;
    max-width: 390px;
    padding: 28px;
    width: 100%;
}

.pin-panel h1,
.topbar h1 {
    font-size: 28px;
    line-height: 1.1;
    margin: 4px 0 0;
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0;
    text-transform: uppercase;
}

.pin-panel label,
.checkout-box label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    font-weight: 700;
    gap: 7px;
    margin-top: 18px;
}

input,
select {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    min-height: 44px;
    padding: 10px 12px;
    width: 100%;
}

input:focus,
select:focus,
button:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.22);
    outline-offset: 2px;
}

.pin-panel button,
.checkout-button {
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    color: white;
    font-weight: 800;
    min-height: 48px;
    margin-top: 20px;
    width: 100%;
}

.checkout-button:not(:disabled):hover,
.pin-panel button:hover {
    background: var(--accent-dark);
}

.checkout-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.payment-buttons {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 20px;
}

.payment-button {
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    color: #fff;
    font-size: 17px;
    font-weight: 900;
    min-height: 56px;
}

.payment-button[data-payment="card"] {
    background: #2563eb;
}

.payment-button[data-payment="qr"] {
    background: #d97706;
}

.payment-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.form-error,
.checkout-message {
    color: var(--danger);
    font-size: 13px;
    font-weight: 700;
    min-height: 18px;
}

.app-shell {
    margin: 0 auto;
    max-width: 1240px;
    padding: 20px;
}

.topbar,
.panel-heading,
.receipt-heading {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.topbar {
    margin-bottom: 18px;
}

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

.ghost-button,
.link-button {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    display: inline-flex;
    font-size: 14px;
    font-weight: 800;
    justify-content: center;
    min-height: 40px;
    padding: 0 12px;
    text-decoration: none;
}

.link-button {
    border: 0;
    color: var(--accent);
    min-height: 32px;
}

.summary-strip {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
}

.summary-strip article,
.catalog-panel,
.cart-panel,
.receipt-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.summary-strip article {
    padding: 14px;
}

.summary-strip span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.summary-strip strong {
    font-size: 24px;
}

.workspace {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) 390px;
}

.catalog-panel,
.cart-panel {
    padding: 16px;
}

.panel-heading h2,
.receipt-heading h2 {
    font-size: 18px;
    margin: 0;
}

.panel-heading input {
    max-width: 240px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    overflow-x: auto;
    padding-bottom: 2px;
}

.tabs button {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 800;
    min-height: 38px;
    padding: 0 14px;
}

.tabs button.active {
    background: #e7f5f3;
    border-color: #8fd3ca;
    color: var(--accent-dark);
}

.product-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.product-card {
    align-items: start;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 9px;
    min-height: 124px;
    padding: 14px;
    text-align: left;
}

.product-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.swatch {
    background: var(--swatch);
    border: 1px solid rgba(22, 24, 29, 0.12);
    border-radius: 999px;
    height: 20px;
    width: 20px;
}

.product-name {
    font-weight: 850;
    line-height: 1.2;
}

.product-price {
    color: var(--muted);
    font-weight: 800;
}

.cart-panel {
    position: sticky;
    top: 16px;
}

.cart-items {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 10px;
    margin-top: 14px;
    max-height: 330px;
    overflow: auto;
    padding-bottom: 14px;
}

.cart-items.empty {
    color: var(--muted);
    display: block;
    font-weight: 700;
    padding: 26px 0;
    text-align: center;
}

.cart-row {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) 104px 72px;
}

.cart-row strong,
.cart-row span {
    display: block;
}

.cart-row strong {
    line-height: 1.2;
}

.cart-row span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    margin-top: 3px;
}

.cart-row b {
    text-align: right;
}

.stepper {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    grid-template-columns: 32px 1fr 32px;
    min-height: 36px;
    overflow: hidden;
}

.stepper button {
    background: #f7f9fb;
    border: 0;
    font-size: 18px;
    font-weight: 900;
    height: 36px;
}

.stepper output {
    font-weight: 850;
    text-align: center;
}

.checkout-box {
    display: grid;
    gap: 2px;
}

.totals {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 9px;
    margin: 16px 0 0;
    padding-top: 14px;
}

.totals div {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.totals dt {
    color: var(--muted);
    font-weight: 800;
}

.totals dd {
    font-weight: 850;
    margin: 0;
}

.grand-total {
    font-size: 24px;
}

.receipt-panel {
    box-shadow: none;
    margin-top: 14px;
    padding: 14px;
}

.receipt-panel pre {
    background: #f7f9fb;
    border: 1px dashed var(--line);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    margin: 12px 0 0;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
}

.admin-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 16px;
    padding: 16px;
}

.product-form {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 12px;
    grid-template-columns: 1.2fr 130px 1fr 86px 110px 150px;
    margin-top: 14px;
    padding-bottom: 14px;
}

.product-form label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    font-weight: 800;
    gap: 6px;
}

.product-form input[type="color"] {
    padding: 4px;
}

.checkbox-label {
    align-content: end;
    grid-template-columns: 18px 1fr;
}

.checkbox-label input {
    min-height: auto;
    width: 18px;
}

.product-form .checkout-button {
    align-self: end;
    margin: 0;
}

.product-form .checkout-message {
    grid-column: 1 / -1;
    margin: 0;
}

.admin-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.admin-row,
.transaction-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.admin-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: 24px minmax(0, 1fr) 76px 92px;
}

.admin-row strong,
.transaction-row strong {
    display: block;
    line-height: 1.25;
}

.admin-row span,
.transaction-row span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-top: 3px;
}

.admin-row button {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-weight: 800;
    min-height: 36px;
}

.transaction-row {
    display: grid;
    gap: 6px;
}

.transaction-row.voided {
    background: #f7f7f7;
    opacity: 0.78;
}

.transaction-row mark {
    background: #fee4e2;
    border-radius: 4px;
    color: var(--danger);
    display: inline-block;
    font-size: 12px;
    font-weight: 900;
    margin-left: 8px;
    padding: 2px 6px;
}

.transaction-row button {
    background: #fff;
    border: 1px solid #f3b1aa;
    border-radius: 6px;
    color: var(--danger);
    font-weight: 900;
    justify-self: start;
    min-height: 36px;
    padding: 0 14px;
}

.transaction-row p,
.transaction-row em,
.empty-note {
    color: var(--muted);
    font-size: 14px;
    font-style: normal;
    font-weight: 700;
    margin: 0;
}

.modal-backdrop {
    align-items: center;
    background: rgba(22, 24, 29, 0.56);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 18px;
    position: fixed;
    z-index: 50;
}

.success-modal {
    background: var(--panel);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(22, 24, 29, 0.24);
    max-width: 460px;
    padding: 24px;
    width: min(100%, 460px);
}

.success-modal h2 {
    color: var(--accent-dark);
    font-size: 56px;
    line-height: 1;
    margin: 8px 0 20px;
}

.success-items {
    border-bottom: 1px solid var(--line);
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
    max-height: 220px;
    overflow: auto;
    padding: 14px 0;
}

.success-items div,
.success-total div {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.success-items span {
    font-weight: 800;
    line-height: 1.25;
}

.success-items strong {
    flex: 0 0 auto;
}

.success-total {
    display: grid;
    gap: 8px;
    margin: 16px 0 0;
}

.success-total dt {
    color: var(--muted);
    font-weight: 800;
}

.success-total dd {
    font-size: 20px;
    font-weight: 900;
    margin: 0;
    text-align: right;
}

.modal-actions {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr;
    margin-top: 20px;
}

.modal-actions .checkout-button {
    margin: 0;
}

@media (max-width: 860px) {
    .app-shell {
        padding: 14px;
    }

    .topbar,
    .panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions,
    .panel-heading input {
        max-width: none;
        width: 100%;
    }

    .ghost-button {
        flex: 1;
    }

    .summary-strip,
    .workspace {
        grid-template-columns: 1fr;
    }

    .cart-panel {
        position: static;
    }

    .product-form {
        grid-template-columns: 1fr 1fr;
    }

    .product-form .checkout-button,
    .product-form .checkout-message {
        grid-column: 1 / -1;
    }
}

@media (max-width: 520px) {
    .summary-strip {
        gap: 8px;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .summary-strip article {
        padding: 10px;
    }

    .summary-strip strong {
        font-size: 17px;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cart-row {
        grid-template-columns: minmax(0, 1fr) 96px;
    }

    .cart-row b {
        grid-column: 1 / -1;
    }

    .payment-buttons {
        grid-template-columns: 1fr;
    }

    .product-form,
    .admin-row {
        grid-template-columns: 1fr;
    }

    .admin-row .swatch {
        display: none;
    }

    .success-modal {
        padding: 20px;
    }

    .success-modal h2 {
        font-size: 46px;
    }

    .modal-actions {
        grid-template-columns: 1fr;
    }
}

@media print {
    body * {
        visibility: hidden;
    }

    .receipt-panel,
    .receipt-panel *,
    .success-modal,
    .success-modal * {
        visibility: visible;
    }

    .receipt-panel {
        border: 0;
        box-shadow: none;
        left: 0;
        position: absolute;
        top: 0;
        width: 80mm;
    }

    .receipt-heading button {
        display: none;
    }

    .modal-backdrop,
    .success-modal {
        background: white;
        box-shadow: none;
        left: 0;
        position: absolute;
        top: 0;
    }

    .success-modal {
        display: none;
    }
}
