/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

/* ── Tokens ───────────────────────────────────────────────── */
:root {
  --white:       #ffffff;
  --bg:          #f8f7f4;
  --bg2:         #f0ede8;
  --border:      #e2ddd6;
  --border2:     #ccc8c0;
  --text:        #1a1a18;
  --text2:       #4a4a46;
  --text3:       #8a8a84;
  --navy:        #0f2040;
  --navy2:       #1a3560;
  --amber:       #d97706;
  --amber-light: #fef3c7;
  --green:       #059669;
  --green-light: #d1fae5;
  --red:         #dc2626;
  --red-light:   #fee2e2;
  --blue:        #2563eb;
  --blue-light:  #dbeafe;
  --purple:      #7c3aed;
  --purple-light:#ede9fe;
  --radius:      8px;
  --radius-lg:   14px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
  --shadow-lg:   0 4px 6px rgba(0,0,0,.06), 0 10px 40px rgba(0,0,0,.1);
  --font:        'Inter', system-ui, sans-serif;
  --mono:        'JetBrains Mono', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ───────────────────────────────────────────── */
h1 { font-size: 2.5rem;  font-weight: 700; line-height: 1.15; }
h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.2;  }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.3;  }
h4 { font-size: 1rem;    font-weight: 600; }
p  { color: var(--text2); }
a  { color: var(--navy);  text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .875rem; background: var(--bg2); padding: 1px 5px; border-radius: 4px; }

/* ── Nav ──────────────────────────────────────────────────── */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { font-weight: 700; font-size: 1.1rem; color: var(--navy); }
.nav-logo span { color: var(--amber); }
.nav-links { display: flex; align-items: center; gap: 20px; font-size: .9rem; }
.nav-links a { color: var(--text2); font-weight: 500; }
.nav-links a:hover { color: var(--navy); text-decoration: none; }
.nav-tier {
  font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 99px; text-transform: uppercase;
}
.tier-free       { background: var(--bg2);         color: var(--text3); }
.tier-developer  { background: var(--blue-light);  color: var(--blue);  }
.tier-architect  { background: var(--purple-light); color: var(--purple);}
.tier-executive  { background: var(--amber-light); color: var(--amber); }
.tier-team       { background: var(--navy);        color: var(--white); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent; transition: all .15s;
  text-decoration: none; font-family: var(--font);
}
.btn-primary  { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy2); text-decoration: none; }
.btn-amber    { background: var(--amber); color: var(--white); }
.btn-amber:hover { filter: brightness(1.1); text-decoration: none; }
.btn-ghost    { background: transparent; border-color: var(--border2); color: var(--text2); }
.btn-ghost:hover { border-color: var(--text3); color: var(--text); text-decoration: none; }
.btn-sm       { padding: 6px 14px; font-size: .82rem; }
.btn-full     { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
}

/* ── Container ────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 520px; margin: 0 auto; padding: 0 24px; }
.container-md { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ── Flash ────────────────────────────────────────────────── */
.flash-stack { position: fixed; top: 70px; right: 16px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 20px; border-radius: var(--radius); font-size: .875rem; font-weight: 500; box-shadow: var(--shadow-lg); }
.flash-success { background: var(--green-light); color: var(--green); border: 1px solid var(--green); }
.flash-error   { background: var(--red-light);   color: var(--red);   border: 1px solid var(--red);   }
.flash-info    { background: var(--blue-light);  color: var(--blue);  border: 1px solid var(--blue);  }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border2); border-radius: var(--radius);
  font-size: .9rem; font-family: var(--font); background: var(--white);
  color: var(--text); transition: border-color .15s;
}
.form-input:focus { outline: none; border-color: var(--navy); }
.form-input.error { border-color: var(--red); }
.form-hint  { font-size: .8rem; color: var(--text3); margin-top: 4px; }
.form-error { font-size: .8rem; color: var(--red);   margin-top: 4px; }
textarea.form-input { resize: vertical; min-height: 120px; font-family: var(--mono); font-size: .85rem; }

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-block; font-size: .72rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 99px;
}
.badge-dev  { background: var(--blue-light);   color: var(--blue);   }
.badge-arch { background: var(--purple-light);  color: var(--purple); }
.badge-exec { background: var(--amber-light);  color: var(--amber);  }
.badge-free { background: var(--bg2); color: var(--text3); }
.badge-done { background: var(--green-light);  color: var(--green);  }
.badge-locked { background: var(--bg2); color: var(--text3); }

/* ── Progress bar ─────────────────────────────────────────── */
.progress-bar { height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--navy); border-radius: 99px; transition: width .4s; }

/* ── Score ring ───────────────────────────────────────────── */
.score-ring { display: flex; align-items: center; justify-content: center; flex-direction: column; }
.score-number { font-size: 2rem; font-weight: 700; color: var(--navy); }
.score-label  { font-size: .75rem; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* ── Grid helpers ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  h1 { font-size: 1.75rem; }
}

/* ── Spacers ──────────────────────────────────────────────── */
.mt-8  { margin-top:  8px;  } .mb-8  { margin-bottom:  8px;  }
.mt-16 { margin-top: 16px;  } .mb-16 { margin-bottom: 16px;  }
.mt-24 { margin-top: 24px;  } .mb-24 { margin-bottom: 24px;  }
.mt-40 { margin-top: 40px;  } .mb-40 { margin-bottom: 40px;  }
.mt-64 { margin-top: 64px;  } .mb-64 { margin-bottom: 64px;  }

