/* HIPAA SRA Tool — clean, calm, minimal */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #16202c;
  --ink-2: #51606f;
  --ink-3: #8494a5;
  --line: #e3e8ee;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fe;
  --good: #1a7f4b;
  --good-soft: #e6f5ec;
  --warn: #b45309;
  --warn-soft: #fdf2e3;
  --bad: #c2343a;
  --bad-soft: #fdecec;
  --crit: #7c2d8e;
  --crit-soft: #f6ebf8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(22,32,44,.05), 0 4px 16px rgba(22,32,44,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px; height: 56px;
}
.topbar .brand { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.topbar .brand .logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; }
.topbar nav { display: flex; gap: 4px; margin-left: 8px; }
.topbar nav a { padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.topbar nav a.active, .topbar nav a:hover { background: var(--accent-soft); color: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--ink-3); font-size: 13px; }
.container { max-width: 1060px; margin: 0 auto; padding: 28px 22px 80px; }
.container.narrow { max-width: 760px; }

/* ---------- generic ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: 9px; padding: 9px 16px;
  font-weight: 600; font-size: 14px;
  transition: filter .12s, transform .05s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--bg); filter: none; }
.btn.ghost { background: transparent; color: var(--ink-2); border: none; }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 5px 11px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; background: #fff; color: var(--ink); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: block; margin-bottom: 14px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
label.field input, label.field select, label.field textarea { margin-top: 5px; font-weight: 400; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -.01em; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.error-box { background: var(--bad-soft); color: var(--bad); border-radius: 9px; padding: 10px 14px; margin: 10px 0; font-size: 14px; }
.ok-box { background: var(--good-soft); color: var(--good); border-radius: 9px; padding: 10px 14px; margin: 10px 0; font-size: 14px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; letter-spacing: .01em; }
.badge.Low { background: var(--good-soft); color: var(--good); }
.badge.Moderate { background: var(--warn-soft); color: var(--warn); }
.badge.High { background: var(--bad-soft); color: var(--bad); }
.badge.Critical { background: var(--crit-soft); color: var(--crit); }
.badge.neutral { background: var(--bg); color: var(--ink-2); }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo-big { width: 48px; height: 48px; border-radius: 13px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 24px; margin: 0 auto 14px; }
.auth-card h1 { text-align: center; font-size: 21px; }
.auth-card .sub { text-align: center; color: var(--ink-3); margin-bottom: 20px; font-size: 14px; }
.auth-toggle { text-align: center; margin-top: 16px; font-size: 14px; color: var(--ink-2); }

/* ---------- home ---------- */
.assessment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.assessment-card { cursor: pointer; transition: transform .1s, box-shadow .1s; position: relative; }
.assessment-card:hover { transform: translateY(-2px); box-shadow: 0 4px 24px rgba(22,32,44,.12); }
.assessment-card h3 { margin: 0 0 2px; font-size: 16px; }
.assessment-card .org { color: var(--ink-3); font-size: 13px; margin-bottom: 12px; }
.progress-track { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.progress-fill.done { background: var(--good); }
.assessment-card .meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--ink-3); margin-top: 10px; }
.card-actions { position: absolute; top: 14px; right: 14px; display: flex; gap: 4px; }
.icon-btn { background: transparent; border: none; border-radius: 7px; padding: 4px 7px; color: var(--ink-3); font-size: 14px; }
.icon-btn:hover { background: var(--bg); color: var(--bad); }

