/* Brand: "My Ideal Cruise" — teal + navy from the logo */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e0e2e7;
  --text: #1c2130;
  --text-muted: #6b7280;
  --accent: #12837c;
  --accent-hover: #0e6862;
  --accent-soft: #e0f4f2;
  --row-hover: #eef8f7;
  --brand-teal: #2ba59e;
  --brand-navy: #22414f;
  --shadow: 0 1px 3px rgba(20, 20, 30, 0.08);
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c;
    --panel: #1c1f27;
    --border: #2c303a;
    --text: #e7e9ee;
    --text-muted: #9aa0ac;
    --accent: #35bdb5;
    --accent-hover: #4fcac3;
    --accent-soft: #123331;
    --row-hover: #17302f;
    --brand-teal: #4cc7c0;
    --brand-navy: #a9c6d4;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.brand { display: flex; align-items: center; gap: 10px; margin: 0; text-decoration: none; }
.brand-logo { height: 46px; width: auto; display: block; }
.brand-wordmark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--brand-navy);
  white-space: nowrap;
}
/* Each theme ships its own logo art (light = teal crest, dark = filled badge),
   so no backing plate is needed on dark surfaces anymore. */
@media (max-width: 640px) {
  .brand-logo { height: 40px; }
  .brand-wordmark { font-size: 17px; }
}

.total-count {
  color: var(--text-muted);
  font-size: 13px;
}

:root {
  --inc: #12837c;
  --inc-soft: #e0f4f2;
  --exc: #b3403a;
  --exc-soft: #fbebea;
  /* chart palette — brand teal (selected) + steel navy (others), validated
     (dataviz six checks) against the light/dark panel surfaces */
  --viz-sel: #159d95;
  --viz-other: #2f6fae;
  --viz-track: #d5e3f2;
}

@media (prefers-color-scheme: dark) {
  :root {
    --inc: #3cc4bb;
    --inc-soft: #123331;
    --exc: #e07470;
    --exc-soft: #3a2222;
    --viz-sel: #26a49d;
    --viz-other: #5b8fc9;
    --viz-track: #1f3a52;
  }
}

.filterbar-wrap {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  position: sticky;
  top: 68px;   /* topbar height (logo 40px + 14px paddings + border) minus 1 */
  z-index: 9;
}

.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1600px;
  margin: 0 auto;
}

.filter-pill-wrap { position: relative; }

.filter-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.filter-pill:hover { background: var(--row-hover); }
.filter-pill-wrap.active .filter-pill {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.filter-pill-wrap.open .filter-pill {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}
.pill-caret { color: var(--text-muted); font-size: 10px; }
.pill-badge { display: flex; gap: 4px; font-size: 11px; font-weight: 600; }
.badge-inc { color: var(--inc); }
.badge-exc { color: var(--exc); }

.filter-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: 300px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(20, 20, 30, 0.18);
  padding: 10px;
}
.filter-pill-wrap.open .filter-panel { display: block; }

/* Ship / Ship Class names run long, especially with the cruiseline shown
   alongside — give those panels more room than the default 300px. */
.filter-panel.panel-wide { width: min(480px, calc(100vw - 48px)); }

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.panel-title-row .wiz-info { margin-left: 0; }

.panel-search, .panel-select, .range-row input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}
.panel-select { margin-bottom: 8px; }
.panel-search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.panel-hint {
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 2px 4px;
}
.hint-inc { color: var(--inc); font-weight: 700; }
.hint-exc { color: var(--exc); font-weight: 700; }

.panel-options {
  max-height: 280px;
  overflow-y: auto;
}

