/* Kavach — mobile-first "fortress" theme.
   Palette: Saturn indigo/charcoal (number 8 = structure, protection)
   with a gold accent (authority). The shield motif echoes the Cancer shell. */

:root {
  --bg: #0b1020;
  --bg-soft: #121a30;
  --card: #16203a;
  --line: #243256;
  --ink: #e8edf7;
  --muted: #9aa8c7;
  --gold: #f4c04e;
  --accent: #7aa2ff;
  --pass: #4ade80;
  --warn: #fbbf24;
  --fail: #f87171;
  --radius: 14px;
  --maxw: 760px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #182445 0%, var(--bg) 55%);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.3px;
}
.brand .shield { color: var(--gold); }
.tag { color: var(--muted); font-size: 0.78rem; }
.topnav { display: flex; gap: 14px; flex-wrap: wrap; }
.topnav a { color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.topnav a:hover { color: var(--ink); }
.pricing th { text-align: center; }
.pricing td:not(:first-child) { text-align: center; }
.group { color: var(--muted); font-size: 0.8rem; margin-top: 8px; }
.group a { color: var(--muted); }

/* ---------- layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 8px 16px 48px; }

.hero { text-align: center; padding: 18px 0 8px; }
h1 { font-size: clamp(1.7rem, 6vw, 2.6rem); line-height: 1.15; margin: 10px 0; }
.accent { color: var(--gold); }
.sub { color: var(--muted); max-width: 52ch; margin: 0 auto 20px; }
.sub strong { color: var(--ink); }

/* ---------- scan box ---------- */
.scanbox {
  display: flex;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  max-width: 520px;
  margin: 0 auto;
}
.scanbox input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 1rem;
  padding: 12px;
  outline: none;
}
.scanbox input::placeholder { color: #6b7aa0; }
.scanbox button {
  background: var(--gold);
  color: #241a00;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  padding: 12px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
}
.scanbox button:disabled { opacity: 0.6; cursor: wait; }
.fineprint { color: var(--muted); font-size: 0.78rem; margin-top: 10px; }

.scanbox select {
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; font-size: 0.85rem;
}
.attest {
  display: block; max-width: 520px; margin: 10px auto 0;
  color: var(--muted); font-size: 0.82rem; text-align: left;
}
.attest input { margin-right: 6px; }
.attest a { color: var(--accent); }
.chip.locked { color: var(--muted); border-color: var(--line); }
.chip.locked a { color: var(--accent); }

/* trust debt */
.debt { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.debt h3 { font-size: 1.05rem; margin: 0 0 8px; }
.debt-total { font-size: 1.3rem; color: var(--gold); }

/* trust passport */
.pp-status { display: inline-block; font-weight: 800; padding: 4px 12px; border-radius: 999px; }
.pp-fresh { background: #3fb950; color: #05240f; }
.pp-stale { background: #9f9f9f; color: #1a1a1a; }
.pp-regression { background: #e05d44; color: #2a0b12; }
.pp-none { background: var(--card); color: var(--muted); border: 1px solid var(--line); }
.pp-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 14px 0; }
.pp-facts dt { color: var(--muted); font-size: 0.85rem; }
.pp-facts dd { margin: 0; font-size: 0.92rem; }
.pp-cats { list-style: none; padding: 0; }
.pp-cats li { display: grid; grid-template-columns: 170px 1fr 70px; gap: 10px; align-items: center; margin: 8px 0; }
.pp-cats .bar { display: block; margin: 0; }
.pp-cats .fill { display: block; height: 100%; background: var(--pass); border-radius: 999px; }
.pp-controls { list-style: none; padding: 0; columns: 2; font-size: 0.88rem; }
.pp-controls .c-fail { color: #ffb4b4; } .pp-controls .c-warn { color: #ffd98a; } .pp-controls .c-pass { color: #9fe6b8; }
.fill.w0{width:0}.fill.w5{width:5%}.fill.w10{width:10%}.fill.w15{width:15%}.fill.w20{width:20%}
.fill.w25{width:25%}.fill.w30{width:30%}.fill.w35{width:35%}.fill.w40{width:40%}.fill.w45{width:45%}
.fill.w50{width:50%}.fill.w55{width:55%}.fill.w60{width:60%}.fill.w65{width:65%}.fill.w70{width:70%}
.fill.w75{width:75%}.fill.w80{width:80%}.fill.w85{width:85%}.fill.w90{width:90%}.fill.w95{width:95%}
.fill.w100{width:100%}

.madein { color: var(--muted); font-size: 0.82rem; margin-top: 10px; }

/* content pages */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 10px 0; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 600; }
.cta { margin-top: 24px; }
.btn { display: inline-block; background: var(--gold); color: #241a00 !important; border-radius: 10px; padding: 10px 14px; font-weight: 700; text-decoration: none; }
#tool-root .finding { margin-top: 10px; }

/* server-rendered documents (legal, passports, checks, fixes) */
.doc { max-width: var(--maxw); margin: 0 auto; padding: 8px 16px 48px; }
.doc h1 { font-size: 1.7rem; }
.doc h2 { font-size: 1.15rem; margin-top: 22px; }
.doc p, .doc li { color: var(--ink); font-size: 0.95rem; }
.doc a { color: var(--accent); }
.topbar .tag { color: var(--muted); text-decoration: none; }

/* On phones, stack the button under the field for comfortable tapping. */
@media (max-width: 440px) {
  .scanbox { flex-direction: column; }
  .scanbox button { width: 100%; }
}

/* ---------- result ---------- */
.result { margin-top: 26px; }
.gradecard {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.gradebubble {
  display: grid;
  place-items: center;
  width: 78px; height: 78px;
  border-radius: 50%;
  font-size: 1.9rem;
  font-weight: 800;
  flex-shrink: 0;
  border: 3px solid currentColor;
}
.g-A, .g-Aplus { color: var(--pass); }
.g-B { color: #a3e635; }
.g-C { color: var(--warn); }
.g-D, .g-F { color: var(--fail); }
.gradecard .meta h3 { margin: 0 0 2px; font-size: 1.05rem; word-break: break-all; }
.gradecard .meta p { margin: 0; color: var(--muted); font-size: 0.86rem; }

.findings { list-style: none; padding: 0; margin: 16px 0 0; }
.finding {
  display: flex;
  gap: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}
.finding.pass { border-left-color: var(--pass); }
.finding.warn { border-left-color: var(--warn); }
.finding.fail { border-left-color: var(--fail); }
.dot { font-size: 1.1rem; line-height: 1.4; }
.finding h4 { margin: 0 0 4px; font-size: 1rem; }
.finding .sev {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 8px;
  vertical-align: middle;
}
.finding p { margin: 4px 0; font-size: 0.88rem; color: var(--muted); }
.finding .fix { color: var(--ink); }
.finding code {
  background: #0d1428;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 0.82rem;
  word-break: break-word;
}
.err {
  background: #2a1620;
  border: 1px solid #5b2740;
  color: #ffd9e2;
  padding: 14px;
  border-radius: var(--radius);
}

/* ---------- info sections ---------- */
.how, .trust { margin-top: 40px; }
h2 { font-size: 1.3rem; }
.grid { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
.grid li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.grid li b { display: block; }
.grid li span { color: var(--muted); font-size: 0.86rem; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } }

.trust p { color: var(--muted); }

footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 16px 40px;
  color: #6b7aa0;
  font-size: 0.8rem;
  text-align: center;
}

/* ---------- interactive additions ---------- */
.chip {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 6px;
}
.fbody { flex: 1; min-width: 0; }
.seen code { word-break: break-word; }

.scanning {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--muted);
}
.scanning::after { content: ""; animation: dots 1.2s steps(4,end) infinite; }
@keyframes dots { 0%{content:""} 25%{content:"."} 50%{content:".."} 75%{content:"..."} }

/* finding entrance animation */
.finding { opacity: 0; transform: translateY(6px); }
.finding.in { animation: rise 0.35s ease forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* attack path reveal */
.reveal {
  background: transparent;
  color: var(--fail);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.reveal:hover { border-color: var(--fail); }
.attack {
  list-style: none;
  margin: 10px 0 2px;
  padding: 10px 12px;
  background: #180f18;
  border: 1px solid #3a2130;
  border-radius: 10px;
  counter-reset: step;
}
.attack li {
  position: relative;
  padding: 6px 0 6px 34px;
  font-size: 0.86rem;
  color: #f0d9e2;
  border-left: 2px dashed #5b2740;
  margin-left: 11px;
}
.attack li:last-child { border-left-color: transparent; }
.attack .num {
  position: absolute;
  left: -11px; top: 4px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--fail);
  color: #2a0b12;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
}

/* fix pack */
.fixpack, .share { margin-top: 26px; }
.fixpack h3, .share h3 { font-size: 1.1rem; margin-bottom: 10px; }
.muted { color: var(--muted); font-weight: 400; font-size: 0.86rem; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tab {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.84rem;
  cursor: pointer;
}
.tab.active { background: var(--gold); color: #241a00; border-color: var(--gold); font-weight: 700; }
.snip {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.snip-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #0f1730;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 600;
}
.copy {
  background: var(--accent);
  color: #05112e;
  border: none;
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.snip pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
}
.snip pre code { color: #cfe0ff; background: none; border: none; padding: 0; white-space: pre; }

/* share badge */
.badgeimg { display: block; margin: 4px 0 12px; height: 20px; }

/* verdict banner (worried-owner executive summary) */
.verdict {
  background: linear-gradient(180deg, #16203a 0%, #121a30 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 24px;
}
.verdict-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.risk-pill {
  font-weight: 800;
  font-size: 0.82rem;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}
.risk-Critical { background: #e05d44; color: #2a0b12; }
.risk-High { background: #fb923c; color: #2a1405; }
.risk-Moderate { background: #d4a72c; color: #241a00; }
.risk-Low { background: #3fb950; color: #05240f; }
.pdf-btn {
  background: var(--gold);
  color: #241a00;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 9px 14px;
  cursor: pointer;
}
.pdf-btn:disabled { opacity: 0.7; cursor: wait; }
.verdict-headline { font-size: 1.25rem; margin: 14px 0 6px; }
.verdict p { margin: 6px 0; color: var(--ink); font-size: 0.95rem; }
.verdict .muted { color: var(--muted); }
.verdict .reassure { color: var(--accent); font-weight: 600; }

.verdict .limits {
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 12px;
}

/* scan history / regression */
.history {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}
.hist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.hist-head h3 { font-size: 1.05rem; margin: 0; }
.spark { display: block; }
.hist-body { margin-top: 10px; }
.delta { font-weight: 800; font-size: 0.95rem; }
.delta.up { color: var(--pass); }
.delta.down { color: var(--fail); }
.delta.flat { color: var(--muted); }
.reg { margin: 10px 0 0; border-radius: 8px; padding: 10px 12px; font-size: 0.88rem; }
.reg ul { margin: 6px 0 0; padding-left: 18px; }
.reg-bad { background: #2a1620; border: 1px solid #5b2740; color: #ffd9e2; }
.reg-good { background: #13241a; border: 1px solid #27503a; color: #c9f5da; }

/* monitor this site */
.monitor { margin-top: 44px; }
.monitor h2 { margin-bottom: 4px; }
.step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}
.step h3 { font-size: 1rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.step h4 { font-size: 0.9rem; margin: 14px 0 6px; color: var(--muted); }
.stepnum {
  width: 22px; height: 22px; display: grid; place-items: center;
  background: var(--gold); color: #241a00; border-radius: 50%;
  font-size: 0.78rem; font-weight: 800;
}
.inline-form { display: flex; gap: 8px; margin-bottom: 8px; }
.inline-form.wrap { flex-wrap: wrap; }
.inline-form input, .inline-form select {
  flex: 1; min-width: 140px;
  background: var(--bg-soft); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; font-size: 0.9rem;
}
.inline-form button, #verify-btn {
  background: var(--gold); color: #241a00; border: none; border-radius: 8px;
  font-weight: 700; padding: 9px 12px; cursor: pointer; white-space: nowrap; font-size: 0.86rem;
}
.inline-form button.secondary { background: var(--card); color: var(--muted); border: 1px solid var(--line); }
button.link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.85rem; padding: 0; }
#verify-btn { margin-top: 4px; }
#verify-status { margin-left: 8px; font-size: 0.85rem; }
.plainlist { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.88rem; }
.plainlist li { padding: 6px 0; border-top: 1px solid var(--line); }
.err-inline { color: var(--fail); font-size: 0.86rem; }
@media (max-width: 440px) { .inline-form { flex-direction: column; } }

/* plan / billing */
.planbox { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.planbox p { margin: 4px 0; font-size: 0.9rem; }
.planbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.planbtns button {
  border: none; border-radius: 8px; padding: 8px 12px; font-size: 0.84rem;
  font-weight: 700; cursor: pointer;
}
.planbtns .upgrade { background: var(--gold); color: #241a00; }
.planbtns .secondary { background: var(--card); color: var(--muted); border: 1px solid var(--line); }

/* priority action plan */
.plan { margin-top: 22px; }
.plan h3, .compliance h3 { font-size: 1.1rem; margin-bottom: 10px; }
.planlist { list-style: none; margin: 0; padding: 0; counter-reset: p; }
.planlist li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.planlist .sev-critical { border-left-color: var(--fail); }
.planlist .sev-high { border-left-color: #fb923c; }
.planlist .sev-medium { border-left-color: var(--warn); }
.planlist .sev-low { border-left-color: var(--accent); }
.planlist .rank {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: var(--gold); color: #241a00;
  border-radius: 50%; font-weight: 800; font-size: 0.85rem;
}
.planlist .effort {
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 6px;
  white-space: nowrap;
}
.planlist p { margin: 4px 0 0; font-size: 0.85rem; }

/* compliance readiness */
.compliance { margin-top: 26px; }
.fwgrid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .fwgrid { grid-template-columns: 1fr 1fr 1fr; } }
.fw {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.fw-head { display: flex; justify-content: space-between; align-items: baseline; }
.fw-head b { font-size: 0.92rem; }
.fw-score { font-weight: 800; font-size: 1.05rem; }
.bar {
  height: 8px;
  background: #0d1428;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 10px;
}
.bar .fill {
  height: 100%;
  width: 0;               /* set via JS (CSSOM) so strict CSP stays happy */
  border-radius: 999px;
  transition: width 0.7s ease;
  background: var(--pass);
}
.bar .fill.g-A { background: var(--pass); }
.bar .fill.g-C { background: var(--warn); }
.bar .fill.g-F { background: var(--fail); }
.fw-score.g-A { color: var(--pass); }
.fw-score.g-C { color: var(--warn); }
.fw-score.g-F { color: var(--fail); }
.controls { list-style: none; margin: 0; padding: 0; }
.controls li { font-size: 0.78rem; color: var(--muted); padding: 2px 0; }
.controls .c-fail { color: #ffb4b4; }
.controls .c-warn { color: #ffd98a; }
.controls .c-pass { color: #9fe6b8; }

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,0.25);
  border-top-color: #241a00;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }
