:root {
  --ink-0: #f6f3ec;
  --ink-1: #d4d8e3;
  --ink-2: #9ca8bf;
  --base-0: #08131f;
  --base-1: #12283e;
  --base-2: #0f4454;
  --brand-gold: #f5b867;
  --brand-coral: #ff8f78;
  --brand-green: #6edfa0;
  --brand-red: #ff6b6b;
  --line: rgba(255, 255, 255, 0.12);
  --card-bg: rgba(11, 21, 34, 0.55);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Urbanist", sans-serif;
  color: var(--ink-0);
  background:
    radial-gradient(900px 650px at 10% 5%, rgba(245, 184, 103, 0.16), transparent 48%),
    radial-gradient(800px 600px at 92% 10%, rgba(255, 143, 120, 0.14), transparent 44%),
    radial-gradient(600px 500px at 50% 95%, rgba(15, 68, 84, 0.4), transparent 50%),
    linear-gradient(150deg, var(--base-0), var(--base-1) 55%, var(--base-2));
  overflow-x: hidden;
}

/* ==================== AMBIENT BLOBS ==================== */
.blob {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.28;
  pointer-events: none;
  z-index: -2;
}
.blob-a {
  width: 420px;
  height: 420px;
  left: -120px;
  top: 80px;
  background: var(--brand-gold);
}
.blob-b {
  width: 360px;
  height: 360px;
  right: -100px;
  bottom: 120px;
  background: var(--brand-coral);
}
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.07;
  background-image: radial-gradient(rgba(255, 255, 255, 0.5) 0.45px, transparent 0.45px);
  background-size: 3px 3px;
}

/* ==================== NAV ==================== */
.dash-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: rgba(8, 19, 31, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink-0);
}
.brand-lockup:focus-visible {
  outline: 2px solid rgba(137, 221, 204, 0.7);
  outline-offset: 2px;
  border-radius: 10px;
}
.logo-glyph {
  width: 34px;
  height: 34px;
  display: inline-block;
  filter: drop-shadow(0 8px 14px rgba(245, 184, 103, 0.2));
}
.logo-glyph img {
  width: 100%;
  height: 100%;
  display: block;
}
.brand-copy {
  display: inline-flex;
  flex-direction: column;
  line-height: 1;
  gap: 2px;
}
.brand-copy strong {
  font-family: "Cinzel", serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.brand-copy small {
  color: var(--ink-2);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-admin-link {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-gold);
  text-decoration: none;
  border: 1px solid rgba(245, 184, 103, 0.45);
  border-radius: 8px;
  padding: 6px 14px;
  transition: background 0.18s;
}
.nav-admin-link:hover {
  background: rgba(245, 184, 103, 0.12);
}
.nav-user {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-sign-out {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-family: "Urbanist", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-sign-out:hover {
  border-color: var(--brand-coral);
  color: var(--brand-coral);
}

/* ==================== MAIN LAYOUT ==================== */
.dash-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 28px 80px;
}

/* ==================== LOADING / ERROR ==================== */
.loading-shell,
.error-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 20px;
  text-align: center;
  color: var(--ink-2);
}
.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(245, 184, 103, 0.2);
  border-top-color: var(--brand-gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.error-icon {
  font-size: 40px;
  margin: 0;
  color: var(--brand-coral);
}
.error-shell h2 {
  font-family: "Cinzel", serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-0);
  margin: 0;
}
.error-shell p {
  font-size: 14px;
  margin: 0;
}

/* ==================== REVEAL ANIMATION ==================== */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ==================== WELCOME HERO ==================== */
.welcome-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.welcome-copy {
  flex: 1;
  min-width: 280px;
}
.welcome-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-gold);
  margin: 0 0 10px;
}
.welcome-hero h1 {
  font-family: "Cinzel", serif;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.15;
}
.welcome-sub {
  font-size: 15px;
  color: var(--ink-2);
  margin: 0;
  max-width: 520px;
  line-height: 1.6;
}
.status-badge-wrap {
  flex-shrink: 0;
  padding-top: 4px;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  font-size: 14px;
  font-weight: 600;
}
.badge-icon {
  font-size: 18px;
  line-height: 1;
}
.status-badge.status-complete {
  border-color: rgba(110, 223, 160, 0.4);
  background: rgba(110, 223, 160, 0.1);
  color: var(--brand-green);
}
.status-badge.status-in-progress {
  border-color: rgba(245, 184, 103, 0.35);
  background: rgba(245, 184, 103, 0.08);
  color: var(--brand-gold);
}
.status-badge.status-not-started {
  border-color: var(--line);
  color: var(--ink-2);
}
.status-badge.status-failed {
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08);
  color: var(--brand-red);
}

