/* ============================================================
   Mitari Agent — Design System
   Palette: charcoal bg · neon-lime accent · dark panels
   ============================================================ */

:root {
  --bg:          #131416;
  --panel:       #1c1d20;
  --panel-alt:   #242527;
  --border:      #2d2e33;
  --border-mid:  #3a3b40;

  --lime:        #c8f400;
  --lime-dim:    #9bbd00;
  --lime-glow:   rgba(200, 244, 0, 0.18);
  --lime-glow-sm:rgba(200, 244, 0, 0.10);

  --text:        #f0f0f0;
  --text-muted:  #8a8c94;
  --text-dim:    #5a5c65;

  --crit:        #f74d4d;
  --crit-bg:     rgba(247, 77, 77, 0.12);
  --warn:        #f5a523;
  --warn-bg:     rgba(245, 165, 35, 0.12);
  --opp:         #58a6ff;
  --opp-bg:      rgba(88, 166, 255, 0.12);
  --success:     #3fb950;
  --success-bg:  rgba(63, 185, 80, 0.12);

  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header ---- */
.m-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.m-header img { width: 30px; height: 30px; border-radius: 7px; }
.m-header-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.m-badge {
  background: var(--lime);
  color: #111;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.m-header-spacer { flex: 1; }

/* ---- Status chips ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip-queued    { background: rgba(88,166,255,0.15); color: var(--opp); }
.chip-running   { background: rgba(245,165,35,0.15); color: var(--warn); }
.chip-succeeded { background: var(--lime-glow-sm); color: var(--lime); border: 1px solid rgba(200,244,0,0.3); }
.chip-failed    { background: var(--crit-bg); color: var(--crit); }
.chip-noop      { background: rgba(88,166,255,0.10); color: var(--text-muted); }

/* ---- Cards ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-glow {
  box-shadow: 0 0 0 1px var(--border), 0 4px 24px rgba(0,0,0,0.4);
}
.card-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.card-section:last-child { border-bottom: none; }

/* ---- Severity dots + badges ---- */
.sev-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.sev-dot-high   { background: var(--crit); box-shadow: 0 0 6px var(--crit); }
.sev-dot-medium { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.sev-dot-low    { background: var(--opp);  box-shadow: 0 0 6px var(--opp); }

.sev-pill {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sev-pill-high   { background: var(--crit-bg); color: var(--crit); }
.sev-pill-medium { background: var(--warn-bg); color: var(--warn); }
.sev-pill-low    { background: var(--opp-bg);  color: var(--opp); }

.conf-pill {
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--panel-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ---- Mono / code ---- */
.mono { font-family: "SFMono-Regular", "Consolas", monospace; font-size: 0.82em; }
.loc-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- Report card stat blocks ---- */
.stat-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 20px;
  border-radius: var(--radius);
  min-width: 90px;
}
.stat-num {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}
.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.stat-crit  { background: var(--crit-bg); color: var(--crit); }
.stat-warn  { background: var(--warn-bg); color: var(--warn); }
.stat-opp   { background: var(--opp-bg);  color: var(--opp); }
.stat-clean { background: var(--lime-glow-sm); color: var(--lime); }

/* ---- Model report card categories ---- */
.mrc-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.mrc-item:last-child { border-bottom: none; }
.mrc-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.mrc-icon-ok      { background: var(--lime-glow-sm); color: var(--lime); border: 1px solid rgba(200,244,0,0.3); }
.mrc-icon-warn    { background: var(--crit-bg); color: var(--crit); }
.mrc-icon-neutral { background: var(--panel-alt); color: var(--text-dim); border: 1px solid var(--border); }
.mrc-name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.mrc-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
  text-decoration: none;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-primary {
  background: var(--lime);
  color: #111;
}
.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-mid);
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); }

/* ---- Collapsible finding card ---- */
details.finding-card { border-radius: var(--radius); overflow: hidden; }
details.finding-card summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}
details.finding-card[open] summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-color: var(--border-mid);
}
details.finding-card summary::-webkit-details-marker { display: none; }
details.finding-card summary:hover { border-color: var(--border-mid); }

details.finding-card[open] summary { box-shadow: none; }
details.finding-card > summary ~ * {
  background: var(--panel);
  border: 1px solid var(--border-mid);
  border-top: none;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  padding: 16px 18px;
}

.finding-chevron {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.8rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}
details[open] .finding-chevron { transform: rotate(180deg); }

.finding-title-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.finding-body-grid {
  display: grid;
  gap: 14px;
}
.finding-field label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 5px;
}
.finding-field p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.finding-locs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

details.diff-toggle {
  margin-top: 10px;
}
details.diff-toggle summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--lime);
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
  user-select: none;
}
details.diff-toggle summary::-webkit-details-marker { display: none; }
details.diff-toggle summary:hover { opacity: 0.8; }
details.diff-toggle > div {
  margin-top: 8px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  overflow-x: auto;
  line-height: 1.6;
}

/* ---- Section label ---- */
.section-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* ---- Meta grid ---- */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.meta-item label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 4px;
}
.meta-item span { font-size: 0.85rem; color: var(--text-muted); }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-dim);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .run-layout { grid-template-columns: 1fr !important; }
  .sidebar { display: none; }
}
