/* =========================================================
   CPDS design system
   One stylesheet for the whole app. Colors, spacing, and
   sizes are set once as variables at the top.
   ========================================================= */

:root {
  /* Brand colors */
  --primary: #0f5c5a;        /* deep teal: trust, guidance */
  --primary-600: #0b4a48;
  --primary-50: #e8f3f2;
  --accent: #e8a33d;         /* warm amber: growth, optimism */
  --accent-50: #fdf4e6;

  /* Neutrals */
  --ink: #14211f;            /* main text */
  --muted: #5b6b68;          /* secondary text */
  --line: #e1e7e5;           /* borders */
  --bg: #f6f8f7;             /* page background */
  --surface: #ffffff;        /* cards */

  /* Status */
  --success: #2e7d4f;
  --warning: #b7791f;
  --danger: #c0392b;

  /* Strand colors (TVL) */
  --ict: #2f6fde;
  --he: #d9574a;
  --ia: #6b5bd6;
  --afa: #3c9a5b;

  /* Shape and type */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 33, 31, .06), 0 4px 16px rgba(20, 33, 31, .06);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); font-weight: 750; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--primary); }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.icon { width: 20px; height: 20px; flex: none; }

/* Keyboard focus is always visible (accessibility) */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--primary);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-accent { background: var(--accent); color: #2b1d05; }
.btn-accent:hover { background: #d9932c; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 8px 14px; font-size: .9rem; }
.btn-block { width: 100%; }

/* ---------- Top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--primary); color: #fff;
}
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 8px; }
.nav a:not(.btn) { color: var(--muted); text-decoration: none; padding: 8px 10px; font-weight: 600; font-size: .95rem; }
.nav a:not(.btn):hover { color: var(--ink); }

/* ---------- Cards and grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; background: var(--primary-50); color: var(--primary);
}
.badge-accent { background: var(--accent-50); color: #8a5a12; }
.badge-ict { background: #e8effc; color: var(--ict); }
.badge-he  { background: #fbeceb; color: var(--he); }
.badge-ia  { background: #efedfb; color: var(--ia); }
.badge-afa { background: #e8f5ec; color: var(--afa); }

/* ---------- Landing: hero ---------- */
.hero { padding: 72px 0 88px; background:
  radial-gradient(900px 400px at 85% 0%, var(--primary-50), transparent 70%),
  radial-gradient(600px 300px at 0% 100%, var(--accent-50), transparent 70%); }
.hero .container { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 20px; }
.trust { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: .9rem; }
.trust span { display: inline-flex; align-items: center; gap: 6px; }

/* Preview card shown in the hero */
.preview { position: relative; }
.preview .card { padding: 22px; }
.preview-float {
  position: absolute; right: -14px; bottom: -58px; width: 210px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}

/* "How it works" steps */
.steps { counter-reset: step; }
.step { position: relative; padding-top: 56px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: 0; left: 0; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800; background: var(--primary-50); color: var(--primary);
}
.step h3 { margin-bottom: .35em; }
.step p { color: var(--muted); font-size: .95rem; margin: 0; }

.feature { display: flex; gap: 14px; }
.feature-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--accent-50); color: #8a5a12;
}

.note {
  display: flex; gap: 12px; padding: 16px 18px; border-radius: 12px;
  background: var(--accent-50); border: 1px solid #f3dcb5; color: #6b4610; font-size: .95rem;
}

.footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .9rem; background: var(--surface); }
.footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ---------- Progress and meters ---------- */
.progress { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .3s; }

.meter { display: grid; grid-template-columns: 150px 1fr 48px; align-items: center; gap: 12px; margin: 10px 0; font-size: .95rem; }
.meter .bar { height: 10px; background: var(--primary-50); border-radius: 999px; overflow: hidden; }
.meter .bar > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.meter.accent .bar > span { background: var(--accent); }
.meters-wide .meter { grid-template-columns: 200px 1fr 40px; }
.meter b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Assessment ---------- */
.app-header { background: var(--surface); border-bottom: 1px solid var(--line); padding: 18px 0; }
.app-header .row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }

