/* mysupershop — flat, compact, mobile-first UI.
   No gradients. Light palette. Tight spacing (Gmail-like density). */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #f0a000;
    --card: #f8f9fa;
    --border: #e3e6ea;
    --text: #202124;
    --muted: #5f6368;
    --sidebar-w: 220px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: #fff;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Flat buttons */
.btn { border-radius: 4px; font-size: 13px; padding: 6px 12px; font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 3px 8px; font-size: 12px; }

.form-control, .form-select {
    border-radius: 4px;
    font-size: 14px;
    border-color: var(--border);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26,115,232,.15);
}
.form-label { font-size: 12px; color: var(--muted); margin-bottom: 3px; font-weight: 500; }

/* Cards — flat, no shadow */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 6px; }
.card-tight { padding: 14px; }

/* ---------- Auth / guest screens ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #fff;
}
.auth-card {
    width: 100%;
    max-width: 360px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 22px;
}
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand .fa { color: var(--primary); }
.auth-brand h1 { font-size: 20px; margin: 6px 0 2px; }
.auth-brand small { color: var(--muted); }

/* ---------- App shell ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .2s ease;
}
.sidebar-brand {
    height: 48px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.sidebar-brand .fa { color: var(--primary); }
.sidebar-nav { padding: 6px; overflow-y: auto; flex: 1; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 5px;
    color: var(--text);
    font-size: 13px;
    margin-bottom: 1px;
}
.sidebar-nav a:hover { background: var(--card); text-decoration: none; }
.sidebar-nav a.active { background: rgba(26,115,232,.1); color: var(--primary); font-weight: 600; }
.sidebar-nav a .fa { width: 16px; text-align: center; }
.sidebar-nav a.nav-priority {
    font-weight: 700;
    background: rgba(26,115,232,.08);
    border: 1px solid rgba(26,115,232,.25);
    margin-bottom: 6px;
}
.sidebar-nav a.nav-priority:not(.active) { color: var(--primary); }
.sidebar-nav a.nav-priority.active { background: rgba(26,115,232,.16); }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 48px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.topbar .shop-name { font-weight: 600; font-size: 14px; }
.topbar-logo { height: 28px; width: 28px; object-fit: contain; border-radius: 4px; margin-right: 8px; }
.topbar .spacer { flex: 1; }

/* Icon buttons (bell, search) */
.icon-btn { background: none; border: none; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: background .15s; }
.icon-btn:hover { background: var(--card); color: var(--text); }

