.sim-page {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sim-title {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 800;
  color: #111827;
}

.sim-subtitle {
  font-size: 0.9rem;
  font-weight: 600;
  color: #6b7280;
  line-height: 1.5;
}

.sim-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.sim-toolbar-field {
  min-width: 180px;
}

.sim-toolbar-field .form-label {
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #374151;
}

.sim-run-btn {
  font-weight: 800;
  min-width: 150px;
}

.sim-run-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.sim-status {
  font-size: 0.85rem;
  font-weight: 700;
}

.sim-status.is-error {
  color: #b91c1c;
}

.sim-status.is-success {
  color: #047857;
}

.sim-empty {
  text-align: center;
  padding: 48px 20px;
  color: #6b7280;
}

.sim-empty i {
  font-size: 2rem;
  color: #93a3d4;
  margin-bottom: 12px;
  display: block;
}

.sim-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sim-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.sim-summary-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sim-summary-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sim-summary-card strong {
  font-size: 1.2rem;
  color: #111827;
}

.sim-panel-head h2 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 800;
  color: #111827;
}

.sim-panel-head p {
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
}

.sim-panel-head {
  margin-bottom: 14px;
}

.sim-panel-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sim-panel-head-text {
  flex: 1;
  min-width: 0;
}

.sim-panel-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sim-panel-toggle:hover {
  background: #f3f4f6;
}

.sim-panel-toggle i {
  transition: transform 0.2s ease;
}

.sim-panel.is-collapsed .sim-panel-body {
  display: none;
}

.sim-panel.is-collapsed .sim-panel-head {
  margin-bottom: 0;
}

.sim-panel.is-collapsed .sim-panel-toggle i {
  transform: rotate(180deg);
}

.sim-timeline-wrap {
  overflow-x: auto;
}

.sim-timeline {
  min-width: 960px;
}

.sim-timeline-head,
.sim-timeline-row {
  display: grid;
  grid-template-columns: 220px repeat(var(--hour-count), minmax(72px, 1fr));
  gap: 4px;
  align-items: stretch;
}

.sim-timeline-head {
  margin-bottom: 6px;
}

.sim-timeline-driver-col,
.sim-timeline-hour-col,
.sim-timeline-cell {
  border-radius: 8px;
  padding: 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.sim-timeline-driver-col {
  background: #eef2ff;
  color: #1e3a8a;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.sim-timeline-driver-col small {
  color: #4b5563;
  font-weight: 600;
}

.sim-timeline-hour-col {
  text-align: center;
  background: #f8fafc;
  color: #475569;
}

.sim-timeline-cell {
  min-height: 56px;
  background: #f9fafb;
  border: 1px dashed #e5e7eb;
  position: relative;
  pointer-events: auto;
}

.sim-timeline-cell .sim-event {
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.sim-event {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 0;
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.sim-event-spans-next {
  border-right: 3px solid rgba(255, 255, 255, 0.65);
}

.sim-event-span-hint {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  opacity: 0.9;
  font-weight: 700;
}

.sim-event:hover {
  filter: brightness(1.08);
}

.sim-event-order {
  background: #2563eb;
}

.sim-badge-car {
  background: #e5e7eb;
  color: #374151;
}

.sim-detail-btn {
  font-weight: 700;
  padding: 2px 8px;
}

.sim-detail-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin-bottom: 16px;
}

.sim-detail-explain {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
}

.sim-detail-explain-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #1e40af;
  font-size: 0.84rem;
  font-weight: 800;
}

.sim-detail-explain-body {
  color: #1f2937;
}

.sim-explain-line {
  margin: 0 0 8px;
  font-size: 0.84rem;
  line-height: 1.45;
  font-weight: 600;
}

.sim-explain-line:last-child {
  margin-bottom: 0;
}

.sim-detail-item {
  font-size: 0.82rem;
}

.sim-detail-item strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
  margin-bottom: 2px;
}

