
:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --sidebar: #0f172a;
    --sidebar-text: #cbd5e1;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #eaf1ff 0%, #f8fbff 100%);
}
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    padding: 32px;
    border-radius: 22px;
    border: 1px solid #edf2f7;
    box-shadow: 0 20px 60px rgba(0,0,0,.08);
}
.login-brand {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: white;
    font-weight: 700;
    margin-bottom: 18px;
}
.demo-note {
    margin-top: 18px;
    padding: 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
}
.layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 270px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
}
.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
}
.brand-title { color: white; font-size: 22px; font-weight: 700; }
.brand-subtitle { font-size: 13px; color: #94a3b8; }
.nav-menu { display: flex; flex-direction: column; gap: 8px; }
.nav-menu a {
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 12px;
    transition: .2s ease;
}
.nav-menu a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.main-content { flex: 1; padding: 26px; }
.topbar, .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 10px 26px rgba(15,23,42,.04);
}
.topbar { padding: 20px 24px; margin-bottom: 22px; }
.page-header, .page-header-flex, .section-title-row, .toolbar, .form-actions, .actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.page-header, .page-header-flex { margin-bottom: 18px; }
.card { padding: 22px; margin-bottom: 22px; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}
.dual-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}
.stat-card span { display: block; color: var(--muted); margin-bottom: 8px; }
.stat-card strong { font-size: 30px; font-weight: 700; }
.form-grid { display: grid; gap: 16px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-width { grid-column: 1 / -1; }
label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
input, textarea, select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    outline: none;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37,99,235,.08);
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    border: none;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 600;
    cursor: pointer;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.secondary { background: #eef2ff; color: #1f2937; }
.btn.full { width: 100%; }
.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}
.alert.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.alert.success {
    background: #ecfdf5;
    color: #166534;
    border: 1px solid #a7f3d0;
}
.muted { color: var(--muted); }
.table-scroll { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    min-width: 900px;
}
table th, table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
table th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.inline-form { display: inline; margin: 0; }
.link-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}
.danger-text { color: var(--danger); }
.pagination { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    text-decoration: none;
    border-radius: 10px;
    border: 1px solid var(--line);
    color: var(--text);
    background: #fff;
}
.pagination a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.error-list {
    display: grid;
    gap: 8px;
    color: #991b1b;
}
@media (max-width: 992px) {
    .dual-grid { grid-template-columns: 1fr; }
    .sidebar { width: 220px; }
}
@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; }
    .main-content { padding: 16px; }
    .stats-grid, .two-col { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
}

.pagination-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--muted);
    font-size: 14px;
}

.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    text-decoration: none;
    border-radius: 10px;
    border: 1px solid var(--line);
    color: var(--text);
    background: #fff;
    font-weight: 600;
    transition: 0.2s ease;
}

.pagination a:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.pagination a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination-dots {
    padding: 0 6px;
    color: var(--muted);
    font-weight: 600;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.dashboard-hero h1 {
    margin: 8px 0 6px;
}

.dashboard-role-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
}

.dashboard-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.dashboard-stat-card {
    padding: 22px;
}

.dashboard-stat-label {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 10px;
    font-weight: 600;
}

.dashboard-stat-value {
    font-size: 34px;
    line-height: 1;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.dashboard-stat-subtext {
    color: var(--muted);
    font-size: 13px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.dashboard-table-card {
    padding: 22px;
    min-width: 0;
}

.dashboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.dashboard-card-header h3 {
    margin: 0 0 6px;
}

.dashboard-table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
}

.dashboard-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
}

.dashboard-table th,
.dashboard-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.dashboard-table th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.cell-break {
    word-break: break-word;
    white-space: normal;
}

.empty-state-cell {
    text-align: center;
    color: var(--muted);
    padding: 24px 12px;
}

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

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

    .dashboard-hero {
        align-items: flex-start;
    }

    .dashboard-hero-actions {
        width: 100%;
    }

    .dashboard-hero-actions .btn {
        flex: 1 1 auto;
    }
}
