:root {
    --shop-bg: #0f172a;
    --shop-panel: #111827;
    --shop-card: #1f2937;
    --shop-border: #374151;
    --shop-text: #f9fafb;
    --shop-muted: #9ca3af;
    --shop-accent: #f97316;
    --shop-accent-dark: #ea580c;
    --shop-success: #22c55e;
    --shop-danger: #ef4444;
    --shop-radius: 16px;
    --shop-shadow: 0 20px 40px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }

body.shop-app {
    margin: 0;
    min-height: 100vh;
    background: var(--shop-bg);
    color: var(--shop-text);
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Login */
body.shop-login-page {
    margin: 0;
    min-height: 100vh;
    background: #0b1220;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}

.login-brand {
    background: linear-gradient(145deg, #1e3a8a 0%, #0f172a 55%, #7c2d12 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-brand-inner { max-width: 420px; }

.login-badge {
    display: inline-block;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #fde68a;
}

.login-brand h1 {
    font-size: 48px;
    margin: 16px 0 8px;
    color: white;
}

.login-brand p {
    color: rgba(255,255,255,.82);
    line-height: 1.6;
    font-size: 18px;
}

.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #fff;
}

.login-form {
    width: 100%;
    max-width: 380px;
}

.login-form h2 {
    margin: 0 0 8px;
    color: #111827;
    font-size: 28px;
}

.login-sub {
    margin: 0 0 24px;
    color: #6b7280;
}

.login-form label {
    display: block;
    margin-bottom: 16px;
}

.login-form label span {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 15px;
}

.login-form input:focus {
    outline: none;
    border-color: var(--shop-accent);
    box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}

/* Buttons */
.shop-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: .2s;
}

.shop-btn-primary {
    background: linear-gradient(135deg, var(--shop-accent), var(--shop-accent-dark));
    color: white;
}

.shop-btn-primary:hover { filter: brightness(1.05); }

.shop-btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.shop-btn-block { width: 100%; }

.shop-alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
}

.shop-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* POS top bar */
.pos-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: rgba(17,24,39,.95);
    border-bottom: 1px solid var(--shop-border);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.pos-brand strong {
    display: block;
    font-size: 20px;
}

.pos-brand span {
    color: var(--shop-muted);
    font-size: 13px;
}

.pos-topbar-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.pos-pill {
    background: rgba(34,197,94,.15);
    color: #86efac;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.pos-staff { color: var(--shop-muted); font-size: 13px; }

.pos-link {
    color: #fca5a5;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

/* POS layout */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    min-height: calc(100vh - 62px);
}

.pos-catalog {
    padding: 20px;
    overflow: auto;
}

.pos-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
}

.pos-search {
    flex: 1;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid var(--shop-border);
    background: var(--shop-card);
    color: white;
    font-size: 15px;
}

.pos-search:focus {
    outline: none;
    border-color: var(--shop-accent);
}

.pos-count {
    color: var(--shop-muted);
    font-size: 13px;
    white-space: nowrap;
}

.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.pos-product {
    background: var(--shop-card);
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius);
    overflow: hidden;
    text-align: left;
    cursor: pointer;
    color: inherit;
    transition: transform .15s, border-color .15s, box-shadow .15s;
    padding: 0;
}

.pos-product:hover {
    transform: translateY(-2px);
    border-color: var(--shop-accent);
    box-shadow: var(--shop-shadow);
}

.pos-product-img {
    aspect-ratio: 1;
    background: #111827;
    overflow: hidden;
}

.pos-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pos-no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    background: linear-gradient(135deg, #1f2937, #374151);
}

.pos-product-body {
    padding: 12px;
}

.pos-product-body strong {
    display: block;
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 4px;
}

.pos-sku {
    display: block;
    font-size: 11px;
    color: var(--shop-muted);
    margin-bottom: 8px;
}

.pos-product-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.pos-price {
    color: #fdba74;
    font-weight: 800;
    font-size: 15px;
}

.pos-stock {
    font-size: 11px;
    color: #86efac;
    background: rgba(34,197,94,.12);
    padding: 3px 8px;
    border-radius: 999px;
}

.pos-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--shop-muted);
}

