/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-input: #16213e;
  --bg-sidebar: #0d0d1a;
  --border: #2a2a4a;
  --text: #e0e0e0;
  --text-muted: #8888aa;
  --primary: #4a6cf7;
  --primary-hover: #3a5ce5;
  --accent: #00d4aa;
  --danger: #e74c3c;
  --warning: #f39c12;
  --success: #27ae60;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --header-h: 56px;
  --sidebar-w: 240px;
  --transition: 0.2s ease;
}

html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Header === */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}
.header-left, .header-right { display: flex; align-items: center; gap: 12px; }
.header-title { font-size: 1.1rem; font-weight: 600; white-space: nowrap; }
.user-display { font-size: 0.85rem; color: var(--text-muted); }

/* Global search */
.global-search-wrap {
  position: relative;
}
.global-search-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}
#global-search {
  width: 220px;
  padding: 6px 10px 6px 32px;
  font-size: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: width 0.2s, border-color 0.2s;
}
#global-search:focus {
  width: 320px;
  border-color: var(--primary);
  outline: none;
}
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 420px;
  max-height: 480px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 200;
}
.search-results.hidden { display: none; }
.search-result-group {
  padding: 6px 12px 2px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.search-result-item {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
}
.search-result-item:hover { background: rgba(108,99,255,0.1); }
.search-result-item:last-child { border-bottom: none; }
.search-result-title { font-weight: 600; font-size: 0.9rem; }
.search-result-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.search-result-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.search-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
@media (max-width: 768px) {
  #global-search { width: 140px; }
  #global-search:focus { width: 200px; }
  .search-results { width: 300px; }
}

.icon-btn {
  background: none; border: none; color: var(--text); cursor: pointer;
  padding: 6px; border-radius: var(--radius); display: flex; align-items: center;
  transition: background var(--transition);
  position: relative;
}
.icon-btn:hover { background: rgba(255,255,255,0.08); }

.badge {
  position: absolute; top: 0; right: 0;
  background: var(--danger); color: #fff; font-size: 0.65rem;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* === Notifications Panel === */
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute; top: 100%; right: 0; margin-top: 8px;
  width: 340px; max-height: 420px; overflow-y: auto;
  background: #1a1a2e; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 2000;
}
.notif-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.btn-link {
  background: none; border: none; color: var(--primary);
  cursor: pointer; font-size: 0.8rem; padding: 0;
}
.btn-link:hover { text-decoration: underline; }
.notif-list { padding: 0; }
.notif-item {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-item.unread { border-left: 3px solid var(--primary); }
.notif-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 2px; }
.notif-message { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }
.notif-time { font-size: 0.7rem; color: var(--text-secondary); margin-top: 4px; opacity: 0.7; }

@media (max-width: 480px) {
  .notif-panel { width: calc(100vw - 24px); right: -8px; }
}

/* === Sidebar === */
.sidebar {
  position: fixed; top: var(--header-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 90;
  overflow-y: auto;
  transition: transform var(--transition);
}
.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 12px;
  color: var(--accent);
}
.sidebar-brand { font-weight: 700; font-size: 1rem; }
.nav-list { list-style: none; padding: 4px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--text-muted); font-size: 0.9rem;
  cursor: pointer; transition: all var(--transition);
  border: none; background: none; width: 100%; text-align: left;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); text-decoration: none; }
.nav-item.active { background: rgba(74,108,247,0.15); color: var(--primary); }
.nav-separator { height: 1px; background: var(--border); margin: 8px 16px; }
.sidebar-footer { margin-top: auto; padding: 8px; }
.logout-btn { color: var(--danger) !important; }

.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 85;
}

/* === Main Content === */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 24px;
  min-height: calc(100vh - var(--header-h));
}

/* === Pages === */
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 1.4rem; font-weight: 600; }

/* === Login === */
.page-login {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}
.page-login.active {
  display: flex;
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 200;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
}
.login-logo { color: var(--accent); margin-bottom: 16px; }
.login-card h2 { font-size: 1.5rem; margin-bottom: 4px; }
.login-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 28px; }
.login-footer { color: var(--text-muted); font-size: 0.75rem; margin-top: 20px; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.8rem; padding: 0; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }

