/* ==========================================================================
   Расстояния — оформление
   ========================================================================== */

:root {
  --bg: #070b12;
  --bg-soft: #0a1019;
  --panel: #0f1724;
  --panel-2: #131d2d;
  --panel-3: #182435;
  --border: #223149;
  --border-soft: #1a2538;
  --text: #eaf1fa;
  --text-2: #c2cee0;
  --muted: #8a9ab3;
  --muted-2: #60718e;
  --accent: #3ddc97;
  --accent-2: #4cc9f0;
  --accent-3: #7c8cff;
  --accent-soft: rgba(61, 220, 151, 0.12);
  --cyan-soft: rgba(76, 201, 240, 0.12);
  --amber: #ffb454;
  --amber-soft: rgba(255, 180, 84, 0.12);
  --red: #ff6b81;
  --red-soft: rgba(255, 107, 129, 0.12);
  --radius: 18px;
  --shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 8% -12%, rgba(61, 220, 151, 0.09), transparent 62%),
    radial-gradient(950px 650px at 98% -5%, rgba(76, 201, 240, 0.09), transparent 58%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(61, 220, 151, 0.3);
  color: #fff;
}

svg {
  display: block;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent-2);
}

:focus-visible {
  outline: 2px solid rgba(61, 220, 151, 0.75);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #26344b;
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: #33455f;
  background-clip: content-box;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Верхняя панель
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 11, 18, 0.82);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, #5bd5f5 0%, #3ddc97 100%);
  color: #06111c;
  box-shadow: 0 10px 28px -10px rgba(61, 220, 151, 0.65);
}

.brand-logo svg {
  width: 24px;
  height: 24px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.brand-text small {
  font-size: 10.5px;
  color: var(--muted-2);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

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

.data-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--border-soft);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.data-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.14);
}

/* --------------------------------------------------------------------------
   Страница
   -------------------------------------------------------------------------- */

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: 30px;
  padding: 38px 0 30px;
}

.eyebrow {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 8px 0 12px;
  font-size: clamp(34px, 4.7vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.038em;
  font-weight: 700;
}

.hero p {
  margin: 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.hero-art {
  display: flex;
  justify-content: flex-end;
}

.hero-route {
  position: relative;
  width: 380px;
  height: 190px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(76, 201, 240, 0.12), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(61, 220, 151, 0.12), transparent 60%),
    rgba(15, 23, 36, 0.5);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.hero-route::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 150, 190, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 150, 190, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 50%, #000 40%, transparent 90%);
}

.hero-line {
  position: absolute;
  inset: 30px 20px 20px;
  width: calc(100% - 40px);
  height: calc(100% - 50px);
  filter: drop-shadow(0 0 10px rgba(61, 220, 151, 0.35));
}

.hero-point {
  position: absolute;
  z-index: 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 750;
  color: #06120d;
  box-shadow: 0 8px 22px -6px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(7, 11, 18, 0.65);
}

.hero-point-a {
  left: 30px;
  bottom: 32px;
  background: linear-gradient(135deg, #6de0ff, #4cc9f0);
}

.hero-point-b {
  right: 31px;
  top: 33px;
  background: linear-gradient(135deg, #ffcf85, #ff9e54);
}

.hero-distance {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-4deg);
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(9, 16, 27, 0.9);
  border: 1px solid rgba(61, 220, 151, 0.35);
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.8);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #d9ffef;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Панель настроек
   -------------------------------------------------------------------------- */

.card {
  background: linear-gradient(180deg, rgba(19, 29, 45, 0.94), rgba(13, 21, 33, 0.94));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), var(--shadow);
  padding: 22px;
  scroll-margin-top: 84px;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
}

.toolbar-divider {
  width: 1px;
  height: 34px;
  background: var(--border-soft);
}

.toolbar-hint {
  margin: 0 0 0 auto;
  max-width: 320px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  text-align: right;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: #080e17;
  border: 1px solid var(--border-soft);
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.seg-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.seg-btn:hover {
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.025);
}

.seg-btn.is-active {
  color: var(--accent);
  background: linear-gradient(180deg, rgba(61, 220, 151, 0.17), rgba(61, 220, 151, 0.07));
  box-shadow: inset 0 0 0 1px rgba(61, 220, 151, 0.24);
}

.seg-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.seg-btn:disabled:hover {
  color: var(--muted);
  background: transparent;
}

.seg-btn.is-active:disabled:hover {
  color: var(--accent);
  background: linear-gradient(180deg, rgba(61, 220, 151, 0.17), rgba(61, 220, 151, 0.07));
}

/* --------------------------------------------------------------------------
   Вкладки
   -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 16px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.tab svg {
  width: 18px;
  height: 18px;
}

.tab:hover {
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.025);
}

.tab.is-active {
  color: var(--text);
  background: var(--panel);
  border-color: var(--border-soft);
  box-shadow: 0 10px 24px -18px #000;
}

.tab-badge {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(61, 220, 151, 0.16);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
}

.panel:not([hidden]) {
  animation: fade-up 0.3s ease both;
}

/* --------------------------------------------------------------------------
   Один маршрут
   -------------------------------------------------------------------------- */

.single-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
  align-items: stretch;
}

