/* =========================================================================
   PriceLens — style.css
   Club Med competitive price intelligence dashboard
   Palette sourced from Trident UI design system (trident-ui.pro.clubmed)
   ========================================================================= */

@import './tokens.css';

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }

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

/* ---- Page container ---- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px 56px;
}

/* ---- Page header ---- */
.page-header {
  margin-bottom: 24px;
  padding: 18px 24px;
  background: var(--cm-ultramarine);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  row-gap: 12px;
  box-shadow: 0 4px 20px rgba(30,45,74,.22);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  letter-spacing: -0.01em;
}

/* ---- PriceLens logo ---- */
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex-shrink: 0;
  padding-right: 0;
}

.logo-mark {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
  transition: filter .2s, transform .2s;
}

.site-logo:hover .logo-mark {
  filter: drop-shadow(0 3px 10px rgba(0,0,0,.35));
  transform: scale(1.04);
}

.logo-wordmark {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}
.logo-wordmark-inner {
  display: flex;
  align-items: baseline;
}
.logo-price {
  font-size: 1.55rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.logo-lens {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--cm-saffron);
  letter-spacing: -0.02em;
}
.logo-by {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.45);
  padding-left: 1px;
}

/* ---- Vertical divider between logo and resort selector ---- */
.header-divider {
  width: 1px;
  height: 36px;
  background: rgba(255,255,255,.2);
  margin: 0 24px;
  flex-shrink: 0;
}

/* ---- Resort selector ---- */
.header-resort {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}

.header-resort-eyebrow {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,.55);
  padding-left: 2px;
}

#location-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(255,255,255,.22);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffffff' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: 1.5px solid rgba(255,255,255,.45);
  border-radius: 8px;
  padding: 7px 34px 7px 13px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  min-width: 190px;
  transition: border-color .15s, background-color .15s;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

#location-select:hover {
  border-color: rgba(255,255,255,.7);
  background-color: rgba(255,255,255,.32);
}

#location-select:focus {
  outline: none;
  border-color: var(--cm-saffron);
  box-shadow: 0 0 0 2px rgba(255,204,0,.25);
}

#location-select option {
  background: #fff;
  color: #1a2a6c;
  font-weight: 600;
}

#location-select option:checked {
  background: #1a2a6c;
  color: #fff;
}

/* ---- Right side: subtitle pill ---- */
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.page-subtitle {
  font-size: 0.78rem;
  color: rgba(255,255,255,.6);
  font-weight: 500;
  letter-spacing: 0.02em;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 20px;
  padding: 4px 12px 4px 10px;
  white-space: nowrap;
}

/* ---- Legacy selectors that other parts of the CSS may reference ---- */
.location-label        { display: none; }
.location-label-text   { display: none; }
#location-select:focus {
  outline: none;
  border-color: var(--cm-saffron);
  box-shadow: 0 0 0 3px hsla(45, 100%, 50%, 0.25);
  background-color: var(--cm-saffron-muted);
}

/* ---- Section card (shared) ---- */
section {
  background: var(--cm-surface);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 1px 4px rgba(30, 45, 74, .06), 0 4px 16px rgba(30, 45, 74, .04);
  border: 1px solid var(--cm-border);
}

section h2 {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cm-wave);
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: .10em;
}

/* ================================================================
   Row 1 — Filters side by side
   ================================================================ */
.filters-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

.filter-card {
  /* inherits section styles */
}

/* ================================================================
   Row 2 — Spreadsheet left, Booking curve right
   ================================================================ */
.main-row {
  display: grid;
  grid-template-columns: 520px 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

/* Left panel: spreadsheet */
.panel-left {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 520px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-title-row h2 {
  margin: 0;
}

/* 6.3 — Season badge: small grey subtitle below the Booking Curve chart title */
#season-badge {
  font-size: 11px;
  color: var(--cm-text-muted, #888);
  font-style: italic;
  margin-left: auto;
}

/* Inline filter (check-in date) inside the title row */
.inline-filter {
  margin-bottom: 0 !important;
}

.inline-filter label {
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cm-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Scrollable table area — vertical scroll only, no horizontal */
.table-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 420px;
  border: 1px solid var(--cm-border);
  border-radius: 8px;
}

#price-table {
  width: 100%;
  table-layout: fixed;   /* columns respect explicit widths */
  border-collapse: collapse;
  font-size: 13.5px;
}

/* Column widths — hotel name gets remaining space, numbers are tight */
#price-table colgroup col.col-focus      { width: 28px; }
#price-table colgroup col.col-hotel      { width: auto; }
#price-table colgroup col.col-type       { width: 46px; }
#price-table colgroup col.col-price      { width: 88px; }
#price-table colgroup col.col-room-match { width: 150px; }
#price-table colgroup col.col-vs         { width: 72px; }

/* Focus checkbox cell */
#price-table td.col-focus,
#price-table th.col-focus {
  width: 28px;
  padding: 0 4px;
  text-align: center;
  vertical-align: middle;
}

/* Custom checkbox indicator */
.focus-checkbox {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--cm-light-grey);
  background: transparent;
  transition: background 0.12s, border-color 0.12s;
  vertical-align: middle;
  position: relative;
  flex-shrink: 0;
}

.focus-checkbox--checked {
  background: var(--focus-color, #f59e0b);
  border-color: var(--focus-color, #f59e0b);
}

.focus-checkbox--checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 5px;
  height: 8px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

#price-table thead th {
  position: sticky;
  top: 0;
  background: var(--cm-light-sand);
  text-align: left;
  padding: 8px 8px;
  border-bottom: 2px solid var(--cm-border-strong);
  color: var(--cm-ultramarine);
  font-weight: 700;
  white-space: nowrap;
  font-size: 12px;
  z-index: 1;
  overflow: hidden;
}

/* Numeric columns right-aligned */
#price-table th.col-price,
#price-table th.col-vs,
#price-table td.col-price,
#price-table td.col-vs {
  text-align: right;
}

/* Price cell: stacked total + per-night */
#price-table td.col-price {
  white-space: nowrap;
  line-height: 1.2;
  vertical-align: middle;
}

