:root {
    --primary: #dc0032;
    --primary-dark: #a9062b;
    --primary-light: #e8193f;
    --accent: #a9062b;
    --sidebar-width: 260px;
    --sidebar-bg: #1a0a0e;
    --sidebar-text: rgba(255,255,255,0.8);
    --sidebar-hover: rgba(220,0,50,0.15);
    --sidebar-active: rgba(220,0,50,0.25);
    --topbar-height: 60px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f0f2f7;
    color: #1a1a2e;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-brand .brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.sidebar-brand .brand-img {
    width: 40px; height: 40px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
    background: white;
    padding: 3px;
}

.sidebar-brand .brand-text {
    line-height: 1.2;
}

.sidebar-brand .brand-name {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.3px;
}

.sidebar-brand .brand-sub {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-section {
    padding: 16px 16px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.3);
}

.sidebar-nav .nav-item .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 0;
    transition: all 0.2s;
    margin: 1px 8px;
    border-radius: 8px;
}

.sidebar-nav .nav-item .nav-link:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-nav .nav-item .nav-link.active {
    background: var(--primary-light);
    color: white;
}

.sidebar-nav .nav-item .nav-link .nav-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}

.sidebar-nav .nav-item .nav-link.active .nav-icon {
    opacity: 1;
}

.sidebar-nav .nav-item .nav-link .badge {
    margin-left: auto;
    font-size: 10px;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.sidebar-footer .user-info:hover {
    background: var(--sidebar-hover);
}

.sidebar-footer .user-avatar {
    width: 34px; height: 34px;
    background: var(--primary-light);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-footer .user-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    line-height: 1.2;
}

.sidebar-footer .user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

/* ===== MAIN CONTENT ===== */
#main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar .page-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    flex: 1;
}

.topbar .topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    border: 1px solid #e8ecf0;
    background: white;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-icon:hover {
    background: #f0f2f7;
    color: #1a1a2e;
    border-color: #d1d5db;
}

/* ===== PAGE CONTENT ===== */
.page-content {
    flex: 1;
    padding: 24px;
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: white;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid #e8ecf0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

/* ===== CARDS ===== */
.content-card {
    background: white;
    border-radius: 14px;
    border: 1px solid #e8ecf0;
    overflow: hidden;
}

.content-card .card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e8ecf0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-card .card-header h5 {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.content-card .card-body {
    padding: 20px;
}

/* ===== TABLE ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    padding: 10px 16px;
    border-bottom: 1px solid #e8ecf0;
    white-space: nowrap;
    background: #fafbfc;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13.5px;
    vertical-align: middle;
}

.data-table tbody tr:hover td {
    background: #fafbfc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== SYSTEM CARD PREVIEW ===== */
.sys-card-preview {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sys-icon-preview {
    width: 36px; height: 36px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.sys-name-preview {
    font-weight: 600;
    font-size: 13.5px;
    color: #1a1a2e;
}

.sys-url-preview {
    font-size: 11.5px;
    color: #9ca3af;
    margin-top: 1px;
}

/* ===== BADGES ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}

.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* ===== FORMS ===== */
.form-section {
    background: white;
    border-radius: 14px;
    border: 1px solid #e8ecf0;
    padding: 24px;
    margin-bottom: 20px;
}

.form-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.form-control, .form-select {
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    padding: 9px 12px;
    font-size: 13.5px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,48,135,0.1);
}

.form-hint {
    font-size: 11.5px;
    color: #9ca3af;
    margin-top: 4px;
}

/* ===== BUTTONS ===== */
.btn {
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 9px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-sm {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 7px;
}

.btn-xs {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
}

/* ===== COLOR PICKER ===== */
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker-wrap input[type="color"] {
    width: 40px; height: 38px;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    border: 1.5px solid #e5e7eb;
}

/* ===== DRAG HANDLE ===== */
.drag-handle {
    cursor: grab;
    color: #d1d5db;
    padding: 4px;
}

.drag-handle:active {
    cursor: grabbing;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #2a0008 0%, #8b0018 50%, #dc0032 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, #dc0032, #a9062b);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

/* ===== ALERTS ===== */
.alert {
    border: none;
    border-radius: 10px;
    font-size: 13.5px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.open {
        transform: translateX(0);
    }
    #main-content {
        margin-left: 0;
    }
}

/* ===== DRAG AND DROP ===== */
.sortable-ghost {
    opacity: 0.4;
    background: #e8ecf0 !important;
}

.sortable-chosen {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* ===== MISC ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #9ca3af;
}

.empty-state svg {
    margin-bottom: 12px;
    opacity: 0.4;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: #1a1a2e;
    margin: 0;
}

.page-header p {
    font-size: 13px;
    color: #6b7280;
    margin: 4px 0 0;
}

.breadcrumb {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.breadcrumb a {
    color: #6b7280;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.divider {
    border: none;
    border-top: 1px solid #e8ecf0;
    margin: 20px 0;
}