.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin: 24px 0; }
.stepper a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  text-decoration: none; font-size: .85rem; font-weight: 650;
}
.stepper a .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.stepper a.done { color: var(--success); }
.stepper a.done .dot { background: var(--success); }
.stepper a.current { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.stepper a.current .dot { background: var(--primary); }

.question { padding: 22px 0; border-bottom: 1px solid var(--line); }
.question:last-child { border-bottom: 0; }
.question p { font-weight: 600; font-size: 1.05rem; margin-bottom: 14px; }
.question .num { color: var(--muted); font-weight: 700; margin-right: 6px; }

/* Likert scale: real radio buttons styled as big, tappable pills */
.likert { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.likert label { position: relative; cursor: pointer; }
.likert input { position: absolute; opacity: 0; }
.likert span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 64px; padding: 8px 4px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); font-size: .78rem; color: var(--muted); text-align: center; line-height: 1.2;
  transition: border-color .15s, background .15s;
}
.likert span b { font-size: 1.15rem; color: var(--ink); }
.likert label:hover span { border-color: var(--primary); }
.likert input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.likert input:checked + span { border-color: var(--primary); background: var(--primary); color: #e6f2f1; }
.likert input:checked + span b { color: #fff; }

.form-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* ---------- Result ---------- */
.result-hero { background: var(--primary); color: #fff; padding: 40px 0 88px; }
.result-hero .muted { color: #b9d6d3; }
.result-hero .badge { background: rgba(255,255,255,.14); color: #fff; }
.overlap { margin-top: -64px; }
.code-letters { display: flex; gap: 10px; margin: 10px 0 4px; }
.code-letters span {
  width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.5rem; font-weight: 800; background: var(--accent); color: #2b1d05;
}
.code-letters span + span { background: rgba(255,255,255,.16); color: #fff; }

.rank-card { position: relative; display: flex; flex-direction: column; gap: 12px; }
.rank-card.top { border: 2px solid var(--accent); }
.rank-num {
  position: absolute; top: -12px; left: 20px; padding: 3px 12px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: .78rem; font-weight: 700;
}
.rank-card.top .rank-num { background: var(--accent); color: #2b1d05; }
.match { display: flex; align-items: baseline; gap: 6px; }
.match b { font-size: 2.2rem; font-weight: 800; color: var(--primary); line-height: 1; }
.spec-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; color: #fff; }

.ring {
  --value: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--value) * 1%), var(--primary-50) 0);
}
.ring > div {
  width: 104px; height: 104px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; text-align: center;
}
.ring b { font-size: 1.7rem; display: block; line-height: 1; }

/* ---------- Admin ---------- */
.admin { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #c9d6d3; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.sidebar .brand { color: #fff; padding: 4px 8px 20px; }
.sidebar .brand small { color: #8fa5a1; }
.sidebar a.link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: #c9d6d3; text-decoration: none; font-weight: 600; font-size: .95rem;
}
.sidebar a.link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.link.active { background: var(--primary); color: #fff; }
.sidebar .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #7e9490; padding: 16px 12px 6px; }
.main { padding: 28px; min-width: 0; }
.main-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }

.stat .label { color: var(--muted); font-size: .88rem; font-weight: 600; }
.stat .value { font-size: 2rem; font-weight: 800; line-height: 1.1; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: .82rem; color: var(--success); font-weight: 650; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:hover { background: #fafcfb; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: .85rem; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--success); }
.status.wip { color: var(--warning); }
.status.none { color: var(--muted); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 650; font-size: .92rem; }
.field .hint { font-size: .82rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; font: inherit; padding: 11px 12px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--primary); flex: none; }
.alert { padding: 12px 14px; border-radius: 10px; font-size: .93rem; margin-bottom: 16px; }
.alert-error { background: #fdecea; color: #8c2a20; border: 1px solid #f5c6c0; }
.alert-success { background: #e8f5ec; color: #1f5e39; border: 1px solid #bfe3cb; }
[hidden] { display: none !important; }

.auth { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 32px 16px; }
.auth .card { width: 100%; max-width: 440px; padding: 32px; }
.consent-text { max-height: 340px; overflow-y: auto; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: .93rem; margin-bottom: 18px; }
.consent-text h4 { margin: 14px 0 4px; font-size: .95rem; }
.consent-text h4:first-child { margin-top: 0; }

.question.missing > p { color: var(--danger); }
.question.missing .likert span { border-color: #f0b8b1; }
.loading { padding: 48px 0; text-align: center; color: var(--muted); }
.row-actions { display: flex; gap: 6px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.inline-form .full { grid-column: 1 / -1; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar select, .toolbar input { width: auto; min-width: 180px; }
td.wrap { white-space: normal; min-width: 260px; }
.eval-cat { margin-top: 28px; }
.eval-cat:first-of-type { margin-top: 8px; }

/* ---------- Print (learner result) ---------- */
@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .result-hero { background: #fff; color: var(--ink); padding: 0 0 16px; }
  .overlap { margin-top: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero .container { grid-template-columns: 1fr; }
  .preview-float { right: 8px; }
  .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .admin { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; padding: 10px; gap: 4px; }
  .sidebar .brand, .sidebar .label { display: none; }
  .sidebar a.link { white-space: nowrap; }
}
@media (max-width: 640px) {
  .section { padding: 44px 0; }
  .container { padding: 0 16px; }
  .grid-2, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .nav a:not(.btn) { display: none; }
  .likert span { min-height: 56px; font-size: 0; }   /* phones: show numbers only */
  .likert span b { font-size: 1.1rem; }
  .meter, .meters-wide .meter { grid-template-columns: 112px 1fr 40px; font-size: .88rem; }
  .main { padding: 18px 16px; }
  .preview-float { position: static; width: auto; margin-top: 12px; }
  .inline-form { grid-template-columns: 1fr; }
  .auth .card { padding: 24px 20px; }
}
