:root {
    color-scheme: light;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --danger: #ef4444;
    --success: #10b981;
    --th-bg: #f1f5f9;
}

[data-theme="dark"] {
    color-scheme: dark;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --th-bg: #0f172a;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background-color: var(--bg-color); color: var(--text-main); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Sidebar Layout */
.app-wrapper { display: flex; min-height: 100vh; position: relative; }
.sidebar { width: 260px; background: var(--card-bg); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; transition: transform 0.3s ease; z-index: 200; }
.sidebar-header { height: 64px; box-sizing: border-box; padding: 0 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); }
.nav-brand { font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sidebar-nav { padding: 16px 0; flex: 1; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 16px; padding: 10px 24px; color: var(--text-muted); border-radius: 0; font-weight: 500; font-size: 14px; transition: 0.2s; }
.nav-item i { font-size: 20px; font-weight: normal; }
.nav-item:hover { background: var(--bg-color); color: var(--text-main); }
.nav-item.active { background: rgba(37, 99, 235, 0.1); color: var(--primary); }
.nav-section-title { font-size: 0.7rem; text-transform: uppercase; font-weight: 600; color: var(--text-muted); margin: 16px 24px 8px 24px; letter-spacing: 0.05em; opacity: 0.7; }

/* Collapsible Menu */
.nav-group-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 24px; color: var(--text-muted); font-weight: 500; font-size: 14px; cursor: pointer; transition: 0.2s; }
.nav-group-header:hover { background: var(--bg-color); color: var(--text-main); }
.nav-group-header .group-left { display: flex; align-items: center; gap: 16px; }
.nav-group-header .group-left i { font-size: 20px; font-weight: normal; }
.nav-group-header .group-right i { font-size: 18px; color: var(--text-muted); opacity: 0.7; }
.nav-group-items { display: none; flex-direction: column; padding: 4px 0; }
.nav-group.open .nav-group-items { display: flex; }
.nav-subitem { display: flex; align-items: center; gap: 16px; padding: 10px 24px 10px 60px; color: var(--text-muted); font-weight: 400; font-size: 13.5px; transition: 0.2s; }
.nav-subitem:hover { background: var(--bg-color); color: var(--text-main); }
.nav-subitem.active { color: var(--primary); font-weight: 500; background: transparent; }
.nav-subitem i { font-size: 18px; }

.nav-group:not(.open) .chevron-open { display: none !important; }
.nav-group.open .chevron-closed { display: none !important; }

.sidebar-footer { padding: 24px; }

.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.4); z-index: 150; backdrop-filter: blur(2px); }

.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; background: var(--card-bg); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 100; }
.hamburger { display: none; font-size: 1.5rem; color: var(--text-main); cursor: pointer; padding: 8px; margin-left: -8px; }
.mobile-logo { display: none; font-size: 1.125rem; font-weight: 700; align-items: center; gap: 8px; color: var(--text-main); text-decoration: none; }
.dropdown-item { padding: 10px 16px; cursor: pointer; display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 500; color: var(--text-main); transition: 0.2s; text-decoration: none; white-space: nowrap; }
.dropdown-item:hover { background: var(--bg-color); }
.dropdown-item.text-danger { color: var(--danger); }
.dropdown-item i { font-size: 18px; }
.container { max-width: 100%; margin: 0; padding: 24px; }

@media (max-width: 768px) {
    .sidebar { position: fixed; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .hamburger { display: block; }
    .mobile-logo { display: flex; }
    .table-wrapper { overflow-x: auto; }
}

/* Cards */
.card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); overflow: hidden; }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); }
.card-body { padding: 24px; }
.card-footer { padding: 20px 24px; border-top: 1px solid var(--border-color); background: var(--bg-color); }

/* Typography */
h1 { font-size: 1.5rem; font-weight: 600; margin-bottom: 8px; color: var(--text-main); }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 16px; color: var(--text-main); }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; color: var(--text-main); }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 8px; font-weight: 500; font-size: 0.875rem; transition: 0.2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { border: 1px solid var(--border-color); background: var(--card-bg); }
.btn-outline:hover { background: var(--bg-color); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-text { color: var(--text-muted); }
.btn-text:hover { color: var(--text-main); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 8px; color: var(--text-main); }
.form-control { width: 100%; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 0.875rem; outline: none; transition: border-color 0.2s; background: var(--bg-color); color: var(--text-main); }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.file-drop-area { border: 2px dashed var(--border-color); border-radius: 8px; padding: 24px; text-align: center; cursor: pointer; transition: 0.2s; background: var(--bg-color); }
.file-drop-area:hover { border-color: var(--primary); background: rgba(37, 99, 235, 0.05); }

/* Table */
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th, .table td { padding: 12px 16px; border: 1px solid var(--border-color); font-size: 0.8125rem; vertical-align: middle; }
.table th { border-bottom: 2px solid var(--border-color); background: var(--th-bg); color: var(--text-main); font-weight: 600; text-align: center; }
.table td { color: var(--text-main); }
.table tr:hover { background: var(--bg-color); }
.table th.highlight { color: #7c3aed; } /* Purple highlight from image */

/* Modal */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.4); z-index: 300; backdrop-filter: blur(2px); align-items: center; justify-content: center; padding: 24px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--card-bg); border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); width: 100%; max-width: 600px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; background: var(--card-bg); z-index: 10; border-radius: 12px 12px 0 0; flex-shrink: 0; }
.modal-close { font-size: 1.5rem; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; transition: 0.2s; }
.modal-close:hover { background: var(--bg-color); color: var(--text-main); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 20px 24px; border-top: 1px solid var(--border-color); background: var(--bg-color); display: flex; justify-content: flex-end; gap: 12px; border-radius: 0 0 12px 12px; flex-shrink: 0; }

/* Badges */
.badge { padding: 4px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; display: inline-block; white-space: nowrap; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-blue { background: #eff6ff; color: #2563eb; }
.badge-green { background: #f0fdf4; color: #16a34a; }
.badge-purple { background: #f5f3ff; color: #7c3aed; }

/* Utils */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.block { display: block; }
