/* Warden — design tokens */
:root {
  --bg: #0b0f14;
  --bg-raised: #121821;
  --bg-card: #161d28;
  --bg-inset: #0e131b;
  --border: #253041;
  --border-soft: #1c2531;
  --text: #e7ecf3;
  --text-dim: #9aa7b8;
  --text-faint: #667186;
  --accent: #e8a33d;
  --accent-dim: #a97729;
  --accent-glow: rgba(232, 163, 61, 0.15);
  --critical: #f0475a;
  --high: #f0783f;
  --medium: #e8c23d;
  --low: #4ea1e8;
  --info: #7d8aa0;
  --good: #3ecf8e;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, var(--bg-raised), var(--bg));
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-mark {
  color: var(--accent);
  font-size: 20px;
}

.brand-name {
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 15px;
  color: var(--text);
}

.brand-tag {
  color: var(--text-faint);
  font-size: 12.5px;
  border-left: 1px solid var(--border);
  padding-left: 10px;
  display: none;
}

@media (min-width: 640px) {
  .brand-tag { display: inline; }
}

.app-nav {
  display: flex;
  gap: 6px;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.nav-btn:hover { color: var(--text); background: var(--bg-card); }
.nav-btn.active { color: var(--accent); border-color: var(--border); background: var(--bg-card); }

/* Main */
.view-root {
  flex: 1;
  padding: 32px 28px 60px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

.app-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-faint);
  font-size: 12px;
}

.app-footer a { color: var(--text-dim); }
.footer-brand a { color: var(--accent-dim); text-decoration: none; }
.footer-brand a:hover { text-decoration: underline; }

/* Generic building blocks */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
}

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grid { display: grid; gap: 16px; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; color: var(--text-dim); }

.muted { color: var(--text-faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }

label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
}

input[type="text"], input[type="password"], select {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 13.5px;
}

input:focus, select:focus, button:focus-visible {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field { margin-bottom: 14px; }
.field-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }

button, .btn {
  font-family: inherit;
  cursor: pointer;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: var(--bg-inset);
  color: var(--text);
}

button:hover { background: var(--bg-raised); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #201203;
}
.btn-primary:hover { background: #f0af53; }

.btn-ghost { background: transparent; border-color: var(--border); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.checkbox-row input { width: auto; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.badge-critical { background: rgba(240, 71, 90, 0.14); color: var(--critical); border-color: rgba(240,71,90,0.3); }
.badge-high { background: rgba(240, 120, 63, 0.14); color: var(--high); border-color: rgba(240,120,63,0.3); }
.badge-medium { background: rgba(232, 194, 61, 0.14); color: var(--medium); border-color: rgba(232,194,61,0.3); }
.badge-low { background: rgba(78, 161, 232, 0.14); color: var(--low); border-color: rgba(78,161,232,0.3); }
.badge-info { background: rgba(125, 138, 160, 0.14); color: var(--info); border-color: rgba(125,138,160,0.3); }

/* Grade pill */
.grade {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  flex-shrink: 0;
}

.grade-A { background: rgba(62,207,142,0.15); color: var(--good); }
.grade-B { background: rgba(78,161,232,0.15); color: var(--low); }
.grade-C { background: rgba(232,194,61,0.15); color: var(--medium); }
.grade-D { background: rgba(240,120,63,0.15); color: var(--high); }
.grade-F { background: rgba(240,71,90,0.15); color: var(--critical); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
th { color: var(--text-faint); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--bg-raised); }

/* Progress / bars */
.bar-track { height: 6px; border-radius: 100px; background: var(--bg-inset); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 100px; }

/* Stat tiles */
.stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-value { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; }
.stat-label { color: var(--text-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); margin-bottom: 18px; }
.tab-btn {
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text-faint); padding: 9px 4px; margin-right: 18px; font-size: 13.5px; font-weight: 600; border-radius: 0;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-btn:hover { color: var(--text); background: transparent; }

/* Finding card */
.finding {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--bg-inset);
}
.finding + .finding { margin-top: 10px; }
.finding-evidence {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  padding: 10px 12px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}
.finding-remediation {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
  font-size: 13px;
}
.finding-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tag {
  font-size: 10.5px;
  font-family: var(--mono);
  color: var(--text-faint);
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  padding: 2px 7px;
  border-radius: 5px;
}

/* Loading / progress log */
.scan-log {
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  max-height: 220px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}
.scan-log div { padding: 2px 0; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}

pre.code-block {
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
  max-height: 480px;
}

.link-btn {
  background: none; border: none; padding: 0; color: var(--accent);
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; background: none; }

.error-box {
  background: rgba(240,71,90,0.08);
  border: 1px solid rgba(240,71,90,0.3);
  color: #ffb3bc;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
