/* =========================================================
   POS System — Base Theme
   Primary: #3141d3 | Success: #22c55e | Danger: #ef4444 | Warning: #f59e0b
   ========================================================= */

:root {
    --primary: #3141d3;
    --primary-dark: #2532a8;
    --primary-light: #eef0fd;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text: #1e2130;
    --text-muted: #6b7280;
    --bg: #f5f6fb;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --radius: 14px;
    --shadow: 0 2px 10px rgba(30, 33, 48, 0.06);
    --shadow-lg: 0 8px 30px rgba(30, 33, 48, 0.10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }

/* ---------- Layout ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: #171a2b;
    color: #fff;
    flex-shrink: 0;
    padding: 20px 14px;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
    transition: transform 0.25s ease;
    z-index: 40;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 24px;
    font-weight: 700;
    font-size: 18px;
}

.sidebar-brand .dot {
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--primary);
}

.nav-group-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8b8fa8;
    margin: 18px 10px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 10px;
    color: #cfd2e6;
    font-weight: 500;
    margin-bottom: 2px;
}

.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }

.main-content {
    margin-left: 240px;
    flex: 1;
    min-width: 0;
    padding: 22px 26px 60px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 12px;
}

.topbar h1 { font-size: 22px; margin: 0; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px 6px 6px;
    box-shadow: var(--shadow);
}

.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}

/* ---------- Cards ---------- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    border: 1px solid var(--border);
}

.card-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.card-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
}

.card-value.success { color: var(--success); }
.card-value.warning { color: var(--warning); }
.card-value.danger { color: var(--danger); }

.panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 20px;
}

.panel h2 {
    font-size: 16px;
    margin: 0 0 14px;
}

table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}
table.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}
table.data-table tr:last-child td { border-bottom: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 12px;
    padding: 13px 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 17px; border-radius: 14px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    font-size: 15px;
    background: #fff;
    color: var(--text);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ---------- Alerts / Flash ---------- */
.alert {
    padding: 13px 16px;
    border-radius: 12px;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 500;
}
.alert-success { background: #e9fbf0; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-muted   { background: #f1f2f6; color: var(--text-muted); }

/* ---------- Guest / Login Page ---------- */
.guest-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(150deg, var(--primary) 0%, #1c2470 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
}

.login-logo {
    width: 56px; height: 56px; border-radius: 16px;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 22px;
    margin: 0 auto 18px;
}

.login-card h1 { text-align: center; font-size: 20px; margin: 0 0 4px; }
.login-card p.subtitle { text-align: center; color: var(--text-muted); margin: 0 0 24px; font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; }
    .cards-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

.mobile-topbar {
    display: none;
}
@media (max-width: 900px) {
    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #171a2b;
        color: #fff;
        padding: 14px 16px;
        margin: -16px -16px 16px;
    }
}