/* ── Divider ──────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Locked overlay ───────────────────────────────────────── */
.locked { opacity: .45; pointer-events: none; position: relative; }
.lock-icon { font-size: 1.1rem; }

/* ── Footer ───────────────────────────────────────────────── */
.footer { margin-top: auto; padding: 24px; border-top: 1px solid var(--border); }
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  font-size: .8rem; color: var(--text3);
}
.footer-inner a { color: var(--text3); }

/* ── Landing hero ─────────────────────────────────────────── */
.hero { padding: 80px 24px 64px; text-align: center; }
.hero h1 { max-width: 700px; margin: 0 auto 20px; }
.hero p { max-width: 540px; margin: 0 auto 32px; font-size: 1.1rem; }
.hero-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.hero-tag {
  display: inline-block; background: var(--amber-light); color: var(--amber);
  font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 99px; margin-bottom: 20px;
}

/* ── Track cards on landing ───────────────────────────────── */
.track-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  border-top: 4px solid var(--navy);
}
.track-card.amber { border-top-color: var(--amber);  }
.track-card.purple{ border-top-color: var(--purple); }

/* ── Pricing cards ────────────────────────────────────────── */
.pricing-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
  box-shadow: var(--shadow); position: relative;
}
.pricing-card.popular {
  border-color: var(--navy);
  box-shadow: 0 0 0 1px var(--navy), var(--shadow-lg);
}
.pricing-card .popular-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: var(--white);
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 14px; border-radius: 99px;
}
.price-amount { font-size: 2.5rem; font-weight: 700; color: var(--navy); line-height: 1; }
.price-period { font-size: .9rem; color: var(--text3); }
.pricing-features { list-style: none; margin: 20px 0; }
.pricing-features li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.pricing-features li::before { content: "✓"; color: var(--green); font-weight: 700; flex-shrink: 0; }
.pricing-features li.na { color: var(--text3); }
.pricing-features li.na::before { content: "—"; color: var(--border2); }

/* ── Dashboard ────────────────────────────────────────────── */
.page-header { padding: 32px 0 0; }
.page-header h2 { font-size: 1.4rem; }
.track-section { margin-top: 40px; }
.track-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text3); margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.track-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.level-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  cursor: pointer; transition: all .15s; position: relative;
}
.level-card:hover { border-color: var(--navy); box-shadow: var(--shadow); transform: translateY(-2px); }
.level-card.completed { border-color: var(--green); }
.level-card.locked    { cursor: default; }
.level-card.locked:hover { transform: none; box-shadow: none; border-color: var(--border); }
.level-number { font-size: .75rem; font-weight: 700; color: var(--text3); margin-bottom: 6px; }
.level-title  { font-size: .9rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.level-tagline{ font-size: .78rem; color: var(--text3); line-height: 1.4; }
.level-score  { position: absolute; top: 12px; right: 12px; font-size: .75rem; font-weight: 700; color: var(--green); }

/* ── Level page ───────────────────────────────────────────── */
.level-page { padding: 40px 0 80px; }
.level-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.level-what-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  font-size: .9rem; color: var(--text2); margin-bottom: 20px;
}
.level-what-box strong { color: var(--text); }

/* Chat bubbles */
.chat-window {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); height: 380px;
  overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.bubble { max-width: 75%; padding: 12px 16px; border-radius: 12px; font-size: .9rem; line-height: 1.55; }
.bubble-ai   { background: var(--bg2); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble-user { background: var(--navy); color: #fff;      align-self: flex-end;   border-bottom-right-radius: 4px; }
.bubble-label{ font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 4px; color: var(--text3); }

.chat-input-row { display: flex; gap: 10px; margin-top: 12px; }
.chat-input-row .form-input { flex: 1; }

/* Grade result box */
.grade-result {
  border-radius: var(--radius-lg); padding: 24px;
  margin-top: 20px; display: none;
}
.grade-result.show { display: block; }
.grade-result.pass { background: var(--green-light); border: 1.5px solid var(--green); }
.grade-result.fail { background: var(--red-light);   border: 1.5px solid var(--red);   }
.grade-result h3 { font-size: 1.1rem; margin-bottom: 8px; }
.grade-result .feedback { font-size: .9rem; color: var(--text2); white-space: pre-wrap; }
.ai-label { font-size: .72rem; color: var(--text3); margin-top: 12px; }

/* ── Admin ────────────────────────────────────────────────── */
.admin-page { padding: 32px 0 80px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--navy); }
.stat-label { font-size: .8rem; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th { background: var(--bg2); padding: 10px 14px; text-align: left; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tr:hover td { background: var(--bg); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--white); }

/* ── Loading spinner ──────────────────────────────────────── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--navy); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth page ────────────────────────────────────────────── */
.auth-page { min-height: calc(100vh - 60px); display: flex; align-items: center; padding: 40px 0; }
.auth-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; box-shadow: var(--shadow-lg); }
.auth-logo { font-size: 1.3rem; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.auth-logo span { color: var(--amber); }
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.auth-tab { flex: 1; padding: 10px; text-align: center; font-size: .875rem; font-weight: 600; color: var(--text3); cursor: pointer; border-bottom: 2px solid transparent; transition: all .15s; }
.auth-tab.active { color: var(--navy); border-bottom-color: var(--navy); }