.single-layout > *,
.bulk-layout > * {
  min-width: 0;
}

.route-card {
  display: flex;
  flex-direction: column;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.card-head h2,
.map-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.card-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.route-form {
  display: flex;
  flex-direction: column;
}

.point-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 10px;
}

.point-marker {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 750;
  color: #06120d;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.8);
}

.point-a {
  background: linear-gradient(135deg, #6de0ff, #4cc9f0);
}

.point-b {
  background: linear-gradient(135deg, #ffcf85, #ff9e54);
}

.point-field {
  min-width: 0;
}

.point-field input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #080e18;
  color: var(--text);
  font-size: 14.5px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.point-field input::placeholder {
  color: var(--muted-2);
}

.point-field input:hover {
  border-color: #2a3b57;
}

.point-field input:focus {
  outline: none;
  border-color: rgba(61, 220, 151, 0.65);
  background: #09111d;
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.11);
}

.point-connector {
  height: 22px;
  margin: 4px 0 4px 18px;
  border-left: 2px dashed rgba(76, 201, 240, 0.28);
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--panel-3);
  border-color: var(--border-soft);
}

.route-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.kbd-hint {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 11px;
}

.route-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.route-tip svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--muted-2);
}

/* Кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease, background 0.16s ease,
    border-color 0.16s ease, color 0.16s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn-primary {
  background: linear-gradient(135deg, #3ddc97 0%, #4cc9f0 100%);
  color: #04120c;
  box-shadow: 0 14px 30px -14px rgba(61, 220, 151, 0.7);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border);
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--panel-3);
  color: var(--text);
  border-color: #2b3c58;
}

.btn-ghost:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-sm {
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 12px;
}

.btn-sm svg {
  width: 15px;
  height: 15px;
}

.btn-block {
  width: 100%;
  margin-top: 16px;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid rgba(4, 18, 12, 0.25);
  border-top-color: #04120c;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* --------------------------------------------------------------------------
   Результат
   -------------------------------------------------------------------------- */

.result-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.result-card:not([hidden]) {
  animation: fade-up 0.32s ease both;
}

.result-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-3);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.is-accent {
  border-color: rgba(61, 220, 151, 0.32);
  background: rgba(61, 220, 151, 0.1);
  color: #9bf0c8;
}

.badge.is-amber {
  border-color: rgba(255, 180, 84, 0.34);
  background: rgba(255, 180, 84, 0.1);
  color: #ffd69c;
}

.result-main {
  padding: 2px 0 18px;
  border-bottom: 1px solid var(--border-soft);
}

