*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.demo-body {
    --demo-bg: #F9FAFB;
    --demo-panel: #FFFFFF;
    --demo-text: #111827;
    --demo-muted: #6B7280;
    --demo-line: #E5E7EB;
    --demo-primary: #0284C7;
    --demo-primary-dark: #0369A1;
    --demo-active: #E0F2FE;
    --demo-danger: #DC2626;
    --demo-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    background: var(--demo-bg);
    color: var(--demo-text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    padding-top: 0;
}

.demo-body .btn,
.demo-body button,
.demo-body input,
.demo-body select { border-radius: 8px; font-family: inherit; }

.demo-body .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    min-height: 40px;
    padding: 0 18px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: none;
}

.demo-body .btn-primary {
    background: var(--demo-primary);
    color: #fff;
}

.demo-body .btn-primary:hover { background: var(--demo-primary-dark); }

.demo-body .btn-ghost {
    background: #E5E7EB;
    color: #374151;
}

.demo-body .btn-block { width: 100%; }

.demo-body .btn-small { min-height: 36px; padding: 0 14px; font-size: 14px; }

.demo-shell { min-height: 100vh; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.demo-nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: 256px;
    background: #fff;
    border-right: 1px solid var(--demo-line);
    z-index: 40;
    padding: 16px 12px;
}

.demo-nav-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.demo-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 40px;
    padding: 10px 14px;
    border: 0;
    border-left: 4px solid transparent;
    background: transparent;
    color: #374151;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.demo-nav-item svg {
    width: 18px;
    height: 18px;
    color: #9CA3AF;
}

.demo-nav-item:hover,
.demo-nav-item.active {
    background: var(--demo-active);
    color: var(--demo-primary-dark);
    border-left-color: var(--demo-primary);
}

.demo-nav-item.active svg { color: var(--demo-primary); }

.demo-topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 256px;
    height: 65px;
    background: #fff;
    border-bottom: 1px solid var(--demo-line);
    z-index: 30;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.demo-topbar-inner {
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.demo-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #111827;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
}

.demo-brand img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.demo-top-actions {
    display: flex;
    align-items: center;
    gap: 22px;
}

