/* Tour editor: laptop-first, usable on tablets. Colors match the follower app. */
:root {
  color-scheme: light;
  --ink: #20302d; --muted: #60716a; --green: #173f3b; --green-2: #24584f; --green-light: #e7efea;
  --brick: #a54534; --brick-light: #fbeeea; --amber: #8a5a12; --amber-light: #fdf3e1;
  --line: #dce3df; --line-strong: #bfcec4; --bg: #f5f7f6; --surface: #fff; --focus: #b7701e;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--green); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 1.9rem; letter-spacing: -.03em; line-height: 1.2; }
h2 { font-size: 1.15rem; letter-spacing: -.02em; }
h3 { font-size: 1rem; }
p { line-height: 1.55; }
.loading { padding: 60px 32px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 1rem; z-index: 50; padding: .75rem 1rem; background: #fff; }
.skip-link:focus { top: .75rem; }

/* Header */
.topbar { position: sticky; top: 0; z-index: 20; height: 60px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 24px; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 750; letter-spacing: -.04em; white-space: nowrap; }
.brand-mark { background: var(--green); color: #fff; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 1.4rem; font-weight: 400; }
.brand small { font-weight: 450; color: var(--muted); letter-spacing: 0; font-size: .875rem; }
.topnav { display: flex; gap: 4px; height: 100%; }
.topnav a { display: flex; align-items: center; padding: 0 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; font-weight: 600; font-size: .9rem; }
.topnav a[aria-current="page"] { color: var(--green); border-bottom-color: var(--green); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .8125rem; color: var(--muted); }
.topbar-end select { max-width: 220px; }

.page { max-width: 1440px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }

/* Controls */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 7px; padding: 8px 14px; border: 1px solid var(--line-strong); background: #fff; color: var(--green); font-weight: 650; font-size: .875rem; min-height: 38px; text-decoration: none; white-space: nowrap; }
.button:hover:not(:disabled) { background: #f0f4f1; }
.button.primary { background: var(--green); border-color: var(--green); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--green-2); }
.button.danger { color: var(--brick); border-color: #e3c3bb; }
.button.danger:hover:not(:disabled) { background: var(--brick-light); }
.button.quiet { border-color: transparent; background: transparent; }
.button.small { min-height: 30px; padding: 4px 9px; font-size: .8125rem; }
.icon-button { border: 1px solid transparent; background: transparent; border-radius: 6px; min-width: 30px; min-height: 30px; color: var(--muted); font-size: .95rem; line-height: 1; }
.icon-button:hover:not(:disabled) { background: #edf1ee; color: var(--ink); }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; min-width: 0; }
.button-row > .field { flex: 1 1 240px; }
.button-row > .field.field-narrow { flex: 0 0 160px; }
.field > span, .field-label { font-size: .8125rem; font-weight: 650; }
.field .hint { font-size: .75rem; color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=number], input[type=url], input[type=tel], input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; padding: 8px 10px; background: #fff; min-height: 38px; line-height: 1.4;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
select { max-width: 100%; text-overflow: ellipsis; }
input[aria-invalid=true], textarea[aria-invalid=true], select[aria-invalid=true] { border-color: var(--brick); background: #fffaf8; }
.field-problem { color: var(--brick); font-size: .75rem; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .875rem; }
.check input { margin-top: 3px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 14px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: grid; gap: 14px; }
.span-2 { grid-column: span 2; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head p { margin-top: 3px; }
.card-head > .button-row { flex-shrink: 0; }
.subcard { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fbfcfb; }
.notice { border-radius: 8px; padding: 12px 14px; font-size: .875rem; background: var(--green-light); color: var(--green); }
.notice.warning { background: var(--amber-light); color: var(--amber); }
.notice.error { background: var(--brick-light); color: var(--brick); }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px; font-size: .72rem; font-weight: 700; background: var(--green-light); color: var(--green); white-space: nowrap; }
.badge.warning { background: var(--amber-light); color: var(--amber); }
.badge.error { background: var(--brick-light); color: var(--brick); }
.badge.plain { background: #edf1ee; color: var(--muted); }

/* Tables and lists */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .875rem; }
.table th { font-size: .75rem; color: var(--muted); font-weight: 650; background: #fafbfa; }
.table tr:last-child td { border-bottom: 0; }
.table td .button-row { justify-content: flex-end; }
.member-name { display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { border: 0; background: none; padding: 10px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tabs button[aria-selected=true] { color: var(--green); border-bottom-color: var(--green); }

/* Sign in */
.sign-in { max-width: 440px; margin: 64px auto; }
.sign-in h1 { margin-bottom: 8px; }
.sign-in form { display: grid; gap: 14px; margin-top: 20px; }

/* Tour editor */
.editor { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.editor-nav { position: sticky; top: 84px; display: grid; gap: 2px; }
.editor-nav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 11px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem; }
.editor-nav a:hover { background: #edf1ee; }
.editor-nav a[aria-current=page] { background: var(--green-light); color: var(--green); }
.editor-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 18px; }
.editor-bar h1 { font-size: 1.6rem; }
.save-state { font-size: .8125rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.save-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #388366; }
.save-state.unsaved::before, .save-state.saving::before { background: #b67a1e; }
.save-state.error::before { background: var(--brick); }

.stops-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px; align-items: start; }
.stops-layout > *, .editor > *, .stack > * { min-width: 0; }
.stop-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.walk-group + .walk-group { margin-top: 14px; }
.walk-group h3 { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 4px 8px; display: flex; justify-content: space-between; align-items: center; }
.stop-item { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.stop-item .actions { flex-shrink: 0; }
.stop-item > button:first-child { flex: 1; min-width: 0; overflow: hidden; display: flex; gap: 10px; align-items: center; text-align: left; border: 0; background: transparent; padding: 8px; border-radius: 8px; }
.stop-item > button:first-child:hover { background: #edf1ee; }
.stop-item.selected > button:first-child { background: var(--green-light); }
.stop-item strong { display: block; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-item small { display: block; color: var(--muted); font-size: .75rem; margin-top: 2px; }
.stop-item .actions { display: none; }
.stop-item:hover .actions, .stop-item:focus-within .actions, .stop-item.selected .actions { display: flex; }
.number { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: .72rem; font-weight: 700; }
.number.bad { background: var(--brick); }
.map { height: 360px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #e8eeea; position: relative; }
.map-tools { display: flex; gap: 8px; align-items: center; margin: 10px 0 16px; flex-wrap: wrap; }
.map-message { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--muted); font-size: .875rem; }
.map-pin { width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--green); border: 2px solid #fff; box-shadow: 0 2px 6px #0004; display: grid; place-items: center; cursor: pointer; }
.map-pin span { transform: rotate(45deg); color: #fff; font-size: .7rem; font-weight: 750; }
.map-pin.selected { background: var(--focus); width: 34px; height: 34px; }
.map-pin.point { background: var(--brick); }
.search-results { list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; max-height: 220px; overflow: auto; }
.search-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; font-size: .8125rem; }
.search-results button:hover { background: #edf1ee; }

.segment { display: grid; gap: 14px; }
.segment-head { display: flex; align-items: center; gap: 10px; }
.segment-head h3 { flex: 1; }
.kind { font-size: .7rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.media-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: grid; align-content: start; }
.media-card img { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--green-light); }
.media-card audio { width: 100%; }
.media-card .body { padding: 12px; display: grid; gap: 10px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; width: 112px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.thumb img { width: 100%; height: 74px; object-fit: cover; display: block; }
.thumb .button-row { gap: 0; justify-content: center; padding: 2px; }
.upload { display: inline-flex; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload:focus-within .button { outline: 3px solid var(--focus); outline-offset: 2px; }

.problems { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.problems li { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 8px; background: var(--brick-light); color: var(--brick); font-size: .8125rem; }
.problems code { color: var(--muted); font-size: .72rem; }
.preview-list { list-style: none; margin: 0; padding: 0; }
.preview-list li { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .875rem; }
.preview-list time { font-weight: 700; color: var(--green); }

/* Calendar */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: #fff; border: 1px solid var(--line); border-radius: 10px; min-height: 260px; padding: 8px; display: grid; align-content: start; gap: 6px; }
.day.today { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.day h3 { font-size: .8125rem; color: var(--muted); padding: 2px 4px 6px; }
.session { text-align: left; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 7px; padding: 7px 8px; background: #fbfcfb; font-size: .78rem; display: grid; gap: 2px; width: 100%; }
.session:hover { background: #f0f4f1; }
.session.open { border-left-color: var(--focus); }
.session.live { border-left-color: #2e8b57; background: #eef8f1; }
.session.ended, .session.canceled { opacity: .6; }
.session.over { box-shadow: inset 0 0 0 1px var(--amber); }
.session strong { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: .75rem; color: var(--muted); flex-wrap: wrap; }
.days-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.days-picker label { border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 9px; font-size: .8125rem; display: flex; gap: 6px; align-items: center; }
.qr { display: grid; justify-items: center; gap: 8px; text-align: center; }
.qr svg { width: 200px; height: 200px; }
.join-code { font-size: 2rem; letter-spacing: .12em; font-weight: 750; font-variant-numeric: tabular-nums; }

/* Dialogs and messages */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 60px #0003; color: var(--ink); }
dialog::backdrop { background: #1a2b2766; }
.dialog-body { padding: 22px; display: grid; gap: 16px; max-height: calc(100vh - 80px); overflow: auto; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #132c27; color: #fff; border-radius: 10px; padding: 12px 18px; font-size: .875rem; z-index: 60; max-width: min(560px, calc(100vw - 32px)); box-shadow: 0 8px 30px #0003; }
.toast.error { background: #6d2a1f; }
.side-panel { position: fixed; top: 60px; right: 0; bottom: 0; width: min(440px, 100vw); background: #fff; border-left: 1px solid var(--line); box-shadow: -10px 0 30px #0001; z-index: 15; overflow: auto; padding: 20px; display: grid; gap: 16px; align-content: start; }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .editor-nav { position: static; display: flex; flex-wrap: wrap; }
  .stops-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { padding: 0 14px; gap: 12px; }
  .brand small, .topbar-end span { display: none; }
  .page { padding: 20px 14px 40px; }
  .grid-2, .grid-3, .grid-4, .stops-layout { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .week { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .no-print { display: none !important; }
  .page { padding: 0; }
}

/* Notifications: the top bar's button and its panel. */
.notifications { position: relative; }
.badge.count { background: var(--brick); color: #fff; margin-left: 4px; }
.notifications-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px #122e2729; padding: 8px; text-align: left; }
.notifications-panel ul { list-style: none; margin: 0; padding: 0; }
.notifications-panel li { display: grid; gap: 2px; padding: 10px 10px; border-radius: 8px; font-size: .875rem; }
.notifications-panel li + li { border-top: 1px solid var(--line); }
.notifications-panel li.new { background: var(--green-light); }
.notifications-panel > p { padding: 10px; margin: 0; }

/* A walk's street route in Walks & shuttles. */
.walk-route { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.walk-route p { margin: 0; }

/* Languages: translations beside their originals. */
.tabs button[aria-pressed=true] { color: var(--green); border-bottom-color: var(--green); }
.language-list { list-style: none; margin: 0; padding: 0; }
.language-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.language-list li:first-child { border-top: 0; padding-top: 0; }
.translation-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; padding: 14px 0; border-top: 1px solid var(--line); }
.translation-row:first-child { border-top: 0; padding-top: 0; }
.translation-source p { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; }
.translation-row.stale input, .translation-row.stale textarea { border-color: var(--amber); }
@media (max-width: 760px) { .translation-row { grid-template-columns: 1fr; gap: 8px; } }


/* The flag at the top: the editor's language. */
.language-menu { position: relative; }
.language-menu span { display: inline; }
.language-button { font-size: 1.125rem; line-height: 1; padding-inline: 10px; }
.language-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px #122e2729; padding: 6px; display: grid; gap: 2px; }
.language-option { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.language-option:hover, .language-option:focus-visible { background: var(--green-light); }
.language-option[aria-checked=true] { font-weight: 650; }
.language-option .flag { font-size: 1.125rem; }
.language-option .check { color: var(--green); }
.corner-language { position: fixed; top: 14px; right: 16px; z-index: 20; }

/* Guide notes: rich text with a small toolbar (views/guide-notes.js). */
.notes-box { border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; }
.notes-box:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.notes-box[aria-invalid=true] { border-color: var(--brick); background: #fffaf8; }
.notes-toolbar { display: flex; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); }
.notes-toolbar .icon-button { font-weight: 700; min-width: 34px; }
.notes-toolbar .notes-italic { font-style: italic; font-family: Georgia, serif; }
.notes-toolbar .icon-button:hover { background: var(--green-light); color: var(--green); }
.notes-area { min-height: 110px; padding: 8px 12px; line-height: 1.5; outline: none; overflow-wrap: anywhere; }
.notes-area p, .notes-area ul, .notes-area ol { margin: 0 0 8px; }
.notes-area ul, .notes-area ol { padding-left: 22px; }
.notes-area > :last-child { margin-bottom: 0; }
