/* ============================================================
   TraceGraph AI — Modern High-Contrast Engineering Theme
   Clean, Crisp, Bold, No Muddy Gradients
   ============================================================ */

:root {
  --bg-app: #090d16;
  --bg-sidebar: #0f172a;
  --bg-card: #141e33;
  --bg-card-hover: #1c2a47;
  --bg-input: #0b1120;
  --border-subtle: #1e293b;
  --border-focus: #6366f1;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --color-brand: #6366f1;
  --color-brand-hover: #4f46e5;
  --color-cyan: #06b6d4;
  --color-emerald: #10b981;
  --color-amber: #f59e0b;
  --color-rose: #f43f5e;
  --color-purple: #a855f7;
  --color-blue: #3b82f6;

  --node-pr: #ef4444;
  --node-code: #a855f7;
  --node-ui: #06b6d4;
  --node-page: #3b82f6;
  --node-flow: #f59e0b;
  --node-req: #10b981;

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Top Navbar ───────────────────────────────────────────── */
.navbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background-color: #0b1324;
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
}

.navbar-left .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: #1e1b4b;
  color: var(--color-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #312e81;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-title .accent {
  color: var(--color-cyan);
}

.navbar-center .active-target-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  padding: 6px 16px;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.pill-repo {
  color: var(--text-secondary);
  font-weight: 500;
}

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

.pill-pr {
  color: var(--color-cyan);
  font-weight: 700;
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-emerald);
  box-shadow: 0 0 8px var(--color-emerald);
}

/* ── Main Layout ─────────────────────────────────────────── */
.main-body {
  display: grid;
  grid-template-columns: 360px 1fr;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 56px);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  padding: 16px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
  width: 100%;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  box-sizing: border-box;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.form-group {
  margin-bottom: 12px;
}

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

.form-group label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

input[type="text"], input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus, input[type="number"]:focus {
  border-color: var(--border-focus);
}

.quick-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.preset-tag {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.preset-tag:hover {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action input {
  flex: 1;
}

.pr-preview-box {
  margin-top: 12px;
  padding: 10px 12px;
  background-color: #0b1120;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-rose);
}

.pr-title {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 8px;
}

.pr-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pr-author {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  box-sizing: border-box;
}

.metric-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.code-color { background: rgba(59, 130, 246, 0.15); color: var(--color-blue); }
.symbol-color { background: rgba(168, 85, 247, 0.15); color: var(--color-purple); }
.ui-color { background: rgba(6, 182, 212, 0.15); color: var(--color-cyan); }
.req-color { background: rgba(244, 63, 94, 0.15); color: var(--color-rose); }

.metric-data {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.metric-num {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1.1;
}

.metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Layer List */
.layer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
}

.layer-item input {
  display: none;
}

.chk {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  position: relative;
}

.layer-item input:checked + .chk::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.pr-chk::after { background: var(--node-pr); }
.code-chk::after { background: var(--node-code); }
.ui-chk::after { background: var(--node-ui); }
.flow-chk::after { background: var(--node-flow); }
.req-chk::after { background: var(--node-req); }

.rec-card {
  border-left: 3px solid var(--color-amber);
}

.rec-body {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ── Workspace ───────────────────────────────────────────── */
.workspace {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  overflow: hidden;
  min-width: 0;
}

.tab-strip {
  display: flex;
  background-color: #0b1324;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab-item {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 12px 12px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 0 auto;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.tab-item .tab-label {
  display: block;
  white-space: nowrap;
}

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

.tab-item.active {
  color: var(--color-brand);
  border-bottom-color: var(--color-brand);
}

.tab-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
}

/* ── Canvas View ─────────────────────────────────────────── */
.canvas-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 620px;
  height: calc(100vh - 112px);
}

.canvas-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background-color: #0d1527;
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
  gap: 10px;
  flex-wrap: wrap;
}

.canvas-actions {
  display: flex;
  gap: 8px;
}

.canvas-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.legend-tag {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.bg-pr { background: var(--node-pr); }
.bg-code { background: var(--node-code); }
.bg-ui { background: var(--node-ui); }
.bg-page { background: var(--node-page); }
.bg-flow { background: var(--node-flow); }
.bg-req { background: var(--node-req); }

.vis-canvas {
  flex: 1;
  width: 100%;
  min-height: 560px;
  height: calc(100% - 45px);
  background-color: #080c14;
}

/* ── Report Views ────────────────────────────────────────── */
.report-content {
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.section-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background-color: #0f192e;
  font-size: 0.88rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
}

.styled-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.84rem;
  table-layout: auto;
}

