/* ds/lineup-map.css — Line-ups BR port-selection map + port chips (Designer direction v1, 30/11/2026). Loads after ds/components.css.
   Colours come ONLY from ds/tokens.css variables (no new colour, no gradient, glow, pulse or marker shadow). The map reads the --lum-* aliases below;
   .dark (no toggle in the dashboard today) remaps them to the §9 dark values, which are tokens too (--sidebar-accent #0F3F44, --brand-teal #0A3236,
   --brand-cream, --brand-gold, --sidebar-ring #D4B57A, --sidebar-muted-foreground #9FB3B4, .dark --border = cream 14%). */

.lum {
  --lum-water: var(--card);            /* #FBF8F4 */
  --lum-land: var(--muted);            /* #F3EBE0 */
  --lum-border: var(--border);         /* #DCCDB9: coast / country 1 px, states 0.5 px at 60% */
  --lum-country: var(--muted-foreground);
  --lum-dot-fill: var(--card);
  --lum-dot-stroke: var(--chart-1);    /* #0A3236 */
  --lum-dot-text: var(--chart-1);
  --lum-sel-fill: var(--chart-1);
  --lum-sel-text: var(--primary-foreground);
  --lum-sel-ring: var(--gold);
  --lum-cluster: var(--gold);
  --lum-nodata: var(--input);
  --lum-label: var(--chart-1);
  --lum-halo: var(--card);
  --lum-dim: 0.45;
  position: relative; overflow: hidden; background: var(--lum-water); border: 1px solid var(--border); border-radius: var(--radius);
  user-select: none; -webkit-user-select: none; touch-action: pan-x pan-y;   /* card: a finger scrolls the page, never trapped */
}
.dark .lum, .lum.dark {
  --lum-water: var(--brand-teal);
  --lum-land: var(--sidebar-accent);
  --lum-border: var(--border);
  --lum-country: var(--sidebar-muted-foreground);
  --lum-dot-fill: var(--brand-teal);
  --lum-dot-stroke: var(--brand-cream);
  --lum-dot-text: var(--brand-cream);
  --lum-sel-fill: var(--brand-gold);
  --lum-sel-text: var(--brand-teal);
  --lum-sel-ring: var(--sidebar-ring);
  --lum-cluster: var(--sidebar-ring);
  --lum-nodata: var(--sidebar-muted-foreground);
  --lum-label: var(--brand-cream);
  --lum-halo: var(--brand-teal);
  --lum-dim: 0.4;
}
.lum--touch, .lum--touch .lum-svg { touch-action: none; }   /* phone sheet only: one finger pans, two fingers pinch */
.lum[hidden] { display: none; }
.lum-svg { display: block; width: 100%; height: 100%; cursor: grab; }
.lum.is-panning .lum-svg { cursor: grabbing; }
.lum-water { fill: var(--lum-water); }
.lum-geo path { vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.lum-land path { fill: var(--lum-land); stroke: var(--lum-border); stroke-width: 1px; }
.lum-br-edge path { fill: var(--lum-land); stroke: var(--lum-border); stroke-width: 2px; }   /* outer 1 px survives under .lum-br = coast/border */
.lum-br path { fill: var(--lum-land); stroke: none; }
.lum-uf path { fill: none; stroke: var(--lum-border); stroke-width: 0.5px; stroke-opacity: 0.6; }
.lum-country { font: 400 11px/1 var(--font-sans); fill: var(--lum-country); }

/* markers */
.lum-c { fill: var(--lum-dot-fill); stroke: var(--lum-dot-stroke); stroke-width: 1.5px; }
.lum-m.is-sel .lum-c, .lum-c--sel { fill: var(--lum-sel-fill); }
.lum-ring { fill: none; stroke: var(--lum-sel-ring); stroke-width: 2px; }
.lum-m.is-nodata .lum-c, .lum-c--nodata { fill: var(--lum-dot-fill); stroke: var(--lum-nodata); stroke-dasharray: 2 1.5; }
.lum-m.is-cluster:not(.is-nodata) .lum-c { stroke: var(--lum-cluster); stroke-width: 1px; }
.lum-ring2 { fill: none; stroke: var(--lum-cluster); stroke-width: 1px; }
.lum-m.is-nodata .lum-ring2 { stroke: var(--lum-nodata); stroke-dasharray: 2 1.5; }   /* cluster of ports without vessels: dashed, no gold */
.lum-n { font: 600 11px/1 var(--font-sans); fill: var(--lum-dot-text); font-variant-numeric: tabular-nums; pointer-events: none; }
.lum-m.is-sel .lum-n { fill: var(--lum-sel-text); }
.lum-m.is-dim, .lum-label.is-dim { opacity: var(--lum-dim); }
.lum-body { transform-box: fill-box; transform-origin: center; transition: transform 150ms ease-out; }
.lum-m.is-hover .lum-body, .lum-m.is-focus .lum-body { transform: scale(1.1); }
.lum-m.is-hover .lum-c, .lum-m.is-focus .lum-c { stroke-width: 2px; }
.lum-m.is-hover, .lum-m.is-focus { opacity: 1; }
.lum-focus { fill: none; stroke: var(--ring); stroke-width: 2px; opacity: 0; }
.lum-m.is-focus .lum-focus { opacity: 1; }
.lum-leg { stroke: var(--lum-dot-stroke); stroke-width: 1px; stroke-opacity: 0.5; }
.lum-hub { fill: var(--lum-dot-stroke); }
.lum-hit { cursor: pointer; outline: none; }
.lum-hit.is-disabled { cursor: default; }
.lum-hit-c { fill: transparent; stroke: none; pointer-events: all; }
.lum.is-panning .lum-hit { cursor: grabbing; }

/* labels: Plex 12 px teal with a 2 px cream halo */
.lum-label { font: 500 12px/1 var(--font-sans); fill: var(--lum-label); stroke: var(--lum-halo); stroke-width: 4px; stroke-linejoin: round; paint-order: stroke; pointer-events: none; }
.lum-label.is-sel { font-weight: 600; }
.lum-measure { visibility: hidden; }

/* controls (top-right), legend (bottom-left), attribution (bottom-right) */
.lum-controls { position: absolute; top: 8px; right: 8px; z-index: 3; display: flex; flex-direction: column; gap: 4px; }
.lum-controls .kp-btn--icon { width: 32px; height: 32px; padding: 0; font: 500 18px/1 var(--font-sans); background: var(--card); color: var(--foreground); border-color: var(--input); }
.lum-controls .kp-btn--icon:hover { background: var(--muted); }
.lum-controls .kp-btn--icon:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.lum-legend { position: absolute; left: 8px; bottom: 8px; z-index: 3; max-width: calc(100% - 120px); padding: 4px 8px 6px; background: var(--card); color: var(--muted-foreground);
  border: 1px solid var(--border); border-radius: 4px; box-shadow: none; font: 400 11px/1.3 var(--font-sans); }
.lum-legend-toggle { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0; border: 0; background: transparent; color: var(--muted-foreground); font: 600 11px/1 var(--font-sans); cursor: pointer; }
.lum-legend-toggle svg { transition: transform var(--dur) var(--ease); }
.lum-legend.is-collapsed .lum-legend-toggle svg { transform: rotate(-90deg); }
.lum-legend-toggle:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 2px; }
.lum-legend.is-collapsed .lum-legend-body { display: none; }
.lum-legend-title { margin: 2px 0 2px; color: var(--foreground); font-weight: 500; }
.lum-legend-scale { display: block; overflow: visible; }
.lum-legend-n { font: 400 10px/1 var(--font-sans); fill: var(--muted-foreground); }
.lum-legend-keys { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 2px 0 0; padding: 0; list-style: none; }
.lum-legend-keys li { display: inline-flex; align-items: center; gap: 4px; }
.lum-legend-none { margin: 0; }
.lum-legend .lum-c { stroke-width: 1.5px; }
.lum-legend .lum-c--cluster { stroke: var(--lum-cluster); stroke-width: 1px; }
.lum-attrib { position: absolute; right: 8px; bottom: 4px; z-index: 2; font: 400 10px/1.2 var(--font-sans); color: var(--muted-foreground); pointer-events: none; }
.lum-hint { position: absolute; left: 50%; top: 12px; z-index: 4; transform: translateX(-50%); padding: 4px 10px; background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-lg); font: 500 12px/1.3 var(--font-sans); pointer-events: none; white-space: nowrap; }
.lum-hint[hidden] { display: none; }
.lum-nogeo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; color: var(--muted-foreground); font-size: var(--text-sm); }

