:root {
  color-scheme: light;
  --blue: #1a73e8;
  --blue-strong: #0b57d0;
  --red: #ea4335;
  --yellow: #fbbc04;
  --green: #34a853;
  --ink: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --soft-line: #e8eaed;
  --surface: #ffffff;
  --wash: #f8fafd;
  --chip: #f1f3f4;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.18), 0 1px 3px rgba(60, 64, 67, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: #fff;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  background: #f8fafd;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

button.primary,
.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

button.primary:hover,
.primary:hover {
  background: var(--blue-strong);
}

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

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 72px;
  border-bottom: 1px solid var(--soft-line);
  display: grid;
  grid-template-columns: 210px minmax(280px, 760px) auto;
  gap: 24px;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.icon-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.trip-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  width: 176px;
  padding: 6px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(32, 33, 36, 0.18);
}

.trip-menu.hidden {
  display: none;
}

.trip-menu button {
  width: 100%;
  border: 0;
  text-align: left;
  background: #fff;
}

.trip-menu button:hover {
  background: var(--wash);
}

.save-status {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.save-status[data-tone="saved"] {
  color: #137333;
}

.save-status[data-tone="error"] {
  color: #b3261e;
}

.shared-banner {
  width: min(1424px, calc(100% - 56px));
  margin: 14px auto -8px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px 8px 16px;
  border: 1px solid #c4d7f8;
  border-radius: 8px;
  background: #f3f7fe;
  color: #174ea6;
  font-size: 13px;
}

.shared-banner.hidden {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 600;
  color: #3c4043;
  min-width: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  display: block;
  border-radius: 8px;
}

.search-box {
  height: 46px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.12);
  overflow: hidden;
}

.search-box:focus-within {
  border-color: transparent;
  box-shadow: 0 1px 8px rgba(32, 33, 36, 0.2);
}

.search-box input {
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 20px;
  min-width: 0;
  font-size: 16px;
}

.search-box button {
  height: 36px;
  margin-right: 5px;
  border-radius: 20px;
}

.workspace {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px 28px 18px;
  display: grid;
  grid-template-columns: 340px minmax(380px, 1fr) 460px;
  gap: 20px;
  align-items: start;
}

.controls-panel,
.recommend-panel,
.plan-panel {
  background: var(--surface);
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.controls-panel {
  padding: 18px;
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.recommend-panel,
.plan-panel {
  min-height: 620px;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.recommend-panel {
  display: flex;
  flex-direction: column;
}

.plan-panel {
  display: flex;
  flex-direction: column;
}

.section-head,
.panel-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.panel-toolbar {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--soft-line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
}

.panel-toolbar p,
.footnote,
.card-meta,
.small-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.city-badge,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 16px;
  background: #e8f0fe;
  color: #174ea6;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.form-grid,
.meal-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.trip-builder {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--soft-line);
}

.inline-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.day-tabs {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.add-day {
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  border-style: dashed;
  color: var(--blue);
  background: #fff;
}

.add-day:hover {
  background: #f8fbff;
  border-color: var(--blue);
}

.day-tab {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 8px 10px;
  text-align: left;
  border-radius: 8px;
}

.day-tab.active {
  border-color: rgba(26, 115, 232, 0.45);
  background: #e8f0fe;
  color: #174ea6;
}

.day-number {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--chip);
  color: #3c4043;
  font-size: 13px;
  font-weight: 600;
}

.day-tab.active .day-number {
  background: #fff;
  color: var(--blue);
}

.day-name {
  min-width: 0;
}

.day-name strong,
.day-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-name strong {
  font-size: 14px;
}

.day-name span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.form-grid {
  grid-template-columns: 1fr;
}

.meal-grid {
  grid-template-columns: 1fr 1fr;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  width: 100%;
}

input:focus,
select:focus {
  outline: 2px solid rgba(26, 115, 232, 0.18);
  border-color: var(--blue);
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
}

.metric-row div {
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  padding: 10px 8px;
  background: var(--wash);
}

.metric-row strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.metric-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.recommend-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--soft-line);
}

.select-toggle {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #3c4043;
  cursor: pointer;
}

.select-toggle input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--blue);
}

.recommend-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.transport-options {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.transport-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  background: var(--chip);
  color: #3c4043;
  font-size: 12px;
  white-space: nowrap;
}

.transport-pill.recommended {
  background: #e8f0fe;
  color: #174ea6;
  font-weight: 600;
}

.tabs {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 3px;
  background: var(--chip);
  border-radius: 8px;
}

.tab {
  border: 0;
  min-height: 32px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.14);
}

.place-search {
  display: grid;
  grid-template-columns: 1fr 96px auto;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--soft-line);
}

.card-list {
  display: grid;
  gap: 10px;
  padding: 14px;
  overflow-y: auto;
  flex: 1 1 auto;
  align-content: start;
}

.recommend-panel.browsing .panel-toolbar {
  padding-top: 8px;
  padding-bottom: 8px;
  align-items: center;
}

.recommend-panel.browsing .panel-toolbar > div:first-child,
.recommend-panel.browsing .place-search {
  display: none;
}

