/* ═══════════════════════════════════════════════════════════════════════════
   BHD Ops — Black Hat Defense LLC
   Brand palette derived from company logo:
     Primary red  #cc1111  (the "HAT" red)
     Near-black   #0a0000  (logo background undertone)
     White/silver #e8e8e8  (logo "BLACK" + "DEFENSE LLC" text)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Backgrounds ── */
  --bg:          #0a0000;   /* near-black with red undertone — matches logo bg */
  --surface:     #110606;   /* panel backgrounds */
  --surface2:    #1a0c0c;   /* cards, inputs */
  --surface3:    #241414;   /* hover states, elevated cards */
  --border:      #3d1a1a;   /* primary borders — visible but not glaring */
  --border-soft: #281010;   /* subtle dividers */
  --border-hard: #5a2020;   /* high-contrast separation lines */

  /* ── Brand Red (primary accent) ── */
  --accent:      #cc1111;
  --accent-bright: #e61919;
  --accent-dim:  rgba(204,17,17,0.13);
  --accent-glow: rgba(204,17,17,0.30);
  --accent-soft: rgba(204,17,17,0.07);

  /* ── Secondary (silver/white — from logo lettering) ── */
  --silver:      #c8c8c8;
  --silver-dim:  rgba(200,200,200,0.10);

  /* ── Semantic colors ── */
  --red:         #ef4444;
  --amber:       #f59e0b;
  --green:       #22c55e;
  --green-dim:   rgba(34,197,94,0.12);
  --blue:        #3b82f6;

  /* ── Severity ── */
  --severity-critical: #ef4444;
  --severity-high:     #f97316;
  --severity-medium:   #f59e0b;
  --severity-low:      #3b82f6;
  --severity-info:     #6b7280;

  /* ── Text ── */
  --text:        #d8d4d0;   /* slightly brighter warm gray */
  --text-bright: #f2eeea;   /* headings, important labels */
  --text-muted:  #8a7878;   /* secondary labels */
  --text-dim:    #564545;   /* placeholders, disabled */

  /* ── Geometry ── */
  --radius:      7px;
  --radius-lg:   11px;
  --sidebar-w:   285px;
  --findings-w:  305px;

  /* ── Typography ── */
  --font-mono: 'JetBrains Mono','Fira Code','Cascadia Code',ui-monospace,monospace;
  --font-sans: 'Inter',system-ui,-apple-system,sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;      /* up from 14px — easier to read */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ── App Layout ───────────────────────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--findings-w);
  grid-template-rows: 96px 1fr;  /* tall topbar for large logo */
  height: 100vh;
  overflow: hidden;
}

/* ── Top Bar ──────────────────────────────────────────────────────────────── */
#topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: #0d0505;
  border-bottom: 2px solid var(--accent);
  gap: 12px;
  z-index: 100;
  box-shadow: 0 2px 24px rgba(204,17,17,0.22);
}

.topbar-logo {
  height: 88px;   /* 2× previous size */
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(204,17,17,0.45));
}

.topbar-logo-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.5px;
  color: var(--text-bright);
}
.topbar-logo-text .hat { color: var(--accent); }

#topbar .engagement-label {
  flex: 1;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
#topbar .engagement-label .eng-name {
  color: var(--text-bright);
  font-weight: 700;
}
#topbar .engagement-label .phase-badge {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(204,17,17,0.30);
  border-radius: 4px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

/* ── Provider selector pills ──────────────────────────────────────────────── */
#provider-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 3px 5px;
}

.provider-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 18px;
  font-size: 11px;
  font-weight: 800;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.provider-pill:hover {
  background: var(--surface3);
  color: var(--text);
}
.provider-pill.active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 0 0 1px rgba(204,17,17,0.30);
}
.provider-pill.compare {
  color: #60a5fa;
}
.provider-pill.compare:hover {
  background: rgba(59,130,246,0.12);
  color: #93c5fd;
}
.provider-pill.compare.active {
  background: rgba(59,130,246,0.14);
  color: #93c5fd;
  box-shadow: 0 0 0 1px rgba(59,130,246,0.35);
}
/* Online/offline dot inside pills */
.provider-pill .pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background 0.4s;
}
.provider-pill .pill-dot.online  { background: var(--green); box-shadow: 0 0 5px rgba(34,197,94,0.6); }
.provider-pill .pill-dot.offline { background: var(--red); }

