/* ============================================================
   MTAX Dashboard — style.css
   Dark theme, GitHub-inspired professional UI
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  --bg-primary:    #0d1117;
  --bg-secondary:  #161b22;
  --bg-card:       #1c2128;
  --border:        #30363d;
  --accent-blue:   #58a6ff;
  --accent-green:  #3fb950;
  --accent-yellow: #d29922;
  --accent-red:    #f85149;
  --accent-purple: #bc8cff;
  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #484f58;
  --sidebar-width: 240px;
  --topbar-height: 60px;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }

/* ---------- Login Screen ---------- */
#login-overlay {
  position: fixed; inset: 0;
  background: var(--bg-primary);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}

.login-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 48px 40px;
  width: 100%; max-width: 380px;
  text-align: center;
}

.login-logo {
  font-size: 40px;
  margin-bottom: 8px;
}

.login-box h2 {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 28px;
}

.login-error {
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid var(--accent-red);
  border-radius: 6px;
  color: var(--accent-red);
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 16px;
  text-align: left;
}

#login-form {
  display: flex; flex-direction: column; gap: 12px;
}

#login-pass {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s;
}

#login-pass:focus { border-color: var(--accent-blue); }

#login-btn {
  background: var(--accent-blue);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 12px;
  transition: opacity 0.15s;
}

#login-btn:hover:not(:disabled) { opacity: 0.85; }
#login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- App Shell ---------- */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

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

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-blue);
  padding: 24px 20px;
  letter-spacing: -0.3px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#sidebar nav {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
}

#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
  position: relative;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

#sidebar nav a:hover {
  background: #21262d;
  color: var(--text-primary);
}

#sidebar nav a.active {
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
  background: rgba(88, 166, 255, 0.06);
}

/* Quarantine badge */
#quarantine-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent-red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
}

#quarantine-badge:empty { display: none; }

.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

#ws-status {
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.3s;
}

#ws-status.ws-connected {
  color: var(--accent-green);
}

#ws-status.ws-disconnected {
  color: var(--accent-red);
}

/* ============================================================
   MAIN + TOPBAR
   ============================================================ */
#main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

#topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 90;
  flex-shrink: 0;
}

#topbar h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

#notif-bell {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

#notif-bell:hover { background: #21262d; color: var(--text-primary); }

#notif-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--accent-red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 48px;
  background: var(--bg-primary);
}

/* ---------- Loading / Error / Empty States ---------- */
.loading-state,
.error-state,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 14px;
  color: var(--text-muted);
  text-align: center;
}

.loading-state .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.empty-state .empty-icon { font-size: 48px; line-height: 1; }
.empty-state p { font-size: 15px; color: var(--text-secondary); }
.empty-state small { font-size: 13px; }

.error-state { color: var(--accent-red); }

/* ============================================================
   STAT CARDS (Home page)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card .stat-number {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.stat-blue   .stat-number { color: var(--accent-blue);   }
.stat-yellow .stat-number { color: var(--accent-yellow); }
.stat-red    .stat-number { color: var(--accent-red);    }
.stat-green  .stat-number { color: var(--accent-green);  }
.stat-purple .stat-number { color: var(--accent-purple); }

/* ============================================================
   SECTION HEADINGS
   ============================================================ */
.section-heading {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-heading small {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

/* ============================================================
   LIVE FEED (Home page)
   ============================================================ */
.feed-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  animation: fadeIn 0.3s ease;
}

.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: #21262d; }

.feed-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1.4;
}

.feed-body { flex: 1; min-width: 0; }

.feed-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.feed-client {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-blue);
  cursor: pointer;
}

.feed-client:hover { text-decoration: underline; }

.feed-time {
  font-size: 11px;
  color: var(--text-muted);
}

.feed-summary {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   CLIENT TABLE
   ============================================================ */
.search-bar {
  width: 100%;
  max-width: 400px;
  padding: 8px 14px;
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.15s;
}

.search-bar::placeholder { color: var(--text-muted); }
.search-bar:focus { border-color: var(--accent-blue); }

.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-secondary);
}