.demo-user { text-align: right; line-height: 1.2; }
.demo-user strong { display: block; font-size: 14px; font-weight: 600; }
.demo-user span { color: var(--demo-muted); font-size: 12px; }
.demo-icon { color: #111827; font-size: 18px; }

.icon-button {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: #374151;
    font-size: 19px;
    text-decoration: none;
    cursor: pointer;
}

.icon-button:hover { background: #F3F4F6; }

.demo-layout { margin-left: 256px; padding-top: 65px; }

.demo-main {
    min-width: 0;
    padding: 32px;
}

.demo-notice {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #1E40AF;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    margin-bottom: 26px;
}

.demo-notice a { color: var(--demo-primary-dark); font-weight: 700; }
.demo-view { display: none; }
.demo-view.active { display: block; animation: fadeIn 0.18s ease; }

.view-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.view-head h1 {
    color: #111827;
    font-size: 32px;
    line-height: 1.1;
    font-weight: 800;
    margin: 0 0 6px;
}

.view-sub,
.view-date {
    color: var(--demo-muted);
    margin: 0;
    font-size: 14px;
}

.view-date { text-align: right; max-width: 260px; }

.panel {
    background: var(--demo-panel);
    border: 1px solid #EEF2F7;
    border-radius: 10px;
    box-shadow: var(--demo-shadow);
}

.panel h2 {
    font-size: 20px;
    margin: 0 0 18px;
    color: #1F2937;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(210px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.kpi {
    min-height: 154px;
    border-radius: 10px;
    padding: 26px 24px;
    color: #fff;
    box-shadow: var(--demo-shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

.kpi .k { font-size: 15px; font-weight: 500; opacity: 0.92; }
.kpi .v { font-size: 32px; line-height: 1.12; font-weight: 800; letter-spacing: -0.03em; color: #fff; }
.kpi .s { font-size: 13px; font-weight: 600; opacity: 0.9; }
.kpi-blue { background: linear-gradient(135deg, #3B82F6, #2563EB); }
.kpi-gold { background: linear-gradient(135deg, #FACC15, #EAB308); }
.kpi-red { background: linear-gradient(135deg, #F87171, #DC2626); }
.kpi-green { background: linear-gradient(135deg, #22C55E, #16A34A); }
.kpi-purple { background: linear-gradient(135deg, #A855F7, #9333EA); }
.kpi-orange { background: linear-gradient(135deg, #FB923C, #F97316); }
.kpi-cyan { background: linear-gradient(135deg, #0891B2, #0369A1); }

.dash-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.dash-cols .panel { padding: 24px; }
ul.leader-list, ul.recent-list, ul.stats-list { list-style: none; margin: 0; padding: 0; }

.leader-list li,
.recent-list li,
.stats-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 0;
    border-bottom: 1px solid var(--demo-line);
    color: #374151;
    font-size: 15px;
}

.leader-list li:last-child,
.recent-list li:last-child,
.stats-list li:last-child { border-bottom: 0; }
.leader-list .nm, .stats-list .nm { font-weight: 600; }
.leader-list .qt, .stats-list .qt { color: #4B5563; font-weight: 600; white-space: nowrap; }
.recent-list li { flex-wrap: wrap; }
.recent-list .ts { color: var(--demo-muted); font-size: 12px; }
.empty { color: var(--demo-muted); font-size: 14px; }

.product-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px;
    gap: 16px;
    padding: 24px;
    margin-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: none;
}

.product-toolbar input,
.product-toolbar select,
.report-filter input,
.field input,
.field select,
.cart-row input,
.pos-toolbar input,
.report-filter button {
    min-height: 44px;
    border: 1px solid #D1D5DB;
    background: #fff;
    color: #111827;
    padding: 10px 16px;
    font: inherit;
    font-size: 15px;
}

.product-toolbar input::placeholder,
.pos-toolbar input::placeholder { color: #9CA3AF; }
.product-toolbar + .panel { border-top-left-radius: 0; border-top-right-radius: 0; box-shadow: none; }

.table-scroll { overflow-x: auto; }
.demo-table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
.demo-table th {
    text-align: left;
    color: #6B7280;
    background: #F9FAFB;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 14px 24px;
    border-bottom: 1px solid var(--demo-line);
}
.demo-table td { padding: 16px 24px; border-bottom: 1px solid var(--demo-line); color: #111827; }
.demo-table td.ra, .demo-table th.ra { text-align: right; }
.demo-table small { display: block; color: var(--demo-muted); font-size: 13px; margin-top: 4px; }
.demo-table .price { font-weight: 800; }
.stock-low, .stock-out { color: var(--demo-danger); font-weight: 800; }
.stock-ok { color: #111827; font-weight: 800; }
.category-pill { display: inline-block; background: var(--demo-active); color: #075985; border: 1px solid #BAE6FD; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 700; }

.pos-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 334px;
    gap: 24px;
    align-items: start;
}

.pos-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--demo-shadow);
    padding: 14px;
    margin-bottom: 16px;
}

.pos-toolbar input { width: 132px; border-color: var(--demo-primary); }
.cat-chips { display: flex; gap: 8px; overflow-x: auto; }
.chip {
    min-height: 44px;
    border: 0;
    background: #E5E7EB;
    color: #374151;
    padding: 0 16px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.chip.active { background: var(--demo-primary); color: #fff; }

.prod-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(170px, 1fr));
    gap: 16px;
}

.prod-card {
    min-height: 132px;
    background: #fff;
    border: 1px solid #EEF2F7;
    border-radius: 8px;
    box-shadow: var(--demo-shadow);
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.prod-card.low .pc-stock,
.prod-card.out .pc-stock { color: var(--demo-danger); font-weight: 800; }
.prod-card.out { opacity: 0.58; }
.prod-card.out::after { content: "OUT"; position: absolute; right: 14px; bottom: 18px; color: #6B7280; background: #F3F4F6; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 800; }
.pc-name { color: #111827; font-size: 15px; line-height: 1.2; font-weight: 800; }
.pc-cat, .pc-stock { color: #6B7280; font-size: 13px; }
.pc-pkgs { margin-top: auto; }
.pkg {
    border: 0;
    background: transparent;
    color: var(--demo-primary);
    padding: 0;
    text-align: left;
    font-size: 0;
    cursor: pointer;
}
.pkg b { color: var(--demo-primary); font-size: 20px; font-weight: 800; }
.pkg:disabled { cursor: not-allowed; }

.pos-cart { padding: 24px; position: sticky; top: 89px; }
.cart-empty { min-height: 150px; display: grid; place-items: center; color: #9CA3AF; text-align: center; }
.cart-empty span { display: block; font-size: 46px; filter: grayscale(1); opacity: 0.55; }
.cart-empty p { margin: 8px 0 0; }
.cart-items { list-style: none; margin: 0 0 16px; padding: 0; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--demo-line); font-size: 13px; }
.cl-name { font-weight: 700; }
.cl-name em { color: var(--demo-muted); display: block; font-style: normal; font-weight: 500; }
.cl-q { display: flex; align-items: center; gap: 6px; }
.cl-q button { width: 24px; height: 24px; border: 1px solid #D1D5DB; background: #fff; cursor: pointer; }
.cl-q b { min-width: 16px; text-align: center; }
.cl-t { font-weight: 800; white-space: nowrap; }
.cl-del { border: 0; background: none; color: #9CA3AF; cursor: pointer; font-size: 18px; }
.cl-del:hover { color: var(--demo-danger); }
.cart-foot { border-top: 1px solid var(--demo-line); padding-top: 16px; }
.cart-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; color: #4B5563; font-size: 14px; }
.cart-row input { width: 112px; min-height: 32px; padding: 6px 10px; text-align: center; }
.cart-row.tot { color: #111827; font-size: 18px; font-weight: 800; }
.cart-row.tot strong { color: var(--demo-primary); font-size: 22px; }
.checkout-block { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .field-label { color: #374151; font-size: 14px; font-weight: 500; }
.pay-type-tabs { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #D1D5DB; border-radius: 8px; overflow: hidden; }
.pay-type-tabs button { border: 0; min-height: 56px; background: #fff; color: #374151; font-size: 14px; font-weight: 600; }
.pay-type-tabs button.active { background: var(--demo-primary); color: #fff; }
.pay-methods { display: none; }
.momo-ref[hidden] { display: none; }
.hint { color: var(--demo-muted); font-size: 12px; margin: 0; }
.receipt-ready {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #ECFDF5;
    border: 1px solid #BBF7D0;
    color: #166534;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
}
.receipt-ready[hidden] { display: none; }

.report-filter {
    display: grid;
    grid-template-columns: 1fr 1fr 135px 92px;
    gap: 16px;
    align-items: end;
    padding: 24px;
    margin-bottom: 24px;
}
.report-filter label { color: #374151; font-size: 14px; font-weight: 500; display: flex; flex-direction: column; gap: 8px; }
.report-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 24px; }
.mt-1 { margin-top: 24px; }

.receipt { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: grid; place-items: center; z-index: 80; padding: 16px; }
.receipt-pane { background: #F9FAFB; border-radius: 10px; max-width: 460px; width: 100%; max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(15,23,42,.22); }
.receipt-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--demo-line); }
.receipt-head h2 { font-size: 18px; margin: 0; }
.modal-close { border: 0; background: none; color: #6B7280; font-size: 24px; cursor: pointer; }
.receipt-paper {
    width: min(400px, calc(100% - 28px));
    margin: 18px auto;
    background: #fff;
    color: #111;
    font-family: Arial, sans-serif;
    font-size: 8pt;
    line-height: 1.32;
    padding: 20px 18px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
}
.rp-logo { text-align: center; margin-bottom: 8px; }
.rp-logo img { width: 74px; height: auto; }
.rp-identity { text-align: center; }
.rp-identity h3 { font-size: 26px; line-height: 1.05; letter-spacing: -0.04em; margin: 6px 0 8px; }
.rp-identity p { margin: 0; color: #4B5563; font-size: 12px; }
.rp-rule { border-top: 1px dashed #A3A3A3; margin: 24px 0 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; }
.rp-meta p,
.rp-pay p,
.rp-totals p { margin: 0; }
.rp-meta span,
.rp-customer span { display: block; color: #4B5563; }
.rp-meta b,
.rp-customer b { display: block; color: #111827; font-weight: 800; }
.rp-customer { border-top: 1px solid #F3F4F6; border-bottom: 1px solid #F3F4F6; margin: 22px 0 18px; padding: 12px 0 10px; }
.rp-customer small { display: block; color: #6B7280; }
.rp-items { width: 100%; border-collapse: collapse; }
.rp-items th { color: #374151; font-size: 7.5pt; text-align: left; padding: 0 0 8px; border-bottom: 1px dashed #A3A3A3; }
.rp-items td { font-size: 7.5pt; padding: 10px 0; border-bottom: 1px solid #F3F4F6; vertical-align: top; }
.rp-items th:nth-child(n+2),
.rp-items td:nth-child(n+2) { text-align: right; }
.rp-totals { border-top: 1px dashed #A3A3A3; border-bottom: 1px solid #F3F4F6; margin-top: 18px; padding: 14px 0 10px; }
.rp-totals p,
.rp-pay p { display: flex; justify-content: space-between; gap: 18px; margin: 0 0 8px; }
.rp-totals b,
.rp-pay b { text-align: right; }
.rp-grand { font-size: 22px; font-weight: 900; letter-spacing: -0.04em; }
.rp-grand b { color: var(--demo-primary); }
.rp-pay { padding: 14px 0; border-bottom: 1px solid #F3F4F6; }
.rp-thanks { text-align: center; margin: 20px 0 8px; font-size: 11px; font-weight: 900; letter-spacing: 0.12em; color: #9CA3AF; }
.rp-fine { text-align: center; margin: 0; font-size: 10px; font-style: italic; letter-spacing: 0.12em; color: #6B7280; }
.rp-demo-note { text-align: center; margin: 8px 0 0; color: #9CA3AF; font-size: 10px; }
.receipt-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 0 20px 20px; }

@media print {
    @page { size: 80mm auto; margin: 0; }
    html,
    body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
    body > *:not(.receipt) { display: none !important; }
    .receipt { position: static !important; inset: auto !important; display: block !important; background: #fff !important; padding: 0 !important; }
    .receipt-pane { max-width: none !important; width: auto !important; max-height: none !important; overflow: visible !important; box-shadow: none !important; border-radius: 0 !important; background: #fff !important; }
    .receipt-head,
    .receipt-actions { display: none !important; }
    .receipt-paper { width: 68mm !important; max-width: 68mm !important; margin: 0 auto !important; padding: 4mm 3.5mm !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; font-size: 8pt !important; }
    .rp-items th,
    .rp-items td { font-size: 7.5pt !important; }
}

.demo-drawer-toggle,
.demo-drawer-backdrop { display: none; }

@media (max-width: 1180px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
    .prod-grid { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
    .pos-grid { grid-template-columns: minmax(0, 1fr) 330px; }
}

@media (max-width: 900px) {
    .demo-drawer-toggle {
        display: grid;
        position: fixed;
        top: 12px;
        left: 14px;
        z-index: 70;
        width: 40px;
        height: 40px;
        place-items: center;
        border: 1px solid var(--demo-line);
        background: #fff;
        color: #111827;
        box-shadow: var(--demo-shadow);
    }
    .demo-drawer-toggle svg { width: 22px; height: 22px; }
    .demo-nav { transform: translateX(-100%); transition: transform 0.2s ease; }
    .demo-nav.open { transform: translateX(0); }
    .demo-drawer-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 35; }
    .demo-drawer-backdrop:not([hidden]) { display: block; }
    .demo-topbar { left: 0; }
    .demo-topbar-inner { padding: 0 16px 0 66px; }
    .demo-brand strong { font-size: 15px; }
    .demo-user, .demo-icon { display: none; }
    .demo-layout { margin-left: 0; }
    .demo-main { padding: 24px 16px; }
    .view-head { align-items: flex-start; }
    .view-head h1 { font-size: 28px; }
    .view-date { text-align: left; }
    .dash-cols, .pos-grid, .report-filter, .report-kpis { grid-template-columns: 1fr; }
    .pos-cart { position: static; }
    .pos-toolbar { align-items: stretch; flex-direction: column; }
    .pos-toolbar input { width: 100%; }
    .cat-chips { width: 100%; }
}

@media (max-width: 560px) {
    .kpi-grid { grid-template-columns: 1fr; gap: 16px; }
    .kpi { min-height: 132px; padding: 22px; }
    .prod-grid { grid-template-columns: 1fr; }
    .product-toolbar { grid-template-columns: 1fr; padding: 16px; }
    .demo-table th, .demo-table td { padding: 13px 14px; }
    .cart-line { grid-template-columns: 1fr auto; }
    .cl-t { grid-column: 1 / 2; }
    .receipt-paper { width: calc(100% - 28px); }
    .receipt-actions { flex-direction: column; }
}