.price-total {
  display: block;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--cm-text-body);
}

.price-ppn {
  display: block;
  font-size: 11px;
  color: var(--cm-text-muted);
  font-weight: 400;
}

#price-table tbody td {
  padding: 7px 8px;
  border-bottom: 1px solid hsl(32deg 20% 93%);
  color: var(--cm-text-body);
  white-space: nowrap;
  overflow: hidden;
}

/* Hotel name cell: clipped by default, smooth horizontal scroll on hover */
#price-table td.col-hotel {
  max-width: 0;          /* forces table-layout:fixed to respect width */
  overflow: hidden;
  white-space: nowrap;
  position: relative;    /* needed for the inner scroll container */
  padding-right: 4px;
}

/* Inner scroll container — text slides on hover */
#price-table td.col-hotel .hotel-name-inner {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: none;
}

/* On row hover, if text overflows, animate it to the left */
#price-table tbody tr:hover td.col-hotel .hotel-name-inner {
  text-overflow: clip;
  animation: hotel-scroll 4s linear 0.4s 1 forwards;
}

@keyframes hotel-scroll {
  0%   { transform: translateX(0); }
  10%  { transform: translateX(0); }        /* brief pause before scrolling */
  80%  { transform: translateX(var(--scroll-dist, 0px)); }
  100% { transform: translateX(var(--scroll-dist, 0px)); }
}

#price-table tbody tr:last-child td { border-bottom: none; }

#price-table tbody tr:hover td { background: hsl(32deg 40% 96%); }

/* Competitor rows are clickable — show pointer */
#price-table tbody tr[data-hotel-name] { cursor: pointer; }

/* Club Med row — lightSand with saffron left accent */
#price-table tbody tr.row-clubmed td {
  background: var(--cm-light-sand);
  font-weight: 600;
}
#price-table tbody tr.row-clubmed td:first-child {
  border-left: 3px solid var(--cm-saffron);
}
#price-table tbody tr.row-clubmed:hover td { background: hsl(35deg 50% 90%); }

/* Focused (pinned) competitor row — coloured left accent matching chart line colour */
#price-table tbody tr.row-focused td:first-child {
  border-left: 3px solid var(--focus-color, #f59e0b);
}
#price-table tbody tr.row-focused {
  font-weight: 700;
}

/* Sortable col */
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--cm-wave); }
.sort-icon { font-size: 10px; opacity: .55; margin-left: 2px; }

/* Hotel name hyperlink — subtle dotted underline always visible; colour on hover */
.hotel-name-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  transition: border-color .15s, color .15s;
  cursor: pointer;
}
.hotel-name-link:hover {
  color: var(--cm-wave);
  border-bottom-color: var(--cm-wave);
}

/* Source badge for direct competitors */
.source-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
  line-height: 1.4;
}

/* Indented "other offer" label in sub-rows */
.offer-indent {
  color: var(--cm-text-muted);
  font-style: italic;
}

/* Greyed-out label for unavailable offers in sub-rows */
.offer-unavailable-label {
  color: var(--cm-text-muted);
  font-style: italic;
  opacity: 0.6;
}

/* Hotel count badge next to the "Prices" heading */
.hotel-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  background: var(--cm-wave);
  color: #fff;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-left: 6px;
  text-transform: none;
}

/* Room type chip shown on hotel rows with multiple offers */
.room-types-chip {
  display: inline-block;
  padding: 1px 6px;
  background: hsl(227deg 38% 92%);
  color: var(--cm-ultramarine);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.room-types-chip:hover {
  background: hsl(227deg 38% 85%);
}

/* Partial-availability chip: amber tone to signal some offers are unavailable */
.room-types-chip.room-types-partial {
  background: hsl(38deg 80% 90%);
  color: hsl(30deg 70% 35%);
}
.room-types-chip.room-types-partial:hover {
  background: hsl(38deg 80% 82%);
}

/* Expanded room type sub-rows */
.row-room-type td {
  background: hsl(32deg 30% 97%);
  font-size: 12.5px;
  color: var(--cm-text-muted);
}
.row-room-type td.col-hotel {
  padding-left: 20px;
  font-style: italic;
}

/* Unavailable offer sub-rows: slightly dimmer */
.row-offer-unavailable td {
  opacity: 0.55;
}

/* ---- Room-match column ---- */
#price-table td.col-room-match {
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  color: var(--cm-text-muted);
}

.room-match-empty {
  color: var(--cm-light-grey);
}

.room-match-cm {
  font-size: 11px;
  color: var(--cm-text-muted);
  font-style: italic;
}

.room-match-result {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  overflow: hidden;
}

/* Confidence badge */
.room-match-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.room-match-badge--high {
  background: hsl(145deg 52% 88%);
  color: hsl(145deg 52% 24%);
}
.room-match-badge--medium {
  background: hsl(45deg 90% 88%);
  color: hsl(38deg 70% 30%);
}
.room-match-badge--low {
  background: hsl(0deg 0% 90%);
  color: hsl(0deg 0% 40%);
}
.room-match-badge--none {
  background: hsl(0deg 0% 93%);
  color: hsl(0deg 0% 60%);
}

/* ---- Room type filter: capacity-mismatch greyed options ---- */
/* Native <option> elements have limited styling, but disabled gives a system grey.
   We reinforce with a CSS class for any wrapper that supports it. */
.room-type-opt--needs-switch {
  color: var(--cm-grey);
  font-style: italic;
}

/* Scenario-switch hint chips — rendered below the room type dropdown label */
.room-type-switch-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.room-type-switch-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: hsl(45deg 90% 92%);
  color: hsl(38deg 70% 28%);
  border: 1px solid hsl(45deg 60% 75%);
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
  line-height: 1.3;
}

.room-type-switch-chip::before {
  content: '→';
  font-size: 10px;
  opacity: 0.7;
}

.room-type-switch-chip:hover {
  background: hsl(45deg 90% 83%);
  border-color: hsl(45deg 60% 60%);
}

