:root {
    --ink: #1c1730;
    --muted: #6d6780;
    --line: rgba(28, 23, 48, 0.08);
    --card: #ffffff;
    --violet: #6d28d9;
    --violet-deep: #5b21b6;
    --bg: #f6f4fb;
    --cheap: #15803d;
    --dear: #dc2626;
    --shadow: 0 18px 50px rgba(48, 24, 90, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(900px 420px at 10% -10%, rgba(167, 139, 250, 0.35), transparent 60%),
        radial-gradient(700px 380px at 100% 0%, rgba(251, 207, 232, 0.45), transparent 55%),
        var(--bg);
    font-family: "Plus Jakarta Sans", sans-serif;
}

a { color: var(--violet); text-decoration: none; }
h1, h2 { letter-spacing: -0.04em; margin: 0 0 0.4rem; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.15rem; }

.auth-body { min-height: 100vh; }
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
}
.auth-aside, .auth-card { padding: 3rem 2.2rem; }
.auth-aside { color: white; display: flex; flex-direction: column; justify-content: flex-end; background: linear-gradient(160deg, #2e1065, #6d28d9 55%, #c084fc); }
.auth-aside h1 { font-size: clamp(2rem, 4vw, 3.4rem); max-width: 12ch; }
.auth-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
}
.brand { font-weight: 700; letter-spacing: -0.04em; margin-bottom: 1rem; }
.auth-aside .brand { color: white; }
.lead-copy, .muted { color: var(--muted); }
.stack { display: grid; gap: 0.85rem; margin-top: 1rem; }
label { display: grid; gap: 0.35rem; font-size: 0.92rem; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], .item-name, .item-price, .item-qty {
    width: 100%;
    border: 1px solid var(--line);
    background: white;
    border-radius: 14px;
    padding: 0.85rem 0.95rem;
    font: inherit;
    color: var(--ink);
}
input:focus, .item-name:focus, .item-price:focus, .item-qty:focus {
    outline: 2px solid rgba(109, 40, 217, 0.25);
    border-color: transparent;
}
.check { display: flex; align-items: center; gap: 0.55rem; font-weight: 500; }
.btn {
    border: 0;
    border-radius: 999px;
    padding: 0.8rem 1.1rem;
    font-weight: 700;
}
.btn-primary { background: var(--violet); color: white; }
.btn-primary:hover { background: var(--violet-deep); color: white; }
.btn-ghost, .btn-soft { background: white; color: var(--ink); border: 1px solid var(--line); }
.btn-lg { width: 100%; }
.switch-link { margin-top: 1rem; }
.alert-note { border-radius: 14px; padding: 0.8rem 0.95rem; margin: 0.8rem 0; background: #fff7ed; }
.alert-success { background: #ecfdf3; }
.alert-warning { background: #fff7ed; }

.app-shell { max-width: 760px; margin: 0 auto; min-height: 100vh; padding-bottom: 6.5rem; }
.topbar, .dock {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar { padding: 1rem 1rem 0.2rem; }
.who { color: var(--muted); font-size: 0.92rem; }
.sheet { padding: 0.6rem 1rem 1rem; }
.dock {
    position: fixed;
    left: 50%;
    bottom: 0.7rem;
    transform: translateX(-50%);
    width: min(720px, calc(100% - 1rem));
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: 22px;
    padding: 0.45rem;
    z-index: 20;
    justify-content: space-around;
}
.dock a { color: var(--ink); font-size: 0.82rem; font-weight: 700; padding: 0.55rem; }

.hero-card, .block, .item-row, .auth-card, .scan-modal {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}
.hero-card, .block { padding: 1.2rem; margin-bottom: 0.9rem; }
.eyebrow { color: var(--violet); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.35rem; }
.choice-grid { display: grid; gap: 0.6rem; margin: 0.8rem 0 1rem; }
.choice {
    display: block;
    background: #faf8ff;
    border-radius: 16px;
    padding: 0.95rem 1rem;
    color: var(--ink);
    font-weight: 700;
    border: 1px solid transparent;
}
.choice input { margin-right: 0.4rem; }
.list { display: grid; gap: 0.55rem; }
.list-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 0.2rem;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
}
.list-row small, .price-hint { display: block; color: var(--muted); font-weight: 500; }
.list-row.static { align-items: flex-start; }
.inline-form { grid-template-columns: 1fr auto; align-items: end; }

.purchase-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 0.8rem; }
.save-state { font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.item-row { padding: 0.4rem 0.55rem 0.32rem; margin-bottom: 0.5rem; position: relative; border-radius: 18px; }
.item-main, .item-meta { display: flex; gap: 0.4rem; align-items: center; }
.item-main { min-height: 0; }
.item-name { flex: 1; min-width: 0; }
.item-photo {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #f4f1f8;
    overflow: hidden;
}
.item-photo-img { width: 100%; height: 100%; object-fit: contain; display: block; background: white; }
.item-row .item-name,
.item-row .item-price,
.item-row .item-qty {
    padding: 0.28rem 0.55rem;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    background: #fbfafe;
    border-color: rgba(28, 23, 48, 0.07);
}
.item-meta { margin-top: 0.28rem; margin-left: calc(40px + 0.4rem); }
.item-meta label { flex: 0 1 5.4rem; gap: 0.08rem; font-size: 0.7rem; font-weight: 600; color: var(--muted); }
.item-meta label:nth-child(2) { flex-basis: 3.4rem; }
.item-total { margin-left: auto; min-width: 4.6rem; text-align: right; font-size: 0.95rem; }
.item-row .price-hint { margin: 0.15rem 0 0 calc(40px + 0.4rem); font-size: 0.75rem; }
.icon-btn {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #faf8ff;
    font-size: 1rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
}
.item-remove { width: 30px; height: 30px; flex-basis: 30px; background: transparent; border-color: transparent; color: var(--muted); font-size: 1.15rem; }
.suggest {
    position: absolute;
    left: calc(0.55rem + 40px + 0.4rem);
    right: 3rem;
    top: 2.7rem;
    background: white;
    border-radius: 14px;
    border: 1px solid var(--line);
    z-index: 5;
    overflow: hidden;
}
.suggest button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: white;
    padding: 0.7rem 0.8rem;
}
.suggest button:hover { background: #f6f4fb; }
.app-toast {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 2000;
    max-width: calc(100% - 1.5rem);
    transform: translate(-50%, -42%);
    background: var(--ink);
    color: white;
    border-radius: 999px;
    padding: 0.7rem 1.05rem;
    font-size: 0.92rem;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.app-toast.is-on { opacity: 1; transform: translate(-50%, -50%); }
.is-cheaper { color: var(--cheap) !important; font-weight: 800; }
.is-expensive { color: var(--dear) !important; font-weight: 800; }
.cart-bar {
    position: sticky;
    bottom: 4.6rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 0.7rem;
    box-shadow: var(--shadow);
}
.cart-bar small { color: var(--muted); display: block; }
.cart-bar strong { font-size: 1.15rem; }
.total-line { font-size: 1.4rem; font-weight: 800; }
.barcode-scanner-viewport {
    background: #111;
    border-radius: 18px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}
.barcode-scanner-viewport video { width: 100%; height: 100%; object-fit: cover; }
.scan-modal { border: 0; }
#kt_barcode_scanner_torch.active { background: #fde68a; }

@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { min-height: 34vh; }
    .inline-form { grid-template-columns: 1fr; }
    .dock a { font-size: 0.74rem; }
}
