:root {
  color-scheme: light;
  --ink: #23364a;
  --ink-soft: #66706f;
  --paper: #fffaf0;
  --paper-bright: #fffdf7;
  --paper-deep: #eadcc3;
  --canvas: #ead9bc;
  --line: rgba(92, 73, 48, 0.2);
  --line-strong: rgba(86, 66, 43, 0.4);
  --forest: #35654f;
  --forest-dark: #244b3a;
  --coral: #df7058;
  --coral-dark: #b84e3d;
  --blue: #4f86a2;
  --yellow: #dfb34e;
  --day-red: #b95345;
  --day-gold: #d69b34;
  --day-green: #4f744a;
  --day-blue: #3c6f89;
  --day-lavender: #6b5c8c;
  --day-peach: #b25843;
  --day-teal: #3f7774;
  --elevation-board: 0 14px 34px rgba(91, 67, 39, 0.16), 0 3px 8px rgba(91, 67, 39, 0.1);
  --elevation-magnet: 0 6px 12px rgba(91, 67, 39, 0.15), 0 2px 3px rgba(91, 67, 39, 0.09);
  --elevation-lifted: 0 20px 34px rgba(67, 48, 28, 0.27), 0 6px 10px rgba(67, 48, 28, 0.14);
  --shadow: var(--elevation-board);
  --shadow-small: var(--elevation-magnet);
  --radius: 24px;
  --content-width: min(calc(100vw - clamp(20px, 4vw, 64px)), 1920px);
  --slot-width: 168px;
  --event-row-height: 70px;
  font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 5%, rgba(255, 255, 255, 0.58) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.38) 0 1px, transparent 2px),
    repeating-linear-gradient(97deg, rgba(109, 79, 41, 0.02) 0 1px, transparent 1px 8px),
    linear-gradient(145deg, #f2e7d2 0%, var(--canvas) 56%, #dfc9a5 100%);
  background-size: 38px 38px, 27px 27px, auto, auto;
}

button,
input,
select {
  font: inherit;
}