/* === Forms === */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em;
}
input[type="text"], input[type="password"], input[type="email"],
input[type="search"], input[type="number"], input[type="date"],
input[type="tel"], textarea, select {
  width: 100%; padding: 10px 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 0.95rem; transition: border-color var(--transition);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
}
textarea { resize: vertical; min-height: 80px; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border: none; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--text-muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-success { background: var(--success); color: #fff; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Cards & Stats === */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.card h3 { font-size: 1rem; margin-bottom: 12px; }

/* Dashboard Tabs */
.dash-tabs {
  display: flex; gap: 0; margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.dash-tab {
  background: none; border: none; color: var(--text-muted);
  padding: 10px 20px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color 0.15s, border-color 0.15s;
}
.dash-tab:hover { color: var(--text); }
.dash-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.dash-panel.hidden { display: none; }
.clickable { cursor: pointer; }
.clickable:hover { background: rgba(255,255,255,0.04); }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.dashboard-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

/* === Activity & Lists === */
.activity-list, .assignment-list { max-height: 300px; overflow-y: auto; }
.empty-state { color: var(--text-muted); text-align: center; padding: 24px; font-size: 0.9rem; }

/* === Error / Status Messages === */
.error-msg { color: var(--danger); font-size: 0.85rem; margin-bottom: 12px; text-align: left; }

/* === Toast Notifications === */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  display: flex; flex-direction: column-reverse; gap: 8px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  font-size: 0.85rem; box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* === List rows === */
.list-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px;
  background: var(--bg-card); cursor: pointer;
  transition: border-color var(--transition);
}
.list-row:hover { border-color: var(--primary); }
.list-row-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.list-row-meta { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; }

/* === Status badges === */
.badge-status {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
}
.badge-pending { background: rgba(243,156,18,0.15); color: var(--warning); }
.badge-accepted { background: rgba(39,174,96,0.15); color: var(--success); }
.badge-denied { background: rgba(231,76,60,0.15); color: var(--danger); }
.badge-in_progress { background: rgba(74,108,247,0.15); color: var(--primary); }
.badge-analysis_complete { background: rgba(0,212,170,0.15); color: var(--accent); }
.badge-ready_for_pickup { background: rgba(0,212,170,0.15); color: var(--accent); }
.badge-closed { background: rgba(136,136,170,0.15); color: var(--text-muted); }

/* === Detail views === */
.detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-field label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.detail-field p { margin-top: 4px; }
.detail-text { white-space: pre-wrap; line-height: 1.6; }

/* === Review actions === */
.review-actions { display: flex; gap: 12px; }

/* === Notes & History === */
.note-item, .history-item {
  padding: 12px; border-bottom: 1px solid var(--border);
}
.note-item:last-child, .history-item:last-child { border-bottom: none; }
.note-header { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.85rem; }

/* === Filter select === */
.filter-select {
  padding: 6px 10px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 0.85rem;
}

/* === Priority badges === */
.badge-low { background: rgba(136,136,170,0.15); color: var(--text-muted); }
.badge-normal { background: rgba(74,108,247,0.15); color: var(--primary); }
.badge-high { background: rgba(243,156,18,0.15); color: var(--warning); }
.badge-urgent { background: rgba(231,76,60,0.2); color: var(--danger); font-weight: 700; }

/* === Document/Data table === */
.doc-table { width: 100%; }
.doc-header-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
  gap: 8px; padding: 8px 12px; font-size: 0.75rem;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.doc-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
  gap: 8px; padding: 10px 12px; align-items: center;
  border-bottom: 1px solid var(--border); font-size: 0.85rem;
}
.doc-row:hover { background: rgba(255,255,255,0.02); }
.admin-user-row {
  grid-template-columns: 2fr 1.1fr 1.1fr 1.1fr 0.6fr 1.1fr 140px !important;
}
.admin-user-row span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-user-row .filter-select {
  width: 100%;
  max-width: 130px;
}
.doc-filename { word-break: break-all; }
.doc-actions { display: flex; gap: 4px; }

/* Badge for document types */
.badge-warrant { background: rgba(231,76,60,0.15); color: var(--danger); }
.badge-consent_form { background: rgba(39,174,96,0.15); color: var(--success); }
.badge-report { background: rgba(74,108,247,0.15); color: var(--primary); }
.badge-other { background: rgba(136,136,170,0.15); color: var(--text-muted); }

/* === Photo grid === */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-thumb { text-align: center; }
.photo-thumb img {
  width: 100%; height: 120px; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--border);
  cursor: pointer;
}

