:root {
  --bg-0: #010402;
  --bg-1: #041009;
  --bg-2: #071611;
  --surface: rgba(4, 12, 9, 0.9);
  --surface-border: rgba(40, 255, 145, 0.34);
  --surface-border-soft: rgba(26, 199, 255, 0.24);
  --text-main: #d8ffe9;
  --text-muted: #84b99f;
  --accent: #28ff91;
  --accent-2: #1ac7ff;
  --warn: #ffc46b;
  --ok: #6dffae;
  --bad: #ff7f75;
  --corner-cut: 10px;
  --radius-tight: 2px;
}

html,
body {
  min-height: 100%;
  color: var(--text-main);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background:
    radial-gradient(72rem 38rem at 6% -8%, rgba(26, 199, 255, 0.16) 0%, transparent 56%),
    radial-gradient(58rem 35rem at 100% 0%, rgba(40, 255, 145, 0.16) 0%, transparent 48%),
    linear-gradient(150deg, var(--bg-0), var(--bg-1) 58%, var(--bg-2));
}

.theme-dark {
  position: relative;
  overflow-x: hidden;
}

.theme-dark::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
  background: repeating-linear-gradient(
    to bottom,
    rgba(40, 255, 145, 0.16) 0,
    rgba(40, 255, 145, 0.16) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: scanline-shift 9s linear infinite;
}

.theme-dark::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
  background:
    repeating-linear-gradient(to right, transparent 0, transparent 35px, rgba(26, 199, 255, 0.1) 36px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 35px, rgba(40, 255, 145, 0.08) 36px);
  animation: grid-drift 22s linear infinite;
}

.theme-dark .section,
.theme-dark .hero {
  position: relative;
  z-index: 1;
}

.theme-dark .title,
.theme-dark .subtitle,
.theme-dark .label,
.theme-dark .card-header-title,
.theme-dark .message-body,
.theme-dark .content,
.theme-dark p,
.theme-dark span,
.theme-dark strong {
  color: var(--text-main);
}

.hero-shell {
  position: relative;
  overflow: hidden;
}

.hero-shell::before,
.hero-shell::after {
  content: "";
  position: absolute;
  border-radius: var(--radius-tight);
  filter: blur(34px);
  pointer-events: none;
}

.hero-shell::before {
  width: 420px;
  height: 110px;
  background: rgba(26, 199, 255, 0.24);
  top: -32px;
  right: -30px;
  transform: rotate(-14deg);
}

.hero-shell::after {
  width: 300px;
  height: 120px;
  background: rgba(40, 255, 145, 0.24);
  bottom: -42px;
  left: -40px;
  transform: rotate(10deg);
}

.eyebrow {
  font-family: "JetBrains Mono", "Consolas", monospace;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent-2);
  margin-bottom: 0.75rem;
}

.eyebrow::before {
  content: "// ";
  color: var(--accent);
}

.app-title {
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: clamp(1.9rem, 3.8vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: 0.02em;
  display: inline-block;
  position: relative;
  color: #c8ffd8;
  text-shadow:
    0 0 8px rgba(40, 255, 145, 0.32),
    0 0 20px rgba(26, 199, 255, 0.22);
  animation: title-flicker 4.6s steps(2, end) infinite;
}

.app-title::after {
  content: " _";
  color: var(--accent);
  animation: cursor-blink 0.95s steps(1, end) infinite;
}

.app-subtitle {
  color: var(--text-muted);
  max-width: 46rem;
}

.section-tight {
  padding-top: 1rem;
}

.glass-panel {
  background: linear-gradient(180deg, rgba(9, 16, 27, 0.95), rgba(8, 13, 22, 0.9));
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-tight);
  position: relative;
  clip-path: polygon(
    0 0,
    calc(100% - var(--corner-cut)) 0,
    100% var(--corner-cut),
    100% 100%,
    var(--corner-cut) 100%,
    0 calc(100% - var(--corner-cut))
  );
  box-shadow:
    0 0 0 1px rgba(26, 199, 255, 0.1),
    0 16px 42px rgba(3, 8, 14, 0.6),
    inset 0 1px 0 rgba(40, 255, 145, 0.07),
    inset 0 -20px 40px rgba(3, 15, 8, 0.3);
}

.glass-panel::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(40, 255, 145, 0.8), transparent);
  pointer-events: none;
}

