﻿/* ============================================================
   NETWORK — Design System
   GitHub-dark palette, single CSS source of truth.
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg-base:      #0d1117;
  --bg-surface:   #161b22;
  --bg-elevated:  #21262d;
  --bg-border:    #30363d;
  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #484f58;
  --text-link:      #58a6ff;
  --accent:        #1f6feb;
  --accent-hover:  #388bfd;
  --accent-subtle: #1f3a5f;
  --sev-critical: #ff4444;
  --sev-high:     #ff8c00;
  --sev-medium:   #ffd700;
  --sev-low:      #4fc3f7;
  --sev-info:     #8b949e;
  --status-online:  #3fb950;
  --status-offline: #f85149;
  --status-unknown: #8b949e;
  --status-running: #d29922;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
  --font-size-base: 14px;
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.6);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--font-size-base); }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-hover); }
code, pre, .mono { font-family: var(--font-mono); font-size: 0.875em; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* ── Layout ─────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--bg-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--bg-border);
  flex-shrink: 0;
}
.logo-icon { font-size: 20px; color: var(--accent); line-height: 1; }
.logo-text  { font-size: 15px; font-weight: 700; color: var(--text-primary); letter-spacing: -.3px; }
.logo-version { font-size: 11px; color: var(--text-muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.nav-section {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted); padding: 16px 16px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; font-size: 13px; color: var(--text-secondary);
  transition: background .12s, color .12s;
  border-left: 3px solid transparent; cursor: pointer;
}
.nav-link:hover { background: var(--bg-elevated); color: var(--text-primary); text-decoration: none; }
.nav-link.active { background: var(--accent-subtle); color: var(--accent-hover); border-left-color: var(--accent); font-weight: 600; }
.nav-link i, .nav-link .nav-icon { width: 16px; text-align: center; flex-shrink: 0; font-size: 13px; }
.nav-divider { height: 1px; background: var(--bg-border); margin: 8px 16px; }
.nav-footer {
  margin-top: auto; padding: 12px 16px;
  border-top: 1px solid var(--bg-border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-muted); flex-shrink: 0;
}
.nav-footer a { color: var(--text-muted); font-size: 12px; }
.nav-footer a:hover { color: var(--status-offline); text-decoration: none; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content { display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; }
.page-body { padding: 24px; flex: 1; }

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-title { font-size: 20px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.page-title small { display: block; font-size: 13px; font-weight: 400; color: var(--text-secondary); margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-bottom: 16px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); transition: color .15s; }
.breadcrumb a:hover { color: var(--accent-hover); text-decoration: none; }
.breadcrumb-sep { color: var(--bg-border); }
.breadcrumb-current { color: var(--text-secondary); }

/* ── Cards ──────────────────────────────────────────────────── */
.card { background: var(--bg-surface); border: 1px solid var(--bg-border); border-radius: var(--radius-md); padding: 16px; position: relative; }
.card + .card { margin-top: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--text-secondary); font-size: 13px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ── KPI Strip ──────────────────────────────────────────────── */
.stat-grid { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.kpi {
  background: var(--bg-surface); border: 1px solid var(--bg-border);
  border-radius: var(--radius-md); padding: 14px 18px;
  min-width: 110px; display: flex; flex-direction: column; gap: 2px;
}
.kpi-num { font-size: 26px; font-weight: 700; line-height: 1; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); font-weight: 600; }
.kpi--critical .kpi-num { color: var(--sev-critical); }
.kpi--high     .kpi-num { color: var(--sev-high); }
.kpi--medium   .kpi-num { color: var(--sev-medium); }
.kpi--low      .kpi-num { color: var(--sev-low); }
.kpi--success  .kpi-num { color: var(--status-online); }
.kpi--accent   .kpi-num { color: var(--accent-hover); }
/* aliases used by report_detail / target_profile */
.kpi-strip  { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.kpi-card   { background: var(--bg-surface); border: 1px solid var(--bg-border); border-radius: var(--radius-md); padding: 14px 18px; min-width: 100px; display: flex; flex-direction: column; gap: 4px; }
.kpi-value  { font-size: 26px; font-weight: 700; line-height: 1; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--bg-elevated); color: var(--text-secondary);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  padding: 10px 14px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--bg-border); position: sticky; top: 0; z-index: 2;
}
.data-table td { padding: 10px 14px; color: var(--text-primary); border-bottom: 1px solid var(--bg-border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-elevated); }
.data-table .muted { color: var(--text-secondary); font-size: 12px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; font-size: 11px; font-weight: 600;
  border-radius: 20px; white-space: nowrap; border: 1px solid transparent;
}
.badge--critical { background: rgba(255,68,68,.15);  color: var(--sev-critical); border-color: rgba(255,68,68,.3); }
.badge--high     { background: rgba(255,140,0,.15);  color: var(--sev-high);     border-color: rgba(255,140,0,.3); }
.badge--medium   { background: rgba(255,215,0,.12);  color: var(--sev-medium);   border-color: rgba(255,215,0,.25); }
.badge--low      { background: rgba(79,195,247,.12); color: var(--sev-low);      border-color: rgba(79,195,247,.25); }
.badge--info     { background: rgba(139,148,158,.1); color: var(--sev-info);     border-color: rgba(139,148,158,.25); }
.badge--online   { background: rgba(63,185,80,.12);  color: var(--status-online);  border-color: rgba(63,185,80,.3); }
.badge--offline  { background: rgba(248,81,73,.12);  color: var(--status-offline); border-color: rgba(248,81,73,.3); }
.badge--unknown  { background: rgba(139,148,158,.1); color: var(--status-unknown); border-color: rgba(139,148,158,.2); }
.badge--running  { background: rgba(210,153,34,.12); color: var(--status-running); border-color: rgba(210,153,34,.3); }
.badge--reviewed { background: rgba(31,111,235,.12); color: var(--accent-hover);   border-color: rgba(31,111,235,.3); }
.badge--complete { background: rgba(63,185,80,.1);   color: var(--status-online);  border-color: rgba(63,185,80,.2); }
.badge--failed   { background: rgba(248,81,73,.12);  color: var(--status-offline); border-color: rgba(248,81,73,.3); }
.badge--neutral  { background: var(--bg-elevated); color: var(--text-secondary); border-color: var(--bg-border); }
.badge--accent   { background: var(--accent-subtle); color: var(--accent-hover); border-color: rgba(31,111,235,.4); }