/* === Signature canvas === */
.sig-canvas {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-input); cursor: crosshair;
  width: 100%; max-width: 300px; height: 100px;
  touch-action: none;
}

/* === Custody timeline === */
.custody-timeline { border-left: 2px solid var(--border); margin-left: 12px; padding-left: 20px; }
.custody-record { margin-bottom: 20px; position: relative; }
.custody-record::before {
  content: ''; position: absolute; left: -26px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
}
.custody-date { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.custody-body { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.custody-parties { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.custody-arrow { color: var(--accent); font-weight: 700; }
.custody-sigs { font-size: 0.75rem; margin-top: 6px; }

/* === Label preview === */
.label-preview {
  text-align: center; padding: 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.label-preview img { max-height: 150px; }

/* === Print label fallback (browser print) === */
@media print {
  body > *:not(#print-label-fallback) { display: none !important; }
  #print-label-fallback {
    display: block !important; position: fixed; inset: 0;
    background: #fff; color: #000; padding: 8mm;
    font-family: Arial, sans-serif;
  }
  .print-label { border: 1px solid #000; padding: 4mm; width: 89mm; height: 28mm; display: flex; gap: 4mm; }
  .print-label-qr { width: 24mm; height: 24mm; flex-shrink: 0; }
  .print-label-qr img { width: 100%; height: 100%; }
  .print-label-text { flex: 1; font-size: 9pt; line-height: 1.3; }
  .print-label-text .ev-num { font-size: 13pt; font-weight: bold; }
}

/* === Encryption note === */
.encryption-note {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: var(--accent); padding: 10px;
  background: rgba(0,212,170,0.08); border-radius: var(--radius);
  margin-top: 12px;
}

/* === Modal === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 250;
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
  max-width: 440px; width: 90%;
}
.modal h3 { margin-bottom: 8px; }

/* === Workflow Timeline === */
.workflow-timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: 16px 0;
  position: relative;
}
.workflow-timeline::before {
  content: '';
  position: absolute;
  top: 28px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.workflow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 80px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: opacity 0.2s;
}
.workflow-step:hover { opacity: 0.8; }
.step-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  transition: all 0.2s;
  margin-bottom: 8px;
}
.step-label {
  font-size: 0.7rem;
  text-align: center;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
  max-width: 90px;
}
.step-done .step-dot {
  background: var(--accent);
  border-color: var(--accent);
}
.step-done .step-label { color: var(--accent); }
.step-current .step-dot {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(74,108,247,0.25);
}
.step-current .step-label { color: var(--primary); font-weight: 600; }
.step-future .step-dot {
  background: var(--bg);
  border-color: var(--border);
}
.step-future .step-label { color: var(--text-muted); opacity: 0.6; }

/* Branch steps (supported/unsupported) */
.workflow-evidence .step-branch { flex: 0.6; min-width: 70px; }

/* === New Status Badges === */
.badge-requested { background: rgba(136,136,170,0.15); color: var(--text-muted); }
.badge-intake { background: rgba(243,156,18,0.15); color: var(--warning); }
.badge-unassigned { background: rgba(231,76,60,0.15); color: var(--danger); }
.badge-assigned { background: rgba(74,108,247,0.15); color: var(--primary); }
.badge-analyzing { background: rgba(74,108,247,0.2); color: #6c99ff; }
.badge-reporting { background: rgba(0,212,170,0.1); color: var(--accent); }
.badge-peer_review { background: rgba(155,89,182,0.15); color: #bb8fce; }
.badge-approved { background: rgba(39,174,96,0.15); color: var(--success); }
.badge-distribution { background: rgba(0,212,170,0.2); color: var(--accent); }
.badge-archived { background: rgba(136,136,170,0.1); color: var(--text-muted); }
/* Evidence-specific statuses */
.badge-manual_review { background: rgba(243,156,18,0.15); color: var(--warning); }
.badge-supported { background: rgba(39,174,96,0.15); color: var(--success); }
.badge-unsupported { background: rgba(231,76,60,0.15); color: var(--danger); }
.badge-acquisition { background: rgba(74,108,247,0.15); color: var(--primary); }
.badge-completed { background: rgba(0,212,170,0.15); color: var(--accent); }
.badge-ready_for_release { background: rgba(0,212,170,0.2); color: var(--accent); }
.badge-released { background: rgba(136,136,170,0.15); color: var(--text-muted); }

/* === Reports === */
.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.report-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.report-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.report-bar-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  width: 130px;
  min-width: 130px;
  text-align: right;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.report-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.report-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.4s ease;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  min-width: fit-content;
}
.report-bar-fill.accent { background: var(--accent); }
.report-bar-fill.warning { background: var(--warning); }
.report-bar-fill.danger { background: var(--danger); }
.report-bar-fill.success { background: var(--success); }
.report-bar-value {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 36px;
  text-align: right;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.report-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.report-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

/* === Pie Charts === */
.pie-chart-wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.pie-chart-svg {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}
.pie-chart-svg circle {
  fill: none;
  stroke-width: 32;
  cx: 50%;
  cy: 50%;
  r: 25%;
}
.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
}
.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pie-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.pie-legend-label {
  color: var(--text-muted);
  text-transform: capitalize;
}
.pie-legend-count {
  font-weight: 600;
  margin-left: auto;
  padding-left: 12px;
}

@media (max-width: 768px) {
  .reports-grid { grid-template-columns: 1fr; }
  .report-bar-label { min-width: 80px; font-size: 0.7rem; }
  .pie-chart-wrap { flex-direction: column; }
  .pie-chart-svg { width: 140px; height: 140px; }
}

/* === Utility === */
.hidden { display: none !important; }
/* === Sortable Data Table === */
.case-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.case-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
}
.case-table th:hover {
  color: var(--text);
}
.case-table th .sort-arrow {
  margin-left: 4px;
  font-size: 0.6rem;
  opacity: 0.3;
}
.case-table th.sorted .sort-arrow {
  opacity: 1;
  color: var(--primary);
}
.case-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.case-table tr {
  cursor: pointer;
  transition: background 0.15s;
}
.case-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}
.case-table .col-hidden {
  display: none;
}

/* Column toggle menu */
.col-menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.col-menu.hidden { display: none; }
.col-menu label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.col-menu input[type="checkbox"] {
  accent-color: var(--primary);
}

/* === Dymo Printer Status === */
.dymo-status {
  position: relative;
  cursor: pointer;
}
.dymo-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  border: 1px solid var(--bg);
}
.dymo-status.connected .dymo-dot { background: var(--success); }
.dymo-status.disconnected .dymo-dot { background: var(--danger); }
.dymo-status.checking .dymo-dot { background: var(--warning); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* === Password Toggle === */
.pw-wrap {
  position: relative;
  display: block;
}
.pw-wrap input {
  padding-right: 40px !important;
}
.pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  z-index: 2;
}
.pw-toggle:hover {
  color: var(--text);
}

/* === Evidence Accordion === */
.ev-case-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  overflow: hidden;
}
.ev-case-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--surface);
  transition: background 0.15s;
  flex-wrap: wrap;
}
.ev-case-header:hover {
  background: var(--surface-hover, rgba(255,255,255,0.04));
}
.ev-case-arrow {
  font-size: 0.7rem;
  color: var(--text-muted);
  width: 14px;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.ev-case-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.ev-case-body {
  padding: 8px 14px 14px;
  border-top: 1px solid var(--border);
}
.ev-case-body.hidden {
  display: none;
}

.ev-custody-row.hidden { display: none; }
.ev-custody-body { border-left: 3px solid var(--primary); }
.ev-custody-body .case-table { margin-bottom: 0; }
.ev-custody-body .case-table th { font-size: 0.7rem; padding: 6px 8px; }
.ev-custody-body .case-table td { padding: 6px 8px; }

/* === Tab Bar === */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
}
.tab-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.row-inactive { opacity: 0.5; }
.storage-row {
  grid-template-columns: 1.5fr 2.5fr 0.8fr 0.6fr 0.8fr 140px !important;
}
.status-active { background: var(--success); color: #fff; }
.status-inactive { background: var(--text-muted); color: #fff; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

/* === Responsive === */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
