/* ============================================================
   OMGQA — design-system skin for MudBlazor.
   Dark-first, Linear/GitHub/Vercel lineage, indigo accent.
   Tokens ported from the OMGQA design prototype (styles.css).
   ============================================================ */

:root {
  --bg:            #0C0D11;
  --bg-elev:       #121319;
  --surface:       #16171E;
  --surface-2:     #1C1D26;
  --surface-3:     #232430;

  --line:          rgba(255,255,255,0.08);
  --line-2:        rgba(255,255,255,0.05);
  --line-strong:   rgba(255,255,255,0.14);

  --fg-1:          #EDEEF2;
  --fg-2:          #A6A8B3;
  --fg-3:          #6E707C;

  --accent:        #5E6AD2;
  --accent-hover:  #6E7AE6;
  --accent-soft:   color-mix(in srgb, var(--accent) 16%, transparent);

  --sev-critical:  #F2555A;
  --sev-high:      #FF8A3D;
  --sev-medium:    #E5B636;
  --sev-low:       #57B6E5;
  --sev-none:      #6E707C;

  --st-open:       #57B6E5;
  --st-triage:     #C792EA;
  --st-progress:   #E5B636;
  --st-review:     #FF8A3D;
  --st-resolved:   #38C793;
  --st-closed:     #6E707C;

  --ai:            #C792EA;

  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

html, body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg-1);
}

.mud-typography, .mud-input, .mud-button-root, .mud-nav-link, .mud-table {
  font-family: var(--font-sans) !important;
}

code, .t-mono, .mono { font-family: var(--font-mono); }
.om-muted { color: var(--fg-2); }
.om-faint { color: var(--fg-3); }

/* ---------- App shell ---------- */
.om-appbar {
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.om-brand { font-weight: 700; letter-spacing: -.2px; }

/* Workspace switcher (app bar) — native <details> disclosure, not MudMenu (see MainLayout for why). */
.om-ws-switch { position: relative; }
.om-ws-switch > summary { list-style: none; cursor: pointer; outline: none; }
.om-ws-switch > summary::-webkit-details-marker { display: none; }
.om-ws-switch > summary::marker { content: ""; }
.om-ws-bar {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--fg-1);
  user-select: none;
}
.om-ws-bar:hover { background: rgba(255,255,255,.07); }
.om-ws-menu {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 1200; min-width: 220px;
  background: var(--bg-elev, var(--surface)); border: 1px solid var(--line);
  border-radius: 10px; padding: 5px; box-shadow: 0 10px 30px rgba(0,0,0,.28);
}
.om-ws-menu-caption { font-size: 12px; color: var(--fg-3); }
.om-ws-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: 0; text-align: left; cursor: pointer;
  padding: 8px 12px; border-radius: 7px; font-size: 13.5px; color: var(--fg-1);
  text-decoration: none;
}
.om-ws-item:hover { background: var(--surface-2); }

/* Project picker in the app bar: no floating label (it overlapped the dense bar), just a compact outlined box. */
/* Board tabs: subtle divider between the tab strip and the panel content, plus a little breathing room
   so the column headers (Backlog/Todo/…) don't sit flush against the tab row. */
.om-pm-tabs .mud-tabs-tabbar { border-color: var(--line) !important; }
.om-pm-tabs .mud-tabs-panels { padding-top: 16px; }
.om-pm-project { align-self: center; }
.om-pm-project .mud-input-control { margin-top: 0; }
.om-pm-project .mud-input.mud-input-outlined .mud-input-slot { padding-top: 6px; padding-bottom: 6px; }
.om-drawer .mud-drawer-content { border-right: 1px solid var(--line); background: var(--bg-elev); }
.om-main { background: var(--bg); }
.om-page { padding: 20px 24px; max-width: 1240px; }

