/* ========================================================================
   CKA Exam Lab — Utilitarian design system
   Warm off-white parchment · hairline rules · IBM Plex Sans + JetBrains Mono
   One steel-blue accent. No gradients, minimal shadows, square edges.
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* surfaces */
  --bg:           #f4f3ed;         /* warm parchment */
  --surface:      #ffffff;
  --surface-2:    #fafaf5;
  --surface-3:    #efeee7;
  --tint:         #e9e7dd;

  /* line */
  --line:         #d9d6cb;
  --line-2:       #c2bfb2;
  --line-strong:  #1a1a17;

  /* ink */
  --ink:          #18181a;
  --ink-2:        #36352f;
  --ink-3:        #5a5851;
  --muted:        #7e7c72;
  --muted-2:      #9b998f;

  /* accent — steel blue, single-hue family */
  --accent:       oklch(0.46 0.12 248);
  --accent-ink:   oklch(0.32 0.10 248);
  --accent-soft:  oklch(0.96 0.025 248);
  --accent-line:  oklch(0.85 0.05 248);

  /* status (chroma matched, hue varied) */
  --ok:           oklch(0.50 0.11 148);
  --ok-soft:      oklch(0.96 0.03 148);
  --warn:         oklch(0.62 0.13 75);
  --warn-soft:    oklch(0.96 0.04 80);
  --danger:       oklch(0.52 0.18 28);
  --danger-soft:  oklch(0.96 0.03 28);

  /* type */
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --radius:       2px;
  --radius-lg:    3px;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Layout primitives ─────────────────────────────────────────────────── */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.app-main { padding: 0; overflow: auto; }

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 16px 16px;
  display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 4px 16px;
  border-bottom: 1px dashed var(--line);
}
.side-brand .mark {
  width: 28px; height: 28px;
  background: var(--ink); color: var(--bg);
  font-family: var(--mono); font-weight: 700; font-size: 11px;
  display: grid; place-items: center;
  border-radius: var(--radius);
  letter-spacing: -0.02em;
}
.side-brand .name {
  font-weight: 600; font-size: 14px;
  letter-spacing: -0.005em;
}
.side-brand .sub {
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
  margin-top: 1px;
}
.side-section {
  display: flex; flex-direction: column; gap: 2px;
}
.side-section h3 {
  margin: 0 8px 6px;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted);
}
.nav-btn {
  border: 0; background: transparent;
  color: var(--ink-2); text-align: left;
  padding: 8px 10px;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  cursor: pointer; border-radius: var(--radius);
  display: flex; align-items: center; gap: 9px;
  position: relative;
}
.nav-btn::before {
  content: ''; width: 4px; height: 4px;
  background: var(--line-2); border-radius: 50%;
  flex-shrink: 0;
}
.nav-btn:hover { background: var(--surface-3); color: var(--ink); }
.nav-btn.active {
  background: var(--ink); color: #fff;
}
.nav-btn.active::before { background: var(--accent); }

.discord-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.discord-mark {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--accent-ink);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.discord-mark svg {
  width: 13px;
  height: 13px;
  display: block;
  fill: currentColor;
}
.discord-link:hover .discord-mark {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.side-meta {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-family: var(--mono); font-size: 11px; line-height: 1.7;
  color: var(--muted);
}
.side-meta .row { display: flex; justify-content: space-between; }
.side-meta .row .v { color: var(--ink-2); }

/* ── Topline ───────────────────────────────────────────────────────────── */
.topline {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topline .crumb {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.topline h1 {
  margin: 0; font-size: 22px; font-weight: 600;
  letter-spacing: -0.015em;
}
.topline .sub {
  margin-top: 4px; color: var(--muted); font-size: 13px;
}
.topline-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--line-strong);
  background: var(--ink); color: #fff;
  padding: 8px 14px;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius);
  display: inline-flex; align-items: center; gap: 7px;
  letter-spacing: -0.005em;
  transition: background .12s;
}
.btn:hover { background: var(--ink-2); }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-2);
}
.btn-ghost:hover { background: var(--surface-3); border-color: var(--line-strong); }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-ink); border-color: var(--accent-ink); }

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger-soft); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Surface / Panel ───────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel-pad { padding: 18px 20px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.panel-head h2 {
  margin: 0; font-size: 12px; font-weight: 600;
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-2);
}
.panel-head .meta {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.panel-body { padding: 18px 20px; }
.panel-body.flush { padding: 0; }

/* ── Section grid ──────────────────────────────────────────────────────── */
.section { padding: 22px 28px; }
.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(5, 1fr); }
.grid-2 { grid-template-columns: minmax(280px, 380px) 1fr; align-items: start; }
.profile-panel { max-width: 760px; }