/* Notification bell badge */
.notif-bell { position: relative; }
.notif-badge { position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff; font-size: 9px; font-weight: 700; min-width: 14px; height: 14px; border-radius: 7px; display: flex; align-items: center; justify-content: center; padding: 0 2px; pointer-events: none; }
.notif-unread { background: #f0f6ff; }
.notif-item:hover { background: var(--card); }

/* Global search modal */
.search-result-row { color: var(--text); }
.search-result-row:hover { background: var(--card); color: var(--primary); text-decoration: none; }

/* Language flag buttons */
.btn-xs { font-size: 11px !important; padding: 2px 7px !important; line-height: 1.4; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 3px 10px;
    font-size: 12px;
    color: var(--text);
}
.chip .fa { font-size: 11px; }
.chip-btn { cursor: pointer; }
.chip-btn:hover { background: #eef1f4; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Status badges (flat) */
.badge-status { font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: 500; }
.s-pending { background: #fff4e0; color: var(--warning); }
.s-approved { background: #e6f4ea; color: var(--success); }
.s-suspended { background: #fce8e6; color: var(--danger); }

.content { padding: 14px; }

/* Mobile toggle */
.menu-toggle { display: none; background: none; border: none; font-size: 18px; color: var(--text); }
.sidebar-backdrop { display: none; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-block; }
    .sidebar-backdrop.show {
        display: block;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.3);
        z-index: 1035;
    }
}

/* Tables — compact */
.table-compact { font-size: 13px; }
.table-compact th { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.table-compact td, .table-compact th { padding: 8px 10px; vertical-align: middle; }

/* Stat cards */
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; }
.stat .n { font-size: 22px; font-weight: 600; }
.stat .l { font-size: 12px; color: var(--muted); }

/* ---------- Toggle switch ---------- */
.toggle { position: relative; display: inline-block; width: 34px; height: 18px; }
.toggle input { display: none; }
.toggle .slider {
    position: absolute; inset: 0; cursor: pointer;
    background: #ccc; border-radius: 18px; transition: .15s;
}
.toggle .slider::before {
    content: ""; position: absolute; height: 14px; width: 14px;
    left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s;
}
.toggle input:checked + .slider { background: var(--success); }
.toggle input:checked + .slider::before { transform: translateX(16px); }

/* ---------- Product table extras ---------- */
.thumb { width: 34px; height: 34px; border-radius: 4px; object-fit: cover; background: #eee; border: 1px solid var(--border); }
.thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.stock-badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #e6f4ea; color: var(--success); }
.stock-badge.low { background: #fce8e6; color: var(--danger); }
.stock-input { width: 56px; padding: 2px 4px; font-size: 12px; text-align: center; border: 1px solid var(--border); border-radius: 4px; }

/* ---------- Size / GST chips (selectable) ---------- */
.pick {
    display: inline-flex; align-items: center; gap: 4px;
    border: 1px solid var(--border); background: #fff;
    border-radius: 14px; padding: 3px 11px; font-size: 12px; cursor: pointer; user-select: none;
}
.pick:hover { background: var(--card); }
.pick.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Variant rows ---------- */
.variant-row { display: flex; gap: 6px; align-items: center; margin-bottom: 5px; }
.variant-row input { font-size: 12px; padding: 3px 6px; }
.swatch { width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--border); padding: 0; }

/* ---------- Slide-over panel ---------- */
.slideover-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 1050; display: none; }
.slideover-backdrop.show { display: block; }
.slideover {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 460px; max-width: 100%;
    background: #fff; border-left: 1px solid var(--border);
    z-index: 1055; transform: translateX(100%); transition: transform .2s ease;
    display: flex; flex-direction: column;
}
.slideover.show { transform: translateX(0); }
.slideover-head { height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.slideover-body { flex: 1; overflow-y: auto; padding: 14px; }
.slideover-foot { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Reports / KPIs ---------- */
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.kpi-ico { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.kpi .n { font-size: 20px; font-weight: 700; line-height: 1.1; }
.kpi .l { font-size: 11px; color: var(--muted); }
.report-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.report-tile { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px; text-decoration: none; color: var(--text); transition: border-color .15s; }
.report-tile:hover { border-color: var(--primary); text-decoration: none; }
.report-tile .fa { font-size: 22px; color: var(--primary); }

/* Skeleton loader */
.skel { background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%); background-size: 400% 100%; animation: skel 1.2s ease infinite; border-radius: 4px; }
.skel-line { height: 12px; margin: 6px 0; }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.chart-wrap { position: relative; height: 240px; }

/* ---------- Employees ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.role-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase; }
.role-owner { background: #efe6ff; color: #6f42c1; }
.role-manager { background: #e6f0ff; color: var(--primary); }
.role-cashier { background: #e6f4ea; color: var(--success); }
.role-stock_keeper { background: #fff4e0; color: var(--warning); }
.role-viewer { background: #eceff1; color: var(--muted); }

.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.lead-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.lead-rank { width: 22px; height: 22px; border-radius: 50%; background: var(--card); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }

/* ---------- POS full-screen ---------- */
/* POS layout — 3 columns: product panel | cart | checkout */
.pos-body { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.pos-topbar { height: 46px; display: flex; align-items: center; padding: 0 12px; border-bottom: 1px solid var(--border); background: #fff; }
.pos-main { flex: 1; display: flex; min-height: 0; }
.pos-products { width: 20%; min-width: 160px; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: #fff; }
.pos-products-head { padding: 8px; border-bottom: 1px solid var(--border); }
.pos-products-body { flex: 1; overflow-y: auto; }
.pp-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 12px; }
.pp-item:last-child { border-bottom: none; }
.pp-item-img { width: 36px; height: 36px; border-radius: 5px; object-fit: cover; flex-shrink: 0; background: #f1f5f9; }
.pp-item-noimg { display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 14px; }
.pp-item-info { flex: 1; min-width: 0; }
.pp-item-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-item-meta { color: var(--muted); font-size: 11px; }
.pp-item-stock { font-size: 11px; }
.pp-item-code { color: var(--muted); font-size: 10px; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-item-stock.low { color: var(--danger); }
.pp-item-stock.ok  { color: var(--success); }
.pp-item-stock.out { color: var(--muted); }
.pp-add { flex-shrink: 0; width: 26px; height: 26px; border: none; border-radius: 4px; background: var(--primary); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pp-add:disabled { background: #ccc; cursor: default; }
.pos-cart { width: 47%; display: flex; flex-direction: column; border-right: 1px solid var(--border); min-width: 0; }
.pos-checkout { width: 33%; display: flex; flex-direction: column; background: var(--card); }
.pos-scan { padding: 10px; border-bottom: 1px solid var(--border); background: #fff; }
.pos-scan input { font-size: 16px; }
.pos-cart-body { flex: 1; overflow-y: auto; padding: 6px 10px; }
.pos-checkout-body { flex: 1; overflow-y: auto; padding: 12px; }

.cart-row { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-bottom: 1px solid var(--border); }
.cart-row .ci-name { flex: 1; min-width: 0; }
.cart-row .ci-name strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-row .ci-meta { font-size: 11px; color: var(--muted); }
.qty-step { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.qty-step button { border: none; background: #fff; width: 24px; height: 24px; line-height: 1; cursor: pointer; }
.qty-step input { width: 36px; border: none; text-align: center; font-size: 13px; }
.cart-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); }
.cart-empty .fa { font-size: 40px; margin-bottom: 10px; }

.totline { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.totline.grand { font-size: 18px; font-weight: 700; border-top: 1px solid var(--border); padding-top: 7px; margin-top: 4px; }
.cust-result { padding: 6px 8px; border: 1px solid var(--border); border-top: none; cursor: pointer; font-size: 13px; background: #fff; }
.cust-result:hover { background: var(--card); }
.cust-box { position: relative; }
.cust-list { position: absolute; left: 0; right: 0; z-index: 20; max-height: 200px; overflow-y: auto; }
.btn-charge { width: 100%; font-size: 18px; font-weight: 700; padding: 12px; }
.qr-box { width: 120px; height: 120px; margin: 6px auto; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); background: #fff; }

@media (max-width: 768px) {
    .pos-main { flex-direction: column; overflow-y: auto; }
    .pos-products, .pos-cart, .pos-checkout { width: 100%; }
    .pos-products { max-height: 220px; }
}

/* Toasts */
#toast-area { position: fixed; top: 12px; right: 12px; z-index: 1080; }
.toast-msg {
    background: var(--text); color: #fff;
    padding: 9px 14px; border-radius: 5px; font-size: 13px;
    margin-bottom: 6px; min-width: 200px;
}
.toast-msg.err { background: var(--danger); }
.toast-msg.ok { background: var(--success); }

/* ---------- Inline barcodes (inventory list) ---------- */
.bc-list { display: flex; flex-direction: column; gap: 3px; }
.bc-row  { display: flex; align-items: center; gap: 6px; }
.bc-label { font-size: 10px; color: var(--muted); min-width: 28px; }
.bc-bars  { line-height: 0; /* strips extra inline-block gap below SVG bars */ }
.bc-bars svg, .bc-bars table { display: block; }
.bc-num  { font-size: 10px; color: var(--muted); font-family: monospace; user-select: all; }
