:root {
  color-scheme: light;
  --background: #f4f5ef;
  --surface: #fffefa;
  --ink: #172f2a;
  --muted: #485f56;
  --forest: #1c5145;
  --forest-deep: #143a32;
  --line: #d7e1d7;
  --sage: #e8efe6;
  --sky: #e4eff4;
  --gold: #f4d584;
  --error: #923e35;
  --page: 1112px;
  font: 16px/1.5 "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--background);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: var(--forest); text-underline-offset: .2em; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #0876a2; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
img { display: block; max-width: 100%; }
.skip-link { position: fixed; top: .55rem; left: .55rem; transform: translateY(-200%); z-index: 20; padding: .6rem .85rem; background: white; }
.skip-link:focus { transform: translateY(0); }
.appbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.appbar-inner, #app, .app-footer {
  width: min(var(--page), calc(100% - 48px));
  margin-inline: auto;
}
.appbar-inner { min-height: 65px; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.brand { display: flex; align-items: center; gap: .7rem; font-size: 1.04rem; font-weight: 720; letter-spacing: -.02em; }
.brand img { border-radius: 10px; }
#app { min-height: 68vh; padding-block: 30px 32px; }
#app:focus { outline: none; }
.app-footer { padding-block: 4px 24px; font-size: .76rem; color: var(--muted); }
.app-footer a { color: inherit; }
.loading { padding-block: 3rem; color: var(--muted); }
.status { position: fixed; inset: auto 1rem calc(1rem + env(safe-area-inset-bottom)) auto; max-width: min(430px, calc(100% - 2rem)); z-index: 20; pointer-events: none; }
.status:not(:empty) { padding: .72rem 1rem; border-radius: 10px; background: var(--forest-deep); color: #fff; box-shadow: 0 4px 20px #14272220; }
.trip-hero {
  display: grid;
  grid-template-columns: 1.13fr 1fr;
  min-height: 248px;
  overflow: hidden;
  border-radius: 26px 26px 26px 8px;
  background: var(--forest-deep);
  color: #fffef2;
}
.trip-hero-content { min-width: 0; align-self: center; padding: clamp(24px, 4.5vw, 48px); }
.trip-hero h1 { font-weight: 690; font-size: clamp(2.35rem, 5.1vw, 4.4rem); line-height: .99; letter-spacing: -.074em; text-wrap: balance; margin-block: 10px 14px; }
.trip-hero p { color: #e1eee5; }
.trip-hero a { color: inherit; }
.trip-hero-art {
  min-height: 180px;
  background: #537a72 url("/assets/krabi.webp") center 57% / cover no-repeat;
}
.trip-tabs { display: flex; gap: .35rem; margin: 23px 0 20px; padding: 0 0 6px; border-bottom: 1px solid var(--line); align-items: center; }
.trip-tabs button { min-height: 44px; padding: .55rem .95rem; font-weight: 680; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.trip-tabs button:hover { background: var(--sage); }
.trip-tabs button[aria-selected="true"], .trip-tabs button[aria-current="page"], .trip-tabs button.active { background: var(--forest); color: white; }
.trip-panel { min-width: 0; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin: 0 0 14px; flex-wrap: wrap; }
.section-heading h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); line-height: 1.16; letter-spacing: -.045em; }
.section-heading p { color: var(--muted); margin-top: .36rem; }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; margin: 0 0 22px; }
.overview-card { min-width: 0; padding: clamp(14px, 3vw, 23px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.overview-card:nth-child(even) { background: var(--sky); border-color: #d3e3ec; }
.overview-card h3 { font-size: 1rem; }
.metric { font-size: clamp(1.85rem, 4vw, 2.9rem); font-weight: 680; line-height: 1.08; letter-spacing: -.069em; }
.overview-card p { color: var(--muted); overflow-wrap: anywhere; }
.event-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .85rem; align-items: start; padding: 15px 16px; margin: 0 0 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.event-icon { display: grid; place-items: center; min-width: 42px; min-height: 42px; border-radius: 12px; background: var(--sage); font-size: 1.15rem; }
.event-content { min-width: 0; overflow-wrap: anywhere; }
.event-content h3 { font-size: 1.08rem; line-height: 1.28; letter-spacing: -.02em; }
.event-content p, .event-meta { margin-top: .3rem; color: var(--muted); font-size: .88rem; }
.event-meta { display: flex; gap: .4rem .75rem; flex-wrap: wrap; align-items: center; }
.event-actions { display: flex; flex-flow: row wrap; gap: .4rem; align-items: center; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; max-width: 100%; padding: .22rem .52rem; border-radius: 999px; background: var(--sage); color: var(--ink); font-size: .75rem; font-weight: 690; line-height: 1.25; }
.badge.booked, .badge-booked { background: #d4eadd; color: #153e2f; }
.badge.draft, .badge-draft { background: #f7ead0; color: #663f11; }
.badge.idea, .badge-idea { background: var(--sky); color: #244a63; }
.day-selector { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 20px; }
.day-selector button { min-width: 48px; min-height: 43px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; cursor: pointer; padding: .42rem .65rem; }
.day-selector button[aria-pressed="true"], .day-selector button.active { background: var(--forest); color: white; border-color: var(--forest); }
.timeline-day { margin-bottom: 22px; }
.timeline-day > h3 { font-size: 1.04rem; margin-bottom: 8px; }
.task-row { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; min-height: 55px; padding: .6rem .82rem; margin: 0 0 .44rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); overflow-wrap: anywhere; }
.task-row label { display: flex; align-items: center; gap: .62rem; flex: 1 1 200px; cursor: pointer; }
.task-row input[type="checkbox"] { flex: none; width: 1.2rem; height: 1.2rem; accent-color: var(--forest); }
.task-row select { max-width: 185px; }
.empty-state, .notice { min-width: 0; padding: 1rem 1.1rem; border-radius: 12px; background: var(--sage); border: 1px solid var(--line); }
.notice { margin: .75rem 0; }
.button {
  min-height: 42px;
  display: inline-flex;
  gap: .42rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--forest);
  border-radius: 9px;
  background: var(--forest);
  color: #fff;
  text-decoration: none;
  font-weight: 665;
  font-size: .88rem;
  line-height: 1.2;
  padding: .62rem .82rem;
  cursor: pointer;
}
.button:hover { background: var(--forest-deep); }
.button-quiet { color: var(--forest-deep); background: var(--surface); border-color: #bdcec3; }
.button-quiet:hover { background: var(--sage); }
.button-danger { color: var(--error); background: var(--surface); border-color: #e6bfb5; }
.button-danger:hover { background: #fbece6; }
.button:disabled, button:disabled { cursor: default; opacity: .58; }
.modal { width: min(600px, calc(100% - 28px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid #b7c9be; border-radius: 18px; color: var(--ink); background: var(--surface); box-shadow: 0 18px 54px #15221b28; overflow: auto; }
.modal[open] { overscroll-behavior: contain; }
.modal::backdrop { background: #142d2acc; }
.dialog-content { padding: 22px; }
.dialog-content h2 { font-size: 1.45rem; line-height: 1.2; letter-spacing: -.04em; }
.dialog-content p { color: var(--muted); margin-block: .4rem .66rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-block: 13px; }
.form-field { min-width: 0; display: grid; gap: .25rem; font-size: .88rem; font-weight: 650; }
.form-field.full, .form-field-wide { grid-column: 1 / -1; }
label { overflow-wrap: anywhere; }
input:not([type="checkbox"]), textarea, select { min-width: 0; color: var(--ink); background: #fbfcf8; border: 1px solid #bacaBF; border-radius: 8px; padding: .57rem .65rem; }
input:not([type="checkbox"]), select { min-height: 44px; }
textarea { min-height: 95px; resize: vertical; }
.form-field input, .form-field textarea, .form-field select, .dialog-content input[readonly] { width: 100%; }
.form-actions { display: flex; gap: .55rem; margin-top: 1rem; align-items: center; flex-wrap: wrap; }
.form-error { color: var(--error) !important; font-weight: 650; }
a.button, button.button, input, textarea { min-width: 0; }
@media (max-width: 720px) {
  .appbar-inner, #app, .app-footer { width: calc(100% - 30px); }
  #app { padding-top: 18px; }
  .trip-hero { min-height: 200px; grid-template-columns: 1.2fr .9fr; border-radius: 20px 20px 20px 6px; }
  .trip-hero-content { padding: 18px; }
  .trip-hero h1 { font-size: clamp(1.95rem, 6.9vw, 3.25rem); }
  .event-card { grid-template-columns: auto minmax(0, 1fr); gap: .55rem; padding: 12px; }
  .event-actions { grid-column: 2; justify-content: flex-start; }
  .trip-tabs { margin-top: 17px; }
}
@media (max-width: 430px) {
  .appbar-inner { min-height: 59px; }
  .brand { font-size: .96rem; }
  .trip-hero { grid-template-columns: minmax(0, 1fr); }
  .trip-hero-content { padding: 18px 17px 20px; }
  .trip-hero-art { grid-row: 1; min-height: 105px; background-position: center 63%; }
  .trip-hero h1 { margin-block: .4rem .52rem; font-size: 2.18rem; }
  .section-heading { align-items: start; }
  .overview-grid { gap: 8px; }
  .overview-card { padding: 12px 10px; }
  .trip-tabs button { padding-inline: .62rem; }
  .event-icon { min-width: 35px; min-height: 35px; }
  .dialog-content { padding: 15px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  input, textarea, select { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  :root { color: #111; background: #fff; }
  .appbar, .app-footer, .status, .trip-tabs, .event-actions, .day-selector, .notice, .button, dialog, .trip-hero-art { display: none !important; }
  #app { margin: 0; width: 100%; padding: 0; min-height: 0; }
  .trip-hero { display: block; min-height: 0; padding: 0; color: #111; background: none; }
  .trip-hero-content { padding: 0; }
  .trip-hero h1 { font-size: 23pt; letter-spacing: -.04em; }
  .trip-hero p, .trip-hero a { color: #333; }
  .event-card { break-inside: avoid; }
  .timeline-day > h3 { break-after: avoid; }
}

.trip-tools, .trip-actions, .trip-role { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.trip-tools { justify-content: space-between; margin-top: .8rem; gap: .7rem; }
.trip-role, .offline-note { color: var(--muted); font-size: .81rem; }
.offline-note { margin-top: .65rem; }
.trip-role .badge { background: var(--sky); }
.overview-card.metric { display: grid; gap: .45rem; font-size: .88rem; line-height: 1.3; letter-spacing: normal; font-weight: 600; }
.overview-card.metric strong { font-size: clamp(2.15rem, 5vw, 3.45rem); font-weight: 680; line-height: 1; letter-spacing: -.065em; }
.overview-card.metric span { color: var(--muted); }
.event-card { grid-template-columns: 42px minmax(0, 1fr) auto; }
.event-prominent { border-left: 4px solid var(--forest); padding: clamp(16px, 3vw, 24px); margin-bottom: 24px; }
.event-prominent h3 { font-size: clamp(1.35rem, 3vw, 1.95rem); }
.event-meta:first-child { margin-top: 0; margin-bottom: .45rem; }
.event-note { white-space: pre-line; }
.badge-locked { background: #dcebe0; color: #1e4c3c; }
.timeline-date span { color: var(--muted); font-size: .82rem; font-weight: 500; margin-left: .35rem; }
.subheading { margin-block: 16px 10px; font-size: 1.2rem; }
.route-alternative, .private-section { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; }
.route-alternative summary { font-weight: 680; cursor: pointer; }
.route-alternative p { margin-top: .55rem; color: var(--muted); }
.private-section { margin-top: 26px; }
.private-note { padding: .65rem .8rem; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--sage); border-radius: 9px; }
.task-meta { color: var(--muted); font-size: .81rem; }
.task-done .task-check span { text-decoration: line-through; color: var(--muted); }
.document-list { margin-top: .8rem; }
.document-list .task-row span { margin-right: auto; }
.form-field:has(textarea) { grid-column: 1 / -1; }
.share-item { border-top: 1px solid var(--line); padding-block: .8rem; }
.share-item .form-field, #access-form .form-field { flex: 1 1 230px; }
.access-screen { max-width: 540px; margin: clamp(30px, 10vh, 90px) auto; padding: clamp(18px, 5vw, 32px); }
.access-screen h1 { font-size: clamp(1.7rem, 5vw, 2.45rem); letter-spacing: -.04em; line-height: 1.13; }
.access-screen p { margin-block: .65rem; }
.status[data-level="error"] { background: #7a342d; }
@media (max-width: 720px) {
  .event-card { grid-template-columns: 36px minmax(0, 1fr); }
  .event-actions { grid-column: 2; }
  .trip-tools { align-items: flex-start; }
  .trip-role { width: 100%; }
}
@media print {
  .trip-tools, .offline-note, .route-alternative, .private-section { display: none !important; }
  .trip-hero h1 { margin-top: 0; }
  .event-icon { display: none; }
  .event-card { display: block; border: 0; border-bottom: 1px solid #ccc; border-radius: 0; padding: 4px 0; margin-bottom: 3px; }
  .event-content h3 { font-size: 11pt; }
  .event-content p, .event-meta { font-size: 8.5pt; }
  .timeline-day { margin-bottom: 12px; }
}

.audit-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 22px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--audit-accent, var(--forest));
  border-radius: 11px;
  background: var(--audit-paper, var(--surface));
}
.audit-summary-text { min-width: 0; }
.audit-summary-text strong { font-size: 1.06rem; font-weight: 700; }
.audit-summary-text p { margin-top: .2rem; color: var(--muted); overflow-wrap: anywhere; }
.audit-first-issue { font-size: .86rem; }
.audit-error { --audit-accent: #9b3a31; --audit-tint: #fae7e2; --audit-paper: #fff1ed; }
.audit-warning { --audit-accent: #805111; --audit-tint: #f9eacb; --audit-paper: #fff6e4; }
.audit-check { --audit-accent: #24526b; --audit-tint: #e3eff5; --audit-paper: #f0f7fa; }
.audit-ok { --audit-accent: #22574a; --audit-tint: #e3f0e8; --audit-paper: #eff7ed; }
.audit-section { margin-block: 24px; scroll-margin-top: 20px; }
.audit-section > h3 { margin-bottom: 9px; font-size: 1.15rem; letter-spacing: -.02em; }
.audit-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
.audit-card {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--audit-accent);
  border-radius: 11px;
  min-width: 0;
  background: var(--surface);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.audit-heading { display: flex; align-items: flex-start; gap: 6px 10px; justify-content: space-between; flex-wrap: wrap; }
.audit-heading h3 { margin: 0; font-size: 1rem; line-height: 1.28; }
.audit-status { color: var(--audit-accent); background: var(--audit-tint); border-radius: 5px; padding: .15rem .35rem; font-weight: 700; font-size: .74rem; }
.audit-card p { margin-top: .4rem; color: var(--muted); font-size: .89rem; }
.audit-card .audit-action-text { color: var(--ink); }
.audit-card .audit-meta { color: var(--muted); font-size: .78rem; }
.audit-actions, .audit-navigation, .audit-jump-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-top: .62rem;
}
.audit-jump-nav { margin-bottom: 14px; }
.audit-actions > .button { white-space: normal; text-align: left; }
.audit-section summary { font-weight: 660; cursor: pointer; }
.flight-details { border: 1px solid var(--line); border-radius: 11px; margin: 14px 0; padding: 8px 12px 2px; min-width: 0; background: var(--sage); }
.flight-details legend { font-weight: 700; padding-inline: .38rem; }
.flight-details .form-grid { margin-top: .45rem; }
.flight-details .flight-checklist-intro { grid-column: 1 / -1; font-size: .83rem; margin: 0; }
.flight-arrival { color: var(--forest) !important; }
.metric-warning { background: #fff4df !important; border-color: #e9ca89 !important; }
.metric span.metric-note { font-size: .78rem; font-weight: 500; }
@media (max-width: 760px) {
  .audit-list { grid-template-columns: minmax(0, 1fr); }
  .audit-summary { flex-wrap: wrap; }
}
@media print {
  .audit-summary, .audit-jump-nav, .audit-navigation { display: none !important; }
}

.audit-priority { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 13px 16px; }
.audit-priority h3 { font-size: 1.05rem; }
.audit-priority ul { display: grid; gap: 5px; padding-left: 1.2rem; margin: .55rem 0 0; }
.audit-priority a, .audit-navigation a { overflow-wrap: anywhere; }
@media (max-width: 390px) {
  .trip-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trip-tabs button { width: 100%; }
  .audit-actions .button, .audit-navigation .button { max-width: 100%; }
}

#panel-assistant .section-caption { max-width: 65ch; }
.model-fields { grid-template-columns: minmax(0, 1fr); }
.model-help, .assistant-result { overflow-wrap: anywhere; }
.assistant-search { display: flex; align-items: center; gap: .55rem; min-height: 44px; margin-top: .5rem; cursor: pointer; }
.assistant-search input { width: 1.15rem; height: 1.15rem; accent-color: var(--forest); }
.assistant-search + .form-actions { margin-top: .45rem; }
.assistant-status { margin-top: .75rem; }
.assistant-result { margin-top: 1rem; padding: clamp(13px, 3vw, 22px); border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.assistant-answer { margin-block: .8rem; white-space: pre-wrap; }
.assistant-result h4 { margin-top: .65rem; }
.assistant-result ul { padding-left: 1.25rem; }
@media (max-width: 600px) {
  .trip-tabs:has([data-id="assistant"]) { flex-wrap: wrap; }
}
