/* ═══════════════════════════════════════════════════════════
   PC AUDIT — Premium SaaS Design System
   Font: Inter via Google Fonts
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --sans: 'Inter', system-ui, -apple-system, sans-serif;

  /* Sidebar */
  --sb-w: 240px;
  --sb-bg: #0f1623;
  --sb-border: rgba(255,255,255,.07);
  --sb-text: #94a3b8;
  --sb-text-active: #f1f5f9;
  --sb-active-bg: rgba(59,130,246,.15);
  --sb-active-border: #3b82f6;

  /* Surface */
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-2: #cbd5e1;

  /* Text */
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  /* Brand */
  --blue: #3b82f6;
  --blue-dk: #2563eb;
  --blue-lt: #eff6ff;
  --blue-mid: #bfdbfe;

  /* Status */
  --green: #10b981;
  --green-lt: #ecfdf5;
  --amber: #f59e0b;
  --amber-lt: #fffbeb;
  --red: #ef4444;
  --red-lt: #fef2f2;
  --orange: #f97316;
  --orange-lt: #fff7ed;
  --purple: #8b5cf6;
  --purple-lt: #f5f3ff;

  /* Radius & shadow */
  --r: 12px;
  --r-sm: 8px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.08);
}

.fleet-table { overflow-x: auto; }
.fleet-table td { max-width: 340px; overflow-wrap: anywhere; }
.fleet-table small { display: block; color: var(--text-3); margin-top: 5px; }
.fleet-link { border: 0; background: none; color: var(--blue-dk); text-align: left; cursor: pointer; font: inherit; font-weight: 600; }
.fleet-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin: 20px 0; }
.fleet-actions, .fleet-pagination { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.fleet-change { padding: 12px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.fleet-change p { margin-top: 6px; }
.change-values { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--text-2); }
#computerView > .report-card { margin: 16px 0; }
#computerView summary { cursor: pointer; font-weight: 600; }
#computerView h3 { margin: 20px 0 10px; }
button:disabled { opacity: .5; cursor: not-allowed; }
@media(max-width: 1000px) { .fleet-grid { grid-template-columns: 1fr; } }
@media(max-width: 720px) { .change-values { grid-template-columns: 1fr; } .fleet-actions { width: 100%; } }

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--sans); font-size: 13px; }
input, textarea { font-family: var(--sans); }
h1, h2, h3 { line-height: 1.25; }

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sb-w);
  min-height: 100vh;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--sb-border);
}
.sidebar-logo {
  width: 38px; height: 38px;
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(96,165,250,.2);
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -.01em;
}
.sidebar-brand-tag {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--sb-text);
  letter-spacing: .04em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--sb-text);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--sb-text);
  border-left: 2px solid transparent;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--sb-text-active); }
.nav-item.active {
  background: var(--sb-active-bg);
  color: #60a5fa;
  border-left-color: var(--sb-active-border);
}
.nav-icon {
  width: 17px; height: 17px;
  flex-shrink: 0;
  opacity: .75;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--amber);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.sidebar-bottom {
  padding: 16px 12px;
  border-top: 1px solid var(--sb-border);
  display: grid;
  gap: 14px;
}
.storage-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--sb-text);
  margin-bottom: 5px;
}
.storage-val { font-weight: 600; }
.storage-bar {
  height: 3px;
  background: rgba(255,255,255,.1);
  border-radius: 99px;
  overflow: hidden;
}
.storage-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 99px;
  transition: width .4s;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--sb-text-active);
}
.sidebar-user-role {
  display: block;
  font-size: 11px;
  color: var(--sb-text);
}

/* ═══════════════════════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════════════════════ */
.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
}
.topbar-breadcrumb {
  font-size: 13px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-breadcrumb .current { font-weight: 600; color: var(--text-1); }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.status-dot-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
}
.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(16,185,129,.2);
}
.status-text { font-size: 12.5px; color: var(--green); font-weight: 600; }
.ai-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--blue);
  background: var(--blue-lt);
  border: 1px solid var(--blue-mid);
  border-radius: 999px;
  padding: 4px 10px;
}
.icon-btn {
  width: 34px; height: 34px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--border); color: var(--text-1); }

/* ── Content sections ───────────────────────────────────── */
.content-section { display: none; padding: 28px; }
.content-section.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -.02em;
}
.page-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Stats row ──────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stat-icon.blue  { background: var(--blue-lt); color: var(--blue); }
.stat-icon.green { background: var(--green-lt); color: var(--green); }
.stat-icon.amber { background: var(--amber-lt); color: var(--amber); }
.stat-icon.red   { background: var(--red-lt); color: var(--red); }
.stat-val {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-1);
  letter-spacing: -.03em;
}
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 3px; font-weight: 500; }