/* Icon buttons */
.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
}
.icon-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(204,17,17,0.35);
}

/* ── Left Sidebar ─────────────────────────────────────────────────────────── */
#sidebar {
  background: var(--surface);
  border-right: 2px solid var(--border-hard);  /* strong separation */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-section {
  padding: 13px 14px 11px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-section.scrollable {
  flex: 1;
  overflow-y: auto;
  min-height: 80px;
}
.sidebar-section.scrollable::-webkit-scrollbar { width: 4px; }
.sidebar-section.scrollable::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Phase / Scope sections — capped height so they never push engagements list off screen */
.sidebar-section--fixed {
  flex-shrink: 0;
  height: 220px;
  max-height: 220px;
  overflow-y: auto;
}
.sidebar-section--fixed::-webkit-scrollbar { width: 4px; }
.sidebar-section--fixed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Section drag handles — used in sidebar and findings panel */
.section-drag-handle {
  height: 6px;
  flex-shrink: 0;
  cursor: ns-resize;
  background: var(--border-hard);
  transition: background 0.15s;
  position: relative;
}
.section-drag-handle::after {
  content: '';
  position: absolute;
  inset: -4px 0;   /* expand hit area without changing visual size */
}
.section-drag-handle:hover,
.section-drag-handle.dragging {
  background: var(--accent);
}

.sidebar-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Engagement cards */
.eng-card {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 5px;
}
.eng-card:hover { border-color: var(--accent); background: var(--surface3); }
.eng-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), inset 0 0 14px var(--accent-soft);
}
.eng-card .eng-client { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.eng-card .eng-project { font-weight: 700; font-size: 13px; color: var(--text-bright); margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 22px; }
.eng-card .eng-meta { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }

/* Edit / Delete action buttons — appear on card hover */
.eng-card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.eng-card:hover .eng-card-actions { opacity: 1; }

.eng-edit-btn,
.eng-delete-btn {
  width: 18px;
  height: 18px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.eng-edit-btn:hover   { background: rgba(59,130,246,0.15); color: var(--blue); }
.eng-delete-btn:hover { background: rgba(239,68,68,0.15);  color: var(--red);  }

.eng-type-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 3px; font-weight: 800;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(204,17,17,0.25);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.eng-finding-count {
  font-size: 10px; padding: 2px 8px; border-radius: 3px;
  background: var(--surface3); color: var(--text-muted);
  border: 1px solid var(--border);
}

/* New engagement button */
.btn-new-eng {
  width: 100%;
  padding: 9px 12px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px dashed rgba(204,17,17,0.40);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-new-eng:hover {
  background: rgba(204,17,17,0.22);
  border-color: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
}

/* Phase tracker */
.phase-list { display: flex; flex-direction: column; gap: 2px; }

.phase-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: default;
  transition: background 0.1s;
}
.phase-item:hover { background: var(--surface2); }
.phase-item.active { background: var(--accent-dim); }

.phase-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  transition: all 0.2s;
}
.phase-dot.not_started { border-color: var(--text-dim); background: transparent; }
.phase-dot.in_progress {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 9px var(--accent-glow);
}
.phase-dot.complete { border-color: var(--green); background: var(--green); }

.phase-name { font-size: 13px; color: var(--text-muted); flex: 1; }
.phase-item.active     .phase-name { color: var(--accent); font-weight: 700; }
.phase-item.in_progress .phase-name { color: var(--accent); font-weight: 700; }
.phase-item.complete   .phase-name { color: var(--text-dim); text-decoration: line-through; }

/* Small icon that appears on hover — hints the item is clickable */
.phase-action-hint {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.phase-item:hover .phase-action-hint { opacity: 1; }

/* Scope */
.scope-targets {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  line-height: 2;
}

/* ── Main Chat ─────────────────────────────────────────────────────────────── */
#chat-area {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  border-right: 1px solid var(--border);
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}
#messages::-webkit-scrollbar { width: 5px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Welcome screen */
.welcome-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
  padding: 48px;
  color: var(--text-muted);
}
.welcome-logo-img {
  height: 110px;    /* up from 80px */
  width: auto;
  opacity: 0.88;
  filter: drop-shadow(0 0 24px rgba(204,17,17,0.45));
}
.welcome-state h2 {
  font-size: 26px;
  color: var(--text-bright);
  font-weight: 800;
  letter-spacing: -0.3px;
}
.welcome-state h2 span { color: var(--accent); }
.welcome-state p { max-width: 420px; line-height: 1.8; font-size: 15px; }
.welcome-tagline {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

/* Message bubbles — .msg-row > .msg-avatar + .msg-col > (label?) + .msg-bubble */
.msg-row {
  display: flex;
  gap: 12px;
  padding: 4px 0;
  animation: fadeInUp 0.18s ease;
}
.msg-row.user { flex-direction: row-reverse; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 4px;
  letter-spacing: 0.02em;
}
.msg-row.user      .msg-avatar { background: var(--accent);   color: #fff; }
.msg-row.assistant .msg-avatar { background: var(--surface2); color: var(--accent); border: 1px solid var(--border-hard); font-size: 15px; }

/* Column wrapper — holds optional provider label + bubble */
.msg-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 76%;
  min-width: 0;
}

/* Provider label shown above bubble in compare mode or when labeled */
.msg-provider-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 0 4px;
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  line-height: 1.72;
  font-size: 14.5px;
}
.msg-row.user .msg-bubble {
  background: var(--accent-dim);
  border: 1px solid rgba(204,17,17,0.28);
  color: var(--text-bright);
  border-bottom-right-radius: 3px;
}
.msg-row.assistant .msg-bubble {
  background: var(--surface2);
  border: 1px solid var(--border-hard);
  color: var(--text);
  border-bottom-left-radius: 3px;
}

