:root {
    --primary-600: #487fff;
    --primary-50: #ecf3ff;
    --success-600: #16a34a;
    --success-focus: #e8f8ee;
    --warning-600: #f6a723;
    --warning-focus: #fef7e8;
    --danger-600: #e5493a;
    --danger-focus: #fdeceb;
    --info-600: #0ea5e9;
    --info-focus: #e8f7fe;
    --neutral-900: #1e293b;
    --neutral-600: #4b5563;
    --neutral-400: #94a3b8;
    --neutral-200: #e2e8f0;
    --neutral-100: #f1f5f9;
    --neutral-50: #f8fafc;
    --sidebar-bg: #17182c;
    --sidebar-bg-hover: #23243d;
    --body-bg: #f8f9fc;
    --radius-16: 16px;
    --radius-12: 12px;
    --radius-8: 8px;
}

* { box-sizing: border-box; }

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--body-bg);
    color: var(--neutral-900);
    font-size: 14px;
}

a { text-decoration: none; }

/* ---------- utility helpers used across pages ---------- */
.radius-8 { border-radius: var(--radius-8); }
.radius-12 { border-radius: var(--radius-12); }
.radius-16 { border-radius: var(--radius-16); }
.text-sm { font-size: 13px; }
.text-md { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.text-secondary-light { color: var(--neutral-600); }
.text-primary-600 { color: var(--primary-600) !important; }
.bg-primary-50 { background: var(--primary-50); }
.bg-neutral-50 { background: var(--neutral-50); }
.bg-neutral-100 { background: var(--neutral-100); }
.bg-neutral-200 { background: var(--neutral-200); }
.bg-success-focus { background: var(--success-focus); }
.text-success-main { color: var(--success-600); }
.bg-warning-focus { background: var(--warning-focus); }
.text-warning-main { color: #b8790f; }
.bg-danger-focus { background: var(--danger-focus); }
.text-danger-main { color: var(--danger-600); }
.bg-info-focus { background: var(--info-focus); }
.text-info-main { color: #0b7fac; }
.w-40-px { width: 40px; }
.h-40-px { height: 40px; }
.cursor-pointer { cursor: pointer; }

/* ---------- buttons ---------- */
.btn-primary {
    background: var(--primary-600);
    border-color: var(--primary-600);
}
.btn-primary:hover, .btn-primary:focus {
    background: #3567e0;
    border-color: #3567e0;
}
.btn-outline-primary {
    color: var(--primary-600);
    border-color: var(--primary-600);
}
.btn-outline-primary:hover {
    background: var(--primary-600);
    border-color: var(--primary-600);
}

/* ---------- badges ---------- */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

/* ---------- cards ---------- */
.card { border: 1px solid var(--neutral-200); border-radius: var(--radius-16); }
.stat-card {
    background: #fff;
    border-radius: var(--radius-16);
    border: 1px solid var(--neutral-200);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 100%;
}
.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.stat-card .stat-value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { color: var(--neutral-600); font-size: 13px; }

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

.sidebar {
    width: 268px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: #cbd2e6;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1030;
    transition: transform .2s ease, width .2s ease;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 24px;
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .logo-badge {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
}
.sidebar-menu-area { flex: 1; overflow-y: auto; padding: 16px 12px 24px; }
.sidebar-menu { list-style: none; margin: 0; padding: 0; }
.sidebar-menu-group-title {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .06em;
    color: #6f7796;
    padding: 18px 12px 8px;
    font-weight: 600;
}
.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: #cbd2e6;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}
.sidebar-menu li a:hover { background: var(--sidebar-bg-hover); color: #fff; }
.sidebar-menu li a.active-page { background: var(--primary-600); color: #fff; }
.sidebar-menu li a iconify-icon, .sidebar-menu li a i { font-size: 19px; flex-shrink: 0; }
.sidebar-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #6f7796; }

.main-wrapper { margin-left: 268px; flex: 1; min-width: 0; display: flex; flex-direction: column; transition: margin-left .2s ease; }
body.sidebar-collapsed .sidebar { transform: translateX(-268px); }
body.sidebar-collapsed .main-wrapper { margin-left: 0; }

.app-navbar {
    background: #fff;
    border-bottom: 1px solid var(--neutral-200);
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.app-content { padding: 24px; flex: 1; }
.app-footer { padding: 16px 24px; color: var(--neutral-400); font-size: 12px; text-align: center; }

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--neutral-100);
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neutral-600);
}
.icon-btn:hover { background: var(--neutral-200); }

/* ---------- tables ---------- */
.table-card { background: #fff; border: 1px solid var(--neutral-200); border-radius: var(--radius-16); overflow: hidden; }
.table > :not(caption) > * > * { padding: 12px 16px; vertical-align: middle; }
.table thead th { background: var(--neutral-50); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--neutral-600); font-weight: 600; border-bottom: 1px solid var(--neutral-200); }
.table td { font-size: 14px; border-bottom: 1px solid var(--neutral-100); }
.table tbody tr:last-child td { border-bottom: none; }
.avatar-circle {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary-50); color: var(--primary-600);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; flex-shrink: 0;
}

/* ---------- auth page ---------- */
.auth-shell { min-height: 100vh; display: flex; align-items: stretch; justify-content: center; background: var(--sidebar-bg); }
.auth-left { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-left img { max-width: 480px; width: 100%; border-radius: 24px; }
.auth-right { width: 460px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding: 40px 32px; background: #fff; }
.auth-card { width: 100%; max-width: 360px; }
.auth-logo-mark { width: 40px; height: 40px; object-fit: contain; }
@media (max-width: 900px) {
    .auth-left { display: none; }
    .auth-right { width: 100%; }
}

/* ---------- coming soon ---------- */
.coming-soon-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 80px 20px; }
.coming-soon-wrap .icon-circle { width: 96px; height: 96px; border-radius: 50%; background: var(--primary-50); color: var(--primary-600); display: flex; align-items: center; justify-content: center; font-size: 44px; margin-bottom: 24px; }

@media (max-width: 991px) {
    .sidebar { transform: translateX(-268px); }
    .main-wrapper { margin-left: 0; }
    body.sidebar-mobile-open .sidebar { transform: translateX(0); }
}
