/* ClauseGuard app — shared brand styles (scan + report pages) */
:root {
  --bg: #0e1720;
  --panel: #102027;
  --panel-border: #073b4c;
  --ink: #dce5df;
  --muted: #8fa6a3;
  --accent: #06d6a0;
  --accent-ink: #06231b;
  --accent-soft: rgba(6, 214, 160, 0.12);
  --blue: #118ab2;
  --crit: #ef476f;   --crit-bg: rgba(239, 71, 111, 0.12);
  --warn: #e8a13a;   --warn-bg: rgba(232, 161, 58, 0.12);
  --ok: #06d6a0;     --ok-bg: rgba(6, 214, 160, 0.12);
  --quote-bg: rgba(7, 59, 76, 0.35);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
html[data-theme="light"] {
  --bg: #f4faf7;
  --panel: #ffffff;
  --panel-border: #d3e4dc;
  --ink: #102027;
  --muted: #5a7370;
  --accent: #05a37a;
  --accent-ink: #ffffff;
  --accent-soft: rgba(6, 214, 160, 0.14);
  --crit: #c62b52;   --crit-bg: rgba(239, 71, 111, 0.1);
  --warn: #9a6a08;   --warn-bg: rgba(232, 161, 58, 0.14);
  --ok: #0a7d5c;     --ok-bg: rgba(6, 214, 160, 0.14);
  --quote-bg: #eef6f2;
  --shadow: 0 1px 3px rgba(16, 32, 39, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "Geist", Arial, Helvetica, sans-serif;
  font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.page { max-width: 820px; margin: 0 auto; padding: 24px 20px 64px; }

.toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 16px; }
.toolbar button {
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--panel-border); border-radius: 999px; padding: 7px 16px;
}

.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.logo .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-ink); font-size: 17px; font-weight: 800;
}
.brandrow { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

section { margin-top: 30px; }
h2 { font-size: 21px; letter-spacing: -0.01em; margin-bottom: 12px; }
h2 .num { color: var(--accent); margin-right: 8px; }

.btn {
  font: inherit; font-weight: 700; font-size: 15.5px; padding: 13px 22px; border-radius: 12px;
  border: 1px solid var(--panel-border); background: var(--panel); color: var(--ink); cursor: pointer;
  text-decoration: none; display: inline-block;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- scan page ---------- */
.scan-hero { border-bottom: 3px solid var(--accent); padding-bottom: 18px; margin-bottom: 22px; }
.scan-hero h1 { font-size: 30px; letter-spacing: -0.02em; margin-top: 14px; }
.scan-hero .meta { color: var(--muted); font-size: 15px; margin-top: 6px; }

.consent {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 14px 16px; font-size: 15px; margin-bottom: 16px;
}
.consent input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); }

.dropzone {
  border: 2px dashed var(--panel-border); border-radius: 16px;
  padding: 42px 24px; text-align: center; color: var(--muted);
  background: var(--panel); transition: border-color 0.15s, background 0.15s;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.dropzone.disabled { opacity: 0.45; pointer-events: none; }
.dropzone .browse {
  color: var(--accent); font-weight: 700; cursor: pointer; text-decoration: underline;
}
.limits-note { font-size: 13.5px; color: var(--muted); margin-top: 10px; text-align: center; }

.file-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 10px; padding: 10px 14px; font-size: 15px;
}
.file-row .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fsize { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.file-row .rm {
  border: none; background: none; color: var(--crit); cursor: pointer;
  font-size: 13.5px; font-weight: 700; white-space: nowrap;
}
.file-row.error { border-color: var(--crit); }
.file-row .err-msg { color: var(--crit); font-size: 13.5px; }

.notice {
  border-radius: 10px; padding: 10px 14px; font-size: 14.5px; margin-top: 12px;
  border: 1px solid var(--warn); background: var(--warn-bg); color: var(--warn);
}
.notice.ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }

