/* Scenarios simulator styles */

.scenarios-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* .top-bar-nav / .top-nav-link — общие стили в components.css */

.scenarios-main {
  flex: 1;
  padding: 24px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}
.view-header h1 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}
.view-subtitle {
  color: var(--color-muted-foreground);
  font-size: 14px;
}
.view-actions {
  display: flex;
  gap: 8px;
}
.breadcrumb a {
  color: var(--color-muted-foreground);
  text-decoration: none;
  font-size: 14px;
}
.breadcrumb a:hover { color: var(--color-primary); }

.compare-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.scenarios-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.scenario-card {
  background: var(--color-card);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.scenario-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}
.scenario-card h3 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  margin-right: 28px;
}
.scenario-card .meta {
  color: var(--color-muted-foreground);
  font-size: 13px;
}
.scenario-card .stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.stat {
  background: var(--color-muted);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
}
.scenario-card .compare-check {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 20px;
  height: 20px;
  cursor: pointer;
}
.verdict-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--color-muted);
  color: var(--color-muted-foreground);
}
.verdict-badge.ok { background: rgba(91, 154, 139, 0.16); color: var(--color-success); }
.verdict-badge.borderline { background: rgba(212, 160, 70, 0.16); color: var(--color-warning); }
.verdict-badge.overtime, .verdict-badge.unassigned, .verdict-badge.error {
  background: rgba(199, 93, 93, 0.16); color: var(--color-destructive);
}

/* Detail */
.detail-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
}
@media (max-width: 960px) {
  .detail-layout { grid-template-columns: 1fr; }
}
.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card {
  background: var(--color-card);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}
.card h3 {
  font-family: var(--font-heading);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted-foreground);
  margin-bottom: 10px;
  font-weight: 600;
}
.card h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.detail-meta {
  color: var(--color-muted-foreground);
  font-size: 13px;
}
.detail-notes {
  margin-top: 8px;
  font-size: 14px;
  color: var(--color-muted-foreground);
  font-style: italic;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-foreground);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.chip.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-primary-foreground);
}
.chip.readonly { cursor: default; }

