:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --business: #2563eb;
  --entrepreneurship: #ea580c;
  --leadership: #9333ea;
  --marketing: #e11d48;
  --finance: #16a34a;
  --planning: #0891b2;
  --accent: #2563eb;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; line-height: 1.3; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* NAV */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; height: 60px; gap: 32px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; font-weight: 700;
  color: var(--text); text-decoration: none;
}
.nav-logo {
  width: 32px; height: 32px; background: var(--accent); color: #fff;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 6px 14px; border-radius: 6px; font-size: 0.9rem; font-weight: 500;
  color: var(--muted); text-decoration: none; transition: all 0.15s;
}
.nav-link:hover, .nav-link.active { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 12px; }
.nav-name { font-weight: 600; font-size: 0.9rem; }
.nav-role {
  font-size: 0.75rem; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: 0.05em;
}
.nav-role.student { background: #dbeafe; color: #1d4ed8; }
.nav-role.instructor { background: #fef3c7; color: #92400e; }
.nav-logout { font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.nav-logout:hover { color: var(--danger); }

/* MAIN */
.main { max-width: 1280px; margin: 0 auto; padding: 32px 24px; }

/* FLASH */
.flash-container { margin-bottom: 20px; }
.flash {
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af;
  padding: 12px 16px; border-radius: var(--radius); font-size: 0.9rem;
  margin-bottom: 8px;
}

/* PAGE HEADER */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; }
.page-header p { color: var(--muted); margin-top: 4px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }

/* CARDS */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.card-sm { padding: 16px; }

/* GRID */
.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); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* STAT */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.85rem; color: var(--muted); }

/* PILL / BADGE */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-teal { background: #cffafe; color: #0e7490; }
.badge-gray { background: var(--surface2); color: var(--muted); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; font-size: 0.9rem;
  font-weight: 600; cursor: pointer; border: none; transition: all 0.15s;
  text-decoration: none; font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface2); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* FORMS */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 0.9rem; font-family: inherit;
  background: var(--surface); color: var(--text); transition: border 0.15s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; padding: 10px 14px; font-size: 0.8rem; font-weight: 600;
     text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
     border-bottom: 2px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* PROGRESS BAR */
.progress-bar-wrap { background: var(--surface2); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 20px; transition: width 0.4s; }
.progress-bar.business { background: var(--business); }
.progress-bar.entrepreneurship { background: var(--entrepreneurship); }
.progress-bar.leadership { background: var(--leadership); }
.progress-bar.marketing { background: var(--marketing); }
.progress-bar.finance { background: var(--finance); }
.progress-bar.planning { background: var(--planning); }

/* PILLAR CARDS */
.pillar-card { border-left: 4px solid; }
.pillar-card.business { border-color: var(--business); }
.pillar-card.entrepreneurship { border-color: var(--entrepreneurship); }
.pillar-card.leadership { border-color: var(--leadership); }
.pillar-card.marketing { border-color: var(--marketing); }
.pillar-card.finance { border-color: var(--finance); }
.pillar-card.planning { border-color: var(--planning); }

/* CHAPTER */
.chapter-block { margin-bottom: 24px; }
.chapter-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; user-select: none;
}
.chapter-header:hover { background: var(--surface2); }
.chapter-title { font-weight: 600; font-size: 0.95rem; }
.chapter-sections { border: 1px solid var(--border); border-top: none;
                    border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.section-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  border-bottom: 1px solid var(--border); font-size: 0.88rem;
}
.section-row:last-child { border-bottom: none; }
.section-row:hover { background: var(--surface2); }
.section-check { width: 18px; height: 18px; border-radius: 4px; cursor: pointer; }
.section-text { flex: 1; }
.section-done { color: var(--muted); text-decoration: line-through; }

/* SNAPSHOT CARD */
.snapshot-card { padding: 18px 20px; }
.snapshot-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.snapshot-meta span { font-size: 0.82rem; color: var(--muted); }

/* EMPTY STATE */
.empty { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty h3 { font-size: 1.1rem; margin-bottom: 8px; }
.empty p { color: var(--muted); font-size: 0.9rem; margin-bottom: 20px; }

/* TABS */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 18px; font-size: 0.9rem; font-weight: 600;
  border: none; background: none; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s;
  font-family: inherit;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

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

/* LOGIN PAGE */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-box { width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .logo-mark {
  width: 56px; height: 56px; background: var(--accent); color: #fff;
  border-radius: 14px; font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem; font-weight: 700; display: flex; align-items: center;
  justify-content: center; margin: 0 auto 12px;
}
.auth-logo h1 { font-size: 1.5rem; }
.auth-logo p { color: var(--muted); font-size: 0.9rem; }

/* SNAPSHOT DETAIL */
.snapshot-section { margin-bottom: 28px; }
.snapshot-section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.data-row { display: flex; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.data-row:last-child { border-bottom: none; }
.data-key { width: 200px; font-weight: 600; color: var(--muted); flex-shrink: 0; }
.data-val { flex: 1; }

/* TERM HINTS */
.term-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}
.term-label {
  display: flex;
  align-items: center;
  gap: 5px;
}
.term-label .tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px; height: 15px;
  background: var(--surface2);
  border-radius: 50%;
  font-size: 0.65rem;
  color: var(--muted);
  cursor: default;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* PRINT */
@media print {
  .nav, .btn, .flash-container { display: none !important; }
  .main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