/* ── Status Dots ────────────────────────────────────────────── */
.status-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.status-dot--up,
.status-dot--online  { background: var(--status-online); box-shadow: 0 0 6px var(--status-online); }
.status-dot--down,
.status-dot--offline { background: var(--status-offline); }
.status-dot--unknown { background: var(--status-unknown); }
.status-dot--running { background: var(--status-running); animation: pulse-dot 1.4s ease-in-out infinite; }
.status-row { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(210,153,34,.5); }
  50%       { opacity: .7; box-shadow: 0 0 0 5px rgba(210,153,34,0); }
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  font-family: var(--font-sans);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .14s, border-color .14s, opacity .14s;
  text-decoration: none; white-space: nowrap; vertical-align: middle;
  line-height: 1; -webkit-user-select: none; user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled, .btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--danger  { background: rgba(248,81,73,.15); border-color: rgba(248,81,73,.4); color: var(--status-offline); }
.btn--danger:hover { background: rgba(248,81,73,.28); }
.btn--success { background: rgba(63,185,80,.15); border-color: rgba(63,185,80,.4); color: var(--status-online); }
.btn--success:hover { background: rgba(63,185,80,.28); }
.btn--ghost   { background: transparent; border-color: var(--bg-border); color: var(--text-secondary); }
.btn--ghost:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--text-muted); }
.btn--icon    { padding: 6px 8px; background: transparent; border-color: transparent; color: var(--text-muted); }
.btn--icon:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--bg-border); }
.btn--sm { padding: 4px 10px; font-size: 12px; }
.btn--xs { padding: 2px 7px;  font-size: 11px; }
.btn--lg { padding: 10px 20px; font-size: 14px; }
.btn.loading { pointer-events: none; opacity: .7; }
.btn.loading::before {
  content: ''; display: inline-block; width: 11px; height: 11px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin .6s linear infinite; flex-shrink: 0;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input,
.form-select,
.form-textarea {
  display: block; width: 100%; padding: 8px 12px;
  font-size: 13px; font-family: var(--font-sans);
  color: var(--text-primary); background: var(--bg-elevated);
  border: 1px solid var(--bg-border); border-radius: var(--radius-sm);
  outline: none; transition: border-color .14s, box-shadow .14s;
  appearance: none; -webkit-appearance: none;
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,111,235,.2); }
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible { outline: none; }
.form-select {
  cursor: pointer; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b949e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.form-hint { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-hint.error { color: var(--status-offline); }
.form-row { display: grid; gap: 12px; align-items: end; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr auto; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-secondary); user-select: none; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

/* ── Filter Bar ─────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar .form-input,
.filter-bar .form-select { max-width: 200px; }
.filter-bar .search-input { flex: 1; min-width: 180px; max-width: 320px; }
.filter-tabs { display: flex; gap: 2px; background: var(--bg-elevated); padding: 3px; border-radius: var(--radius-md); flex-wrap: wrap; }
.filter-tab {
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  border-radius: calc(var(--radius-md) - 2px); background: transparent;
  border: none; color: var(--text-muted); cursor: pointer;
  transition: background .12s, color .12s; font-family: var(--font-sans); white-space: nowrap;
}
.filter-tab:hover { background: var(--bg-border); color: var(--text-secondary); }
.filter-tab.active { background: var(--bg-surface); color: var(--text-primary); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-backdrop,
.modal-overlay {
  position: fixed; inset: 0; background: rgba(1,4,9,.75);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--bg-surface); border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: modal-in .16s ease;
}
.modal--lg { max-width: 760px; }
.modal--sm { max-width: 400px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--bg-border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-title  { font-size: 15px; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; margin: 0; }
.modal-close  { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm); transition: color .12s, background .12s; line-height: 1; }
.modal-close:hover { color: var(--status-offline); background: rgba(248,81,73,.08); }
.modal-body   { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--bg-border); display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; margin-bottom: 12px; border: 1px solid transparent; position: relative; }
.alert--success { background: rgba(63,185,80,.1);  border-color: rgba(63,185,80,.25);  color: var(--status-online); }
.alert--error   { background: rgba(248,81,73,.1);  border-color: rgba(248,81,73,.25);  color: var(--status-offline); }
.alert--warning { background: rgba(210,153,34,.1); border-color: rgba(210,153,34,.25); color: var(--status-running); }
.alert--info    { background: rgba(31,111,235,.1); border-color: rgba(31,111,235,.25); color: var(--accent-hover); }
.alert-close { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: inherit; opacity: .6; cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 6px; }
.alert-close:hover { opacity: 1; }

/* ── Scan Log Stream ────────────────────────────────────────── */
.log-stream { background: var(--bg-base); border: 1px solid var(--bg-border); border-radius: var(--radius-sm); padding: 12px; font-family: var(--font-mono); font-size: 12px; line-height: 1.7; max-height: 420px; overflow-y: auto; color: var(--text-secondary); }
.log-line { display: block; }
.log-line .log-ts { color: var(--text-muted); user-select: none; margin-right: 8px; }
.log-line.log--phase   { color: var(--accent-hover); font-weight: 700; }
.log-line.log--finding { color: var(--sev-high); }
.log-line.log--error   { color: var(--status-offline); }
.log-line.log--done    { color: var(--status-online); font-weight: 700; }

/* ── Phase Stepper ──────────────────────────────────────────── */
.phase-stepper { display: flex; align-items: center; gap: 0; flex-wrap: wrap; margin-bottom: 20px; border: 1px solid var(--bg-border); border-radius: var(--radius-md); background: var(--bg-surface); overflow: hidden; }
.phase-step { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--text-muted); flex: 1; min-width: 100px; border-right: 1px solid var(--bg-border); transition: background .14s, color .14s; }
.phase-step:last-child { border-right: none; }
.phase-step--complete { color: var(--status-online); background: rgba(63,185,80,.06); }
.phase-step--active   { color: var(--accent-hover); background: var(--accent-subtle); }
.phase-step--failed   { color: var(--status-offline); background: rgba(248,81,73,.06); }
.phase-step-icon { font-size: 14px; flex-shrink: 0; }
.phase-step--active .phase-step-icon { animation: spin .9s linear infinite; display: inline-block; }

/* ── Calendar ───────────────────────────────────────────────── */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--bg-border); border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--bg-border); }
.calendar-day-header { background: var(--bg-elevated); padding: 8px 4px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.calendar-day { background: var(--bg-surface); min-height: 80px; padding: 6px; vertical-align: top; }
.calendar-day--today { background: var(--accent-subtle); }
.calendar-day--other-month .cal-day-num { color: var(--text-muted); }
.cal-day-num { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.calendar-day--today .cal-day-num { color: var(--accent-hover); }
.cal-event { display: block; font-size: 10px; font-weight: 600; padding: 2px 5px; border-radius: 3px; margin-bottom: 2px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .12s; }
.cal-event:hover { opacity: .8; text-decoration: none; }
.cal-event--complete { background: rgba(63,185,80,.2);  color: var(--status-online); }
.cal-event--running  { background: rgba(210,153,34,.2); color: var(--status-running); animation: pulse-dot 1.4s ease-in-out infinite; }
.cal-event--failed   { background: rgba(248,81,73,.2);  color: var(--status-offline); }
.cal-event--pending  { background: rgba(31,111,235,.15); color: var(--accent-hover); }
/* schedule calendar helpers */
.calendar-day.today  { background: var(--accent-subtle); }
.calendar-day.today .day-num { color: var(--accent-hover); font-weight: 700; }
.calendar-day.has-event { outline: 1px solid var(--accent); }
.day-num { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; display: block; }
.cal-event-chip { font-size: 10px; font-weight: 600; padding: 1px 4px; border-radius: 3px; margin-top: 2px; background: rgba(31,111,235,.2); color: var(--accent-hover); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-more { background: var(--bg-elevated); color: var(--text-muted); }

/* ── Layout Utilities ───────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap    { flex-wrap: wrap; }
.flex-gap-8   { gap: 8px; }
.flex-gap-12  { gap: 12px; }
.flex-gap-16  { gap: 16px; }
.flex-1       { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.text-muted     { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-success   { color: var(--status-online); }
.text-danger    { color: var(--status-offline); }
.text-warning   { color: var(--status-running); }
.text-accent    { color: var(--accent-hover); }
.text-right     { text-align: right; }
.text-center    { text-align: center; }
.text-sm        { font-size: 12px; }
.text-xs        { font-size: 11px; }
.font-mono      { font-family: var(--font-mono); }
.font-bold      { font-weight: 700; }
.nowrap         { white-space: nowrap; }
.truncate       { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sev-critical { color: var(--sev-critical); }
.sev-high     { color: var(--sev-high); }
.sev-medium   { color: var(--sev-medium); }
.sev-low      { color: var(--sev-low); }
.sev-info     { color: var(--sev-info); }

/* ── Misc Components ────────────────────────────────────────── */
.section-divider { height: 1px; background: var(--bg-border); margin: 20px 0; }
.inline-form { display: none; background: var(--bg-elevated); border: 1px solid var(--bg-border); border-radius: var(--radius-md); padding: 16px; margin-top: 12px; }
.inline-form.open { display: block; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 48px 24px; color: var(--text-muted); text-align: center; }
.empty-state i { font-size: 32px; opacity: .3; }
.empty-state p { font-size: 14px; margin: 0; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--bg-border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0; }
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
[data-tip] { position: relative; cursor: default; }
[data-tip]::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--bg-elevated); color: var(--text-primary); font-size: 11px; padding: 5px 9px; border-radius: var(--radius-sm); white-space: nowrap; box-shadow: var(--shadow-md); pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 100; border: 1px solid var(--bg-border); }
[data-tip]:hover::after { opacity: 1; }

/* ── Login page ─────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-base); padding: 24px; }
.login-card { background: var(--bg-surface); border: 1px solid var(--bg-border); border-radius: var(--radius-lg); padding: 32px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 36px; color: var(--accent); display: block; margin-bottom: 10px; }
.login-logo .logo-text { font-size: 20px; font-weight: 800; color: var(--text-primary); letter-spacing: -.5px; }
.login-logo small { font-size: 12px; color: var(--text-muted); }

/* ── Scan Panel Cards (target_profile) ──────────────────────── */
.scan-panel { padding: 0; overflow: hidden; }
.scan-panel-hd {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px 14px; border-bottom: 1px solid var(--bg-border);
}
.scan-panel-icon {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.scan-panel-icon--repo { background: rgba(255,215,0,.1);    color: var(--sev-medium); }
.scan-panel-icon--prod { background: rgba(31,111,235,.12);  color: var(--accent-hover); }
.scan-panel-icon--auth { background: rgba(63,185,80,.1);    color: var(--status-online); }
.scan-panel-icon--lint { background: rgba(167,139,250,.12); color: #a78bfa; }
.scan-panel-meta  { flex: 1; min-width: 0; }
.scan-panel-title { font-size: 14px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.scan-panel-desc  { font-size: 11px; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
.scan-panel-bd    { padding: 16px 20px 18px; }
.scan-panel--repo { border-top: 2px solid var(--sev-medium); }
.scan-panel--prod { border-top: 2px solid var(--accent); }
.scan-panel--auth { border-top: 2px solid var(--status-online); }
.scan-panel--lint { border-top: 2px solid #a78bfa; }
/* Last-scan strip inside scan panel */
.scan-strip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding: 10px 12px;
  background: var(--bg-elevated); border-radius: var(--radius-sm); font-size: 12px;
}
.scan-strip .btn--ghost { margin-left: auto; }
.scan-strip--empty { color: var(--text-muted); font-size: 12px; }
/* Info rows for Scan Target / Credentials cards */
.info-list { }
.info-row  { display: flex; align-items: baseline; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--bg-border); }
.info-row:last-child { border-bottom: none; }
.info-lbl  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); width: 76px; flex-shrink: 0; }
.info-val  { font-size: 13px; color: var(--text-primary); flex: 1; word-break: break-all; min-width: 0; }

/* ── AI Report ───────────────────────────────────────────────── */
.ai-report {
  padding: 0;
}
.ai-report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--bg-border);
}
.ai-report-header-meta h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}
.ai-report-header-meta dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 16px;
  font-size: 12px;
}
.ai-report-header-meta dt {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.ai-report-header-meta dd {
  color: var(--text-secondary);
  margin: 0;
}
.ai-report-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.ai-report-body {
  padding: 24px 32px 28px;
  line-height: 1.75;
  font-size: 14px;
  color: var(--text-secondary);
}
/* Markdown output inside the report body */
.ai-report-body h1 { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 0 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); }
.ai-report-body h2 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--bg-border); }
.ai-report-body h3 { font-size: 13px; font-weight: 700; color: var(--text-primary); margin: 20px 0 8px; text-transform: uppercase; letter-spacing: .5px; }
.ai-report-body p  { margin: 0 0 12px; }
.ai-report-body hr { border: none; border-top: 1px solid var(--bg-border); margin: 24px 0; }
.ai-report-body ul, .ai-report-body ol { padding-left: 20px; margin: 0 0 12px; }
.ai-report-body li { margin-bottom: 5px; }
.ai-report-body strong { color: var(--text-primary); font-weight: 600; }
.ai-report-body code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-elevated); border: 1px solid var(--bg-border); border-radius: var(--radius-sm); padding: 1px 5px; color: var(--accent-hover); }
.ai-report-body blockquote { border-left: 3px solid var(--accent); margin: 0 0 12px; padding: 4px 0 4px 14px; color: var(--text-muted); }

/* ── Print ──────────────────────────────────────────────────── */
@media print {
  .sidebar, .page-actions, .filter-bar, .btn, .nav-footer, .ai-report-actions { display: none !important; }
  .layout { display: block; }
  body { background: #fff; color: #111; }
  .card { border: 1px solid #ccc; page-break-inside: avoid; }
  .ai-report-body { color: #111; }
  .ai-report-body h1, .ai-report-body h2, .ai-report-body h3,
  .ai-report-body strong { color: #000; }
  .ai-report-body code { background: #f4f4f4; color: #333; border-color: #ccc; }
  .ai-report-body hr, .ai-report-body h2 { border-color: #ccc; }
  .ai-report-header { border-color: #ccc; }
  .ai-report-header-meta dt, .ai-report-header-meta dd { color: #333; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row.cols-2, .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr; }
  .stat-grid { gap: 8px; }
  .kpi { min-width: 80px; padding: 10px 12px; }
  .kpi-num { font-size: 20px; }
  .page-body { padding: 16px; }
}
