:root {
    --bg-gradient-start: #0d1b2a;
    --bg-gradient-end: #162b40;
    --card-bg: rgba(255, 255, 255, 0.96);
    --card-border: rgba(255, 255, 255, 0.12);
    --muted: #64748b;
    --primary: #4f46e5;
    --primary-soft: #6366f1;
    --danger: #e53935;
    --success: #22c55e;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
}

body.app-body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.12), transparent 30%),
                radial-gradient(circle at 80% 0%, rgba(34, 197, 94, 0.1), transparent 30%),
                linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: #0f172a;
    min-height: 100vh;
    margin: 0;
}

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d1b2a, #162b40);
    min-height: 100vh;
}

.login-card {
    max-width: 420px;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    object-fit: cover;
    margin-bottom: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.app-shell {
    width: 100%;
    margin: 0;
    padding: 32px 32px 48px;
    max-width: none;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    margin-bottom: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.7);
    background: #fff;
}

.logo-badge {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #22c55e, #3b82f6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.25);
}

.brand .subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

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

.menu a {
    padding: 10px 14px;
    border-radius: 12px;
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.menu a:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.menu a.active {
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.auth-menu {
    gap: 10px;
}

.user-tag {
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.18);
    color: #15803d;
    font-weight: 600;
}

.flash-stack {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.flash {
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    background: #eef2ff;
}

.flash.success { background: #ecfdf3; border-color: rgba(34, 197, 94, 0.4); }
.flash.info { background: #eff6ff; border-color: rgba(59, 130, 246, 0.35); }
.flash.warning { background: #fff7ed; border-color: rgba(251, 146, 60, 0.45); }
.flash.error { background: #fef2f2; border-color: rgba(239, 68, 68, 0.35); }

.content-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hero {
    padding: 22px 24px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
}

.hero h1 {
    margin: 0;
    font-size: 1.6rem;
}

.hero p {
    margin: 6px 0 0;
    color: var(--muted);
}

.hero .actions a,
.hero .actions button {
    margin-left: 8px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.actions-compact {
    display: flex;
    gap: 6px;
    flex-direction: column;
    align-items: stretch;
}

.inline-form {
    display: inline;
    margin: 0;
}

.actions-row {
    min-width: 260px;
}

.actions-row .actions-compact a[role="button"],
.actions-row .actions-compact button {
    min-width: 140px;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid #3b82f6;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
    font-weight: 700;
    font-size: 0.8rem;
}

.actions-row .actions-compact a.secondary,
.actions-row .actions-compact button.secondary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.stat-card {
    padding: 16px;
    border-radius: 14px;
    background: linear-gradient(160deg, #ffffff, #f8fafc);
    border: 1px solid #e5e7eb;
}

.stat-card .label {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.stat-card .value {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.section-card {
    padding: 18px;
}

.section-card h2 {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 1.2rem;
}

.section-card p.subtitle {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 0.95rem;
}

.table-card {
    overflow: hidden;
}

.table-card table {
    margin-bottom: 0;
    width: 100%;
}

.table-card thead {
    background: #f8fafc;
}

.table-card th {
    font-size: 0.9rem;
    color: #475569;
    letter-spacing: 0.2px;
}

.table-card tbody tr:hover {
    background: #f9fafb;
}

.table-card tbody tr {
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.table-card tbody tr:last-child {
    border-bottom: none;
}

.table-card tbody tr:nth-child(odd) {
    background: #f8fafc;
}

.table-card td, .table-card th {
    padding: 12px 12px;
}

.status-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    color: #0f172a;
}

.status-pill.success { background: rgba(34, 197, 94, 0.12); color: #15803d; }
.status-pill.info { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.status-pill.warning { background: rgba(251, 146, 60, 0.16); color: #c2410c; }
.status-pill.danger { background: rgba(239, 68, 68, 0.14); color: #b91c1c; }

.alert-bar {
    display: inline-block;
    width: 40px;
    height: 12px;
    border-radius: 4px;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.alert-bar.success { background: var(--success); }
.alert-bar.danger { background: var(--danger); }

.table-card tr.low-stock {
    background: rgba(239, 68, 68, 0.05);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.page-header h1 {
    margin: 0;
}

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

.page-header .actions a {
    margin-left: 8px;
}

.form-card {
    padding: 18px;
}

.form-card form {
    display: grid;
    gap: 12px;
}

.form-card button[type="submit"] {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.35);
}

.form-card a.secondary {
    border: 1px solid #e2e8f0;
    color: #0f172a;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.75rem;
    margin: 0 0 6px;
}

.legend {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--muted);
}

.legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 768px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .menu {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .topbar {
        gap: 12px;
        align-items: flex-start;
    }
}
