:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #667085;
    --line: #e6eaf2;
    --primary: #204ecf;
    --primary-dark: #173aa3;
    --danger: #b42318;
    --success: #067647;
    --warning: #b54708;
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
    --radius: 18px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
code {
    background: #eef2ff;
    color: #263a93;
    padding: 2px 6px;
    border-radius: 8px;
}
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top left, rgba(32, 78, 207, .18), transparent 32rem),
        linear-gradient(135deg, #f8fbff, #eef3ff);
}
.login-shell { width: min(94vw, 460px); }
.login-card, .card {
    background: rgba(255,255,255,.96);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.login-card { padding: 34px; }
.brand-mark {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #6d5dfc);
    color: #fff;
    font-weight: 800;
    font-size: 28px;
    margin-bottom: 18px;
}
.brand-mark.small {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    font-size: 20px;
    margin: 0;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 26px; }
h2 { margin-bottom: 4px; font-size: 20px; }
.muted { color: var(--muted); }
.form-stack { display: grid; gap: 16px; margin-top: 24px; }
label span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; color: #344054; }
input, select, textarea {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    padding: 11px 13px;
    font: inherit;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: .15s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(32, 78, 207, .12);
}
small { display: block; margin-top: 5px; color: var(--muted); }
.btn {
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: .15s ease;
    font-size: 14px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: #fff; color: #344054; border-color: var(--line); }
.btn-danger { background: #fee4e2; color: var(--danger); border-color: #fecdca; }
.btn-success { background: #dcfae6; color: var(--success); border-color: #abefc6; }
.btn-warning { background: #fef0c7; color: var(--warning); border-color: #fedf89; }
.btn-full { width: 100%; }
.btn-xs { padding: 6px 9px; border-radius: 9px; font-size: 12px; }
.icon-btn {
    display: none;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 9px 11px;
    font-size: 18px;
}
.alert {
    padding: 13px 15px;
    border-radius: 14px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}
.alert-success { background: #ecfdf3; border-color: #abefc6; color: #05603a; }
.alert-danger { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.alert-warning { background: #fffaeb; border-color: #fedf89; color: #b54708; }
.demo-box {
    margin-top: 20px;
    padding: 14px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    color: #475467;
    font-size: 13px;
}
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 280px;
    background: #101828;
    color: #fff;
    padding: 22px 18px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 30;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}
.sidebar-brand span { display: block; color: #98a2b3; font-size: 12px; }
.sidebar-nav { display: grid; gap: 5px; }
.nav-group {
    color: #98a2b3;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 18px 12px 7px;
}
.nav-link {
    color: #d0d5dd;
    padding: 10px 12px;
    border-radius: 12px;
    display: block;
    font-size: 14px;
}
.nav-link:hover, .nav-link.active { background: #1d2939; color: #fff; }
.main-panel {
    margin-left: 280px;
    flex: 1;
    min-width: 0;
}
.topbar {
    min-height: 92px;
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 28px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar h1 { margin: 0; }
.topbar p { margin: 3px 0 0; }
.topbar-actions { margin-left: auto; }
.content { padding: 28px; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .05);
}
.stat-card span { color: var(--muted); font-size: 13px; display: block; }
.stat-card strong { display: block; font-size: 30px; margin-top: 6px; }
.two-column { display: grid; grid-template-columns: 1.2fr .8fr; gap: 22px; }
.card { padding: 20px; }
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}
.card-head p { margin-bottom: 0; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.quick-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    background: #fbfcff;
}
.quick-card:hover { border-color: #b8c7ff; background: #f4f7ff; }
.quick-card strong { display: block; margin-bottom: 4px; }
.quick-card span { color: var(--muted); font-size: 13px; }
.activity-list { display: grid; gap: 12px; }
.activity-item {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfcff;
}
.activity-item p { margin: 8px 0 4px; }
.activity-item small { color: var(--muted); }
.list-head { align-items: center; }
.list-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.search-form { display: flex; gap: 8px; align-items: center; }
.search-form input { min-width: 220px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { background: #f8fafc; color: #475467; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.data-table tr:last-child td { border-bottom: 0; }
.actions-col { width: 190px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions form { display: inline; }
.empty-cell { text-align: center; color: var(--muted); padding: 36px !important; }
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    text-transform: capitalize;
}
.badge-green { background: #dcfae6; color: #067647; }
.badge-amber { background: #fef0c7; color: #b54708; }
.badge-red { background: #fee4e2; color: #b42318; }
.badge-purple { background: #f4ebff; color: #6941c6; }
.badge-blue { background: #e0eaff; color: #204ecf; }
.badge-gray { background: #eef2f6; color: #475467; }
.form-card { max-width: 1080px; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-field.wide, .wide { grid-column: 1 / -1; }
.switch-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 13px;
    width: 100%;
    background: #fff;
}
.switch-row input { width: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .two-column { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-102%); transition: .2s ease; }
    .sidebar.open { transform: translateX(0); }
    .main-panel { margin-left: 0; }
    .icon-btn { display: inline-flex; }
    .topbar { padding: 14px 16px; }
    .content { padding: 18px 14px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-form, .quick-grid { grid-template-columns: 1fr; }
    .list-head { display: block; }
    .list-actions { justify-content: flex-start; margin-top: 14px; }
    .search-form { width: 100%; }
    .search-form input { min-width: 0; flex: 1; }
}
@media (max-width: 520px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 24px; }
    .topbar-actions { display: none; }
}
