:root {
    --bg-color: #f6f7fb;
    --panel-bg: #ffffff;
    --panel-alt: #f1f4ff;
    --primary: #ff7a18;
    --primary-dark: #ea5b00;
    --secondary: #1d3557;
    --success: #2ecc71;
    --danger: #e63946;
    --warning: #f4b942;
    --text: #152033;
    --muted: #687385;
    --line: #ebedf5;
    --shadow: 0 20px 45px rgba(27, 35, 58, 0.1);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #fff7f1, #f5f9ff 30%, #f6f7fb);
    color: var(--text);
}

a { text-decoration: none; }

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #1b243a 0%, #101827 100%);
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    overflow: hidden;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-badge {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffb067, #ff7a18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
}

.brand-box h5 {
    margin: 0;
    font-size: 1.1rem;
}

.brand-box small {
    color: rgba(255,255,255,0.7);
}

.nav-menu {
    margin-top: 20px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.nav-menu::-webkit-scrollbar { width: 6px; }
.nav-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 8px; }

.sidebar-footer { flex-shrink: 0; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    color: rgba(255,255,255,0.82);
    margin-bottom: 6px;
    transition: 0.2s ease;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-footer {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-mini-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 10px 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #feae62);
    color: #fff;
    font-weight: 700;
}

.main-content {
    flex: 1;
    min-width: 0;
    margin-left: 280px;
    padding: 18px 28px 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 18px 22px;
    margin-bottom: 18px;
    backdrop-filter: blur(8px);
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    color: var(--muted);
}

.topbar h3 { margin: 0; }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.status-pill {
    background: rgba(46, 204, 113, 0.12);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: #1d7c4d;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 600;
}

.container-fluid { max-width: 1500px; }

.panel {
    background: var(--panel-bg);
    border-radius: 20px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.stat-card {
    background: var(--panel-bg);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 22px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
}

.stat-card.accent-orange .stat-icon { background: linear-gradient(135deg, #ff804d, #ff5d5d); }
.stat-card.accent-blue .stat-icon { background: linear-gradient(135deg, #5378ff, #4fb6ff); }
.stat-card.accent-green .stat-icon { background: linear-gradient(135deg, #2ecb93, #16a085); }
.stat-card.accent-purple .stat-icon { background: linear-gradient(135deg, #8a7dff, #b070ff); }

.stat-card span { display: block; color: var(--muted); font-size: 0.82rem; }
.stat-card h4 { margin: 4px 0 0; font-size: 1.7rem; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.chart-placeholder {
    height: 220px;
    padding-top: 12px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.bars {
    display: flex;
    align-items: flex-end;
    gap: clamp(2px, 0.8vw, 8px);
    height: 100%;
    flex: 1;
    min-width: 0;
}

.chart-bar {
    flex: 1;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.chart-bar span {
    width: 100%;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, #ffb067, #ff7a18);
    display: block;
}

.chart-bar strong,
.chart-bar small {
    font-size: 0.68rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
}

.chart-bar strong {
    min-height: 15px;
    font-size: 0.62rem;
}

.chart-y-axis {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    color: var(--muted);
    font-size: 0.7rem;
    padding-bottom: 24px;
}

.mini-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.mini-stat:last-child { border-bottom: 0; }

.stacked-list { display: flex; flex-direction: column; gap: 14px; }
.stacked-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #f8f9fd;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
}
.stacked-item small { display: block; color: var(--muted); }

.table { margin-bottom: 0; }
.table thead th {
    background: #f8f9fd;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pos-layout .product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
}

.product-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
}

.product-image {
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: linear-gradient(135deg, #ffefe5, #ffe0bc);
}

.product-body {
    padding: 14px;
}

.product-body h6 { margin: 0 0 6px; }
.product-body small { color: var(--muted); }
.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    gap: 10px;
}
.price-row strong { color: var(--primary-dark); }
.price-row span { font-size: 0.75rem; color: var(--muted); }

.cart-panel { min-height: 620px; }
.cart-items { display: flex; flex-direction: column; gap: 12px; min-height: 200px; }
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f9fafd;
}
.cart-item strong { display: block; }
.cart-item small { color: var(--muted); }
.qty-controls {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
}
.qty-controls button {
    width: 26px;
    border: 0;
    background: white;
}

.totals { font-size: 0.95rem; }
.total-row {
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 1.15rem;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff1e8, #eef5ff 55%, #f5f6fe);
}

.login-shell {
    width: min(100%, 520px);
    padding: 24px;
}

.login-card {
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 30px;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.brand-header h2 { margin: 0; }
.brand-header p { color: var(--muted); margin: 4px 0 0; }

.demo-credentials ul {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    color: var(--muted);
}

.auth-body {
    min-height: 100vh;
}

.receipt-wrap {
    max-width: 540px;
    margin: 0 auto;
}

.receipt-sheet {
    border: 1px dashed #d6dbe8;
    border-radius: 18px;
    background: #fff;
    padding: 24px;
}

.receipt-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
}

.receipt-business {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.receipt-logo {
    width: 145px;
    height: auto;
    flex: 0 0 auto;
}

.receipt-business-details {
    display: grid;
    gap: 3px;
    font-size: 0.78rem;
    line-height: 1.3;
}

.receipt-business-details strong {
    font-size: 1rem;
}

.receipt-business-details b {
    color: var(--primary);
    font-size: 0.95rem;
}

.receipt-brand strong {
    display: block;
    font-size: 1.2rem;
}

.receipt-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 16px;
}

.receipt-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--line);
}

.receipt-item small {
    display: block;
    color: var(--muted);
}

.receipt-totals {
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.receipt-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.receipt-line.total {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

@media print {
    @page {
        margin: 10mm;
    }

    body {
        background: #fff !important;
    }

    body > *:not(.app-shell),
    .sidebar,
    .topbar,
    .receipt-wrap > .d-flex,
    .btn,
    .nav-link {
        display: none !important;
    }

    .app-shell,
    .main-content,
    .main-content > .container-fluid,
    .receipt-wrap,
    .receipt-sheet {
        display: block !important;
        visibility: visible !important;
        position: static !important;
        width: auto !important;
        max-width: none !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .receipt-sheet,
    .receipt-sheet * {
        visibility: visible !important;
    }

    .receipt-sheet {
        padding: 4mm !important;
    }

    .receipt-business {
        break-inside: avoid;
    }

    .receipt-items,
    .receipt-totals {
        break-inside: avoid;
    }

    .receipt-wrap {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
        border: 0;
        box-shadow: none;
    }

}

@media (max-width: 992px) {
    .app-shell { display: block; }
    .sidebar { position: relative; width: 100%; height: auto; min-height: auto; }
    .nav-menu { display: flex; flex-wrap: wrap; }
    .main-content { margin-left: 0; padding: 18px 12px 22px; }
}

@media (max-width: 576px) {
    .topbar { flex-direction: column; align-items: flex-start; }
    .topbar-actions { width: 100%; justify-content: space-between; }
    .stat-card { padding: 18px 14px; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-placeholder { height: 190px; gap: 5px; }
    .chart-bar strong { display: none; }
    .chart-bar small { font-size: 0.55rem; }
    .chart-y-axis { font-size: 0.62rem; }
}
