/* ChainSight App CSS — matches landing page design tokens */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #161f31;
  --fg-primary: #e8ecf4;
  --fg-secondary: #8892a8;
  --fg-muted: #4a5568;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --accent-bright: #60a5fa;
  --border: #1e293b;
  --border-light: #243044;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --sidebar-width: 240px;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--fg-primary);
  font-family: var(--font-display);
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 40px;
  max-width: 100%;
  overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  z-index: 50;
}

.sidebar-brand {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--fg-primary);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand-icon { color: var(--accent); font-size: 1.2rem; }

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--fg-muted);
  letter-spacing: 0.1em;
  margin-top: 4px;
  display: block;
}

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

.sidebar-nav li { margin-bottom: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--fg-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: var(--bg-card); color: var(--fg-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--accent-bright); }

.sidebar-cta {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.btn-block { display: block; width: 100%; text-align: center; }

.sidebar-footer {
  padding: 12px 20px 0;
}

.sidebar-footer-link {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-decoration: none;
}

.sidebar-footer-link:hover { color: var(--fg-secondary); }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.back-link {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-decoration: none;
  display: block;
  margin-bottom: 8px;
}
.back-link:hover { color: var(--fg-secondary); }

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-subtitle {
  color: var(--fg-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

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

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
}

.stat-value--accent { color: var(--accent-bright); }
.stat-value--warning { color: var(--warning); }

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

/* ===== PANEL ===== */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.panel--full { grid-column: 1 / -1; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg-primary);
  letter-spacing: -0.01em;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

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

.btn-ghost {
  background: transparent;
  color: var(--fg-secondary);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover { border-color: var(--fg-muted); color: var(--fg-primary); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-bar--extended {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  padding: 14px 20px;
}

/* ===== INPUTS ===== */
.input,
.form-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--fg-primary);
  font-family: var(--font-display);
  font-size: 0.875rem;
  padding: 9px 12px;
  width: 100%;
  transition: border-color 0.15s;
}

.input:focus,
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-sm { padding: 6px 10px; font-size: 0.8rem; width: auto; flex: 1; min-width: 120px; }

.input-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

.mono-input { font-family: var(--font-mono); }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }

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

.table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

.table-row-link {
  cursor: pointer;
  transition: background 0.1s;
}

.table-row-link:hover { background: rgba(255,255,255,0.03); }
.table-row-link:last-child td { border-bottom: none; }

.table-count {
  padding: 10px 20px;
  font-size: 0.75rem;
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
}

.description-cell {
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-lg { padding: 4px 12px; font-size: 0.75rem; }

.badge--active { background: rgba(16,185,129,0.12); color: #10b981; }
.badge--pending { background: rgba(245,158,11,0.12); color: #f59e0b; }
.badge--closed { background: rgba(100,116,139,0.15); color: #64748b; }
.badge--received { background: rgba(59,130,246,0.12); color: var(--accent-bright); }
.badge--in_lab { background: rgba(168,85,247,0.12); color: #a855f7; }
.badge--analyzed { background: rgba(16,185,129,0.12); color: #10b981; }
.badge--returned { background: rgba(100,116,139,0.15); color: #64748b; }

/* Evidence type badges */
.type-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(59,130,246,0.08);
  color: var(--fg-secondary);
  border: 1px solid var(--border-light);
}

.type--biological { color: #34d399; border-color: rgba(52,211,153,0.25); }
.type--digital { color: var(--accent-bright); border-color: rgba(59,130,246,0.25); }
.type--firearms { color: #f87171; border-color: rgba(248,113,113,0.25); }
.type--narcotics { color: #a78bfa; border-color: rgba(167,139,250,0.25); }
.type--trace { color: #fbbf24; border-color: rgba(251,191,36,0.25); }

/* ===== ACTIVITY FEED ===== */
.activity-feed { padding: 8px 0; }

.activity-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-action {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.activity-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 3px;
}

.activity-item-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg-primary);
  text-decoration: none;
}
.activity-item-link:hover { color: var(--accent-bright); }

.activity-meta {
  display: flex;
  gap: 12px;
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.activity-case a { color: var(--accent-bright); text-decoration: none; }

/* Action color coding */
.action--intake { background: rgba(59,130,246,0.15); color: var(--accent-bright); }
.action--transfer { background: rgba(168,85,247,0.15); color: #a855f7; }
.action--analysis { background: rgba(251,191,36,0.15); color: #fbbf24; }
.action--checkout { background: rgba(245,158,11,0.15); color: #f59e0b; }
.action--checkin { background: rgba(16,185,129,0.15); color: #10b981; }
.action--returned { background: rgba(100,116,139,0.15); color: #64748b; }
.action--other { background: rgba(100,116,139,0.1); color: var(--fg-muted); }

/* ===== FORMS ===== */
.form-container {
  max-width: 720px;
}

.form { display: flex; flex-direction: column; gap: 0; }
.form-compact .form-group { margin-bottom: 12px; }

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 16px;
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 18px;
}

.form-group {
  margin-bottom: 18px;
}
.form-group:last-child { margin-bottom: 0; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-secondary);
  margin-bottom: 6px;
}

.required { color: var(--danger); }

.form-hint {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 5px;
}

.form-hint--warn { color: var(--warning); }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 8px;
}

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: 7px;
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: #f87171;
}

/* ===== DETAIL PAGE ===== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-bottom: 20px;
}

.detail-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0;
  padding: 8px 20px;
}

.detail-list dt {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-list dd {
  font-size: 0.875rem;
  color: var(--fg-primary);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.notes-text { color: var(--fg-secondary); font-style: italic; }

.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.8rem;
}

/* ===== CUSTODY TIMELINE ===== */
.custody-timeline {
  padding: 20px;
}

.custody-event {
  display: flex;
  gap: 16px;
  margin-bottom: 0;
}

.custody-event-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 16px;
}

.custody-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  flex-shrink: 0;
  margin-top: 4px;
}

.custody-dot.action--intake { border-color: var(--accent); background: var(--accent-glow); }
.custody-dot.action--transfer { border-color: #a855f7; }
.custody-dot.action--analysis { border-color: #fbbf24; }
.custody-dot.action--checkin { border-color: #10b981; }
.custody-dot.action--returned { border-color: #64748b; }

.custody-line {
  width: 1px;
  flex: 1;
  background: var(--border);
  margin: 4px 0;
  min-height: 24px;
}

.custody-event-body {
  padding-bottom: 20px;
  flex: 1;
}

.custody-event-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.custody-action-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 3px;
}

.custody-handler {
  font-size: 0.875rem;
  font-weight: 600;
}

.custody-time {
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.custody-locations {
  display: flex;
  gap: 8px;
  font-size: 0.78rem;
  margin-top: 4px;
}

.custody-notes {
  font-size: 0.8rem;
  margin-top: 4px;
  font-style: italic;
}

/* ===== MISC ===== */
.mono { font-family: var(--font-mono); font-size: 0.85em; }

.muted { color: var(--fg-muted); }

.case-ref { color: var(--accent-bright); font-size: 0.8em; }

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--fg-muted);
}

.empty-state a { color: var(--accent-bright); }

.case-description {
  padding: 16px 20px;
  margin-bottom: 20px;
  color: var(--fg-secondary);
  font-size: 0.9rem;
}

.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.error-icon {
  font-size: 3rem;
  color: var(--warning);
  margin-bottom: 16px;
}

/* ===== MOBILE TOPBAR ===== */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--fg-primary);
  text-decoration: none;
}

.hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-primary);
  border-radius: 8px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.hamburger-btn:hover { background: var(--bg-card); }

.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hamburger-icon span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--fg-primary);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* Hamburger → X animation */
.nav-open .hamburger-icon span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .hamburger-icon span:nth-child(2) { opacity: 0; }
.nav-open .hamburger-icon span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 98;
  backdrop-filter: blur(2px);
}

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

/* Tablet (768px–1024px) */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
}

/* Tablet smaller (640px–900px) */
@media (max-width: 900px) {
  :root { --sidebar-width: 200px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .app-main { padding: 24px 20px; }
}

/* Mobile (≤640px) — hamburger drawer nav */
@media (max-width: 640px) {
  /* Show topbar, hide static sidebar */
  .mobile-topbar { display: flex; }
  .app-main {
    margin-left: 0;
    padding: 72px 16px 24px; /* 56px topbar + 16px */
  }

  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99;
    width: 260px;
  }

  .sidebar.sidebar--open {
    transform: translateX(0);
  }

  .sidebar-overlay.overlay--visible {
    display: block;
  }

  /* Stats: 1-col on very small, 2-col on wider mobile */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card { padding: 16px; }
  .stat-value { font-size: 1.6rem; }

  /* Single column layouts */
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  /* Page header: stack on mobile */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
  }

  .header-actions { flex-wrap: wrap; }

  /* Form actions: full-width on mobile */
  .form-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .form-actions .btn { width: 100%; justify-content: center; }

  /* Filter bar: wrap and stack */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 16px;
  }
  .filter-bar .input-sm { min-width: 0; width: 100%; }
  .filter-bar .btn { align-self: flex-start; min-height: 44px; padding: 10px 20px; }

  /* Touch-friendly tap targets */
  .btn { min-height: 44px; padding: 10px 18px; }
  .btn-sm { min-height: 40px; padding: 8px 14px; }
  .nav-item { min-height: 44px; padding: 12px 14px; }
  .input, .form-input { min-height: 44px; padding: 10px 12px; }

  /* Tables: horizontal scroll on mobile */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 480px; }

  /* Custody timeline: tighter on mobile */
  .custody-timeline { padding: 12px 16px; }
  .custody-event-body { padding-bottom: 16px; }
  .custody-event-header { flex-wrap: wrap; gap: 6px; }

  /* Detail list: stack label above value */
  .detail-list {
    grid-template-columns: 1fr;
    padding: 4px 16px;
  }
  .detail-list dt {
    padding: 10px 0 2px;
    border-bottom: none;
  }
  .detail-list dd {
    padding: 0 0 10px;
  }

  /* Form sections */
  .form-section { padding: 16px; }
  .form-container { max-width: 100%; }

  /* Inline actions: wrap */
  .inline-actions { flex-wrap: wrap; gap: 8px; }

  /* Auth card: remove excess padding */
  .auth-card { padding: 24px 20px; }

  /* Page title */
  .page-title { font-size: 1.3rem; }
}

/* Very small screens (≤375px) */
@media (max-width: 375px) {
  .stats-grid { grid-template-columns: 1fr; }
  .app-main { padding: 68px 12px 20px; }
}

/* ===== AUTH PAGES ===== */
.auth-page {
  background: var(--bg-primary);
  color: var(--fg-primary);
  font-family: var(--font-display);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-container {
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  justify-content: center;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg-primary);
  margin: 0 0 6px 0;
}

.auth-subtitle {
  color: var(--fg-secondary);
  font-size: 0.9rem;
  margin: 0 0 24px 0;
}

.auth-form { display: flex; flex-direction: column; gap: 18px; }

.auth-switch {
  margin-top: 20px;
  text-align: center;
  color: var(--fg-secondary);
  font-size: 0.875rem;
}

.auth-switch a {
  color: var(--accent-bright);
  text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }

.form-error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  color: #fca5a5;
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.btn-full { width: 100%; }

.form-hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-weight: 400;
}

/* ===== SIDEBAR ORG + LOGOUT ===== */
.sidebar-org {
  font-size: 0.75rem;
  color: var(--fg-muted);
  padding: 0 20px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-icon { font-size: 0.8rem; color: var(--accent); }

.sidebar-logout {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.8rem;
  display: block;
  width: 100%;
  text-align: left;
  padding: 4px 20px;
  color: var(--fg-muted);
  transition: color 0.15s;
}

.sidebar-logout:hover { color: var(--danger); }

/* ===== ADMIN SIDEBAR ENHANCEMENTS ===== */
.sidebar-user {
  padding: 8px 20px;
  border-top: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-meta {
  font-size: 0.7rem;
  color: var(--fg-muted);
  margin-top: 2px;
}

.sidebar-admin-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--accent-bright);
  text-decoration: none;
  font-weight: 500;
}

.sidebar-admin-link:hover { text-decoration: underline; }

.sidebar-logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.8rem;
  width: 100%;
  text-align: left;
  color: var(--fg-muted);
  transition: color 0.15s;
  padding: 4px 0;
}

.sidebar-logout-btn:hover { color: var(--danger); }

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 20px;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* ===== ADMIN DATA TABLE ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--fg-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-primary);
  vertical-align: middle;
}

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

.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.td-mono { font-family: var(--font-mono); font-size: 0.8rem; }
.td-muted { color: var(--fg-secondary); }
.td-name { font-weight: 500; }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-default {
  background: rgba(136, 146, 168, 0.15);
  color: var(--fg-secondary);
}

.badge-accent {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-bright);
}

/* ===== ACTION GROUPS ===== */
.action-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.inline-details summary { cursor: pointer; list-style: none; }
.inline-details summary::-webkit-details-marker { display: none; }

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ===== FORM PANEL (admin forms) ===== */
.form-panel {
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.form-stack { display: flex; flex-direction: column; gap: 20px; }

.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }

.link { color: var(--accent-bright); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ===== INLINE NEW FORM (orgs page) ===== */
.inline-new-form {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 0 16px;
}

.inline-new-form .input { flex: 1; }

/* ===== DANGER BUTTON ===== */
.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}
