:root {
  --sidebar-w: 260px;
  --primary: #c45c26;
  --primary-dark: #a34a1c;
  --primary-light: #e87a3a;
  --accent: #f5c518;
  --bg: #0f0f12;
  --bg-card: #1a1a21;
  --bg-sidebar: #141419;
  --border: #2a2a35;
  --text: #e8e8ed;
  --text-muted: #9a9aa8;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,.35);
}

[data-theme="light"] {
  --bg: #f2f3f6;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --border: #e3e5ea;
  --text: #1e2230;
  --text-muted: #6b7280;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
}

[data-theme="light"] .sidebar-brand h1 { color: var(--text); }
[data-theme="light"] .table th { background: rgba(0,0,0,.02); }
[data-theme="light"] .table tbody tr:hover { background: rgba(0,0,0,.025); }
[data-theme="light"] .btn-outline:hover { background: rgba(0,0,0,.05); }
[data-theme="light"] .form-control::placeholder { color: #9ca3af; }
[data-theme="light"] .spinner { border-color: rgba(0,0,0,.15); border-top-color: var(--primary); }
[data-theme="light"] .top-bar-bg { background: rgba(0,0,0,.08); }
[data-theme="light"] .pending-card .stat-value { color: #dc2626; }
[data-theme="light"] .alert-danger { color: #b91c1c; }
[data-theme="light"] .alert-success { color: #15803d; }
[data-theme="light"] .alert-info { color: #1d4ed8; }
[data-theme="light"] .modal-overlay { background: rgba(15,15,18,.45); }
[data-theme="light"] .badge-success { color: #15803d; }
[data-theme="light"] .badge-danger { color: #b91c1c; }
[data-theme="light"] .badge-warning { color: #b45309; }
[data-theme="light"] .badge-info { color: #1d4ed8; }
[data-theme="light"] .badge-secondary { color: #4b5563; }
[data-theme="light"] .trend.up { color: #15803d; }
[data-theme="light"] .trend.down { color: #dc2626; }

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
}

.sidebar-brand {
  padding: 1.4rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .logo {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.2rem; color: #fff;
}

.sidebar-brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #fff;
}

.sidebar-brand span { font-size: .7rem; color: var(--text-muted); display: block; }

.sidebar-nav { flex: 1; padding: 1rem .75rem; overflow-y: auto; }

.nav-section {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: .75rem .75rem .35rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .9rem;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: all .15s;
  margin-bottom: 2px;
}

.nav-link i { width: 20px; text-align: center; font-size: 1.05rem; }

.nav-link:hover {
  background: rgba(196,92,38,.12);
  color: var(--primary-light);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(196,92,38,.25), rgba(245,197,24,.08));
  color: var(--primary-light);
  border: 1px solid rgba(196,92,38,.3);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

/* Main */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.topbar-title { font-size: 1.15rem; font-weight: 600; }

.user-menu {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .15s;
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: #fff;
}

.page-body { padding: 1.5rem; flex: 1; }

/* Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: transform .15s, box-shadow .15s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}

.stat-icon.orange { background: rgba(196,92,38,.2); color: var(--primary-light); }
.stat-icon.green { background: rgba(34,197,94,.15); color: var(--success); }
.stat-icon.blue { background: rgba(59,130,246,.15); color: var(--info); }
.stat-icon.yellow { background: rgba(245,197,24,.15); color: var(--accent); }

.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}

.card-header h5 { font-size: 1rem; font-weight: 600; margin: 0; }

.card-body { padding: 1.25rem; }

/* Table */
.table-responsive { overflow-x: auto; }

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

.table th {
  text-align: left;
  padding: .75rem 1rem;
  background: rgba(255,255,255,.03);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:hover { background: rgba(255,255,255,.02); }

.table img.thumb {
  width: 42px; height: 42px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 560;
  border: none;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  color: #fff;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-light), var(--primary)); box-shadow: 0 4px 12px rgba(196,92,38,.35); }

.btn-success { background: var(--success); }
.btn-success:hover { filter: brightness(1.1); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { filter: brightness(1.1); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: rgba(255,255,255,.05); border-color: var(--text-muted); }

.btn-sm { padding: .3rem .6rem; font-size: .78rem; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  justify-content: center;
  border-radius: 8px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
}

.badge-success { background: rgba(34,197,94,.15); color: var(--success); }
.badge-danger { background: rgba(239,68,68,.15); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-info { background: rgba(59,130,246,.15); color: var(--info); }
.badge-secondary { background: rgba(154,154,168,.15); color: var(--text-muted); }

/* Forms */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 560;
  color: var(--text-muted);
  margin-bottom: .35rem;
}

.form-control {
  width: 100%;
  padding: .6rem .85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  transition: border-color .15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(196,92,38,.2);
}

.form-control::placeholder { color: #5a5a6a; }

.form-check {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.form-check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.show { display: flex; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h5 { font-size: 1.05rem; font-weight: 600; margin: 0; }

.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.4rem; cursor: pointer; line-height: 1;
  padding: .2rem;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 1.35rem; }
.modal-footer {
  padding: 1rem 1.35rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
}

/* Auth pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(196,92,38,.15), transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(245,197,24,.08), transparent 50%),
              var(--bg);
  padding: 1.5rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800; color: #fff;
  margin: 0 auto 1.25rem;
}

.auth-card h2 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: .35rem;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 1.75rem;
}

.alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  margin-bottom: 1rem;
}

.alert-danger { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); color: #86efac; }
.alert-info { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3); color: #93c5fd; }

.auth-links {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .85rem;
}

.auth-links a { color: var(--primary-light); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

/* Toast */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast {
  padding: .85rem 1.15rem;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn .25s ease;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.toast-success { background: #166534; color: #dcfce7; border: 1px solid #22c55e; }
.toast-error { background: #7f1d1d; color: #fecaca; border: 1px solid #ef4444; }
.toast-info { background: #1e3a5f; color: #bfdbfe; border: 1px solid #3b82f6; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Loading */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state i { font-size: 2.5rem; margin-bottom: .75rem; opacity: .4; }

/* Mobile */
.menu-toggle {
  display: none;
  background: none; border: none; color: var(--text);
  font-size: 1.4rem; cursor: pointer;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .stat-card { margin-bottom: .75rem; }
}

.overlay-sidebar {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}
.overlay-sidebar.show { display: block; }