.styled-table th {
  background-color: #0b1120;
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.styled-table td {
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.styled-table td code {
  white-space: normal;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  background: #090d16;
  border: 1px solid #1e293b;
  padding: 3px 8px;
  border-radius: 4px;
  color: #38bdf8;
  font-weight: 600;
  font-size: 0.82rem;
  display: inline-block;
}

.styled-table tr:hover {
  background-color: var(--bg-card-hover);
}

.table-scroll {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.table-scroll .styled-table {
  margin: 0;
}

#tableCrawlSessions {
  min-width: 860px;
  table-layout: fixed;
}

#tableCrawlSessions th:nth-child(1), #tableCrawlSessions td:nth-child(1) { width: 22%; }
#tableCrawlSessions th:nth-child(2), #tableCrawlSessions td:nth-child(2) { width: 22%; }
#tableCrawlSessions th:nth-child(3), #tableCrawlSessions td:nth-child(3) { width: 11%; }
#tableCrawlSessions th:nth-child(4), #tableCrawlSessions td:nth-child(4) { width: 11%; }
#tableCrawlSessions th:nth-child(5), #tableCrawlSessions td:nth-child(5) { width: 10%; }
#tableCrawlSessions th:nth-child(6), #tableCrawlSessions td:nth-child(6) { width: 12%; }
#tableCrawlSessions th:nth-child(7), #tableCrawlSessions td:nth-child(7) { width: 12%; }

#tableCrawlSessions td {
  padding: 10px 12px;
}

#tableCrawlSessions .session-id,
#tableCrawlSessions .session-url {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-actions {
  display: grid;
  gap: 5px;
}

.session-actions .btn-tool {
  justify-content: center;
  width: 100%;
  margin: 0;
  min-height: 30px;
  padding: 5px 7px;
  font-size: 0.72rem;
}

#qaView .input-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  max-width: 840px !important;
  align-items: stretch;
}

#qaView .input-with-action select {
  min-width: 0;
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  padding: 8px 12px;
  font: 500 0.88rem var(--font-sans);
}

#qaView .input-with-action .btn {
  min-height: 48px;
}

/* ── Evidence Cards ──────────────────────────────────────── */
.evidence-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.evidence-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

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

.evidence-req-title {
  font-size: 0.92rem;
  font-weight: 600;
}

