:root {
    --bg: #f4f0ea;
    --surface: #ffffff;
    --surface-soft: #faf7f3;
    --ink: #181513;
    --muted: #6e645d;
    --line: #e5ddd5;
    --brand: #1f1f1f;
    --brand-soft: #ef542d;
    --confirm: #56bf2b;
    --danger: #d84867;
    --shadow: 0 18px 40px rgba(17, 22, 31, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.88), transparent 18rem),
        linear-gradient(180deg, #f4f0ea 0%, #efe8df 100%);
    color: var(--ink);
    font-family: "Inter", sans-serif;
}

input,
select,
button {
    font: inherit;
}

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

input:focus,
select:focus {
    outline: none;
    border-color: #1e1e1e;
    box-shadow: 0 0 0 4px rgba(31, 31, 31, 0.08);
}

button {
    border: 0;
    cursor: pointer;
}

.hidden,
.pos-shell--hidden {
    display: none !important;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card,
.receipt-card,
.panel-block,
.topbar {
    background: var(--surface);
    border: 1px solid rgba(229, 221, 213, 0.92);
    box-shadow: var(--shadow);
}

.login-card {
    width: min(460px, 100%);
    border-radius: 24px;
    padding: 32px;
    display: grid;
    gap: 18px;
}

.eyebrow {
    margin: 0;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}

.login-card h1,
.topbar h1,
.receipt-panel h2,
.panel-block h3 {
    margin: 0;
    font-family: "Outfit", sans-serif;
    letter-spacing: -0.04em;
}

.login-copy,
.login-message,
.topbar-copy,
.receipt-note,
.message-box {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.login-form,
.form-grid {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
}

label span,
.meta-pill span,
.bag-stat,
th,
.total-line span {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.primary-button,
.ghost-button,
.action-button,
.confirm-button {
    min-height: 44px;
    border-radius: 12px;
    padding: 0 16px;
}

.primary-button {
    background: var(--brand);
    color: #fff;
}

.ghost-button,
.action-button {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}

.confirm-button {
    background: var(--confirm);
    color: #fff;
    font-weight: 700;
}

.pos-shell {
    min-height: 100vh;
    padding: 22px;
    display: grid;
    gap: 16px;
}

.topbar {
    border-radius: 22px;
    padding: 18px 20px;
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 18px;
}

.topbar h1 {
    font-size: clamp(1.9rem, 3vw, 2.6rem);
}

.topbar-meta {
    display: flex;
    gap: 10px;
    align-items: start;
    flex-wrap: wrap;
}

.meta-pill {
    min-width: 128px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    display: grid;
    gap: 4px;
}

.meta-pill strong {
    font-size: 0.92rem;
}

.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.95fr);
    gap: 16px;
}

.receipt-panel,
.controls-panel {
    display: grid;
    gap: 14px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
}

.bag-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bag-stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
}

.receipt-card {
    border-radius: 24px;
    padding: 18px;
    display: grid;
    gap: 14px;
}

.receipt-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.receipt-meta {
    display: grid;
    gap: 4px;
    justify-items: end;
    color: var(--muted);
    font-size: 0.84rem;
}

.table-wrap,
.results-list {
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: auto;
    background: #fff;
}

.receipt-table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: 0.86rem;
    vertical-align: top;
}

th {
    background: var(--surface-soft);
}

.empty-cell {
    color: var(--muted);
}

.cart-item {
    display: grid;
    gap: 2px;
}

.cart-item strong {
    font-size: 0.9rem;
}

.cart-meta {
    color: var(--muted);
    font-size: 0.76rem;
}

.qty-input {
    width: 78px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 10px;
}

.row-remove {
    min-height: 34px;
    min-width: 34px;
    border-radius: 10px;
    background: #f5e6ea;
    color: #a1354e;
    font-weight: 700;
}

.receipt-note,
.message-box {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: 10px 12px;
}

.totals-box {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    display: grid;
    gap: 8px;
}

.total-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.total-line strong {
    font-family: "Outfit", sans-serif;
    font-size: 1rem;
}

.total-line--discount strong {
    color: var(--danger);
}

.total-line--grand strong {
    font-size: 1.55rem;
}

.panel-block {
    border-radius: 22px;
    padding: 18px;
    display: grid;
    gap: 12px;
}

.searchbar {
    display: flex;
    gap: 10px;
}

.searchbar input {
    flex: 1;
}

.results-list {
    max-height: 360px;
}

.result-card {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 8px;
}

.result-card:last-child {
    border-bottom: 0;
}

.result-card__head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.result-card__title {
    display: grid;
    gap: 4px;
}

.result-card__title strong {
    font-size: 0.95rem;
}

.result-card__meta {
    color: var(--muted);
    font-size: 0.78rem;
}

.result-card__actions {
    display: grid;
    grid-template-columns: 86px 110px 1fr auto;
    gap: 8px;
    align-items: center;
}

.result-card__qty,
.result-card__price {
    min-height: 38px;
}

.result-add {
    min-height: 38px;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    padding: 0 14px;
    font-weight: 700;
}

.action-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.barcode-text {
    font-family: "Outfit", sans-serif;
    letter-spacing: 0.05em;
    font-weight: 700;
}

@media print {
    body {
        background: #fff;
    }

    .topbar,
    .controls-panel,
    .login-screen {
        display: none !important;
    }

    .pos-shell {
        padding: 0;
    }

    .pos-layout {
        display: block;
    }

    .receipt-card {
        box-shadow: none;
        border: 0;
        padding: 0;
    }
}

@media (max-width: 1100px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .topbar,
    .panel-head,
    .searchbar,
    .result-card__head,
    .result-card__actions {
        grid-template-columns: 1fr;
        display: grid;
    }

    .topbar {
        display: grid;
    }

    .action-bar {
        grid-template-columns: 1fr;
    }
}
