/* ── Trip Health inline panel (step 4) ── */
.trip-health-inline-panel {
  margin-top: 24px;
  border-top: 1px solid var(--secondary-light, #E2E8F0);
  padding-top: 20px;
}

/* ── Trip Health badge ── */
.trip-health-badge {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.trip-health-badge:active { transform: scale(.97); }

.trip-health-badge.ready { background: #dcfce7; color: #166534; }
.trip-health-badge.needs-review { background: #fef3c7; color: #92400e; }
.trip-health-badge.conflicts-found { background: #fee2e2; color: #991b1b; }
.trip-health-badge.missing-details { background: #ffe4e6; color: #9f1239; }

.topbar-actions { position: relative; }

.trip-health-popover {
  position: absolute;
  right: 100px;
  top: 46px;
  background: #FAF8F5;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 16px;
  min-width: 280px;
  box-shadow: 0 12px 40px rgba(11,37,69,.12);
  z-index: 20;
  color: #1E293B;
}
.trip-health-popover p { margin: 6px 0; color: #1E293B; }
.trip-health-popover strong { color: #0F172A; }

/* GuideMe Booking Checklist — redesigned styles
 *
 * Drop-in replacement for the checklist module styles currently in
 * public/tripHealth.css. The selectors below match the markup produced
 * by renderChecklistModal() in public/app.js (and the modal shell in
 * public/planner.html) 1:1 — no JS changes required.
 *
 * Token dependencies (defined in public/styles.css):
 *   --paper-0, --paper-1, --paper-2, --hair, --hair-strong,
 *   --text-900, --text-700, --text-500, --text-400,
 *   --accent, --accent-soft, --accent-deep, --accent-hover,
 *   --ok, --err, --r-sm, --r-md, --r-lg, --r-pill, --r-xl,
 *   --sh-sm, --sh-md, --sh-lg, --dur-fast, --ease-out,
 *   --font-mono
 *
 * If the codebase uses the older names from tripHealth.css
 * (--base-light, --secondary-light, etc.), wire them through aliases.
 */

/* =====================================================================
   BOOKING CHECKLIST — redesigned to GuideMe tokens
   Selectors match public/js + public/tripHealth.css 1:1 so the live
   renderChecklistModal() markup picks these up unchanged.
   ===================================================================== */

/* Modal shell (matches .modal / .modal-card from app + the .checklist-modal-card override) */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 22, 40, .42);
  backdrop-filter: blur(8px);
  z-index: 1900;
  padding: 24px;
}
.modal.hidden { display: none; }
.modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--paper-1);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  color: var(--text-700);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.checklist-modal-card {
  width: min(860px, 100%);
  padding: 0;
}
.checklist-modal-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--hair);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.checklist-modal-header h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-900);
  line-height: 1.15;
}
.checklist-modal-header .icon-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-500);
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  padding: 0;
}
.checklist-modal-header .icon-btn:hover {
  background: var(--paper-2);
  color: var(--text-900);
  border-color: var(--hair-strong);
}
.checklist-modal-header .icon-btn.red:hover {
  background: rgba(192,54,44,.08);
  color: var(--err);
  border-color: rgba(192,54,44,.25);
}
.checklist-modal-header .icon-btn i { font-size: 14px; line-height: 1; }

#bookingChecklist {
  flex: 1;
  overflow-y: auto;
  padding: 18px 26px 24px;
}

/* Search bar */
.cl-search-wrap { position: relative; margin-bottom: 18px; }
.cl-search-row { display: flex; align-items: center; gap: 8px; }
.cl-search-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-0);
  border: 1px solid var(--hair-strong);
  border-radius: var(--r-pill);
  padding: 0 14px;
  height: 40px;
  max-width: 340px;
  flex: 1;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.cl-search-pill:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47,125,251,.14);
}
.cl-search-icon {
  color: var(--text-500);
  font-size: 14px;
  flex-shrink: 0;
}
.cl-search-input {
  border: 0;
  background: transparent;
  outline: none;
  flex: 1;
  width: 100%;
  height: 100%;
  font-size: 13.5px;
  color: var(--text-900);
  letter-spacing: -0.005em;
  padding: 0;
  margin: 0;
}
.cl-search-input::placeholder { color: var(--text-400); }