/* ── Stat card ─────────────────────────────────────────────────────────── */
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
}
.stat-label {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em;
}
.stat-value {
  margin-top: 14px;
  font-family: var(--mono); font-size: 30px; font-weight: 500;
  color: var(--ink); letter-spacing: -0.02em;
  font-feature-settings: 'tnum';
  line-height: 1;
}
.stat-value .unit { color: var(--muted); font-size: 18px; margin-left: 2px; }
.stat-note {
  margin-top: 8px;
  font-size: 11px; color: var(--muted);
  font-family: var(--mono);
}
.stat .marker {
  position: absolute; top: 0; left: 18px;
  width: 24px; height: 2px; background: var(--ink);
}
.stat.readiness-low {
  border-color: color-mix(in oklch, var(--danger) 55%, var(--line));
  background: color-mix(in oklch, var(--danger-soft) 62%, var(--surface));
}
.stat.readiness-mid {
  border-color: color-mix(in oklch, var(--warn) 55%, var(--line));
  background: color-mix(in oklch, var(--warn-soft) 62%, var(--surface));
}
.stat.readiness-ready {
  border-color: color-mix(in oklch, var(--ok) 55%, var(--line));
  background: color-mix(in oklch, var(--ok-soft) 62%, var(--surface));
}
.stat.readiness-low .marker { background: var(--danger); }
.stat.readiness-mid .marker { background: var(--warn); }
.stat.readiness-ready .marker { background: var(--ok); }
.stat.readiness-low .stat-value { color: var(--danger); }
.stat.readiness-mid .stat-value { color: var(--warn); }
.stat.readiness-ready .stat-value { color: var(--ok); }
.stat:nth-child(2) .marker { background: var(--accent); }
.stat:nth-child(3) .marker { background: var(--ok); width: 16px; }
.stat:nth-child(4) .marker { background: var(--line-2); width: 8px; }

/* ── Definition rows ───────────────────────────────────────────────────── */
.def-row {
  display: grid; grid-template-columns: 120px 1fr;
  gap: 12px; padding: 11px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  align-items: baseline;
}
.def-row:last-child { border-bottom: 0; }
.def-label {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
}
.def-value { color: var(--ink); font-weight: 500; }

/* ── Attempt / table rows ──────────────────────────────────────────────── */
.row-table { display: flex; flex-direction: column; }
.row-head, .attempt-row {
  display: grid;
  grid-template-columns: 60px 1fr 90px 80px 90px;
  gap: 14px; align-items: center;
  padding: 10px 18px;
}
.row-head {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em;
}
.attempt-row {
  border-bottom: 1px solid var(--line);
  font-size: 13px; cursor: pointer;
  transition: background .1s;
}
.attempt-row:last-child { border-bottom: 0; }
.attempt-row:hover { background: var(--surface-2); }
.attempt-row .idx {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.attempt-row .meta {
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  min-width: 0;
}
.attempt-row .meta .sub {
  display: block; font-size: 11px; color: var(--muted); margin-top: 2px;
}
.attempt-row > div { min-width: 0; }
.score-cell {
  font-family: var(--mono); font-weight: 500; font-size: 14px;
  font-feature-settings: 'tnum';
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.score-cell::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--line-2);
}
.score-cell.pass::before { background: var(--ok); }
.score-cell.fail::before { background: var(--danger); }