/* ── Section headers ────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}

/* ── Pending grid ───────────────────────────────────────── */
.pending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
  min-height: 20px;
}
.pending-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--amber);
  transition: box-shadow .15s;
}
.pending-card:hover { box-shadow: var(--shadow); }
.pending-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 10px;
}
.pending-meta {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}
.pending-meta span {
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 5px;
}
.meta-icon { opacity: .5; }
.pending-actions { display: flex; gap: 8px; }

.empty-state {
  font-size: 13px;
  color: var(--text-3);
  padding: 16px 0;
}

/* ── Search ─────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  width: 260px;
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 8px 11px 8px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-1);
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.search-input::placeholder { color: var(--text-3); }

/* ── Table ──────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface-2); }
th {
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 13px 16px;
  font-size: 13.5px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: 0; }
.table-row { cursor: pointer; transition: background .1s; }
.table-row:hover { background: #f8faff; }
.table-row td:first-child { color: var(--text-3); font-size: 12.5px; }
.table-row td b { color: var(--text-1); font-weight: 600; }
.table-chevron { color: var(--text-3); display: flex; align-items: center; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--blue-dk); box-shadow: 0 4px 12px rgba(59,130,246,.3); }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--text-1);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red-lt);
  color: var(--red);
  border: 1px solid #fecaca;
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s;
  white-space: nowrap;
}
.btn-danger:hover { background: #fee2e2; }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--border); }
.btn-full { width: 100%; justify-content: center; padding: 11px 16px; }

/* ═══════════════════════════════════════════════════════════
   BADGES — State & Risk
═══════════════════════════════════════════════════════════ */
.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.state-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.state-pending   { background: #fef9c3; color: #854d0e; }
.state-accepted, .state-scanning, .state-analyzing { background: var(--blue-lt); color: var(--blue-dk); }
.state-completed { background: var(--green-lt); color: #065f46; }
.state-declined, .state-analysis_error, .state-analysis_invalid, .state-analysis_timeout { background: var(--red-lt); color: #991b1b; }

.risk-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}
.risk-low, .risk-info   { background: var(--blue-lt); color: var(--blue-dk); }
.risk-medium { background: var(--amber-lt); color: #92400e; }
.risk-high   { background: var(--orange-lt); color: #9a3412; }
.risk-critical { background: var(--red-lt); color: #991b1b; }
.risk-unknown  { background: var(--surface-2); color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════
   SETTINGS
═══════════════════════════════════════════════════════════ */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.settings-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.settings-card-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.settings-card-icon.blue   { background: var(--blue-lt); color: var(--blue); }
.settings-card-icon.purple { background: var(--purple-lt); color: var(--purple); }
.settings-card-title { font-size: 15px; font-weight: 700; color: var(--text-1); }
.settings-desc { font-size: 13px; color: var(--text-3); margin-bottom: 16px; line-height: 1.5; }
.settings-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.model-tag {
  font-size: 12px;
  color: var(--text-3);
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  display: inline-block;
}

/* Tokens list */
.tokens-list { margin-top: 8px; }
.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.token-row:last-child { border-bottom: none; }
.token-name { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.token-meta { font-size: 12px; color: var(--text-3); margin-top: 1px; }

.once-box {
  padding: 12px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--r-sm);
  margin: 10px 0;
  font-size: 12.5px;
  word-break: break-all;
  line-height: 1.55;
  color: #065f46;
}
.once-label { font-weight: 700; display: block; margin-bottom: 4px; }

/* ═══════════════════════════════════════════════════════════
   FORM FIELDS
═══════════════════════════════════════════════════════════ */
.field-group { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field-wrap { position: relative; }
.field-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.field-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text-1);
  transition: border-color .15s, box-shadow .15s;
}
.field-input:not(.field-wrap .field-input) {
  padding-left: 12px;
}
.field-wrap .field-input { padding-left: 36px; }
.field-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.field-input::placeholder { color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════
   REPORT DIALOG
═══════════════════════════════════════════════════════════ */
.report-dialog {
  width: min(1340px, 96vw);
  height: min(920px, 94vh);
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.report-dialog::backdrop { background: rgba(15,22,35,.65); backdrop-filter: blur(4px); }
.report-shell { height: 100%; overflow-y: auto; }

.report-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.report-topbar-left { display: flex; align-items: center; gap: 14px; }
.report-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-2);
}
.report-breadcrumb span:last-child { font-weight: 700; color: var(--text-1); }
.muted-text { color: var(--text-3); }
.report-topbar-actions { display: flex; align-items: center; gap: 8px; }
.close-btn {
  width: 34px; height: 34px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* Report hero */
.report-hero {
  margin: 20px 24px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow-sm);
}
.machine { display: flex; align-items: center; gap: 18px; }
.machine-icon {
  width: 68px; height: 68px;
  border-radius: 14px;
  background: var(--blue-lt);
  border: 1px solid var(--blue-mid);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.machine-icon svg { color: var(--blue); }
.machine h1 { font-size: 24px; font-weight: 800; color: var(--text-1); letter-spacing: -.02em; margin-bottom: 8px; }
.machine-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
}
.machine-meta span { display: flex; align-items: center; gap: 5px; }
.machine-meta svg { opacity: .5; }

.risk-panel {
  min-width: 200px;
  border-left: 1px solid var(--border);
  padding-left: 28px;
  flex-shrink: 0;
}
.risk-panel small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--text-3);
  margin-bottom: 6px;
}
.risk-value {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.03em;
  margin-bottom: 6px;
}
.risk-text-low      { color: var(--blue-dk); }
.risk-text-medium   { color: #d97706; }
.risk-text-high     { color: var(--orange); }
.risk-text-critical { color: var(--red); }
.risk-text-unknown  { color: var(--text-3); }
.risk-gauge { margin-top: 10px; }
.confidence-line { font-size: 12.5px; color: var(--text-2); }
.confidence-line b { color: var(--text-1); }

/* Metrics bar */
.metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin: 16px 24px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}
.metric-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--blue-lt);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}
.metric-card span  { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; }
.metric-card strong { display: block; font-size: 17px; font-weight: 800; color: var(--text-1); margin: 2px 0; letter-spacing: -.02em; }
.metric-card small  { display: block; font-size: 11px; }
.ok-text   { color: var(--green) !important; font-weight: 600; }
.warn-text { color: var(--amber) !important; font-weight: 600; }

/* Report content grid */
.report-body { padding: 0 24px 24px; }
.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, .85fr);
  gap: 14px;
  margin-top: 14px;
}
.report-main, .report-side { display: grid; gap: 14px; align-content: start; }