.panel-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.panel-option:hover { background: var(--row-hover); }
.panel-option.inc { background: var(--inc-soft); }
.panel-option.exc { background: var(--exc-soft); text-decoration: line-through; }
.panel-option .opt-label { cursor: pointer; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-option .opt-sub { color: var(--text-muted); font-size: 11px; flex-shrink: 0; }
.panel-option.inc .opt-label { color: var(--inc); font-weight: 600; }
.panel-option.exc .opt-label { color: var(--exc); }

.opt-actions { display: flex; gap: 4px; flex-shrink: 0; }
.opt-btn {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0;
}
.opt-btn:hover { border-color: var(--text-muted); }
.opt-inc.on { background: var(--inc); border-color: var(--inc); color: #fff; }
.opt-exc.on { background: var(--exc); border-color: var(--exc); color: #fff; }

.panel-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 2px 4px;
}

.custom-range {
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.cr-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.cr-btn {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
  font-size: 12px;
}
.cr-inc { color: var(--inc); border-color: var(--inc); }
.cr-inc:hover { background: var(--inc-soft); }
.cr-exc { color: var(--exc); border-color: var(--exc); }
.cr-exc:hover { background: var(--exc-soft); }

.panel-note {
  padding: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.active-chips-row {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1600px;
  margin: 8px auto 0;
  flex-wrap: wrap;
}
.chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.chips-list[hidden] { display: none; }

.chips-toggle-btn, .filterbar-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}
.chips-toggle-btn:hover, .filterbar-toggle-btn:hover { background: var(--row-hover); }
.chips-toggle-btn .pill-caret, .filterbar-toggle-btn .pill-caret { transition: transform 0.15s; }
.chips-toggle-btn.open .pill-caret, .filterbar-toggle-btn.open .pill-caret { transform: rotate(180deg); }

/* The "Filter Options" collapse toggle only appears on narrow screens
   (see the phone media query) -- on desktop the filterbar is always visible. */
.filterbar-toggle-btn { display: none; margin-bottom: 8px; }

.chip {
  border-radius: 12px;
  padding: 3px 9px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chip-inc { background: var(--inc-soft); color: var(--inc); }
.chip-exc { background: var(--exc-soft); color: var(--exc); }
.chip button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  white-space: nowrap;
}
.link-btn:hover { color: var(--accent-hover); text-decoration: underline; }

.range-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.range-row input { min-width: 0; }
.range-row span { color: var(--text-muted); }

.layout {
  padding: 20px 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.content {
  flex: 1;
  min-width: 0;
}

.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.results-count { font-size: 13px; color: var(--text-muted); }

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}
.toolbar-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.toolbar-controls select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}

.icon-btn {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.icon-btn:hover { background: var(--row-hover); }

#results-table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--panel);
}

/* 16 columns: tighter cells and wrappable headers so desktop needs no
   horizontal scrolling */
#results-table { font-size: 12.5px; }
#results-table thead th {
  white-space: normal;
  padding: 8px 7px;
  font-size: 11.5px;
}
#results-table tbody td { padding: 8px 7px; }
td.ports-cell { font-size: 11.5px; min-width: 130px; }
.ports-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* clickable column-header sorting */
#results-table thead th[data-sort] { cursor: pointer; user-select: none; }
#results-table thead th[data-sort]:hover { color: var(--text); }
#results-table thead th.sort-asc,
#results-table thead th.sort-desc { color: var(--accent); }
#results-table thead th.sort-asc::after { content: " \2191"; }
#results-table thead th.sort-desc::after { content: " \2193"; }

tbody tr.cruise-row {
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
tbody tr.cruise-row:hover { background: var(--row-hover); }
tbody td { padding: 9px 12px; vertical-align: top; }

.price-cell { font-weight: 600; color: var(--accent); white-space: nowrap; }
.price-cell .cabin-tag {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 11px;
}

.expand-toggle {
  color: var(--text-muted);
  width: 16px;
  text-align: center;
}

.detail-modal {
  /* near-fullscreen: fill the overlay, whose padding keeps a gap at the edges */
  width: min(1400px, 100%);
  height: 100%;
  max-height: 100%;
}
/* compound selector: must outweigh .compare-modal-body's padding reset */
.compare-modal-body.detail-body { padding: 14px 24px 20px; }
.detail-subtitle { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 20px;
}

.detail-block h4 {
  margin: 0 0 4px 0;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}
.detail-block div.val { font-size: 13px; }
.detail-block .ports { line-height: 1.5; }

.empty-state, .loading-state {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pagination button {
  padding: 6px 11px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.pagination button:hover:not(:disabled) { background: var(--row-hover); }
.pagination button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pagination button:disabled { opacity: 0.4; cursor: default; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .filterbar-wrap { position: static; }
  .filter-panel { width: min(300px, calc(100vw - 48px)); }
}

/* phone rules live at the end of the file so they win the cascade */

.filter-panel.align-right {
  left: auto;
  right: 0;
}

/* ---------- compare feature ---------- */

.cmp-th, .cmp-cell { width: 34px; text-align: center; }
.cmp-check { cursor: pointer; width: 15px; height: 15px; accent-color: var(--accent); }

.compare-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -2px 10px rgba(20, 20, 30, 0.15);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 40;
}
.compare-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.compare-chips[hidden] { display: none; }
.compare-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.compare-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.compare-btn:hover:not(:disabled) { background: var(--accent-hover); }
.compare-btn:disabled { opacity: 0.5; cursor: not-allowed; }

body.modal-open { overflow: hidden; }

.compare-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.55);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.compare-modal {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
  max-width: min(1200px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.compare-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.compare-modal-head h2 { margin: 0; font-size: 17px; }
.compare-modal-body { overflow: auto; padding: 0 0 12px; }

.compare-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.compare-table th, .compare-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  min-width: 150px;
  max-width: 260px;
}
.compare-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
  border-bottom: 2px solid var(--accent);
}
.compare-table tbody th {
  position: sticky;
  left: 0;
  background: var(--panel);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  min-width: 110px;
  z-index: 1;
}
/* Frozen top-left corner: sticky on both axes and above every other sticky
   layer, so scrolled columns/rows pass behind it instead of through it. */
.compare-table thead th.cmp-corner {
  left: 0;
  z-index: 3;
  color: var(--text-muted);
}
.compare-table tbody tr:hover td { background: var(--row-hover); }
.compare-table s { color: var(--text-muted); margin-left: 4px; }

.cmp-col-head { position: relative; padding-right: 22px; }
.cmp-col-title { font-weight: 700; }
.cmp-col-sub { color: var(--text-muted); font-weight: 400; font-size: 12px; }
.cmp-remove {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 2px;
}
.cmp-remove:hover { color: var(--text); }

.cmp-best { font-weight: 700; color: var(--accent); }

/* hidden must beat the display:flex above */
.compare-bar[hidden], .compare-overlay[hidden] { display: none; }

/* when the compare bar is visible, reserve space so it never covers the pagination */
body.compare-open .layout { padding-bottom: 72px; }

/* price-by-date comparison chart (expanded row) */
.price-history {
  margin-bottom: 14px;
}
.ph-note { font-size: 12px; color: var(--text-muted); padding: 4px 0 8px; }
.ph-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.ph-title { font-size: 12px; font-weight: 600; color: var(--text); }
.ph-legend { display: flex; gap: 14px; font-size: 11px; color: var(--text-muted); }
.ph-key { display: inline-flex; align-items: center; gap: 5px; }
.ph-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ph-swatch-sel { background: var(--viz-sel); }
.ph-swatch-other { background: var(--viz-other); }
.ph-chart { position: relative; }
/* charts have a 480px min drawing width; scale down via viewBox on phones */
.ph-chart svg { max-width: 100%; height: auto; display: block; }
/* many-bar charts render full-size and pan sideways instead of shrinking */
.ph-chart.ph-scroll { overflow-x: auto; }
.ph-chart.ph-scroll svg { max-width: none; }
.ph-grid { stroke: var(--border); stroke-width: 1; }
.ph-divider { stroke: var(--border); stroke-width: 1; }
.ph-tick { fill: var(--text-muted); font-size: 10px; }
.ph-axis-label { fill: var(--text-muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.ph-value { fill: var(--text); font-size: 11px; font-weight: 600; }
.ph-bar { fill: var(--viz-other); }
.ph-bar-sel { fill: var(--viz-sel); }
.ph-track { fill: var(--viz-track); }
.ph-marker { stroke: var(--viz-sel); stroke-width: 3; }
.ph-marker-ring { stroke: var(--bg); stroke-width: 7; }
.ph-hit { cursor: pointer; }
.ph-hit:hover { fill: rgba(128, 128, 128, 0.08); }
.ph-tooltip {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 6px 9px;
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}

.ph-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ph-cabin {
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
}

.ph-tick-year { font-weight: 600; }

.ph-bar-cmp { stroke: var(--text); stroke-width: 1.5; }
.ph-cmp-dot { fill: var(--text); }
.ph-tip-hint { color: var(--text-muted); font-size: 11px; }

/* per-bar cruise summary under the alternatives price chart */
.alt-chart-label {
  font-size: 9px;
  line-height: 11px;
  color: var(--text-muted);
  text-align: center;
  overflow: hidden;
}
.alt-chart-label .acl-ship,
.alt-chart-label .acl-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alt-chart-label .acl-ship { font-size: 10px; font-weight: 700; color: var(--text); }
.alt-chart-label.acl-sel .acl-ship { color: var(--viz-sel); }

.compare-head-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- best alternative options ---------- */

.alternatives {
  margin: 12px 0 6px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.alt-sections { display: flex; flex-direction: column; gap: 6px; }
.alt-section { margin: 8px 0 4px; }
.alt-table-wrap { overflow-x: auto; }
.alt-table td.alt-ports { font-size: 11px; min-width: 150px; max-width: 260px; }
.alt-table tr.alt-row-click { cursor: pointer; }
.alt-table tr.alt-row-click:hover td { background: var(--row-hover); }
.alt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 4px 0 8px;
}
.alt-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.alt-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.alt-table .cmp-cell { width: 24px; }
.alt-option-label { font-weight: 600; min-width: 130px; max-width: 220px; }
.alt-row-sel { background: var(--accent-soft); }
.alt-diff { font-weight: 600; }
.alt-price { font-weight: 600; color: var(--accent); white-space: nowrap; }
.alt-cheaper { color: var(--inc); font-weight: 600; white-space: nowrap; }
.alt-pricier { color: var(--exc); font-weight: 600; white-space: nowrap; }
.alt-same { color: var(--text-muted); }
.alt-chart { margin-top: 2px; }

/* ---------- importance selector (filter panels) ---------- */

.imp-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 7px 2px 3px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.imp-lbl { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-right: 2px; }
.imp-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
}
.imp-btn:hover { border-color: var(--text-muted); }
.imp-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- score column + blend control ---------- */

.score-cell { min-width: 86px; }
.score-cell .wiz-score { font-size: 13px; }
.score-sub { display: block; color: var(--text-muted); font-size: 10px; margin-top: 2px; }

.blend-label { white-space: nowrap; }
.blend-ends { font-size: 11px; color: var(--text-muted); }
#price-weight { width: 110px; accent-color: var(--accent); vertical-align: middle; }
.blend-val { font-weight: 600; color: var(--text); font-size: 12px; min-width: 32px; }

.score-factors {
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.score-factors h4 {
  margin: 0 0 2px 0;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* ---------- cruise selection wizard ---------- */

.wizard-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.wizard-btn:hover { background: var(--accent-hover); }

.wizard-modal { width: min(1050px, 100%); max-height: 92vh; }
.wizard-body { padding: 16px 20px 20px; overflow-y: auto; }

.wiz-progress { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.wiz-dot {
  width: 24px;
  height: 9px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  padding: 0;
}
.wiz-dot:hover { border-color: var(--accent); }
.wiz-dot.done { background: var(--accent-soft); border-color: var(--accent); }
.wiz-dot.cur { background: var(--accent); border-color: var(--accent); }

.wiz-info {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: var(--panel);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  vertical-align: 3px;
  margin-left: 8px;
}
.wiz-info:hover { background: var(--accent); color: #fff; }

.wizhelp-overlay { z-index: 60; }
.wizhelp-modal {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
  width: min(520px, 92vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wizhelp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.wizhelp-head h3 { margin: 0; font-size: 15px; }
.wizhelp-body { padding: 4px 18px 16px; overflow-y: auto; font-size: 13px; }
.wizhelp-text p { margin: 10px 0; line-height: 1.5; }
.wizhelp-list { margin: 6px 0; padding-left: 20px; }
.wizhelp-list li { margin: 4px 0; line-height: 1.45; }

.wiz-step-count {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}
.wiz-step-title { margin: 2px 0; font-size: 18px; }
.wiz-step-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }

.wiz-imp-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}
.wiz-imp {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 7px 8px;
  text-align: center;
  cursor: pointer;
  color: var(--text);
}
.wiz-imp:hover { background: var(--row-hover); }
.wiz-imp.on { border-color: var(--accent); background: var(--accent-soft); outline: 1px solid var(--accent); }
.wiz-imp-label { display: block; font-weight: 600; font-size: 13px; }

.wiz-sel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--panel);
}
.wiz-sel.wiz-dim { opacity: 0.8; }
.wiz-options { max-height: 320px; }
/* The choices themselves should read as the main content of the step */
.wiz-options .panel-option { font-size: 14px; }
.wiz-options .opt-label { font-weight: 600; color: var(--text); }
.wiz-sel .panel-search { margin-bottom: 4px; }

.wiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  gap: 10px;
}
.wiz-footer-right { display: flex; align-items: center; gap: 14px; }

.wiz-results-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.wiz-results-summary { font-size: 13px; }
.wiz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.wiz-chips .chip { max-width: 100%; }
.wiz-chip-crit { outline: 1px solid var(--inc); }

.wiz-blend {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.wiz-blend input[type="range"] { width: 200px; accent-color: var(--accent); }
.wiz-blend-val { font-weight: 600; color: var(--text); }

.wiz-table td { vertical-align: middle; }
.wiz-row { cursor: pointer; }
.wiz-row:hover { background: var(--row-hover); }
.wiz-rank { font-weight: 700; color: var(--text-muted); }
.wiz-score-cell { min-width: 96px; }
.wiz-score { font-weight: 700; color: var(--accent); font-size: 14px; }
.wiz-score-sub { color: var(--text-muted); font-size: 11px; }
.wiz-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--viz-track);
  margin-top: 3px;
  overflow: hidden;
}
.wiz-bar > span { display: block; height: 100%; background: var(--viz-sel); border-radius: 3px; }
.wiz-price { font-weight: 600; color: var(--accent); white-space: nowrap; }
.wiz-price .cabin-tag { display: block; font-weight: 400; color: var(--text-muted); font-size: 11px; }
.wiz-detail td { background: var(--bg); }

.wiz-factors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 6px 20px;
  padding: 6px 0;
}
.wiz-factor { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.wiz-factor-label { flex: 0 0 130px; }
.wiz-factor-imp { color: var(--text-muted); font-size: 11px; flex: 0 0 76px; }
.wiz-factor-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--viz-track);
  overflow: hidden;
}
.wiz-factor-bar > span { display: block; height: 100%; background: var(--viz-other); }
.wiz-factor-pct { flex: 0 0 36px; text-align: right; font-weight: 600; }
.wiz-more { text-align: center; margin-top: 10px; }

/* ---------- phones (kept last so these overrides win the cascade) ---------- */

@media (max-width: 700px) {
  /* the two-row topbar would eat ~90px of every scrolled screen if sticky */
  .topbar { padding: 10px 12px; position: static; }
  .topbar-title { white-space: normal; flex-wrap: wrap; row-gap: 0; }
  .filterbar-wrap { padding: 8px 12px; }
  .layout { padding: 12px; }

  .compare-modal-body.detail-body { padding: 10px 12px 14px; }

  .compare-overlay { padding: 8px; }
  /* flex items won't shrink below their content's min width unless told to */
  .compare-modal, .wizard-modal {
    min-width: 0;
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }
  .compare-modal-head { padding: 10px 12px; }
  .wizard-body { padding: 12px; }

  /* Keep Back/Next reachable without scrolling past a long step's options --
     pin the footer to the bottom of the modal, above the scrolling content. */
  .wiz-footer {
    position: sticky;
    bottom: 0;
    background: var(--panel);
    margin: 14px -12px -12px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
  }

  .wiz-imp-row { grid-template-columns: 1fr 1fr 1fr; }
  .wiz-factor-label { flex: 0 0 96px; }
  .wiz-factor-imp { flex: 0 0 62px; }

  /* bigger touch targets for include/exclude */
  .opt-btn { width: 30px; height: 30px; font-size: 13px; }

  .results-toolbar { justify-content: flex-start; }
  .toolbar-controls { flex-wrap: wrap; gap: 8px; }

  /* Collapse the filter-pill row behind a toggle to save mobile screen space. */
  .filterbar-toggle-btn { display: flex; }
  .filterbar { display: none; }
  .filterbar-wrap.filters-open .filterbar { display: flex; }

  /* Selected-cruise chips: one left-aligned, horizontally-scrolling line
     instead of wrapping (wrapping with flex:1 left odd gaps between chips). */
  .compare-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    overflow: hidden;   /* clip iOS rubber-band overscroll from the chip row below */
  }
  .compare-chips {
    width: 100%;
    flex: none;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  .compare-chips .chip { flex-shrink: 0; white-space: nowrap; }
  .compare-actions { width: 100%; justify-content: flex-end; }
}

/* Port hierarchy tree: same row rhythm (padding/gap/font-size) as
   .panel-option, indented one step per level to show nesting. */
.port-tree-section {
  display: flex;
  flex-direction: column;
}

.port-tree-header,
.port-tree-port {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 13px;
  user-select: none;
  cursor: pointer;
}

.port-tree-header:hover,
.port-tree-port:hover { background: var(--row-hover); }

.port-tree-toggle {
  display: inline-block;
  width: 14px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
}

.port-tree-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.port-tree-children {
  display: flex;
  flex-direction: column;
}
.port-tree-children[hidden] { display: none; }

.port-tree-port.inc { background: var(--inc-soft); }
.port-tree-port.exc { background: var(--exc-soft); text-decoration: line-through; }
.port-tree-port.inc .port-tree-name { color: var(--inc); font-weight: 600; }
.port-tree-port.exc .port-tree-name { color: var(--exc); }

.port-tree-header.has-selection .port-tree-name { font-weight: 700; }