/* hover card (shadcn HoverCard: radius-lg + --shadow-float) */
.lum-tip { position: absolute; left: 0; top: 0; z-index: 6; width: max-content; max-width: 260px; padding: 10px 12px; background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-float); font: 400 12px/1.4 var(--font-sans); pointer-events: none; }
.lum-tip[hidden] { display: none; }
.lum-tip p { margin: 0; }
.lum-tip-title { font: 600 var(--text-base)/20px var(--font-display); color: var(--foreground); }
.lum-tip-sub { color: var(--muted-foreground); margin-bottom: 6px !important; }
.lum-tip-dl { display: grid; gap: 2px; margin: 0; }
.lum-tip-dl div { display: flex; justify-content: space-between; gap: 16px; }
.lum-tip-dl dt { color: var(--muted-foreground); }
.lum-tip-dl dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.lum-tip-dl small { font-weight: 400; color: var(--muted-foreground); }
.lum-tip-empty { color: var(--muted-foreground); }
.lum-tip-also { margin-top: 6px !important; color: var(--muted-foreground); font-size: 11px; }
.lum-tip-list { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.lum-tip-list li { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.lum-tip-foot { margin-top: 6px !important; padding-top: 6px; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: 11px; }

/* List view (accessible alternative: checkboxes) */
.lum-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 16px; margin: 0; padding: 0; border: 0; min-width: 0; }
.lum-check { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 8px; border-radius: var(--radius); cursor: pointer; font: 500 var(--text-sm)/1.3 var(--font-sans); color: var(--foreground); }
.lum-check:hover { background: var(--surface-sunken); }
.lum-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); flex: none; }
.lum-check input:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.lum-check-meta { margin-left: auto; color: var(--muted-foreground); font-weight: 400; font-size: var(--text-xs); text-align: right; }
.lum-check.is-disabled { cursor: default; color: var(--muted-foreground); }
.lum-list-empty { margin: 0; color: var(--muted-foreground); }