.room-type-switch-chip:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Right panel: booking curve — sizes to content, no forced minimum */
.panel-right {
  display: flex;
  flex-direction: column;
}

/* Canvas container: explicit height — Chart.js fills this with responsive:true + maintainAspectRatio:false */
#booking-curve-canvas-container,
#room-curve-canvas-container {
  position: relative;
  width: 100%;
  height: 450px;
}

/* Legend: sits below the canvas, wraps naturally, no fixed height */
.booking-curve-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 8px 4px 4px;
  font-size: 12px;
  color: var(--cm-text-body);
}

.booking-curve-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: default;
}

.booking-curve-legend-swatch {
  display: inline-block;
  width: 20px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-wrapper {
  position: relative;
  height: 300px;
}

/* ================================================================
   Filter bar (shared)
   ================================================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 0;
}

.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--cm-text-label);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.filter-bar select {
  padding: 6px 10px;
  border: 1px solid var(--cm-border-strong);
  border-radius: 6px;
  background: var(--cm-surface);
  font-size: 13px;
  color: var(--cm-text-body);
  cursor: pointer;
  min-width: 110px;
  transition: border-color .15s;
  font-family: inherit;
}

.filter-bar select:hover  { border-color: var(--cm-verdigris); }
.filter-bar select:focus  {
  outline: 2px solid var(--cm-saffron);
  outline-offset: 1px;
  border-color: var(--cm-saffron);
}

/* Amenities group — keeps the label + all checkboxes together as one flex item
   so they never split across rows when the filter bar wraps.
   flex: 1 lets it claim remaining horizontal space on the same row as the
   <select> filters rather than falling to a new line. */
.amenities-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.tag-filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--cm-text-label);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-right: -4px;
}

.amenities-group label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--cm-text-body);
  cursor: pointer;
}

.amenities-group input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--cm-wave);
  cursor: pointer;
  margin: 0;
}

/* ================================================================
   Table chips & deltas
   ================================================================ */
.chip-ai {
  display: inline-block;
  padding: 2px 7px;
  background: hsl(163deg 30% 88%);
  color: hsl(163deg 50% 25%);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}

.delta-negative { color: hsl(163deg 50% 28%); font-weight: 600; }
.delta-positive { color: var(--cm-red); font-weight: 600; }

.empty-msg { color: var(--cm-grey); font-style: italic; text-align: center; padding: 24px 0; }

/* ================================================================
   Notices / warnings
   ================================================================ */
.notice {
  padding: 7px 11px;
  background: hsl(45deg 100% 94%);
  border-left: 3px solid var(--cm-saffron);
  border-radius: 4px;
  margin-bottom: 10px;
  color: var(--cm-ultramarine);
  font-size: 12px;
}

.warning-banner {
  padding: 7px 11px;
  background: hsl(35deg 100% 94%);
  border-left: 3px solid var(--cm-marygold);
  border-radius: 4px;
  margin-bottom: 10px;
  color: hsl(35deg 80% 28%);
  font-size: 12px;
}

/* ================================================================
   Responsive: stack below 900px
   ================================================================ */
@media (max-width: 900px) {
  .filters-row,
  .main-row {
    grid-template-columns: 1fr;
  }
  .main-row { grid-template-columns: 1fr; }
  .panel-left,
  .panel-right { min-height: 0; }
  .table-scroll { max-height: 340px; }
}

/* ================================================================
   Manual chart legend (Price Trend Evolution, CM Premium)
   ================================================================ */
.chart-manual-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: hsl(32deg 30% 97%);
  border-radius: 8px;
  border: 1px solid var(--cm-border);
  font-size: 12px;
  color: var(--cm-text-body);
  align-items: center;
  min-height: 32px;
}

.chart-manual-legend:empty { display: none; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: default;
}

.legend-swatch {
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-swatch.dashed {
  background: repeating-linear-gradient(
    90deg,
    var(--swatch-color, #888) 0px,
    var(--swatch-color, #888) 5px,
    transparent 5px,
    transparent 9px
  );
}

.legend-swatch.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #fff;
}

.legend-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--cm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 2px;
}

/* Zoom hint text shown under Price Trend Evolution */
.zoom-hint {
  font-size: 11px;
  color: var(--cm-text-muted);
  font-style: italic;
  margin-top: 4px;
  text-align: right;
}

/* ================================================================
   Price Trend Evolution — zoom reset button
   ================================================================ */
.zoom-reset-btn {
  font-size: 11px;
  padding: 3px 10px;
  background: var(--cm-ultramarine);
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}
.zoom-reset-btn:hover { background: var(--cm-ultramarine-hover); }
.full-width-section {
  margin-bottom: 16px;
}

#price-trend .chart-wrapper {
  width: 100%;
  height: 340px;
}

#price-trend .panel-title-row {
  flex-wrap: wrap;
  gap: 12px;
}

.trend-legend-note {
  font-size: 12px;
  color: var(--cm-text-muted);
  font-style: italic;
}

.btn-sm {
  font-size: 12px;
  padding: 5px 12px;
}

.btn-secondary {
  background: var(--cm-mid-grey);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}

.btn-secondary:hover {
  background: var(--cm-dark-grey);
}

/* ================================================================
   Supplementary price trend chart sections
   ================================================================ */
#price-trend-cm-premium .chart-wrapper {
  width: 100%;
  height: 260px;
}

#price-trend-run-delta .chart-wrapper {
  width: 100%;
  height: 220px;
}

#price-trend-band-snapshot .chart-wrapper {
  width: 100%;
  height: 260px;
}

#price-trend-indexed-evolution .chart-wrapper {
  width: 100%;
  height: 260px;
}

/* ================================================================
   KPI Strip
   ================================================================ */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  /* Override section defaults — the strip is transparent, no card shadow */
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
}

.kpi-tile {
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 4px rgba(30, 45, 74, .06), 0 4px 16px rgba(30, 45, 74, .04);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cm-wave);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cm-ultramarine);
  line-height: 1.1;
}

.kpi-value.positive { color: var(--cm-red); }
.kpi-value.negative { color: var(--cm-wave); }