thead th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #21262d; }

tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody td:first-child { color: var(--text-primary); font-weight: 500; }

.row-action-btn {
  padding: 4px 12px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}

.row-action-btn:hover {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-intake       { background: rgba(88,166,255,0.15);  color: var(--accent-blue);   }
.badge-in_progress  { background: rgba(210,153,34,0.15);  color: var(--accent-yellow); }
.badge-ready_to_file{ background: rgba(63,185,80,0.15);   color: var(--accent-green);  }
.badge-complete     { background: rgba(188,140,255,0.15); color: var(--accent-purple); }
.badge-default      { background: rgba(139,148,158,0.15); color: var(--text-secondary);}

.missing-count { color: var(--accent-red); font-weight: 600; }
.missing-zero  { color: var(--text-muted); }

/* ============================================================
   CLIENT DETAIL
   ============================================================ */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s;
}

.detail-back:hover { color: var(--accent-blue); }

.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.detail-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Top info cards row */
.detail-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
}

.info-card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.info-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.info-card-row:last-child { border-bottom: none; }

.info-card-row .label { color: var(--text-secondary); }
.info-card-row .value { color: var(--text-primary); font-weight: 500; }

.check-yes { color: var(--accent-green); }
.check-no  { color: var(--accent-red);   }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   CHECKLIST
   ============================================================ */
.checklist-section { margin-bottom: 24px; }

.checklist-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 0 4px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 6px;
  border-radius: 6px;
  border-left: 3px solid transparent;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.checklist-item.received { border-left-color: var(--accent-green); }
.checklist-item.missing  { border-left-color: var(--accent-red);   }
.checklist-item.waived   { border-left-color: var(--text-muted); opacity: 0.6; }

.checklist-item .item-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

.checklist-item .item-body { flex: 1; min-width: 0; }

.checklist-item .item-doc {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.checklist-item .item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-event {
  position: relative;
  margin-bottom: 18px;
  animation: fadeIn 0.3s ease;
}

.timeline-event::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  border: 2px solid var(--bg-primary);
  z-index: 1;
}

/* Dot colors by event type */
.tev-EMAIL_IN::before    { background: var(--accent-blue);   }
.tev-EMAIL_OUT::before   { background: var(--accent-green);  }
.tev-SMS_IN::before,
.tev-SMS_OUT::before     { background: var(--accent-yellow); }
.tev-STRIPE::before,
.tev-STRIPE_IN::before   { background: var(--accent-purple); }
.tev-DISCORD_IN::before,
.tev-DISCORD_OUT::before { background: #5865f2; }
.tev-CHECKLIST::before   { background: var(--accent-green);  }
.tev-DOC_UPLOAD::before  { background: var(--accent-blue);   }
.tev-INTAKE_CREATED::before { background: var(--accent-yellow); }
.tev-SYSTEM::before      { background: var(--text-muted);    }

.timeline-event .tev-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
}

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

.tev-icon { font-size: 14px; }

.tev-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

.tev-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.tev-client-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-blue);
  cursor: pointer;
}

.tev-client-link:hover { text-decoration: underline; }

/* ============================================================
   OPEN LOOPS
   ============================================================ */
.loops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.loop-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  border-left-width: 4px;
  border-left-style: solid;
}

