:root {
  --sand: #f8f1e4;
  --cream: #fffaf0;
  --gold: #d89f2f;
  --gold-deep: #9f6312;
  --gold-soft: rgba(216, 159, 47, 0.15);
  --teal: #175d59;
  --teal-soft: #d7ebe4;
  --coral: #ef6d53;
  --ink: #1f2b25;
  --muted: #6f766f;
  --line: rgba(39, 49, 43, 0.12);
  --shadow: 0 24px 60px rgba(39, 34, 12, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 209, 128, 0.35), transparent 28%),
    radial-gradient(circle at bottom right, rgba(23, 93, 89, 0.2), transparent 26%),
    linear-gradient(180deg, #f4ecd8 0%, #f8f6ef 42%, #f2efe4 100%);
  font-family: "Manrope", "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  padding: 32px 20px 56px;
  overflow: hidden;
}

.ambient {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.4;
  pointer-events: none;
}

.ambient-left {
  top: -180px;
  left: -120px;
  background: rgba(239, 109, 83, 0.18);
}

.ambient-right {
  right: -180px;
  top: 160px;
  background: rgba(23, 93, 89, 0.14);
}

.topbar,
.layout {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 188px;
  max-width: 42vw;
  height: auto;
  filter: drop-shadow(0 12px 18px rgba(39, 34, 12, 0.18));
}

.brand-photo {
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

h3 {
  font-size: 1.4rem;
}

p {
  margin: 0;
}

.topbar-actions,
.hero-button-row,
.employee-actions,
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-btn,
.secondary-btn,
.primary-btn,
.ghost-btn,
.signoff-btn {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mode-btn {
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(39, 49, 43, 0.08);
}

.mode-btn.active,
.primary-btn,
.signoff-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), #2c8377);
  box-shadow: 0 12px 28px rgba(23, 93, 89, 0.24);
}

.mode-btn:hover,
.secondary-btn:hover,
.primary-btn:hover,
.ghost-btn:hover,
.signoff-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn,
.ghost-btn {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(39, 49, 43, 0.08);
}

.primary-btn,
.signoff-btn {
  padding: 12px 18px;
}

.layout,
.view-stack {
  display: grid;
  gap: 20px;
}

.card,
.hero {
  background: rgba(255, 250, 240, 0.82);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
  border-radius: 30px;
  padding: 24px;
}

.hero {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 24px;
}

.hero-text,
.support-text,
.roadmap-card p,
.module-card p,
.badge-caption,
.rule-list,
.employee-meta,
.summary-note,
.phase-meta,
.module-foot,
.resource-list,
.answer-note {
  color: var(--muted);
}

.hero-text {
  max-width: 56ch;
  margin-top: 14px;
  line-height: 1.65;
}

.hero-controls,
.form-grid,
.phase-snapshot,
.roadmap-grid,
.module-grid,
.badge-grid,
.employee-table,
.dashboard-stats {
  display: grid;
  gap: 14px;
}

.hero-controls {
  align-content: center;
}

.auth-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(39, 49, 43, 0.08);
}

.auth-head {
  align-items: center;
}