.kpi-sub {
  font-size: 0.78rem;
  color: var(--cm-text-muted);
}

/* ================================================================
   Chart E — CM Premium Heatmap
   ================================================================ */
#price-trend-heatmap .chart-wrapper {
  width: 100%;
  height: 260px;  /* overridden dynamically in JS */
  position: relative;
}

#heatmap-tooltip {
  position: absolute;
  background: var(--cm-ultramarine);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
  display: none;
}

@media (max-width: 900px) {
  .kpi-strip {
    grid-template-columns: 1fr;
  }
}

/* ================================================================
   Chat floating widget
   ================================================================ */

/* Outer container — fixed bottom-right, z-index above all content */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  /* Collapsed: only the toggle button is visible */
}

/* Toggle button */
.chat-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--cm-ultramarine);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(30, 45, 74, 0.28);
  transition: background 0.15s, box-shadow 0.15s;
}
.chat-toggle-btn::before {
  content: '◎';
  font-size: 13px;
  color: var(--cm-saffron);
}
.chat-toggle-btn:hover {
  background: var(--cm-ultramarine-hover);
  box-shadow: 0 6px 20px rgba(30, 45, 74, 0.36);
}

/* Inner panel — hidden when widget is collapsed */
.chat-panel {
  width: 360px;
  max-height: 500px;
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(30, 45, 74, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* collapsed state: hidden */
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s, transform 0.18s;
}

.chat-widget--expanded .chat-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Panel header */
.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  background: var(--cm-ultramarine);
  border-radius: 13px 13px 0 0;
}
.chat-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
}
.chat-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  font-family: inherit;
  transition: color 0.1s;
}
.chat-close-btn:hover {
  color: #fff;
}

/* Scenario context label */
.chat-context-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--cm-text-muted);
  padding: 6px 14px 4px;
  background: var(--cm-light-sand);
  border-bottom: 1px solid var(--cm-border);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Starter chips row */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 4px;
  background: var(--cm-light-sand);
  border-bottom: 1px solid var(--cm-border);
}
.chat-chip {
  padding: 4px 10px;
  background: var(--cm-surface);
  border: 1px solid var(--cm-border-strong);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cm-ultramarine);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.chat-chip:hover {
  background: var(--cm-saffron-muted);
  border-color: var(--cm-saffron);
}
.chat-chips--hidden {
  display: none;
}

/* Message list */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
  max-height: 260px;
}

/* Message bubbles */
.chat-bubble {
  max-width: 86%;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.chat-bubble--user {
  align-self: flex-end;
  background: var(--cm-ultramarine);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.chat-bubble--ai {
  align-self: flex-start;
  background: hsl(32deg 35% 94%);
  color: var(--cm-text-body);
  border-bottom-left-radius: 3px;
}
.chat-bubble--error {
  align-self: flex-start;
  background: hsl(9deg 60% 94%);
  color: hsl(9deg 60% 30%);
  border: 1px solid hsl(9deg 40% 82%);
  border-bottom-left-radius: 3px;
  font-size: 12px;
}

/* ---- Scoped markdown typography inside AI bubbles ---- */
.chat-bubble--ai p {
  margin: 0 0 0.5em;
}
.chat-bubble--ai p:last-child {
  margin-bottom: 0;
}
.chat-bubble--ai ul,
.chat-bubble--ai ol {
  margin: 0.25em 0 0.5em;
  padding-left: 1.4em;
}
.chat-bubble--ai li {
  margin-bottom: 0.2em;
}
.chat-bubble--ai ul {
  list-style: disc;
}
.chat-bubble--ai ol {
  list-style: decimal;
}
.chat-bubble--ai h2,
.chat-bubble--ai h3 {
  color: var(--cm-wave);
  font-size: 0.95em;
  font-weight: 700;
  margin: 0.6em 0 0.3em;
}
.chat-bubble--ai strong {
  color: var(--cm-ultramarine);
  font-weight: 700;
}
.chat-bubble--ai code {
  background: var(--cm-ultramarine);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.88em;
  font-family: 'JetBrains Mono', 'Fira Mono', 'Courier New', monospace;
}
.chat-bubble--ai pre {
  background: var(--cm-ultramarine);
  border-radius: 5px;
  padding: 8px 10px;
  overflow-x: auto;
  margin: 0.4em 0;
}
.chat-bubble--ai pre code {
  padding: 0;
  background: transparent;
  font-size: 0.85em;
}
.chat-bubble--ai table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85em;
  margin: 0.5em 0;
  overflow-x: auto;
  display: block;
}
.chat-bubble--ai th,
.chat-bubble--ai td {
  border: 1px solid var(--cm-border-strong);
  padding: 4px 8px;
  text-align: left;
}
.chat-bubble--ai th {
  background: var(--cm-ultramarine);
  color: #fff;
  font-weight: 600;
}
.chat-bubble--ai tr:nth-child(even) td {
  background: var(--cm-light-sand);
}

/* Loading indicator (animated dots) */
.chat-loading {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 10px 14px;
}
.chat-loading span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cm-verdigris);
  animation: chat-dot-bounce 1.2s infinite ease-in-out;
}
.chat-loading span:nth-child(2) { animation-delay: 0.2s; }
.chat-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chat-dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40%            { transform: scale(1);   opacity: 1;   }
}

/* Input row */
.chat-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--cm-border);
  background: var(--cm-surface);
}
.chat-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--cm-border-strong);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--cm-text-body);
  background: var(--cm-surface);
  transition: border-color 0.15s;
  outline: none;
}
.chat-input:focus {
  border-color: var(--cm-wave);
  box-shadow: 0 0 0 2px rgba(0, 127, 127, 0.15);
}
.chat-input:disabled {
  background: hsl(32deg 20% 95%);
  color: var(--cm-grey);
}
.chat-send-btn {
  padding: 7px 14px;
  background: var(--cm-wave);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
  white-space: nowrap;
}
.chat-send-btn:hover:not(:disabled) {
  background: hsl(180deg 100% 20%);
}
.chat-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* =========================================================================
   Data-source toggle (Booking.com ↔ Direct)
   ========================================================================= */