.loop-card.pending_document  { border-left-color: #e3a000; }
.loop-card.pending_question  { border-left-color: var(--accent-blue);   }
.loop-card.verification_task { border-left-color: var(--accent-purple); }
.loop-card.followup          { border-left-color: var(--accent-yellow); }

.loop-type-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.loop-desc {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.loop-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   CONVERSATION (chat bubbles)
   ============================================================ */
.conversation {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 700px;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.message-row.outbound { flex-direction: row-reverse; }

.bubble {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}

.message-row.inbound  .bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.message-row.outbound .bubble {
  background: rgba(88,166,255,0.15);
  border: 1px solid rgba(88,166,255,0.3);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}

.bubble-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  text-align: right;
}

.message-row.inbound .bubble-meta { text-align: left; }

/* ============================================================
   QUARANTINE GRID
   ============================================================ */
.quarantine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.quarantine-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.4s, transform 0.4s;
}

.quarantine-card.fade-out {
  opacity: 0;
  transform: scale(0.95);
}

.qcard-filename {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.qcard-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  flex: 1;
}

.qcard-actions {
  display: flex;
  gap: 10px;
}

.btn-approve, .btn-delete {
  flex: 1;
  padding: 7px 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: opacity 0.15s;
}

.btn-approve { background: var(--accent-green); color: #000; }
.btn-approve:hover { opacity: 0.85; }

.btn-delete  { background: var(--accent-red);   color: #fff; }
.btn-delete:hover { opacity: 0.85; }

/* ============================================================
   ACTIVITY LOG
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filter-btn:hover { background: #21262d; color: var(--text-primary); }

.filter-btn.active {
  background: var(--accent-blue);
  color: #000;
  border-color: var(--accent-blue);
  font-weight: 600;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
  max-width: 340px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  pointer-events: all;
  animation: slideInRight 0.25s ease;
  border-left-width: 4px;
  border-left-style: solid;
  position: relative;
}

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

.toast-email_in, .toast-email_out { border-left-color: var(--accent-blue);   }
.toast-sms_in,   .toast-sms_out   { border-left-color: var(--accent-yellow); }
.toast-stripe,   .toast-stripe_in { border-left-color: var(--accent-purple); }
.toast-discord_in,.toast-discord_out { border-left-color: #5865f2; }
.toast-checklist               { border-left-color: var(--accent-green);  }
.toast-doc_upload              { border-left-color: var(--accent-blue);   }
.toast-intake_created          { border-left-color: var(--accent-yellow); }
.toast-system                  { border-left-color: var(--text-muted);    }
.toast-default                 { border-left-color: var(--text-muted);    }

.toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.toast-body { flex: 1; min-width: 0; }

.toast-client {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-msg {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.toast-close:hover { color: var(--text-primary); }

/* ============================================================
   NOTIFICATION DRAWER
   ============================================================ */
#notif-drawer {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  width: 360px;
  height: calc(100vh - var(--topbar-height));
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 500;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
  transition: transform 0.25s ease;
}

#notif-drawer.hidden {
  transform: translateX(100%);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

#clear-notifs {
  padding: 4px 12px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}

#clear-notifs:hover { background: var(--accent-red); color: #fff; border-color: var(--accent-red); }

#notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.notif-item:hover { background: #21262d; }
.notif-item:last-child { border-bottom: none; }

.notif-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

.notif-body { flex: 1; min-width: 0; }

.notif-client {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.notif-summary {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   RESPONSIVE — sidebar collapses to icon strip on < 900px
   ============================================================ */
@media (max-width: 900px) {
  :root { --sidebar-width: 56px; }

  .logo { font-size: 20px; padding: 16px 0; text-align: center; }

  #sidebar nav a {
    padding: 12px 0;
    justify-content: center;
    font-size: 18px;
    overflow: hidden;
    width: 56px;
  }

  /* Hide text, show only emoji */
  #sidebar nav a span,
  #sidebar nav a::after { display: none; }

  /* Trim the text nodes — we keep only the leading emoji char visible */
  #sidebar nav a {
    text-indent: 0;
    letter-spacing: 0;
  }

  #quarantine-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 9px;
    min-width: 14px;
    height: 14px;
  }

  .sidebar-footer { padding: 10px 0; text-align: center; }
  #ws-status { font-size: 10px; }

  .quarantine-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .quarantine-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .detail-cards { grid-template-columns: 1fr; }
  #notif-drawer { width: 100%; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.hidden { display: none !important; }

.clickable { cursor: pointer; }

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

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