/* ==================== METRICS ROW ==================== */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s;
}
.metric-card:hover {
  border-color: rgba(245, 184, 103, 0.3);
}
.metric-val {
  font-family: "Cinzel", serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--brand-gold);
  margin: 0 0 6px;
}
.metric-lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0;
}

/* ==================== ACTION BLOCK ==================== */
.action-block {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  backdrop-filter: blur(14px);
  overflow: hidden;
  margin-bottom: 52px;
  position: relative;
}
.action-block::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(245, 184, 103, 0.06), transparent 60%);
  pointer-events: none;
}
.action-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 36px 40px;
  flex-wrap: wrap;
}
.action-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-coral);
  margin: 0 0 8px;
}
.action-block h2 {
  font-family: "Cinzel", serif;
  font-size: clamp(18px, 2.5vw, 26px);
  font-weight: 700;
  margin: 0 0 10px;
}
.action-copy p:last-child {
  font-size: 14px;
  color: var(--ink-2);
  margin: 0;
  line-height: 1.6;
  max-width: 480px;
}
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

/* ==================== BUTTONS ==================== */
.btn-solid {
  display: inline-block;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--brand-gold), var(--brand-coral));
  color: var(--base-0);
  font-family: "Urbanist", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: filter 0.2s, transform 0.15s;
  white-space: nowrap;
}
.btn-solid:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn-ghost {
  display: inline-block;
  padding: 13px 26px;
  background: transparent;
  color: var(--ink-1);
  font-family: "Urbanist", sans-serif;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--ink-0);
}

/* ==================== SECTIONS ==================== */
.section {
  margin-bottom: 60px;
}
.section-head {
  margin-bottom: 24px;
}
.section-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-gold);
  margin: 0 0 8px;
}
.section-head h2 {
  font-family: "Cinzel", serif;
  font-size: clamp(18px, 2.5vw, 26px);
  font-weight: 700;
  margin: 0;
}

/* ==================== COURSE GRID ==================== */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.course-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.2s, transform 0.2s;
}
.course-card:hover {
  transform: translateY(-2px);
}
.course-card.card-passed { border-color: rgba(110, 223, 160, 0.3); }
.course-card.card-in-progress { border-color: rgba(245, 184, 103, 0.3); }
.course-card.card-failed { border-color: rgba(255, 107, 107, 0.25); }
.course-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.course-title {
  font-family: "Cinzel", serif;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.3;
}
.course-meta {
  font-size: 12px;
  color: var(--ink-2);
  margin: 0;
}
.course-status-tag {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
}
.tag-passed {
  background: rgba(110, 223, 160, 0.15);
  color: var(--brand-green);
  border: 1px solid rgba(110, 223, 160, 0.3);
}
.tag-in-progress {
  background: rgba(245, 184, 103, 0.12);
  color: var(--brand-gold);
  border: 1px solid rgba(245, 184, 103, 0.3);
}
.tag-failed {
  background: rgba(255, 107, 107, 0.1);
  color: var(--brand-red);
  border: 1px solid rgba(255, 107, 107, 0.25);
}
.tag-not-started {
  background: rgba(156, 168, 191, 0.1);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.course-score-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.score-bar-wrap {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--brand-gold), var(--brand-coral));
  transition: width 0.6s ease;
}
.score-bar-fill.fill-green {
  background: linear-gradient(90deg, #6edfa0, #3cbf7a);
}
.score-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-gold);
  min-width: 38px;
  text-align: right;
}
.course-dates {
  font-size: 12px;
  color: var(--ink-2);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.course-dates span { display: flex; gap: 4px; align-items: center; }
.course-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.course-card-actions .btn-solid {
  font-size: 13px;
  padding: 10px 20px;
}
.course-card-actions .btn-ghost {
  font-size: 13px;
  padding: 9px 18px;
}
.cert-link {
  font-size: 12px;
  color: var(--brand-green);
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  padding-top: 2px;
}
.cert-link:hover { text-decoration: underline; }

/* Due-date warning banners */
.due-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 6px;
  padding: 6px 12px;
  margin: 10px 0 0;
}
.due-overdue {
  background: rgba(255, 107, 107, 0.15);
  color: #ff8f8f;
  border: 1px solid rgba(255, 107, 107, 0.3);
}
.due-soon {
  background: rgba(245, 184, 103, 0.12);
  color: #f5b867;
  border: 1px solid rgba(245, 184, 103, 0.3);
}

