:root {
  color-scheme: light;
  --sea-ink: #123c4a;
  --water: #167a86;
  --pale-sky: #edf6f7;
  --white: #ffffff;
  --sand: #e9dfc5;
  --sunset: #b84c36;
  --ink-soft: #4d6870;
  --line: #cddfe1;
  --danger-wash: #fff0ec;
  --shadow: 0 14px 36px rgb(18 60 74 / 12%);
  --safe-top: max(16px, env(safe-area-inset-top));
  --safe-right: max(16px, env(safe-area-inset-right));
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
  --safe-left: max(16px, env(safe-area-inset-left));
  font-family: "Segoe UI", Candara, Calibri, system-ui, sans-serif;
  background: var(--pale-sky);
  color: var(--sea-ink);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--pale-sky);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(var(--sea-ink) 0 164px, var(--pale-sky) 164px);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #f0ad43;
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  transform: translateY(-150%);
  border-radius: 8px;
  background: var(--white);
  color: var(--sea-ink);
}

.skip-link:focus {
  transform: none;
}

.app-shell {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: var(--safe-top) var(--safe-right) calc(92px + var(--safe-bottom)) var(--safe-left);
}

.trip-header {
  display: flex;
  min-height: 108px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  color: var(--white);
}

.location-line,
.day-heading p,
.dialog-header p {
  margin: 0 0 5px;
  color: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  letter-spacing: 0.015em;
}

.location-line {
  color: #bbd9dc;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 18ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 8vw, 3.3rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

h2,
h3 {
  margin: 0;
  line-height: 1.12;
}

h2 {
  font-size: clamp(1.65rem, 6vw, 2.5rem);
  letter-spacing: -0.035em;
}

h3 {
  font-size: 1.15rem;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.sync-state,
.demo-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 999px;
  padding: 4px 9px;
  color: #d8ebed;
  font-size: 0.75rem;
}

.sync-state[data-state="error"] {
  border-color: #f0ae9f;
  color: #ffd9cf;
}

.demo-badge {
  background: var(--sand);
  border-color: var(--sand);
  color: var(--sea-ink);
  font-weight: 700;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.35rem;
  cursor: pointer;
}

.quick-days {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 6px;
  margin: 0 -2px 14px;
  padding: 4px;
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 4px 18px rgb(18 60 74 / 9%);
}

.quick-day,
.date-picker {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--sea-ink);
  cursor: pointer;
}

.quick-day {
  padding: 0 12px;
  font-weight: 700;
}

.quick-day[aria-pressed="true"] {
  background: var(--sand);
}

.date-picker {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-weight: 700;
}

.date-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.planner-layout {
  min-width: 0;
}

.date-index {
  margin-inline: calc(-1 * var(--safe-left)) calc(-1 * var(--safe-right));
}

.date-strip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 5px var(--safe-right) 14px var(--safe-left);
  scroll-padding-inline: var(--safe-left);
  scrollbar-width: none;
}

.date-strip::-webkit-scrollbar {
  display: none;
}

.date-chip {
  width: 62px;
  min-width: 62px;
  min-height: 72px;
  border: 0;
  border-radius: 11px;
  padding: 8px 5px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.date-chip span {
  display: block;
}

.date-chip .weekday {
  margin-bottom: 3px;
  font-size: 0.74rem;
  font-weight: 700;
}

.date-chip .day-number {
  color: var(--sea-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  line-height: 1;
}

.date-chip .day-mark {
  min-height: 15px;
  margin-top: 4px;
  color: var(--water);
  font-size: 0.68rem;
  font-weight: 700;
}

.date-chip[aria-current="date"] {
  background: var(--sea-ink);
  box-shadow: 0 8px 18px rgb(18 60 74 / 18%);
  color: #bcdde0;
}

.date-chip[aria-current="date"] .day-number,
.date-chip[aria-current="date"] .day-mark {
  color: var(--white);
}

.date-chip.is-today:not([aria-current="date"]) {
  background: var(--sand);
}

.import-entry {
  width: calc(100% - var(--safe-left) - var(--safe-right));
  margin: 0 var(--safe-right) 14px var(--safe-left);
  background: var(--white);
}

main {
  min-width: 0;
  border-radius: 20px;
  padding: 21px 17px 28px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.day-heading,
.section-heading,
.dialog-header,
.dialog-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.day-heading p,
.dialog-header p {
  color: var(--water);
}

.primary-button,
.secondary-button,
.quiet-button,
.text-button {
  min-height: 44px;
  border-radius: 9px;
  padding: 9px 14px;
  font-weight: 720;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--sunset);
  background: var(--sunset);
  color: var(--white);
}

.secondary-button {
  border: 1px solid var(--water);
  background: transparent;
  color: var(--water);
}

.quiet-button,
.text-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--sea-ink);
}