/* ---------- Sidebar bits ---------- */
.om-ws-mark {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.om-proj-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; border-radius: 5px; margin-right: 9px;
  font-size: 8.5px; font-weight: 700; font-family: var(--font-mono); letter-spacing: -.3px;
}
.om-user {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; margin-top: auto; border-top: 1px solid var(--line-2);
}
.om-user-name { font-size: 13px; font-weight: 500; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.om-user-role { font-size: 11px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.om-user form { flex-shrink: 0; }

/* active nav link tint */
.om-drawer .mud-nav-link.active {
  background: var(--accent-soft) !important; color: var(--accent) !important;
}
.om-drawer .mud-nav-link.active .mud-icon-root { color: var(--accent) !important; }

/* ---------- Mini (icon-only) rail: collapsed desktop sidebar ---------- */
/* Hide every label / header / count so only the centered nav icons remain at MiniWidth. */
.om-drawer--mini .mud-nav-link-text,
.om-drawer--mini .om-user-name,
.om-drawer--mini .om-user-role,
.om-drawer--mini .mud-nav-link .mud-chip { display: none !important; }
.om-drawer--mini .mud-nav-link {
  justify-content: center;
  padding-left: 0 !important; padding-right: 0 !important;
}
.om-drawer--mini .mud-nav-link .mud-nav-link-icon { margin-right: 0 !important; }
.om-drawer--mini .om-user { justify-content: center; gap: 0; padding-left: 0; padding-right: 0; }
.om-drawer--mini .om-user form { display: none; } /* expand the sidebar to sign out */

/* ---------- Severity bars ---------- */
.om-sev-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.om-sev-bars > span { width: 3px; border-radius: 1px; display: block; }

/* ---------- Status badge ---------- */
.om-status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}

/* ---------- Tag ---------- */
.om-tag {
  display: inline-flex; align-items: center; gap: 1px;
  padding: 2px 8px; border-radius: 7px;
  background: var(--surface-3); color: var(--fg-2);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--line-2);
}
.om-minitag {
  padding: 1px 6px; border-radius: 5px; background: var(--surface-2);
  color: var(--fg-3); font-size: 11px; white-space: nowrap;
}

/* ---------- Cards / papers ---------- */
.om-card {
  background: var(--surface) !important;
  border: 1px solid var(--line);
  border-radius: 12px; padding: 16px;
}
.om-card h3, .om-card-title { font-size: 13px; font-weight: 600; color: var(--fg-1); margin: 0 0 12px; }

/* ---------- Stat cards ---------- */
.om-stat { display: flex; flex-direction: column; gap: 6px; }
.om-stat-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.om-stat-val { font-size: 26px; font-weight: 600; letter-spacing: -.5px; }
.om-stat-label { font-size: 12.5px; color: var(--fg-2); }

/* ---------- Bars ---------- */
.om-bar-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.om-bar-label { width: 74px; font-size: 12.5px; color: var(--fg-2); }
.om-bar-track { flex: 1; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.om-bar-fill { display: block; height: 100%; border-radius: 999px; }
.om-bar-val { width: 24px; text-align: right; font-size: 12.5px; color: var(--fg-2); font-variant-numeric: tabular-nums; }

/* ---------- Findings table refinements ---------- */
.om-ftitle { font-weight: 450; color: var(--fg-1); }
.om-id { color: var(--fg-2); font-size: 12.5px; }

/* ---------- Finding detail ---------- */
.om-d-title { font-size: 22px; font-weight: 600; letter-spacing: -.4px; margin: 8px 0 12px; line-height: 1.3; }
.om-d-topline { display: flex; align-items: center; gap: 8px; color: var(--fg-2); font-size: 13px; }
.om-d-quickbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.om-d-h { font-size: 13px; font-weight: 600; color: var(--fg-2); text-transform: uppercase; letter-spacing: .4px; margin: 0 0 10px; }
.om-d-desc p { color: var(--fg-1); line-height: 1.65; margin: 0 0 12px; }
.om-ai-panel {
  border: 1px solid color-mix(in srgb, var(--ai) 35%, transparent);
  background: color-mix(in srgb, var(--ai) 8%, var(--surface));
  border-radius: 12px; padding: 16px;
}
.om-ai-orb {
  width: 26px; height: 26px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--ai) 22%, transparent); color: var(--ai);
}
.om-ev-card {
  display: flex; align-items: center; gap: 10px; padding: 9px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.om-ev-thumb { width: 44px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.om-prop { display: flex; align-items: center; min-height: 30px; }
.om-prop-label { width: 96px; color: var(--fg-3); font-size: 12.5px; flex-shrink: 0; }
.om-rail-h { color: var(--fg-3); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.om-pill-soft { padding: 2px 8px; border-radius: 6px; background: var(--surface-3); font-size: 12.5px; }

/* Paste-a-screenshot target in the New Finding dialog (permission-free clipboard paste). */
.om-pastebox {
  min-height: 38px; border: 1px dashed var(--line); border-radius: 8px;
  padding: 9px 12px; color: var(--fg-1); font-size: 13px; cursor: text;
  transition: border-color .12s ease;
}
.om-pastebox:empty::before { content: attr(data-ph); color: var(--fg-3); }
.om-pastebox:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }

/* Copy-pasteable code/snippet block (CI ingestion help, etc.). */
.om-codeblock {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin: 6px 0 2px; overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  line-height: 1.5; color: var(--fg-1); white-space: pre;
}

/* ============================================================
   E23 — In-app debugging: evidence timeline + trace step viewer.
   ============================================================ */
.om-tl { margin-top: 6px; }
.om-tl-lane {
  display: grid; grid-template-columns: 78px 1fr; align-items: center;
  gap: 10px; min-height: 30px; padding: 3px 0;
}
.om-tl-lane-label {
  color: var(--fg-3); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px; text-align: right;
}
.om-tl-track {
  position: relative; height: 22px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line-2);
}
.om-tl-mark {
  position: absolute; top: 3px; width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; border: 2px solid var(--bg); cursor: pointer;
  background: var(--accent);
}
.om-tl-mark.is-error { background: var(--sev-critical); }
.om-tl-mark.k-screenshot { background: var(--st-open); }
.om-tl-mark.k-video { background: var(--st-triage); }
.om-tl-mark.k-network { background: var(--st-resolved); }
.om-tl-mark.k-console { background: var(--st-progress); }
.om-tl-axis {
  display: flex; justify-content: space-between;
  color: var(--fg-3); font-size: 10.5px; padding: 2px 0 0 88px;
}
.om-step {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); padding: 10px 12px; margin-top: 8px;
}
.om-step.is-failed { border-color: color-mix(in srgb, var(--sev-critical) 55%, transparent); }
.om-step-head { display: flex; align-items: center; gap: 8px; }
.om-step-idx {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--fg-2);
}
.om-step-dur { color: var(--fg-3); font-size: 11.5px; margin-left: auto; }
.om-step-err {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12px;
  background: color-mix(in srgb, var(--sev-critical) 12%, transparent);
  color: var(--sev-critical); white-space: pre-wrap;
}
.om-net-row {
  display: grid; grid-template-columns: 52px 56px 1fr 70px; gap: 8px;
  align-items: center; font-size: 12px; padding: 5px 0;
  border-bottom: 1px solid var(--line-2);
}
.om-net-status { font-weight: 700; }
.om-net-status.is-error { color: var(--sev-critical); }
.om-net-status.is-ok { color: var(--st-resolved); }
.om-lightbox-img { max-width: 100%; max-height: 78vh; display: block; margin: 0 auto; border-radius: 8px; }

