:root {
  --bg: #f6f5ef;
  --surface: #ffffff;
  --surface-2: #eef4f1;
  --ink: #17211d;
  --muted: #66756f;
  --line: #dfe6e1;
  --brand: #1f7a5f;
  --brand-2: #e0573f;
  --accent: #2e6f9e;
  --shadow: 0 18px 45px rgba(31, 49, 41, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(31, 49, 41, 0.1);
  background: rgba(246, 245, 239, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
}

.nav {
  display: flex;
  gap: 4px;
  justify-content: center;
  overflow-x: auto;
}

.nav a {
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--muted);
  white-space: nowrap;
}

.nav a.active,
.nav a:hover {
  background: #e6eee9;
  color: var(--ink);
}

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

.account form {
  margin: 0;
}

.account-name {
  max-width: 110px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 28px;
  align-items: stretch;
  min-height: calc(100vh - 96px);
  padding: 36px 0 26px;
}

.workbench-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.eyebrow {
  width: fit-content;
  margin-bottom: 14px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

.workbench h1 {
  max-width: 720px;
  margin-bottom: 18px;
  font-size: clamp(42px, 6vw, 78px);
  line-height: 1.02;
  letter-spacing: 0;
}

.lead {
  max-width: 560px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.7;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 700;
}

.button {
  padding: 0 16px;
}

.button.primary {
  background: var(--brand);
  color: #fff;
}

.button.secondary,
.button.ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.button.danger {
  background: var(--brand-2);
  color: #fff;
}

.button.full {
  width: 100%;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.icon-button {
  width: 38px;
  height: 38px;
  background: #fff;
  color: var(--ink);
}

.route-preview {
  display: flex;
  align-items: center;
  min-height: 520px;
}

.preview-map {
  position: relative;
  width: 100%;
  height: min(66vh, 620px);
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(31, 122, 95, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(31, 122, 95, 0.08) 1px, transparent 1px),
    #ecf1ec;
  background-size: 42px 42px;
  box-shadow: var(--shadow);
}

.preview-map::before,
.preview-map::after {
  position: absolute;
  content: "";
  background: rgba(46, 111, 158, 0.18);
}

.preview-map::before {
  left: -8%;
  top: 15%;
  width: 86%;
  height: 30%;
  transform: rotate(-13deg);
}

.preview-map::after {
  right: -15%;
  bottom: 6%;
  width: 72%;
  height: 36%;
  transform: rotate(18deg);
}

.route-line {
  position: absolute;
  z-index: 2;
  left: 22%;
  top: 23%;
  width: 56%;
  height: 48%;
  border-top: 5px solid var(--brand);
  border-right: 5px solid var(--brand);
  border-bottom: 5px solid var(--brand);
  border-radius: 48% 38% 56% 34%;
  transform: rotate(8deg);
}

.pin {
  position: absolute;
  z-index: 3;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(31, 122, 95, 0.18);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(31, 49, 41, 0.16);
  font-weight: 800;
}

.pin span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-2);
  color: #fff;
}

.p1 { left: 14%; top: 22%; }
.p2 { right: 18%; top: 28%; }
.p3 { left: 34%; bottom: 24%; }
.p4 { right: 12%; bottom: 16%; }

.section-grid,
.two-column {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  padding: 18px 0 42px;
}

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

.panel,
.post-card,
.trip-card,
.booking-card,
.auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(31, 49, 41, 0.07);
}

.panel {
  padding: 22px;
}

.panel.compact {
  height: fit-content;
}

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

.panel-head h2,
.panel h2,
.post-card h2,
.trip-card h2,
.booking-card h2 {
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.25;
}

.panel-head a {
  color: var(--brand);
  font-weight: 700;
}

.list {
  display: grid;
  gap: 8px;
}

.list-item {
  display: grid;
  gap: 4px;
  padding: 13px;
  border-radius: 7px;
  background: var(--surface-2);
}

small,
.post-meta,
.list-item small,
.trip-card small {
  color: var(--muted);
}

.empty {
  padding: 18px;
  border: 1px dashed #bdcbc4;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
}

.empty.large {
  padding: 36px;
}

.page-head {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  padding: 34px 0 24px;
}

