:root {
  --ink: #0d0d0d;
  --muted: #6f6f66;
  --line: #dfddd2;
  --paper: #fffdf6;
  --panel: #ffffff;
  --yellow: #e9b724;
  --yellow-dark: #c5950b;
  --black: #0d0d0d;
  --charcoal: #171711;
  --green: #0d0d0d;
  --green-dark: #0d0d0d;
  --gold: #e9b724;
  --rust: #a84e35;
  --blue: #5e6258;
  --shadow: 0 18px 45px rgba(13, 13, 13, 0.12);
}

* {
  box-sizing: border-box;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: var(--black);
  pointer-events: none;
  will-change: opacity;
  animation: splashExit 1.45s ease forwards;
}

.splash-logo {
  position: relative;
  width: min(820px, 86vw);
  color: white;
  transform-origin: center;
  will-change: opacity, transform;
  animation: splashLogo 1.2s ease forwards;
}

.splash-video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 8px;
}

.splash-logo img {
  display: none;
  width: 100%;
  height: auto;
}

.splash-logo.show-fallback .splash-video {
  display: none;
}

.splash-logo.show-fallback img {
  display: block;
}

@keyframes splashLogo {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  22%,
  72% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px) scale(1.02);
  }
}

@keyframes splashExit {
  0%,
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "Arial Rounded MT Bold", "Arial Rounded", Arial, ui-sans-serif, system-ui, sans-serif;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--black);
  border-right: 1px solid #27271f;
  padding: 28px 22px;
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-sidebar .brand {
  width: 100%;
  justify-items: center;
  text-align: center;
}

.admin-sidebar .brand-logo-wrap {
  justify-self: center;
  margin-inline: auto;
}

.admin-sidebar .brand > div:last-child {
  width: 100%;
  text-align: center;
}

.admin-sidebar .brand span {
  width: 100%;
  padding-left: 0;
  text-align: center;
}

.brand {
  display: grid;
  gap: 10px;
  margin-bottom: 26px;
  color: white;
}

.brand-logo-wrap {
  display: block;
  width: min(250px, 100%);
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.brand span {
  display: block;
  padding-left: 3px;
}

.brand span,
.label,
.eyebrow,
.panel-heading p {
  color: var(--muted);
}

.sidebar .brand span,
.sidebar .label {
  color: #cac6b3;
}

.progress-card {
  background: #191912;
  border: 1px solid #2d2c22;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  color: white;
}

.view-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe9e4;
  padding: 4px;
  margin-bottom: 16px;
}

.view-toggle button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--green-dark);
  font-weight: 800;
  cursor: pointer;
}

.view-toggle button.active {
  background: white;
  box-shadow: 0 1px 5px rgba(25, 38, 35, 0.1);
}

.progress-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.35rem;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  margin-top: 12px;
  border-radius: 999px;
  background: #363424;
}

.progress-bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--yellow);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 180ms ease;
}

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

.step-button {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #f8f4df;
  text-align: left;
  cursor: pointer;
}

.step-button.active {
  border-color: var(--yellow);
  background: #242316;
}

.step-button.locked {
  color: #c7b8b3;
}

.step-index,
.step-state {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #343322;
  color: var(--yellow);
  font-size: 0.82rem;
  font-weight: 700;
}

.step-state.done {
  background: var(--yellow);
  color: var(--black);
}

.step-state.locked {
  background: #4a3329;
  color: #ffd5c6;
}

.workspace {
  width: min(1080px, 100%);
  padding: 28px clamp(18px, 4vw, 54px);
}

.topbar,
.status-strip,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--black);
  cursor: pointer;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.status-strip {
  align-items: stretch;
  margin-bottom: 18px;
}

.status-strip > div {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-top: 4px solid var(--yellow);
  border-radius: 8px;
  background: white;
  padding: 14px 16px;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 2.4fr);
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px 16px;
  margin-bottom: 18px;
}

#cloudStatus {
  display: block;
  min-height: 2.6em;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.auth-actions input {
  width: min(260px, 100%);
}

.status-strip strong,
.label {
  display: block;
}

.status-strip strong {
  overflow-wrap: anywhere;
}

.label {
  margin-bottom: 4px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel {
  display: none;
  border: 1px solid var(--line);
  border-top: 5px solid var(--yellow);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 30px);
}

.panel.active {
  display: block;
}

[hidden] {
  display: none !important;
}

body[data-admin-mode="draft"] .admin-review-view,
body[data-admin-mode="review"] .admin-draft-view {
  display: none !important;
}

.panel-heading {
  max-width: 680px;
  margin-bottom: 22px;
}

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

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

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

.file-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: #243230;
  font-size: 0.95rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c8d3cf;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

input[type="file"] {
  padding: 8px;
}

.file-status {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(233, 183, 36, 0.34);
  outline-offset: 2px;
}

.checklist,
.training-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

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

.checklist label,
.training-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--yellow);
}

.notice {
  border-left: 4px solid var(--yellow);
  background: #fff7d8;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: 0 8px 8px 0;
  color: #2f2a16;
}

.notice a {
  color: var(--black);
  font-weight: 800;
}

.survey-block {
  margin-top: 22px;
}

.survey-block h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.survey-block p {
  margin-bottom: 12px;
  color: var(--muted);
}