.cl-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--paper-1);
  border: 1px solid var(--hair-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  z-index: 50;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow: hidden;
}
.cl-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.cl-search-result:hover,
.cl-search-result.active { background: var(--accent-soft); }
.cl-search-name { font-size: 13px; color: var(--text-900); }
.cl-search-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
}
.cl-badge--transportation { background: var(--accent-soft); color: var(--accent-deep); border-color: rgba(47,125,251,.20); }
.cl-badge--accommodation { background: rgba(31,157,85,.10); color: #18854A; border-color: rgba(31,157,85,.22); }
.cl-badge--activity { background: rgba(192,139,16,.10); color: #8A6208; border-color: rgba(192,139,16,.22); }
.cl-search-no-results {
  padding: 10px 14px;
  color: var(--text-500);
  font-size: 13px;
}

/* Container blocks (sections — Accommodation, Transportation, per-city) */
.cl-containers { display: flex; flex-direction: column; gap: 12px; }
.cl-container {
  border: 1px solid var(--hair);
  border-radius: var(--r-lg);
  background: var(--paper-1);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.cl-container-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  color: var(--text-900);
  font-family: inherit;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.012em;
  transition: background var(--dur-fast);
}
.cl-container-header:hover { background: var(--paper-2); }
.cl-container-title { flex: 1; }
.cl-container-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--paper-2);
  color: var(--text-500);
  border: 1px solid var(--hair);
  border-radius: var(--r-pill);
  padding: 2px 9px;
}
.cl-container-price {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-900);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.cl-container-chevron {
  color: var(--text-500);
  font-size: 12px;
}
.cl-container-body { padding: 4px 14px 14px; }

/* Subsections within a city container (Booking Required / Not Required) */
.cl-subsection { margin-top: 4px; }
.cl-subsection + .cl-subsection { margin-top: 14px; }
.cl-subsection-title {
  margin: 8px 4px 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-500);
}
.cl-subsection-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  cursor: pointer;
}
.cl-subsection-toggle .cl-subsection-title {
  flex: 1;
  text-align: left;
}
.cl-subsection-toggle .cl-container-chevron { font-size: 11px; }

/* Empty state */
.cl-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 0 14px;
  color: var(--text-500);
}
.cl-empty-icon { font-size: 26px; opacity: .35; color: var(--text-400); }
.cl-empty-label {
  margin: 0;
  font-size: 13px;
  letter-spacing: -0.005em;
}

/* Item — collapsed row */
.cl-item {
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  margin-bottom: 6px;
  background: var(--paper-0);
  overflow: hidden;
  transition: border-color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast);
}
.cl-item:last-child { margin-bottom: 0; }
.cl-item-collapsed {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  border-radius: var(--r-md);
  transition: background var(--dur-fast);
}
.cl-item-collapsed:hover { background: var(--paper-2); }

/* Verified state */
.cl-item--checked {
  background: rgba(31,157,85,.04);
  border-color: rgba(31,157,85,.22);
}
.cl-item--checked .cl-item-collapsed { background: transparent; }
.cl-item--checked .cl-item-name {
  color: var(--text-500);
  text-decoration: line-through;
  text-decoration-color: rgba(10,22,40,.20);
}
.cl-item--checked .cl-item-meta { color: var(--text-400); }
.cl-item--checked .cl-item-price { color: #18854A; }

.cl-item--flash { animation: cl-flash 1.1s var(--ease-out); }
@keyframes cl-flash {
  0%, 100% { background: var(--paper-0); }
  25% { background: var(--accent-soft); }
}

/* Custom verified checkbox */
.cl-checkbox {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: 1.5px solid var(--text-400);
  border-radius: 6px;
  background: var(--paper-0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 12px;
  padding: 0;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.cl-checkbox:hover { border-color: var(--text-900); }
.cl-checkbox.checked {
  background: var(--ok);
  border-color: var(--ok);
}
.cl-checkbox:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cl-checkbox i { font-size: 12px; line-height: 1; }

/* Ticket toggle (booking-required / not-required indicator for activities) */
.cl-ticket-toggle {
  position: relative;
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: 1px solid var(--hair-strong);
  border-radius: 6px;
  background: var(--paper-0);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}
.cl-ticket-toggle:hover { border-color: var(--text-900); }
.cl-ticket-toggle i { font-size: 12px; line-height: 1; }
.cl-ticket-toggle--off { color: var(--text-400); background: var(--paper-2); }
.cl-ticket-toggle--off::after {
  content: '';
  position: absolute;
  width: 16px;
  border-top: 1.5px solid currentColor;
  transform: rotate(-38deg);
}

/* Item text */
.cl-item-text { flex: 1; min-width: 0; }
.cl-item-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-900);
  letter-spacing: -0.008em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--dur-fast);
}
.cl-item-meta {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--dur-fast);
}
.cl-item-price {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-900);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.cl-item-chevron {
  color: var(--text-500);
  font-size: 12px;
  flex-shrink: 0;
}

/* Expanded form */
.cl-item-expanded-wrap {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--hair);
  background: var(--paper-1);
}
.cl-expanded-header {
  display: flex;
  justify-content: flex-end;
  padding: 6px 0 2px;
  min-height: 22px;
}
.cl-delete-btn {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--text-500);
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.cl-delete-btn:hover { color: var(--err); background: rgba(192,54,44,.08); }
.cl-delete-btn i { font-size: 13px; line-height: 1; }

