/* ============================================================
   Admin Panel — Complete Stylesheet
   Design: Clean modern sidebar, responsive mobile-first
   ============================================================ */

:root {
    --primary:        #6b5bfc;
    --primary-dark:   #5a4ae8;
    --primary-light:  #ede9ff;
    --sidebar-w:      270px;
    --sidebar-bg:     #ffffff;
    --header-h:       64px;
    --header-bg:      #ffffff;
    --body-bg:        #f0f3fa;
    --card-bg:        #ffffff;
    --text-dark:      #1e293b;
    --text-mid:       #475569;
    --text-muted:     #94a3b8;
    --border:         #e2e8f0;
    --shadow:         0 1px 8px rgba(0,0,0,.07);
    --shadow-md:      0 4px 24px rgba(0,0,0,.12);
    --radius:         14px;
    --radius-sm:      8px;
    --success:        #10b981;
    --danger:         #ef4444;
    --warning:        #f59e0b;
    --info:           #3b82f6;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--body-bg);
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

/* ── Sidebar ──────────────────────────────────────────────── */
#sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
}
#sidebar .sidebar-inner {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding-bottom: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--sidebar-bg);
    z-index: 2;
    flex-shrink: 0;
}
.brand-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(107,91,252,.35);
}
.brand-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
}
.brand-sub { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.brand-toggle {
    margin-left: auto;
    background: none;
    border: none;
    width: 30px; height: 30px;
    border-radius: 7px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s, color .2s;
    flex-shrink: 0;
}
.brand-toggle:hover { background: var(--body-bg); color: var(--text-dark); }

/* Section header */
.nav-section {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 18px 20px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-section::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Nav item */
.nav-group { padding: 2px 10px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-mid);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background .18s, color .18s;
    position: relative;
}
.nav-link .ni {
    width: 22px; text-align: center;
    font-size: 15px;
    color: var(--text-muted);
    transition: color .18s;
    flex-shrink: 0;
}
.nav-link .nt { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link .na { font-size: 11px; color: var(--text-muted); transition: transform .25s; }
.nav-link:hover { background: var(--primary-light); color: var(--primary); }
.nav-link:hover .ni { color: var(--primary); }
.nav-link.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-link.active .ni { color: #fff; }
.nav-link.active .na { color: rgba(255,255,255,.6); }
.nav-link.open .na { transform: rotate(90deg); }

/* Submenu */
.submenu {
    display: none;
    padding: 3px 0 3px 44px;
}
.submenu.open { display: block; }

.sub-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all .18s;
}
.sub-link::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: background .18s, transform .18s;
}
.sub-link:hover { color: var(--primary); background: var(--primary-light); }
.sub-link:hover::before { background: var(--primary); transform: scale(1.4); }
.sub-link.active { color: var(--primary); font-weight: 600; }
.sub-link.active::before { background: var(--primary); }

/* ── Sidebar Overlay (mobile) ─────────────────────────────── */
#sb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,20,40,.45);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* ── Main wrapper ─────────────────────────────────────────── */
#main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .28s cubic-bezier(.4,0,.2,1);
}

/* ── Header ───────────────────────────────────────────────── */
#hdr {
    height: var(--header-h);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 998;
    box-shadow: var(--shadow);
}
.hdr-btn {
    width: 38px; height: 38px;
    border-radius: 9px;
    border: none;
    background: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    transition: background .18s, color .18s;
    text-decoration: none;
    flex-shrink: 0;
}
.hdr-btn:hover { background: var(--body-bg); color: var(--text-dark); }
.hdr-search {
    flex: 1;
    max-width: 360px;
    position: relative;
}
.hdr-search input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--body-bg);
    font-size: 13px;
    color: var(--text-dark);
    outline: none;
    transition: border-color .2s, background .2s;
}
.hdr-search input:focus { border-color: var(--primary); background: #fff; }
.hdr-search .si {
    position: absolute; left: 11px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); font-size: 13px; pointer-events: none;
}
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.notif-wrap { position: relative; }
.notif-dot {
    position: absolute; top: 4px; right: 4px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid #fff;
}
.av-wrap { position: relative; }
.avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .2s;
    position: relative;
}
.avatar:hover { border-color: var(--primary); }
.av-online {
    position: absolute; bottom: 0; right: 0;
    width: 10px; height: 10px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid #fff;
}

/* Avatar dropdown */
.av-drop {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    z-index: 2000;
    display: none;
    overflow: hidden;
}
.av-drop.show { display: block; }
.av-drop-head { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.av-drop-head .avd-name { font-weight: 700; font-size: 14px; }
.av-drop-head .avd-role { font-size: 11px; color: var(--text-muted); }
.av-drop-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 18px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 13px;
    transition: background .18s;
}
.av-drop-item:hover { background: var(--body-bg); }
.av-drop-item.danger { color: var(--danger); }