/* Markdown inside bubbles */
.msg-bubble p { margin-bottom: 9px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
  color: var(--text-bright);
  margin: 14px 0 6px;
}
.msg-bubble h1 { font-size: 17px; }
.msg-bubble h2 { font-size: 15px; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.msg-bubble h3 { font-size: 14px; color: var(--accent); }
.msg-bubble ul, .msg-bubble ol { padding-left: 20px; margin-bottom: 9px; }
.msg-bubble li { margin-bottom: 4px; }
.msg-bubble code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface3);
  border: 1px solid var(--border-hard);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent);
}
.msg-bubble pre {
  background: #080000;
  border: 1px solid var(--border-hard);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px;
  overflow-x: auto;
  margin: 10px 0;
}
.msg-bubble pre code {
  background: transparent; border: none; padding: 0;
  color: #d8d4d0; font-size: 13px;
}
.msg-bubble strong { color: var(--text-bright); }
.msg-bubble a { color: var(--accent); text-decoration: none; }
.msg-bubble a:hover { text-decoration: underline; }
.msg-bubble blockquote {
  border-left: 3px solid var(--accent);
  padding: 7px 14px;
  margin: 9px 0;
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: italic;
}
.msg-bubble table { width: 100%; border-collapse: collapse; margin: 9px 0; font-size: 13px; }
.msg-bubble th {
  background: var(--surface3);
  color: var(--text-bright);
  padding: 7px 11px;
  text-align: left;
  border-bottom: 1px solid var(--accent);
}
.msg-bubble td { padding: 6px 11px; border-bottom: 1px solid var(--border); }

/* Typing cursor */
.typing-cursor::after {
  content: '▋';
  color: var(--accent);
  animation: blink 0.75s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Compare mode divider */
.compare-divider {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: #60a5fa;
  padding: 10px 0 4px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.8;
}

.msg-system {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 8px;
  font-style: italic;
}

/* ── Input Bar ────────────────────────────────────────────────────────────── */
#input-area {
  padding: 12px 24px 16px;
  border-top: 2px solid var(--border-hard);   /* strong top separator */
  background: var(--bg);
}

#drop-zone {
  border: 1.5px solid var(--border-hard);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: all 0.2s;
  overflow: hidden;
}
#drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
}

/* Image attachment chip — sits above the drop-zone, outside it */
#image-preview-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 4px;
}
#image-preview-chip {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
#image-preview-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-hard);
  display: block;
}
#image-remove-btn {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--bg);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 10;
}
#image-remove-btn:hover { background: var(--accent-bright); transform: scale(1.15); }
#image-preview-label {
  font-size: 12px;
  color: var(--text-dim);
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  resize: none;
  min-height: 24px;
  max-height: 160px;
  overflow-y: auto;
}
#chat-input::placeholder { color: var(--text-dim); }
#chat-input::-webkit-scrollbar { width: 3px; }
#chat-input::-webkit-scrollbar-thumb { background: var(--border); }

