:root {
  --bg: #f6f3ee;
  --surface: #fffdf8;
  --ink: #1e2723;
  --muted: #637069;
  --line: #ded8cd;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --accent: #c2410c;
  --shadow: 0 18px 45px rgba(30, 39, 35, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  font-weight: 800;
  text-decoration: none;
}

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

.shell,
.print-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.page-head,
.stop-hero,
.report-head {
  padding: 10px 0 22px;
}

.eyebrow,
.meta {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.15rem;
}

.page-head p,
.stop-hero p,
.route-card p,
.info-grid p,
.panel p,
.report-head p {
  color: var(--muted);
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.route-card,
.panel,
.info-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.route-card {
  display: flex;
  min-height: 250px;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
}

.route-card h2 {
  font-size: 1.45rem;
}

.route-covers {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.route-covers img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  object-fit: cover;
}

.route-distance {
  color: var(--ink);
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

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

.button.primary:hover {
  background: var(--primary-dark);
}

.button.ghost {
  background: transparent;
}

.button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.progress-wrap {
  max-width: 520px;
}

.progress-label,
.status,
small {
  color: var(--muted);
  font-size: 0.9rem;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5dfd4;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.stop-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stop-row a {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
}

.order {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: #e0f2f1;
  color: var(--primary-dark);
  font-weight: 900;
}

.actions,
.pager,
.print-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 10px 0 16px;
}

.info-grid > div,
.panel {
  padding: 18px;
}

.panel {
  margin: 16px 0;
}

textarea,
input[type="file"],
input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  padding: 12px;
  resize: vertical;
}

input[type="file"] {
  padding: 10px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  min-height: 44px;
  padding: 10px 12px;
}

.author-line {
  color: var(--muted);
  font-size: 0.92rem;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

.codebox {
  min-height: 360px;
  font-family: Consolas, Monaco, monospace;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre;
}

.plain-list {
  margin: 0;
  padding-left: 22px;
}

.plain-list li {
  margin: 8px 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.notice {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.notice.success {
  border-color: #99d6c8;
  background: #ecfdf8;
}

.notice.error {
  border-color: #f0b4a2;
  background: #fff1ed;
  color: #8f2d12;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.gallery figure {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.gallery figcaption {
  padding: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.report-stop {
  break-inside: avoid;
  margin: 22px 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.print-gallery {
  grid-template-columns: repeat(3, 1fr);
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  min-height: calc(100vh - 69px);
}

.map-side {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow: auto;
}

.map-side h1 {
  font-size: 2.2rem;
}

.map-canvas-wrap {
  min-height: calc(100vh - 69px);
}

.route-map {
  width: 100%;
  min-height: calc(100vh - 69px);
}

.mini-stop-list {
  margin: 18px 0 0;
  padding-left: 22px;
}

.mini-stop-list li {
  margin: 8px 0;
}

.mini-stop-list a {
  text-decoration: none;
}

.map-photos {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 6px;
  margin-top: 8px;
}

.map-photos img {
  display: block;
  width: 72px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
}

.map-popup-photo {
  display: block;
  width: 180px;
  max-width: 70vw;
  border-radius: 6px;
}

@media (max-width: 760px) {
  .shell,
  .print-shell {
    width: min(100% - 24px, 1040px);
    padding-top: 20px;
  }

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

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

  .topbar {
    padding-inline: 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  .topnav,
  .topnav .button {
    width: 100%;
  }

  .map-layout {
    grid-template-columns: 1fr;
  }

  .map-side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .map-canvas-wrap,
  .route-map {
    min-height: 68vh;
  }
}

@media print {
  .topbar,
  .print-actions {
    display: none;
  }

  body {
    background: #fff;
  }

  .print-shell {
    width: 100%;
    padding: 0;
  }

  .gallery figure {
    box-shadow: none;
  }
}