/* ==================== ACCOMPLISHMENTS ==================== */
.accomplishments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.accomplishment-tile {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 20px;
  backdrop-filter: blur(10px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s, transform 0.2s;
}
.accomplishment-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 184, 103, 0.3);
}
.accomplishment-icon {
  font-size: 36px;
  line-height: 1;
}
.accomplishment-title {
  font-family: "Cinzel", serif;
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}
.accomplishment-sub {
  font-size: 12px;
  color: var(--ink-2);
  margin: 0;
  line-height: 1.4;
}

/* ==================== HISTORY TABLE ==================== */
.history-table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  backdrop-filter: blur(10px);
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.history-table thead {
  background: rgba(255, 255, 255, 0.04);
}
.history-table th {
  padding: 14px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.history-table td {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--ink-1);
  vertical-align: middle;
}
.history-table tbody tr:last-child td {
  border-bottom: none;
}
.history-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.attempt-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
}
.attempt-status.s-passed { background: rgba(110, 223, 160, 0.15); color: var(--brand-green); }
.attempt-status.s-failed { background: rgba(255, 107, 107, 0.1); color: var(--brand-red); }
.attempt-status.s-in-progress { background: rgba(245, 184, 103, 0.1); color: var(--brand-gold); }

/* ==================== EMPTY STATES ==================== */
.no-courses,
.no-accomplishments,
.no-history {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  color: var(--ink-2);
  backdrop-filter: blur(10px);
}
.no-courses p,
.no-accomplishments p,
.no-history p {
  margin: 0 0 6px;
  font-size: 14px;
}
p.muted { font-size: 13px; color: var(--ink-2); opacity: 0.7; }

/* ==================== UTILITY ==================== */
.hidden { display: none !important; }

/* ==================== SESSION WARNING ==================== */
.session-warning {
  background: rgba(255, 107, 107, 0.12);
  border-bottom: 1px solid rgba(255, 107, 107, 0.35);
  color: var(--brand-coral);
  font-family: "Urbanist", sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 9px 20px;
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(8px);
}

/* ==================== MODAL ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(8, 19, 31, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  background: var(--base-1);
  border: 1px solid rgba(245, 184, 103, 0.28);
  border-radius: 22px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  backdrop-filter: blur(14px);
}
.modal-card h2 {
  font-family: "Cinzel", serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-0);
  margin: 0 0 26px;
}
.modal-field { margin-bottom: 16px; }
.modal-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.modal-input {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-0);
  font-family: "Urbanist", sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  width: 100%;
  transition: border-color 0.2s, outline 0.2s;
  box-sizing: border-box;
}
.modal-input:focus {
  outline: 2px solid rgba(245, 184, 103, 0.4);
  border-color: rgba(245, 184, 103, 0.7);
}
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.modal-status {
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-gold);
  min-height: 1.2rem;
}
.modal-status.is-error { color: var(--brand-coral); }
.modal-status.is-success { color: var(--brand-green); }

/* ==================== TOAST ==================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(12, 26, 42, 0.97);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-0);
  font-family: "Urbanist", sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 20px;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  max-width: 320px;
}
.toast.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { border-left: 3px solid var(--brand-green); }
.toast-error { border-left: 3px solid var(--brand-red); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 860px) {
  .dash-nav { padding: 12px 20px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy small { font-size: 9px; }
  .dash-main { padding: 32px 20px 60px; }
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
  .action-inner { padding: 28px 24px; }
  .welcome-hero { flex-direction: column; gap: 16px; }
}

@media (max-width: 560px) {
  .metrics-row { grid-template-columns: 1fr 1fr; gap: 12px; }
  .metric-val { font-size: 24px; }
  .action-buttons { flex-direction: row; flex-wrap: wrap; }
  .history-table th, .history-table td { padding: 12px 14px; }
  .nav-user { display: none; }
}