.input-actions { display: flex; align-items: center; gap: 6px; }

#mic-btn {
  padding: 7px 11px;
  background: transparent;
  border: 1px solid var(--border-hard);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
}
#mic-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
#mic-btn.listening {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34,197,94,0.12);
  animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

#upload-btn, #camera-btn {
  padding: 7px 11px;
  background: transparent;
  border: 1px solid var(--border-hard);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
}
#upload-btn:hover, #camera-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

#send-btn {
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 800;
  font-size: 13px;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 5px;
  box-shadow: 0 0 14px rgba(204,17,17,0.32);
}
#send-btn:hover  { background: var(--accent-bright); box-shadow: 0 0 22px rgba(204,17,17,0.55); }
#send-btn:active { transform: scale(0.97); }
#send-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

.drop-hint {
  text-align: center;
  padding: 6px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-soft);
}

/* Paste detection banner */
#paste-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid rgba(0,0,0,0.2);
}
#paste-banner.visible { display: flex; }
.paste-actions { margin-left: auto; display: flex; gap: 6px; }
.paste-btn {
  padding: 4px 11px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-sans);
  text-transform: uppercase;
}
.paste-btn.analyze { background: #fff; color: var(--accent); }
.paste-btn.dismiss { background: rgba(255,255,255,0.2); color: #fff; }

/* ── Right Panel (Findings) ───────────────────────────────────────────────── */
#findings-panel {
  background: var(--surface);
  border-left: 2px solid var(--border-hard);   /* strong separation */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-hard);
  background: var(--surface2);   /* tinted header for visual separation */
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.panel-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-muted);
}

