  * { box-sizing: border-box; }
  :root {
    --header-h: 44px; /* fallback until JS measures the real header height */
    color-scheme: light; /* keep native/Google widgets (e.g. the city search box) light-themed even if the OS/browser prefers dark */
  }
  body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #f4f6f8;
    color: #222;
  }
  /* Browsers don't inherit the page font into form controls by default (textareas in
     particular tend to fall back to a monospace UA default) -- without this, every
     <textarea>/<input>/<select>/<button> on the page (the chat box below the map included)
     looks visually inconsistent with the rest of the text. */
  textarea, input, select, button { font-family: inherit; }
  header.page-header {
    background: #2b3e50;
    color: white;
    padding: 8px 16px;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 14px;
    row-gap: 2px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  }
  .page-header-logo {
    height: 36px;
    width: auto;
    display: block;
    align-self: center;
  }
  header.page-header p {
    margin: 0;
    line-height: 1.3;
    color: #d7dee5;
    font-size: 0.82rem;
    align-self: center;
  }
  header.page-header a { color: #9fd0ff; }

  .auth-widget {
    margin-left: auto;
    display: flex;
    align-items: center;
    align-self: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #d7dee5;
    white-space: nowrap;
  }
  .auth-widget button {
    border: 1px solid rgba(255,255,255,0.4);
    background: transparent;
    color: white;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.82rem;
    cursor: pointer;
  }
  .auth-widget button:hover { background: rgba(255,255,255,0.12); }
  .auth-widget button.primary { background: #4c78af; border-color: #4c78af; }
  .auth-widget button.primary:hover { background: #5a86bd; }

  .auth-user-wrap { position: relative; }
  .auth-user-btn {
    border: 1px solid rgba(255,255,255,0.4); background: transparent; color: white;
    border-radius: 6px; padding: 5px 10px; font-size: 0.85rem; cursor: pointer;
  }
  .auth-user-btn:hover { background: rgba(255,255,255,0.12); }
  .auth-user-menu {
    display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 1100;
    min-width: 190px; background: white; border: 1px solid #ddd; border-radius: 8px;
    padding: 6px; box-shadow: 0 6px 20px rgba(0,0,0,0.2); flex-direction: column; gap: 2px;
  }
  .auth-user-wrap.open .auth-user-menu { display: flex; }
  /* Qualified with the ancestor class (not just ".auth-user-menu-item") so this reliably beats
     the ".auth-widget button { color: white; ... }" rule below in specificity -- plain single-
     class selectors here lost to that class+element selector, making every non-danger item
     white-on-white and invisible. */
  .auth-user-menu .auth-user-menu-item {
    display: block; width: 100%; text-align: left; border: none; background: none;
    color: #2b3e50; padding: 8px 10px; border-radius: 6px; font-size: 0.88rem; cursor: pointer;
  }
  .auth-user-menu .auth-user-menu-item:hover { background: #f0f3f7; }
  .auth-user-menu .auth-user-menu-item.danger { color: #c0392b; }
  .auth-user-menu .auth-user-menu-item.danger:hover { background: #fdecea; }
  .auth-user-menu-divider { border: none; border-top: 1px solid #eee; margin: 4px 2px; }

  .modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000; padding: 16px;
  }
  .onboarding-overlay {
    position: fixed; inset: 0; background: rgba(20,25,35,0.78);
    display: flex; align-items: center; justify-content: center;
    z-index: 2500; padding: 20px;
  }
  /* The auth modal can be opened from inside the onboarding overlay (to log in before
     describing a trip) -- it needs to sit above it in that case. */
  #auth-modal { z-index: 2600; }
  .onboarding-box {
    background: white; border-radius: 14px; padding: 28px; max-width: 560px; width: 100%;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35); box-sizing: border-box;
  }
  .onboarding-box h2 { margin: 0 0 8px; color: #2b3e50; }
  .onboarding-auth-hint {
    margin: 0 0 14px; padding: 8px 12px; background: #eef3fa; border-radius: 8px;
    font-size: 0.85rem; color: #444;
  }
  .onboarding-auth-hint a { color: #4c78af; font-weight: 600; }
  .onboarding-textarea {
    width: 100%; box-sizing: border-box; padding: 12px; border: 1px solid #ccc;
    border-radius: 8px; font-size: 0.95rem; resize: vertical; margin-top: 10px;
  }
  .onboarding-box label { display: block; font-size: 0.82rem; color: #555; margin: 12px 0 4px; }
  #onboarding-purpose {
    width: 100%; box-sizing: border-box; padding: 8px; border: 1px solid #ccc;
    border-radius: 8px; font-size: 0.9rem;
  }
  #onboarding-purpose-custom {
    width: 100%; box-sizing: border-box; padding: 8px; border: 1px solid #ccc;
    border-radius: 8px; font-size: 0.9rem; margin-top: 8px;
  }
  .onboarding-checkbox-label {
    display: flex !important; align-items: center; gap: 8px; font-size: 0.9rem !important;
    color: #333 !important; margin: 14px 0 0 !important; cursor: pointer;
  }
  .onboarding-checkbox-label input { width: 16px; height: 16px; cursor: pointer; }
  .onboarding-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
  .onboarding-btn-primary {
    flex: 1 1 auto; padding: 10px 16px; border: none; border-radius: 8px; background: #4c78af;
    color: white; font-weight: 600; font-size: 0.95rem; cursor: pointer;
  }
  .onboarding-btn-primary:hover { background: #3d6899; }
  .onboarding-btn-primary:disabled { background: #9db7d1; cursor: default; }
  .onboarding-btn-secondary {
    padding: 10px 16px; border: 1px solid #ccc; border-radius: 8px; background: white;
    color: #555; font-weight: 600; font-size: 0.9rem; cursor: pointer;
  }
  .onboarding-btn-secondary:hover { border-color: #999; }
  #onboarding-status { min-height: 1.2em; margin-top: 10px; }

  .trips-overview-box { position: relative; max-width: 640px; }
  .trips-overview-list {
    display: flex; flex-direction: column; gap: 10px; margin: 14px 0;
    max-height: 50vh; overflow-y: auto;
  }
  .trip-overview-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    flex-wrap: wrap; border: 1px solid #ddd; border-radius: 10px; padding: 12px 14px;
    cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
  }
  .trip-overview-row:hover { border-color: #4c78af; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
  .trip-overview-main { display: flex; flex-direction: column; gap: 4px; }
  .trip-overview-cities { font-weight: 600; color: #2b3e50; }
  .trip-overview-dates { font-size: 0.85rem; color: #666; }
  .trip-overview-edited { font-size: 0.78rem; color: #888; white-space: nowrap; }
  .trip-overview-delete-btn {
    flex-shrink: 0; border: none; background: #c0392b; color: white; border-radius: 6px;
    width: 32px; height: 32px; font-size: 0.95rem; cursor: pointer; line-height: 1;
  }
  .trip-overview-delete-btn:hover { background: #a5311f; }
  .trips-overview-new-btn {
    display: block; width: 100%; padding: 10px 16px; border: none; border-radius: 8px;
    background: #4c78af; color: white; font-weight: 600; font-size: 0.95rem; cursor: pointer;
  }
  .trips-overview-new-btn:hover { background: #3d6899; }
  .modal-box {
    position: relative;
    background: white; border-radius: 10px; padding: 24px 20px 20px;
    width: 100%; max-width: 320px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  }
  .modal-box h3 { margin: 0 0 14px; color: #2b3e50; }
  .modal-close {
    position: absolute; top: 8px; right: 10px;
    border: none; background: none; font-size: 1.2rem; color: #888; cursor: pointer;
  }
  .delete-account-confirm-btn {
    display: block; width: 100%; padding: 9px 10px; margin-top: 4px; border: none;
    border-radius: 6px; background: #c0392b; color: white; font-weight: 600;
    font-size: 0.9rem; cursor: pointer;
  }
  .delete-account-confirm-btn:hover { background: #a5311f; }
  .delete-account-cancel-btn {
    display: block; width: 100%; padding: 9px 10px; margin-top: 8px; border: 1px solid #ccc;
    border-radius: 6px; background: white; color: #555; font-weight: 600;
    font-size: 0.9rem; cursor: pointer;
  }
  .delete-account-cancel-btn:hover { border-color: #999; }
  #auth-form { display: flex; flex-direction: column; gap: 10px; }
  #auth-form input {
    padding: 9px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 0.95rem;
  }
  #auth-form button[type="submit"] {
    padding: 9px 10px; border: none; border-radius: 6px; background: #4c78af; color: white;
    font-weight: 600; cursor: pointer;
  }
  .auth-error { color: #c0392b; font-size: 0.82rem; min-height: 1.1em; }
  .modal-box .hint { margin: 12px 0 0; }

  .oauth-buttons { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
  .oauth-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 10px; border: 1px solid #ccc; border-radius: 6px; background: white;
    font-weight: 600; font-size: 0.9rem; cursor: pointer; color: #333;
  }
  .oauth-btn:hover { background: #f5f5f5; }
  .oauth-btn-icon { font-weight: 700; }
  .oauth-btn-google .oauth-btn-icon { color: #4285F4; }
  .oauth-btn-facebook .oauth-btn-icon { color: #1877F2; }
  .oauth-divider { display: flex; align-items: center; gap: 10px; margin: 10px 0; color: #999; font-size: 0.8rem; }
  .oauth-divider::before, .oauth-divider::after { content: ""; flex: 1; border-top: 1px solid #ddd; }

  .hotel-modal-box { max-width: 480px; max-height: 85vh; overflow-y: auto; }
  .hotel-form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
  .hotel-form-row label {
    flex: 1 1 100px; display: flex; flex-direction: column; gap: 4px;
    font-size: 0.82rem; color: #555;
  }
  .hotel-form-row input, .hotel-form-row select {
    padding: 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 0.9rem; width: 100%;
    box-sizing: border-box;
  }
  .hotel-form-row-3col { flex-wrap: nowrap; }
  .hotel-form-row-3col label { flex: 1 1 0; min-width: 0; }
  .hotel-modal-box > label { display: block; font-size: 0.82rem; color: #555; margin-bottom: 4px; }
  .hotel-modal-box > input[type="text"] {
    width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 6px;
    font-size: 0.9rem; margin-bottom: 10px; box-sizing: border-box;
  }
  .booking-link-btn {
    display: block; text-align: center; margin: 12px 0; padding: 9px 10px;
    border: 1px solid #003580; border-radius: 6px; background: #003580; color: white;
    font-weight: 600; font-size: 0.9rem; text-decoration: none;
  }
  .booking-link-btn:hover { background: #002a66; }
  .gyg-link-btn {
    display: block; text-align: center; margin: 12px 0; padding: 9px 10px;
    border: 1px solid #ff5533; border-radius: 6px; background: #ff5533; color: white;
    font-weight: 600; font-size: 0.9rem; text-decoration: none;
  }
  .gyg-link-btn:hover { background: #e6431f; }
  .rental-link-btn {
    display: block; text-align: center; margin: 12px 0; padding: 9px 10px;
    border: 1px solid #0a6ebd; border-radius: 6px; background: #0a6ebd; color: white;
    font-weight: 600; font-size: 0.9rem; text-decoration: none;
  }
  .rental-link-btn:hover { background: #085795; }
  .flight-link-btn {
    display: block; text-align: center; margin: 12px 0; padding: 9px 10px;
    border: 1px solid #0770e3; border-radius: 6px; background: #0770e3; color: white;
    font-weight: 600; font-size: 0.9rem; text-decoration: none;
  }
  .flight-link-btn:hover { background: #055bb8; }
  .transport-link-btn {
    display: block; text-align: center; margin: 12px 0; padding: 9px 10px;
    border: 1px solid #6b3fa0; border-radius: 6px; background: #6b3fa0; color: white;
    font-weight: 600; font-size: 0.9rem; text-decoration: none;
  }
  .transport-link-btn:hover { background: #55307f; }

  .hotel-name-search { margin: 14px 0 4px; padding-top: 12px; border-top: 1px solid #eee; }
  .hotel-name-search label { display: block; font-size: 0.82rem; color: #555; margin-bottom: 4px; }
  .hotel-name-search input[type="text"] {
    width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 6px;
    font-size: 0.9rem; margin-bottom: 10px; box-sizing: border-box;
  }
  .hotel-name-search button {
    display: block; width: 100%; padding: 8px 14px; border: none; border-radius: 6px;
    background: #2e8b57; color: white; font-weight: 600; cursor: pointer;
  }

  .hotel-selected {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0;
    font-size: 0.85rem; color: #205c3b; background: #e6f7ee; border: 1px solid #2e8b57;
    border-radius: 6px; padding: 5px 10px;
  }
  .hotel-selected-name { cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hotel-selected-remove {
    border: none; background: none; color: #205c3b; font-size: 0.9rem; cursor: pointer; padding: 0;
  }
  .hotel-selected-remove:hover { color: #c0392b; }

  .container {
    display: grid;
    max-width: 1920px;
    width: 100%;
    padding: 12px;
    gap: 12px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "route"
      "map";
  }

  .left-box, .right-box {
    background: white;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    min-width: 0;
  }

  .left-box { grid-area: route; }
  .right-box { grid-area: map; padding: 0; overflow: hidden; }

  /* Tablet: route planner and map side by side */
  @media (min-width: 700px) {
    .container {
      padding: 16px;
      gap: 16px;
      grid-template-columns: 1fr 1fr;
      grid-template-areas: "route map";
      align-items: start;
    }
  }

  /* Desktop / large monitor: wider route column, map panel sticky
     and stretched to fill the viewport height (not just its content height) */
  @media (min-width: 1100px) {
    .container {
      grid-template-columns: 1.6fr 1fr;
    }
    .right-box {
      position: sticky;
      top: calc(var(--header-h) + 16px);
      height: calc(100vh - var(--header-h) - 32px);
      display: flex;
      flex-direction: column;
    }
    .right-box #route-map, .right-box #poi-map, .right-box #chat-box {
      flex: 1 1 auto;
      height: auto;
      min-height: 200px;
      margin-bottom: 0;
    }
    #map-toggle-container, .map-legend, .toolbar, #finalize-banner, .chat-input-row {
      flex-shrink: 0;
    }
  }

  h4 { margin: 6px 0 4px; }
  .hint { font-style: italic; text-align: center; font-size: 0.95rem; color: #666; margin: 0 0 10px; }

  .city-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 60px;
    padding: 10px;
    border: 2px dashed #ccc;
    border-radius: 10px;
    background: #f9f9f9;
    margin-bottom: 14px;
  }
  .city-item {
    flex: 0 0 auto;
    min-width: 110px;
    padding: 10px 10px 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    text-align: center;
    cursor: grab;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .city-item.dragging { opacity: 0.4; }
  .city-item.placeholder { visibility: hidden; }
  .city-remove {
    border: none; background: #eee; color: #888; border-radius: 50%;
    width: 18px; height: 18px; line-height: 18px; font-size: 0.8rem;
    cursor: pointer; flex-shrink: 0; padding: 0;
  }
  .city-remove:hover { background: #e57373; color: white; }

  #confirm-btn, #optimize-btn {
    background: #4c78af; color: white; border: none; border-radius: 6px;
    padding: 8px 14px; cursor: pointer; font-weight: 600;
  }
  #optimize-btn { background: #2e8b57; margin-left: 8px; }
  #confirm-msg { margin-left: 10px; color: #2e8b57; font-weight: bold; }

  /* Shared footprint for both the city/sight search and the category-search trigger, so the
     two columns line up. The Google widget renders its own internal chrome (shadow DOM, out
     of our control beyond the --gmp-mat-color-* tokens below) -- .search-box-shell only fixes
     height/spacing; .category-search-btn additionally gets full manual styling to *look* like
     a matching search field (border, radius, icon) since it's plain HTML we fully control. */
  .search-box-shell { width: 100%; height: 42px; margin-bottom: 12px; box-sizing: border-box; }

  #city-search-container gmp-place-autocomplete {
    width: 100%;
    height: 100%;
    color-scheme: light;
    font-family: Arial, sans-serif;
    --gmp-mat-color-surface: #ffffff;
    --gmp-mat-color-on-surface: #222222;
    --gmp-mat-color-on-surface-variant: #666666;
    --gmp-mat-color-outline: #cccccc;
    --gmp-mat-color-primary: #4c78af;
    --gmp-mat-color-on-primary: #ffffff;
  }

  .trip-dates-row {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid #eee;
  }
  .trip-dates-row h4 { margin: 0; }
  .trip-dates-row label { font-size: 0.88rem; color: #555; }
  #trip-start-date, #trip-end-date { padding: 6px 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 0.9rem; }
  .date-weekday { font-size: 0.85rem; color: #4c78af; font-weight: 600; margin-right: -4px; min-width: 1.6em; display: inline-block; }
  #trip-date-summary { color: #666; }

  .add-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; transition: opacity 0.15s; }
  .add-row.gated { opacity: 0.45; pointer-events: none; }
  .add-col { flex: 1 1 260px; min-width: 0; }
  .add-col h4 { margin: 6px 0 6px; }

  .category-search-btn {
    display: flex; align-items: center; gap: 8px; padding: 0 14px;
    font-family: Arial, sans-serif; font-size: 0.95rem; text-align: left; color: #666;
    border: 1px solid #ccc; border-radius: 4px; background: white; cursor: pointer;
  }
  .search-icon { flex-shrink: 0; display: flex; color: #666; }
  .search-icon svg { width: 23px; height: 23px; fill: currentColor; }
  .category-search-btn:hover { border-color: #999; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
  .category-search-btn.active { border-color: #4c78af; color: #4c78af; font-weight: 600; }
  .category-search-btn.active .search-icon { color: #4c78af; }

  .category-panel {
    margin-top: 8px; border: 1px solid #ddd; border-radius: 8px; padding: 10px;
    background: #fafafa; max-height: 380px; overflow-y: auto;
  }
  .category-breadcrumb {
    display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: #888;
    margin-bottom: 10px; flex-wrap: wrap;
  }
  .crumb { cursor: default; }
  .crumb.filled { color: #4c78af; cursor: pointer; font-weight: 600; }
  .crumb.filled:hover { text-decoration: underline; }
  .crumb-sep { color: #ccc; }

  .category-pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
  .category-pill {
    border: 1px solid #ccc; border-radius: 20px; background: white; padding: 6px 14px;
    font-size: 0.88rem; cursor: pointer;
  }
  .category-pill:hover { border-color: #4c78af; color: #4c78af; }

  .category-results-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px;
  }
  .category-result-card {
    border: 1px solid #ddd; border-radius: 10px; padding: 6px; text-align: center;
    background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
  .category-result-add {
    display: block; width: 100%; margin-top: 6px; padding: 5px 0; border: none;
    border-radius: 6px; background: #4c78af; color: white; font-size: 0.78rem;
    font-weight: 600; cursor: pointer;
  }
  .category-result-add:disabled { background: #9db7d1; cursor: default; }

  .city-container {
    margin: 0 0 24px;
    padding: 10px 14px 14px;
    border-radius: 10px;
    border: 1px solid #ccc;
  }
  .city-header-row {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    margin: 4px 0 10px; flex-wrap: wrap;
  }
  .city-heading {
    margin: 0; color: #2b3e50; cursor: pointer; user-select: none;
  }
  .city-heading-dates { font-size: 0.7em; font-weight: 400; color: #6b7a89; }
  .city-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
  .city-options-wrap { position: relative; flex-shrink: 0; }
  .city-options-toggle {
    flex-shrink: 0; width: 30px; height: 30px; border: 1px solid #999; background: white;
    color: #555; border-radius: 50%; font-weight: 700; font-size: 1rem; cursor: pointer;
    line-height: 1; padding: 0;
  }
  .city-options-toggle:hover { background: #f0f0f0; }
  .city-options-dropdown {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; min-width: 190px;
    display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    background: white; border: 1px solid #ddd; border-radius: 8px; padding: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  }
  .hotel-btn {
    flex-shrink: 0; border: 1px solid #4c78af; background: white; color: #4c78af;
    border-radius: 6px; padding: 6px 12px; font-weight: 600; font-size: 0.85rem; cursor: pointer;
  }
  .hotel-btn:hover { background: #4c78af; color: white; }
  .activity-add-btn {
    flex-shrink: 0; border: 1px solid #ff5533; background: white; color: #ff5533;
    border-radius: 6px; padding: 6px 12px; font-weight: 600; font-size: 0.85rem; cursor: pointer;
  }
  .activity-add-btn:hover { background: #ff5533; color: white; }
  .rental-btn {
    flex-shrink: 0; border: 1px solid #0a6ebd; background: white; color: #0a6ebd;
    border-radius: 6px; padding: 6px 12px; font-weight: 600; font-size: 0.85rem; cursor: pointer;
  }
  .rental-btn:hover { background: #0a6ebd; color: white; }
  .flight-btn {
    flex-shrink: 0; border: 1px solid #0770e3; background: white; color: #0770e3;
    border-radius: 6px; padding: 6px 12px; font-weight: 600; font-size: 0.85rem; cursor: pointer;
  }
  .flight-btn:hover { background: #0770e3; color: white; }

  .transport-leg {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin: 0 0 16px; padding: 6px 10px; flex-wrap: wrap;
  }
  .transport-leg-label { font-size: 0.82rem; color: #666; white-space: nowrap; }
  .transport-leg-btn {
    flex-shrink: 0; border: 1px solid #6b3fa0; background: white; color: #6b3fa0;
    border-radius: 6px; padding: 4px 10px; font-weight: 600; font-size: 0.78rem; cursor: pointer;
  }
  .transport-leg-btn:hover { background: #6b3fa0; color: white; }

  .day-container { margin-bottom: 14px; }
  .day-container h3 { margin: 4px 0 8px; font-size: 1.02rem; color: #333; }
  .day-story { margin: 10px 0 0; font-size: 0.9rem; line-height: 1.45; color: #444; min-height: 1.2em; }
  .day-story:empty::before { content: "…"; color: #bbb; }

  .activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 10px;
  }
  .activity-icon { font-size: 1.6rem; margin-bottom: 2px; }
  .activity-meta { font-size: 0.75rem; color: #777; margin: 2px 0; }
  .activity-book-link {
    display: block; margin-top: 6px; padding: 5px 0; border-radius: 6px;
    background: #ff5533; color: white; font-size: 0.78rem; font-weight: 600;
    text-decoration: none;
  }
  .activity-book-link:hover { background: #e6431f; }

  .poi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    min-height: 40px;
  }
  .poi-card {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: grab;
    transition: transform 0.15s, box-shadow 0.15s;
  }
  .poi-card:hover { transform: scale(1.04); box-shadow: 0 4px 12px rgba(0,0,0,0.18); }
  .poi-card.dragging { opacity: 0.4; }
  .poi-card.activity-card { border-color: #ffd0c2; background: #fff8f6; cursor: default; }
  .poi-card.activity-card:hover { transform: none; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
  .poi-remove {
    position: absolute; top: 6px; right: 6px; z-index: 2;
    border: none; background: rgba(0,0,0,0.55); color: white; border-radius: 50%;
    width: 20px; height: 20px; line-height: 20px; font-size: 0.85rem;
    cursor: pointer; padding: 0;
  }
  .poi-remove:hover { background: #e57373; }
  .poi-thumb {
    height: 80px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    overflow: hidden;
  }
  .poi-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
  .poi-name { margin-top: 6px; font-weight: bold; font-size: 0.88rem; line-height: 1.2; }
  .poi-rating { margin-top: 2px; font-size: 0.75rem; color: #777; }

  .day-drop-zone {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    color: #aaa;
    font-style: italic;
    font-size: 0.85rem;
    margin: 8px 0;
  }
  .day-drop-zone.drag-over, .poi-grid.drag-over {
    border-color: #4c78af;
    background-color: #eef5fb;
    color: #4c78af;
  }
  .invalid-drop { outline: 3px solid #ff4d4d !important; background-color: #ffe6e6 !important; }

  .active-by-click { outline: 3px solid rgba(33,150,243,0.35); }

  #map-toggle-container {
    display: flex; width: 100%; height: 34px; align-items: stretch;
    border-radius: 10px 10px 0 0; overflow: hidden;
  }
  .btn-toggle {
    flex: 1; border: none; padding: 8px 0; font-weight: 600; cursor: pointer;
    background: #6c757d; color: white; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center;
  }
  .btn-toggle.active { background: #4c78af; }

  #route-map, #poi-map, #chat-box {
    width: 100%; height: 360px; border-radius: 0; overflow: hidden; margin-bottom: 10px;
  }
  #chat-box { overflow-y: auto; border: 1px solid #ccc; padding: 10px; background: #fbfbfb; box-sizing: border-box; }
  #chat-box h5 { margin: 10px 0 4px; color: #2b3e50; }
  #chat-box p { margin: 0 0 12px; line-height: 1.4; font-size: 0.92rem; }
  .map-legend { font-size: 0.78rem; color: #555; display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 0 12px; padding: 0 14px; }
  .map-legend span { display: inline-flex; align-items: center; gap: 5px; }
  .swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

  .chat-input-row { display: flex; gap: 8px; margin: 8px 14px 14px; }
  #chat-input { flex-grow: 1; min-height: 38px; max-height: 140px; resize: none; padding: 8px; font-size: 0.95rem; border-radius: 6px; border: 1px solid #ccc; }
  #send-btn { padding: 8px 14px; background: #4c78af; color: white; border: none; border-radius: 6px; cursor: pointer; }

  .toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; padding: 0 14px; }
  .toolbar button {
    border: none; border-radius: 6px; padding: 8px 14px; color: white; cursor: pointer; font-weight: 600;
  }
  #undo-btn, #reset-btn { background: #6c757d; }
  #pause-btn { background: #4c78af; }
  #finalize-btn { background: #2e8b57; }
  #finalize-btn:disabled { background: #8fbf9f; cursor: default; }

  .paused * { pointer-events: none; }
  .paused #pause-btn { pointer-events: auto; }

  #finalize-banner {
    display: none; margin: 10px 14px 14px; padding: 10px; background: #e6f7ee; border: 1px solid #2e8b57;
    border-radius: 8px; color: #205c3b; font-weight: 600;
  }

  .demo-note {
    background: #fff8e1; border: 1px solid #f0d68a; border-radius: 8px;
    padding: 8px 12px; font-size: 0.82rem; color: #6b5a12; margin-bottom: 12px;
  }

  @media (max-width: 699px) {
    #route-map, #poi-map, #chat-box { height: 260px; }
    .left-box { padding: 10px; }
  }

  .site-footer {
    margin-top: 24px; padding: 16px 20px; border-top: 1px solid #ddd;
    background: #f7f8fa; color: #666; font-size: 0.85rem;
  }
  .site-footer-inner {
    max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between;
    align-items: center; flex-wrap: wrap; gap: 10px;
  }
  .site-footer-links a { color: #4c78af; text-decoration: none; margin-left: 16px; }
  .site-footer-links a:first-child { margin-left: 0; }
  .site-footer-links a:hover { text-decoration: underline; }
