.route-view {
  display: flex;
  height: calc(100vh - 8px);
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.route-view__topbar,
.route-view__summary {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.route-view__topbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 12px 20px;
  overflow: hidden;
}

.route-view__module-title {
  display: flex;
  width: 270px;
  flex: 0 0 270px;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
}

.route-view__module-title h2,
.route-view__module-title p,
.route-view__summary h3,
.route-view__summary-note,
.route-view__stop-info h4,
.route-view__stop-info p { margin: 0; }

.route-view__module-title h2 {
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
}

.route-view__module-title p {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
}

.route-view__date-nav,
.route-view__topbar-actions,
.route-view__summary-actions,
.route-view__summary-meta,
.route-view__stop-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-view__date-nav { min-width: 0; }
.route-view__date-nav strong {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 18px;
  white-space: nowrap;
}

.route-view__flex-spacer { min-width: 0; flex: 1 1 auto; }

.route-view__button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--action-secondary-bg);
  color: var(--action-secondary-text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.route-view__button:hover:not(:disabled),
.route-view__button:focus-visible:not(:disabled) {
  border-color: #b8c1cc;
  background: #e4eaf0;
  outline: 2px solid rgb(120 144 156 / 24%);
  outline-offset: 1px;
}

.route-view__button--neutral {
  border-color: var(--border);
  background: var(--history-bg);
  color: var(--history-text);
}

.route-view__button--primary {
  border-color: transparent;
  background: var(--sidebar);
  color: #ffffff;
}

.route-view__button--primary:hover:not(:disabled),
.route-view__button--primary:focus-visible:not(:disabled) {
  border-color: transparent;
  background: var(--sidebar-active);
  color: #ffffff;
}

.route-view__button--secondary { background: var(--action-secondary-bg); color: var(--action-secondary-text); }
.route-view__button--icon { width: 41px; padding: 8px; }
.route-view__button--move-icon {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  line-height: 1;
}

.route-view__button--move-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.route-view__button:disabled,
.route-view__button--disabled {
  border-color: #d9dee7;
  background: #eef2f6;
  color: #66727d;
  cursor: not-allowed;
  opacity: 1;
}

.route-view__summary {
  display: flex;
  min-height: 96px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  overflow: hidden;
}

.route-view__summary-data {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.route-view__summary h3 {
  overflow: hidden;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-view__summary-meta { min-width: 0; }

.route-view__pill {
  display: inline-flex;
  height: 24px;
  align-items: center;
  padding: 4px 12px;
  border: 1px solid var(--history-border);
  border-radius: 999px;
  background: var(--history-bg);
  color: var(--history-text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.route-view__summary-note {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-view__summary-actions { flex: 0 0 auto; }

.route-view__topbar-actions .app-back-link { flex: 0 0 auto; }

.route-view__notice {
  display: flex;
  min-height: 48px;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--awaiting-border);
  border-radius: 8px;
  background: var(--awaiting-bg);
  color: var(--awaiting-text);
  font-size: 12px;
  line-height: 16px;
}

.route-view__notice::before {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  content: "!";
  font-weight: 700;
}

.route-view__list {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 0 24px 16px;
  scrollbar-color: rgb(69 90 100 / 85%) transparent;
  scrollbar-width: thin;
}

.route-view__list::-webkit-scrollbar { width: 4px; }
.route-view__list::-webkit-scrollbar-track { background: transparent; }
.route-view__list::-webkit-scrollbar-thumb { border-radius: 999px; background: rgb(69 90 100 / 85%); }

.route-view__stop-card {
  display: grid;
  min-height: 124px;
  flex: 0 0 auto;
  grid-template-columns: 64px 170px minmax(0, 1fr) 260px;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.route-view__stop-order {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.route-view__order-number {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--history-border);
  border-radius: 999px;
  background: var(--history-bg);
  color: var(--history-text);
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
}

.route-view__drag-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
}

.route-view__drag-hint { font-size: 16px; line-height: 16px; }

.route-view__schedule,
.route-view__stop-info,
.route-view__stop-actions {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.route-view__schedule { gap: 8px; }
.route-view__schedule strong {
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
  white-space: nowrap;
}

.route-view__schedule span,
.route-view__stop-info p {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-view__stop-info { gap: 8px; overflow: hidden; }
.route-view__stop-info h4 {
  overflow: hidden;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-view__stop-actions { align-items: flex-end; gap: 12px; }

.route-view__status {
  display: inline-flex;
  height: 22px;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border: 1px solid var(--confirmed-border);
  border-radius: 6px;
  background: var(--confirmed-bg);
  color: var(--confirmed-text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.route-view__stop-buttons .route-view__button { min-height: 32px; }

.route-view__empty {
  margin: 0;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1023px) {
  .route-view__topbar { flex-wrap: wrap; }
  .route-view__module-title { flex: 1 1 100%; order: 1; }
  .route-view__date-nav { order: 2; }
  .route-view__flex-spacer { display: none; }
  .route-view__topbar-actions { order: 3; margin-left: auto; }
  .route-view__summary { align-items: flex-start; flex-direction: column; }
  .route-view__summary-actions { width: 100%; flex-wrap: wrap; justify-content: flex-end; }
  .route-view__summary-note { white-space: normal; }
  .route-view__stop-card {
    grid-template-areas:
      "order info"
      "schedule actions";
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px 16px;
  }
  .route-view__stop-order { grid-area: order; }
  .route-view__schedule { grid-area: schedule; }
  .route-view__stop-info { grid-area: info; }
  .route-view__stop-actions { grid-area: actions; align-items: flex-end; }
}

@media (max-width: 639px) {
  .route-view {
    height: calc(100vh - 72px);
    overflow: hidden;
  }

  .route-view__topbar {
    min-height: 136px;
    align-content: center;
    padding: 12px;
  }

  .route-view__module-title h2 { font-size: 19px; }
  .route-view__date-nav { max-width: 100%; flex-wrap: wrap; }
  .route-view__date-nav strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .route-view__topbar-actions { max-width: 100%; flex-wrap: wrap; }
  .route-view__topbar-actions .route-view__button { padding-right: 10px; padding-left: 10px; }
  .route-view__summary { margin: 0; padding: 12px; }
  .route-view__summary h3 { font-size: 18px; }
  .route-view__summary-meta { flex-wrap: wrap; }
  .route-view__summary-note { flex-basis: 100%; white-space: normal; }
  .route-view__summary-actions { justify-content: flex-start; }
  .route-view__summary-actions .route-view__button { flex: 1 1 auto; padding-right: 10px; padding-left: 10px; }
  .route-view__notice { min-height: 58px; padding: 10px 12px; }
  .route-view__list { padding: 0 0 8px; scrollbar-width: none; }
  .route-view__list::-webkit-scrollbar { display: none; }
  .route-view__stop-card {
    min-height: 180px;
    grid-template-areas:
      "order info"
      "order schedule"
      "order actions";
    padding: 12px;
  }
  .route-view__schedule strong,
  .route-view__stop-info h4 { font-size: 17px; line-height: 22px; }
  .route-view__schedule { gap: 4px; align-self: start; }
  .route-view__schedule strong { white-space: normal; }
  .route-view__stop-actions { align-items: flex-start; flex-direction: row; justify-content: space-between; }
  .route-view__stop-buttons { gap: 4px; }
  .route-view__stop-buttons .route-view__button { padding-right: 10px; padding-left: 10px; }
}
