/* One stylesheet for the whole project. */

:root {
  --ink: #0f172a;
  --soft: #64748b;
  --line: #e2e8f0;
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
}

body {
  background: #f1f5f9;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.container.narrow { max-width: 880px; }
.container.dash { max-width: 1100px; }

/* Client dashboard score bars */
.score-list { display: flex; flex-direction: column; gap: .85rem; }
.score-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.1fr) minmax(120px, 2fr) 4.5rem;
  gap: .75rem;
  align-items: center;
}
@media (max-width: 640px) {
  .score-row { grid-template-columns: 1fr 4rem; }
  .score-track { grid-column: 1 / -1; order: 3; }
}
.score-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.score-tag {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-radius: 99px;
  padding: .1rem .45rem;
}
.score-tag.good { background: #dcfce7; color: #166534; }
.score-tag.mid  { background: #e0e7ff; color: #3730a3; }
.score-tag.low  { background: #ffedd5; color: #9a3412; }
.score-tag.muted { background: #f1f5f9; color: #64748b; }
.score-track {
  height: 10px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.score-fill { height: 100%; border-radius: 99px; }
.score-fill.good { background: #16a34a; }
.score-fill.mid  { background: #1d4ed8; }
.score-fill.low  { background: #ea580c; }
.score-fill.muted { background: #94a3b8; }
.score-num { text-align: right; font-weight: 700; font-size: 1.05rem; }

.chart.chart-sm { height: 220px; }

.detail-block summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem;
}
.detail-block summary::-webkit-details-marker { display: none; }
.detail-block summary::before {
  content: '▸';
  display: inline-block;
  margin-right: .4rem;
  color: var(--brand);
  transition: transform .15s ease;
}
.detail-block[open] summary::before { transform: rotate(90deg); }

.kpi .hint { font-size: .72rem; color: var(--soft); margin-top: .2rem; }

.small-flag { color: #b45309; font-weight: 700; }

/* ---------- top bar ---------- */
.topbar {
  background: linear-gradient(120deg, var(--brand-dark), var(--brand));
  color: #fff;
  padding: 1rem 0;
}
.topbar.dark { background: #0f172a; padding: .7rem 0; }
.topbar a { color: #cbd5e1; text-decoration: none; }
.topbar a:hover { color: #fff; }
.topbar .btn-outline-light { color: #fff; }

/* ---------- cards ---------- */
.card-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .7rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: .25rem;
}
.section-title {
  font-weight: 700;
  color: var(--brand);
  border-bottom: 1px solid var(--line);
  padding-bottom: .5rem;
  margin-bottom: .75rem;
}

/* ---------- ID input ---------- */
.id-input {
  font-size: 1.15rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: center;
  font-weight: 600;
  padding: .75rem;
}
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

/* ---------- wizard: one SCREEN at a time ---------- */
/* Without JavaScript the form has no .wizard class, so every step stays
   visible and the survey still works as one long page. */
.wizard .step { display: none; }
.wizard .step.active { display: block; animation: fade .18s ease-out; }
.step { margin-bottom: 1rem; }

/* Likert matrix (C1–C6) */
.likert-grid th, .likert-grid td { vertical-align: middle; }
.likert-grid th { font-size: .78rem; white-space: nowrap; }
.likert-grid .q-label { font-size: .92rem; font-weight: 600; min-width: 220px; }
.likert-grid tr.bad { background: #fef2f2; }
.likert-cell { position: relative; display: inline-block; margin: 0; cursor: pointer; }
.likert-cell input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.likert-cell span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
  color: var(--soft);
  background: #fff;
}
.likert-cell input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.likert-cell input:focus-visible + span { outline: 3px solid rgba(29, 78, 216, .35); }
@media (max-width: 575.98px) {
  .likert-cell span { width: 1.65rem; height: 1.65rem; font-size: .8rem; }
}

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.wizard-head .step-label { font-weight: 600; font-size: .9rem; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--brand); transition: width .25s ease; }

.hint { font-size: .78rem; color: var(--soft); margin: .5rem 0 0; }
.opt-tag {
  font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--soft); border: 1px solid var(--line); border-radius: 99px; padding: .05rem .45rem;
  margin-left: .25rem;
}
.nav-box { position: sticky; bottom: .75rem; box-shadow: 0 10px 25px -18px rgba(15, 23, 42, .6); }

/* ---------- questions ---------- */
.qblock { padding: .9rem 0; border-top: 1px solid var(--line); }
.qblock:first-of-type { border-top: 0; padding-top: .2rem; }
.qblock.bad { border-left: 3px solid #dc2626; padding-left: .75rem; background: #fef2f2; }
.step.bad { border-color: #dc2626; }
.qtext { font-weight: 600; margin-bottom: .6rem; font-size: 1.05rem; }
.qcode {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  border-radius: 5px;
  padding: .05rem .4rem;
  margin-right: .4rem;
}
.req { color: #dc2626; }
.err { color: #b91c1c; font-size: .85rem; margin: .4rem 0 0; }

.options { display: grid; gap: .5rem; }
@media (min-width: 640px) { .options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.opt {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .55rem .75rem;
  display: flex;
  gap: .55rem;
  align-items: center;
  cursor: pointer;
  background: #fff;
  margin: 0;
}
.opt:hover { border-color: #94a3b8; }
.opt.on { border-color: var(--brand); background: #eff6ff; }

/* ---------- likert 1–7 ---------- */
.likert { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.likert label { position: relative; margin: 0; text-align: center; }
.likert input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.likert span {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .5rem 0;
  font-weight: 600;
  color: var(--soft);
  background: #fff;
}
.likert input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.likert input:focus-visible + span { outline: 3px solid rgba(29, 78, 216, .35); }
.ends { display: flex; justify-content: space-between; font-size: .7rem; color: var(--soft); margin-top: .25rem; }

.tick { font-size: 2.5rem; line-height: 1; margin-bottom: .5rem; }

/* ---------- admin ---------- */
body.admin { background: #f8fafc; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: .8rem .9rem;
}
.kpi .l { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--soft); }
.kpi .v { font-size: 1.6rem; font-weight: 700; }
.kpi.green { border-left-color: #16a34a; }
.kpi.amber { border-left-color: #d97706; }
.kpi.red { border-left-color: #dc2626; }

.chart { position: relative; height: 280px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
.table-wrap { max-height: 70vh; overflow: auto; }
table.tight th { color: var(--soft); font-weight: 600; white-space: nowrap; }
table.tight td, table.tight th { font-size: .88rem; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: #0f172a; padding: 1.5rem; }
.login-card { background: #fff; border-radius: 14px; padding: 2rem; width: min(400px, 100%); }

/* ---------- report extras ---------- */
.construct-head {
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: .35rem;
}
.spread { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--line); }
.spread .seg { height: 100%; }
.spread-key { display: flex; gap: .6rem; flex-wrap: wrap; font-size: .7rem; color: var(--soft); }
.quote {
  border-left: 3px solid var(--line);
  padding: .3rem 0 .3rem .8rem;
  margin-bottom: .75rem;
}
.quote .meta { font-size: .72rem; color: var(--soft); }

/* ---------- printing the report ---------- */
@media print {
  body.admin { background: #fff; }
  .topbar, .no-print, form { display: none !important; }
  .card-box { border: 1px solid #ccc; break-inside: avoid; page-break-inside: avoid; }
  .chart { height: 240px; }
  a[href]:after { content: ''; }
}
