:root {
  color-scheme: light;
  --bg: #eef3f7;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #d7e1ea;
  --accent: #0f8fb8;
  --accent-strong: #0f766e;
  --good: #0f9f6e;
  --warn: #b7791f;
  --bad: #dc2626;
  --ink: #101827;
  --soft: #e8f6f8;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 255px 1fr;
}

.sidebar {
  background: var(--ink);
  color: #f8fafc;
  padding: 28px 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.brand img {
  width: 42px;
  height: 42px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: #a8b5c8;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  text-decoration: none;
  padding: 0 12px;
  cursor: pointer;
  box-sizing: border-box;
}

.nav-item.active,
.nav-item:hover {
  background: #202b3b;
  color: #ffffff;
}

.icon {
  display: inline-block;
  width: 24px;
  color: #38bdf8;
}

.main {
  padding: 28px;
  display: grid;
  gap: 20px;
  align-content: start;
}

.toolbar {
  display: grid;
  grid-template-columns: 330px 1fr;
  align-items: stretch;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 14px;
  margin-bottom: 10px;
}

.toolbar p,
.panel-header span {
  color: var(--muted);
  font-size: 13px;
}

.page-title {
  display: grid;
  align-content: center;
  gap: 6px;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

#connection-status {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: #ecfdf5;
  color: var(--good);
  font-weight: 700;
}

#connection-status[data-status="error"] {
  background: #fef2f2;
  color: var(--bad);
}

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7f7;
  color: var(--bad);
  padding: 12px 14px;
}

.notice code {
  color: var(--text);
}

.hidden {
  display: none;
}

.scan-form {
  display: grid;
  gap: 12px;
}

.field-grid,
.action-grid {
  display: grid;
  gap: 10px;
}

.field-grid {
  display: none;
}

.action-grid {
  grid-template-columns: repeat(2, minmax(170px, 1fr)) minmax(160px, auto) repeat(2, minmax(120px, auto));
  align-items: end;
}

.action-grid button {
  min-width: 120px;
  white-space: nowrap;
  padding: 0 16px;
}

.github-repos-field {
  display: grid;
  gap: 8px;
}

.github-repo-list {
  display: grid;
  gap: 8px;
}

.github-repo-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.6fr) minmax(200px, 1.4fr) 36px;
  gap: 8px;
}

.github-repo-row .remove-repo-row {
  width: 36px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  background: #fbe4e4;
  color: #b42318;
}

.add-repo-row {
  justify-self: start;
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.group-badge {
  justify-self: start;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--soft);
  border-radius: 999px;
  padding: 2px 8px;
}

.linked-projects {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
}

.linked-project-chip {
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--soft);
  color: var(--accent);
}

.field {
  display: grid;
  gap: 5px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fbfdff;
  color: var(--text);
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 143, 184, 0.14);
}

.file-drop {
  position: relative;
  display: grid;
  gap: 5px;
  cursor: pointer;
}

.file-drop span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.file-drop strong {
  display: flex;
  align-items: center;
  min-height: 40px;
  border: 1px dashed #9fb8ca;
  border-radius: 6px;
  background: #f6fbff;
  color: #25566b;
  padding: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-drop:hover strong {
  border-color: var(--accent);
  background: var(--soft);
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  transition: box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
}

button:not(.project-row):not(.scan-row):not(.factor):not(.nav-item):not(.remove-repo-row):not(.mobile-menu-btn):not(.sidebar-close-btn):not(.back-to-overview-btn) {
  height: 40px;
  white-space: nowrap;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
}

button:hover {
  box-shadow: 0 10px 22px rgba(15, 143, 184, 0.16);
}

.secondary {
  background: var(--ink);
}

.ghost {
  background: #e2e8f0;
  color: var(--text);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.045);
}

.metric {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #cbd5e1;
}

.metric[data-state="good"]::before,
.metric[data-state="passed"]::before {
  background: var(--good);
}

.metric[data-state="warn"]::before,
.metric[data-state="warning"]::before,
.metric[data-state="running"]::before,
.metric[data-state="queued"]::before {
  background: #f59e0b;
}