.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-1);
}
.card-title-right {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
}
.card-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.card-icon.blue   { background: var(--blue-lt); color: var(--blue); }
.card-icon.green  { background: var(--green-lt); color: var(--green); }
.card-icon.amber  { background: var(--amber-lt); color: var(--amber); }
.card-icon.purple { background: var(--purple-lt); color: var(--purple); }

.summary-text {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-2);
}

/* Findings */
.findings { display: grid; gap: 10px; }
.finding {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  transition: box-shadow .15s;
  cursor: default;
}
.finding:hover { box-shadow: var(--shadow); }
.finding-left { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.finding-category {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.finding h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 4px;
  line-height: 1.4;
}
.finding p { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.recommend {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  font-size: 12.5px;
  align-items: start;
}
.recommend-label {
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
.recommend span { color: var(--text-2); line-height: 1.5; }

/* Fact list */
.facts { display: grid; }
.fact-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.fact-row:last-child { border-bottom: none; }
.fact-label { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.fact-value {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-1);
  text-align: right;
  overflow-wrap: anywhere;
  word-break: break-all;
}

/* Bottom grid */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.styled-list { padding-left: 0; list-style: none; display: grid; gap: 8px; }
.styled-list li {
  display: flex;
  gap: 9px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}
.styled-list li::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  margin-top: 7px;
}
.limitations-list li::before { background: var(--amber); }

.empty-findings { font-size: 13px; color: var(--text-3); }

/* Raw JSON */
.raw-json {
  margin: 20px 24px;
  background: #0f172a;
  color: #94a3b8;
  padding: 20px;
  border-radius: var(--r);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  overflow: auto;
  min-height: 500px;
}
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #0f172a;
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.login-bg-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .18;
}
.s1 {
  width: 500px; height: 500px;
  background: #3b82f6;
  top: -100px; left: -100px;
}
.s2 {
  width: 400px; height: 400px;
  background: #8b5cf6;
  bottom: -80px; right: -60px;
}
.s3 {
  width: 300px; height: 300px;
  background: #06b6d4;
  top: 50%; left: 55%;
  transform: translate(-50%, -50%);
}

.login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 36px;
  box-shadow: 0 32px 80px rgba(0,0,0,.4);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.login-logo {
  width: 44px; height: 44px;
  background: rgba(59,130,246,.15);
  border: 1px solid rgba(59,130,246,.3);
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.login-brand-name {
  font-size: 18px;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -.02em;
}
.login-brand-sub {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}
.login-title {
  font-size: 24px;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -.03em;
  margin-bottom: 6px;
}
.login-desc { font-size: 14px; color: #64748b; margin-bottom: 28px; }
.login-form { display: grid; gap: 16px; }
.login-form .field-label { color: #94a3b8; }
.login-form .field-input {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.1);
  color: #f1f5f9;
  padding-left: 36px;
}
.login-form .field-input::placeholder { color: #475569; }
.login-form .field-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
  background: rgba(255,255,255,.08);
}
.login-form .field-icon { color: #475569; }

.login-footer {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}
.login-secure {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #475569;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .report-grid { grid-template-columns: 1fr; }
  .report-side { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  :root { --sb-w: 200px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .bottom-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .content-section { padding: 18px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .report-dialog { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .report-hero { flex-direction: column; }
  .risk-panel { border-left: none; border-top: 1px solid var(--border); padding: 14px 0 0; width: 100%; }
  .finding { grid-template-columns: 1fr; }
  .report-side { grid-template-columns: 1fr; }
  .bottom-grid { grid-template-columns: 1fr; }
}


/* Step 8 UI consistency fixes */
.status-text { color: var(--green); }
.status-text.offline { color: var(--red); }
.table-empty {
  color: var(--text-3);
  text-align: center;
  padding: 28px !important;
}
#sec-audits .pending-grid {
  margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════════════════
   IN-PAGE AUDIT REPORT
   Report replaces the audit list inside the same dashboard page.
   No <dialog>, no overlay, no modal backdrop.
═══════════════════════════════════════════════════════════ */
.report-page-section {
  padding: 0 !important;
  background: var(--bg);
  min-height: calc(100vh - 60px);
}

.report-page {
  min-height: calc(100vh - 60px);
  width: 100%;
}

#sec-report .report-topbar {
  top: 60px;
  padding: 12px 28px;
  box-shadow: 0 1px 0 var(--border);
}

.report-back-btn {
  flex-shrink: 0;
}

#sec-report .report-breadcrumb {
  min-width: 0;
}

#sec-report .report-breadcrumb #reportTitle {
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sec-report .report-hero {
  margin-top: 20px;
}

#sec-report .raw-json {
  margin-bottom: 28px;
}

/* Old dialog CSS is intentionally left in place for compatibility,
   but the dashboard no longer renders a dialog element. */

@media (max-width: 720px) {
  #sec-report .report-topbar {
    top: 60px;
    padding: 10px 18px;
    gap: 10px;
    align-items: flex-start;
  }

  #sec-report .report-topbar-left {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  #sec-report .report-breadcrumb {
    font-size: 12px;
  }

  #sec-report .report-topbar-actions {
    margin-left: auto;
  }
}

/* ═══════════════════════════════════════════════════════════
   REPORT HEADER STACKING FIX
   Keep the in-page report below the global sticky topbar.
═══════════════════════════════════════════════════════════ */
#sec-report .report-topbar {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
}

#sec-report .report-hero {
  margin-top: 0 !important;
}

