:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-soft: #eef4f1;
  --line: #d8e2de;
  --line-strong: #b9cbc4;
  --text: #1f2a29;
  --muted: #647371;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --coral: #bd4d43;
  --gold: #b78324;
  --sky: #3478a8;
  --violet: #7259a2;
  --success: #2d7d46;
  --warning: #a86412;
  --danger: #b83939;
  --shadow: 0 18px 48px rgba(31, 42, 41, 0.1);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 8px;
  background: var(--text);
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1,
.brand p,
.overview h2,
.section-title h2,
.panel h2,
.day-card h3,
.dialog-heading h2 {
  margin: 0;
}

.brand h1 {
  font-size: 1.08rem;
  line-height: 1.2;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.top-actions,
.button-row,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--text);
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--accent);
}

.ghost-button {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
}

.text-button {
  min-height: auto;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel,
.day-card,
.overview,
.crowd-strip,
.hours-strip,
.planner-section,
.status-banner {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(31, 42, 41, 0.04);
}

.panel {
  padding: 18px;
}

.panel h2,
.section-title h2 {
  font-size: 1rem;
}

.panel label,
.slot-label,
.reservation-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.panel input,
.panel select,
.day-card input,
.day-card select,
.day-card textarea,
.share-dialog input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
}

.panel input:focus,
.panel select:focus,
.day-card input:focus,
.day-card select:focus,
.day-card textarea:focus,
.share-dialog input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.15);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.toggle-line {
  align-content: end;
  grid-template-columns: 18px 1fr;
  min-height: 65px;
  margin-top: 14px;
}

.toggle-line input {
  width: 18px;
  min-height: 18px;
  margin: 20px 0 0;
}

.button-row {
  margin-top: 16px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.source-panel p,
.crowd-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.source-links {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.9rem;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.status-banner {
  padding: 12px 14px;
  border-color: rgba(183, 131, 36, 0.4);
  background: #fff6df;
  color: #5d4414;
  font-weight: 700;
}

.overview {
  display: grid;
  grid-template-columns: minmax(220px, 0.22fr) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 18px;
  overflow: hidden;
}

.overview-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.overview h2 {
  font-size: clamp(1.18rem, 1.6vw, 1.7rem);
  line-height: 1.14;
}

.park-visuals {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 6px;
}

.visual-tile {
  position: relative;
  aspect-ratio: 1.35;
  min-height: 92px;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-soft);
}

.visual-tile::before {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  width: 6px;
  background: var(--park-color, var(--accent));
  content: "";
}

.visual-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.visual-tile figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 3px;
  padding: 18px 8px 8px;
  color: #ffffff;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7));
}

.park-name,
.park-count {
  min-width: 0;
  overflow-wrap: anywhere;
}

.park-name {
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.2;
}

.park-count {
  font-size: 0.66rem;
  font-weight: 800;
}

.crowd-strip,
.hours-strip,
.planner-section {
  padding: 16px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.hours-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 10px;
}

.empty-state {
  min-height: 96px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.crowd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(218px, 1fr));
  gap: 10px;
}

.crowd-cell {
  min-height: 146px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfc;
}