.evidence-path-box {
  background-color: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: #e2e8f0;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: var(--font-sans);
  white-space: nowrap;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.badge-risk-high, .badge-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.badge-warning, .badge-risk-medium {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-covered {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-partial {
  background: rgba(6, 182, 212, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.badge-unverified {
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.badge-absent {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.35);
}

.coverage-badges {
  display: flex;
  gap: 8px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn-primary:hover {
  background-color: var(--color-brand-hover);
}

.btn-action {
  background-color: #334155;
  color: #fff;
}

.btn-action:hover {
  background-color: #475569;
}

.btn-secondary {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

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

.btn-tool {
  background-color: #1e293b;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.74rem;
  padding: 4px 8px;
}

.btn-tool:hover {
  background-color: var(--color-brand);
  color: #fff;
}

/* Utilities */
.icon-sm { width: 15px; height: 15px; }
.text-cyan { color: var(--color-cyan); }
.text-rose { color: var(--color-rose); }
.text-amber { color: var(--color-amber); }
.text-emerald { color: var(--color-emerald); }
.text-muted { color: var(--text-muted); }
.hidden { display: none !important; }

/* ── Crawl Application Control Center Styles ─────────────── */
.crawl-config-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
}

.crawl-settings-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.url-validation-feedback {
  font-size: 0.78rem;
  margin-top: 6px;
  font-family: var(--font-mono);
}
.url-valid { color: var(--color-emerald); }
.url-invalid { color: var(--color-rose); }

.crawl-presets-bar {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.config-sliders-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #090d16;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.slider {
  width: 100%;
  accent-color: var(--color-brand);
  cursor: pointer;
}

.config-toggles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.toggle-item input[type="checkbox"] {
  accent-color: var(--color-brand);
  width: 15px;
  height: 15px;
}

.crawl-action-bar {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn-lg {
  padding: 10px 18px;
  font-size: 0.9rem;
}

.btn-danger {
  background-color: var(--color-rose);
  color: #fff;
}

/* ── Crawl Monitor & Terminal ────────────────────────────── */
.crawl-monitor-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #0b1120;
}

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

.monitor-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
}

.status-dot.running {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 1.5s infinite;
}

.status-dot.completed {
  background: #06b6d4;
}

.monitor-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.monitor-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.mstat-box {
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: center;
}

.mstat-num {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #f1f5f9;
}

.mstat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.current-activity-box {
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
}

.activity-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.act-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.terminal-feed-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.terminal-feed {
  background: #050811;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  height: 220px;
  overflow-y: auto;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.term-line {
  color: #cbd5e1;
  word-break: break-all;
}

.term-time { color: #64748b; margin-right: 6px; }
.term-evt-page { color: #38bdf8; }
.term-evt-action { color: #f59e0b; }
.term-evt-trans { color: #34d399; }
.term-evt-shot { color: #c084fc; }

.post-crawl-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

/* ── Discovered Screens Gallery ──────────────────────────── */
.discovered-artifacts-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.screens-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.screen-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.screen-thumb {
  width: 100%;
  height: 140px;
  background: #090d16;
  object-fit: cover;
  border-bottom: 1px solid var(--border-subtle);
}

.screen-card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.screen-id {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-cyan);
}

.screen-title {
  font-size: 0.85rem;
  font-weight: 700;
}

.screen-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* ── Spec Ingestion Panel ────────────────────────────────── */
.spec-ingest-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 14px;
}

.spec-source-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.spec-source-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
}

.spec-source-option input[type="radio"] {
  accent-color: var(--color-brand);
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
}

.spec-ingest-grid input[type="url"] {
  width: 100%;
  box-sizing: border-box;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.35;
  outline: none;
  transition: border-color 0.2s;
}

.spec-ingest-grid input[type="url"]:focus {
  border-color: var(--border-focus);
}

#specUrlPolicy {
  display: block;
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.45;
}

.spec-textarea {
  width: 100%;
  height: 200px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}

.spec-textarea:focus {
  border-color: var(--border-focus);
}

@media (max-width: 1200px) {
  .main-body {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .navbar-center {
    display: none;
  }

  .tab-strip {
    padding: 0 8px;
  }

  .tab-item {
    padding: 12px 11px;
    font-size: 0.8rem;
    gap: 6px;
  }

  .canvas-legend {
    gap: 9px;
  }
}

@media (max-width: 900px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .app-layout {
    height: auto;
    min-height: 100vh;
  }

  .navbar {
    height: auto;
    min-height: 56px;
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .navbar-right {
    margin-left: auto;
  }

  .main-body {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    overflow: visible;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
    max-height: none;
    overflow: visible;
  }

  .workspace {
    min-height: 680px;
  }

  .canvas-wrapper {
    min-height: 600px;
    height: 70vh;
  }
}

@media (max-width: 760px) {
  .navbar-right .status-indicator {
    display: none;
  }

  .brand-title {
    font-size: 1rem;
  }

  .tab-item {
    padding: 11px 12px;
  }

  .report-content {
    padding: 16px;
    gap: 16px;
  }

  .panel-header {
    gap: 12px;
    flex-wrap: wrap;
  }

  .canvas-bar {
    padding: 8px 12px;
  }

  .canvas-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .canvas-legend {
    font-size: 0.72rem;
  }

  #qaView .input-with-action {
    grid-template-columns: minmax(0, 1fr);
    max-width: none !important;
  }

  .spec-ingest-grid {
    grid-template-columns: 1fr;
  }

  .spec-source-options {
    grid-template-columns: 1fr;
  }
}

/* ── Screen Artifacts & Screenshots Gallery ────────────────── */
.screens-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.screen-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.screen-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-cyan);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.screen-thumb {
  width: 100%;
  height: 155px;
  object-fit: cover;
  background: #090d16;
  border-bottom: 1px solid var(--border-subtle);
  display: block;
}

.screen-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.screen-id {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.screen-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.screen-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
}