.result-distance {
  margin: 5px 0 7px;
  font-size: clamp(38px, 4.7vw, 55px);
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(115deg, #ffffff 0%, #c8f7e3 55%, #a7e4fa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.result-modes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.result-modes .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted-2);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 15px 0;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(7, 13, 22, 0.55);
}

.stat span {
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.points {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.point-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(19, 29, 45, 0.55);
}

.point-item .point-marker {
  width: 28px;
  height: 28px;
  font-size: 10.5px;
  border-radius: 50%;
}

.point-info {
  min-width: 0;
}

.point-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.4;
}

.point-meta {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.point-input {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warnings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.warning-item {
  padding: 8px 10px;
  border: 1px solid rgba(255, 180, 84, 0.3);
  border-radius: 8px;
  background: var(--amber-soft);
  color: #ffd79c;
  font-size: 11.5px;
  line-height: 1.5;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

/* Заглушка */

.placeholder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 32px;
  border-style: dashed;
  background: rgba(15, 23, 36, 0.35);
  text-align: center;
}

.placeholder-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--muted);
  box-shadow: 0 12px 30px -16px #000;
}

.placeholder-icon svg {
  width: 26px;
  height: 26px;
}

.placeholder-card h3,
.empty-state h3 {
  margin: 16px 0 6px;
  font-size: 15px;
  font-weight: 600;
}

.placeholder-card p,
.empty-state p {
  margin: 0;
  max-width: 330px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.placeholder-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
}

.placeholder-chips span {
  padding: 4px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted-2);
  font-size: 10.5px;
}

/* --------------------------------------------------------------------------
   Карта
   -------------------------------------------------------------------------- */

.map-card {
  margin-top: 18px;
  padding: 20px;
}

.map-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.map-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-a {
  background: #4cc9f0;
}

.legend-b {
  background: #ff9e54;
}

.legend-line {
  width: 18px;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, #3ddc97, #4cc9f0);
}

.map {
  height: 400px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  overflow: hidden;
  background: #0a1019;
}

/* Тёмная тема для светлых плиток OpenStreetMap */
.leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9) saturate(0.65);
}

.map-pin {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 750;
  color: #06120d;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.8), 0 0 0 4px rgba(7, 11, 18, 0.55);
}

.map-pin-a {
  background: linear-gradient(135deg, #6de0ff, #4cc9f0);
}

.map-pin-b {
  background: linear-gradient(135deg, #ffcf85, #ff9e54);
}

.leaflet-container {
  background: #0a1019;
  font-family: var(--font);
}

.leaflet-control-attribution {
  background: rgba(7, 11, 18, 0.82) !important;
  color: var(--muted-2) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: var(--muted) !important;
}

.leaflet-bar a {
  background: var(--panel-2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.leaflet-bar a:hover {
  background: var(--panel-3) !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: 0 16px 40px -16px #000;
}

.leaflet-popup-content {
  margin: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Массовый расчёт
   -------------------------------------------------------------------------- */

.bulk-layout {
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.bulk-input-card {
  display: flex;
  flex-direction: column;
}

.bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.bulk-date-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding: 7px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(7, 13, 22, 0.45);
}

.bulk-date-label {
  color: var(--muted);
  font-size: 11.5px;
}

.date-input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #070d16;
  color: var(--text);
  color-scheme: dark;
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.date-input:focus {
  outline: none;
  border-color: rgba(61, 220, 151, 0.6);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.1);
}

.date-input:disabled {
  opacity: 0.65;
}

.date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.75);
  cursor: pointer;
}

.rate-input {
  width: 108px;
}

.rate-unit {
  color: var(--muted);
  font-size: 11.5px;
}

#bulkInput {
  width: 100%;
  min-height: 300px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #070d16;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.7;
  resize: vertical;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  tab-size: 4;
}

#bulkInput::placeholder {
  color: var(--muted-2);
}

#bulkInput:focus {
  outline: none;
  border-color: rgba(61, 220, 151, 0.6);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.1);
}

#bulkInput:disabled {
  opacity: 0.65;
}

.bulk-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 11px;
}

.dot-sep {
  color: var(--muted-2);
}

kbd {
  display: inline-block;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--text-2);
  font-family: inherit;
  font-size: 10px;
  line-height: 16px;
}