.source-toggle-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.source-toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--cm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.source-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--cm-border-strong);
  border-radius: 6px;
  overflow: hidden;
  height: 30px;
}

.source-toggle-btn {
  flex: 1;
  border: none;
  border-radius: 0;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  background: var(--cm-light-sand);
  color: var(--cm-text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  line-height: 1;
}

.source-toggle-btn:first-child {
  border-right: 1px solid var(--cm-border-strong);
}

.source-toggle-btn:hover:not(.active) {
  background: hsl(32deg 30% 88%);
  color: var(--cm-text-body);
}

.source-toggle-btn.active[data-source="booking"] {
  background: var(--cm-ultramarine);
  color: #fff;
}

.source-toggle-btn.active[data-source="direct"] {
  background: var(--cm-wave);
  color: #fff;
}

/* In Direct mode: hide charts that depend on Booking.com enrichment tags */
body.source-direct #graph {
  display: none;
}

/* In Booking mode: hide the supplement-related "show raw prices" toggle
   (it only makes sense for direct competitors) */
body.source-booking #raw-prices-toggle-label {
  display: none !important;
}

/* Notice variant for informational messages */
.notice--info {
  background: #e3f2fd;
  color: #1565c0;
  border-left: 3px solid #90caf9;
}

/* =========================================================================
   Supplement/breakdown expand panel
   ========================================================================= */

/* AI-status chip — sits in its own row below the competitor hotel name cell */
.sup-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  margin-top: 3px;
  transition: background 0.12s;
}
.sup-chip .sup-chip-arrow {
  font-size: 8px;
  transition: transform 0.15s;
  display: inline-block;
}
.sup-chip.open .sup-chip-arrow {
  transform: rotate(180deg);
}

/* Row that holds the chip — spans full hotel cell */
.row-sup-chip td {
  padding: 0 8px 5px 8px;
  background: var(--cm-surface);
  border-bottom: none;
}
.row-sup-chip td:not(.col-hotel) {
  background: var(--cm-surface);
}

/* Panel row — hidden by default, revealed when chip is clicked */
.row-sup-panel {
  display: none;
}
.row-sup-panel.open {
  display: table-row;
}
.row-sup-panel td {
  padding: 0;
  background: hsl(32deg 30% 97%);
  border-top: 1px solid var(--cm-border);
  border-bottom: 2px solid var(--cm-border);
}

/* Inner panel container */
.sup-panel {
  padding: 10px 14px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Inclusions line */
.sup-inclusions {
  font-size: 12px;
  color: var(--cm-text-muted);
}
.sup-inclusions strong {
  color: var(--cm-text-body);
}

/* Supplement table */
.sup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.sup-table th {
  text-align: left;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--cm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--cm-border);
}
.sup-table td {
  padding: 4px 8px;
  border-bottom: 1px solid hsl(32deg 20% 92%);
  vertical-align: middle;
}
.sup-table tr:last-child td {
  border-bottom: none;
}

/* Source badges in supplement table */
.sup-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.sup-badge--included {
  background: hsl(145deg 60% 88%);
  color: hsl(145deg 60% 22%);
}
.sup-badge--actual {
  background: #d4edda;
  color: #155724;
}
.sup-badge--estimated {
  background: #fff3cd;
  color: #856404;
}
.sup-badge--default {
  background: #fff3cd;
  color: #856404;
}
.sup-badge--missing {
  background: #f8d7da;
  color: #721c24;
}
.sup-badge--na {
  background: #e9ecef;
  color: #6c757d;
}
.sup-badge--overridden {
  background: #e3f2fd;
  color: #1565c0;
}

/* ---------------------------------------------------------------------------
   Booking.com AI-breakdown panel
   Read-only variant of the supplement panel for booking-source rows.
   --------------------------------------------------------------------------- */

/* Chip variant for booking breakdown */
.sup-chip--booking-breakdown {
  background: hsl(210deg 60% 92%);
  color: hsl(210deg 60% 26%);
  border: 1px solid hsl(210deg 40% 76%);
}
.sup-chip--booking-breakdown:hover {
  background: hsl(210deg 60% 84%);
}

/* Panel background slightly different from direct competitor panel */
.row-booking-breakdown-panel td {
  background: hsl(210deg 25% 97%);
  border-top: 1px solid hsl(210deg 30% 88%);
  border-bottom: 2px solid hsl(210deg 30% 88%);
}

/* Inner panel: no save row needed */
.booking-breakdown-panel {
  padding: 10px 14px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Summary line: raw + added = AI-equivalent */
.booking-breakdown-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  flex-wrap: wrap;
  padding: 6px 8px;
  background: hsl(210deg 30% 94%);
  border-radius: 5px;
  border: 1px solid hsl(210deg 30% 84%);
}
.bbd-raw {
  font-weight: 600;
  color: var(--cm-text-body);
}
.bbd-added {
  font-weight: 600;
  color: hsl(30deg 70% 36%);
}
.bbd-ai {
  font-weight: 700;
  color: hsl(210deg 60% 30%);
}
.bbd-plus, .bbd-eq {
  color: var(--cm-text-muted);
  font-weight: 600;
}
.bbd-label {
  font-weight: 400;
  font-size: 10px;
  color: var(--cm-text-muted);
  margin-left: 2px;
}
.bbd-ppn {
  font-size: 10px;
  color: var(--cm-text-muted);
  margin-left: 4px;
}

/* ==========================================================================
   Tab bar (Market Overview / Room Prices)
   ========================================================================== */
/* ==========================================================================
   Global Scenario Strip — sits between header and tab bar, shared by all tabs
   ========================================================================== */
.scenario-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--cm-surface, #fff);
  border: 1px solid var(--cm-border, #e2e8f0);
  border-radius: 6px;
  margin-top: 12px;
}

.scenario-strip-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--cm-text-label, #64748b);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  padding-right: 8px;
  border-right: 1px solid var(--cm-border, #e2e8f0);
}

