:root {
  --ink: #17352f;
  --muted: #6f7f78;
  --paper: #f4efe6;
  --card: #fffdf8;
  --line: #dcd7cc;
  --green: #1c5d4f;
  --mint: #d7e7dc;
  --coral: #e98467;
  --yellow: #f0c86a;
  --shadow: 0 18px 50px rgba(44, 57, 49, 0.08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 92% 4%, rgba(233, 132, 103, 0.13), transparent 22rem),
    var(--paper);
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
}

.topbar, .trip-heading, .section-heading, footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar { min-height: 50px; margin-bottom: 42px; }

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px 10px 10px 3px;
  color: white;
  background: var(--green);
  font-family: Georgia, serif;
  font-style: italic;
}

.topbar-actions { display: flex; gap: 9px; align-items: center; }

.status-pill, .mode-button {
  border: 1px solid rgba(23, 53, 47, 0.14);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.62);
  font-size: 12px;
  font-weight: 700;
}

.status-pill { display: inline-flex; gap: 6px; align-items: center; padding: 8px 10px; }
.status-pill span { width: 7px; height: 7px; border-radius: 50%; background: #50a575; }
.status-pill.offline span { background: var(--coral); }
.mode-button { padding: 8px 12px; cursor: pointer; }

.trip-heading { align-items: flex-end; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
h1, h2, h3, p { text-wrap: pretty; }
h1 { max-width: 620px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(43px, 10vw, 72px); font-weight: 400; letter-spacing: -0.055em; line-height: 0.95; }
.trip-meta { margin: 14px 0 0; color: var(--muted); font-size: 15px; }
.round-button { width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: var(--card); cursor: pointer; }

.day-tabs {
  display: flex;
  gap: 8px;
  margin: 0 -22px 22px;
  padding: 0 22px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  min-width: 80px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.day-tab strong, .day-tab span { display: block; }
.day-tab strong { margin-bottom: 3px; font-family: Georgia, serif; font-size: 22px; font-weight: 400; }
.day-tab span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.day-tab.active { border-color: var(--green); color: white; background: var(--green); box-shadow: var(--shadow); }
.day-tab.active span { color: rgba(255,255,255,0.72); }

.day-summary {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  overflow: hidden;
  margin-bottom: 38px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.72);
  box-shadow: var(--shadow);
}
.summary-item { min-height: 112px; padding: 20px; border-right: 1px solid var(--line); }
.summary-item:last-child { border: 0; }
.summary-item span { display: block; margin-bottom: 12px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.summary-item strong { display: block; font-family: Georgia, serif; font-size: 22px; font-weight: 400; line-height: 1.05; }
.summary-item small { display: block; margin-top: 7px; color: var(--muted); }

.section-heading { margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 30px; font-weight: 400; letter-spacing: -0.025em; }
.text-button { padding: 8px 0; border: 0; color: var(--green); background: transparent; font-size: 13px; font-weight: 800; cursor: pointer; }

.timeline { position: relative; }
.event { position: relative; display: grid; grid-template-columns: 62px 1fr; gap: 14px; }
.event-time { padding-top: 18px; color: var(--ink); font-size: 12px; font-weight: 800; }
.event-time span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 600; }
.event-card {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 9px 30px rgba(44, 57, 49, 0.05);
}
.event-card::before { position: absolute; top: 22px; left: -22px; width: 8px; height: 8px; border: 3px solid var(--paper); border-radius: 50%; background: var(--coral); content: ""; }
.event-card h3 { margin: 5px 38px 6px 0; font-family: Georgia, serif; font-size: 23px; font-weight: 400; letter-spacing: -0.02em; }
.event-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.event-label { color: var(--coral); font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.edit-event { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--paper); cursor: pointer; }
.event-details { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.detail-chip { padding: 7px 9px; border-radius: 9px; color: var(--ink); background: #f2eee5; font-size: 11px; font-weight: 700; }
.parent-detail { border: 1px dashed rgba(23, 53, 47, .25); background: transparent; }

.transfer { display: grid; grid-template-columns: 62px 1fr; gap: 14px; min-height: 92px; }
.transfer-rail { position: relative; }
.transfer-rail::after { position: absolute; top: 0; bottom: 0; left: 12px; width: 1px; background: var(--line); content: ""; }
.transfer-card { display: flex; gap: 12px; align-items: flex-start; padding: 16px 4px; }
.transport-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 12px; background: var(--mint); font-size: 16px; }
.transfer-copy { flex: 1; }
.transfer-topline { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.transfer-topline strong { font-size: 13px; }
.recommended { color: var(--green); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.transfer-copy p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.route-link { flex: 0 0 auto; color: var(--green); font-size: 11px; font-weight: 800; text-decoration: none; }

.offline-card { display: flex; gap: 14px; align-items: center; margin-top: 30px; padding: 20px; border-radius: 20px; background: var(--mint); }
.offline-icon { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: white; background: var(--green); }
.offline-card h3 { margin: 0 0 4px; font-family: Georgia, serif; font-size: 20px; font-weight: 400; }
.offline-card p { margin: 0; color: #547067; font-size: 12px; line-height: 1.45; }

footer { margin-top: 46px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
footer span:first-child { color: var(--ink); font-weight: 800; }

.modal { width: min(calc(100% - 28px), 480px); padding: 0; border: 0; border-radius: 24px; color: var(--ink); background: var(--card); box-shadow: 0 30px 90px rgba(23,53,47,.25); }
.modal::backdrop { background: rgba(20, 35, 30, .45); backdrop-filter: blur(4px); }
.modal form { position: relative; padding: 28px; }
.modal h2 { margin: 0; font-family: Georgia, serif; font-size: 32px; font-weight: 400; }
.modal-copy { margin: 8px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.modal-close { position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--paper); font-size: 21px; cursor: pointer; }
label { display: block; }
label > span { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 800; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: white; }
input { height: 46px; padding: 0 13px; }
textarea { padding: 12px 13px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(28, 93, 79, .1); }
.primary-button { width: 100%; min-height: 48px; margin-top: 18px; border: 0; border-radius: 13px; color: white; background: var(--green); font-weight: 800; cursor: pointer; }
.prototype-note { margin: 12px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.form-error { min-height: 17px; margin: 6px 0 0; color: #b84635; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 12px; margin-top: 22px; }
.form-grid .wide { grid-column: 1 / -1; }
.admin-only { display: none; }
body.admin-mode .admin-only { display: inline-grid; }
body.admin-mode .text-button.admin-only { display: inline-block; }
body:not(.admin-mode) .parent-only { display: none; }

@media (max-width: 560px) {
  .app-shell { padding-right: 16px; padding-left: 16px; }
  .topbar { margin-bottom: 32px; }
  .status-pill { display: none; }
  .day-tabs { margin-right: -16px; margin-left: -16px; padding-right: 16px; padding-left: 16px; }
  .day-summary { grid-template-columns: 1fr 1fr; }
  .summary-item { min-height: 96px; padding: 16px; }
  .summary-item:first-child { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); }
  .summary-item:nth-child(2) { border-bottom: 0; }
  .summary-item strong { font-size: 20px; }
  .event, .transfer { grid-template-columns: 48px 1fr; gap: 10px; }
  .event-card::before { left: -17px; }
  .transfer-rail::after { left: 9px; }
  h1 { font-size: 48px; }
}

@media (display-mode: standalone) {
  .app-shell { padding-top: max(12px, env(safe-area-inset-top)); }
}