.note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.format-help {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.format-help summary {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}

.format-help summary:hover {
  color: var(--text);
}

.format-help div {
  padding-top: 8px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.format-help p {
  margin: 0 0 6px;
}

.format-help ul {
  margin: 0 0 6px;
  padding-left: 18px;
}

.format-help li {
  margin-bottom: 2px;
}

.format-help code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--panel-3);
  color: #9fe8fb;
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.bulk-result-card {
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.bulk-result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.bulk-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.summary-chip {
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(7, 13, 22, 0.55);
  min-width: 0;
}

.summary-chip span {
  display: block;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-chip strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-chip.is-bad strong {
  color: var(--red);
}

.day-summary {
  margin: 0 0 14px;
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(7, 13, 22, 0.45);
}

.day-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.day-summary-meta {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.day-summary-list {
  max-height: 176px;
  overflow: auto;
}

.day-summary-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 88px 86px;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-top: 1px solid var(--border-soft);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.day-summary-row:first-child {
  border-top: 0;
}

.day-date {
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
}

.day-count {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-count em {
  color: #ff9fae;
  font-style: normal;
}

.day-distance {
  color: var(--text);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.day-duration {
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.progress-wrap {
  margin: 2px 0 14px;
}

.progress {
  height: 8px;
  border-radius: 99px;
  background: var(--panel-3);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #3ddc97, #4cc9f0);
  box-shadow: 0 0 14px rgba(61, 220, 151, 0.45);
  transition: width 0.3s ease;
}

.progress-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-2);
  font-size: 11.5px;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.table-wrap {
  flex: 1;
  min-width: 0;
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(7, 13, 22, 0.35);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 30px 20px;
  text-align: center;
}

.empty-state .placeholder-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.empty-state .placeholder-icon svg {
  width: 23px;
  height: 23px;
}

.bulk-table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.bulk-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  background: #0e1623;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.bulk-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

.bulk-table tbody tr:last-child td {
  border-bottom: 0;
}

.bulk-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.018);
}

.bulk-table tr.is-active {
  background: rgba(76, 201, 240, 0.045);
}

.bulk-table tr.has-error {
  background: rgba(255, 107, 129, 0.035);
}

.col-num {
  width: 34px;
  color: var(--muted-2) !important;
  font-variant-numeric: tabular-nums;
}

.col-date {
  width: 82px;
  white-space: nowrap;
}

.cell-date {
  color: var(--text-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-date.is-muted {
  color: var(--muted-2);
}

.col-value {
  width: 88px;
  white-space: nowrap;
}

.col-cost {
  width: 96px;
}

.col-status {
  width: 122px;
}

.cell-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-2);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.cell-sub {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.cell-value {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-value.is-muted {
  color: var(--muted-2);
  font-weight: 400;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.is-active {
  border-color: rgba(76, 201, 240, 0.35);
  background: var(--cyan-soft);
  color: #9fe8fb;
}

.status-badge.is-ok {
  border-color: rgba(61, 220, 151, 0.3);
  background: var(--accent-soft);
  color: #9bf0c8;
}

.status-badge.is-error {
  border-color: rgba(255, 107, 129, 0.4);
  background: var(--red-soft);
  color: #ffb3be;
}

.status-badge.is-fallback {
  border-color: rgba(255, 180, 84, 0.35);
  background: var(--amber-soft);
  color: #ffd69c;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.is-active .status-dot {
  animation: pulse 1s ease-in-out infinite;
}

.status-error-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
  color: #ff9fae;
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   Уведомления
   -------------------------------------------------------------------------- */

.alert {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
}

.alert-error {
  border-color: rgba(255, 107, 129, 0.35);
  background: var(--red-soft);
  color: #ffb3be;
}

.alert-warn {
  border-color: rgba(255, 180, 84, 0.3);
  background: var(--amber-soft);
  color: #ffd79c;
}

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(19, 29, 45, 0.97);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 18px 40px -18px #000;
  animation: toast-in 0.2s ease both;
  pointer-events: auto;
}

.toast.is-success {
  border-color: rgba(61, 220, 151, 0.4);
}

.toast.is-error {
  border-color: rgba(255, 107, 129, 0.45);
}

.toast-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--accent);
}

.toast.is-error .toast-icon {
  color: var(--red);
}

/* --------------------------------------------------------------------------
   Подвал
   -------------------------------------------------------------------------- */

.page-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 34px;
  padding: 16px 0 0;
  border-top: 1px solid var(--border-soft);
  color: var(--muted-2);
  font-size: 11px;
}

.page-footer a {
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.16s ease, border-color 0.16s ease;
}

.page-footer a:hover {
  color: var(--accent);
  border-bottom-color: rgba(61, 220, 151, 0.45);
}

.footer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.1);
}

/* --------------------------------------------------------------------------
   Анимации
   -------------------------------------------------------------------------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* --------------------------------------------------------------------------
   Адаптивность
   -------------------------------------------------------------------------- */

@media (max-width: 1120px) {
  .single-layout {
    grid-template-columns: 1fr;
  }

  .placeholder-card {
    min-height: 230px;
  }

  .result-card {
    min-height: 0;
  }

  .bulk-layout {
    grid-template-columns: 1fr;
  }

  .bulk-result-card {
    min-height: 400px;
  }

  #bulkInput {
    min-height: 220px;
  }
}

@media (max-width: 940px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 30px;
  }

  .hero-art {
    display: none;
  }

  .toolbar-hint {
    flex: 1 0 100%;
    max-width: none;
    margin: 0;
    text-align: left;
  }

  .toolbar-divider {
    display: none;
  }
}