.scenario-strip-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.scenario-strip-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--cm-text-label, #64748b);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.scenario-strip-controls select {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--cm-border, #e2e8f0);
  border-radius: 4px;
  background: var(--cm-bg, #f8fafc);
  color: var(--cm-text, #1e293b);
  cursor: pointer;
  min-width: 64px;
}

.scenario-strip-controls select:hover {
  border-color: var(--cm-verdigris, #0d9488);
}

.scenario-strip-controls select:focus {
  outline: 2px solid var(--cm-verdigris, #0d9488);
  outline-offset: 1px;
}

.tab-bar {
  display: flex;
  gap: 4px;
  margin: 12px 0 0;
  border-bottom: 2px solid #e2e8f0;
}
.tab-btn {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: #1e2d4a; }
.tab-btn--active {
  color: #1e2d4a;
  border-bottom-color: #1e2d4a;
}

/* ==========================================================================
   Room comparison tab — notice, subtitle, content
   ========================================================================== */
.room-comparison-notice {
  padding: 48px 24px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}
.room-comparison-notice--scenario {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 20px 24px;
  font-size: 14px;
  text-align: center;
  margin: 16px 0;
}
.room-curve-subtitle {
  font-size: 13px;
  font-weight: 400;
  color: #64748b;
  margin-left: 8px;
}

/* ==========================================================================
   Meal plan pills
   ========================================================================== */
.meal-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.meal-pill--all_inclusive { background: #dcfce7; color: #166534; }
.meal-pill--full_board    { background: #dbeafe; color: #1e40af; }
.meal-pill--half_board    { background: #fef9c3; color: #854d0e; }
.meal-pill--breakfast     { background: #ffedd5; color: #9a3412; }
.meal-pill--room_only,
.meal-pill--unknown       { background: #f1f5f9; color: #64748b; }

/* ==========================================================================
   Match confidence indicators
   ========================================================================== */
.conf-pill { font-size: 11px; font-weight: 600; }
.conf-pill--high   { color: #166534; }
.conf-pill--medium { color: #854d0e; }
.conf-pill--low    { color: #9a3412; }
.conf-pill--none   { color: #94a3b8; }

/* ==========================================================================
   Room comparison table — CM pinned row highlight
   ========================================================================== */
#room-comparison-table tr.cm-row td {
  background: #fff8f0;
  font-weight: 600;
}
#room-comparison-table tr.cm-row td:first-child {
  border-left: 3px solid #c1391b;
}
#room-comparison-table tr.row-cm-soldout td {
  opacity: 0.5;
}

/* Sold-out pill badge — used in CM card price area and spreadsheet CM row */
.sold-out-badge {
  display: inline-block;
  background: #fee2e2;
  color: #c1391b;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 5px;
}

/* vs CM % colouring */
.vs-below { color: #166534; font-weight: 600; }
.vs-above { color: #9a3412; font-weight: 600; }
.vs-parity { color: #64748b; }

/* ==========================================================================
   Room info cards row — CM anchor + competitor strip
   ========================================================================== */

/* Outer wrapper: full-width row, horizontal scroll on overflow */
/* ==========================================================================
   Room Info Cards — carousel with fixed CM anchor + scrollable competitor strip
   ========================================================================== */

.room-info-cards {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  margin: 0 0 20px 0;
  /* No overflow here — the competitor strip handles its own scroll */
  min-height: 0;
}

/* ── CM anchor card ──────────────────────────────────────────────────────── */
/* Shares the same "selected pill" language — navy fill, white text, red accent */
#room-card-cm {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--cm-ultramarine, #1e2d4a);
  border: none;
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 200px;
  max-width: 240px;
  flex-shrink: 0;
  margin-right: 16px;   /* visual separation from competitor strip */
  position: relative;
  /* The CM card naturally stays fixed because .room-comp-cards handles its own overflow */
  align-self: flex-start;
}

.room-card-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--cm-red, #c1391b);
  margin-bottom: 6px;
}

.room-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 8px;
}

.room-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.room-card-meta-chip {
  background: rgba(255,255,255,0.12);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.80);
  white-space: nowrap;
}

.room-card-meta-chip--ec {
  background: rgba(255,204,0,0.20);
  color: #ffcc00;
}

/* Price area at bottom of CM card */
.room-card-price {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.room-card-price-unit {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,0.55);
  margin-left: 2px;
}

.room-card-price-total-secondary {
  font-size: 11px;
  color: rgba(255,255,255,0.50);
  font-weight: 400;
  margin-top: 3px;
}

.room-card-stock {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  margin-top: 3px;
}

/* ── Competitor card strip ───────────────────────────────────────────────── */
/* Scrolls independently — CM card stays fixed on the left */
.room-comp-cards {
  display: flex;
  flex-direction: row;
  gap: 10px;
  flex: 1;
  min-width: 0;
  align-items: stretch;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;  /* room for scrollbar */
}

/* ── Hotel group: label + one or more room cards ─────────────────────────── */
.room-card-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0;
  background: #f8f9fb;
  border: 1.5px solid #dde3ec;
  border-radius: 12px;
  padding: 10px 10px 10px 10px;
  min-width: 170px;
}

/* Hotel name header row */
.room-card-group-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid #dde3ec;
  flex-wrap: wrap;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: background 0.12s;
  margin: -4px -4px 8px -4px;
  padding: 4px 4px 7px 4px;
}

.room-card-group-header:hover {
  background: rgba(30, 45, 74, 0.05);
}

/* Selected state: highlight the entire group */
.room-card-group--selected {
  border-color: var(--cm-ultramarine, #1e2d4a);
  box-shadow: 0 0 0 2px rgba(30, 45, 74, 0.18);
  background: #f0f3f8;
}

.room-card-group--selected .room-card-group-header {
  border-bottom-color: rgba(30, 45, 74, 0.2);
}

.room-card-group--selected .room-card-group-name {
  color: var(--cm-ultramarine, #1e2d4a);
}

.room-card-group-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--cm-ultramarine, #1e2d4a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.room-card-group-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.room-card-group-chip {
  font-size: 9px;
  font-weight: 600;
  background: #e8edf5;
  color: #475569;
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

/* Cards row inside a group: side by side if multiple rooms */
.room-card-group-cards {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: stretch;
}

/* Cards inside a group lose their outer border/radius — the group provides it */
.room-card-group .room-comp-card {
  border: 1.5px solid #e2e9f3;
  border-radius: 8px;
  background: #fff;
  min-width: 150px;
  max-width: 185px;
}

.room-card-group .room-comp-card:hover {
  border-color: #b0bec5;
  box-shadow: 0 2px 8px rgba(30,45,74,0.08);
}

/* Confidence left accent stays on the card itself */
.room-card-group .room-comp-card--conf-high   { border-left: 3px solid #166534; }
.room-card-group .room-comp-card--conf-medium { border-left: 3px solid #854d0e; }
.room-card-group .room-comp-card--conf-low    { border-left: 3px solid #9a3412; }

/* Each competitor card */
.room-comp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--cm-surface, #fff);
  border: 1.5px solid var(--cm-border, #e8dfd0);
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 180px;
  max-width: 210px;
  flex-shrink: 0;
  cursor: default;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.room-comp-card:hover {
  border-color: var(--cm-border-strong, #ccc2b0);
  box-shadow: 0 3px 10px rgba(30,45,74,0.07);
}

/* Confidence-coded left accent border */
.room-comp-card--conf-high   { border-left: 3px solid #166534; }
.room-comp-card--conf-medium { border-left: 3px solid #854d0e; }
.room-comp-card--conf-low    { border-left: 3px solid #9a3412; }

/* vs-CM delta badge — absolute top-right */
.room-comp-card-vs {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  line-height: 1.4;
  white-space: nowrap;
}
.room-comp-card-vs.vs-below  { background: #dcfce7; color: #166534; }
.room-comp-card-vs.vs-above  { background: #fee2e2; color: #9a3412; }
.room-comp-card-vs.vs-parity { background: #f1f5f9; color: #64748b; }

/* Room name — the primary label inside each card (hotel name moved to group header) */
.room-comp-card-room {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
  margin-right: 44px;   /* keep clear of vs-CM badge */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

/* Meta chips row (stars, all-incl, adults-only) */
.room-comp-card-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* Price area — de-emphasized, pushed to bottom of card */
.room-comp-card-price {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--cm-border, #e8dfd0);
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  line-height: 1;
  display: block;
}

.room-comp-card-price--unavailable {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--cm-border, #e8dfd0);
  font-size: 12px;
  color: #94a3b8;
  font-weight: 400;
}

.room-comp-card-price-total {
  font-size: 10px;
  color: #b0bec5;
  font-weight: 400;
  margin-top: 2px;
  display: block;
}

/* Override /night unit color inside competitor cards (dark-on-white context) */
.room-comp-card .room-card-price-unit {
  color: #94a3b8;
}

/* Override meta chip colors inside competitor cards (dark-on-white context) */
.room-comp-card .room-card-meta-chip {
  background: #f1f5f9;
  color: #475569;
}


/* Room comparison table — aligned with market overview #price-table style */
#room-comparison-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13.5px;
}

#room-comparison-table col.col-focus     { width: 28px; }
#room-comparison-table col.col-room-name { width: auto; }
#room-comparison-table col.col-price     { width: 110px; }
#room-comparison-table col.col-vs        { width: 72px; }

/* Room sqm annotation */
.room-sqm {
  color: #94a3b8;
  font-size: 11px;
  margin-left: 4px;
}

#room-comparison-table thead th {
  position: sticky;
  top: 0;
  background: var(--cm-light-sand);
  text-align: left;
  padding: 8px 8px;
  border-bottom: 2px solid var(--cm-border-strong);
  color: var(--cm-ultramarine);
  font-weight: 700;
  white-space: nowrap;
  font-size: 12px;
  z-index: 1;
  overflow: hidden;
}

#room-comparison-table th.col-focus { padding: 8px 4px; }
#room-comparison-table td.col-focus { padding: 8px 4px; text-align: center; vertical-align: middle; }

#room-comparison-table th.col-price,
#room-comparison-table th.col-vs,
#room-comparison-table td.col-price,
#room-comparison-table td.col-vs {
  text-align: right;
}

#room-comparison-table tbody td {
  padding: 7px 8px;
  border-bottom: 1px solid hsl(32deg 20% 93%);
  color: var(--cm-text-body);
  white-space: nowrap;
  overflow: hidden;
  font-size: 13px;
}


#room-comparison-table tbody tr:last-child td { border-bottom: none; }

#room-comparison-table tbody tr:hover td { background: hsl(32deg 40% 96%); }

/* Club Med rows */
#room-comparison-table tr.cm-row td {
  background: var(--cm-light-sand);
  font-weight: 600;
}
/* CM header row: red left accent on the hotel name cell */
#room-comparison-table tr.cm-row.row-hotel-header td.col-hotel-header {
  border-left: 3px solid #c1391b;
}
#room-comparison-table tr.cm-row:hover td { background: hsl(35deg 50% 90%); }

/* ==========================================================================
   Room comparison table — focus / click-to-pin (mirrors market table)
   ========================================================================== */

/* Competitor rows are clickable */
#room-comparison-tbody tr[data-comp-key] {
  cursor: pointer;
}
#room-comparison-tbody tr[data-comp-key]:hover td {
  background: hsl(32deg 40% 96%);
}

/* Hotel header row — hotel name only, no price/vs data */
#room-comparison-tbody tr.row-hotel-header td,
#room-comparison-tbody tr.row-hotel-header th {
  padding: 8px 8px 4px;
  border-bottom: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--cm-ultramarine);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#room-comparison-tbody tr.row-hotel-header td.col-hotel-header {
  color: var(--cm-ultramarine);
}
#room-comparison-tbody tr.row-hotel-header .hotel-name-link {
  color: inherit;
  text-decoration: none;
}
#room-comparison-tbody tr.row-hotel-header .hotel-name-link:hover {
  text-decoration: underline;
}
/* Separator above each hotel header (except the first) */
#room-comparison-tbody tr.row-hotel-header:not(:first-child) td {
  border-top: 1px solid hsl(32deg 20% 88%);
  padding-top: 12px;
}

/* Sub-room rows: all rooms sit under the hotel header */
#room-comparison-tbody tr.row-sub-room td {
  padding-top: 4px;
  padding-bottom: 4px;
  border-top: none;
  border-bottom: none;
  font-size: 12.5px;
  background: #f8f9fb;
}

/* Left connector bar on the room-name column */
#room-comparison-tbody tr.row-sub-room td.col-room-name {
  border-left: 2px solid #dde3ec;
  padding-left: 10px;
  white-space: normal;          /* allow room name to wrap */
  overflow: visible;
  word-break: break-word;
}
/* CM sub-row: red left accent overrides generic connector */
#room-comparison-tbody tr.cm-row.row-sub-room td.col-room-name {
  border-left: 3px solid #c1391b;
}

/* Last sub-row of a group: close the connector with a bottom border */
#room-comparison-tbody tr.row-sub-room:not(:has(+ tr.row-sub-room)) td {
  border-bottom: 1px solid hsl(32deg 20% 93%);
}
#room-comparison-tbody tr.row-sub-room:not(:has(+ tr.row-sub-room)) td.col-room-name {
  border-bottom-left-radius: 3px;
}


/* Hover: keep background highlight on sub-rows */
#room-comparison-tbody tr.row-sub-room:hover td {
  background: hsl(32deg 40% 96%);
}
#room-comparison-tbody tr.row-sub-room:hover td.col-room-name {
  border-left-color: #b0bec5;
}
/* Pinned row: left border uses --focus-color custom property set inline by JS */
#room-comparison-tbody tr.row-focused td {
  background: #f0f4ff;
  font-weight: 700;
}
#room-comparison-tbody tr.row-focused td.col-room-name {
  border-left: 3px solid var(--focus-color, #f59e0b);
}
#room-comparison-tbody tr.row-focused:hover td {
  background: hsl(32deg 40% 96%);
}
/* Focused sub-row: focus border replaces the connector bar */
#room-comparison-tbody tr.row-sub-room.row-focused td.col-room-name {
  border-left: 3px solid var(--focus-color, #f59e0b);
  background: #f0f4ff;
}

