:root {
  --bg: #f7fbff;
  --surface: #ffffff;
  --surface-soft: #f2f7ff;
  --surface-tint: #f8fbff;
  --text: #0e1726;
  --muted: #5a667a;
  --quiet: #8792a6;
  --line: #e4ecf7;
  --line-strong: #ced9e9;
  --accent: #1f6bff;
  --accent-2: #7c3aed;
  --accent-soft: #eaf2ff;
  --green: #14a46c;
  --green-soft: #e9f9f1;
  --yellow: #f6a600;
  --yellow-soft: #fff6df;
  --red: #e14b5a;
  --red-soft: #fff0f2;
  --shadow: 0 18px 50px rgba(18, 38, 75, 0.08);
  --shadow-soft: 0 10px 30px rgba(18, 38, 75, 0.06);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 34px;
  --sidebar: 276px;
  --topbar: 76px;
  --ease: cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(31, 107, 255, .12), transparent 28rem),
    radial-gradient(circle at top right, rgba(124, 58, 237, .08), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }

.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(18px);
  overflow: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 20px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 16px;
  background: linear-gradient(135deg, #155eef, #7c3aed);
  color: #fff; display: grid; place-items: center; font-weight: 900;
  letter-spacing: -0.06em; box-shadow: 0 12px 28px rgba(31, 107, 255, .22);
}
.brand h1 { margin: 0; font-size: 1.02rem; line-height: 1.1; letter-spacing: -0.03em; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: .78rem; }

