:root {
  --navy: #102c57;
  --navy-deep: #0a1a33;
  --white: #ffffff;
  --offwhite: #f7f8fb;
  --ink: #111827;
  --gray: #4b5563;
  --gray-soft: #d7dde6;
  --yellow: #f5c542;
  --yellow-strong: #f0b90b;
  --success: #e1f7c7;
  --success-ink: #245d18;
  --danger: #fbe7e7;
  --danger-ink: #8d1f1f;
  --shadow: 0 16px 40px rgba(16, 44, 87, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(245, 197, 66, 0.18), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f3f6fb 100%);
  color: var(--ink);
  font-family: "Roboto", "Open Sans", sans-serif;
}

body.large-text {
  font-size: 18px;
}

body.dark-mode {
  background: linear-gradient(180deg, #0a1424 0%, #111b2f 100%);
  color: #f8fafc;
}

body.dark-mode .login-card,
body.dark-mode .panel,
body.dark-mode .module-card,
body.dark-mode .video-panel,
body.dark-mode .quiz-panel,
body.dark-mode .profile-card,
body.dark-mode .certificate-card,
body.dark-mode .tip-card,
body.dark-mode .chart-card {
  background: rgba(14, 25, 44, 0.92);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .muted,
body.dark-mode .subtle,
body.dark-mode .field span {
  color: #cbd5e1;
}

body.high-contrast {
  --yellow: #ffd84e;
  --gray-soft: #b9c1cf;
}

button,
input,
select,
textarea {
  font: inherit;
}

a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.muted,
.subtle {
  color: var(--gray);
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--yellow-strong);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(245, 197, 66, 0.14), transparent 24%),
    linear-gradient(180deg, #102c57 0%, #0a1a33 100%);
}

.login-card,
.panel,
.module-card,
.video-panel,
.quiz-panel,
.profile-card,
.certificate-card,
.tip-card,
.chart-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(16, 44, 87, 0.1);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.login-card {
  width: min(100%, 480px);
  padding: 32px 28px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.brand-mark {
  width: 60px;
  height: 60px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  border-radius: 18px;
  display: grid;
  place-items: center;
}

.brand-mark-light {
  width: 180px;
  height: 72px;
  background: var(--white);
  border: 1px solid rgba(16, 44, 87, 0.08);
  box-shadow: 0 10px 24px rgba(16, 44, 87, 0.08);
  padding: 8px 14px;
}

.login-logo-wrap {
  width: 220px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
}

.login-logo {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.login-title {
  text-align: center;
  color: var(--white);
  font-size: clamp(2rem, 6vw, 2.6rem);
  margin-bottom: 10px;
}

.login-copy {
  margin: 0 0 22px;
  text-align: center;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.7;
}

.login-field span {
  color: rgba(255, 255, 255, 0.84);
}

.login-field input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--white);
}

.login-field input::placeholder {
  color: rgba(255, 255, 255, 0.54);
}

.login-button {
  width: 100%;
}

.login-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 18px;
}

.login-status {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.94);
  line-height: 1.5;
}

.login-status.error {
  background: rgba(141, 31, 31, 0.28);
  border: 1px solid rgba(251, 231, 231, 0.34);
}

.login-status.success {
  background: rgba(36, 93, 24, 0.3);
  border: 1px solid rgba(225, 247, 199, 0.34);
}

.login-links a {
  color: var(--yellow);
  text-decoration: none;
  font-weight: 600;
}

.login-links a:hover {
  text-decoration: underline;
}

.login-road {
  position: absolute;
  left: 28px;
  right: 28px;
  height: 10px;
  opacity: 0.18;
  border-top: 2px dashed rgba(255, 255, 255, 0.85);
}

.login-road-top {
  top: 18px;
}

.login-road-bottom {
  bottom: 18px;
}

.login-truck {
  position: absolute;
  right: -16px;
  top: 18px;
  width: 180px;
  opacity: 0.08;
}

.login-truck svg {
  width: 100%;
  height: auto;
  fill: rgba(255, 255, 255, 0.9);
}

.brand-mark svg {
  width: 34px;
  height: 34px;
  fill: var(--yellow);
}

.brand-mark img {
  width: 84%;
  height: 84%;
  object-fit: contain;
  display: block;
}

.brand-mark-small {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Open Sans", sans-serif;
}

h1 {
  font-size: 2rem;
}

.stack-lg {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--gray);
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--gray-soft);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--white);
  color: var(--ink);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.password-toggle {
  justify-self: end;
  border: 0;
  background: transparent;
  color: var(--yellow-strong);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0 4px;
}

.password-toggle:hover {
  color: var(--white);
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
  min-height: 48px;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.5;
  transform: none;
  cursor: not-allowed;
}

.button.busy {
  opacity: 0.82;
  transform: scale(0.98);
}

.button.feedback-pop {
  animation: button-pop 220ms ease;
}

@keyframes button-pop {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(0.96);
  }

  100% {
    transform: scale(1);
  }
}

.button-navy {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--white);
}

.button-yellow {
  background: linear-gradient(180deg, #ffd757 0%, var(--yellow-strong) 100%);
  color: var(--navy-deep);
  font-weight: 700;
}

.button-secondary {
  background: rgba(16, 44, 87, 0.08);
  color: var(--ink);
}

.button-ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid rgba(16, 44, 87, 0.16);
}