.metric[data-state="bad"]::before,
.metric[data-state="failed"]::before,
.metric[data-state="error"]::before {
  background: var(--bad);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.metric small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin-top: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  min-height: 560px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.side-stack {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.workspace {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.panel {
  padding: 18px;
  min-width: 0;
  box-sizing: border-box;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.scan-list,
.project-list,
.findings-list,
.ai-list,
.fix-list,
.feature-grid,
.trend-list {
  display: grid;
  gap: 10px;
}

.scan-list {
  max-height: calc(100vh - 520px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.project-list {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.scan-row,
.project-row,
.finding-row,
.ai-row,
.fix-row,
.feature-card,
.trend-row,
.factor {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  width: 100%;
  height: auto;
  font: inherit;
  color: inherit;
}

.factor:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(15, 143, 184, 0.12);
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 36, 0.38);
  z-index: 40;
}

.factor-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100vw);
  background: #ffffff;
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 32px -18px rgba(15, 27, 36, 0.35);
  z-index: 41;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.factor-drawer .panel-header {
  flex: none;
  align-items: flex-start;
}

.factor-drawer.hidden {
  display: none;
}

.factor-drawer-subtitle {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.factor-drawer-body {
  overflow-y: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.factor-drawer-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  background: var(--soft, #f4fbfd);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.factor-drawer-meta div { display: flex; flex-direction: column; gap: 2px; }
.factor-drawer-meta span:first-child { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; }

.factor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.factor-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-strong, var(--line));
}

.factor-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.factor-table tr:last-child td { border-bottom: 0; }

.factor-table .loc,
.factor-table .cause,
.mono {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.factor-table .loc,
.factor-table .cause {
  font-size: 11.5px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.factor-evidence-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.project-row,
.scan-row {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  width: 100% !important;
  min-height: 76px !important;
  height: auto !important;
  white-space: normal !important;
  padding: 12px !important;
  box-sizing: border-box !important;
  text-align: left !important;
  overflow: hidden !important;
  color: var(--text);
  line-height: 1.35;
  cursor: pointer;
}

.project-row:hover,
.scan-row:hover {
  border-color: var(--accent);
  background: #f8fcff;
  box-shadow: none;
}

.project-row.active,
.scan-row.active {
  border-color: var(--accent);
  background: var(--soft);
  box-shadow: inset 4px 0 0 var(--accent);
}

.scan-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.scan-row-top b {
  border-radius: 999px;
  padding: 4px 8px;
  background: #e2e8f0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
}

.scan-row-top small {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.project-row[data-status="passed"] .scan-row-top b,
.scan-row[data-status="passed"] .scan-row-top b {
  background: #d1fae5;
  color: #047857;
}

.project-row[data-status="ready"] .scan-row-top b,
.project-row[data-status="running"] .scan-row-top b,
.project-row[data-status="queued"] .scan-row-top b,
.project-row[data-status="warning"] .scan-row-top b,
.scan-row[data-status="running"] .scan-row-top b,
.scan-row[data-status="warning"] .scan-row-top b,
.scan-row[data-status="queued"] .scan-row-top b {
  background: #fef3c7;
  color: #92400e;
}

.project-row[data-status="failed"] .scan-row-top b,
.project-row[data-status="error"] .scan-row-top b,
.scan-row[data-status="failed"] .scan-row-top b,
.scan-row[data-status="error"] .scan-row-top b {
  background: #fee2e2;
  color: #b91c1c;
}

.project-row strong,
.scan-row strong,
.finding-row strong,
.ai-row strong,
.fix-row strong,
.feature-card strong,
.trend-row strong,
.factor strong {
  display: block;
  margin-bottom: 4px;
}

.project-row span,
.scan-row span,
.finding-row span,
.ai-row span,
.fix-row span,
.feature-card span,
.trend-row span,
.factor span {
  color: var(--muted);
  font-size: 12px;
}

.project-row strong,
.scan-row strong {
  display: block !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  color: var(--text) !important;
  margin: 0 !important;
}

.project-row span,
.scan-row span {
  display: block !important;
  font-size: 11.5px !important;
  line-height: 1.35 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-all !important;
  color: var(--muted) !important;
  margin: 0 !important;
}

.workspace {
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.factor {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: 4px !important;
  height: auto !important;
  min-height: 62px !important;
  padding: 10px 14px !important;
  white-space: normal !important;
  text-align: left !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
}

.factor strong {
  display: block !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  color: var(--text) !important;
  margin: 0 !important;
  white-space: normal !important;
}

.factor span {
  display: block !important;
  font-size: 11.5px !important;
  line-height: 1.25 !important;
  color: var(--muted) !important;
  margin: 0 !important;
  white-space: normal !important;
}

.scan-progress {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 14px;
}

.progress-main {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}

.progress-main strong,
.progress-main span {
  display: block;
}

.progress-main span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.progress-main b {
  color: var(--accent-strong);
  font-size: 22px;
  line-height: 1;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #dfe8ef;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent-strong);
  transition: width 200ms ease;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.record-grid span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  padding: 9px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.record-grid b {
  display: block;
  color: var(--text);
  margin-bottom: 3px;
}

.factor[data-status="passed"] {
  border-color: #a7f3d0;
  background: #fbfffd;
}

.factor[data-status="warning"],
.factor[data-status="skipped"] {
  border-color: #fde68a;
  background: #fffdf6;
}

.factor[data-status="failed"] {
  border-color: #fecaca;
  background: #fffafa;
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-group {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.tech-group strong {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.chip {
  border-radius: 999px;
  background: #dff3f4;
  color: #0f676e;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.bars {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 80px 1fr 30px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent-strong);
}

.trend-row {
  display: grid;
  grid-template-columns: 120px 1fr 80px;
  align-items: center;
  gap: 10px;
}

.feature-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.feature-card {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  min-height: 82px;
}

.feature-card b {
  border-radius: 999px;
  padding: 4px 8px;
  background: #e2e8f0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.feature-card[data-status="active"],
.feature-card[data-status="ready"],
.feature-card[data-status="passed"] {
  border-color: #a7f3d0;
}

.feature-card[data-status="active"] b,
.feature-card[data-status="ready"] b,
.feature-card[data-status="passed"] b {
  background: #d1fae5;
  color: #047857;
}

.feature-card[data-status="partial"],
.feature-card[data-status="planned"],
.feature-card[data-status="running"],
.feature-card[data-status="warning"],
.feature-card[data-status="skipped"] {
  border-color: #fde68a;
}

.feature-card[data-status="partial"] b,
.feature-card[data-status="planned"] b,
.feature-card[data-status="running"] b,
.feature-card[data-status="warning"] b,
.feature-card[data-status="skipped"] b {
  background: #fef3c7;
  color: #92400e;
}

.feature-card[data-status="failed"],
.feature-card[data-status="missing"] {
  border-color: #fecaca;
}

.feature-card[data-status="failed"] b,
.feature-card[data-status="missing"] b {
  background: #fee2e2;
  color: #b91c1c;
}

.severity-critical,
.severity-high {
  color: var(--bad);
}

.severity-medium {
  color: var(--warn);
}

.severity-low,
.severity-info {
  color: var(--good);
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 24px;
  text-align: center;
  background: #fbfdff;
}

/* ==========================================================================
   Chart & Visualizations (Histogram, Seaborn Heatmaps, Spline Trend Charts)
   ========================================================================== */

.overview-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
  width: 100%;
  min-width: 0;
}

.trends-grid-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
  width: 100%;
  min-width: 0;
}

.chart-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.03);
}

.chart-card.full-width-chart {
  margin-bottom: 16px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.chart-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.chart-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.chart-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-badge.seaborn-badge {
  background: #e0f2fe;
  color: #0284c7;
}

.trend-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 600;
  color: var(--text);
}

.stat-pill b {
  color: var(--accent-strong);
}

.chart-box {
  width: 100%;
  overflow-x: auto;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.chart-box svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.trend-history-section {
  margin-top: 22px;
}

.trend-history-section h3 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text);
}

/* Seaborn Heatmap Legend */
.heatmap-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  padding: 6px 12px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* ==========================================================================
   Page View Separation (Dedicated Page Positions per Sidebar Menu)
   ========================================================================== */

body[data-active-view="overview"] .toolbar {
  display: grid;
}

body[data-active-view="overview"] .side-stack {
  display: grid;
  grid-column: 1;
}

body[data-active-view="overview"] .workspace {
  grid-column: 2;
}

body:not([data-active-view="overview"]) .toolbar {
  display: none !important;
}

body:not([data-active-view="overview"]) .side-stack {
  display: none !important;
}

body:not([data-active-view="overview"]) .layout {
  grid-template-columns: 1fr !important;
}

body:not([data-active-view="overview"]) .workspace {
  grid-column: 1 !important;
  width: 100% !important;
  min-width: 0;
}

.back-to-overview-btn {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid var(--line);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.back-to-overview-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

/* ==========================================================================
   Mobile Topbar, Drawer & Scrim
   ========================================================================== */

.mobile-topbar {
  display: none;
}

.sidebar-close-btn {
  display: none;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-scrim.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   Fixes & Remediation Solutions Panel
   ========================================================================== */

.nav-badge {
  margin-left: auto;
  background: var(--bad);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.2;
}

.nav-badge.hidden {
  display: none !important;
}

.fix-cta-banner {
  margin-top: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
  border: 1px solid #7dd3fc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.fix-cta-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 240px;
  flex: 1;
}

.fix-cta-info strong {
  font-size: 14px;
  color: #0369a1;
}

.fix-cta-info span {
  font-size: 12px;
  color: #475569;
  line-height: 1.4;
}

.fix-cta-btn {
  background: var(--accent);
  color: #ffffff !important;
  border: 0;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.fix-cta-btn:hover {
  background: #0b7294;
  box-shadow: 0 4px 12px rgba(15, 143, 184, 0.25);
  transform: translateY(-1px);
}

.fixes-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.fixes-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.fixes-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fix-filter-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 120ms ease;
}

.fix-filter-btn:hover {
  border-color: var(--accent);
  background: #f0f9ff;
}

.fix-filter-btn.active {
  background: var(--accent) !important;
  color: #ffffff !important;
  border-color: var(--accent) !important;
}

.copy-all-btn {
  background: #0f172a !important;
  color: #38bdf8 !important;
  border: 1px solid #334155 !important;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.copy-all-btn:hover {
  background: #1e293b !important;
  color: #7dd3fc !important;
}

.fixes-search-box {
  width: 100%;
}

#fixes-search-input {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  background: #ffffff;
  color: var(--text);
  outline: none;
  box-sizing: border-box;
  transition: border-color 120ms ease;
}

#fixes-search-input:focus {
  border-color: var(--accent);
}

.fixes-cards-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fix-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow 150ms ease, border-color 150ms ease;
}

.fix-card.severity-critical {
  border-left: 5px solid #dc2626;
}

.fix-card.severity-high {
  border-left: 5px solid #ea580c;
}

.fix-card.severity-medium {
  border-left: 5px solid #d97706;
}

.fix-card.severity-low,
.fix-card.severity-info,
.fix-card.severity-warning {
  border-left: 5px solid #0284c7;
}

.fix-card-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.fix-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fix-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.fix-badge.severity-critical {
  background: #fee2e2;
  color: #991b1b;
}

.fix-badge.severity-high {
  background: #ffedd5;
  color: #9a3412;
}

.fix-badge.severity-medium {
  background: #fef3c7;
  color: #92400e;
}

.fix-badge.severity-low {
  background: #e0f2fe;
  color: #0369a1;
}

.fix-badge.severity-info {
  background: #f1f5f9;
  color: #475569;
}

.fix-badge.category-badge {
  background: #ecfdf5;
  color: #065f46;
}

.fix-badge.code-badge {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-family: ui-monospace, Consolas, monospace;
}

.fix-card-title-group {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.fix-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.fix-source {
  font-size: 12px;
  color: var(--muted);
}

.fix-source b {
  color: var(--text);
}

.fix-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fix-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.fix-location-details {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
}

.fix-loc-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fix-loc-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.fix-loc-val {
  font-size: 12.5px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--text);
  word-break: break-all;
}

.fix-loc-val.file-name {
  color: var(--accent-strong);
  font-weight: 700;
}

.fix-loc-val.line-number {
  color: #0369a1;
  font-weight: 700;
}

.fix-reason-section {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 12px 14px;
}

.fix-reason-section .fix-section-title {
  color: #92400e;
}

.fix-reason-text {
  font-size: 13.5px;
  line-height: 1.45;
  color: #78350f;
}

.fix-raw-message {
  margin-top: 4px;
  font-size: 12px;
  color: #92400e;
}

.fix-raw-message code {
  font-family: ui-monospace, Consolas, monospace;
  background: rgba(255, 255, 255, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-all;
}

.fix-code-box {
  background: #0f172a;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 6px;
}

.fix-code-header {
  background: #1e293b;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fix-code-preview,
.fix-diff-preview {
  margin: 0;
  padding: 12px 14px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #f8fafc;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.fix-diff-preview {
  color: #93c5fd;
}

.fix-solution-text {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}

.fix-command-box,
.fix-verify-box {
  background: #0f172a;
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.fix-verify-box {
  background: #141f2d;
  border: 1px dashed #334155;
}

.fix-cmd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cmd-label {
  color: #38bdf8;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.fix-verify-box .cmd-label {
  color: #34d399;
}

.copy-cmd-btn {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 120ms ease;
  white-space: nowrap;
}

.copy-cmd-btn:hover {
  background: #334155;
  color: #ffffff;
}

.copy-cmd-btn.copied {
  background: #059669 !important;
  color: #ffffff !important;
  border-color: #059669 !important;
}

.fix-cmd-code {
  margin: 0;
  color: #f1f5f9;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.4;
  word-break: break-all;
  white-space: pre-wrap;
}

.verify-code {
  color: #6ee7b7;
}

.fix-clean-card {
  background: #ffffff;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.fix-clean-icon {
  font-size: 36px;
}

.fix-clean-card h3 {
  margin: 0;
  font-size: 18px;
  color: #065f46;
}

.fix-clean-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  max-width: 480px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1220px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .action-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .layout {
    grid-template-columns: 1fr !important;
  }

  body[data-active-view="overview"] .side-stack,
  body[data-active-view="overview"] .workspace {
    grid-column: 1 !important;
  }
}

@media (max-width: 980px) {
  .shell {
    display: block;
    width: 100%;
    min-height: 100vh;
  }

  /* Slide-out mobile drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    max-width: 84vw;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.35);
    overflow-y: auto;
    padding: 22px 18px;
  }

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

  .sidebar .brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
  }

  .sidebar .brand-info {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
  }

  .sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.22);
  }

  /* Mobile Topbar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 54px;
    padding: 0 14px;
    background: var(--ink);
    border-radius: 8px;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  }

  .mobile-menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
  }

  .mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.16);
  }

  .hamburger-bar {
    width: 18px;
    height: 2px;
    background: #cbd5e1;
    border-radius: 2px;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-brand img {
    width: 24px;
    height: 24px;
  }

  .mobile-brand-title {
    font-weight: 700;
    font-size: 15px;
    color: #ffffff;
  }

  .mobile-view-pill {
    background: rgba(56, 189, 248, 0.16);
    color: #38bdf8;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
  }

  .mobile-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #0f9f6e;
    box-shadow: 0 0 8px rgba(15, 159, 110, 0.6);
  }

  .mobile-status-dot[data-status="error"] {
    background: #dc2626;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.6);
  }

  .main {
    padding: 14px;
    gap: 14px;
  }

  /* Compact 2-column metrics on mobile/tablet */
  .metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .metric {
    padding: 12px 14px;
  }

  .metric strong {
    font-size: 22px;
  }

  .metric:nth-child(5) {
    grid-column: span 2;
  }

  .toolbar {
    padding: 14px;
    gap: 14px;
  }

  .action-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .action-grid button {
    width: 100%;
  }

  .github-repo-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .github-repo-row .remove-repo-row {
    width: 100%;
    height: 32px;
  }

  .layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

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

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

  .overview-charts,
  .trends-grid-charts {
    grid-template-columns: 1fr;
  }

  .status-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .fix-location-details {
    grid-template-columns: 1fr;
  }

  .fix-cta-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .fix-cta-btn {
    justify-content: center;
  }
}

@media (max-width: 520px) {
  .main {
    padding: 10px;
    gap: 10px;
  }

  .fix-card {
    padding: 14px;
  }

  .fixes-toolbar-top {
    flex-direction: column;
    align-items: stretch;
  }

  .copy-all-btn {
    text-align: center;
    justify-content: center;
  }

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

  .metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .metric {
    padding: 10px 12px;
  }

  .metric strong {
    font-size: 20px;
  }

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