@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  --bg-primary: #16141c;
  --bg-secondary: #1c1a24;
  --bg-card: #221f2e;
  --bg-hover: #2a2738;
  --text-primary: #eae7f1;
  --text-secondary: #8a8698;
  --text-muted: #5c586a;
  --accent-purple: #6d4aff;
  --accent-blue: #6d4aff;
  --accent-green: #1ea885;
  --accent-red: #f44336;
  --accent-orange: #ff9800;
  --accent-pink: #e05aff;
  --border-color: #2e2b3a;
  --border-subtle: #262335;
  --sidebar-width: 260px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.15);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f7f7f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f3f3f5;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent-purple: #6d4aff;
  --accent-blue: #6d4aff;
  --accent-green: #059669;
  --accent-red: #dc2626;
  --accent-orange: #d97706;
  --border-color: #e5e7eb;
  --border-subtle: #f0f0f2;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04);
}
[data-theme="light"] .sidebar { background: #ffffff; border-color: #e5e7eb; }
[data-theme="light"] .sidebar-header h3 { color: #1a1a2e; }
[data-theme="light"] .sidebar-user { border-color: #f0f0f2; }
[data-theme="light"] .user-name { color: #1a1a2e; }
[data-theme="light"] .log-box { background: #1e1b2e; }
[data-theme="light"] .topbar { background: #ffffff; border-color: #e5e7eb; }
[data-theme="light"] .topbar-icon { background: #f3f4f6; color: #6d4aff; }
[data-theme="light"] .topbar h1 { color: #1a1a2e; }
[data-theme="light"] th { background: #f9fafb; color: #6b7280; border-color: #f0f0f2; }
[data-theme="light"] td { color: #374151; border-color: #f0f0f2; }
[data-theme="light"] tr:hover td { background: #f9fafb; }
[data-theme="light"] .stat-card { border-color: #e5e7eb; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
[data-theme="light"] .stat-card::before { background: #e5e7eb; }
[data-theme="light"] .stat-card .label { color: #6b7280; }
[data-theme="light"] .table-wrap { border-color: #e5e7eb; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
[data-theme="light"] input, [data-theme="light"] textarea, [data-theme="light"] select { background: #f9fafb; color: #1a1a2e; border-color: #e5e7eb; }
[data-theme="light"] input:focus, [data-theme="light"] textarea:focus { border-color: #6d4aff; box-shadow: 0 0 0 3px rgba(109,74,255,0.08); }
[data-theme="light"] .submenu li.active a { background: rgba(109,74,255,0.05) !important; }
[data-theme="light"] .sidebar-menu li.active > a { background: #f3f4f6; }
[data-theme="light"] .sidebar-menu li a:hover { background: #f3f4f6; }
[data-theme="light"] .sidebar-footer { border-color: #f0f0f2; }
[data-theme="light"] .topbar-btn { border-color: #e5e7eb; color: #6b7280; }
[data-theme="light"] .topbar-btn:hover { background: #f3f4f6; border-color: #6d4aff; color: #6d4aff; }
[data-theme="light"] .dropdown-menu { background: #fff; border-color: #e5e7eb; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
[data-theme="light"] .dropdown-item { color: #374151; }
[data-theme="light"] .dropdown-item:hover { background: #f3f4f6; color: #1a1a2e; }
[data-theme="light"] h3 { color: #1a1a2e; }
[data-theme="light"] a { color: #6d4aff; }
[data-theme="light"] .toast.success { background: #059669; }
[data-theme="light"] .toast.error { background: #dc2626; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; min-height: 100vh; }

/* ===== SIDEBAR (Proton-style) ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  padding: 0;
  position: fixed;
  height: 100vh;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
}
.sidebar-header h3 {
  color: var(--accent-purple);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* User section */
.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-user:hover { background: var(--bg-hover); }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: var(--text-muted);
}
.user-chevron {
  color: var(--text-muted);
  font-size: 10px;
  transition: var(--transition);
}

/* Menu */
.sidebar-menu {
  list-style: none;
  padding: 8px 10px;
  flex: 1;
}
.sidebar-menu > li { margin-bottom: 2px; }
.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border-left: none;
  position: relative;
}
.sidebar-menu li a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.sidebar-menu li.active > a {
  color: var(--text-primary);
  background: var(--bg-hover);
  font-weight: 600;
}
.sidebar-menu li.active > a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent-purple);
  border-radius: 0 3px 3px 0;
}
.sidebar-menu .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Submenu */
.has-submenu > a { position: relative; }
.arrow {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.25s ease;
  cursor: pointer;
  color: var(--text-muted);
}
.has-submenu.open .arrow { transform: rotate(180deg); }
.has-submenu.open .submenu { display: block !important; }
.submenu {
  list-style: none;
  padding: 2px 0 6px;
  margin: 0;
}
.submenu li a {
  padding: 8px 14px 8px 46px !important;
  font-size: 12.5px;
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  margin: 1px 0;
  border-left: none !important;
  background: none !important;
}
.submenu li a:hover {
  color: var(--text-primary) !important;
  background: var(--bg-hover) !important;
}
.submenu li.active a {
  color: var(--accent-purple) !important;
  background: rgba(109, 74, 255, 0.08) !important;
  font-weight: 600;
}
.submenu li.active a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--accent-purple);
  border-radius: 0 3px 3px 0;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== CONTENT ===== */
.content { margin-left: var(--sidebar-width); flex: 1; min-width: 0; overflow-x: hidden; transition: margin-left 0.2s ease; }

.topbar {
  padding: 20px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(109, 74, 255, 0.1);
  color: var(--accent-purple);
}
.topbar h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}
.topbar .badge {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-report { background: rgba(109,74,255,0.12); color: var(--accent-purple); }
.badge-abuse { background: rgba(255,152,0,0.12); color: var(--accent-orange); }

/* Topbar actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: var(--transition);
}
.topbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-purple);
}

.main-content { padding: 28px 32px; max-width: 100%; overflow-x: auto; }

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-color);
  transition: var(--transition);
}
.stat-card:hover::before {
  background: var(--accent-purple);
}
.stat-card:hover {
  border-color: var(--border-color);
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}
.stat-card .label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-card .value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.stat-card .value.blue { color: var(--accent-purple); }
.stat-card .value.green { color: var(--accent-green); }
.stat-card .value.red { color: var(--accent-red); }
.stat-card .value.orange { color: var(--accent-orange); }

/* ===== TABLES ===== */
.table-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border-color);
  overflow-x: auto;
  margin-bottom: 0;
}
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: transparent;
  border-bottom: 1px solid var(--border-color);
}
td { color: var(--text-primary); }
tr:hover td { background: rgba(109, 74, 255, 0.03); }
tr:last-child td { border-bottom: none; }
.aksi { opacity: 0.3; transition: opacity 0.2s; }
tr:hover .aksi, div:hover > .aksi { opacity: 1; }
.aksi span { font-size: 14px !important; padding: 2px 4px; }

/* ===== BUTTONS ===== */
.btn {
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary {
  background: var(--accent-purple);
  color: #fff;
  box-shadow: 0 1px 4px rgba(109, 74, 255, 0.3);
}
.btn-primary:hover {
  background: #5b3de6;
  box-shadow: 0 2px 8px rgba(109, 74, 255, 0.4);
  transform: translateY(-1px);
}
.btn-danger {
  background: var(--accent-red);
  color: #fff;
}
.btn-danger:hover { background: #d32f2f; }
.btn-success {
  background: var(--accent-green);
  color: #fff;
}
.btn-success:hover { background: #178f72; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ===== FORMS ===== */
input, textarea, select {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  transition: var(--transition);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(109, 74, 255, 0.12);
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}
.tab {
  padding: 12px 20px;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 500;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--accent-purple);
  border-bottom-color: var(--accent-purple);
  font-weight: 600;
}

/* ===== LOG BOX ===== */
.log-box {
  background: #0e0c14;
  color: #1ea885;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  padding: 16px;
  border-radius: var(--radius-md);
  height: 300px;
  overflow-y: auto;
  font-size: 12.5px;
  white-space: pre-wrap;
  border: 1px solid var(--border-color);
  line-height: 1.6;
}

/* ===== FAQ ===== */
.faq-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}
.faq-item:hover { border-color: var(--accent-purple); }
.faq-q {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}
.faq-q:hover { color: var(--accent-purple); }
.faq-a {
  padding: 0 20px 16px;
  color: var(--text-secondary);
  display: none;
  font-size: 13px;
  line-height: 1.7;
}
.faq-item.open .faq-a { display: block; }
.faq-item.open { border-color: var(--accent-purple); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.toast.success { background: var(--accent-green); }
.toast.error { background: var(--accent-red); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== DROPDOWN (Proton-style) ===== */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  z-index: 200;
  display: none;
  animation: dropIn 0.2s ease;
}
.dropdown-menu.show { display: block; }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'Inter', sans-serif;
}
.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* ===== TOGGLE / SWITCH (Proton-style) ===== */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border-color);
  border-radius: 100px;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle input:checked + .toggle-slider {
  background: var(--accent-purple);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 6px;
  background: var(--border-color);
  border-radius: 100px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--accent-purple);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== BADGE / PILL ===== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.pill-purple { background: rgba(109,74,255,0.12); color: var(--accent-purple); }
.pill-green { background: rgba(30,168,133,0.12); color: var(--accent-green); }
.pill-red { background: rgba(244,67,54,0.12); color: var(--accent-red); }
.pill-orange { background: rgba(255,152,0,0.12); color: var(--accent-orange); }

/* ===== SECTION HEADERS ===== */
h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== SELECTION ===== */
::selection { background: rgba(109, 74, 255, 0.25); color: #fff; }

/* ===== LOGIN PAGE ===== */
.login-page {
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-card);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header h1 { font-size: 20px; color: var(--text-primary); margin-top: 12px; font-weight: 700; }
.login-header p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-error {
  background: rgba(244,67,54,0.1);
  border: 1px solid rgba(244,67,54,0.25);
  color: var(--accent-red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.input-icon {
  position: relative;
}
.input-icon svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.input-icon input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
}
.input-icon input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(109,74,255,0.15);
}
.login-btn {
  width: 100%;
  padding: 11px;
  background: var(--accent-purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}
.login-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* ===== SIDEBAR EXTRAS ===== */
.sidebar-divider { height: 1px; background: var(--border-color); margin: 8px 12px; list-style: none; }
.sidebar-section { list-style:none; padding:14px 20px 4px; }
.sidebar-section span { font-size:9px; font-weight:700; color:var(--text-muted); letter-spacing:1.5px; text-transform:uppercase; }
@media (max-width:1024px) { .sidebar-section { display:none; } }
.logout-link { color: var(--accent-red) !important; }
.logout-link:hover { background: rgba(244,67,54,0.1) !important; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 90%; max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 16px; color: var(--text-primary); }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal form { padding: 20px; }
.modal .form-group { margin-bottom: 16px; }
.modal .form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.modal .form-group input,
.modal .form-group select {
  width: 100%; padding: 9px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px; font-family: inherit;
}
.modal .form-group input:focus,
.modal .form-group select:focus {
  outline: none; border-color: var(--accent-purple);
}
.modal .form-group small { display: block; margin-top: 4px; font-size: 11px; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding-top: 8px;
}

/* ===== BADGES ===== */
.badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-danger { background: rgba(244,67,54,0.15); color: var(--accent-red); }
.badge-warning { background: rgba(255,152,0,0.15); color: var(--accent-orange); }
.badge-info { background: rgba(109,74,255,0.15); color: var(--accent-purple); }
.badge-success { background: rgba(30,168,133,0.15); color: var(--accent-green); }
.badge-secondary { background: rgba(140,140,140,0.15); color: var(--text-muted); }

/* ===== BUTTONS (reusable) ===== */
.btn { padding: 7px 14px; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; transition: var(--transition); }
.btn-primary { background: var(--accent-purple); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--bg-hover); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-sm { padding: 5px 8px; font-size: 12px; }
.btn-outline { background: none; border: 1px solid var(--border-color); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent-purple); color: var(--accent-purple); }
.btn-danger-outline { background: none; border: 1px solid rgba(244,67,54,0.3); color: var(--accent-red); }
.btn-danger-outline:hover { background: rgba(244,67,54,0.1); }

/* ===== RESPONSIVE ===== */

/* Global responsive helpers — override inline fixed-width styles */
@media (max-width: 1200px) {
  /* Tables: always scrollable */
  table { table-layout: auto !important; }
  .table-wrap, [style*="overflow-x"] { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }

  /* Flex containers: allow wrapping */
  [style*="display:flex"], [style*="display: flex"] { flex-wrap: wrap !important; }

  /* Fixed-width inline cards: shrink */
  [style*="min-width:110px"], [style*="min-width: 110px"] { min-width: 90px !important; }
  [style*="max-width:160px"], [style*="max-width: 160px"] { max-width: none !important; }
  [style*="min-width:200px"], [style*="min-width: 200px"] { min-width: 140px !important; }
  [style*="min-width:220px"], [style*="min-width: 220px"] { min-width: 160px !important; }
  [style*="min-width:240px"], [style*="min-width: 240px"] { min-width: 160px !important; }

  /* Canvas charts: scale down */
  canvas { max-width: 100% !important; height: auto !important; }
}

/* Restore down / medium screens */
@media (max-width: 1200px) {
  .sidebar { width: 200px; }
  :root { --sidebar-width: 200px; }
  .content { margin-left: 200px; }
  .main-content { padding: 20px; }
  .topbar { padding: 16px 20px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
}

@media (max-width: 1024px) {
  .sidebar { width: 60px; }
  :root { --sidebar-width: 60px; }
  .sidebar-header h3, .sidebar-menu li a span:not(.icon), .sidebar-user .user-info,
  .sidebar-footer span, .submenu a span { display: none; }
  .sidebar-menu li a { justify-content: center; padding: 10px; }
  .sidebar-menu .icon { margin-right: 0; }
  .sidebar-header { justify-content: center; }
  .sidebar-user { justify-content: center; padding: 12px 8px; }
  .submenu { padding-left: 0; }
  .submenu a { justify-content: center; padding: 8px; }
  .content { margin-left: 60px; }
  .main-content { padding: 16px; }
  .topbar { padding: 14px 16px; }
  .topbar h1 { font-size: 16px; }

  /* Inline stat cards: smaller */
  [style*="min-width:110px"] { min-width: 80px !important; max-width: 120px !important; font-size: 10px !important; }
  [style*="min-width:200px"] { min-width: 120px !important; }
  [style*="width:250px"] { width: 100% !important; max-width: 250px !important; }
}

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header h3, .sidebar-menu li a span:not(.icon), .sidebar-user, .sidebar-footer span { display: none; }
  .content { margin-left: 60px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .main-content { padding: 12px; }
  .topbar { padding: 12px; }
  .topbar h1 { font-size: 15px; }
  .login-card { padding: 28px 20px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 22px; }
  .table-wrap { padding: 12px; }

  /* Inline grid/flex: stack vertically */
  [style*="gap:8px"], [style*="gap: 8px"],
  [style*="gap:6px"], [style*="gap: 6px"] { gap: 6px !important; }

  /* Progress bars inline: full width */
  [style*="width:100px"] { width: 80px !important; }

  /* Forms: stack */
  [style*="min-width:160px"] { min-width: 100% !important; }
}
