/* NorthStar Analyst Suite. Colours and type match the public website:
   dark slate background, emerald accent, Inter. */
:root {
  --bg: #0f172a;         /* slate-900 */
  --bg-deep: #020617;    /* slate-950 */
  --panel: #111c33;
  --line: rgba(255, 255, 255, 0.1);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #34d399;     /* emerald-400 */
  --accent-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 Inter, system-ui, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3, h4 { color: #fff; line-height: 1.25; margin: 0 0 0.5em; font-weight: 600; }
h1 { font-size: 28px; } h2 { font-size: 20px; } h3 { font-size: 17px; } h4 { font-size: 15px; }
p { margin: 0 0 0.9em; }
[hidden] { display: none !important; }

/* ── Top bar ── */
.topbar {
  display: flex; align-items: center; gap: 32px; padding: 14px 28px;
  border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 20px; font-weight: 600; }
.brand b { color: var(--accent); font-weight: 600; }
.brand small { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 6px; }
.topbar nav { display: flex; gap: 22px; flex: 1; }
.topbar nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.topbar nav a:hover, .topbar nav a.active { color: var(--accent); }
.account { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.chip { border: 1px solid rgba(52, 211, 153, 0.4); background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 600; text-decoration: none; }
.chip.low { border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.12); color: var(--warn); }
.footer { max-width: 1240px; margin: 0 auto; padding: 20px 28px 36px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.footer a { color: var(--muted); margin-left: 16px; text-decoration: none; } .footer a:hover { color: var(--accent); }
.group { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.group .grid { margin-top: 16px; } .group .empty { margin-top: 12px; }
.auth .legal { text-align: center; margin-top: 16px; font-size: 13px; }
.auth .choice { font-size: 14px; }
.banner { background: rgba(251, 191, 36, 0.12); color: var(--warn); border-bottom: 1px solid rgba(251, 191, 36, 0.3); padding: 10px 28px; font-size: 14px; }

main { max-width: 1240px; margin: 0 auto; padding: 32px 28px 80px; }

/* ── Building blocks ── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panel + .panel { margin-top: 20px; }
.grid > .panel { margin-top: 0; }
.eyebrow { font: 500 11px/1.4 ui-monospace, monospace; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

button, .button {
  font: inherit; cursor: pointer; border-radius: 10px; padding: 9px 16px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
button:hover, .button:hover { border-color: rgba(52, 211, 153, 0.6); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--bg-deep); font-weight: 600; }
button.primary:hover { background: #6ee7b7; }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
button.link { background: none; border: none; padding: 0; color: var(--muted); }
button.link:hover { color: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

label { display: block; font-weight: 500; color: #fff; margin-bottom: 6px; }
label small { display: block; font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=file], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg-deep);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 16px; }
.fields { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; font-weight: 400; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 4px; accent-color: var(--accent); }
.error { color: var(--bad); margin: 8px 0; }
.callout { border: 1px solid rgba(52, 211, 153, 0.35); border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; }
#gap-form textarea { min-height: 54px; min-width: 220px; }
.cite.ext { text-decoration: underline; }
.note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.note.good { color: var(--accent); } .note.error { color: var(--bad); }

.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid var(--line); color: var(--muted); }
.badge.good { color: var(--accent); border-color: rgba(52, 211, 153, 0.4); background: var(--accent-soft); }
.badge.warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); }
.badge.bad { color: var(--bad); border-color: rgba(248, 113, 113, 0.4); }

/* ── Pop-up (the terms) ── */
.modal-layer { position: fixed; inset: 0; z-index: 50; background: rgba(2, 6, 23, 0.82); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: min(760px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.modal .callout { margin-bottom: 12px; font-size: 14px; }
.modal .callout ul { margin: 6px 0 0; padding-left: 20px; }
.terms-scroll { overflow-y: auto; flex: 1 1 auto; min-height: 160px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-deep); padding: 16px 18px; font-size: 14px; }
.terms-scroll h3 { font-size: 15px; margin-top: 1em; }
.terms-scroll h3:first-child { margin-top: 0; }
.modal .row { margin-top: 10px; }

/* ── Feedback under a report ── */
.feedback { margin-top: 28px; padding: 22px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; background: var(--bg-deep); }
.feedback h2 { margin-top: 0; }
.feedback .choice { margin-bottom: 14px; }
.feedback textarea { min-height: 84px; }

/* ── Admin panel and the knowledge graph page ── */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 4px 0 24px; }
.tabs a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 8px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: #fff; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.steps { padding-left: 20px; } .steps li { margin-bottom: 8px; } .steps ul { margin-top: 6px; }
details summary { cursor: pointer; margin: 8px 0; }

/* ── Sign in ── */
.auth { max-width: 420px; margin: 8vh auto 0; }
.auth .brand { justify-content: center; margin-bottom: 24px; font-size: 24px; }

/* ── Material cards ── */
.card { display: block; color: inherit; text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; transition: border-color 0.2s; }
a.card:hover { border-color: rgba(52, 211, 153, 0.6); }

/* ── Pathway map ── */
.pathway { overflow-x: auto; background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius);
  background-image: radial-gradient(#1e293b 1px, transparent 1px); background-size: 28px 28px; }
.pathway svg { display: block; }
.pathway .node { cursor: pointer; }
.pathway .node text { font: 500 12.5px Inter, sans-serif; fill: var(--text); paint-order: stroke; stroke: var(--bg-deep); stroke-width: 4px; }
.pathway .node .sub { font-weight: 400; font-size: 11px; fill: var(--muted); }
.pathway .node.current circle.ring { fill: var(--accent); }
.pathway .node.running circle.ring { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; display: inline-block; }

/* ── Report ── */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.report h2 { margin-top: 1.6em; padding-top: 1.2em; border-top: 1px solid var(--line); }
.report h2:first-of-type { border-top: none; padding-top: 0; }
.report ul { margin: 0 0 0.9em; padding-left: 20px; }
.report ul.findings { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.findings li { background: var(--accent-soft); border: 1px solid rgba(52, 211, 153, 0.25); border-radius: 12px; padding: 12px 14px; color: #fff; }
.cite { font-size: 11px; vertical-align: super; text-decoration: none; padding: 0 1px; }
.table-wrap { overflow-x: auto; margin: 12px 0 18px; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: rgba(255, 255, 255, 0.04); color: #fff; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.chart { margin: 12px 0 18px; }
.chart .bar-row { display: grid; grid-template-columns: minmax(120px, 30%) 1fr auto; gap: 12px; align-items: center; margin: 6px 0; font-size: 13px; }
.chart .bar { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #10b981, var(--accent)); min-width: 2px; }
.chart .track { background: rgba(255, 255, 255, 0.05); border-radius: 7px; }
.flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin: 12px 0 18px; }
.flow .step { flex: 1 1 150px; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; position: relative; }
.flow .step.highlight { border-color: var(--accent); background: var(--accent-soft); }
.flow .step b { display: block; color: #fff; }
.flow .step span { font-size: 13px; color: var(--muted); }
.flow .arrow { align-self: center; color: var(--accent); }

.option { background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.option dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.option dt { color: var(--muted); } .option dd { margin: 0; }
.score { display: inline-flex; gap: 3px; }
.score i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); }
.score i.on { background: var(--accent); }

.calc { background: var(--bg-deep); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.calc code { display: block; background: rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font: 13px ui-monospace, monospace; color: #fff; overflow-x: auto; }
.calc .result { font-size: 18px; font-weight: 600; color: #fff; }
.sources { font-size: 13px; padding-left: 0; list-style: none; }
.sources li { margin-bottom: 6px; display: grid; grid-template-columns: 44px 1fr; }
.sources li:target { background: var(--accent-soft); border-radius: 6px; }

/* ── Calculator ── */
.calculator { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 24px; }
.calculator .inputs .field { margin-bottom: 10px; }
.calculator .inputs label { font-size: 13px; margin-bottom: 3px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--bg-deep); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.kpi b { display: block; font-size: 20px; color: #fff; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi.good b { color: var(--accent); } .kpi.bad b { color: var(--bad); }
@media (max-width: 860px) { .calculator { grid-template-columns: 1fr; } .topbar { gap: 16px; flex-wrap: wrap; } }

/* ── Printing a report (the "Save as PDF" button uses the browser's print) ── */
@media print {
  :root { --bg: #fff; --bg-deep: #fff; --panel: #fff; --text: #111; --muted: #444; --line: #ccc; --accent: #047857; --accent-soft: #ecfdf5; }
  body { background: #fff; color: #111; font-size: 11pt; }
  h1, h2, h3, h4, th, .findings li, .calc .result, .kpi b, .flow .step b, .calc code { color: #111 !important; }
  .no-print { display: none !important; }
  main { padding: 0; max-width: none; }
  .panel { border: none; padding: 0; }
  .calc, .option, .table-wrap, .flow .step { break-inside: avoid; }
  a { color: #047857; }
}
