:root {
    --ink: #1c2333;
    --ink-soft: #55607a;
    --line: #e2e5ec;
    --bg: #f6f7fa;
    --panel: #ffffff;
    --accent: #2454ff;
    --accent-ink: #ffffff;
    --good: #147a4a;
    --bad: #b3261e;
    --warn: #a5620a;
    --radius: 8px;
    font-size: 15px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: var(--ink);
    color: #cdd3e6;
    padding: 20px 0;
    flex-shrink: 0;
}
.sidebar .brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 12px;
}
.sidebar .biz-type {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: #8a93ad;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}
.sidebar nav a {
    display: block;
    padding: 10px 20px;
    color: #cdd3e6;
    font-size: 0.92rem;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}
.sidebar .user-box {
    margin-top: 24px;
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.85rem;
}

.main { flex: 1; padding: 28px 32px; max-width: 1200px; }

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
.subtitle { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 22px; }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; } }

.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    transition: box-shadow 0.15s, transform 0.15s;
}
.stat:hover { box-shadow: 0 4px 14px rgba(28,35,51,0.06); transform: translateY(-1px); }
.stat .label { font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.stat .value { font-size: 1.6rem; font-weight: 700; margin-top: 4px; }
.stat.warn .value { color: var(--warn); }

.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.icon-circle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    font-size: 1rem; flex-shrink: 0;
}
.icon-circle.blue   { background: #e5ebff; color: var(--accent); }
.icon-circle.purple { background: #f2e9fc; color: #a855f7; }
.icon-circle.green  { background: #e2f6ec; color: var(--good); }
.icon-circle.amber  { background: #fbeed9; color: var(--warn); }
.icon-circle.grey   { background: #eceef3; color: var(--ink-soft); }

.trend { font-size: 0.76rem; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.trend.up { color: var(--good); background: #e2f6ec; }
.trend.down { color: var(--bad); background: #fbe7e6; }
.trend.neutral { color: var(--ink-soft); background: #eceef3; }

.soft { color: var(--ink-soft); font-weight: 400; font-size: 0.82rem; }
.empty-hint { color: var(--ink-soft); font-size: 0.88rem; padding: 10px 0; }

/* ---- Onboarding checklist ---- */
.panel.onboarding { background: linear-gradient(135deg, #1c2333, #2a3350); border: none; color: #fff; }
.panel.onboarding h2 { color: #fff; }
.checklist { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.check-item {
    display: flex; align-items: center; gap: 14px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px; padding: 12px 14px;
}
.check-item .dot {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,0.14); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700; flex-shrink: 0;
}
.check-item.done .dot { background: var(--good); }
.check-item strong { font-size: 0.92rem; }
.check-item .hint { font-size: 0.8rem; color: #b7bedb; margin-top: 2px; }
.check-item { margin-right: auto; }
.check-item > div { flex: 1; }
.check-item .btn { flex-shrink: 0; }

/* ---- Top products bars ---- */
.top-products { display: flex; flex-direction: column; gap: 12px; }
.tp-label { display: flex; justify-content: space-between; font-size: 0.86rem; margin-bottom: 4px; }
.tp-bar-track { background: #eceef3; border-radius: 6px; height: 7px; overflow: hidden; }
.tp-bar-fill { background: linear-gradient(90deg, var(--accent), #6f8dff); height: 100%; border-radius: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.btn {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-ink);
    border: none;
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}
.btn:hover { background: #1a3fd6; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: #f2f3f6; }
.btn.danger { background: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 0.78rem; }

form.inline { display: inline; }

label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
input[type=text], input[type=number], input[type=password], input[type=email], input[type=tel], input[type=file], select, textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
    color: var(--ink);
    font-family: inherit;
}
.field { margin-bottom: 14px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.74rem; font-weight: 600; }
.badge.good { background: #e2f6ec; color: var(--good); }
.badge.bad { background: #fbe7e6; color: var(--bad); }
.badge.warn { background: #fbeed9; color: var(--warn); }
.badge.neutral { background: #eceef3; color: var(--ink-soft); }

.flash { padding: 11px 14px; border-radius: 6px; margin-bottom: 18px; font-size: 0.88rem; }
.flash.success { background: #e2f6ec; color: var(--good); }
.flash.error { background: #fbe7e6; color: var(--bad); }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
}
.login-card {
    background: #fff;
    border-radius: 10px;
    padding: 36px;
    width: 340px;
}
.login-card .brand { font-weight: 700; font-size: 1.3rem; margin-bottom: 4px; }
.login-card .tagline { color: var(--ink-soft); font-size: 0.85rem; margin-bottom: 24px; }

/* ---- Billing / POS screen ---- */
.pos-grid { display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start; }
#cart-table td, #cart-table th { padding: 7px 8px; }
.totals-box .row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 0.9rem; }
.totals-box .row.grand { font-size: 1.2rem; font-weight: 700; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }

/* ---- Print invoice ---- */
@media print {
    .no-print { display: none !important; }
    .main { padding: 0; max-width: 100%; }
    body { background: #fff; }
}
.invoice-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.invoice-header h1 { margin: 0; }