/* ── Content area ─────────────────────────────────────────── */
#content {
    flex: 1;
    padding: 24px;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}
.page-title small {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-h {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-h h5 { font-size: 15px; font-weight: 700; color: var(--text-dark); margin: 0; flex: 1; }
.card-h .ch-icon { font-size: 16px; color: var(--primary); }
.card-b { padding: 20px; }
.card-f {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--body-bg);
}

/* Stat cards — colored */
.scard {
    border-radius: var(--radius);
    padding: 22px 20px;
    position: relative;
    overflow: hidden;
    color: #fff;
}
.scard .scard-icon {
    position: absolute; right: 16px; top: 50%;
    transform: translateY(-50%);
    font-size: 52px; opacity: .18;
}
.scard .sc-val { font-size: 26px; font-weight: 800; }
.scard .sc-lbl { font-size: 12px; opacity: .85; margin-top: 4px; font-weight: 500; }
.scard .sc-link { font-size: 11px; opacity: .7; text-decoration: none; color: #fff; margin-top: 8px; display: inline-block; }
.sc-green  { background: linear-gradient(135deg, #10b981, #059669); }
.sc-red    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.sc-navy   { background: linear-gradient(135deg, #1e3a5f, #0f1f3a); }
.sc-purple { background: linear-gradient(135deg, #6b5bfc, #a78bfa); }
.sc-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.sc-teal   { background: linear-gradient(135deg, #06b6d4, #0891b2); }

/* Stat cards — white */
.scard-w {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 20px;
}
.scard-w .sc-val  { font-size: 24px; font-weight: 800; color: var(--success); }
.scard-w .sc-lbl  { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.scard-w .sc-link { font-size: 12px; color: var(--primary); text-decoration: none; }

/* ── Grid ─────────────────────────────────────────────────── */
.g { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2,1fr); }
.g-3 { grid-template-columns: repeat(3,1fr); }
.g-4 { grid-template-columns: repeat(4,1fr); }
.g-6 { grid-template-columns: repeat(6,1fr); }

/* ── Forms ────────────────────────────────────────────────── */
.f-group { margin-bottom: 18px; }
.f-label { font-size: 13px; font-weight: 600; color: var(--text-dark); margin-bottom: 6px; display: block; }
.f-hint  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-ctrl {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-dark);
    background: #fff;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    font-family: inherit;
}
.form-ctrl:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(107,91,252,.12); }
.form-ctrl[disabled] { background: var(--body-bg); cursor: not-allowed; opacity: .7; }
textarea.form-ctrl { resize: vertical; min-height: 90px; }
select.form-ctrl {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}
.input-group { display: flex; gap: 0; }
.input-group .form-ctrl { border-radius: var(--radius-sm) 0 0 var(--radius-sm); flex: 1; }
.input-group .ig-addon {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--body-bg);
    color: var(--text-muted);
    font-size: 13px;
    display: flex; align-items: center;
    white-space: nowrap;
}
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.f-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Toggle switch */
.tog { position: relative; display: inline-block; width: 46px; height: 24px; cursor: pointer; }
.tog input { opacity: 0; width: 0; height: 0; }
.tog-sl {
    position: absolute; inset: 0;
    background: #cbd5e1; border-radius: 24px;
    transition: background .25s;
}
.tog-sl::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .25s;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.tog input:checked + .tog-sl { background: var(--primary); }
.tog input:checked + .tog-sl::before { transform: translateX(22px); }

/* Color picker */
.color-pick { display: flex; align-items: center; gap: 10px; }
.color-pick input[type="color"] {
    width: 42px; height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    cursor: pointer;
    background: #fff;
}

/* Image upload */
.img-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    position: relative;
}
.img-upload:hover { border-color: var(--primary); background: var(--primary-light); }
.img-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.img-upload .iu-icon { font-size: 32px; color: var(--text-muted); margin-bottom: 8px; }
.img-upload .iu-text { font-size: 13px; color: var(--text-muted); }
.img-preview { max-width: 160px; max-height: 100px; border-radius: 8px; margin-top: 10px; display: none; border: 1px solid var(--border); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 7px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
    font-family: inherit;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(107,91,252,.4); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; box-shadow: 0 4px 14px rgba(16,185,129,.35); }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-info    { background: var(--info);    color: #fff; }
.btn-secondary { background: var(--border); color: var(--text-mid); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-outline-danger { background: transparent; border: 1.5px solid var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-sm  { padding: 6px 14px; font-size: 12px; border-radius: 7px; }
.btn-lg  { padding: 13px 28px; font-size: 15px; }
.btn-xl  { padding: 14px 28px; font-size: 15px; width: 100%; border-radius: 10px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ── Table ────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
table th {
    background: var(--body-bg);
    padding: 11px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    text-align: left;
}
table td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text-dark); }
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover td { background: #fafbff; }
.tbl-empty { padding: 40px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px; font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-danger  { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-info    { background: #dbeafe; color: #2563eb; }
.badge-secondary { background: var(--border); color: var(--text-muted); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ── Tabs ─────────────────────────────────────────────────── */
.tab-bar { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 22px; flex-wrap: wrap; }
.tab-item {
    padding: 10px 20px;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    cursor: pointer;
    font-size: 13.5px; font-weight: 600;
    color: var(--text-muted);
    transition: all .18s;
    border-radius: 8px 8px 0 0;
    text-decoration: none; display: block;
}
.tab-item:hover { color: var(--primary); background: var(--primary-light); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
}
.alert-success { background: #dcfce7; color: #15803d; border-left: 4px solid #16a34a; }
.alert-danger  { background: #fee2e2; color: #b91c1c; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--info); }

/* ── Pagination ───────────────────────────────────────────── */
.pag { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pag-btn {
    width: 34px; height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 13px; font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all .18s;
}
.pag-btn:hover, .pag-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pag-btn.disabled { opacity: .4; pointer-events: none; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-bg {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,20,40,.5);
    z-index: 3000;
    align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}
.modal-bg.show { display: flex; }
.modal-box {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%; max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(-20px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-h h5 { font-size: 16px; font-weight: 700; margin: 0; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); line-height: 1; transition: color .18s; }
.modal-close:hover { color: var(--danger); }
.modal-b { padding: 22px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Game Manager ─────────────────────────────────────────── */
.gm-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 22px;
}
.gm-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.gm-value { font-size: 24px; font-weight: 800; color: var(--success); font-variant-numeric: tabular-nums; }
.gm-value.timer { font-size: 36px; color: var(--success); }
.gm-value.period { font-size: 18px; color: var(--primary); }
.pred-badge-ns { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 20px; background: #dcfce7; color: #16a34a; font-size: 12px; font-weight: 600; }
.pred-badge-set { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 20px; background: var(--primary-light); color: var(--primary); font-size: 12px; font-weight: 600; }

/* ── Misc utils ───────────────────────────────────────────── */
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.align-center { align-items: center; }
.align-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end  { justify-content: flex-end; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-primary { color: var(--primary) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-dark    { color: var(--text-dark) !important; }
.fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.p-0 { padding: 0; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Login page ───────────────────────────────────────────── */
.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #6b5bfc 0%, #a78bfa 50%, #06b6d4 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-bg::before {
    content: '';
    position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-card {
    background: #fff;
    border-radius: 22px;
    padding: 44px 40px;
    width: 100%; max-width: 430px;
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
    position: relative; z-index: 1;
}
.login-logo {
    width: 66px; height: 66px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 28px; font-weight: 800;
    margin: 0 auto 22px;
    box-shadow: 0 8px 24px rgba(107,91,252,.4);
}
.login-title    { font-size: 24px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 30px; }

/* ── Dark mode ────────────────────────────────────────────── */
body.dark {
    --sidebar-bg:   #1c2235;
    --header-bg:    #242b42;
    --body-bg:      #141829;
    --card-bg:      #1c2235;
    --text-dark:    #e2e8f0;
    --text-mid:     #94a3b8;
    --border:       #2a3352;
    --shadow:       0 1px 8px rgba(0,0,0,.3);
}
body.dark .form-ctrl { background: #141829; color: #e2e8f0; border-color: #2a3352; }
body.dark table th { background: #141829; }
body.dark .hdr-search input { background: #141829; color: #e2e8f0; }
body.dark table tbody tr:hover td { background: #1a2038; }
body.dark .scard-w { background: #1c2235; border-color: #2a3352; }
body.dark .login-card { background: #1c2235; }
body.dark .modal-box { background: #1c2235; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .g-4 { grid-template-columns: repeat(2,1fr); }
    .g-6 { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); box-shadow: var(--shadow-md); }
    #sidebar.open { transform: translateX(0); }
    #sb-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity .28s; }
    #sb-overlay.active { opacity: 1; pointer-events: all; }
    #main { margin-left: 0 !important; }
    #content { padding: 14px; }
    .hdr-search { display: none; }
    .g-3, .g-2 { grid-template-columns: 1fr 1fr; }
    .g-4 { grid-template-columns: 1fr 1fr; }
    .g-6 { grid-template-columns: repeat(2,1fr); }
    .f-row, .f-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .g-2, .g-3, .g-4, .g-6 { grid-template-columns: 1fr; }
    .page-title { font-size: 17px; }
    #content { padding: 10px; }
    .login-card { padding: 28px 22px; }
    .scard .sc-val { font-size: 22px; }
}