.recommend-panel.browsing .panel-toolbar .tabs {
  width: 100%;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.recommend-panel.browsing .recommend-actions {
  padding-top: 4px;
  padding-bottom: 4px;
}

.place-card {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  padding: 13px;
  background: #fff;
}

.place-card.selected {
  border-color: rgba(26, 115, 232, 0.45);
  background: #f8fbff;
}

.place-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin-top: 2px;
  accent-color: var(--blue);
}

.card-title-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: flex-start;
}

.place-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0;
}

.place-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--soft-line);
  background: var(--wash);
  margin-bottom: 11px;
}

.score {
  min-width: 44px;
  text-align: right;
  color: var(--blue);
  font-weight: 600;
}

.place-detail {
  margin: 7px 0 0;
  color: #3c4043;
  font-size: 13px;
  line-height: 1.55;
}

.tag-row,
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  background: var(--chip);
  color: #3c4043;
  font-size: 12px;
}

.tag.must {
  color: #a50e0e;
  background: #fce8e6;
}

.tag.food {
  color: #0d652d;
  background: #e6f4ea;
}

.tag.shopping {
  color: #8d4e00;
  background: #fff3e0;
}

.link-row a {
  color: var(--blue);
  text-decoration: none;
  font-size: 13px;
}

.link-row a:hover {
  text-decoration: underline;
}

.route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.map-preview {
  margin: 14px;
  height: 310px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(218, 220, 224, 0.5) 1px, transparent 1px),
    linear-gradient(0deg, rgba(218, 220, 224, 0.5) 1px, transparent 1px), #fbfcff;
  background-size: 42px 42px;
  overflow: hidden;
  position: relative;
  flex: 0 0 auto;
  transition: height 180ms ease, margin 180ms ease;
}

.plan-panel.map-compact .map-preview {
  height: 150px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.map-preview svg {
  width: 100%;
  height: 100%;
  display: block;
}

.amap-map,
.mapkit-map,
.leaflet-map,
.map-fallback {
  position: absolute;
  inset: 0;
}

.amap-map {
  z-index: 3;
}

.mapkit-map {
  z-index: 2;
}

.leaflet-map {
  z-index: 1;
}

.map-fallback {
  z-index: 0;
}

.amap-map.hidden,
.mapkit-map.hidden,
.leaflet-map.hidden,
.map-fallback.hidden {
  display: none;
}

.leaflet-container {
  font: 12px -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, sans-serif;
}

.marker-label {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(60, 64, 67, 0.35);
  font-weight: 700;
  font-size: 12px;
}

.marker-label.meal {
  background: var(--green);
}

.marker-label.start {
  background: #5f6368;
}

.timeline {
  display: block;
  padding: 0 14px 16px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.timeline-item {
  display: grid;
  grid-template-columns: 72px 18px 1fr;
  gap: 10px;
  min-height: 64px;
}

.timeline-time {
  color: var(--muted);
  font-size: 13px;
  padding-top: 3px;
}

.timeline-line {
  position: relative;
}

.timeline-line::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: -16px;
  left: 8px;
  width: 2px;
  background: var(--soft-line);
}

.timeline-item:last-child .timeline-line::before {
  display: none;
}

.timeline-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(26, 115, 232, 0.35);
  position: relative;
  z-index: 1;
}

.timeline-dot.meal {
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(52, 168, 83, 0.35);
}

.timeline-dot.travel {
  background: #9aa0a6;
  box-shadow: 0 0 0 1px rgba(154, 160, 166, 0.35);
}

.timeline-body {
  padding-bottom: 14px;
}

.timeline-title {
  display: flex;
  gap: 6px;
  font-weight: 600;
  line-height: 1.3;
}

.timeline-order {
  flex: 0 0 auto;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.timeline-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 30px;
}

.share-dialog {
  width: min(560px, calc(100% - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(32, 33, 36, 0.24);
}

.share-dialog::backdrop {
  background: rgba(32, 33, 36, 0.38);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--soft-line);
}

.dialog-head p,
.dialog-message {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.share-section {
  padding: 18px 18px 8px;
}

.field-label {
  color: var(--muted);
  font-size: 13px;
}

.share-permission {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 12px 0 4px;
  padding: 3px;
  border: 0;
  border-radius: 8px;
  background: var(--chip);
}

.share-permission legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.share-permission label {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  color: #3c4043;
  cursor: pointer;
}

.share-permission label:has(input:checked) {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.16);
}

.share-permission input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--blue);
}

.share-link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.dialog-message {
  min-height: 28px;
  padding: 0 18px 16px;
}

.footnote {
  border-top: 1px solid var(--soft-line);
  padding: 12px 28px 18px;
  text-align: center;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 300px minmax(360px, 1fr);
  }

  .plan-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions .save-status {
    margin-right: auto;
  }

  .shared-banner {
    width: calc(100% - 32px);
    margin-top: 12px;
    margin-bottom: 0;
    align-items: flex-start;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .controls-panel {
    position: static;
    max-height: none;
  }

  .recommend-panel,
  .plan-panel {
    max-height: none;
  }

  .plan-panel.map-compact .map-preview {
    height: 190px;
  }

  .panel-toolbar {
    display: grid;
  }

  .tabs {
    grid-auto-flow: row;
    grid-template-columns: repeat(5, 1fr);
  }

  .metric-row {
    grid-template-columns: 1fr;
  }

  .place-search {
    grid-template-columns: 1fr;
  }

  .share-link-row {
    grid-template-columns: 1fr;
  }
}