.glass-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.58;
  background:
    linear-gradient(var(--accent), var(--accent)) left top / 14px 1px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left top / 1px 14px no-repeat,
    linear-gradient(var(--accent-2), var(--accent-2)) right top / 14px 1px no-repeat,
    linear-gradient(var(--accent-2), var(--accent-2)) right top / 1px 14px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left bottom / 14px 1px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left bottom / 1px 14px no-repeat,
    linear-gradient(var(--accent-2), var(--accent-2)) right bottom / 14px 1px no-repeat,
    linear-gradient(var(--accent-2), var(--accent-2)) right bottom / 1px 14px no-repeat;
}

.card.glass-panel {
  overflow: hidden;
}

.theme-dark .card-header {
  background: rgba(3, 10, 8, 0.94);
  border-bottom: 1px solid var(--surface-border-soft);
}

.theme-dark .card-header-title {
  font-family: "JetBrains Mono", "Consolas", monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: #b8ffd9;
}

.theme-dark .card-header-title::before {
  content: "[root] ";
  color: var(--accent);
  margin-right: 0.1rem;
}

.theme-dark .input.is-dark,
.theme-dark .select.is-dark select {
  font-family: "JetBrains Mono", "Consolas", monospace;
  background: rgba(2, 12, 9, 0.94);
  border-color: rgba(67, 208, 142, 0.34);
  border-radius: var(--radius-tight);
  color: var(--text-main);
}

.theme-dark .select.is-dark select {
  width: 100%;
}

.theme-dark .input.is-dark::placeholder {
  color: rgba(132, 185, 159, 0.72);
}

.theme-dark .input.is-dark:focus,
.theme-dark .select.is-dark select:focus {
  border-color: var(--accent);
  box-shadow:
    0 0 0 0.125em rgba(67, 208, 142, 0.2),
    0 0 18px rgba(67, 208, 142, 0.22);
}

.theme-dark .select:not(.is-multiple):not(.is-loading)::after {
  border-color: var(--accent) !important;
}

.routing-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.route-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(67, 208, 142, 0.32);
  border-radius: var(--radius-tight);
  background: rgba(2, 12, 9, 0.92);
  padding: 0.45rem 0.55rem;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 0.76rem;
  color: #d3ffe4;
}

.route-option input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent);
}

.routing-option-grid.is-disabled .route-option {
  opacity: 0.5;
}

.native-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.csv-dropzone {
  border: 1px dashed rgba(40, 255, 145, 0.5);
  border-radius: var(--radius-tight);
  clip-path: polygon(
    0 0,
    calc(100% - 12px) 0,
    100% 12px,
    100% 100%,
    12px 100%,
    0 calc(100% - 12px)
  );
  background:
    linear-gradient(180deg, rgba(2, 12, 9, 0.95), rgba(3, 10, 8, 0.92));
  padding: 1rem 1rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.csv-dropzone:hover {
  border-color: rgba(40, 255, 145, 0.78);
  box-shadow: 0 0 0 1px rgba(40, 255, 145, 0.24), 0 0 20px rgba(40, 255, 145, 0.22);
}

.csv-dropzone:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(67, 208, 142, 0.25), 0 0 18px rgba(67, 208, 142, 0.2);
}

.csv-dropzone.is-dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(67, 208, 142, 0.24), 0 0 24px rgba(67, 208, 142, 0.2);
  transform: translateY(-1px);
}

.csv-dropzone.is-error {
  border-color: rgba(255, 127, 117, 0.7);
  box-shadow: 0 0 0 1px rgba(255, 127, 117, 0.24), 0 0 18px rgba(255, 127, 117, 0.2);
}

.csv-dropzone.has-file {
  border-color: rgba(100, 239, 155, 0.62);
  box-shadow: 0 0 0 1px rgba(100, 239, 155, 0.24);
}

.dropzone-main {
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 0.88rem;
  color: #d9ffeb;
}

.dropzone-main::before {
  content: "> ";
  color: var(--accent);
}