.auth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.auth-field {
  min-width: 0;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.field input,
.field select {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fffdfa;
}

.field span {
  font-size: 0.92rem;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-actions {
  grid-column: 1 / -1;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
}

.progress-head,
.section-head,
.dashboard-row,
.employee-card-head,
.phase-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.branch-filter {
  min-width: 180px;
}

.access-notice {
  border: 1px solid rgba(209, 86, 56, 0.22);
  background: linear-gradient(135deg, rgba(255, 247, 241, 0.96), rgba(255, 253, 249, 0.92));
  box-shadow: 0 18px 38px rgba(209, 86, 56, 0.08);
}

.empty-state-card {
  border-style: dashed;
  border-width: 1px;
  border-color: rgba(39, 49, 43, 0.12);
  background: rgba(255, 252, 247, 0.86);
}

.meter-wrap {
  margin: 24px 0 20px;
}

.meter {
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: #ebdfcc;
}

.meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #f1b13e, #ef6d53 50%, #1b6f68 100%);
  transition: width 220ms ease;
}

.meter-figure {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-top: 12px;
  gap: 12px;
}

.meter-figure strong {
  font-size: 2.4rem;
  font-family: "Fraunces", Georgia, serif;
}

.stats-row {
  display: grid;
  gap: 12px;
}

.stats-row-wide {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-stat,
.dashboard-stat {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(39, 49, 43, 0.06);
}

.mini-stat span,
.dashboard-stat span {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mini-stat strong,
.dashboard-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
}

.rule-list {
  padding-left: 18px;
  margin: 16px 0 0;
  line-height: 1.65;
}

.rule-list.compact {
  margin-top: 12px;
}

.phase-card,
.module-card,
.badge-card,
.employee-card,
.roadmap-card {
  border-radius: 24px;
  border: 1px solid rgba(39, 49, 43, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

.phase-card,
.roadmap-card {
  padding: 16px;
}

.phase-card {
  display: grid;
  gap: 10px;
}

.phase-row strong {
  font-size: 1rem;
}

.phase-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #ecdfcb;
}

.phase-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #efc257, #d8893d);
}

.roadmap-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.roadmap-card {
  position: relative;
  overflow: hidden;
  min-height: 188px;
}

.roadmap-card::after {
  content: "";
  position: absolute;
  inset: auto -24px -42px auto;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(23, 93, 89, 0.08);
}

.roadmap-card .week-tag,
.section-tag,
.module-pill,
.badge-pill,
.status-pill,
.branch-pill,
.badge-tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.week-tag,
.section-tag,
.branch-pill {
  background: var(--gold-soft);
  color: var(--gold-deep);
}

.roadmap-card h4,
.module-card h4,
.badge-card h4,
.employee-card h4 {
  margin-top: 12px;
  font-size: 1.1rem;
}

.module-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-card,
.badge-card,
.employee-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.module-meta,
.employee-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.module-pill {
  background: rgba(23, 93, 89, 0.12);
  color: var(--teal);
}

.module-pill.pending {
  background: rgba(239, 109, 83, 0.12);
  color: #b3482d;
}

.module-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
}

.badge-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.badge-card {
  text-align: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.94), rgba(251,246,236,0.94)),
    radial-gradient(circle at top right, rgba(216,159,47,0.08), transparent 34%);
  border: 1px solid rgba(140, 104, 31, 0.16);
}

.badge-showcase {
  position: relative;
  width: 144px;
  height: 144px;
  margin: 4px auto 12px;
}

.badge-glow {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 225, 149, 0.7), rgba(255, 225, 149, 0) 72%);
  filter: blur(6px);
}

.badge-medal {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto;
}

.badge-core {
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  z-index: 2;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.35),
    0 8px 18px rgba(33, 25, 9, 0.18);
}

.badge-core svg {
  width: 42px;
  height: 42px;
}

.badge-ribbon {
  position: absolute;
  bottom: 8px;
  width: 28px;
  height: 58px;
  clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%);
  z-index: 1;
}

.badge-ribbon-left {
  left: 24px;
  transform: rotate(7deg);
}

.badge-ribbon-right {
  right: 24px;
  transform: rotate(-7deg);
}

.badge-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 8px solid rgba(255, 255, 255, 0.84);
  box-shadow:
    0 18px 28px rgba(39, 34, 12, 0.16),
    inset 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.badge-inner-ring {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.55);
  z-index: 1;
}

.badge-tier {
  margin: 0 auto;
  width: fit-content;
}

.badge-banner {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 4;
  min-width: 92px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.92);
  color: #6a4a12;
  box-shadow: 0 8px 16px rgba(33, 25, 9, 0.14);
}

.badge-card.locked {
  opacity: 0.52;
  filter: grayscale(0.16);
}

.badge-card.unlocked {
  box-shadow:
    0 26px 44px rgba(39, 34, 12, 0.16),
    inset 0 1px 0 rgba(255,255,255,0.65);
}

.badge-card.unlocked::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(130deg, rgba(255,255,255,0.28), rgba(255,255,255,0) 42%);
}

.badge-card.locked .badge-tier {
  background: rgba(39, 49, 43, 0.08);
  color: var(--muted);
}

.badge-card.unlocked .badge-tier {
  background: rgba(23, 93, 89, 0.14);
  color: var(--teal);
}