.page-head h1 {
  margin-bottom: 8px;
  font-size: 42px;
  line-height: 1.1;
}

.page-head p {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.search,
.lookup-row,
.split {
  display: flex;
  gap: 10px;
}

.search input {
  width: min(360px, 52vw);
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #34413c;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #ccd8d2;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 122, 95, 0.13);
}

.notice {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 7px;
  background: #edf4f0;
  color: var(--muted);
}

.notice.error {
  background: #fff0ec;
  color: #9b321e;
}

.feed,
.trip-grid,
.booking-grid {
  display: grid;
  gap: 14px;
}

.form-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.trip-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  align-content: start;
}

.post-card,
.trip-card a,
.booking-card {
  display: grid;
  gap: 8px;
  padding: 20px;
}

.post-card p,
.trip-card p,
.booking-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span {
  padding: 5px 9px;
  border-radius: 7px;
  background: #e9f0ec;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.reading {
  max-width: 820px;
  margin: 0 auto;
  padding: 42px 0 70px;
}

.reading h1 {
  margin-bottom: 16px;
  font-size: 44px;
  line-height: 1.12;
}

.external {
  color: var(--brand);
  font-weight: 800;
}

.prose {
  margin: 24px 0;
  color: #2a3933;
  font-size: 17px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.auth-shell,
.edit-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 90px);
  padding: 32px 0;
}

.auth-card {
  width: min(420px, 100%);
  padding: 26px;
}

.auth-card h1 {
  font-size: 34px;
}

.auth-card p {
  margin: 18px 0 0;
  color: var(--muted);
}

.auth-card a {
  color: var(--brand);
  font-weight: 800;
}

.trip-layout {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 20px;
  width: min(1480px, calc(100vw - 28px));
  margin: 0 calc((100% - min(1480px, calc(100vw - 28px))) / 2);
  padding: 20px 0 34px;
}

.trip-sidebar {
  min-width: 0;
}

.trip-title {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.trip-title a {
  color: var(--brand);
  font-weight: 800;
}

.trip-title h1 {
  margin: 10px 0 8px;
  font-size: 29px;
  line-height: 1.18;
}

.trip-title p {
  margin-bottom: 0;
  color: var(--muted);
}

.stop-form {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stop-form h2 {
  font-size: 22px;
}

.map-workspace {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.trip-map {
  height: min(62vh, 620px);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dbe8e2;
  box-shadow: var(--shadow);
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.timeline-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.timeline-top {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
}

.timeline-top h2 {
  margin-bottom: 6px;
  font-size: 21px;
}

.timeline-top span,
.meta-row {
  color: var(--muted);
}

.timeline-item p {
  margin-bottom: 8px;
  color: var(--muted);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
}

.meta-row span {
  padding: 5px 8px;
  border-radius: 7px;
  background: #edf4f0;
}

.notes {
  padding-top: 6px;
  color: #33433d !important;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.row-actions a,
.row-actions button {
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font-weight: 800;
  padding: 0;
}

.lookup-row input {
  min-width: 0;
}

.lookup-results {
  display: grid;
  gap: 6px;
  margin: -6px 0 12px;
}

.lookup-results button,
.lookup-note {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf8;
  padding: 9px;
  color: var(--muted);
  text-align: left;
}

.booking-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  padding-bottom: 52px;
}

.booking-card span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    order: 3;
    padding-bottom: 10px;
  }

  .workbench,
  .section-grid,
  .two-column,
  .trip-layout {
    grid-template-columns: 1fr;
  }

  .workbench {
    min-height: auto;
  }

  .route-preview {
    min-height: auto;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .search input {
    width: 100%;
  }
}

@media (max-width: 640px) {
  main {
    width: min(100% - 22px, 1180px);
  }

  .topbar {
    padding: 0 12px;
  }

  .brand span:last-child {
    display: none;
  }

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

  .page-head h1,
  .reading h1 {
    font-size: 34px;
  }

  .split,
  .search,
  .lookup-row,
  .timeline-top {
    flex-direction: column;
  }

  .trip-layout {
    width: min(100% - 18px, 1480px);
    margin: 0 auto;
  }

  .trip-map {
    min-height: 360px;
  }
}