.demo-grid,
.two-up,
.action-row,
.filter-row,
.settings-grid,
.quiz-actions,
.certificate-actions,
.top-actions {
  display: grid;
  gap: 12px;
}

.demo-grid,
.two-up,
.quiz-actions,
.certificate-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-card,
.status-badge,
.chip,
.status-pill {
  border-radius: 999px;
}

.info-card {
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.08);
  padding: 16px;
  color: rgba(255, 255, 255, 0.88);
}

.main-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--white);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  box-shadow: 0 12px 28px rgba(10, 26, 51, 0.24);
}

.icon-chip {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  cursor: pointer;
}

.topbar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.topbar-brand p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
}

.topbar-status {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  font-size: 0.84rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: var(--navy-deep);
  color: var(--white);
  padding: 12px 16px;
  border-radius: 999px;
  z-index: 50;
}

.content {
  padding: 16px 16px 96px;
  width: min(100%, 900px);
  margin: 0 auto;
}

.screen {
  display: grid;
  gap: 16px;
}

.panel,
.video-panel,
.quiz-panel,
.profile-card,
.tip-card,
.chart-card {
  padding: 18px;
}

.hero-card {
  background: linear-gradient(135deg, var(--navy) 0%, #173f7a 100%);
  color: var(--white);
  padding: 22px;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-card .muted {
  color: rgba(255, 255, 255, 0.82);
}

.progress-ring-wrap {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
}

.progress-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--yellow) 0%, var(--yellow) 40%, rgba(255, 255, 255, 0.22) 40%);
}

.progress-ring::after {
  content: "";
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--navy);
}

.progress-ring span {
  position: absolute;
  font-weight: 700;
  color: var(--white);
}

.next-list,
.module-list,
.notes-list,
.invite-list,
.question-list {
  display: grid;
  gap: 14px;
}

.chat-thread,
.faq-prompt-list {
  display: grid;
  gap: 12px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-top: 10px;
}

.permission-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(16, 44, 87, 0.06);
}

.permission-item input {
  width: 18px;
  height: 18px;
}

.chat-thread {
  margin: 14px 0;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.chat-bubble {
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.6;
}

.chat-user {
  background: rgba(245, 197, 66, 0.2);
  color: var(--navy-deep);
}

.chat-assistant {
  background: rgba(16, 44, 87, 0.08);
  color: var(--ink);
}

.module-card {
  overflow: hidden;
}

.module-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #dbe4f0;
}

.module-body {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.title-row,
.summary-row,
.tab-row,
.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chip,
.status-pill,
.category-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.chip,
.category-filter {
  background: rgba(16, 44, 87, 0.08);
  color: var(--navy);
}

.status-pill {
  background: rgba(245, 197, 66, 0.24);
  color: var(--navy-deep);
  font-weight: 700;
}

.status-pill.success {
  background: var(--success);
  color: var(--success-ink);
}

.status-pill.error {
  background: var(--danger);
  color: var(--danger-ink);
}

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

.category-filter {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.category-filter.active {
  background: var(--yellow);
  color: var(--navy-deep);
  font-weight: 700;
}

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 22px;
  overflow: hidden;
  background: #0f172a;
}

.video-frame iframe,
.video-frame #youtubePlayer {
  width: 100%;
  height: 100%;
}

.notes-sheet {
  border-top: 1px solid var(--gray-soft);
  margin-top: 16px;
  padding-top: 16px;
}

.notes-toggle {
  width: 100%;
}

.quiz-option {
  width: 100%;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--gray-soft);
  background: #f5f7fb;
  text-align: left;
  cursor: pointer;
}

.quiz-option.selected {
  background: rgba(245, 197, 66, 0.22);
  border-color: rgba(245, 197, 66, 0.8);
}

.quiz-option.correct {
  background: var(--success);
  border-color: rgba(36, 93, 24, 0.22);
}

.quiz-option.incorrect {
  background: var(--danger);
  border-color: rgba(141, 31, 31, 0.22);
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: #e6ebf3;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--yellow) 0%, var(--yellow-strong) 100%);
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 8px;
}

.profile-badge {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(245, 197, 66, 0.18);
  color: var(--navy-deep);
  font-weight: 700;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(16, 44, 87, 0.08);
}

.toggle-row:last-child {
  border-bottom: 0;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c7d2e3;
  transition: 0.2s ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: white;
  transition: 0.2s ease;
}

.switch input:checked + .slider {
  background: var(--yellow);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

.admin-grid {
  display: grid;
  gap: 16px;
}

.certificate-sheet {
  position: fixed;
  inset: 0;
  background: rgba(10, 26, 51, 0.7);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 90;
}

.certificate-card {
  width: min(100%, 760px);
  padding: 28px;
  text-align: center;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  box-shadow: 0 -14px 30px rgba(10, 26, 51, 0.3);
}

.nav-item {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.78);
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 16px;
  cursor: pointer;
}

.nav-item.active {
  background: rgba(245, 197, 66, 0.18);
  color: var(--yellow);
}

.nav-icon {
  font-size: 1.12rem;
}

@media (min-width: 700px) {
  .content {
    padding-top: 22px;
  }

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

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

  .admin-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  #certificateSheet,
  #certificateSheet * {
    visibility: visible;
  }

  #certificateSheet {
    position: absolute;
    inset: 0;
    background: white;
  }
}