.badge-theme-amber .badge-core {
  background: radial-gradient(circle at top, #ffd67a, #ea9c2f 62%, #a75b0e 100%);
}

.badge-theme-amber .badge-ribbon {
  background: linear-gradient(180deg, #f6c75c, #d97825);
}

.badge-theme-teal .badge-core {
  background: radial-gradient(circle at top, #52c2b8, #227a72 62%, #0c4b46 100%);
}

.badge-theme-teal .badge-ribbon {
  background: linear-gradient(180deg, #4eb8aa, #186761);
}

.badge-theme-ruby .badge-core {
  background: radial-gradient(circle at top, #ff9a88, #d75b43 62%, #8f2c20 100%);
}

.badge-theme-ruby .badge-ribbon {
  background: linear-gradient(180deg, #ff9f78, #b84c32);
}

.badge-theme-violet .badge-core {
  background: radial-gradient(circle at top, #9ac0ff, #5f7fe6 62%, #33489e 100%);
}

.badge-theme-violet .badge-ribbon {
  background: linear-gradient(180deg, #8fa8ff, #4f68cf);
}

.badge-theme-forest .badge-core {
  background: radial-gradient(circle at top, #92d88f, #3a9a4d 62%, #216135 100%);
}

.badge-theme-forest .badge-ribbon {
  background: linear-gradient(180deg, #77c970, #2b8742);
}

.badge-theme-crown .badge-core {
  background: radial-gradient(circle at top, #ffe2a4, #d9a13a 62%, #7f5611 100%);
}

.badge-theme-crown .badge-ribbon {
  background: linear-gradient(180deg, #f7d476, #bf8230);
}

.employee-table {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.employee-actions {
  gap: 10px;
}

.status-pill {
  color: #fff;
  background: linear-gradient(135deg, #2e8b77, #1e695d);
}

.status-pill.support {
  background: linear-gradient(135deg, #d89f2f, #c3791e);
}

.status-pill.escalate,
.status-pill.overdue {
  background: linear-gradient(135deg, #d15638, #a13a27);
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 20, 18, 0.52);
  backdrop-filter: blur(3px);
}

.modal-panel {
  position: relative;
  width: min(820px, 100%);
  max-height: min(88vh, 980px);
  overflow: auto;
  border-radius: 28px;
  background: #fffaf1;
  box-shadow: 0 26px 64px rgba(12, 17, 14, 0.28);
  padding: 28px;
}

.close-btn {
  position: sticky;
  top: 0;
  float: right;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(39, 49, 43, 0.08);
  cursor: pointer;
}

.modal-stack,
.quiz-list,
.resource-list,
.quiz-actions,
.module-completion-box {
  display: grid;
  gap: 16px;
}

.modal-stack {
  clear: both;
}

.resource-list {
  margin: 0;
  padding-left: 18px;
}

.resource-list a {
  color: var(--teal);
  font-weight: 700;
  text-decoration: none;
}

.resource-list a:hover {
  text-decoration: underline;
}

.summary-block,
.quiz-item,
.module-completion-box {
  border-radius: 22px;
  padding: 18px;
  background: #fff;
  border: 1px solid rgba(39, 49, 43, 0.08);
}

.summary-block ul {
  margin: 12px 0 0;
  padding-left: 18px;
  line-height: 1.7;
}

.quiz-item {
  transition: border-color 140ms ease, background 140ms ease;
}

.quiz-item legend {
  font-weight: 800;
  margin-bottom: 10px;
}

.quiz-item.correct {
  border-color: rgba(23, 93, 89, 0.28);
  background: rgba(23, 93, 89, 0.04);
}

.quiz-item.wrong {
  border-color: rgba(209, 86, 56, 0.28);
  background: rgba(209, 86, 56, 0.05);
}

.quiz-option {
  display: flex;
  gap: 10px;
  align-items: start;
  margin-top: 10px;
}

.answer-note {
  display: none;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 0.94rem;
}

.answer-note.show {
  display: block;
}

.answer-note.error {
  background: rgba(209, 86, 56, 0.08);
  color: #8d351f;
}

.answer-note.success {
  background: rgba(23, 93, 89, 0.08);
  color: #18584f;
}

.quiz-actions {
  grid-template-columns: repeat(2, minmax(0, auto));
  justify-content: start;
}

.score-box {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(23, 93, 89, 0.08);
  font-weight: 700;
  line-height: 1.55;
}

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: start;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  min-width: 260px;
  max-width: 380px;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, #1b6f68, #2a8b78);
  color: #fff;
  box-shadow: 0 22px 40px rgba(23, 93, 89, 0.26);
}

@media (max-width: 920px) {
  .hero,
  .overview-grid,
  .roadmap-grid,
  .module-grid,
  .badge-grid,
  .employee-table,
  .form-grid,
  .auth-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .stats-row-wide,
  .dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 18px 14px 42px;
  }

  .card,
  .hero {
    border-radius: 24px;
    padding: 18px;
  }

  .topbar-actions,
  .hero-button-row,
  .employee-actions,
  .quiz-actions,
  .form-actions {
    width: 100%;
  }

  .mode-btn,
  .secondary-btn,
  .primary-btn,
  .ghost-btn,
  .signoff-btn {
    width: 100%;
  }

  .stats-row-wide,
  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .meter-figure,
  .section-head {
    flex-direction: column;
    align-items: start;
  }

  .brand-mark {
    width: 150px;
    max-width: 54vw;
  }
}