/* Hint text below table */
#room-focus-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 6px;
  padding-left: 2px;
}

/* ==========================================================================
   Room type pill selector (Room Prices tab)
   ========================================================================== */
.room-tab-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.room-type-pills {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-pills-placeholder {
  font-size: 13px;
  color: #94a3b8;
  font-style: italic;
}

.room-pill-tier {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* Tier label — vertical divider feel */
.room-pill-tier-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #b0bec5;
  min-width: 56px;
  padding-top: 8px;
  flex-shrink: 0;
  border-top: 2px solid #e8dfd0;
  padding-top: 4px;
}

.room-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 2px;
}

.room-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.1s;
  text-align: left;
  position: relative;
}

.room-pill:hover {
  border-color: #7c95b4;
  background: #f5f8fb;
  box-shadow: 0 2px 6px rgba(30,45,74,0.08);
  transform: translateY(-1px);
}

.room-pill:active {
  transform: translateY(0);
}

/* Selected pill: CM navy with red left accent */
.room-pill.selected {
  background: #1e2d4a;
  border-color: #1e2d4a;
  border-left: 3px solid #c1391b;
  color: #fff;
  box-shadow: 0 3px 10px rgba(30,45,74,0.22);
}

.room-pill.selected:hover {
  background: #253659;
  transform: translateY(-1px);
}