.crowd-date,
.crowd-source,
.recommendation-note {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.crowd-selected {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  font-size: 0.92rem;
  font-weight: 900;
}

.crowd-score {
  white-space: nowrap;
  color: var(--accent-dark);
}

.crowd-label {
  margin-top: 5px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
}

.crowd-best {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.crowd-best strong {
  color: var(--text);
}

.best-park-summary {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.best-park-pill {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: #fbfdfc;
  font-size: 0.82rem;
  font-weight: 800;
}

.best-park-pill span:first-child {
  color: var(--muted);
}

.best-park-pill span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.hours-cell {
  min-height: 118px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfc;
}

.hours-date {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hours-park {
  margin-top: 4px;
  font-size: 0.92rem;
  font-weight: 800;
}

.hours-time {
  margin-top: 8px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.hours-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.planner-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.day-card {
  position: relative;
  padding: 14px;
  border-left: 5px solid var(--day-accent, var(--line-strong));
  overflow: hidden;
}

.day-color-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  height: 7px;
  margin: -14px -14px 12px;
  background: var(--surface-soft);
}

.day-color-segment {
  min-width: 0;
  background: var(--focus-color, var(--line-strong));
}

.day-color-segment.is-empty {
  background: var(--line);
}

.day-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.day-card h3 {
  font-size: 1rem;
  line-height: 1.25;
}

.edit-day-button {
  align-self: start;
}

.itinerary-focus {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.focus-pill {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 2px 10px;
  min-height: 0;
  border: 1px solid var(--focus-border, var(--line));
  border-left: 5px solid var(--focus-color, var(--line-strong));
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--focus-bg, #fbfdfc);
}

.focus-pill.is-open {
  color: var(--muted);
}

.focus-pill span {
  display: block;
  align-self: start;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.focus-pill strong {
  display: block;
  min-width: 0;
  font-size: 0.92rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.focus-pill em {
  grid-column: 2;
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.focus-pill .focus-time {
  color: var(--muted);
  font-weight: 400;
}

.day-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.day-card-footer span {
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 5px 8px;
}

.day-summary-block {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.summary-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  font-size: 0.84rem;
  line-height: 1.35;
}

.summary-row.single {
  grid-template-columns: 1fr;
}

.summary-row span,
.summary-kicker {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-row strong {
  min-width: 0;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.day-note-preview {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.day-date {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.park-select {
  margin-top: 12px;
}

.hour-badge {
  min-width: 106px;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 8px 10px;
  text-align: right;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.badge-stack {
  display: grid;
  gap: 8px;
}

.crowd-badge {
  min-width: 106px;
  border-radius: 8px;
  background: #fff6df;
  padding: 8px 10px;
  text-align: right;
  color: #6e4d12;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.crowd-badge strong {
  display: block;
  color: var(--text);
  font-size: 0.86rem;
}

.crowd-advice {
  margin-top: 10px;
  border: 1px solid rgba(183, 131, 36, 0.38);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fffaf0;
  color: #5d4414;
  font-size: 0.84rem;
  line-height: 1.4;
}

.hour-badge strong {
  display: block;
  color: var(--text);
  font-size: 0.86rem;
}

.slot-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.slot-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.slot-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.slot-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
}

.slot-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--accent);
}

.slot-controls {
  display: grid;
  gap: 8px;
}

.day-card textarea {
  min-height: 74px;
  resize: vertical;
  line-height: 1.38;
}

dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

#dayDialog {
  width: min(1180px, calc(100vw - 24px));
}

dialog::backdrop {
  background: rgba(31, 42, 41, 0.42);
}

.share-dialog,
.settings-dialog,
.day-dialog {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.settings-dialog {
  max-height: min(86vh, 900px);
  overflow: auto;
}

.day-dialog {
  max-height: min(88vh, 980px);
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

#dayDialogContent,
.day-dialog > *,
.day-dialog-grid,
.day-core-fields,
.day-editor-main,
.day-intel,
.slot-controls,
.dialog-section,
.intel-panel {
  min-width: 0;
}

.dialog-section,
.intel-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.dialog-section h3,
.intel-panel h3 {
  margin: 0 0 12px;
  font-size: 0.96rem;
}

.day-core-fields {
  display: grid;
  grid-template-columns: minmax(0, 0.45fr) minmax(0, 0.55fr);
  gap: 12px;
}

.activity-editor {
  border-left: 5px solid var(--accent);
}

.additional-info-entry textarea {
  min-height: 128px;
  resize: vertical;
  line-height: 1.4;
}

.settings-dialog label,
.day-dialog label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.settings-dialog input,
.settings-dialog select,
.day-dialog input,
.day-dialog select,
.day-dialog textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
}

.day-dialog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 16px;
  align-items: start;
}

.day-editor-main {
  display: grid;
  gap: 12px;
}

.editor-slot-grid {
  margin-top: 0;
}

.day-intel {
  display: grid;
  gap: 12px;
}

.intel-panel p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.intel-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 5px 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.intel-row:first-of-type {
  border-top: 0;
}

.intel-row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.intel-row strong {
  font-size: 0.9rem;
}

.intel-row em {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

.intel-mini-grid {
  display: grid;
  gap: 6px;
}

.intel-row.compact {
  grid-template-columns: minmax(0, 1.35fr) 48px minmax(0, 1fr);
  align-items: center;
  padding: 6px 0;
  border-radius: 8px;
}

.intel-row.compact em {
  grid-column: auto;
}

.intel-row.compact.is-selected {
  border-top-color: transparent;
  border-left: 5px solid var(--intel-color, var(--accent));
  background: color-mix(in srgb, var(--intel-color, var(--accent)) 12%, #ffffff);
  padding: 8px 10px;
}

.intel-slot-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.intel-slot-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  background: var(--intel-color, var(--accent));
  color: #ffffff !important;
  padding: 0 7px;
  font-size: 0.68rem !important;
  font-weight: 900;
  text-transform: uppercase;
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.share-dialog p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 840px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions button {
    flex: 1;
  }

  .sidebar,
  .day-dialog-grid {
    grid-template-columns: 1fr;
  }

  .overview {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .overview h2 {
    font-size: 1.16rem;
  }

  .park-visuals {
    display: flex;
    gap: 8px;
    margin: 0 -14px;
    padding: 0 14px 4px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .visual-tile {
    width: clamp(128px, 38vw, 176px);
    min-height: 86px;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
}

@media (max-width: 560px) {
  .layout {
    padding: 12px;
  }

  .topbar {
    padding: 12px;
  }

  .field-grid,
  .day-core-fields {
    grid-template-columns: 1fr;
  }

  .planner-board {
    grid-template-columns: 1fr;
  }

  .slot-row {
    grid-template-columns: 1fr;
  }

  .itinerary-focus {
    grid-template-columns: 1fr;
  }

  .slot-name {
    min-height: 22px;
  }

  .visual-tile {
    width: 132px;
  }
}

@media print {
  .topbar,
  .sidebar,
  .source-panel,
  body {
    background: #ffffff;
  }

  .layout {
    display: block;
    padding: 0;
  }

  .workspace {
    gap: 10px;
  }

  .day-card,
  .overview,
  .crowd-strip,
  .hours-strip,
  .planner-section {
    box-shadow: none;
    break-inside: avoid;
  }
}
