/* S-4 Critical Thinking Platform — design system
   Palette: cream paper · charcoal · electric blue · coral
   Distinct from S-1 (cream/navy/saffron/teal), S-2 (cream/navy/amber/teal), S-3 (cream/forest/burgundy)
*/

:root {
  --bg:           #f6f3eb;          /* cream paper */
  --bg-elev:     #fffdf6;
  --ink:          #1f2433;          /* charcoal */
  --ink-soft:     #4a5163;
  --ink-mute:     #7c8298;
  --line:         #d8d2c1;
  --line-soft:    #ece6d4;
  --accent:       #1e4dd8;          /* electric blue */
  --accent-soft:  #e3ebff;
  --accent-deep:  #143a9e;
  --coral:        #e85b4a;          /* coral - alerts, warnings, "challenge" */
  --coral-soft:   #fde7e3;
  --ok:           #2e8b57;
  --ok-soft:      #dcf0e4;
  --warn:         #c98a00;
  --warn-soft:    #fbf0d3;
  --shadow:       0 2px 6px rgba(31,36,51,0.06), 0 1px 2px rgba(31,36,51,0.04);
  --shadow-lift:  0 4px 18px rgba(31,36,51,0.12);
  --radius:       6px;
  --radius-lg:    10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 15.5px;
}
h1, h2, h3, h4, h5 {
  font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.012em;
  margin: 0 0 0.6em;
}
h1 { font-size: 1.7em; }
h2 { font-size: 1.32em; }
h3 { font-size: 1.12em; }
h4 { font-size: 1em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
p  { margin: 0 0 0.9em; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'JetBrains Mono', Menlo, monospace; font-size: 0.9em; background: var(--line-soft); padding: 1px 5px; border-radius: 3px; }

/* ─── LANDING / AUTH ─────────────────────────────────────────────────── */
.landing {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.landing-hero {
  background: linear-gradient(155deg, #1f2433 0%, #2c3247 55%, #1e4dd8 130%);
  color: #f6f3eb;
  padding: 4.2rem 3.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.landing-hero::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 360px; height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,91,74,0.35), transparent 70%);
  pointer-events: none;
}
.landing-hero h1 {
  color: #fffdf6; font-size: 2.6em; letter-spacing: -0.02em; margin-bottom: 0.3em;
}
.landing-hero .tagline { color: #c8d0e8; font-size: 1.05em; max-width: 460px; }
.landing-hero .mark {
  display: inline-block; font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 0.85em; letter-spacing: 0.18em; color: #e85b4a; margin-bottom: 1.5em;
}
.landing-form {
  padding: 4rem 3.2rem;
  background: var(--bg-elev);
  display: flex; flex-direction: column; justify-content: center;
}
.tabs { display: flex; gap: 0; margin-bottom: 1.6rem; border-bottom: 1px solid var(--line); }
.tab {
  padding: 0.7em 1.4em; background: none; border: none; cursor: pointer;
  font-family: 'Space Grotesk', sans-serif; font-size: 0.95em; color: var(--ink-mute);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover  { color: var(--ink); }

/* ─── FORMS ──────────────────────────────────────────────────────────── */
.form-row { margin-bottom: 1.1rem; }
.form-row label {
  display: block; font-family: 'Space Grotesk', sans-serif; font-size: 0.86em;
  font-weight: 500; color: var(--ink-soft); margin-bottom: 0.3em;
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 0.65em 0.85em;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-elev); color: var(--ink); font: inherit;
  font-size: 0.97em; transition: border 0.15s, box-shadow 0.15s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,77,216,0.12);
}
.form-row.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
textarea { resize: vertical; min-height: 90px; font-family: 'Lora', Georgia, serif; }
.field-hint { font-size: 0.85em; color: var(--ink-mute); margin-top: 0.3em; }

button, .btn {
  font-family: 'Space Grotesk', sans-serif; font-size: 0.95em; font-weight: 500;
  padding: 0.65em 1.25em; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s;
  background: var(--accent); color: #fff;
}
button:hover, .btn:hover { background: var(--accent-deep); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--ink-soft); border-color: var(--line);
}
.btn-ghost:hover { background: var(--line-soft); color: var(--ink); }
.btn-coral { background: var(--coral); }
.btn-coral:hover { background: #c94a3a; }
.btn-sm { font-size: 0.85em; padding: 0.4em 0.85em; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #1f6e43; }
.btn-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }

.alert {
  padding: 0.7em 1em; border-radius: var(--radius); font-size: 0.92em; margin-bottom: 1rem;
  border: 1px solid var(--coral); background: var(--coral-soft); color: #8b2a1a;
}
.alert-ok { border-color: var(--ok); background: var(--ok-soft); color: #1d5634; }
.alert-warn { border-color: var(--warn); background: var(--warn-soft); color: #6b4500; }

/* ─── APP SHELL ──────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #1f2433;
  color: #c8d0e8;
  padding: 1.6rem 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--ink);
}
.sidebar .brand {
  padding: 0 1.6rem 1.4rem;
  border-bottom: 1px solid #2e3447;
  margin-bottom: 1.1rem;
}
.sidebar .brand .mark {
  display: block; font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 0.78em; letter-spacing: 0.16em; color: #e85b4a; margin-bottom: 0.2em;
}
.sidebar .brand .name {
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; color: #fffdf6;
  font-size: 1.05em; line-height: 1.3;
}
.nav-group { padding: 0.8rem 0 0.4rem; }
.nav-group-label {
  font-family: 'Space Grotesk', sans-serif; font-size: 0.72em;
  text-transform: uppercase; letter-spacing: 0.12em; color: #7c8298;
  padding: 0 1.6rem 0.5rem;
}
.nav-item {
  display: block; padding: 0.5em 1.6rem; color: #c8d0e8;
  font-size: 0.95em; cursor: pointer; border-left: 3px solid transparent;
  transition: all 0.12s; text-decoration: none;
}
.nav-item:hover { background: #2c3247; color: #fffdf6; text-decoration: none; }
.nav-item.active { background: rgba(30,77,216,0.18); color: #fffdf6; border-left-color: var(--accent); }

.user-card {
  margin: 1.6rem 1.1rem 0; padding: 0.85em 1em;
  background: #2c3247; border-radius: var(--radius); font-size: 0.88em;
}
.user-card .name { font-weight: 600; color: #fffdf6; font-family: 'Space Grotesk', sans-serif; }
.user-card .role { color: #c8d0e8; font-size: 0.85em; text-transform: capitalize; }
.user-card .signout {
  display: inline-block; margin-top: 0.6em; background: none; color: #e85b4a;
  padding: 0; font-size: 0.85em; border: none; cursor: pointer; font-family: 'Space Grotesk', sans-serif;
}
.user-card .signout:hover { text-decoration: underline; }

/* ─── MAIN AREA ──────────────────────────────────────────────────────── */
.main { padding: 2rem 2.4rem 4rem; max-width: 1100px; }
.page-head { margin-bottom: 1.8rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line); }
.page-head h1 { margin-bottom: 0.15em; }
.page-head .crumb {
  font-family: 'Space Grotesk', sans-serif; font-size: 0.82em;
  color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.1em;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ─── CARDS ──────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.2rem;
}
.card.flat { box-shadow: none; }
.card h2, .card h3 { margin-top: 0; }
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.9rem;
}
.card-head h3 { margin: 0; }

.stat {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.05rem 1.15rem;
}
.stat .label {
  font-family: 'Space Grotesk', sans-serif; font-size: 0.78em;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute);
}
.stat .value {
  font-family: 'Space Grotesk', sans-serif; font-size: 1.95em;
  font-weight: 600; color: var(--ink); margin-top: 0.2em; line-height: 1;
}
.stat .sub { font-size: 0.85em; color: var(--ink-soft); margin-top: 0.3em; }
.stat.accent { border-color: var(--accent); }
.stat.accent .value { color: var(--accent); }
.stat.coral { border-color: var(--coral); }
.stat.coral .value { color: var(--coral); }