button,
input,
select,
.event-card {
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

.visually-hidden {
  position: absolute !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  margin: -1px !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.event-card:focus-visible {
  outline: 3px solid rgba(78, 134, 168, 0.55);
  outline-offset: 3px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2.6vw, 2.3rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  letter-spacing: -0.025em;
}

.app-shell {
  width: 100%;
  margin: 0 auto;
  padding: clamp(12px, 1.5vw, 24px) 0 36px;
}

.journey-masthead {
  position: relative;
  z-index: 30;
  width: var(--content-width);
  height: clamp(185px, 18vw, 250px);
  margin: 0 auto 30px;
  overflow: visible;
  border: 1px solid rgba(91, 67, 39, 0.28);
  border-radius: 28px;
  background: linear-gradient(180deg, #dceaf0 0%, #f7e8c7 58%, #d4c18e 100%);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.journey-panorama {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(180deg, rgba(255, 253, 247, 0.04) 35%, rgba(255, 249, 235, 0.18) 72%, rgba(83, 62, 37, 0.14) 100%),
    url("../assets/travel-panorama.png");
  overflow: hidden;
  border-radius: inherit;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.journey-masthead::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  height: 44%;
  background: linear-gradient(180deg, transparent, rgba(57, 44, 28, 0.13));
  pointer-events: none;
}

.app-header,
.trip-settings,
.section-heading,
.toolbar,
.date-fields,
.brand-lockup,
.ribbon-help,
.dialog-actions,
.field-row {
  display: flex;
  align-items: center;
}

.app-header {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto auto;
  justify-content: stretch;
  gap: clamp(14px, 2vw, 30px);
  width: 100%;
  margin: 0;
  padding: 14px 18px;
  border: 1px solid rgba(92, 67, 39, 0.34);
  border-radius: 20px;
  background:
    linear-gradient(90deg, transparent 0 9%, rgba(79, 134, 162, 0.07) 9% 9.3%, transparent 9.3% 90%),
    repeating-linear-gradient(97deg, rgba(82, 71, 48, 0.025) 0 1px, transparent 1px 7px),
    rgba(255, 250, 240, 0.95);
  box-shadow: 0 10px 24px rgba(65, 46, 25, 0.2), 0 3px 0 rgba(98, 73, 42, 0.15);
  backdrop-filter: blur(8px);
}

.brand-lockup {
  min-width: 0;
  gap: 14px;
}

.brand-lockup > div {
  min-width: 0;
}

.trip-title-heading {
  min-width: 0;
}

.trip-title-control {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.trip-title-edit-hint {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  margin-left: 3px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  opacity: 0.72;
  pointer-events: none;
}

.brand-lockup::after {
  display: none;
}

.trip-title-input {
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 2px 5px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  cursor: text;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.trip-title-input:hover {
  border-color: var(--line);
  background: rgba(255, 250, 240, 0.38);
}

.trip-title-input:focus {
  border-color: var(--blue);
  background: rgba(255, 250, 240, 0.78);
  box-shadow: 0 0 0 3px rgba(78, 134, 168, 0.18);
  outline: none;
}

.brand-pin {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 2px solid rgba(123, 44, 27, 0.38);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #ffb08f 0 20%, var(--coral) 26% 60%, var(--coral-dark) 100%);
  box-shadow: 0 4px 8px rgba(108, 44, 30, 0.3);
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.toolbar {
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 10px;
}

.actions-menu {
  position: relative;
  z-index: 90;
}

.actions-menu-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.actions-menu-popover {
  position: absolute;
  z-index: 100;
  top: calc(100% + 9px);
  right: 0;
  width: max-content;
  min-width: 156px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--paper-bright);
  box-shadow: var(--shadow-small);
}

.actions-menu-popover[hidden] {
  display: none;
}

.actions-menu-popover button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-weight: 750;
  cursor: pointer;
}

.actions-menu-popover button:hover,
.actions-menu-popover button:focus-visible {
  background: rgba(49, 93, 67, 0.1);
}

.button,
.icon-button {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(57, 68, 54, 0.13);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.button-icon,
.icon-button svg,
.view-button svg,
.selection-action svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.actions-menu-button svg circle {
  fill: currentColor;
  stroke: none;
}

.button {
  min-height: 44px;
  padding: 9px 15px;
  border-radius: 14px;
  font-weight: 750;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(57, 68, 54, 0.13);
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(57, 68, 54, 0.13);
}

.button-primary {
  border-color: var(--forest-dark);
  color: #fffdf7;
  background: linear-gradient(180deg, #3f7353, var(--forest));
  box-shadow: 0 4px 0 var(--forest-dark);
}

.button-danger {
  border-color: #a33f32;
  color: #fff;
  background: #c85343;
  box-shadow: 0 4px 0 #91382e;
}

.paper-panel {
  border: 1px solid rgba(83, 71, 49, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(255, 255, 255, 0.23), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(97deg, rgba(82, 71, 48, 0.018) 0 1px, transparent 1px 7px),
    var(--paper);
  box-shadow: var(--shadow);
}

.trip-settings {
  display: grid;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.trip-settings .eyebrow {
  margin-bottom: 0;
}

.date-fields {
  gap: 10px;
}

.date-fields input {
  width: 142px;
  min-height: 44px;
  padding: 6px 8px;
}

.date-fields label,
.form-grid label {
  display: grid;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 750;
}

input,
select {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 10px;
}

.date-arrow {
  margin-top: 19px;
  color: var(--ink-soft);
}

.ribbon-section {
  width: var(--content-width);
  margin-inline: auto;
}

.board-toolbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.88);
}

.view-control,
.board-toolbar-actions,
.selection-toolbar,
.selection-summary,
.selection-actions,
.selection-action {
  display: flex;
  align-items: center;
}

.view-control {
  position: relative;
  min-width: 0;
  gap: 9px;
}

.board-toolbar-label {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.view-switcher {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: rgba(255, 250, 240, 0.9);
  box-shadow: 0 2px 0 rgba(57, 68, 54, 0.1);
}

.view-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.view-button:disabled {
  color: #6f7471;
  background: rgba(102, 112, 111, 0.1);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.72;
}

.overview-unavailable-hint {
  max-width: 28ch;
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
}

.board-toolbar-actions {
  justify-content: flex-end;
  gap: 12px;
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.button-quiet:hover {
  background: rgba(49, 93, 67, 0.08);
  box-shadow: none;
}

.help-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 14px;
  width: min(390px, calc(100vw - 40px));
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  color: var(--ink);
  background: var(--paper-bright);
  box-shadow: var(--elevation-lifted);
}

.help-popover[hidden] {
  display: none;
}

.help-popover p {
  margin: 6px 0 12px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.45;
}

.help-popover dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.help-popover dl div {
  display: grid;
  grid-template-columns: 125px 1fr;
  gap: 10px;
  font-size: 0.78rem;
}

.help-popover dt {
  font-weight: 850;
}

.help-popover dd {
  margin: 0;
  color: var(--ink-soft);
}

.view-button:hover {
  color: var(--ink);
  background: rgba(49, 93, 67, 0.08);
}

.view-button.is-active {
  color: #fffdf7;
  background: var(--forest);
  box-shadow: 0 2px 0 var(--forest-dark);
}

.view-button:focus-visible {
  outline: 3px solid rgba(78, 134, 168, 0.55);
  outline-offset: 2px;
}

.autosave-status {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.autosave-status::before {
  content: "✓";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 7px;
  border-radius: 50%;
  color: #fffdf7;
  background: #477957;
  font-size: 0.68rem;
  line-height: 18px;
  text-align: center;
}

.autosave-status[data-state="saving"]::before {
  content: "…";
  color: var(--ink);
  background: var(--yellow);
}

.autosave-status[data-state="error"]::before {
  content: "!";
  background: var(--coral-dark);
}

.selection-toolbar {
  min-height: 58px;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper), var(--blue) 7%);
}

.selection-toolbar[hidden] {
  display: none;
}

.selection-summary {
  min-width: 0;
  gap: 8px;
}

.selection-summary strong {
  overflow: hidden;
  max-width: 32ch;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-sticker {
  font-size: 1.15rem;
}

.selection-actions {
  gap: 6px;
}

.selection-action {
  min-height: 44px;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.selection-action:hover,
.selection-action:focus-visible {
  border-color: var(--line);
  background: rgba(255, 253, 247, 0.72);
}

.selection-action.icon-only {
  width: 44px;
  justify-content: center;
  padding-inline: 0;
}

.selection-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.is-hidden {
  display: none !important;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-small);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast-action {
  min-height: 44px;
  margin-left: auto;
  padding: 5px 10px;
  border: 1px solid var(--forest);
  border-radius: 9px;
  color: var(--forest-dark);
  background: rgba(255, 253, 247, 0.9);
  font-weight: 850;
  cursor: pointer;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .journey-masthead {
    aspect-ratio: auto;
    height: auto;
    min-height: 270px;
  }

  .app-header {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .trip-settings {
    grid-row: 2;
    grid-column: 1 / -1;
    grid-template-columns: auto 1fr;
  }

  .toolbar {
    grid-row: 1;
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px 0 24px;
  }

  .journey-masthead {
    min-height: 314px;
    margin-bottom: 22px;
    border-radius: 22px;
  }

  .journey-panorama {
    background-position: 68% center;
    background-size: auto 100%;
  }

  .trip-settings {
    align-items: flex-start;
  }

  .brand-lockup,
  .brand-lockup > div,
  .trip-title-heading {
    width: 100%;
    min-width: 0;
  }

  .toolbar {
    justify-content: flex-end;
  }

  .app-header {
    gap: 12px;
    padding: 13px;
  }

  .brand-lockup::after {
    display: none;
  }

  .toolbar .button {
    min-height: 44px;
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .trip-settings {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .date-fields {
    width: 100%;
    align-items: flex-end;
  }

  .date-fields label {
    flex: 1;
  }

  .date-fields input {
    width: 100%;
  }

  .board-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .view-control,
  .board-toolbar-actions {
    justify-content: space-between;
  }

  .view-control {
    flex-wrap: wrap;
  }

  .overview-unavailable-hint {
    order: 3;
    width: 100%;
    max-width: none;
  }

  .view-switcher {
    max-width: 100%;
  }

  .view-button {
    padding-inline: 8px;
  }

  .selection-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .selection-actions {
    overflow-x: auto;
    width: 100%;
    padding-bottom: 2px;
  }
}

@media (max-width: 460px) {
  .journey-masthead {
    min-height: 324px;
  }

  .journey-panorama {
    background-position: 71% bottom;
  }

  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .brand-pin {
    display: none;
  }

  .trip-title-input {
    font-size: 1.35rem;
  }

  .board-toolbar-label,
  .help-button span {
    display: none;
  }

  .view-switcher {
    flex: 1;
  }

  .view-button {
    flex: 1;
    justify-content: center;
    font-size: 0.72rem;
  }

  .view-button svg {
    display: none;
  }

  .autosave-status {
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
