:root {
  color-scheme: light;
  --ink: #18362f;
  --muted: #667b74;
  --line: #dce7e1;
  --paper: #fbfcf9;
  --green: #176b52;
  --green-dark: #105640;
  --mint: #eaf4ee;
  --shadow: 0 12px 34px rgba(28, 62, 48, .07);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--green); }
.topbar { height: 68px; padding: 0 max(calc((100vw - 1120px) / 2), 24px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); }
.brand { color: var(--ink); font-family: Georgia, serif; font-size: 1.35rem; font-weight: 700; text-decoration: none; letter-spacing: -.03em; }
.topbar nav, .topbar nav form { display: flex; align-items: center; gap: 18px; }
.user-label, .muted, .card-owner, .small { color: var(--muted); }
.link-button { padding: 0; border: 0; background: none; color: var(--green); font: inherit; cursor: pointer; }
.container { width: min(100% - 40px, 1040px); margin: 44px auto 88px; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; line-height: 1.15; letter-spacing: -.025em; }
h1 { margin-bottom: 12px; font-size: clamp(2.2rem, 5vw, 3.35rem); }
h2 { margin-bottom: 10px; font-size: 1.7rem; }
h3 { margin: 5px 0 0; font-size: 1.2rem; }
h4 { margin-bottom: 9px; }
.eyebrow { margin-bottom: 8px; color: var(--green); font-size: .75rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.page-heading, .section-heading, .day-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-heading { margin-bottom: 30px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 17px; border: 1px solid transparent; border-radius: 9px; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
.primary { background: var(--green); color: white; }
.primary:hover { background: var(--green-dark); }
.secondary { background: white; border-color: var(--line); color: var(--green); }
.small-button { min-height: 34px; padding: 5px 11px; border-color: var(--line); background: white; font-size: .88rem; }
.trip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.trip-card { min-height: 205px; padding: 23px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.trip-card:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(28,62,48,.11); }
.trip-card h2 { margin: 13px 0 8px; }
.trip-card p { color: var(--muted); }
.card-date, .card-owner { display: block; font-size: .85rem; }
.card-date { color: var(--green); font-weight: 650; }
.empty-state, .form-card, .auth-card, .members-card, .map-card { border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow); }
.empty-state { padding: 48px 28px; text-align: center; }
.empty-state p { margin-bottom: 22px; color: var(--muted); }
.form-card, .auth-card { width: min(100%, 620px); margin: 26px auto; padding: clamp(24px, 5vw, 42px); }
.auth-card { width: min(100%, 440px); margin-top: 8vh; }
form p { margin-bottom: 17px; }
label { display: block; margin-bottom: 5px; font-weight: 650; }
input:not([type=checkbox]), textarea, select { width: 100%; padding: 11px 12px; border: 1px solid #cbd8d1; border-radius: 8px; background: white; color: var(--ink); font: inherit; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(23,107,82,.15); border-color: var(--green); }
.helptext, .helptext ul, .form-card ul.errorlist, .auth-card ul.errorlist { color: var(--muted); font-size: .88rem; }
.errorlist { color: #a52d2d; }
.back-link { display: inline-block; margin-bottom: 20px; text-decoration: none; }
.trip-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.lead { max-width: 720px; color: #435c53; font-size: 1.12rem; }
.role-pill { display: inline-block; padding: 5px 10px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.map-card, .members-card { margin: 26px 0; padding: 24px; }
.map { height: 360px; overflow: hidden; border-radius: 11px; background: var(--mint); }
.picker-map { height: 410px; margin: 14px 0 8px; border: 1px solid var(--line); }
.selection-status { min-height: 1.6em; color: var(--green); font-size: .9rem; }
.map-search { margin: 20px 0 12px; }
.search-row { display: flex; align-items: stretch; gap: 9px; }
.search-row input { width: auto !important; min-width: 0; flex: 1; }
.search-results { display: grid; gap: 5px; margin-top: 8px; }
.search-result { padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); text-align: left; cursor: pointer; }
.search-result:hover { border-color: var(--green); background: var(--mint); }
.members-card { background: #fdfefc; }
.access-card { padding: 0; }
.access-summary { display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; cursor: pointer; list-style: none; }
.access-summary::-webkit-details-marker { display: none; }
.access-summary > span:first-child { display: grid; gap: 3px; }
.access-summary .eyebrow { margin: 0; }
.access-summary strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.4rem; }
.access-summary-action { color: var(--green); font-size: .9rem; font-weight: 700; }
.access-summary-action::after { display: inline-block; margin-left: 9px; content: "+"; font-size: 1.2rem; }
.access-card[open] .access-summary { border-bottom: 1px solid var(--line); }
.access-card[open] .access-summary-action::after { content: "−"; }
.access-content { padding: 22px 24px 24px; }
.member-list, .place-list { margin: 0; padding: 0; list-style: none; }
.member-list li { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.invite-form { display: grid; grid-template-columns: minmax(180px,1fr) minmax(180px,.8fr) auto; align-items: end; gap: 12px; margin-top: 18px; }
.invite-form label { margin: 0; font-size: .88rem; }
.invite-form input, .invite-form select { display: block; margin-top: 5px; font-weight: 400; }
.small { margin: 12px 0 0; font-size: .84rem; }
.days-section { margin-top: 44px; }
.section-heading { margin-bottom: 17px; }
.day-card { margin: 14px 0; padding: clamp(20px, 4vw, 30px); border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: var(--shadow); }
.day-heading { align-items: flex-start; margin-bottom: 16px; }
.day-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.day-date { color: var(--green); font-size: .9rem; font-weight: 750; }
.places-block { margin: 18px 0; padding: 16px 18px; border-radius: 11px; background: var(--mint); }
.place-timeline { display: grid; gap: 12px; margin: 18px 0; }
.place-stop { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: white; }
.place-stop-header { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 15px 18px; background: var(--mint); }
.place-stop-header h4 { margin: 0; }
.place-stop-entries { display: grid; gap: 10px; padding: 14px 18px; }
.place-empty { margin: 2px 0; }
.general-entries { margin-top: 24px; padding-top: 21px; border-top: 1px solid var(--line); }
.general-entries-heading h4 { margin-bottom: 13px; }
.place-list li { display: flex; align-items: center; gap: 11px; margin: 9px 0; }
.place-details { flex: 1; min-width: 0; }
.place-details span { display: block; font-size: .9rem; }
.order-badge { display: inline-flex; width: 27px; height: 27px; flex: 0 0 27px; align-items: center; justify-content: center; border-radius: 50%; background: white; color: var(--green-dark); font-size: .82rem; font-weight: 750; }
.place-actions { display: flex; gap: 4px; }
.place-actions button, .place-action-link { display: inline-flex; width: 31px; height: 31px; flex: 0 0 31px; align-items: center; justify-content: center; padding: 0; border: 1px solid #ccdbd2; border-radius: 7px; background: white; color: var(--green-dark); font: inherit; font-size: 1.05rem; text-decoration: none; cursor: pointer; }
.place-actions button:disabled { opacity: .38; cursor: default; }
.place-actions .place-delete { color: #a52d2d; }
.place-note { color: var(--muted); }
.text-link { display: inline-block; margin: 0 0 14px; font-size: .92rem; }
.entries { display: grid; gap: 12px; }
.entry-card { padding: 16px; border: 1px solid #e7ece8; border-radius: 11px; background: #fdfefc; }
.entry-meta { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .84rem; }
.entry-meta strong { color: var(--ink); }
.entry-place { margin: 8px 0 0; color: var(--green-dark); font-size: .9rem; font-weight: 650; }
.entry-meta a { font-size: .84rem; }
.collection-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.collection-chips a { padding: 3px 9px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: .78rem; text-decoration: none; }
.collection-hero { margin: 10px 0 28px; }
.collection-feed { display: grid; gap: 15px; }
.collection-item { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: var(--shadow); }
.collection-source { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: .88rem; }
.collection-source a { font-weight: 700; }
.collection-card .card-owner { color: var(--green); }
.entry-card p { margin: 10px 0 0; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 13px; }
.media-item { position: relative; min-width: 0; }
.media-delete-form { position: absolute; z-index: 2; top: 7px; right: 7px; }
.media-delete-form button { display: grid; width: 32px; height: 32px; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.8); border-radius: 50%; background: rgba(25,35,31,.82); color: white; font: inherit; font-size: 1.35rem; line-height: 1; cursor: pointer; }
.media-grid img, .video-preview { width: 100%; height: 180px; border-radius: 8px; background: #e9eeeb; object-fit: cover; }
.media-grid .gallery-trigger { display: block; overflow: hidden; border: 0; border-radius: 8px; background: #e9eeeb; cursor: pointer; }
.media-grid .video-preview { position: relative; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; border: 1px solid var(--line); color: var(--green-dark); font: inherit; }
.video-preview .video-poster { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; }
.video-preview .video-play-icon, .video-preview .video-play-label { position: relative; z-index: 1; }
.video-preview .video-play-icon { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 50%; background: rgba(255,255,255,.92); font-size: 1.25rem; }
.video-preview.video-queue-state { padding: 16px; color: var(--muted); cursor: default; }
.video-queue-state > span:first-child { color: var(--green); font-size: 1.5rem; }
.video-queue-state a { position: relative; z-index: 1; }
.media-gallery-dialog { width: min(96vw, 1280px); max-width: none; max-height: 94dvh; padding: 12px; border: 0; border-radius: 14px; background: #14211d; color: white; }
.media-gallery-dialog::backdrop { background: rgba(0,0,0,.82); }
.media-gallery-toolbar { display: flex; justify-content: space-between; align-items: center; min-height: 42px; }
.media-gallery-toolbar button, .media-gallery-view > button { width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; background: rgba(255,255,255,.1); color: white; font-size: 1.8rem; line-height: 1; cursor: pointer; }
.media-gallery-view { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; }
#media-gallery-content { display: grid; min-width: 0; min-height: 50vh; max-height: calc(94dvh - 80px); place-items: center; }
#media-gallery-content img, #media-gallery-content video { display: block; max-width: 100%; max-height: calc(94dvh - 100px); object-fit: contain; }
.media-gallery-view > button:disabled { opacity: .35; cursor: default; }
.story-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 16px clamp(14px, 3vw, 42px) 22px; border: 0; background: #14211d; color: white; }
.story-dialog::backdrop { background: #101815; }
.story-toolbar { display: flex; min-height: 44px; align-items: center; justify-content: space-between; color: rgba(255,255,255,.78); font-size: .9rem; }
.story-toolbar-status, .story-toolbar-actions { display: flex; align-items: center; gap: 14px; }
.story-toolbar-actions { gap: 8px; }
.story-toolbar button, .story-controls button { min-width: 44px; min-height: 44px; padding: 7px 14px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; background: rgba(255,255,255,.08); color: white; font: inherit; cursor: pointer; }
.story-toolbar button { font-size: .9rem; line-height: 1.2; }
.story-toolbar-actions button:last-child { font-size: 1.5rem; line-height: 1; }
.story-progress { height: 3px; margin: 7px 0 12px; overflow: hidden; border-radius: 3px; background: rgba(255,255,255,.16); }
.story-progress span { display: block; width: 0; height: 100%; background: #80d2ad; transition: width .2s ease; }
.story-slide { min-height: 0; height: calc(100dvh - 158px); overflow: hidden; touch-action: pan-y; }
.story-layout { display: grid; width: 100%; height: 100%; min-height: 0; grid-template-columns: minmax(250px, .36fr) minmax(0, 1fr); gap: clamp(14px, 2vw, 28px); }
.story-sidebar { display: grid; min-height: 0; grid-template-rows: minmax(0, .9fr) minmax(0, 1.1fr); gap: 12px; }
.story-day-info, .story-comment { min-height: 0; overflow-y: auto; padding: clamp(16px, 2.3vw, 30px); border: 1px solid rgba(255,255,255,.12); border-radius: 13px; background: rgba(255,255,255,.055); }
.story-day-info h1 { margin: 0 0 14px; font-size: clamp(1.5rem, 3vw, 2.6rem); }
.story-day-info h2 { margin: 0 0 10px; color: #bce3ce; font-size: clamp(1.05rem, 1.8vw, 1.4rem); }
.story-subtitle { margin-bottom: 12px; color: #9bd4b7; font-size: .9rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.story-location-details { margin: 0; color: rgba(255,255,255,.68); font-size: .94rem; line-height: 1.65; white-space: pre-line; }
.story-comment-meta { margin: 0 0 12px; color: #9bd4b7; font-size: .85rem; font-weight: 700; }
.story-text { margin: 0; color: rgba(255,255,255,.9); font-size: clamp(1rem, 1.7vw, 1.25rem); line-height: 1.75; white-space: pre-line; }
.story-media { display: grid; min-width: 0; min-height: 0; height: 100%; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; place-items: center; }
.story-image, .story-video { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; }
.story-map { width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; border-radius: 12px; background: var(--mint); }
.story-map .leaflet-container { width: 100%; height: 100%; font: inherit; }
.story-empty-media { max-width: 320px; color: rgba(255,255,255,.55); text-align: center; }
.story-video-hint { margin: 8px 0 0; color: rgba(255,255,255,.72); font-size: .9rem; text-align: center; }
.story-controls { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 12px; }
.story-controls button:disabled { opacity: .38; cursor: default; }
.story-controls button.primary { border-color: var(--green); background: var(--green); }
.story-controls button span { padding: 0 5px; }
.message { margin: 0 0 18px; padding: 12px 15px; border-radius: 9px; background: var(--mint); }
.message.error { background: #fff0ed; color: #8c2920; }
@media (max-width: 680px) {
  .topbar { padding: 0 18px; }
  .container { width: min(100% - 28px, 1040px); margin-top: 28px; }
  .page-heading, .trip-hero { align-items: flex-start; flex-direction: column; }
  .day-heading { flex-direction: column; }
  .day-heading-actions { justify-content: flex-start; }
  .invite-form { grid-template-columns: 1fr; }
  .map { height: 280px; }
  .story-dialog { padding: 10px 12px 12px; }
  .story-toolbar-status, .story-toolbar-actions { gap: 6px; }
  .story-toolbar button { min-height: 40px; padding: 6px 9px; font-size: .78rem; }
  .story-toolbar-actions button:last-child { min-width: 40px; font-size: 1.35rem; }
  .story-slide { height: calc(100dvh - 142px); overflow-y: auto; }
  .story-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, .8fr) minmax(0, 1fr) minmax(160px, 1.8fr); gap: 8px; }
  .story-sidebar { display: contents; }
  .story-day-info, .story-comment { padding: 12px 14px; }
  .story-day-info h1 { margin-bottom: 8px; font-size: 1.4rem; }
  .story-day-info h2 { margin-bottom: 5px; font-size: 1rem; }
  .story-subtitle { margin-bottom: 5px; font-size: .72rem; }
  .story-location-details, .story-comment-meta { font-size: .78rem; }
  .story-text { font-size: .9rem; line-height: 1.45; }
  .story-media { min-height: 160px; }
  .story-video-hint { font-size: .78rem; }
}
