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

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

:root {
  --bg-base: #0d0f1a;
  --bg-surface: #131627;
  --bg-elevated: #1a1e32;
  --bg-hover: #1f2540;
  --border: #252a42;
  --border-light: #2d3357;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #4b5563;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --sidebar-w: 220px;
  --sidebar-w-col: 60px;
  --radius: 8px;
  --radius-lg: 12px;
}

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

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-base);
  min-width: 0;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3d4468;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease, min-width 0.25s ease;
  overflow: hidden;
}

.sidebar--collapsed {
  width: var(--sidebar-w-col);
  min-width: var(--sidebar-w-col);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 14px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.sidebar-logo-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.sidebar-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-nav-item--active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-hover);
}

.sidebar-nav-icon {
  flex-shrink: 0;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: color 0.15s;
}

.sidebar-toggle:hover {
  color: var(--text-secondary);
}

/* ─── Page ───────────────────────────────────────────────────────────────── */
.page {
  padding: 28px 32px;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Stat Cards ─────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent, #6366f1);
  opacity: 0.8;
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 20px;
}

.stat-trend.positive {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.stat-trend.negative {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat-title {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

.stat-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Charts ─────────────────────────────────────────────────────────────── */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 340px);
  gap: 16px;
}

.chart-grid--single {
  grid-template-columns: 1fr;
}

.chart-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.chart-card--wide {}

.chart-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.chart-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ─── Recent errors ──────────────────────────────────────────────────────── */
.recent-errors-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.recent-errors-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
}

.recent-error-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.recent-error-row:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.recent-error-ts {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  min-width: 130px;
}

.recent-error-src {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 120px;
}

.recent-error-msg {
  font-size: 12px;
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-error-exc {
  font-size: 10px;
  color: #ef4444;
  white-space: nowrap;
  font-weight: 600;
}

/* ─── Explorer toolbar ───────────────────────────────────────────────────── */
.explorer-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ─── Search Bar ─────────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  transition: border-color 0.2s;
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  padding: 11px 0;
  font-family: inherit;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 4px;
  transition: color 0.15s;
}

.search-clear:hover {
  color: var(--text-secondary);
}