.field {
  display: block;
  margin-bottom: 12px;
}
.field-label {
  display: block;
  font-size: 13px;
  color: var(--color-muted-foreground);
  margin-bottom: 4px;
}
.field input[type="text"], .field input[type="date"],
.field input[type="number"], .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--color-card);
  color: var(--color-foreground);
}
.field input:focus, .field textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
  border-color: transparent;
}
.field input[type="range"] { width: 100%; }
.field em { font-style: normal; font-weight: 600; color: var(--color-foreground); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: var(--color-primary-foreground); }
.btn-primary:hover:not(:disabled) { background: #c96a52; }
.btn-secondary {
  background: var(--color-muted);
  color: var(--color-foreground);
}
.btn-ghost {
  background: transparent;
  color: var(--color-muted-foreground);
}
.btn-ghost:hover { color: var(--color-foreground); background: var(--color-muted); }
.btn-danger-ghost {
  background: transparent; color: var(--color-destructive);
}
.btn-danger-ghost:hover { background: rgba(199, 93, 93, 0.1); }
.btn-wide { width: 100%; justify-content: center; }
.link-btn {
  background: transparent;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.runs-list { list-style: none; }
.runs-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 8px;
}
.runs-list li:last-child { border: none; }
.runs-list li:hover { color: var(--color-primary); }
.runs-list .runs-empty { color: var(--color-muted-foreground); cursor: default; }

.dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  color: var(--color-muted-foreground);
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.drag-over {
  border-color: var(--color-primary);
  background: rgba(224, 122, 95, 0.06);
  color: var(--color-foreground);
}

.excel-status {
  font-size: 13px;
  margin-top: 10px;
  color: var(--color-muted-foreground);
}
.excel-status.ok { color: var(--color-success); }
.excel-status.error { color: var(--color-destructive); }

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.run-summary { padding: 20px; }
.verdict-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.verdict-badge { font-size: 14px; padding: 6px 14px; }
.verdict-text { color: var(--color-muted-foreground); font-size: 14px; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.metric-card {
  background: var(--color-sidebar);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.metric-card .label {
  font-size: 12px;
  color: var(--color-muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric-card .value {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}

.map-wrapper { padding: 0; overflow: hidden; }
#scenario-map { height: 420px; width: 100%; }

.routes-tabs .tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  padding: 0 16px;
}
.route-tab {
  padding: 10px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  color: var(--color-muted-foreground);
  border-bottom: 2px solid transparent;
}
.route-tab-sub {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: var(--color-muted-foreground);
  font-weight: 400;
}
.route-tab.active {
  color: var(--color-foreground);
  border-bottom-color: var(--color-primary);
}
.route-stops {
  padding: 16px;
}
.route-stops .stop {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}
.route-stops .stop:last-child { border: none; }
.stop-seq {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--color-muted);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.stop-info .name { font-weight: 600; }
.stop-info .addr { color: var(--color-muted-foreground); font-size: 13px; }
.stop-eta {
  color: var(--color-muted-foreground);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.points-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.points-list-header h3 { margin: 0; }
.points-bulk-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.points-list { max-height: 400px; overflow: auto; }
.points-list .point-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  align-items: center;
}
.points-list .point-del {
  border: none;
  background: transparent;
  color: var(--color-muted-foreground);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.points-list .point-del:hover {
  background: var(--color-destructive, #e53e3e);
  color: #fff;
}
.points-list .point-row:last-child { border: none; }
.points-list .src-badge {
  font-size: 11px; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--color-muted); color: var(--color-muted-foreground);
  margin-right: 6px;
}
.points-list .src-excel { background: rgba(224, 122, 95, 0.16); color: var(--color-primary); }
.points-list .src-baseline { background: rgba(124, 111, 171, 0.16); color: var(--color-info); }
.points-list .geo-failed { color: var(--color-destructive); }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(45, 37, 32, 0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-card {
  background: var(--color-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
}
.modal-header h2 { font-family: var(--font-heading); font-size: 20px; font-weight: 700; }
.icon-btn {
  background: transparent; border: none; font-size: 24px; cursor: pointer;
  color: var(--color-muted-foreground);
  line-height: 1; width: 32px; height: 32px;
}
.wizard-steps {
  display: flex;
  padding: 12px 24px;
  border-bottom: 1px solid var(--color-border);
  gap: 6px;
  font-size: 13px;
  color: var(--color-muted-foreground);
}
.wizard-steps .step {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}
.wizard-steps .step.active {
  background: var(--color-primary);
  color: var(--color-primary-foreground);
  font-weight: 600;
}
.modal-body { padding: 20px 24px; overflow: auto; }
.modal-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--color-border);
  display: flex; align-items: center;
}
.modal-spacer { flex: 1; }
.hint { color: var(--color-muted-foreground); font-size: 13px; margin-bottom: 10px; }

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--color-muted-foreground);
  grid-column: 1 / -1;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.compare-col {
  background: var(--color-card);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.compare-col h3 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
}
.compare-col .bar {
  background: var(--color-muted);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0 4px 0;
}
.compare-col .bar-fill {
  height: 100%;
  background: var(--color-primary);
}

/* ===== Vehicles card (fleet + virtual) ===== */
.vehicles-card__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.vehicles-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--color-muted-foreground);
  background: var(--color-muted);
  padding: 2px 8px;
  border-radius: 999px;
}
.vehicles-subtitle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted-foreground);
  margin: 12px 0 6px 0;
}
.vehicles-subtitle--virtual {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
}
.vehicles-subtitle__hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: 11px;
  color: var(--color-muted-foreground);
  opacity: 0.75;
}
.virtual-vehicles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.virtual-vehicles:empty + .btn-add-virtual { margin-top: 2px; }
.virtual-vehicle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(124, 111, 171, 0.08);
  border: 1px dashed rgba(124, 111, 171, 0.35);
  border-radius: 10px;
  font-size: 13px;
}
.virtual-vehicle__name {
  font-weight: 600;
  color: var(--color-foreground);
}
.virtual-vehicle__meta {
  font-size: 11px;
  color: var(--color-muted-foreground);
}
.virtual-vehicle__del {
  background: transparent;
  border: none;
  color: var(--color-muted-foreground);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s;
}
.virtual-vehicle__del:hover { color: var(--color-destructive, #C75D5D); }
.btn-add-virtual {
  margin-top: 8px;
  width: 100%;
  justify-content: center;
  font-weight: 500;
  border: 1px dashed var(--color-border);
  color: var(--color-muted-foreground);
}
.btn-add-virtual:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: rgba(224, 122, 95, 0.06);
}
.config-dirty {
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-warning, #D4A046);
  background: rgba(212, 160, 70, 0.10);
  border-radius: 8px;
  border: 1px solid rgba(212, 160, 70, 0.30);
}

/* Virtual vehicle modal */
.vv-card { max-width: 480px; }
.vv-body { padding: 20px 24px; }
.vv-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.vv-preset {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--color-muted);
  border: 1px solid var(--color-border);
  color: var(--color-foreground);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.vv-preset:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.vv-preset.active {
  background: var(--color-primary);
  color: var(--color-primary-foreground);
  border-color: var(--color-primary);
}
.vv-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Route tab badge for virtual vehicle */
.vehicle-virtual-badge {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-info, #7C6FAB);
  background: rgba(124, 111, 171, 0.14);
  border-radius: 4px;
  vertical-align: middle;
}

/* ===== Help (?) trigger in top bar ===== */
.help-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  color: var(--color-muted-foreground);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  margin-right: 4px;
}
.help-trigger:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: rgba(224, 122, 95, 0.08);
}
.help-trigger:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===== Help modal ===== */
.help-card {
  max-width: 760px;
}
.help-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 28px;
}
.help-lead {
  color: var(--color-foreground);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 24px 0;
  padding: 14px 16px;
  background: var(--color-muted);
  border-radius: var(--radius-card, 12px);
  border-left: 3px solid var(--color-primary);
}
.help-section {
  padding: 18px 0;
  border-top: 1px solid var(--color-border);
}
.help-section:first-of-type { border-top: none; padding-top: 0; }
.help-section__tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: rgba(224, 122, 95, 0.10);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.help-section h3 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: var(--color-foreground);
}
.help-section p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--color-foreground);
  margin: 0 0 10px 0;
}
.help-section ul,
.help-section ol {
  margin: 6px 0 10px 0;
  padding-left: 22px;
}
.help-section li {
  font-size: 14px;
  line-height: 1.65;
  color: var(--color-foreground);
  margin-bottom: 6px;
}
.help-section code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--color-muted);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--color-foreground);
}
.help-section b { font-weight: 600; }
.help-section--tip {
  margin-top: 8px;
  padding: 16px 18px;
  background: rgba(91, 154, 139, 0.08);
  border-radius: var(--radius-card, 12px);
  border: 1px solid rgba(91, 154, 139, 0.25);
}
.help-section--tip h3 { color: var(--color-success, #5B9A8B); }

.help-glossary {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  gap: 8px 16px;
  margin: 8px 0 0 0;
}
.help-glossary dt {
  font-weight: 600;
  color: var(--color-foreground);
  font-size: 14px;
}
.help-glossary dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-muted-foreground);
}

.help-kbd {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  color: var(--color-foreground);
  background: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.help-inline-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  vertical-align: middle;
}
.help-inline-badge.ok-inline { background: rgba(91, 154, 139, 0.16); color: var(--color-success, #5B9A8B); }
.help-inline-badge.borderline-inline { background: rgba(212, 160, 70, 0.16); color: var(--color-warning, #D4A046); }
.help-inline-badge.overtime-inline,
.help-inline-badge.err-inline { background: rgba(199, 93, 93, 0.16); color: var(--color-destructive, #C75D5D); }
.help-inline-badge.unassigned-inline { background: rgba(124, 111, 171, 0.16); color: var(--color-info, #7C6FAB); }
.help-inline-badge.geo-failed-inline { background: rgba(199, 93, 93, 0.14); color: var(--color-destructive, #C75D5D); }

@media (max-width: 640px) {
  .help-card { max-width: 100%; }
  .help-body { padding: 18px 18px; }
  .help-glossary { grid-template-columns: 1fr; gap: 2px; }
  .help-glossary dt { margin-top: 10px; }
}