/* Rendered markdown — story descriptions, document bodies, epic summaries (MarkdownView). Theme-aware. */
.om-md { font-size: 0.875rem; line-height: 1.55; color: var(--mud-palette-text-primary); overflow-wrap: anywhere; }
.om-md > :first-child { margin-top: 0; }
.om-md > :last-child { margin-bottom: 0; }
.om-md h1, .om-md h2, .om-md h3, .om-md h4, .om-md h5, .om-md h6 { font-weight: 600; line-height: 1.3; margin: 1em 0 0.4em; }
.om-md h1 { font-size: 1.35rem; }
.om-md h2 { font-size: 1.2rem; }
.om-md h3 { font-size: 1.05rem; }
.om-md h4 { font-size: 0.95rem; }
.om-md h5, .om-md h6 { font-size: 0.875rem; color: var(--mud-palette-text-secondary); }
.om-md p { margin: 0.5em 0; }
.om-md ul, .om-md ol { margin: 0.5em 0; padding-left: 1.5em; }
.om-md li { margin: 0.2em 0; }
.om-md li > p { margin: 0.2em 0; }
.om-md a { color: var(--mud-palette-primary); text-decoration: none; }
.om-md a:hover { text-decoration: underline; }
.om-md code { font-family: ui-monospace, "Geist Mono", monospace; font-size: 0.85em; background: rgba(255,255,255,0.08); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
.om-md pre { background: rgba(255,255,255,0.05); border: 1px solid var(--mud-palette-divider); border-radius: 6px; padding: 0.75em 1em; overflow-x: auto; margin: 0.6em 0; }
.om-md pre code { background: none; padding: 0; font-size: 0.82em; }
.om-md blockquote { margin: 0.6em 0; padding: 0.2em 0 0.2em 1em; border-left: 3px solid var(--mud-palette-divider); color: var(--mud-palette-text-secondary); }
.om-md table { border-collapse: collapse; margin: 0.6em 0; font-size: 0.85em; }
.om-md th, .om-md td { border: 1px solid var(--mud-palette-divider); padding: 0.3em 0.6em; text-align: left; }
.om-md th { background: rgba(255,255,255,0.04); font-weight: 600; }
.om-md hr { border: none; border-top: 1px solid var(--mud-palette-divider); margin: 1em 0; }
.om-md img { max-width: 100%; border-radius: 6px; }