@media (max-width: 860px) {
  .bulk-table {
    min-width: 740px;
  }

  .bulk-table th.col-straight,
  .bulk-table td.col-straight {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    height: 64px;
    padding: 0 16px;
  }

  .page {
    padding: 0 16px 32px;
  }

  .hero {
    padding: 24px 0 22px;
  }

  .hero h1 {
    font-size: 38px;
  }

  .hero p {
    font-size: 13px;
  }

  .card {
    padding: 17px;
  }

  .toolbar {
    gap: 12px;
  }

  .toolbar-group {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .segmented {
    flex: 1;
  }

  .seg-btn {
    flex: 1;
    padding: 8px 8px;
  }

  .tabs {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .tab {
    flex: 1;
    justify-content: center;
    padding: 9px 10px;
    font-size: 12px;
  }

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

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

  .map-head {
    flex-direction: column;
    gap: 8px;
  }

  .map {
    height: 330px;
  }

  .map-card {
    padding: 16px;
  }

  .bulk-result-card {
    min-height: 0;
  }

  .table-wrap {
    max-height: 520px;
  }

  .bulk-table {
    min-width: 680px;
  }

  .day-summary-row {
    grid-template-columns: 78px minmax(0, 1fr) 82px;
  }

  .day-duration {
    display: none;
  }

  .empty-state {
    min-height: 300px;
  }

  .kbd-hint {
    display: none;
  }
}

@media (max-width: 520px) {
  .brand-text small {
    display: none;
  }

  .data-badge {
    display: none;
  }

  .hero h1 {
    font-size: 33px;
  }

  .toolbar-label {
    display: none;
  }

  .seg-btn {
    font-size: 11.5px;
    gap: 5px;
  }

  .seg-btn svg {
    width: 16px;
    height: 16px;
  }

  .point-row {
    grid-template-columns: 32px minmax(0, 1fr) 34px;
    gap: 8px;
  }

  .point-marker {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }

  .point-field input {
    height: 46px;
    padding: 0 11px;
    font-size: 13px;
  }

  .point-connector {
    margin-left: 15px;
    height: 18px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .route-actions .btn-primary {
    flex: 1;
  }

  .route-actions .btn-ghost {
    flex: 0 0 auto;
  }

  .card-head {
    flex-wrap: wrap;
  }

  .result-badges {
    justify-content: flex-start;
  }

  .result-distance {
    font-size: 42px;
  }

  .map-legend {
    display: none;
  }

  .map {
    height: 290px;
  }

  .toasts {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .page-footer {
    align-items: flex-start;
    line-height: 1.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