.panel-body { flex: 1; overflow-y: auto; padding: 9px; }
.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Finding cards */
.finding-card {
  background: var(--surface2);
  border: 1px solid var(--border-hard);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.finding-card:hover { border-color: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.finding-card .fc-header { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 4px; }
.finding-card .fc-ref { font-size: 10px; font-family: var(--font-mono); color: var(--text-dim); white-space: nowrap; }
.finding-card .fc-title { font-size: 13px; font-weight: 700; color: var(--text-bright); flex: 1; line-height: 1.4; }
.finding-card .fc-target { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 3px; }
.finding-card .fc-footer { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }

/* Severity / status badges */
.badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge.Critical      { background: rgba(239,68,68,0.18);   color: #ef4444; }
.badge.High          { background: rgba(249,115,22,0.18);  color: #f97316; }
.badge.Medium        { background: rgba(245,158,11,0.18);  color: #f59e0b; }
.badge.Low           { background: rgba(59,130,246,0.18);  color: #3b82f6; }
.badge.Informational { background: rgba(107,114,128,0.18); color: #9ca3af; }
.badge.hypothesis    { background: var(--silver-dim);      color: var(--silver); }
.badge.open          { background: rgba(239,68,68,0.1);    color: #ef4444; }
.badge.remediated    { background: var(--green-dim);       color: var(--green); }
.badge.accepted      { background: var(--surface3);        color: var(--text-muted); }
.badge.retest        { background: rgba(245,158,11,0.1);   color: var(--amber); }

.btn-add-finding {
  width: 100%;
  padding: 9px;
  background: transparent;
  border: 1px dashed var(--border-hard);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.15s;
  margin-top: 5px;
}
.btn-add-finding:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Artifact items */
.artifact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin-bottom: 5px;
  background: var(--surface2);
}
.artifact-icon { font-size: 14px; }
.artifact-name {
  flex: 1;
  font-family: var(--font-mono);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.artifact-count {
  font-size: 11px;
  background: var(--surface3);
  padding: 1px 7px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* ── Modals ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-hard);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  width: 530px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 44px rgba(0,0,0,0.65), 0 0 32px rgba(204,17,17,0.12);
  animation: slideUp 0.2s ease;
}
.modal.wide { width: 700px; }

@keyframes slideUp {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-hard);
}
.modal-title {
  font-size: 16px; font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.2px;
}
.modal-close {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer; font-size: 19px;
  padding: 2px 6px; border-radius: 4px;
  transition: all 0.1s;
}
.modal-close:hover { color: var(--accent); background: var(--accent-dim); }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border-hard);
  border-radius: 6px;
  color: var(--text-bright);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 9px 11px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.form-textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
.form-select option { background: var(--surface2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 20px; padding-top: 14px;
  border-top: 1px solid var(--border-hard);
}

/* Buttons */
.btn {
  padding: 9px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 14px rgba(204,17,17,0.32);
}
.btn-primary:hover { background: var(--accent-bright); box-shadow: 0 0 20px rgba(204,17,17,0.55); }
.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border-hard);
}
.btn-secondary:hover { background: var(--surface3); border-color: var(--text-dim); }
.btn-danger {
  background: rgba(239,68,68,0.12);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* ── Settings Modal ────────────────────────────────────────────────────────── */
.settings-section { margin-bottom: 20px; }
.settings-section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.10em; color: var(--text-dim);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-hard);
}
.provider-row {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 0; font-size: 13px;
}
.provider-row .provider-name { width: 88px; color: var(--text); font-weight: 600; }
.provider-row .provider-status { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.provider-row .provider-status.online  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.provider-row .provider-status.offline { background: var(--red); }
.provider-row .provider-status.unknown { background: var(--text-dim); }

/* ── Report preview modal ──────────────────────────────────────────────────── */
.report-modal-wide {
  width: min(900px, 95vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.report-modal-wide .modal-header {
  flex-shrink: 0;
}
.report-preview {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: #fff;
  color: #1a1a1a;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 13.5px;
  line-height: 1.75;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
/* Markdown elements inside the white report preview */
.report-preview h1 { font-size: 22px; border-bottom: 2px solid #cc1111; padding-bottom: 8px; margin: 0 0 16px; }
.report-preview h2 { font-size: 17px; color: #cc1111; margin: 24px 0 8px; border-bottom: 1px solid #e8e8e8; padding-bottom: 4px; }
.report-preview h3 { font-size: 14px; font-weight: 700; margin: 16px 0 6px; color: #222; }
.report-preview table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12.5px; }
.report-preview th { background: #1a1a1a; color: #fff; padding: 7px 10px; text-align: left; }
.report-preview td { padding: 6px 10px; border-bottom: 1px solid #e8e8e8; }
.report-preview tr:nth-child(even) td { background: #f9f9f9; }
.report-preview code { font-family: var(--font-mono); font-size: 12px; background: #f3f3f3; padding: 1px 5px; border-radius: 3px; color: #cc1111; }
.report-preview pre { background: #1a1a1a; color: #d4d0cc; padding: 12px 16px; border-radius: 6px; overflow-x: auto; margin: 10px 0; font-size: 12px; border-left: 3px solid #cc1111; }
.report-preview pre code { background: transparent; color: inherit; padding: 0; }
.report-preview hr { border: none; border-top: 1px solid #ddd; margin: 20px 0; }
.report-preview blockquote { border-left: 3px solid #cc1111; padding: 6px 14px; margin: 10px 0; color: #666; font-style: italic; background: #fff8f8; }
.report-preview strong { color: #111; }
.report-preview ul, .report-preview ol { padding-left: 22px; margin: 8px 0; }
.report-preview li { margin-bottom: 4px; }
.report-preview p { margin-bottom: 10px; }

/* ── System Prompt presets ─────────────────────────────────────────────────── */
.sp-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sp-preset-btn {
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-hard);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.sp-preset-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(204,17,17,0.35);
}
.sp-preset-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(204,17,17,0.40);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

/* Active system prompt indicator in topbar */
#sp-active-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px rgba(245,158,11,0.7);
  flex-shrink: 0;
  display: none;
}
#sp-active-dot.visible { display: block; }

/* ── Finding Detail ────────────────────────────────────────────────────────── */
.finding-detail-section { margin-bottom: 15px; }
.finding-detail-label {
  font-size: 11px; font-weight: 800; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 5px;
}
.finding-detail-value { font-size: 14px; color: var(--text); line-height: 1.65; }
.finding-detail-value.mono {
  font-family: var(--font-mono); font-size: 13px;
  background: var(--surface2); padding: 9px 11px;
  border-radius: 6px; border: 1px solid var(--border-hard);
  border-left: 3px solid var(--accent);
}

/* ── Scrollbars ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hard); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden        { display: none !important; }
.loading       { opacity: 0.5; pointer-events: none; }
.text-accent   { color: var(--accent); }
.text-muted    { color: var(--text-muted); }
.text-danger   { color: var(--red); }
.text-success  { color: var(--green); }
.mt-8          { margin-top: 8px; }
.mt-12         { margin-top: 12px; }

/* ── Code block copy button ───────────────────────────────────────────────── */
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  font-size: 11px;
  font-family: var(--font-sans);
  background: var(--surface3);
  color: var(--text-muted);
  border: 1px solid var(--border-hard);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Terminal Panel ────────────────────────────────────────────────────────── */
:root { --terminal-h: 0px; }

#terminal-panel {
  width: 100%;
  height: var(--terminal-h);
  min-height: 0;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #0d0d0d;
  border-top: 2px solid var(--accent);
  transition: height 0.15s ease;
  position: relative;
  z-index: 50;
  box-sizing: border-box;
}

/* Drag-to-resize handle */
#terminal-drag-handle {
  height: 5px;
  cursor: ns-resize;
  background: transparent;
  flex-shrink: 0;
}
#terminal-drag-handle:hover { background: var(--accent); }

/* Panel header */
#terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 34px;
  background: #161616;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
}

#terminal-tabs { display: flex; gap: 2px; }

.term-tab {
  padding: 4px 14px;
  font-size: 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: color 0.15s, border-color 0.15s;
}
.term-tab:hover  { color: var(--text); }
.term-tab.active { color: var(--text); border-bottom-color: var(--accent); }

#terminal-cwd-label {
  flex: 1;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#terminal-controls { display: flex; gap: 4px; margin-left: auto; }

.term-ctrl-btn {
  width: 24px; height: 24px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.term-ctrl-btn:hover { background: var(--surface2); color: var(--text); }
#terminal-close-btn:hover { background: #3a1010; color: var(--red); }

/* Terminal body */
#terminal-body {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
}

#terminal-xterm {
  flex: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
}

/* Override xterm.js defaults for seamless look */
.xterm         { padding: 6px 10px; width: 100% !important; }
.xterm-screen  { width: 100% !important; }
.xterm-viewport { background: #0d0d0d !important; width: 100% !important; }

/* ── File Explorer Pane ───────────────────────────────────────────────────── */
#explorer-pane {
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #111;
  overflow: hidden;
}

#explorer-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.exp-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.exp-btn:hover { background: var(--surface3); color: var(--text); }

#explorer-path-input {
  flex: 1;
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text);
  outline: none;
}
#explorer-path-input:focus { border-color: var(--accent); }

#explorer-path {
  padding: 4px 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  background: #0d0d0d;
  border-bottom: 1px solid #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

#explorer-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
#explorer-list::-webkit-scrollbar { width: 5px; }
#explorer-list::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

.exp-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-mono);
  color: #ccc;
  white-space: nowrap;
  transition: background 0.1s;
}
.exp-item:hover     { background: #1e1e1e; }
.exp-dir            { color: #60a5fa; }
.exp-icon           { font-size: 13px; flex-shrink: 0; }
.exp-name           { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.exp-size           { font-size: 10px; color: #555; flex-shrink: 0; }
.explorer-empty     { padding: 16px; color: #555; font-size: 12px; text-align: center; font-family: var(--font-mono); }

/* Update #app grid to include terminal row */
#app { grid-template-rows: 96px 1fr; }
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  margin: 0;
}
#app { flex: 1; min-height: 0; }

/* ── Auto-save notice (large response written to file) ───────────────────── */
.autosave-notice {
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 12px;
  margin-top: 2px;
  border-left: 2px solid var(--accent);
}
.autosave-notice code {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════════════════════
/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── Single-column layout ── */
  #app {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: 56px 1fr !important;
    height: 100vh !important;
    overflow: hidden !important;
  }

  /* ── Compact topbar ── */
  #topbar {
    padding: 0 8px !important;
    gap: 6px !important;
  }
  .topbar-logo      { height: 40px !important; }
  .topbar-logo-text { font-size: 13px !important; }
  #topbar .engagement-label { font-size: 12px !important; overflow: hidden; max-width: 100px; }
  #topbar .engagement-label .phase-badge { display: none !important; }
  #provider-selector { display: none !important; }
  #topbar-username   { display: none !important; }

  /* ── Mobile nav buttons ── */
  #mobile-sidebar-btn,
  #mobile-findings-btn {
    display: flex !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: var(--radius) !important;
    border: 1px solid var(--border) !important;
    background: transparent !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    flex-shrink: 0 !important;
  }

  /* ── Icon buttons: 44px touch targets ── */
  .icon-btn { width: 44px !important; height: 44px !important; font-size: 18px !important; }

  /* ── Sidebar: off-canvas drawer ── */
  #sidebar {
    position: fixed !important;
    top: 56px !important;
    left: 0 !important;
    width: 85vw !important;
    height: calc(100vh - 56px) !important;
    z-index: 300 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.25s ease !important;
    border-right: 2px solid var(--accent) !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #sidebar.drawer-open { transform: translateX(0) !important; }

  /* ── Findings panel: off-canvas drawer ── */
  #findings-panel {
    position: fixed !important;
    top: 56px !important;
    right: 0 !important;
    width: 85vw !important;
    height: calc(100vh - 56px) !important;
    z-index: 300 !important;
    transform: translateX(100%) !important;
    transition: transform 0.25s ease !important;
    border-left: 2px solid var(--accent) !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #findings-panel.drawer-open { transform: translateX(0) !important; }

  /* ── Use dynamic viewport height — excludes browser address/nav bar ── */
  html, body { height: 100dvh !important; }
  #app        { height: 100dvh !important; }

  /* ── Chat area: fills remaining space ── */
  #chat-area {
    grid-column: 1 !important;
    grid-row: 2 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* ── Messages scrollable, never overflow into input bar ── */
  #messages {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 16px !important;
  }

  /* ── Input bar: pinned at bottom, clears phone gesture bar ── */
  #input-area {
    flex-shrink: 0 !important;
    padding: 8px 12px !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
  }

  /* ── Backdrop ── */
  #mobile-backdrop {
    display: none;
    position: fixed !important;
    inset: 56px 0 0 0 !important;
    background: rgba(0,0,0,0.6) !important;
    z-index: 299 !important;
  }
  #mobile-backdrop.active { display: block !important; }

  /* ── Input: prevent iOS/Android zoom, full width ── */
  #chat-input {
    font-size: 16px !important;
    min-height: 44px !important;
  }
  #send-btn, #mic-btn, #upload-btn, #camera-btn {
    min-height: 44px !important;
    min-width: 44px !important;
    font-size: 15px !important;
  }

  /* ── Messages: full width ── */
  .bubble { max-width: 100% !important; }

  /* ── Engagement cards ── */
  .eng-card { padding: 12px 10px !important; }
  .eng-card-actions { opacity: 1 !important; }

  /* ── Modals: full width ── */
  .modal, .modal.wide, .report-modal-wide {
    width: 95vw !important;
    max-height: 85vh !important;
    padding: 16px !important;
  }

  /* ── Form inputs: prevent zoom ── */
  .form-input, .form-select, .form-textarea {
    font-size: 16px !important;
    min-height: 44px !important;
  }
  .btn { min-height: 44px !important; padding: 10px 16px !important; }

  /* ── Drag handles: no mouse on phone ── */
  .section-drag-handle, #terminal-drag-handle { display: none !important; }

  /* ── Terminal: fullscreen overlay ── */
  #terminal-panel {
    position: fixed !important;
    inset: 0 !important;
    z-index: 400 !important;
    height: 100vh !important;
    display: none !important;
  }
  #terminal-panel.term-mobile-open { display: flex !important; }
  #terminal-close-btn { width: 44px !important; height: 44px !important; }
}

/* ── Tablet (769–1024px): sidebar visible, findings as drawer ── */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --findings-w: 0px; }

  #app {
    grid-template-columns: 220px 1fr !important;
  }

  #findings-panel {
    position: fixed !important;
    top: 0 !important; right: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    z-index: 300 !important;
    transform: translateX(100%) !important;
    transition: transform 0.25s ease !important;
    border-left: 2px solid var(--accent) !important;
  }
  #findings-panel.drawer-open { transform: translateX(0) !important; }

  #mobile-findings-btn { display: flex !important; }

  #mobile-backdrop {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,0.4) !important;
    z-index: 299 !important;
  }
  #mobile-backdrop.active { display: block !important; }
}
