:root {
    --dark: #0f172a;
    --dark-light: #1e293b;
    --primary: #2563eb;
    --background: #f8fafc;
    --card: #ffffff;
    --text: #334155;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f97316;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */

.sidebar {
    width: 270px;
    background: var(--dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
    width: 46px;
    height: 46px;
    background: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.sidebar-brand h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
}

.sidebar-brand span {
    color: #94a3b8;
    font-size: 13px;
}

.sidebar-menu {
    padding: 18px 14px;
    flex: 1;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 6px;
    transition: 0.2s;
    font-size: 15px;
}

.menu-link i {
    font-size: 18px;
}

.menu-link:hover {
    background: var(--dark-light);
    color: white;
}

.sidebar-footer {
    padding: 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fecaca;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 12px;
}

.logout-link:hover {
    background: rgba(220,38,38,0.15);
}

/* Main */

.main-content {
    margin-left: 270px;
    width: calc(100% - 270px);
    min-height: 100vh;
}

/* Topbar */

.topbar {
    height: 86px;
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 18px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

.topbar p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.search-box {
    width: 280px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 14px;
}

.search-box i {
    color: var(--muted);
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    background: #dbeafe;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-box strong {
    display: block;
    font-size: 14px;
}

.user-box span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

/* Content */

.content-area {
    padding: 30px;
}

/* Cards */

.card-modern {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: var(--dark);
}

.page-header p {
    margin: 4px 0 0;
    color: var(--muted);
}

/* Tables */

.table-modern {
    background: white;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.table-modern table {
    margin: 0;
}

.table-modern thead {
    background: #f1f5f9;
}

.table-modern th {
    color: var(--dark);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table-modern td {
    vertical-align: middle;
    font-size: 14px;
}

/* Badges */

.badge-stock-ok {
    background: #dcfce7;
    color: #166534;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.badge-stock-low {
    background: #ffedd5;
    color: #9a3412;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.badge-stock-out {
    background: #fee2e2;
    color: #991b1b;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
}

/* Responsive */

@media (max-width: 992px) {
    .sidebar {
        width: 82px;
    }

    .sidebar-brand h1,
    .sidebar-brand span,
    .menu-link span,
    .logout-link span {
        display: none;
    }

    .main-content {
        margin-left: 82px;
        width: calc(100% - 82px);
    }

    .topbar {
        height: auto;
        gap: 15px;
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .search-box {
        width: 100%;
    }
}

.stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.bg-blue {
    background: #2563eb;
}

.bg-green {
    background: #16a34a;
}

.bg-orange {
    background: #f97316;
}

.bg-purple {
    background: #7c3aed;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 4px;
}

.stat-card h3 {
    margin: 0;
    font-size: 24px;
    color: var(--dark);
    font-weight: 700;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
}

.section-title p {
    margin: 3px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.stock-alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

.stock-alert-item:last-child {
    border-bottom: none;
}

.stock-alert-item strong {
    display: block;
    font-size: 14px;
    color: var(--dark);
}

.stock-alert-item span {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.stock-count {
    min-width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #ffedd5;
    color: #9a3412;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.detail-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 4px;
}

.sale-summary {
    margin-top: 20px;
    border-top: 1px solid var(--border);
    padding-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 30px;
}

.sale-summary span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.sale-summary strong {
    display: block;
    font-size: 22px;
    color: var(--dark);
}

.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a, #1e3a8a);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    width: 100%;
    max-width: 430px;
    padding: 35px;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}

.login-brand {
    text-align: center;
    margin-bottom: 30px;
}

.login-brand i {
    font-size: 42px;
    color: var(--primary);
}

.login-brand h1 {
    margin: 12px 0 4px;
    font-size: 26px;
    font-weight: 800;
    color: var(--dark);
}

.login-brand p {
    color: var(--muted);
    margin: 0;
}