.text-button {
  min-height: 38px;
  padding: 6px 9px;
  border-color: transparent;
  color: var(--water);
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.add-button {
  position: relative;
  flex: 0 0 auto;
}

.view-tabs {
  display: flex;
  gap: 3px;
  margin: 22px 0 12px;
  border-bottom: 1px solid var(--line);
}

.view-tabs button {
  min-height: 45px;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 8px 15px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
  cursor: pointer;
}

.view-tabs button[aria-current="page"] {
  border-color: var(--water);
  color: var(--sea-ink);
}

.notice,
.form-error,
.privacy-lock {
  margin: 13px 0;
  border-left: 4px solid var(--sunset);
  padding: 11px 13px;
  background: var(--danger-wash);
  color: #742f22;
  font-size: 0.9rem;
  line-height: 1.4;
}

.timeline,
.idea-list,
.places-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline {
  position: relative;
  padding-top: 6px;
}

.timeline::before {
  position: absolute;
  top: 20px;
  bottom: 22px;
  left: 59px;
  width: 2px;
  background: var(--line);
  content: "";
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 22px;
  padding: 13px 0 19px;
}

.timeline-item::before {
  position: absolute;
  top: 22px;
  left: 54px;
  width: 12px;
  height: 12px;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--water);
  box-shadow: 0 0 0 1px var(--water);
  content: "";
}

.timeline-item[data-status="done"]::before {
  background: var(--sand);
  box-shadow: 0 0 0 1px #a69770;
}

.timeline-time {
  padding-top: 2px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 750;
  text-align: right;
}

.activity-card {
  min-width: 0;
  padding: 2px 0 17px;
  border-bottom: 1px solid #e2ecee;
}

.activity-card h3 {
  margin-right: 75px;
}

.activity-card[data-status="done"] h3 {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.activity-meta,
.activity-place,
.activity-notes,
.idea-card p,
.place-card p,
.section-heading p,
.empty-state p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.activity-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-tag,
.evidence-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--pale-sky);
  color: var(--water);
  font-size: 0.72rem;
  font-weight: 700;
}

.meta-tag.private {
  background: #f3ead5;
  color: #756231;
}

.activity-actions,
.place-actions,
.idea-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.activity-actions a,
.source-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--water);
  font-size: 0.86rem;
  font-weight: 720;
  text-decoration: none;
}

.section-heading {
  margin: 22px 0 15px;
}

.section-heading p {
  max-width: 56ch;
}

.idea-list {
  display: grid;
  gap: 8px;
}

.idea-card {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.empty-state {
  margin: 18px 0 4px;
  border: 1px dashed #a8c6ca;
  border-radius: 14px;
  padding: 30px 20px;
  background: var(--pale-sky);
  text-align: center;
}

.empty-state button {
  margin-top: 16px;
}

.place-filters {
  display: grid;
  grid-template-columns: 1.8fr repeat(3, 1fr);
  gap: 9px;
  margin: 14px 0 9px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #a9c2c6;
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--white);
  color: var(--sea-ink);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.result-count {
  min-height: 20px;
  margin: 9px 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.places-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.place-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px;
  background: #fbfdfd;
}

.place-card h3 {
  margin-top: 7px;
}

.place-eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--water);
  font-size: 0.76rem;
  font-weight: 740;
}

.evidence-row {
  display: flex;
  gap: 5px;
  margin-top: 11px;
  flex-wrap: wrap;
}

.evidence-tag {
  background: #f1ecdf;
  color: #63562f;
}

.place-actions {
  margin-top: auto;
  padding-top: 12px;
}