#sec-report {
  overflow: visible;
}

/* ═══════════════════════════════════════════════════════════
   REPORT MODE — REMOVE GLOBAL DASHBOARD TOPBAR
   The report has its own navigation/header, so the global
   breadcrumb + Online + AI + bell must not remain above it.
═══════════════════════════════════════════════════════════ */
body.report-open .topbar {
  display: none !important;
}

body.report-open #sec-report {
  min-height: 100vh;
}

body.report-open .report-page {
  min-height: 100vh;
}

body.report-open #sec-report .report-topbar {
  position: relative !important;
  top: 0 !important;
  margin: 0 !important;
}

/* ═══════════════════════════════════════════════════════════
   JSON EXPORT + NOTIFICATION TOGGLE
═══════════════════════════════════════════════════════════ */
.notify-toggle {
  position: relative;
}
.notify-indicator {
  position: absolute;
  width: 7px;
  height: 7px;
  right: 5px;
  top: 5px;
  border-radius: 50%;
  background: var(--text-3);
  border: 1px solid var(--surface);
}
.notify-toggle.notify-on {
  color: var(--blue);
  background: var(--blue-lt);
  border-color: var(--blue-mid);
}
.notify-toggle.notify-on .notify-indicator {
  background: var(--green);
}
.notify-toggle.notify-off .notify-indicator {
  background: var(--text-3);
}

.report-topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  #sec-report .report-topbar {
    flex-direction: column;
    align-items: stretch !important;
  }
  #sec-report .report-topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
  #sec-report .report-topbar-actions .btn-ghost {
    flex: 1 1 auto;
    justify-content: center;
  }
}