.search-count {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ─── Filter Bar ─────────────────────────────────────────────────────────── */
.filter-bar {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.level-toggles {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.level-toggle {
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  transition: all 0.15s;
}

.level-toggle:hover {
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.time-range-buttons {
  display: flex;
  gap: 3px;
}

.time-range-btn {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.time-range-btn:hover {
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.time-range-btn--active {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
  color: #a5b4fc;
}

.source-select {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

.source-select:focus {
  border-color: var(--accent);
}

.clear-filters-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #ef444430;
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  font-size: 11px;
  cursor: pointer;
  margin-left: auto;
  transition: all 0.15s;
}

.clear-filters-btn:hover {
  background: rgba(239, 68, 68, 0.15);
}

.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-base);
  font-size: 11px;
  color: var(--text-secondary);
}

.filter-chip button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0;
}

.filter-chip button:hover {
  color: var(--text-secondary);
}

/* ─── Log Table ──────────────────────────────────────────────────────────── */
.log-table-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.log-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--bg-elevated);
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.log-table thead tr {
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.log-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.log-row {
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid rgba(37, 42, 66, 0.6);
}

.log-row:hover {
  background: var(--bg-hover);
}

.log-row--selected {
  background: rgba(99, 102, 241, 0.1) !important;
}

.log-row--error td {
  border-left: 2px solid #ef444440;
}

.log-row--fatal td {
  border-left: 2px solid #dc262640;
}

.log-row--warning td {
  border-left: 2px solid #f59e0b30;
}

.log-table td {
  padding: 9px 12px;
  vertical-align: middle;
}

.log-ts {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.log-source {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  max-width: 160px;
  text-overflow: ellipsis;
}

.log-msg {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 500px;
}

.log-exc-indicator {
  text-align: center;
}

.log-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.log-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.pagination-btn {
  display: flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-info {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ─── Log Detail Drawer ──────────────────────────────────────────────────── */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(560px, 95vw);
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 101;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.22s ease;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.detail-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-ts {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

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

.detail-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.detail-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.detail-close-btn {
  display: flex;
  align-items: center;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.detail-close-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.detail-section-title--error {
  color: #f87171;
}

.detail-message {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  word-break: break-word;
}

.detail-template {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  word-break: break-word;
}

.detail-kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.detail-kv tr {
  border-bottom: 1px solid var(--border);
}

.detail-kv tr:last-child {
  border-bottom: none;
}

.detail-kv td {
  padding: 7px 8px;
  vertical-align: top;
}

.detail-kv td:first-child {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  width: 130px;
  font-size: 11.5px;
}

.detail-kv td:last-child {
  color: var(--text-secondary);
  word-break: break-all;
}

.detail-kv code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #a5b4fc;
  white-space: pre-wrap;
}

.detail-exception {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #fca5a5;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
  overflow-x: auto;
}

/* ─── Login Page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.login-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.login-logo-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.login-logo-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.login-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.login-subheading {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.login-error {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: #fca5a5;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: 4px;
  transition: background 0.2s, transform 0.1s;
}

.login-btn:hover {
  background: var(--accent-hover);
}

.login-btn:active {
  transform: scale(0.98);
}

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: login-spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

.login-footer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin: 0;
}

/* ─── Authorizing splash (shown while auth state loads) ─────────────────── */
.auth-check-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-base);
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}

/* ─── Sidebar user section + logout ─────────────────────────────────────── */
.sidebar-user {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user-email {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 10px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}

.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Admin UI
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Sidebar admin section label ──────────────────────────────────────── */
.sidebar-nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 10px 2px;
  white-space: nowrap;
  overflow: hidden;
}

/* ─── Admin Table ───────────────────────────────────────────────────────── */
.admin-table-wrap {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.admin-table tbody tr:hover {
  background: var(--bg-hover);
}

/* ─── Status / Role Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge--success { background: rgba(34, 197, 94, 0.12);  color: #22c55e; }
.badge--danger  { background: rgba(239, 68, 68, 0.12);  color: #ef4444; }
.badge--warning { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.badge--info    { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
.badge--neutral { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }
.badge--accent  { background: rgba(99, 102, 241, 0.12);  color: #818cf8; }

/* ─── Admin Toolbar ─────────────────────────────────────────────────────── */
.admin-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-search {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  min-width: 200px;
  transition: border-color 0.2s;
}

.admin-search:focus {
  border-color: var(--accent);
}

.admin-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.admin-select:focus {
  border-color: var(--accent);
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: none;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn--danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn--danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.22);
}

.btn--success {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.btn--success:hover:not(:disabled) {
  background: rgba(34, 197, 94, 0.22);
}

.btn--outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn--outline:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn--sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn--xs {
  padding: 3px 9px;
  font-size: 11px;
}

/* ─── Admin Pagination ──────────────────────────────────────────────────── */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-surface);
}

.admin-pagination-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── Admin Alerts ──────────────────────────────────────────────────────── */
.admin-alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid;
}

.admin-alert--error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.admin-alert--success {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

/* ─── Admin Modal ───────────────────────────────────────────────────────── */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.admin-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 26px;
  min-width: 360px;
  max-width: 520px;
  width: 100%;
}

.admin-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.admin-modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.admin-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── Admin Forms ───────────────────────────────────────────────────────── */
.admin-form-group {
  margin-bottom: 16px;
}

.admin-form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-form-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.admin-form-input:focus {
  border-color: var(--accent);
}

.admin-form-select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.admin-form-select:focus {
  border-color: var(--accent);
}

/* ─── Action column ─────────────────────────────────────────────────────── */
.admin-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: nowrap;
}

/* ─── Monospace text ────────────────────────────────────────────────────── */
.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Config group ──────────────────────────────────────────────────────── */
.config-group {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.config-group-header {
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