/* ─── BADGES & PILLS ────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 0.18em 0.6em; border-radius: 999px;
  font-family: 'Space Grotesk', sans-serif; font-size: 0.78em; font-weight: 500;
  background: var(--line-soft); color: var(--ink-soft);
}
.badge.accent { background: var(--accent-soft); color: var(--accent-deep); }
.badge.ok     { background: var(--ok-soft); color: #1d5634; }
.badge.coral  { background: var(--coral-soft); color: #8b2a1a; }
.badge.warn   { background: var(--warn-soft); color: #6b4500; }

/* ─── TABLES ─────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 0.92em; }
th { text-align: left; font-family: 'Space Grotesk', sans-serif; font-weight: 500;
     font-size: 0.82em; text-transform: uppercase; letter-spacing: 0.06em;
     color: var(--ink-mute); padding: 0.55em 0.6em; border-bottom: 1px solid var(--line); }
td { padding: 0.7em 0.6em; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:hover td { background: rgba(30,77,216,0.04); }
.table-actions { display: flex; gap: 0.4rem; }
td.num { font-variant-numeric: tabular-nums; }

/* ─── MODULE CARDS & LESSON BODY ────────────────────────────────────── */
.module-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.2rem 1.4rem; margin-bottom: 0.95rem;
  cursor: pointer; transition: box-shadow 0.15s, transform 0.15s;
}
.module-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.module-card .module-num {
  font-family: 'Space Grotesk', sans-serif; font-size: 0.78em;
  color: var(--coral); letter-spacing: 0.1em; font-weight: 600;
}
.module-card h3 { margin: 0.15em 0 0.3em; }
.module-card .summary { color: var(--ink-soft); font-size: 0.95em; }
.module-card .meta {
  display: flex; gap: 0.7rem; margin-top: 0.6rem; font-size: 0.85em; color: var(--ink-mute);
}