/* ---------- wizard ---------- */
.wizard-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.wizard-head .sec-pill { background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; padding: 4px 12px; border-radius: 99px; white-space: nowrap; }
.wizard-head .counts { color: var(--ink-3); font-size: 13px; }
.wizard-progress { flex-basis: 100%; height: 6px; background: #e7ebf1; border-radius: 99px; overflow: hidden; }
.q-text { font-size: 19px; font-weight: 650; letter-spacing: -.01em; margin: 4px 0 18px; line-height: 1.4; }
.q-req { margin-bottom: 14px; }
.answers { display: flex; flex-direction: column; gap: 10px; }
.answer {
  text-align: left; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 11px; padding: 13px 16px; font-size: 14.5px; line-height: 1.45;
  transition: border-color .1s, background .1s; color: var(--ink);
}
.answer:hover { border-color: var(--accent); background: #fbfcff; }
.answer.selected { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.edu { margin-top: 16px; border-radius: 11px; padding: 14px 16px; font-size: 14px; }
.edu.good { background: var(--good-soft); color: #114d30; }
.edu.risk { background: var(--warn-soft); color: #6d3b09; }
.edu .edu-tag { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: 4px; }
.q-tools { display: flex; gap: 10px; margin-top: 16px; align-items: center; flex-wrap: wrap; }
.flag-btn { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 6px 12px; font-size: 13px; color: var(--ink-2); }
.flag-btn.on { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); font-weight: 600; }
.notes-area { margin-top: 12px; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; gap: 10px; }
.wizard-nav .jump { flex: 1; text-align: center; }
.ref-details { margin-top: 14px; font-size: 12.5px; color: var(--ink-3); }
.ref-details summary { cursor: pointer; font-weight: 600; }
.ref-details pre { white-space: pre-wrap; font-family: inherit; margin: 6px 0 0; background: var(--bg); padding: 10px 12px; border-radius: 8px; }

/* vuln rating phase */
.vuln-row { border-top: 1px solid var(--line); padding: 16px 0; }
.vuln-row:first-child { border-top: none; }
.vuln-row .v-text { font-weight: 600; margin-bottom: 4px; }
.vuln-row .threats { font-size: 12.5px; color: var(--ink-3); margin-bottom: 10px; }
.rate-grid { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.rate-group { display: flex; align-items: center; gap: 7px; }
.rate-group .lbl { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 6px 12px; font-size: 13px; color: var(--ink-2); border-left: 1px solid var(--line); }
.seg button:first-child { border-left: none; }
.seg button.sel-Low { background: var(--good-soft); color: var(--good); font-weight: 700; }
.seg button.sel-Moderate { background: var(--warn-soft); color: var(--warn); font-weight: 700; }
.seg button.sel-High { background: var(--bad-soft); color: var(--bad); font-weight: 700; }

/* ---------- dashboard ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .num { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.stat .lbl { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.bar-row { display: grid; grid-template-columns: 220px 1fr 90px; gap: 12px; align-items: center; padding: 7px 0; font-size: 14px; }
.bar-track { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; }
.findings-filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.findings-filters select { width: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
.finding-detail { background: var(--bg); border-radius: 9px; padding: 12px 14px; margin-top: 8px; font-size: 13.5px; }
.gap-item { border: 1px solid var(--line); border-radius: 11px; padding: 16px 18px; margin-bottom: 12px; background: var(--surface); }
.gap-item .cite { font-weight: 700; font-size: 15px; }
.gap-item ul { margin: 8px 0 0; padding-left: 20px; }
.gap-item li { margin: 4px 0; font-size: 13.5px; }
.md { font-size: 14.5px; line-height: 1.65; }
.md h2 { font-size: 17px; margin: 22px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.md h2:first-child { margin-top: 0; }
.md h3 { font-size: 14.5px; margin: 16px 0 6px; }
.md ul { padding-left: 22px; margin: 6px 0; }
.md li { margin: 4px 0; }
.md blockquote { border-left: 3px solid var(--warn); background: var(--warn-soft); margin: 10px 0; padding: 8px 14px; border-radius: 0 8px 8px 0; }
.ai-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp 0.7s linear infinite; }
.spin.dark { border-color: rgba(31,111,235,.25); border-top-color: var(--accent); }
@keyframes sp { to { transform: rotate(360deg); } }

/* risk hero */
.risk-hero { display: flex; align-items: center; gap: 22px; margin-bottom: 20px; }
.risk-dial { width: 108px; height: 108px; border-radius: 50%; display: grid; place-items: center; position: relative; flex-shrink: 0; }
.risk-dial .inner { width: 84px; height: 84px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; flex-direction: column; text-align: center; }
.risk-dial .inner .val { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.risk-dial .inner .cap { font-size: 10px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; }

/* ---------- report / print ---------- */
.report-only { display: none; }
@media print {
  body { background: #fff; font-size: 12px; }
  .topbar, .tabs, .no-print, .stat-row, .page-head .btn { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; }
  .report-only { display: block; }
  .print-block { page-break-inside: avoid; }
  h1 { font-size: 20px; }
}
@media (max-width: 640px) {
  .bar-row { grid-template-columns: 120px 1fr 70px; }
  .risk-hero { flex-direction: column; align-items: flex-start; }
}

/* ---------- redesigned report ---------- */
#report { --r-color: var(--ink-3); }
.report-banner {
  border-radius: 14px; padding: 26px 28px; color: #fff;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.report-banner .risk-word { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.report-banner .verdict { font-size: 14.5px; opacity: .95; max-width: 560px; }
.report-banner .org-line { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; opacity: .85; margin-bottom: 6px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 20px; }
.kpi { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; text-align: center; background: #fff; }
.kpi .v { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.kpi .k { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-top: 2px; }
.r-section { margin: 26px 0 0; }
.r-section > h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
  color: #fff; background: var(--ink); display: inline-block;
  padding: 4px 12px; border-radius: 6px; margin: 0 0 14px;
}
.r-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 700px) { .r-grid2 { grid-template-columns: 1fr; } }
.takeaway { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 9px; margin-bottom: 8px; font-size: 14px; }
.takeaway .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.stackbar { display: flex; height: 22px; border-radius: 7px; overflow: hidden; margin: 8px 0 6px; }
.stackbar div { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11.5px; font-weight: 700; min-width: 0; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; background: var(--lc); }
.heatmap { display: grid; grid-template-columns: 84px repeat(3, 1fr); gap: 5px; max-width: 420px; }
.heatmap .hm-cell { border-radius: 8px; padding: 10px 6px; text-align: center; font-weight: 800; font-size: 17px; position: relative; }
.heatmap .hm-cell .hm-sub { display: block; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.heatmap .hm-lbl { display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; text-align: right; }
.heatmap .hm-top { text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; align-self: end; }
.gap-table td:first-child { white-space: nowrap; font-weight: 700; }
.reg-sev { border-left: 4px solid var(--r-color); }
table.register { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.register th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 6px 8px; border-bottom: 2px solid var(--ink); }
table.register td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 800; letter-spacing: .03em; color: #fff; }
.mini-note { font-size: 11px; color: var(--ink-3); }
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  .r-section { page-break-inside: auto; }
  .r-section > h2 { page-break-after: avoid; }
  .report-banner { border-radius: 10px; }
  table.register { font-size: 10.5px; }
  .kpi-row { grid-template-columns: repeat(6, 1fr); }
}