.sim-detail-json-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #374151;
  margin-bottom: 8px;
}

.sim-detail-json {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.75rem;
  line-height: 1.45;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 767.98px) {
  .sim-detail-summary {
    grid-template-columns: 1fr;
  }
}

.sim-event-moving {
  background: #ea580c;
}

.sim-event-slot {
  opacity: 0.9;
  font-weight: 800;
}

.sim-driver-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}

.sim-driver-card-head {
  background: #f8fafc;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sim-driver-card-head strong {
  color: #111827;
}

.sim-driver-card-head span {
  font-size: 0.82rem;
  color: #6b7280;
  font-weight: 700;
}

.sim-table th,
.sim-table td {
  font-size: 0.82rem;
  vertical-align: top;
}

.sim-table th {
  background: #f8fafc;
  font-weight: 800;
}

.sim-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.sim-badge-pagi {
  background: #dbeafe;
  color: #1d4ed8;
}

.sim-badge-siang {
  background: #fef3c7;
  color: #b45309;
}

.sim-badge-sore {
  background: #ede9fe;
  color: #6d28d9;
}

.sim-badge-order {
  background: #dbeafe;
  color: #1d4ed8;
}

.sim-badge-moving {
  background: #ffedd5;
  color: #c2410c;
}

.sim-map {
  width: 100%;
  height: 420px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.sim-map-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sim-map-toolbar .form-select {
  min-width: 220px;
  max-width: 280px;
}

.sim-map-speed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #374151;
}

.sim-map-speed .form-select {
  min-width: 72px;
}

.sim-map-clock {
  margin-left: auto;
  font-size: 0.95rem;
  font-weight: 800;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.sim-map-delivery-info {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  min-height: 52px;
}

.sim-map-delivery-empty {
  font-size: 0.84rem;
  font-weight: 600;
  color: #6b7280;
}

.sim-map-delivery-info.is-active {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.sim-map-delivery-info.is-moving {
  border-color: #fed7aa;
  background: #fff7ed;
}

.sim-map-delivery-type {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1d4ed8;
  margin-bottom: 4px;
}

.sim-map-delivery-info.is-moving .sim-map-delivery-type {
  color: #c2410c;
}

.sim-map-delivery-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 2px;
}

.sim-map-delivery-route,
.sim-map-delivery-phase,
.sim-map-delivery-products {
  font-size: 0.82rem;
  font-weight: 600;
  color: #4b5563;
}

.sim-map-delivery-products {
  margin-top: 4px;
  line-height: 1.35;
}

.sim-map-delivery-products strong {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #374151;
  margin-bottom: 2px;
}

.sim-map-delivery-phase {
  margin-top: 4px;
  color: #1f2937;
}

.sim-map-wrap {
  position: relative;
}

.sim-motor-marker {
  background: transparent;
  border: 0;
}

.sim-motor-marker-inner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2563eb;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.25rem;
  line-height: 1;
  transform-origin: center center;
  transition: transform 0.15s linear;
}

.sim-motor-marker-inner.is-playing {
  animation: sim-motor-drive 0.8s ease-in-out infinite;
}

.sim-stop-marker {
  background: transparent;
  border: 0;
}

.sim-stop-marker-inner {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.sim-stop-marker--home {
  background: #1d4ed8;
  color: #fff;
}

.sim-branch-pin-marker,
.sim-customer-pin-marker {
  background: transparent;
  border: 0;
}

.sim-branch-pin-wrap,
.sim-customer-pin {
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sim-branch-pin-wrap.is-active-stop,
.sim-customer-pin.is-active-stop {
  transform: scale(1.12);
  z-index: 2;
}

.sim-branch-pin-wrap.is-active-stop .sim-branch-pin,
.sim-customer-pin.is-active-stop {
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.35),
    0 4px 14px rgba(15, 23, 42, 0.3);
}

.sim-branch-pin {
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 0;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.28);
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sim-branch-pin--origin {
  background: #6366f1;
}

.sim-branch-pin--dest {
  background: #ea580c;
}

.sim-branch-pin-glyph {
  transform: rotate(45deg);
  color: #fff;
  font-size: 15px;
  line-height: 1;
}

.sim-customer-pin {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  line-height: 1;
}

.sim-customer-pin--fins {
  background: #16a34a;
  color: #fff;
  border-color: #bbf7d0;
}

.sim-customer-pin--sponji {
  background: #f97316;
  color: #fff;
  border-color: #fed7aa;
}

.sim-stop-marker-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
  z-index: 3;
}

