:root {
    --color-primary: #0052D9;
    --color-primary-hover: #0040B0;
    --color-primary-light: #E8F0FE;
    --color-sidebar-bg: #fff;
    --color-sidebar-hover: #f5f7fa;
    --color-sidebar-active: #e8f0fe;
    --color-text-primary: #1a202c;
    --color-text-secondary: #64748b;
    --color-border: #e2e8f0;
    --color-bg-page: #f5f7fa;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
    color: var(--color-text-primary);
    background: var(--color-bg-page);
    -webkit-font-smoothing: antialiased;
}

.sidebar {
    width: 220px;
    min-height: 100vh;
    background: var(--color-sidebar-bg);
    border-right: 1px solid var(--color-border);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    transition: transform .2s;
}

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand h1 {
    color: var(--color-text-primary);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
}

.sidebar-brand span { color: var(--color-primary); }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: #475569;
    text-decoration: none;
    font-size: 13.5px;
    transition: all .12s;
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.sidebar-nav a:hover {
    color: var(--color-text-primary);
    background: var(--color-sidebar-hover);
}

.sidebar-nav a.active {
    color: var(--color-primary);
    background: var(--color-sidebar-active);
    border-left-color: var(--color-primary);
    font-weight: 500;
}

.sidebar-nav a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 1.5;
}

.sidebar-section-title {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.main-content {
    margin-left: 220px;
    min-height: 100vh;
}

.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    min-width: 160px;
    padding: 6px 0;
    z-index: 100;
}
.user-dropdown.show { display: block; }
.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 13px;
    color: var(--color-text-primary);
    text-decoration: none;
    transition: background .1s;
}
.user-dropdown a:hover { background: #f8fafc; }

.page-content { padding: 20px 24px; }

.card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.card-body { padding: 20px; }

.stat-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 18px 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.2;
}

.stat-card .stat-change {
    font-size: 12px;
    margin-top: 6px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all .12s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: #fff; color: var(--color-text-primary); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: #fff; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: #fff;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all .12s;
}
.btn-icon:hover { background: #f8fafc; color: var(--color-text-primary); }

.table-wrap { overflow-x: auto; }

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table-wrap th {
    text-align: left;
    padding: 10px 16px;
    font-weight: 500;
    color: var(--color-text-secondary);
    font-size: 12px;
    background: #fafbfc;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.table-wrap td {
    padding: 11px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--color-text-primary);
}

.table-wrap tr:hover td { background: #fafbfc; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
}

.badge-success { background: #ecfdf5; color: #059669; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-danger  { background: #fef2f2; color: #dc2626; }
.badge-info    { background: #eff6ff; color: #2563eb; }
.badge-gray    { background: #f1f5f9; color: #64748b; }

.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 7px 12px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    outline: none;
    transition: border-color .12s, box-shadow .12s;
    background: #fff;
    color: var(--color-text-primary);
}

.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0,82,217,.08);
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    animation: toastIn .2s ease-out;
    max-width: 340px;
}

.toast-success { background: #059669; }
.toast-error   { background: #dc2626; }
.toast-warning { background: #d97706; }
.toast-info    { background: var(--color-primary); }
.toast-exit { animation: toastOut .15s ease-in forwards; }

@keyframes toastIn { from { opacity:0; transform:translateX(30px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { from { opacity:1; transform:translateX(0); } to { opacity:0; transform:translateX(30px); } }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--color-text-secondary);
}

.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: .3; }

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    justify-content: flex-end;
}

.pagination a, .pagination span {
    padding: 5px 11px;
    font-size: 13px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.pagination a:hover { background: #f1f5f9; }
.pagination .active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
}