.programme-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px;
  background: linear-gradient(180deg, #fff, #f7fbff);
  box-shadow: var(--shadow-soft); margin-bottom: 18px;
}
.programme-card .eyebrow { color: var(--accent); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.programme-card h2 { margin: 6px 0 8px; font-size: 1.05rem; letter-spacing: -0.035em; }
.programme-card p { margin: 0; color: var(--muted); font-size: .83rem; }

.nav-label { margin: 22px 10px 9px; color: var(--quiet); font-size: .72rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.nav { display: grid; gap: 7px; }
.nav a, .nav button {
  border: 0; background: transparent; color: var(--muted); border-radius: 15px;
  padding: 11px 12px; text-align: left; display: grid;
  grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px;
  transition: .2s var(--ease); text-decoration: none; width: 100%;
}
.nav a:hover, .nav button:hover { background: var(--surface-soft); color: var(--text); transform: translateX(2px); }
.nav a.active { background: #eef5ff; color: var(--text); box-shadow: inset 0 0 0 1px #d9e8ff; }
.nav-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); font-size: .92rem; }
.nav-title { font-weight: 760; font-size: .88rem; }
.nav-meta { color: var(--quiet); font-size: .72rem; font-weight: 700; }

.sidebar-footer { margin-top: 18px; padding: 14px; border-radius: var(--radius-md); background: #0e1726; color: #fff; }
.sidebar-footer strong { display: block; font-size: .88rem; }
.sidebar-footer span { display: block; color: rgba(255,255,255,.72); font-size: .78rem; margin-top: 4px; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5; height: var(--topbar);
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 0 34px; border-bottom: 1px solid rgba(228, 236, 247, .75);
  background: rgba(247, 251, 255, .84); backdrop-filter: blur(18px);
}
.topbar-left { min-width: 0; }
.topbar-left strong { display: block; font-size: .86rem; color: var(--accent); text-transform: uppercase; letter-spacing: .1em; }
.topbar-left span { display: block; color: var(--muted); font-size: .91rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.status-pill { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 9px 12px; color: var(--muted); font-size: .82rem; font-weight: 720; box-shadow: var(--shadow-soft); }
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }

.primary-btn, .secondary-btn, .ghost-btn {
  border-radius: 999px; border: 1px solid transparent; padding: 10px 15px; font-weight: 800;
  transition: .2s var(--ease); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.primary-btn { background: var(--text); color: #fff; box-shadow: 0 12px 24px rgba(14, 23, 38, .16); }
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(14, 23, 38, .18); }
.secondary-btn { background: #fff; color: var(--text); border-color: var(--line); }
.secondary-btn:hover, .ghost-btn:hover { background: var(--surface-soft); border-color: var(--line-strong); }
.ghost-btn { background: transparent; color: var(--muted); border-color: var(--line); }
.danger-btn { background: var(--red); color: #fff; }

.content { padding: 32px 34px 56px; max-width: 1480px; margin: 0 auto; }

.hero {
  border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 34px;
  background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(244, 249, 255, .92)),
    radial-gradient(circle at 74% 18%, rgba(31, 107, 255, .16), transparent 24rem);
  box-shadow: var(--shadow); overflow: hidden; position: relative;
}
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(320px, .82fr); gap: 30px; align-items: center; }
.kicker { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--accent); font-size: .78rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; box-shadow: var(--shadow-soft); }
.hero h2 { margin: 16px 0 12px; font-size: clamp(1.8rem, 3.4vw, 3.2rem); line-height: .98; letter-spacing: -0.06em; max-width: 860px; }
.hero p { margin: 0; color: var(--muted); font-size: 1.05rem; max-width: 720px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.grid { display: grid; gap: 18px; margin-top: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card { background: rgba(255, 255, 255, .93); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-soft); min-width: 0; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.card h3 { margin: 0; font-size: 1.02rem; line-height: 1.2; letter-spacing: -0.032em; }
.card p { margin: 6px 0 0; color: var(--muted); font-size: .89rem; }

.metric { display: grid; gap: 12px; }
.metric-value { font-size: 2.1rem; font-weight: 900; letter-spacing: -0.07em; line-height: 1; }
.progress { height: 10px; border-radius: 999px; background: #edf3fb; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: var(--value, 50%); }

.split { display: grid; grid-template-columns: minmax(0, .96fr) minmax(340px, 1.04fr); gap: 18px; align-items: start; }

.section-title { margin: 30px 0 14px; display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-title h2 { margin: 0; font-size: clamp(1.3rem, 2vw, 1.9rem); line-height: 1.05; letter-spacing: -0.05em; }
.section-title p { margin: 7px 0 0; color: var(--muted); max-width: 680px; }

.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 7px; }
.field label, .label { color: #273248; font-size: .8rem; font-weight: 820; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 14px;
  background: #fff; color: var(--text); padding: 12px 13px; outline: none; transition: .18s var(--ease);
}
.field textarea { min-height: 100px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(31, 107, 255, .65); box-shadow: 0 0 0 4px rgba(31, 107, 255, .10); }
.field input:disabled, .field textarea:disabled { background: #f4f7fb; color: var(--quiet); }
.helper { color: var(--quiet); font-size: .76rem; }

.consent-list { display: grid; gap: 10px; }
.consent-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; }
.consent-item input { width: 20px; height: 20px; accent-color: var(--accent); margin-top: 2px; }
.consent-item strong { display: block; font-size: .9rem; }
.consent-item span.desc { display: block; color: var(--muted); font-size: .81rem; margin-top: 3px; }
.consent-item.required .mini-tag { color: #065f46; background: var(--green-soft); border-color: #c7efdd; }
.consent-item.optional .mini-tag { color: #7a4b00; background: var(--yellow-soft); border-color: #ffe5a7; }

.mini-tag { padding: 6px 9px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: .72rem; font-weight: 800; white-space: nowrap; }

.log-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.log-tabs a { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 12px; color: var(--muted); font-weight: 820; transition: .18s var(--ease); text-decoration: none; }
.log-tabs a.active { background: var(--text); color: #fff; border-color: var(--text); }

.confidence-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.confidence-row input { position: absolute; opacity: 0; pointer-events: none; }
.confidence-row label { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 12px 10px; text-align: center; font-weight: 900; color: var(--muted); transition: .18s var(--ease); cursor: pointer; display: block; }
.confidence-row input:checked + label { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 12px 24px rgba(31, 107, 255, .18); }

.deliverables { display: grid; gap: 10px; margin-top: 12px; }
.deliverable { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 15px; padding: 12px; background: #fff; }
.deliverable .checkbox-ui { width: 24px; height: 24px; border-radius: 9px; border: 1px solid var(--line-strong); display: grid; place-items: center; color: #fff; font-size: .78rem; }
.deliverable.done .checkbox-ui { border-color: var(--green); background: var(--green); }
.deliverable strong { font-size: .88rem; }

.rubric { display: grid; gap: 12px; }
.rubric-row { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; background: #fff; display: grid; grid-template-columns: minmax(170px, .8fr) minmax(190px, .7fr) minmax(220px, 1.2fr); gap: 14px; align-items: center; }
.rating-row { display: inline-grid; grid-template-columns: repeat(5, 30px); gap: 5px; }
.rating-row input { position: absolute; opacity: 0; pointer-events: none; }
.rating-row label { width: 30px; height: 30px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-weight: 900; display: grid; place-items: center; cursor: pointer; }
.rating-row input:checked + label { background: var(--accent); border-color: var(--accent); color: #fff; }

.audience-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.audience-tabs a { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 12px; color: var(--muted); font-weight: 820; text-decoration: none; }
.audience-tabs a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.alert { border-radius: var(--radius-md); padding: 14px; border: 1px solid; font-size: .86rem; display: flex; gap: 10px; align-items: flex-start; }
.alert.info { background: var(--accent-soft); color: #143a75; border-color: #d6e6ff; }
.alert.warning { background: var(--yellow-soft); color: #6b4300; border-color: #ffe2a0; }
.alert.success { background: var(--green-soft); color: #07553d; border-color: #c7efdd; }
.alert.error { background: var(--red-soft); color: #7a1420; border-color: #ffd3d8; }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-weight: 780; font-size: .78rem; }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0 9px; }
.data-table th { text-align: left; color: var(--quiet); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; padding: 0 12px 2px; }
.data-table td { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 13px 12px; color: var(--muted); font-size: .88rem; }
.data-table td:first-child { border-left: 1px solid var(--line); border-top-left-radius: 15px; border-bottom-left-radius: 15px; color: var(--text); font-weight: 800; }
.data-table td:last-child { border-right: 1px solid var(--line); border-top-right-radius: 15px; border-bottom-right-radius: 15px; }

.mobile-toggle { display: none; width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-soft); }
.empty-state { display: grid; place-items: center; text-align: center; min-height: 180px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-tint); padding: 22px; }
.empty-state strong { font-size: 1.05rem; }
.empty-state p { max-width: 430px; margin: 8px auto 0; }
.mobile-scrim { display: none; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 34px; background: #fff; box-shadow: var(--shadow); }

@media print {
  .sidebar, .topbar, .mobile-scrim, .no-print { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
}

@media (max-width: 1180px) {
  .hero-grid, .split, .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .app { display: block; }
  .sidebar { position: fixed; z-index: 20; left: 0; top: 0; width: 300px; height: 100vh; transform: translateX(-105%); transition: .24s var(--ease); box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-scrim { display: none; position: fixed; inset: 0; background: rgba(14, 23, 38, .24); z-index: 18; }
  .mobile-scrim.show { display: block; }
  .mobile-toggle { display: grid; place-items: center; }
  .topbar { padding: 0 16px; }
  .topbar-left strong { display: none; }
  .content { padding: 22px 16px 44px; }
  .hero { padding: 24px; }
  .rubric-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .form-grid.two, .confidence-row { grid-template-columns: 1fr; }
  .hero-actions { display: grid; }
  .primary-btn, .secondary-btn, .ghost-btn { width: 100%; }
  .card { padding: 16px; }
  .section-title { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, html { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