.lesson { margin-bottom: 1.8rem; }
.lesson-body {
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 1.3rem 1.5rem;
  white-space: pre-wrap;
}
.lesson-body strong { color: var(--ink); }

/* ─── MCQ RUNNER ─────────────────────────────────────────────────────── */
.mcq-q { margin-bottom: 1.6rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--line-soft); }
.mcq-q:last-child { border-bottom: none; }
.mcq-q .stem { font-weight: 500; margin-bottom: 0.7rem; }
.mcq-opt {
  display: block; padding: 0.55em 0.85em; margin-bottom: 0.4rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-elev); cursor: pointer; transition: all 0.12s;
}
.mcq-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.mcq-opt input { margin-right: 0.6em; }
.mcq-opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.mcq-opt.correct  { border-color: var(--ok); background: var(--ok-soft); }
.mcq-opt.wrong    { border-color: var(--coral); background: var(--coral-soft); }
.mcq-explain {
  margin-top: 0.55em; padding: 0.6em 0.9em; background: var(--line-soft);
  border-radius: var(--radius); font-size: 0.9em; color: var(--ink-soft);
}

/* ─── PROGRESS BARS ──────────────────────────────────────────────────── */
.bar { display: flex; align-items: center; gap: 0.6rem; margin: 0.2rem 0; }
.bar-label { font-size: 0.85em; min-width: 120px; color: var(--ink-soft); }
.bar-track {
  flex: 1; height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden;
}
.bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.4s; }
.bar-fill.coral { background: var(--coral); }
.bar-fill.ok { background: var(--ok); }
.bar-val { font-family: 'Space Grotesk', sans-serif; font-size: 0.85em; color: var(--ink-soft); min-width: 35px; text-align: right; }

/* ─── WORKBOOK: 5 WHYS / FISHBONE / MATRIX / SWOT / ARGMAP ──────────── */
.whys-step {
  display: grid; grid-template-columns: 24px 1fr; gap: 0.7rem; margin-bottom: 0.6rem; align-items: start;
}
.whys-num {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; color: var(--coral);
  font-size: 0.95em; padding-top: 0.5em;
}