@keyframes sim-motor-drive {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.sim-map .leaflet-control-layers {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.sim-map .route-measure-control {
  margin-top: 8px;
}

.sim-map .route-measure-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 16px;
  color: #1d4ed8;
  background: #fff;
}

.sim-map .route-measure-btn:hover,
.sim-map .route-measure-btn.is-active {
  background: #eff6ff;
  color: #1e40af;
}

.sim-map .route-measure-btn.is-active {
  box-shadow: inset 0 0 0 2px #93c5ff;
}

.sim-map .leaflet-container.route-measure-active {
  cursor: crosshair;
}

.sim-map .route-measure-panel {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1000;
  min-width: 220px;
  max-width: 280px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(147, 165, 255, 0.35);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.sim-map .route-measure-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 6px;
}

.sim-map .route-measure-total,
.sim-map .route-measure-segment {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1d4ed8;
}

.sim-map .route-measure-segment {
  color: #374151;
  margin-top: 2px;
}

.sim-map .route-measure-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
}

.sim-map .route-measure-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.sim-map .route-measure-point-label {
  background: transparent;
  border: 0;
}

.sim-map .route-measure-point-label span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1d4ed8;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
}

.sim-time-label {
  display: inline-block;
  min-width: 42px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #6b7280;
  text-transform: uppercase;
}

.sim-ask-wrap {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 1080;
}

.sim-ask-fab {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.sim-ask-fab:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.sim-ask-fab.is-open {
  background: #1e40af;
}

.sim-ask-panel {
  position: absolute;
  left: 0;
  bottom: 68px;
  width: min(380px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  display: none;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid #dbeafe;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.sim-ask-panel.is-open {
  display: flex;
}

.sim-ask-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid #eef2ff;
  background: #eff6ff;
}

.sim-ask-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  color: #1e3a8a;
}

.sim-ask-subtitle {
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
}

.sim-ask-close {
  border-radius: 999px;
}

.sim-ask-messages {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px 14px;
  background: #f8fafc;
}

.sim-ask-message {
  display: flex;
  margin-bottom: 10px;
}

.sim-ask-message.is-user {
  justify-content: flex-end;
}

.sim-ask-message.is-assistant {
  justify-content: flex-start;
}

.sim-ask-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.45;
  font-weight: 600;
  white-space: pre-wrap;
}

.sim-ask-message.is-user .sim-ask-bubble {
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.sim-ask-message.is-assistant .sim-ask-bubble {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}

.sim-ask-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 0;
}

.sim-ask-chip {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.sim-ask-chip:hover {
  background: #dbeafe;
}

.sim-ask-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px;
  border-top: 1px solid #eef2ff;
  background: #fff;
}

.sim-ask-input {
  resize: none;
  min-height: 42px;
}

.sim-ask-send {
  white-space: nowrap;
  font-weight: 700;
}

@media (max-width: 767.98px) {
  .sim-run-btn {
    width: 100%;
  }

  .sim-map {
    height: 320px;
  }

  .sim-map-clock {
    margin-left: 0;
    width: 100%;
  }

  .sim-ask-wrap {
    left: 16px;
    bottom: 16px;
  }

  .sim-ask-panel {
    bottom: 64px;
    width: calc(100vw - 32px);
  }
}