.cl-expanded-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cl-primary-zone {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Fields */
.cl-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}
.cl-field-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-500);
}
.cl-field input[type="text"],
.cl-field input[type="date"],
.cl-field input[type="time"],
.cl-field input[type="number"],
.cl-field input[type="search"],
.cl-field textarea,
.cl-field select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--hair-strong);
  border-radius: var(--r-sm);
  padding: 0 12px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--paper-0);
  color: var(--text-900);
  letter-spacing: -0.005em;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  box-sizing: border-box;
}
.cl-field textarea {
  height: auto;
  min-height: 64px;
  padding: 9px 12px;
  resize: vertical;
  line-height: 1.45;
}
.cl-field input:focus,
.cl-field textarea:focus,
.cl-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47,125,251,.14);
  outline: none;
}
.cl-field input[type="date"],
.cl-field input[type="time"] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  letter-spacing: 0;
}
.cl-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background: var(--paper-0) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4 L5 7 L8 4' fill='none' stroke='%235A6679' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 14px center;
  cursor: pointer;
}

/* Layout helpers inside expanded body */
.cl-form-row { display: flex; flex-direction: column; gap: 0; }
.cl-form-row--2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cl-datetime-pair {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 6px;
}
.cl-datetime-pair input[type="time"] { width: 100%; }
.cl-datetime-pair--range {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}
.cl-datetime-pair--range input[type="date"] { flex: 1 1 150px; min-width: 130px; }
.cl-datetime-pair--range input[type="time"] { flex: 0 0 96px; width: 96px; min-width: 96px; }
.cl-datetime-pair--range .finalize-time-sep {
  flex: 0 0 auto;
  padding: 0 2px;
  color: var(--text-500);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Price input */
.cl-field--price .cl-price-wrap {
  display: flex;
  align-items: center;
  height: 38px;
  border: 1px solid var(--hair-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--paper-0);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.cl-field--price .cl-price-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47,125,251,.14);
}
.cl-price-prefix {
  padding: 0 10px 0 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-500);
  flex-shrink: 0;
}
.cl-price-wrap input {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  flex: 1;
  height: 100%;
  background: transparent !important;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  padding-left: 0 !important;
}
.cl-price-wrap input:focus { box-shadow: none !important; }

/* One-way / Round-trip toggle */
.cl-toggle-group {
  display: inline-flex;
  border: 1px solid var(--hair-strong);
  border-radius: var(--r-pill);
  padding: 3px;
  background: var(--paper-0);
  align-self: flex-start;
}
.cl-toggle-btn {
  flex: 1;
  padding: 0 14px;
  height: 30px;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-500);
  cursor: pointer;
  border-radius: var(--r-pill);
  letter-spacing: -0.005em;
  transition: background var(--dur-fast), color var(--dur-fast);
  white-space: nowrap;
}
.cl-toggle-btn:hover { color: var(--text-900); }
.cl-toggle-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(47,125,251,.30);
}

/* Secondary zone (More details) */
.cl-secondary-zone {
  border-top: 1px dashed var(--hair);
  padding-top: 4px;
}
.cl-more-details-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--text-500);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 0 6px;
  transition: color var(--dur-fast);
}
.cl-more-details-btn:hover { color: var(--text-900); }
.cl-more-details-btn i { font-size: 11px; }
.cl-secondary-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}
.cl-secondary-fields.hidden { display: none; }

/* Add Item button */
.cl-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px dashed var(--hair-strong);
  cursor: pointer;
  color: var(--text-500);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  margin-top: 10px;
  border-radius: var(--r-pill);
  letter-spacing: -0.005em;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.cl-add-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cl-add-btn i { font-size: 13px; }
.cl-add-btn { white-space: nowrap; }

/* Totals */
.cl-totals-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.cl-total-trip {
  margin: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--text-900);
}
.cl-total-trip strong { font-weight: 500; }
.cl-total-activities {
  margin: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-500);
}
.cl-subtotal {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-500);
  margin: 8px 4px 0;
  text-align: right;
}
.cl-grand-total {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-900);
  text-align: right;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--hair);
}

/* Undo toast button (kept for the existing toast pattern) */
.cl-undo-btn {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  margin-left: 8px;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
}

/* Mobile */
@media (max-width: 720px) {
  .checklist-modal-card { width: 100%; }
  #bookingChecklist { padding: 14px 16px 18px; }
  .checklist-modal-header { padding: 18px 18px 14px; }
  .cl-container-header { padding: 12px 14px; }
  .cl-container-body { padding: 4px 10px 10px; }
  .cl-form-row--2 { grid-template-columns: 1fr; }
  .cl-datetime-pair { grid-template-columns: 1fr; }
  .cl-checkbox { width: 28px; height: 28px; }
  .cl-ticket-toggle { width: 28px; height: 28px; }
}