.room-pill-name {
  font-size: 12px;
  font-weight: 600;
  color: inherit;
  line-height: 1.35;
}

/* Meta chips: m², capacity, EC */
.room-pill-meta {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 2px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.room-pill.selected .room-pill-meta {
  color: rgba(147, 168, 204, 0.85);
}

/* Tiny dot separator between meta values */
.room-pill-meta span + span::before {
  content: '·';
  margin-right: 5px;
  opacity: 0.5;
}

/* ── Scenario coverage section inside a room pill ─────────────────── */
.room-pill-scenarios {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
  border-top: 1px solid rgba(0,0,0,0.07);
  padding-top: 5px;
  width: 100%;
}

.room-pill.selected .room-pill-scenarios {
  border-top-color: rgba(255,255,255,0.12);
}

.room-pill-scenario-group {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.room-pill-scenario-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.5;
}

/* CM badge — muted navy tint */
.room-pill-scenario-badge--cm {
  background: rgba(30, 45, 74, 0.08);
  color: #1e2d4a;
}

.room-pill.selected .room-pill-scenario-badge--cm {
  background: rgba(255,255,255,0.14);
  color: rgba(220,230,245,0.95);
}

.room-tab-extra-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Label + control pair inside the extra-filters row */
.room-tab-extra-filters label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  white-space: nowrap;
}

/* Shared select styling for both Nights and Run */
.room-tab-extra-filters select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--cm-surface, #fff)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  border: 1.5px solid var(--cm-border, #e8dfd0);
  border-radius: 8px;
  padding: 6px 30px 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cm-ultramarine, #1e2d4a);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 80px;
}

.room-tab-extra-filters select:hover {
  border-color: var(--cm-border-strong, #ccc2b0);
}

.room-tab-extra-filters select:focus {
  outline: none;
  border-color: var(--cm-ultramarine, #1e2d4a);
  box-shadow: 0 0 0 3px rgba(30,45,74,0.08);
}

/* ==========================================================================
   Booking curve mode toggle button (Room Prices tab)
   ========================================================================== */
.room-curve-mode-toggle {
  display: inline-flex;
  align-items: center;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
  margin-left: auto;
}

.room-curve-mode-toggle:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
  color: #1e2d4a;
}

.curve-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
  font-family: inherit;
}

.curve-download-btn:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
  color: #1e2d4a;
}

.curve-download-btn::before {
  content: '\2193';
  font-size: 13px;
}