.gate-card {
  display: grid;
  gap: 4px;
  border: 1px solid #e1c9bf;
  border-left: 4px solid var(--rust);
  border-radius: 8px;
  background: #fff8f5;
  color: #49312b;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.gate-card strong {
  color: var(--rust);
}

.gate-card.unlocked {
  border-color: #e3c964;
  border-left-color: var(--yellow);
  background: #fff9e2;
  color: #3b3214;
}

.gate-card.unlocked strong {
  color: var(--black);
}

.qualification-review-card {
  margin-bottom: 22px;
}

.panel.review-locked > :not(.qualification-review-card) {
  opacity: 0.42;
  pointer-events: none;
}

.integration-frame {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px dashed #b9cac3;
  border-radius: 8px;
  background: #fbfcfb;
  padding: 16px;
  margin-bottom: 18px;
}

.integration-frame strong {
  display: block;
  color: var(--black);
}

.integration-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 116px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--yellow);
  border-radius: 8px;
  background: #fffaf0;
  padding: 14px 16px;
}

.download-card strong {
  display: block;
  color: var(--black);
}

.download-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.download-card .link-button {
  flex: 0 0 auto;
  border: 1px solid var(--yellow);
  background: var(--yellow);
  color: var(--black);
}

.readiness-downloads {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.review-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.review-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fbfcfb;
}

.review-item strong {
  min-width: 0;
  color: var(--black);
  overflow-wrap: anywhere;
  text-align: right;
}

.review-item.missing strong {
  color: var(--rust);
}

.form-actions {
  margin-top: 18px;
}

button.primary,
button.secondary {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}

button.primary {
  border: 1px solid var(--yellow);
  background: var(--yellow);
  color: var(--black);
}

button.primary:hover {
  background: var(--yellow-dark);
}

button.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

button.secondary.active {
  border-color: var(--yellow);
  background: #242316;
  color: white;
}

button.danger {
  border-color: #e0b8ad;
  color: #7c2f20;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  text-decoration: none;
}

button.wide {
  width: 100%;
  margin-top: 14px;
}

button:disabled {
  cursor: not-allowed;
  border-color: #b7b5ac;
  background: #f1f0eb;
  color: #5d5d57;
  opacity: 1;
}

.submission-confirmation {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow: auto;
  background: var(--black);
  padding: 24px;
}

body.submission-complete {
  overflow: hidden;
}

.submission-confirmation-content {
  width: min(620px, 100%);
  border-top: 5px solid var(--yellow);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  padding: clamp(28px, 6vw, 54px);
  text-align: center;
}

.submission-confirmation h2 {
  margin-bottom: 14px;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.submission-confirmation p {
  line-height: 1.5;
}

.submission-application-id {
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 14px;
}

.submission-confirmation .link-button {
  margin-top: 10px;
  border: 1px solid var(--yellow);
  background: var(--yellow);
  color: var(--black);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 340px;
  transform: translateY(18px);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  padding: 12px 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.admin-auth {
  display: grid;
  gap: 8px;
}

.admin-auth input,
.admin-auth button {
  width: 100%;
}

.admin-cleanup {
  display: grid;
  gap: 8px;
  border-top: 1px solid #343322;
  padding-top: 12px;
  margin-top: 4px;
}

.admin-cleanup span {
  color: #cac6b3;
  font-size: 0.82rem;
  line-height: 1.35;
}

.admin-filters {
  display: grid;
  gap: 8px;
  border-top: 1px solid #343322;
  padding-top: 14px;
}

.admin-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.admin-filter-grid button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  border: 1px solid #343322;
  border-radius: 8px;
  background: #191912;
  color: #f8f4df;
  padding: 0 10px;
  font-weight: 800;
  cursor: pointer;
}

.admin-filter-grid button.active {
  border-color: var(--yellow);
  background: #242316;
  color: white;
}

.admin-filter-grid span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--black);
  font-size: 0.74rem;
}

.admin-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.application-row {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.application-row.active {
  border-color: var(--yellow);
  box-shadow: inset 4px 0 0 var(--yellow);
}

.application-row span,
.application-row small {
  color: var(--muted);
  line-height: 1.3;
}

.admin-workspace {
  width: min(1180px, 100%);
}

.admin-section {
  margin-top: 18px;
}

.admin-gates {
  display: grid;
  gap: 22px;
}

.admin-gates h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.empty-state {
  border: 1px dashed #b9cac3;
  border-radius: 8px;
  color: var(--muted);
  padding: 14px;
}

.review-item a {
  color: var(--black);
  font-weight: 800;
}

.invalid {
  border-color: var(--rust);
  box-shadow: 0 0 0 3px rgba(168, 78, 53, 0.15);
}

@media (max-width: 860px) {
  .app-shell,
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .status-strip,
  .auth-panel,
  .download-card,
  .grid.two,
  .grid.three,
  .file-grid,
  .training-grid {
    grid-template-columns: 1fr;
  }

  .download-card {
    display: grid;
  }

  .status-strip {
    display: grid;
  }

  .auth-actions {
    justify-content: stretch;
  }

  .auth-actions input,
  .auth-actions button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .workspace,
  .sidebar {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash-screen {
    display: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