.activity-dialog {
  width: min(680px, calc(100% - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  margin: auto;
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: var(--white);
  color: var(--sea-ink);
  box-shadow: 0 22px 70px rgb(4 31 38 / 30%);
}

.activity-dialog::backdrop {
  background: rgb(6 37 44 / 62%);
  backdrop-filter: blur(2px);
}

.activity-dialog form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  padding: 21px;
}

.dialog-header,
.dialog-actions,
.wide-field,
.field-row,
.form-error,
.privacy-lock {
  grid-column: 1 / -1;
}

.dialog-header .icon-button {
  color: var(--sea-ink);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-row.three-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dialog-actions {
  position: sticky;
  bottom: -21px;
  align-items: center;
  justify-content: flex-end;
  margin: 4px -21px -21px;
  border-top: 1px solid var(--line);
  padding: 13px 21px calc(13px + env(safe-area-inset-bottom));
  background: var(--white);
}

.undo-bar {
  position: fixed;
  z-index: 20;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  display: flex;
  max-width: 430px;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-inline: auto;
  border-radius: 11px;
  padding: 8px 10px 8px 16px;
  background: var(--sea-ink);
  box-shadow: 0 10px 28px rgb(18 60 74 / 30%);
  color: var(--white);
}

.undo-bar button {
  min-width: 68px;
  min-height: 40px;
  border: 1px solid #8cc1c7;
  border-radius: 8px;
  background: transparent;
  color: var(--white);
  font-weight: 750;
}

@media (max-width: 560px) {
  body {
    background-size: 100% 154px;
    background-repeat: no-repeat;
  }

  .app-shell {
    padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right));
  }

  .trip-header {
    min-height: 102px;
  }

  .sync-state {
    display: none;
  }

  .demo-badge {
    max-width: 52px;
    text-align: center;
  }

  .quick-days {
    grid-template-columns: 1fr 1fr 1.1fr;
  }

  .quick-day,
  .date-picker {
    font-size: 0.85rem;
  }

  .date-index {
    margin-inline: max(-10px, calc(-1 * env(safe-area-inset-left))) max(-10px, calc(-1 * env(safe-area-inset-right)));
  }

  main {
    border-radius: 16px;
    padding: 19px 15px 26px;
  }

  .add-button {
    min-width: 44px;
    width: 44px;
    overflow: hidden;
    padding: 0;
    color: transparent;
  }

  .add-button::after {
    display: grid;
    position: absolute;
    inset: 0;
    width: 44px;
    height: 44px;
    place-items: center;
    color: var(--white);
    font-size: 1.45rem;
    content: "+";
  }

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

  .activity-card h3 {
    margin-right: 0;
  }

  .place-filters,
  .places-list {
    grid-template-columns: 1fr;
  }

  .place-filters {
    gap: 10px;
  }

  .activity-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - var(--safe-top));
    margin: var(--safe-top) 0 0;
    border-radius: 18px 18px 0 0;
  }

  .activity-dialog form {
    grid-template-columns: 1fr;
    padding: 18px 15px;
  }

  .field-row.three-fields {
    grid-template-columns: 1fr 1fr;
  }

  .field-row.three-fields label:first-child {
    grid-column: 1 / -1;
  }

  .dialog-actions {
    bottom: -18px;
    margin: 3px -15px -18px;
    padding-inline: 15px;
  }
}

@media (min-width: 860px) {
  body {
    background: linear-gradient(90deg, var(--sea-ink) 0 max(300px, calc((100vw - 1280px) / 2 + 300px)), var(--pale-sky) max(300px, calc((100vw - 1280px) / 2 + 300px)));
  }

  .app-shell {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    column-gap: 32px;
    padding-top: max(28px, env(safe-area-inset-top));
  }

  .trip-header {
    position: sticky;
    top: 28px;
    display: block;
    align-self: start;
  }

  .header-actions {
    justify-content: flex-start;
    margin-top: 26px;
  }

  .quick-days {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    width: min(530px, 100%);
    margin: 0 0 17px;
  }

  .planner-layout {
    display: contents;
  }

  .date-index {
    grid-column: 1;
    grid-row: 2;
    position: sticky;
    top: 224px;
    align-self: start;
    margin: 0;
  }

  .date-strip {
    display: grid;
    gap: 2px;
    overflow: visible;
    padding: 0;
  }

  .date-chip {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    width: 100%;
    min-height: 43px;
    align-items: center;
    border-radius: 8px;
    padding: 4px 10px;
    color: #c6dcdf;
    text-align: left;
  }

  .date-chip .weekday {
    margin: 0;
  }

  .date-chip .day-number {
    color: var(--white);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
  }

  .date-chip .day-mark {
    min-height: 0;
    margin: 0;
    color: #94bcc1;
  }

  .date-chip[aria-current="date"] {
    background: var(--sand);
    color: var(--sea-ink);
    box-shadow: none;
  }

  .date-chip[aria-current="date"] .day-number,
  .date-chip[aria-current="date"] .day-mark {
    color: var(--sea-ink);
  }

  .date-chip.is-today:not([aria-current="date"]) {
    border: 1px solid #68969c;
    background: transparent;
  }

  .import-entry {
    width: 100%;
    margin: 16px 0 0;
    border-color: #68969c;
    background: transparent;
    color: var(--white);
  }

  main {
    grid-column: 2;
    grid-row: 1 / 3;
    margin-top: 73px;
    min-height: calc(100dvh - 118px);
    padding: 30px clamp(25px, 4vw, 52px) 45px;
  }

  .timeline {
    max-width: 820px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .activity-dialog[open] {
    animation: dialog-in 160ms ease-out;
  }

  @keyframes dialog-in {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
  }
}

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