/* Cart */
.pos-cart {
    background: #0b1220;
    border-left: 1px solid var(--shop-border);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 62px);
}

.pos-cart-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 18px 10px;
}

.pos-cart-head h2 {
    margin: 0;
    font-size: 20px;
}

.pos-clear {
    background: transparent;
    border: none;
    color: #fca5a5;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}

.pos-cart-items {
    flex: 1;
    overflow: auto;
    padding: 0 18px;
}

.pos-cart-empty {
    text-align: center;
    color: var(--shop-muted);
    padding: 40px 10px;
}

.cart-line {
    background: var(--shop-card);
    border: 1px solid var(--shop-border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
}

.cart-line-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.cart-line-top strong { font-size: 14px; }

.cart-remove {
    background: rgba(239,68,68,.15);
    color: #fca5a5;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.cart-line-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--shop-muted);
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #111827;
    border-radius: 10px;
    padding: 4px;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: #374151;
    color: white;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    touch-action: manipulation;
}

.qty-btn:hover {
    background: var(--shop-accent);
}

.qty-value {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    color: white;
}

.pos-checkout {
    padding: 18px;
    border-top: 1px solid var(--shop-border);
    background: rgba(17,24,39,.85);
}

.pos-summary {
    margin-bottom: 14px;
}

.pos-summary > div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.pos-discount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.pos-discount input {
    width: 110px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--shop-border);
    background: var(--shop-card);
    color: white;
    text-align: right;
}

.pos-total-row {
    font-size: 18px;
    padding-top: 10px;
    border-top: 1px dashed var(--shop-border);
    margin-top: 8px;
}

.pos-total-row strong { color: #fdba74; }

.pos-pay-methods {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.pay-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--shop-border);
    background: var(--shop-card);
    font-size: 13px;
    cursor: pointer;
}

.pay-option:has(input:checked) {
    border-color: var(--shop-accent);
    background: rgba(249,115,22,.12);
}

.pay-option input { accent-color: var(--shop-accent); }

#checkoutBtn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* Receipt */
body.shop-receipt-page {
    margin: 0;
    background: #eef2f7;
    font-family: 'Segoe UI', system-ui, sans-serif;
    padding: 24px;
}

.receipt-actions {
    max-width: 360px;
    margin: 0 auto 16px;
    display: flex;
    gap: 10px;
}

.receipt-paper {
    max-width: 360px;
    margin: 0 auto;
    background: white;
    padding: 24px 22px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(15,23,42,.12);
}

.receipt-head {
    text-align: center;
    border-bottom: 2px dashed #d1d5db;
    padding-bottom: 14px;
    margin-bottom: 14px;
}

.receipt-head h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: .04em;
}

.receipt-head p {
    margin: 6px 0 0;
    color: #6b7280;
    font-size: 13px;
}

.receipt-meta {
    margin-bottom: 14px;
    font-size: 13px;
}

.receipt-meta div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.receipt-meta span { color: #6b7280; }

.receipt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 14px;
}

.receipt-table th,
.receipt-table td {
    padding: 6px 0;
    border-bottom: 1px dotted #e5e7eb;
}

.receipt-table th {
    text-align: left;
    color: #6b7280;
    font-weight: 600;
}

.receipt-table th:not(:first-child),
.receipt-table td:not(:first-child) {
    text-align: right;
}

.receipt-totals {
    border-top: 2px solid #111827;
    padding-top: 10px;
    font-size: 14px;
}

.receipt-totals div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.receipt-grand {
    font-size: 18px;
    font-weight: 800;
    margin-top: 8px;
}

.receipt-footer {
    text-align: center;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed #d1d5db;
    color: #6b7280;
    font-size: 12px;
}

.receipt-welcome {
    margin-top: 8px;
    color: #111827;
    font-weight: 700;
}

@media (max-width: 960px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { min-height: 220px; }
    .pos-layout { grid-template-columns: 1fr; }
    .pos-cart { min-height: auto; border-left: none; border-top: 1px solid var(--shop-border); }
}

@media print {
    body.shop-receipt-page {
        background: white;
        padding: 0;
    }
    .no-print { display: none !important; }
    .receipt-paper {
        box-shadow: none;
        max-width: none;
        width: 80mm;
        padding: 0;
    }
}
