:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #0ea5e9;
    --topbar-height: 60px;
    --primary: #0ea5e9;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1000;
    overflow-y: auto;
    transition: transform .3s;
}

.sidebar-brand {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand a {
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: .5px;
}

.sidebar-brand small {
    display: block;
    color: #94a3b8;
    font-size: .7rem;
    font-weight: 400;
    margin-top: 2px;
}

.sidebar-menu { padding: .75rem 0; }

.sidebar-section {
    padding: .5rem 1.25rem .25rem;
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    font-weight: 600;
}

.sidebar-item { display: block; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 1.25rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: .875rem;
    transition: all .15s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(14,165,233,.1);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
}

.sidebar-link .icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-link .arrow {
    margin-left: auto;
    font-size: .7rem;
    transition: transform .2s;
}

.sidebar-link[aria-expanded="true"] .arrow { transform: rotate(90deg); }

.submenu {
    padding-left: 2.75rem;
    list-style: none;
    display: none;
}

.submenu.show { display: block; }

.submenu a {
    display: block;
    padding: .4rem 0;
    color: #94a3b8;
    text-decoration: none;
    font-size: .8rem;
    transition: color .15s;
}

.submenu a:hover { color: #fff; }

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }

.toggle-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #475569;
    padding: .25rem;
}

.page-title { font-size: 1.1rem; font-weight: 600; color: #0f172a; }

.topbar-right { display: flex; align-items: center; gap: 1rem; }

.user-menu {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    padding: .25rem .5rem;
    border-radius: 8px;
}

.user-menu:hover { background: #f1f5f9; }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .85rem;
}

.user-info { line-height: 1.2; }

.user-name { font-size: .85rem; font-weight: 500; color: #0f172a; }

.user-role { font-size: .7rem; color: #64748b; }

.content-wrapper { padding: 1.5rem; }

/* Cards */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    transition: box-shadow .2s;
}

.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.05); }

.stat-card .icon-box {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: .75rem;
}

.stat-card .label { font-size: .8rem; color: #64748b; margin-bottom: .25rem; }

.stat-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.stat-card .change {
    font-size: .75rem;
    margin-top: .25rem;
}

.stat-card .change.up { color: #10b981; }
.stat-card .change.down { color: #ef4444; }

/* Tables */
.table-container {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.table-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
}

.table-header h5 { font-size: .95rem; font-weight: 600; margin: 0; }

.table-search {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: .4rem .75rem;
    font-size: .85rem;
    min-width: 220px;
    outline: none;
}

.table-search:focus { border-color: var(--primary); }

.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

.table th {
    padding: .7rem .75rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    white-space: nowrap;
}

.table td {
    padding: .65rem .75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.table tr:hover td { background: #f8fafc; }

/* Badges */
.badge {
    padding: .2em .6em;
    font-size: .75rem;
    font-weight: 500;
    border-radius: 20px;
}

.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #d1fae5; color: #059669; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-info { background: #e0f2fe; color: #0284c7; }
.badge-secondary { background: #f1f5f9; color: #64748b; }

/* Buttons */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #0284c7; border-color: #0284c7; }

.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

.action-btns { display: flex; gap: .25rem; }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.page-header h4 { font-size: 1.1rem; font-weight: 600; margin: 0; }

.page-header .breadcrumb {
    font-size: .8rem;
    color: #64748b;
    margin: 0;
}

.breadcrumb a { color: var(--primary); text-decoration: none; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.empty-state .icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; }

/* Loading */
.loading { opacity: .5; pointer-events: none; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .toggle-sidebar { display: block; }
}

/* Modal */
.modal-content { border: none; border-radius: 12px; }
.modal-header { border-bottom: 1px solid #e2e8f0; padding: 1rem 1.25rem; }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid #e2e8f0; padding: .75rem 1.25rem; }

/* Form */
.form-label { font-size: .85rem; font-weight: 500; color: #374151; margin-bottom: .35rem; }
.form-control, .form-select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: .45rem .75rem;
    font-size: .875rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}

/* Toast notification */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; }
.toast {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: .75rem 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    margin-bottom: .5rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 280px;
    animation: slideIn .3s ease;
}
.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 1rem;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-card .brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-card .brand h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.login-card .brand small {
    color: #64748b;
    font-size: .8rem;
}