.fish-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.fish-cat {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem;
}
.fish-cat h4 { margin: 0 0 0.5em; color: var(--accent); font-size: 0.85em; }
.fish-cat textarea { font-size: 0.92em; min-height: 90px; }

.matrix-table th, .matrix-table td { font-size: 0.9em; padding: 0.5em 0.5em; }
.matrix-table input[type=number] { width: 60px; padding: 0.3em; }
.matrix-row-total { font-family: 'Space Grotesk', sans-serif; font-weight: 600; color: var(--accent); }

.swot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.swot-q { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.swot-q.S { border-top: 4px solid var(--ok); }
.swot-q.W { border-top: 4px solid var(--coral); }
.swot-q.O { border-top: 4px solid var(--accent); }
.swot-q.T { border-top: 4px solid var(--warn); }
.swot-q h4 { margin: 0 0 0.5em; }

.argmap-block {
  margin-bottom: 0.7rem; padding: 0.85em 1em; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-elev);
}
.argmap-block .label {
  font-family: 'Space Grotesk', sans-serif; font-size: 0.78em;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute);
  margin-bottom: 0.3em;
}
.argmap-block.conclusion { border-color: var(--accent); background: var(--accent-soft); }
.argmap-block.fallacy    { border-left: 4px solid var(--coral); }

/* ─── ITEM LIST (saved workbook items, reflections) ─────────────────── */
.item-list { display: flex; flex-direction: column; gap: 0.7rem; }
.item-row {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.85em 1.05em; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.item-row .title { font-weight: 500; }
.item-row .meta { font-size: 0.85em; color: var(--ink-mute); font-family: 'Space Grotesk', sans-serif; }

/* ─── ASSESSMENT RESULT CHARTS ──────────────────────────────────────── */
.result-summary {
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: var(--radius-lg); padding: 1.2rem 1.4rem; margin-bottom: 1.4rem;
}
.result-summary .score {
  font-family: 'Space Grotesk', sans-serif; font-size: 2.2em; font-weight: 600; color: var(--accent-deep);
}
.result-summary .interp { color: var(--ink-soft); margin-top: 0.3em; }

/* ─── TEAM / CAPSTONE ────────────────────────────────────────────────── */
.team-card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.3rem 1.5rem; }
.team-members { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5em; }
.member-chip {
  display: inline-block; padding: 0.25em 0.7em; background: var(--line-soft); color: var(--ink-soft);
  border-radius: 999px; font-size: 0.85em; font-family: 'Space Grotesk', sans-serif;
}
.note-item {
  background: var(--bg-elev); border: 1px solid var(--line-soft); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 0.7em 0.95em; margin-bottom: 0.55em;
}
.note-meta { font-size: 0.82em; color: var(--ink-mute); font-family: 'Space Grotesk', sans-serif; }

/* ─── EMPTY STATES ───────────────────────────────────────────────────── */
.empty {
  padding: 2.5rem 1.5rem; text-align: center; color: var(--ink-mute);
  border: 1px dashed var(--line); border-radius: var(--radius-lg);
  background: var(--bg-elev);
}
.empty .icon { font-size: 1.8em; margin-bottom: 0.3em; opacity: 0.5; }

/* ─── UTILITY ────────────────────────────────────────────────────────── */
.flex { display: flex; gap: 0.7rem; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.text-mute { color: var(--ink-mute); }
.text-soft { color: var(--ink-soft); }
.text-coral { color: var(--coral); }
.text-accent { color: var(--accent); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.6rem; } .mt-2 { margin-top: 1.2rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.6rem; } .mb-2 { margin-bottom: 1.2rem; }
.small { font-size: 0.88em; }
hr.thin { border: none; border-top: 1px solid var(--line-soft); margin: 1rem 0; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .landing { grid-template-columns: 1fr; }
  .landing-hero { padding: 2.5rem 1.8rem; }
  .landing-form { padding: 2.5rem 1.8rem; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .grid-2, .grid-3, .grid-4, .fish-grid, .swot-grid { grid-template-columns: 1fr; }
  .main { padding: 1.5rem 1.2rem 3rem; }
}
