:root {
  color-scheme: dark;
  --ink: #000000;
  --ink-2: #1d2026;
  --panel: rgba(29, 32, 38, 0.84);
  --panel-solid: #1d2026;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --soft: #f2f2f2;
  --gold: #43affc;
  --red: #ea0f0f;
  --green: #52d886;
  --cyan: #a2d5fe;
  --violet: #a98cff;
  --amber: #ffb24a;
  --danger: #ff624d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(67, 175, 252, 0.18), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(162, 213, 254, 0.13), transparent 28rem),
    var(--ink);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.gate-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1.25rem;
  isolation: isolate;
}

.gate-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(9, 9, 7, 0.94), rgba(9, 9, 7, 0.45), rgba(9, 9, 7, 0.88)),
    url("/assets/images/showroom.jpg") center / cover no-repeat;
}

.gate-bg::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.gate-panel {
  width: min(100%, 390px);
  padding: clamp(1rem, 5vw, 2rem);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(15, 14, 11, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.gate-logo {
  width: 138px;
  height: auto;
  margin-bottom: 2.25rem;
  filter: invert(1) grayscale(1) brightness(1.8);
}

.gate-panel h1 {
  margin: 0.65rem 0 0;
  max-width: 100%;
  font-size: clamp(2.25rem, 9.4vw, 3.45rem);
  line-height: 0.94;
  overflow-wrap: anywhere;
  text-wrap: balance;
  text-transform: uppercase;
}

.gate-copy {
  max-width: 22rem;
  margin: 1rem 0 1.7rem;
  color: var(--soft);
  line-height: 1.55;
}

.gate-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pin-display {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  min-height: 54px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.38);
  padding: 0.7rem;
}

.pin-display:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(67, 175, 252, 0.16);
}

.pin-display[aria-invalid="true"] {
  border-color: var(--danger);
}

.pin-display span {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.pin-display span::after {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  content: "";
}

.pin-display span.is-filled::after {
  background: var(--gold);
  box-shadow: 0 0 18px rgba(67, 175, 252, 0.75);
}

.gate-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.gate-keypad button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 950;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.gate-keypad button:hover {
  border-color: rgba(67, 175, 252, 0.6);
  background: rgba(67, 175, 252, 0.14);
}

.gate-keypad button:active {
  transform: translateY(1px) scale(0.98);
}

.gate-keypad .gate-submit {
  grid-column: 1 / -1;
  background: var(--text);
  color: #111;
  font-weight: 900;
  text-transform: uppercase;
}

.gate-keypad .gate-submit:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.gate-hint {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
}

.gate-error {
  margin: 0.75rem 0 0;
  color: var(--danger);
  font-weight: 700;
}

.gate-keypad.is-shaking {
  animation: keypad-shake 220ms ease;
}

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

.side-rail,
.mission-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-color: var(--line);
  background: rgba(10, 10, 8, 0.76);
  backdrop-filter: blur(22px);
}

.side-rail {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.mission-rail {
  border-left: 1px solid var(--line);
  padding: 1.25rem;
}

.brand-lockup {
  display: flex;
  min-height: 84px;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(67, 175, 252, 0.5);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(67, 175, 252, 0.26), rgba(255, 255, 255, 0.08));
  color: var(--gold);
  font-weight: 950;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 1.05rem;
}

.brand-lockup small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-stack {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 0.75rem;
}

.nav-item {
  display: grid;
  min-height: 48px;
  grid-template-columns: 42px 1fr;
  align-items: center;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(247, 241, 229, 0.07);
  color: var(--text);
}

.nav-item.is-active {
  box-shadow: inset 3px 0 0 var(--gold);
}

.nav-item:active {
  transform: translateY(1px);
}

.nav-icon {
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
}

.rail-footer {
  display: grid;
  gap: 0.75rem;
  margin-top: auto;
  padding: 1rem;
}

.signal-card,
.logout-link {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.7rem 0.8rem;
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.signal-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--green);
  box-shadow: 0 0 18px rgba(82, 216, 134, 0.9);
}

.logout-link {
  justify-content: center;
  color: var(--muted);
}

.command-zone {
  min-width: 0;
  padding: 1.25rem;
}