/* ---------------------------------------------------------------- the "Ports" card */
#view-lineups .lu-map-card { margin: 0 0 16px; }
.lu-map-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 16px 0; }
.lu-map-title { margin: 0; font: 500 var(--text-lg)/24px var(--font-display); color: var(--foreground); }
.lu-map-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lu-map-actions .kp-badge { font-variant-numeric: tabular-nums; }
#lu-map-count:not(.is-active) { background: transparent; color: var(--muted-foreground); border-color: var(--border); }
.lu-map-actions .kp-btn--ghost:focus-visible, .lu-map-mode .kp-tab:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.lu-map-mode .kp-tab.is-active { background: var(--background); color: var(--foreground); }
.lu-map-body { padding: 12px 16px 16px; }
.lu-map-canvas { height: 360px; }
.lu-map-listview { height: 360px; overflow: auto; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); overscroll-behavior: contain; }
.lu-map-listview[hidden] { display: none; }
.lu-map-mobile { display: none; }
@media (max-width: 1024px) {
  .lu-map-canvas, .lu-map-listview { height: 280px; }
}

/* port chips (filter bar combobox + phone card) */
.lu-chips, .lu-map-chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.lu-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: 26px; padding: 0 2px 0 10px; border: 1px solid var(--border); border-radius: var(--radius-full);
  background: var(--secondary); color: var(--secondary-foreground); font: 500 var(--text-xs)/1 var(--font-sans); white-space: nowrap; }
