:root {
  --ink: #17212b;
  --muted: #65717f;
  --paper: #f6f8fb;
  --panel: #ffffff;
  --teal: #147d86;
  --teal-dark: #0d5960;
  --yellow: #f5b82e;
  --red: #cf3e36;
  --rail: #9aa8b6;
  --line: #d8e0e7;
  --shadow: 0 20px 60px rgba(22, 33, 43, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.hero-panel {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(10, 19, 28, 0.82), rgba(10, 19, 28, 0.36) 58%, rgba(10, 19, 28, 0.1)),
    url("assets/formacao-sub-gerente-hero.png") center / cover;
  display: flex;
  align-items: flex-end;
  padding: clamp(28px, 5vw, 70px);
  color: white;
}

.hero-overlay {
  max-width: 620px;
  padding-bottom: 7vh;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--yellow);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.3rem, 5vw, 5.8rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.55rem;
  line-height: 1.12;
}

.hero-copy {
  max-width: 520px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.04rem;
  line-height: 1.6;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.hero-metrics span {
  min-height: 76px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.78);
}

.hero-metrics strong {
  display: block;
  color: white;
  font-size: 1.8rem;
  line-height: 1;
}

.workspace {
  min-width: 0;
  padding: clamp(18px, 4vw, 46px);
  display: flex;
  align-items: center;
}

.auth-panel,
.journey-view,
.admin-view {
  width: min(100%, 980px);
  margin: 0 auto;
}

.tabs {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 8px;
  background: #e6edf3;
}