.topbar {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar h1 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.65rem, 4vw, 3.35rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.icon-command {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 950;
}

.icon-command:hover {
  border-color: rgba(67, 175, 252, 0.6);
  color: var(--gold);
}

.business-index {
  display: grid;
  min-width: 78px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(67, 175, 252, 0.45);
  border-radius: var(--radius);
  background: rgba(67, 175, 252, 0.12);
}

.business-index small,
.business-index strong {
  line-height: 1;
}

.business-index small {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.business-index strong {
  color: var(--gold);
  font-size: 1.05rem;
}

.hero-hud {
  position: relative;
  display: grid;
  min-height: 218px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 1rem;
  overflow: hidden;
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(9, 9, 7, 0.92), rgba(9, 9, 7, 0.68), rgba(9, 9, 7, 0.28)),
    url("/assets/images/showroom.jpg") center / cover no-repeat;
  box-shadow: var(--shadow);
}

.hero-hud::after {
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--gold), var(--cyan), var(--green), var(--red));
}

.hero-copy {
  align-self: end;
  padding: clamp(1.25rem, 4vw, 2.2rem);
}

.hero-copy h2 {
  max-width: 700px;
  margin: 0.5rem 0 0;
  font-size: clamp(1.75rem, 4vw, 3.55rem);
  line-height: 0.94;
  text-transform: uppercase;
}

.hud-metrics {
  display: grid;
  gap: 0.75rem;
  align-self: end;
  padding: 1rem;
}

.hud-metrics article {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 0.4rem 1rem;
  min-height: 64px;
  padding: 0.9rem;
  border: 1px solid rgba(247, 241, 229, 0.12);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(14px);
}

.hud-metrics small,
.hud-metrics span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-metrics strong {
  grid-row: span 2;
  color: var(--text);
  font-size: clamp(1.35rem, 3vw, 2.15rem);
  line-height: 1;
}

.view-root {
  min-height: 520px;
  margin-top: 1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 1rem;
}

.panel,
.task-card,
.lead-row,
.vehicle-card,
.appointment-card,
.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}

.panel {
  padding: 1rem;
}

.panel-head,
.row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-head h2,
.mission-header h2 {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  text-transform: uppercase;
}

.stack {
  display: grid;
  gap: 0.7rem;
}

.task-card,
.lead-row,
.appointment-card {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
}

.lead-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.lead-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(67, 175, 252, 0.13);
  color: var(--gold);
  font-weight: 950;
}

.row-title {
  margin: 0;
  font-weight: 900;
}

.row-meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 0.32rem 0.55rem;
  color: var(--soft);
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.pill.hot {
  border-color: rgba(226, 64, 53, 0.35);
  background: rgba(226, 64, 53, 0.12);
  color: #ffaea6;
}

.pill.good {
  border-color: rgba(82, 216, 134, 0.35);
  background: rgba(82, 216, 134, 0.1);
  color: #a9f0c5;
}

.pill.warn {
  border-color: rgba(255, 178, 74, 0.35);
  background: rgba(255, 178, 74, 0.1);
  color: #ffd39b;
}

.probability-meter {
  --heat: 80;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--panel-solid) 57%, transparent 59%),
    conic-gradient(var(--red) calc(var(--heat) * 1%), rgba(255, 255, 255, 0.08) 0);
  color: var(--text);
  font-weight: 950;
}

.probability-meter strong {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  line-height: 1;
}