.status-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: var(--radius);
  border: 1px solid currentColor;
  background: transparent;
}
.status-tag.ok    { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.status-tag.warn  { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.status-tag.danger{ color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.status-tag.muted { color: var(--muted); border-color: var(--line); }

.status-pass { color: var(--ok); font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.status-review { color: var(--warn); font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }

.score-pill {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 500; font-size: 13px;
  font-feature-settings: 'tnum';
  padding: 3px 8px;
  background: var(--ink); color: #fff;
  border-radius: var(--radius);
  letter-spacing: -0.01em;
}

/* expanded attempt detail */
.attempt-detail {
  display: none;
  padding: 0 18px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.attempt-detail.open { display: block; }
.q-row {
  display: grid; grid-template-columns: 1fr auto;
  gap: 12px; align-items: start;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 3px;
  margin-top: 10px;
  border-radius: var(--radius);
  font-size: 13px;
}
.q-row.correct { border-left-color: var(--ok); }
.q-row.partial { border-left-color: var(--warn); }
.q-row.wrong   { border-left-color: var(--danger); }
.q-title { font-weight: 600; color: var(--ink); }
.q-status {
  font-family: var(--mono); font-weight: 600; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em;
  white-space: nowrap;
}
.q-status.correct { color: var(--ok); }
.q-status.partial { color: var(--warn); }
.q-status.wrong   { color: var(--danger); }
.review-block {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.review-block.solution {
  background: var(--surface);
  border-left: 3px solid var(--accent);
}
.review-label {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.review-md {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.65;
}
.review-md p { margin: 8px 0; }
.review-md p:first-child { margin-top: 0; }
.review-md p:last-child { margin-bottom: 0; }
.review-md ul { margin: 8px 0; padding-left: 20px; }
.review-md li { margin: 4px 0; }
.review-md strong { color: var(--ink); font-weight: 600; }
.review-md code {
  background: var(--surface-3); color: var(--accent-ink);
  padding: 2px 5px; border-radius: var(--radius);
  border: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px;
}
.review-md pre {
  margin: 10px 0;
  padding: 11px 12px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
  color: var(--ink-2);
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  border-radius: var(--radius);
}
.review-md pre code {
  background: none; border: 0; padding: 0; color: inherit;
}

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty {
  border: 1px dashed var(--line-2);
  padding: 28px;
  background: var(--surface-2);
  text-align: center;
  color: var(--muted); font-size: 13px;
  border-radius: var(--radius);
}
.empty::before {
  content: '∅';
  display: block;
  font-family: var(--mono);
  font-size: 22px; color: var(--line-2);
  margin-bottom: 8px;
}

/* ── Lab callout ───────────────────────────────────────────────────────── */
.lab-grid {
  display: grid; grid-template-columns: minmax(280px, 1fr) 320px;
  gap: 16px;
}
.lab-callout {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.lab-callout::before {
  content: ''; position: absolute; top: 0; left: 0; height: 3px;
  width: 80px; background: var(--ink);
}
.lab-callout h2 {
  margin: 0 0 6px; font-size: 18px; font-weight: 600;
  letter-spacing: -0.01em;
}
.steps { margin-top: 22px; display: grid; gap: 14px; }
.step {
  display: grid; grid-template-columns: 32px 1fr;
  gap: 14px; align-items: start;
  font-size: 13px; color: var(--ink-2);
}
.step-num {
  width: 24px; height: 24px;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  border-radius: var(--radius);
}

/* ── Auth pages ────────────────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 460px;
  background: var(--bg);
}
.auth-aside {
  background: var(--ink); color: var(--bg);
  padding: 40px 44px;
  display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--line-strong);
  overflow: hidden;
  position: relative;
}
.auth-aside .logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; letter-spacing: -0.005em;
}
.auth-aside .logo .mark {
  width: 26px; height: 26px;
  background: var(--bg); color: var(--ink);
  font-family: var(--mono); font-weight: 700; font-size: 10px;
  display: grid; place-items: center;
  border-radius: var(--radius);
}
.auth-tagline {
  font-size: 32px; font-weight: 500;
  line-height: 1.18; letter-spacing: -0.02em;
  max-width: 460px;
}
.auth-tagline .accent { color: oklch(0.85 0.10 248); }
.auth-meta {
  font-family: var(--mono); font-size: 11px;
  color: oklch(0.62 0.02 248);
  display: grid; gap: 8px;
}
.auth-meta .row {
  display: grid; grid-template-columns: 100px 1fr;
  border-top: 1px dashed oklch(0.30 0.02 248);
  padding-top: 8px;
}
.auth-meta .k { color: oklch(0.55 0.02 248); }
.auth-meta .v { color: oklch(0.85 0.02 248); }

.auth-card {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 36px;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
.auth-form {
  width: 100%; max-width: 360px;
}
.auth-form h1 {
  margin: 0 0 4px;
  font-size: 22px; font-weight: 600; letter-spacing: -0.015em;
}
.auth-form .sub {
  color: var(--muted); font-size: 13px; margin-bottom: 24px;
}
label {
  display: block;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); margin: 14px 0 6px;
}
.input, input[type="text"], input[type="email"], input[type="password"], input[type="search"], select {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  font-family: var(--sans); font-size: 13px;
  color: var(--ink);
  outline: 0;
  transition: border .12s, background .12s;
}
.input:focus, input:focus, select:focus {
  border-color: var(--ink);
  background: var(--surface);
}
.hint {
  margin-top: 6px;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  letter-spacing: 0.02em;
}
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0;
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
.btn-google {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink); padding: 9px 12px; border-radius: var(--radius);
  font-family: var(--sans); font-weight: 500; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-google:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn-google svg { width: 16px; height: 16px; flex-shrink: 0; }
.error {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  font-family: var(--mono); font-size: 12px;
  border-radius: var(--radius);
  display: none;
}
.auth-footer {
  text-align: center; margin-top: 18px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}

/* ── Misc ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.subtle { color: var(--muted); }
.mono { font-family: var(--mono); }
.notice {
  padding: 10px 12px;
  background: var(--surface-2);
  border-left: 2px solid var(--line-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
}
.kbd {
  font-family: var(--mono); font-size: 11px;
  padding: 1px 6px; background: var(--surface-3);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  color: var(--ink-2);
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side-section { flex: 1; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .lab-grid { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { padding: 24px; }
  .row-head, .attempt-row { grid-template-columns: 50px minmax(0, 1fr) 70px 70px; }
  .row-head .col-status, .attempt-row .col-status { display: none; }
}