.lu-chip > span { overflow: hidden; text-overflow: ellipsis; }
.lu-chip button { position: relative; display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted-foreground); font: 400 15px/1 var(--font-sans); cursor: pointer; }
.lu-chip button:hover { background: var(--muted); color: var(--foreground); }
.lu-chip button:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.lu-chip-none { color: var(--muted-foreground); font-size: var(--text-sm); }
#view-lineups .lu-filters .lu-ports-field { grid-column: span 2; min-width: 0; }
.lu-ports-combo { position: relative; display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 4px; min-height: 36px; padding: 4px 6px; }
.lu-ports-box { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.lu-ports-combo > .kt-clear { flex: none; align-self: flex-start; margin-top: 4px; }
.lu-ports-combo .lu-ports-input { flex: 1 1 96px; min-width: 96px; height: 26px; border: 0 !important; background: transparent !important; box-shadow: none !important; outline: none; padding: 0 4px;
  font: var(--text-sm) var(--font-sans); color: var(--foreground); }
.lu-ports-combo .lu-ports-input::placeholder { color: var(--muted-foreground); }
.lu-ports-combo ul.kt-list { left: -1px; right: -1px; }
.lu-port-native { display: none !important; }

/* ---------------------------------------------------------------- phones (< 768 px): map collapsed, chips + "Choose on map" → bottom sheet */
@media (max-width: 767.98px) {
  .lu-map-card .lu-map-body, .lu-map-card .lu-map-mode, #lu-map-all { display: none !important; }
  .lu-map-mobile { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 10px 16px 16px; }
  .lu-map-mobile .lu-chip { height: 32px; }
  .lu-map-mobile .lu-chip button { width: 28px; height: 28px; }
  .lu-map-mobile .lu-chip button::before { content: ""; position: absolute; inset: -8px; }   /* 44 px touch target */
  .lu-map-choose { height: 44px; justify-content: center; }
  .lu-map-actions .kp-btn { min-height: 44px; }
  #view-lineups .lu-filters .lu-ports-field { grid-column: 1 / -1; }
}
.lu-sheet-backdrop { position: fixed; inset: 0; z-index: 95; background: var(--overlay); }
.lu-sheet-backdrop[hidden], .lu-sheet[hidden] { display: none; }
.lu-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 96; display: flex; flex-direction: column; height: 85vh; height: 85dvh; background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-float); overscroll-behavior: contain; }
.lu-sheet-head { position: relative; display: flex; align-items: center; gap: 8px; padding: 18px 16px 8px; }
.lu-sheet-grip { position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--border); }
.lu-sheet-title { margin: 0; font: 500 var(--text-lg)/24px var(--font-display); color: var(--foreground); }
.lu-sheet-close { margin-left: auto; width: 44px; height: 44px; }
/* one Clear on screen: while the sheet is open the card behind it hides its own header actions (the sheet has Clear next to Map | List) */
html.lu-sheet-open .lu-map-card .lu-map-actions { visibility: hidden; }
.lu-sheet-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 16px 8px; }
.lu-sheet-tools .kp-tab { min-height: 36px; }
.lu-sheet-tools .kp-btn { min-height: 44px; }
.lu-sheet-map { flex: 1 1 auto; min-height: 0; margin: 0 8px; }
.lu-sheet-map[hidden], .lu-sheet-list[hidden] { display: none; }
.lu-sheet-list { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 0 16px; overscroll-behavior: contain; }
.lu-sheet-list .lum-check { min-height: 44px; }
.lu-sheet .lum-controls .kp-btn--icon { width: 44px; height: 44px; }
.lu-sheet-info { margin: 0; padding: 8px 16px; min-height: 40px; border-top: 1px solid var(--border); color: var(--muted-foreground); font: 400 var(--text-xs)/1.4 var(--font-sans); }
.lu-sheet-foot { position: sticky; bottom: 0; padding: 8px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--card); border-top: 1px solid var(--border); }
.lu-sheet-apply { width: 100%; height: 44px; }
html.lu-sheet-open, html.lu-sheet-open body { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .lum-body, .lum-legend-toggle svg { transition: none; } }
#view-lineups .lu-kpis.lu-loading { opacity: 0.55; transition: opacity var(--dur) var(--ease); }
/* v2.1: empty Comex price table = the message only, normal padding (styles.css .empty-state has min-height 160 px) */
#view-lineups .lu-price-empty { display: block; min-height: 0; margin: 0; padding: 8px 0 4px; text-align: left; }

/* v3 (01/12/2026, Designer veto): the "Main ports" KPI value breaks only at the <wbr> after "/" («Paranaguá/ | Antonina»), never mid-word */
#lu-kpis .kpi-card strong.lu-kpi-port { overflow-wrap: normal; word-break: normal; min-width: 0; }
/* labels longer than 14 characters: one step down (--text-2xl 28 → --text-xl 22), so "Paranaguá/" fits the 1024 card */
#lu-kpis .kpi-card strong.lu-kpi-port.is-long { font-size: var(--text-xl); line-height: 28px; }