.probability-meter small {
  margin-top: -0.55rem;
  color: var(--muted);
  font-size: 0.46rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mini-action,
.primary-action {
  min-height: 38px;
  border-radius: var(--radius);
  padding: 0.55rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-action {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--soft);
}

.primary-action {
  background: var(--text);
  color: #111;
}

.primary-action:hover,
.mini-action:hover {
  transform: translateY(-1px);
}

.flow-map {
  display: grid;
  gap: 0.65rem;
}

.flow-step {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 0.7rem;
  min-height: 64px;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.flow-step strong {
  display: block;
  font-size: 0.92rem;
}

.flow-step small {
  color: var(--muted);
}

.step-index {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(67, 175, 252, 0.12);
  color: var(--gold);
  font-weight: 950;
}

.status-chip {
  min-width: 78px;
  border-radius: 99px;
  padding: 0.35rem 0.55rem;
  background: rgba(82, 216, 134, 0.1);
  color: #a9f0c5;
  font-size: 0.68rem;
  font-weight: 950;
  text-align: center;
  text-transform: uppercase;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.vehicle-card {
  overflow: hidden;
}

.vehicle-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.vehicle-card-body {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
}

.vehicle-card h3 {
  margin: 0;
  font-size: 1rem;
}

.vehicle-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.vehicle-stats span,
.metric-card span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vehicle-stats strong,
.metric-card strong {
  display: block;
  margin-top: 0.15rem;
  color: var(--text);
}

.appointment-card {
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
}

.time-block {
  display: grid;
  min-height: 56px;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(67, 175, 252, 0.12);
  color: var(--gold);
  font-weight: 950;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.metric-card {
  min-height: 136px;
  padding: 1rem;
}

.metric-card strong {
  font-size: clamp(1.6rem, 4vw, 2.7rem);
  line-height: 1;
}

.metric-card em {
  display: block;
  margin-top: 1rem;
  color: var(--green);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.mission-header {
  margin-bottom: 1rem;
}

.mission-stack {
  display: grid;
  gap: 0.75rem;
}

.mission-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.mission-card.is-done {
  opacity: 0.52;
}

.mission-card h3 {
  margin: 0;
  font-size: 0.95rem;
}

.mission-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.mission-card button {
  justify-self: start;
}

.system-panel {
  margin-top: 1rem;
  border: 1px solid rgba(67, 175, 252, 0.28);
  border-radius: var(--radius);
  background: rgba(67, 175, 252, 0.08);
  padding: 0.9rem;
}

.system-panel small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.system-panel strong {
  display: block;
  margin-top: 0.1rem;
  color: var(--gold);
  font-size: 1.35rem;
}

.system-track {
  height: 8px;
  overflow: hidden;
  margin-top: 0.8rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
}

.system-track span {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--cyan));
  transition: width 300ms ease;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  max-width: min(360px, calc(100vw - 2rem));
  transform: translateY(20px);
  border: 1px solid rgba(82, 216, 134, 0.3);
  border-radius: var(--radius);
  background: rgba(10, 10, 8, 0.94);
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 0.85rem 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.focus-mode .side-rail,
.focus-mode .mission-rail,
.focus-mode .hero-hud,
.focus-mode .topbar-actions {
  display: none;
}

.focus-mode .app-shell {
  grid-template-columns: 1fr;
}

.focus-mode .command-zone {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .mission-rail {
    display: none;
  }

  .brand-lockup {
    justify-content: center;
    padding: 1rem 0.5rem;
  }

  .brand-lockup span:last-child,
  .nav-item span:last-child,
  .rail-footer {
    display: none;
  }

  .nav-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
    padding-bottom: 78px;
  }

  .side-rail {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    display: block;
    width: 100%;
    height: 70px;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .brand-lockup,
  .rail-footer {
    display: none;
  }

  .nav-stack {
    grid-template-columns: repeat(5, 1fr);
    height: 100%;
    padding: 0.45rem;
  }

  .nav-item {
    min-height: 56px;
    grid-template-rows: auto auto;
    gap: 0.2rem;
    justify-items: center;
    padding: 0.35rem;
    text-align: center;
  }

  .nav-item span:last-child {
    display: block;
    font-size: 0.68rem;
  }

  .command-zone {
    padding: 0.85rem;
  }

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

  .hero-hud,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .hud-metrics {
    grid-template-columns: 1fr;
  }

  .cards-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .lead-row,
  .appointment-card {
    grid-template-columns: 1fr;
  }

  .probability-meter {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 520px) {
  .gate-shell {
    align-items: start;
    padding: 0.75rem;
  }

  .gate-panel {
    padding: 1rem;
  }

  .gate-logo {
    width: 92px;
    margin-bottom: 1.2rem;
  }

  .gate-panel h1 {
    font-size: clamp(2rem, 12vw, 2.85rem);
  }

  .gate-copy {
    margin: 0.75rem 0 1rem;
  }

  .gate-keypad {
    gap: 0.45rem;
  }

  .gate-keypad button {
    min-height: 48px;
  }
}

@keyframes keypad-shake {
  33% {
    transform: translateX(-4px);
  }

  66% {
    transform: translateX(4px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .signal-dot {
    animation: pulse-dot 1.5s ease-in-out infinite;
  }

  .hero-hud::after {
    animation: rail-flow 6s linear infinite;
    background-size: 300% 100%;
  }
}

@keyframes pulse-dot {
  50% {
    transform: scale(1.25);
  }
}

@keyframes rail-flow {
  to {
    background-position: 300% 0;
  }
}