.tab {
  min-width: 132px;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab.is-active {
  background: white;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(22, 33, 43, 0.08);
}

.auth-card {
  display: none;
  max-width: 520px;
  border-radius: 8px;
  padding: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card.is-active {
  display: block;
}

.form-head p,
.hint,
.station-details,
.selected-card,
.candidate-row span,
.status-strip span {
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  color: #2d3945;
  font-weight: 800;
}

input,
select {
  width: 100%;
  border: 1px solid #d2dbe4;
  border-radius: 7px;
  padding: 13px 14px;
  background: white;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(20, 125, 134, 0.14);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  min-height: 46px;
  border-radius: 7px;
  padding: 0 18px;
  font-weight: 900;
  border: 1px solid transparent;
}

.primary-btn {
  background: var(--teal);
  color: white;
}

.primary-btn:hover {
  background: var(--teal-dark);
}

.secondary-btn {
  background: #fff6df;
  border-color: #f4d37c;
  color: #76520a;
}

.ghost-btn {
  background: white;
  border-color: #d8e0e7;
  color: var(--ink);
}

.danger-btn {
  background: #fff0ef;
  border-color: #f0bbb7;
  color: #9f2f2b;
}

.danger-btn:hover {
  background: #ffe3e1;
}

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

.hint {
  margin: 14px 0 0;
  font-size: 0.92rem;
}

.is-hidden {
  display: none;
}

.view-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.status-strip div,
.selected-card,
.edit-card,
.candidate-list {
  border: 1px solid #dce4ec;
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 30px rgba(22, 33, 43, 0.07);
}

.status-strip div {
  padding: 16px;
}

.status-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 1.18rem;
}

.train-stage {
  position: relative;
  min-height: 410px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #dce4ec;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 248, 251, 0.98)),
    linear-gradient(120deg, rgba(20, 125, 134, 0.12), rgba(245, 184, 46, 0.13));
  box-shadow: var(--shadow);
}

.track {
  position: absolute;
  inset: 30px 26px 40px;
}

.track::before {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  top: 54%;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  box-shadow: inset 0 0 0 2px #cad5df;
}

.station {
  --pos: 5%;
  position: absolute;
  top: calc(54% - 15px);
  left: var(--pos);
  width: 30px;
  height: 30px;
  translate: -50% 0;
  border: 4px solid white;
  border-radius: 50%;
  background: #aeb9c5;
  box-shadow: 0 6px 18px rgba(22, 33, 43, 0.22);
}

.station.is-complete {
  background: var(--teal);
}

.station.is-current {
  background: var(--yellow);
  animation: stationPulse 1.7s ease-in-out infinite;
}

.station-label {
  position: absolute;
  top: 43px;
  left: 50%;
  width: min(132px, 18vw);
  translate: -50% 0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

.station:nth-child(even) .station-label {
  top: -60px;
}

.train {
  --pos: 5%;
  position: absolute;
  left: var(--pos);
  top: calc(54% - 48px);
  width: 128px;
  height: 54px;
  translate: -50% 0;
  border-radius: 10px 28px 14px 10px;
  background:
    linear-gradient(90deg, #9f2f2b 0 34px, transparent 34px),
    linear-gradient(180deg, #f17851 0 18px, var(--red) 18px 100%);
  border: 2px solid #7f2527;
  box-shadow: 0 18px 30px rgba(22, 33, 43, 0.25);
  transition:
    left 900ms cubic-bezier(0.2, 0.9, 0.22, 1),
    top 900ms cubic-bezier(0.2, 0.9, 0.22, 1);
  animation: trainBob 1.4s ease-in-out infinite;
}

.train::before,
.train::after {
  content: "";
  position: absolute;
  bottom: -12px;
  width: 25px;
  height: 25px;
  border: 5px solid #263442;
  border-radius: 50%;
  background: var(--yellow);
}

.train::before {
  left: 17px;
}

.train::after {
  right: 14px;
}

.engine-window {
  position: absolute;
  left: 9px;
  top: 10px;
  width: 23px;
  height: 19px;
  border-radius: 5px;
  background: #dff5ff;
  border: 2px solid rgba(23, 33, 43, 0.16);
}

.cab-roof {
  position: absolute;
  left: 4px;
  top: -10px;
  width: 37px;
  height: 16px;
  border-radius: 8px 8px 3px 3px;
  background: #263442;
}

.chimney {
  position: absolute;
  right: 24px;
  top: -18px;
  width: 16px;
  height: 24px;
  border-radius: 5px 5px 2px 2px;
  background: #263442;
}

.chimney::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -8px;
  width: 26px;
  height: 10px;
  border-radius: 9px 9px 4px 4px;
  background: #263442;
}

.headlamp {
  position: absolute;
  right: -5px;
  top: 21px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffe9a8;
  border: 2px solid #7f2527;
  box-shadow: 8px 0 16px rgba(245, 184, 46, 0.55);
}

.pilot {
  position: absolute;
  right: -18px;
  bottom: 2px;
  width: 0;
  height: 0;
  border-top: 15px solid transparent;
  border-bottom: 0 solid transparent;
  border-left: 24px solid #263442;
}

.smoke {
  position: absolute;
  right: 23px;
  top: -30px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(20, 125, 134, 0.16);
  animation: smoke 1.8s ease-out infinite;
}

.station-details {
  margin-top: 16px;
  line-height: 1.55;
}

.approval-celebration {
  position: relative;
  overflow: hidden;
  margin-top: 18px;
  min-height: 260px;
  border-radius: 8px;
  padding: 34px;
  background:
    radial-gradient(circle at 20% 20%, rgba(245, 184, 46, 0.32), transparent 24%),
    radial-gradient(circle at 80% 28%, rgba(207, 62, 54, 0.26), transparent 22%),
    linear-gradient(135deg, #0f3d43, #147d86 54%, #17212b);
  color: white;
  box-shadow: var(--shadow);
}

.approval-celebration h2 {
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
  color: #ffe6a1;
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  line-height: 0.95;
}

.approval-celebration p {
  position: relative;
  z-index: 1;
  max-width: 580px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  line-height: 1.55;
}

.fireworks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fireworks span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--yellow);
  animation: fireworks 1.7s ease-out infinite;
}

.fireworks span:nth-child(1) {
  left: 18%;
  top: 28%;
  animation-delay: 0s;
}

.fireworks span:nth-child(2) {
  left: 78%;
  top: 20%;
  background: #ffffff;
  animation-delay: 0.25s;
}

.fireworks span:nth-child(3) {
  left: 62%;
  top: 64%;
  background: #ff8f70;
  animation-delay: 0.45s;
}

.fireworks span:nth-child(4) {
  left: 32%;
  top: 68%;
  background: #9de7ed;
  animation-delay: 0.7s;
}

.fireworks span:nth-child(5) {
  left: 50%;
  top: 18%;
  background: #ffe6a1;
  animation-delay: 0.95s;
}

.fireworks span:nth-child(6) {
  left: 88%;
  top: 58%;
  background: #f7b4ad;
  animation-delay: 1.15s;
}

.admin-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.candidate-list {
  max-height: 560px;
  overflow: auto;
  padding: 8px;
}

.candidate-row {
  width: 100%;
  border: 0;
  border-radius: 7px;
  padding: 13px;
  background: transparent;
  text-align: left;
}

.candidate-row strong,
.candidate-row span {
  display: block;
}

.candidate-row.is-active {
  background: #e9f7f7;
}

.selected-card {
  min-height: 94px;
  padding: 18px;
  margin-bottom: 14px;
}

.edit-card {
  padding: 18px;
  margin-bottom: 14px;
}

.selected-card strong {
  display: block;
  color: var(--ink);
  font-size: 1.25rem;
}

.selected-card .selected-meta {
  display: block;
  margin-top: 5px;
}

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

.admin-stage {
  min-height: 300px;
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.admin-actions.compact {
  margin-top: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  max-width: min(460px, calc(100vw - 32px));
  translate: -50% 30px;
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  padding: 13px 16px;
  background: #17212b;
  color: white;
  box-shadow: var(--shadow);
  transition: 220ms ease;
}

.toast.is-visible {
  translate: -50% 0;
  opacity: 1;
}

@keyframes trainBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes smoke {
  from {
    opacity: 0.55;
    transform: translate(0, 0) scale(0.8);
  }
  to {
    opacity: 0;
    transform: translate(-22px, -26px) scale(2.1);
  }
}

@keyframes stationPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(245, 184, 46, 0.45), 0 6px 18px rgba(22, 33, 43, 0.22);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(245, 184, 46, 0), 0 6px 18px rgba(22, 33, 43, 0.22);
  }
}

@keyframes fireworks {
  0% {
    opacity: 0;
    transform: scale(0.2);
    box-shadow:
      0 0 0 0 currentColor,
      0 0 0 0 currentColor,
      0 0 0 0 currentColor,
      0 0 0 0 currentColor,
      0 0 0 0 currentColor,
      0 0 0 0 currentColor,
      0 0 0 0 currentColor,
      0 0 0 0 currentColor;
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1);
    box-shadow:
      0 -42px 0 -2px currentColor,
      30px -30px 0 -2px currentColor,
      42px 0 0 -2px currentColor,
      30px 30px 0 -2px currentColor,
      0 42px 0 -2px currentColor,
      -30px 30px 0 -2px currentColor,
      -42px 0 0 -2px currentColor,
      -30px -30px 0 -2px currentColor;
  }
}

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

  .hero-panel {
    min-height: 56vh;
  }

  .workspace {
    align-items: flex-start;
  }

  .admin-layout,
  .status-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .hero-panel,
  .workspace {
    padding: 20px;
  }

  .hero-metrics,
  .button-row,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .view-header,
  .admin-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .train-stage {
    min-height: 620px;
  }

  .track {
    inset: 24px 18px 34px;
  }

  .track::before {
    left: calc(50% - 5px);
    right: auto;
    top: 5%;
    bottom: 5%;
    width: 10px;
    height: auto;
  }

  .station {
    top: var(--pos);
    left: 50%;
    translate: -50% -50%;
  }

  .station-label {
    top: 50%;
    left: 44px;
    width: min(190px, calc(50vw - 46px));
    translate: 0 -50%;
    text-align: left;
    font-size: 0.76rem;
  }

  .station:nth-child(even) .station-label {
    top: 50%;
  }

  .train {
    top: var(--pos);
    left: calc(50% - 68px);
    translate: -50% -50%;
  }
}