.dropzone-sub {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.dropzone-file {
  margin-top: 0.55rem;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 0.75rem;
  color: #b8ffd9;
  overflow-wrap: anywhere;
}

.btn-action {
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #03140b;
  border: none;
  border-radius: var(--radius-tight) !important;
  clip-path: polygon(
    0 0,
    calc(100% - 12px) 0,
    100% 12px,
    100% 100%,
    12px 100%,
    0 calc(100% - 12px)
  );
  background: linear-gradient(90deg, #1ac7ff, #28ff91 60%, #69ffa4);
  box-shadow: 0 8px 24px rgba(40, 255, 145, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(40, 255, 145, 0.36);
  filter: brightness(1.03);
}

.theme-dark .button.is-dark {
  background: rgba(3, 10, 8, 0.95);
  border: 1px solid rgba(40, 255, 145, 0.46);
  border-radius: var(--radius-tight) !important;
  color: var(--text-main);
}

.theme-dark .button.is-dark:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(40, 255, 145, 0.28);
}

.job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.75rem 0.3rem;
  border-bottom: 1px dashed rgba(132, 185, 159, 0.3);
  color: var(--text-main);
  transition: transform 0.15s ease, color 0.15s ease;
}

.job-row:hover {
  transform: translateX(6px);
  color: #ffffff;
}

.job-row:last-child {
  border-bottom: none;
}

.job-name {
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 0.84rem;
  color: #bbffd6;
}

.job-tag {
  font-family: "JetBrains Mono", "Consolas", monospace;
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  border-radius: var(--radius-tight) !important;
}

.status-queued,
.status-running {
  background: rgba(255, 196, 107, 0.2);
  color: #ffe5bd;
  border: 1px solid rgba(255, 196, 107, 0.32);
}

.status-completed {
  background: rgba(100, 239, 155, 0.2);
  color: #c6ffd8;
  border: 1px solid rgba(100, 239, 155, 0.35);
}

.status-failed {
  background: rgba(255, 127, 117, 0.22);
  color: #ffd1cc;
  border: 1px solid rgba(255, 127, 117, 0.32);
}

.stats-grid .column {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.stat-box {
  border: 1px solid rgba(67, 208, 142, 0.3);
  border-radius: var(--radius-tight);
  clip-path: polygon(
    0 0,
    calc(100% - 10px) 0,
    100% 10px,
    100% 100%,
    10px 100%,
    0 calc(100% - 10px)
  );
  padding: 0.9rem 1rem;
  background: rgba(2, 10, 8, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(40, 255, 145, 0.1),
    0 0 14px rgba(26, 199, 255, 0.08);
}

.stat-label {
  font-family: "JetBrains Mono", "Consolas", monospace;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-value {
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 1.26rem;
  font-weight: 700;
  color: #ccffd7;
  margin-top: 0.2rem;
}

.theme-dark .progress {
  background: rgba(2, 12, 9, 0.94);
  border: 1px solid rgba(40, 255, 145, 0.35);
  height: 0.95rem;
}

.theme-dark .progress.is-warning::-webkit-progress-value {
  background: linear-gradient(90deg, #1ac7ff, #28ff91);
}

.theme-dark .progress.is-warning::-moz-progress-bar {
  background: linear-gradient(90deg, #1ac7ff, #28ff91);
}

#progress-text {
  font-family: "JetBrains Mono", "Consolas", monospace;
  color: #b6ffd2;
}

.map-meta p {
  font-family: "JetBrains Mono", "Consolas", monospace;
}

.map-status {
  font-family: "JetBrains Mono", "Consolas", monospace;
  color: #98ffc6;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(26, 199, 255, 0.35);
  background: rgba(2, 14, 12, 0.9);
  padding: 0.18rem 0.45rem;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 0.68rem;
  color: #d8e6ff;
  border-radius: var(--radius-tight);
  max-width: 18rem;
}

.map-legend-more {
  border-style: dashed;
  color: #9cb6d8;
}

.map-legend-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 1px;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.32);
  flex: 0 0 auto;
}

.map-legend-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-canvas-shell {
  border: 1px solid rgba(40, 255, 145, 0.42);
  background: linear-gradient(180deg, rgba(2, 10, 8, 0.95), rgba(1, 7, 6, 0.95));
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  border-radius: var(--radius-tight);
  overflow: hidden;
}

.route-map-canvas {
  display: block;
  width: 100%;
  height: auto;
}

@keyframes cursor-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.25;
  }
}

@keyframes title-flicker {
  0%,
  100% {
    opacity: 1;
  }
  8% {
    opacity: 0.86;
  }
  9% {
    opacity: 0.98;
  }
  31% {
    opacity: 0.9;
  }
  32% {
    opacity: 1;
  }
}

@keyframes scanline-shift {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(18px);
  }
}

@keyframes grid-drift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-36px, -18px, 0);
  }
}

@media (max-width: 768px) {
  .app-title {
    font-size: 1.6rem;
  }

  .hero-shell::before {
    width: 260px;
    height: 90px;
    top: -18px;
    right: -80px;
  }

  .hero-shell::after {
    width: 200px;
    height: 92px;
    left: -70px;
    bottom: -34px;
  }
}