.scan-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spinner {
  width: 18px; height: 18px; border: 3px solid var(--accent-soft);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; display: inline-block; vertical-align: -4px; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.privacy { margin-top: 26px; color: var(--muted); font-size: 13.5px; border-top: 1px solid var(--panel-border); padding-top: 14px; }

/* ---------- report page ---------- */
header.rpt { border-bottom: 3px solid var(--accent); padding-bottom: 18px; margin-bottom: 22px; }
header.rpt h1 { font-size: 30px; letter-spacing: -0.02em; margin-top: 14px; }
.meta { color: var(--muted); font-size: 15px; margin-top: 6px; }
.policy-line {
  margin-top: 12px; background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 12px 16px; font-size: 15px;
}
.policy-line strong { font-weight: 700; }

.score-wrap {
  display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: center;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px; padding: 22px;
}
.gauge { text-align: center; }
.gauge svg { display: block; margin: 0 auto; }
.gauge .val { font-size: 34px; font-weight: 800; }
.gauge .of { color: var(--muted); font-size: 14px; }
.verdict { font-size: 18px; font-weight: 700; line-height: 1.4; }
.breakdown { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.bd-row { display: grid; grid-template-columns: 150px 1fr 52px; gap: 10px; align-items: center; font-size: 14px; }
.bd-row .bar { height: 8px; border-radius: 4px; background: var(--panel-border); overflow: hidden; }
.bd-row .bar i { display: block; height: 100%; border-radius: 4px; }
.bd-row .pts { text-align: right; color: var(--muted); font-weight: 700; }

.finding {
  background: var(--panel); border: 1px solid var(--panel-border); border-left-width: 5px;
  border-radius: 14px; padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.finding.crit { border-left-color: var(--crit); }
.finding.warn { border-left-color: var(--warn); }
.finding.consider { border-left-color: var(--blue); }
.f-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.sev {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.sev.crit { background: var(--crit-bg); color: var(--crit); }
.sev.warn { background: var(--warn-bg); color: var(--warn); }
.sev.consider { background: rgba(17, 138, 178, 0.15); color: var(--blue); }
.f-title { font-size: 18px; font-weight: 700; flex: 1; min-width: 200px; }
.f-body { margin-top: 8px; font-size: 15.5px; }
.f-why { margin-top: 10px; font-size: 15px; background: var(--quote-bg); border-radius: 10px; padding: 10px 14px; }
.f-why b { font-weight: 700; }
.f-src { margin-top: 10px; font-size: 13.5px; color: var(--muted); font-style: italic; word-break: break-word; }
.f-ask { margin-top: 10px; font-size: 15px; }
.f-ask .q { font-weight: 700; color: var(--accent); }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--panel-border); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--panel-border); vertical-align: top; }
th { background: var(--panel); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
.st { font-weight: 700; white-space: nowrap; }
.st.ok { color: var(--ok); } .st.gap { color: var(--crit); } .st.att { color: var(--warn); }
.tbl-note { font-size: 13.5px; color: var(--muted); margin-top: 8px; }
.veh-head { background: var(--quote-bg); font-weight: 700; }
.veh-head td { padding: 8px 14px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

.questions { background: var(--accent-soft); border: 1px solid var(--panel-border); border-radius: 14px; padding: 18px 20px; }
.questions ol { margin-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 15.5px; }
.questions .lever-intro { font-size: 15px; margin-bottom: 12px; font-weight: 500; }
.questions ul.levers { margin-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 15.5px; }
.badge-current {
  background: var(--accent); color: var(--accent-ink); border-radius: 999px;
  padding: 2px 10px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.carrier-note { color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 3px; }

.good { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.good .g { background: var(--ok-bg); border-radius: 12px; padding: 14px 16px; font-size: 14.5px; }
.good .g b { color: var(--ok); display: block; margin-bottom: 4px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
footer.disc { margin-top: 36px; border-top: 1px solid var(--panel-border); padding-top: 16px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-state h1 { font-size: 26px; margin-bottom: 10px; }
.empty-state p { color: var(--muted); margin-bottom: 22px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .score-wrap { grid-template-columns: 1fr; }
  .good { grid-template-columns: 1fr; }
  h1, header.rpt h1, .scan-hero h1 { font-size: 25px; }
  .bd-row { grid-template-columns: 110px 1fr 46px; }
}

@media print {
  .toolbar, .actions { display: none !important; }
  body { background: #fff; color: #102027; font-size: 12.5px; }
  .page { max-width: none; padding: 0; }
  .finding, .score-wrap, .questions, .good .g, .policy-line { box-shadow: none; break-inside: avoid; }
  section { margin-top: 18px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
