/* ── Panel ─────────────────────────────────────────────────────────── */
.panel {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--panel-w);
    height: 100%;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform var(--transition);
    box-shadow: var(--shadow);
}
.panel.collapsed { transform: translateX(-100%); }

.panel-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-top: 14px; /* header sits beside hamburger */
}
.panel-scroll::-webkit-scrollbar { width: 4px; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.panel-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-left: 30px; /* clear hamburger */
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.panel-logo { height: 32px; width: auto; }
.panel-title {
    align-self: flex-start;
    padding-left: 83px; /* align R with N of NEXTPORT wordmark */
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .5px;
    margin-top: 1px;
}
.panel-title small { font-weight: 300; color: var(--route); font-size: 11px; }

/* ── Sections ──────────────────────────────────────────────────────── */
.panel-section { margin-bottom: 16px; }
.section-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

/* ── Date fields ──────────────────────────────────────────────────── */
.date-row { display: flex; gap: 8px; }
.date-field { flex: 1; position: relative; }
.date-field label { font-size: 11px; color: var(--text-dim); margin-bottom: 2px; display: block; }
.date-input {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}
.date-input:hover { border-color: var(--accent-dim); }
.date-input:focus { outline: none; border-color: var(--accent); }

/* ── Calendar popup ───────────────────────────────────────────────── */
.calendar-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 2000;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 10px;
    width: 260px;
    margin-top: 4px;
}
.calendar-popup.open { display: block; }
.calendar-popup.align-right { left: auto; right: 0; }

.cal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.cal-nav button {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
}
.cal-nav button:hover, .cal-nav-btn:hover { background: var(--border); }
.cal-nav-btn { background: none; border: none; color: var(--text); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 4px; }
.cal-title { font-size: 13px; font-weight: 500; }
.cal-click { cursor: pointer; border-radius: 3px; padding: 2px 4px; transition: background .15s; }
.cal-click:hover { color: var(--accent); background: var(--border); }

/* Floating dropdowns over calendar */
.month-dropdown, .year-dropdown {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 10;
    padding: 4px;
    min-width: 130px;
}
.dropdown-item {
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    transition: background .15s;
}
.dropdown-item:hover { background: var(--surface2); }
.dropdown-item.current { background: var(--route); color: #fff; font-weight: 500; }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
}
.cal-grid .day-header {
    font-size: 10px;
    color: var(--text-dim);
    padding: 4px 0;
}
.cal-day {
    padding: 5px 0;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s;
}
.cal-day:hover { background: var(--surface2); }
.cal-day.other-month { opacity: .3; }
.cal-day.today { border: 1px solid var(--route); }
.cal-day.selected { background: var(--route); color: #fff; }
.cal-day.has-port { font-weight: 700; border-bottom: 2px solid var(--route); }
.cal-day.disabled { opacity: .25; pointer-events: none; }


/* ── Fleet select ─────────────────────────────────────────────────── */
.fleet-select {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    appearance: none;
    cursor: pointer;
}
.fleet-select:hover { border-color: var(--accent-dim); }
.fleet-select:focus { outline: none; border-color: var(--accent); }

/* ── Search fields ────────────────────────────────────────────────── */
.search-field { position: relative; }
.search-input {
    width: 100%;
    padding: 7px 32px 7px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
}
.search-input:hover { border-color: var(--accent-dim); }
.search-input:focus { outline: none; border-color: var(--accent); }
.clear-btn {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    display: none;
    padding: 0 4px;
}
.clear-btn:hover { color: var(--text); }
.clear-btn.visible { display: block; }

.dropdown-arrow {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    cursor: pointer;
    opacity: .5;
    transition: opacity .15s;
}
.dropdown-arrow::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text);
    margin: 5px auto 0;
}
.dropdown-arrow:hover { opacity: 1; }
.dropdown-arrow.valid::after { border-top-color: #4caf50; }

.search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
    z-index: 1500;
    margin-top: 2px;
}
.search-dropdown.open { display: block; }
.search-dropdown::-webkit-scrollbar { width: 4px; }
.search-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.dd-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background .1s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.dd-item:hover { background: var(--surface2); }
.dd-item.selected { background: var(--accent); color: #fff; }
.dd-item em { font-style: normal; color: var(--accent); font-weight: 600; }
.dd-item .dd-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-item .dd-detail { font-size: 11px; color: var(--text-dim); margin-left: 6px; flex: 0 0 auto; }
/* Two-line service items: full name (bold) on top, partners + volume below.
   Scoped to .dd-item--stacked so the single-line port dropdown is unaffected. */
.dd-item--stacked {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
}
.dd-item--stacked .dd-name {
    flex: none;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;          /* single line, truncate long names with … */
    font-weight: 600;             /* bold name */
    line-height: 1.25;
}
.dd-item--stacked .dd-detail {
    margin-left: 0;               /* own line, below the name */
    flex: none;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;          /* keep entries a uniform 2-line height */
    line-height: 1.2;
}
.dd-item .dd-cc {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--text-dim);
    background: var(--surface2);
    border-radius: 3px;
    padding: 1px 5px;
    flex: 0 0 auto;
}
.dd-item.dd-item--selected .dd-cc,
.dd-item.selected .dd-cc { color: rgba(255,255,255,.85); background: rgba(255,255,255,.15); }

/* ── Vessel card ──────────────────────────────────────────────────── */
.vessel-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
    transition: box-shadow .2s;
}
.vessel-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.card-image-wrap {
    height: 120px;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.card-image { width: 100%; height: 100%; object-fit: cover; }
.card-placeholder { font-size: 48px; opacity: .3; }
.card-image-author {
    display: none;
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 9px;
    padding: 2px 6px;
    text-align: right;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s;
}
.card-image-wrap:hover .card-image-author { opacity: 1; }
.card-body { padding: 12px; }
.card-name { font-size: 15px; font-weight: 600; }
.card-imo { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.card-details { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.card-services-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}
.chevron-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    transition: transform .2s;
}
.chevron-btn:hover { color: var(--text); }
.chevron-btn.open { transform: rotate(180deg); }
.services-list {
    margin-top: 6px;
    max-height: 160px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #666 transparent;
}
.services-list::-webkit-scrollbar { width: 4px; }
.services-list::-webkit-scrollbar-track { background: transparent; }
.services-list::-webkit-scrollbar-thumb { background: #666; border-radius: 2px; }
.service-item {
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}
.service-item { cursor: pointer; }
.service-item:hover { background: var(--surface2); }
.service-item .svc-name { color: var(--route); }
.service-item .svc-name:hover { text-decoration: underline; }
.service-item .svc-range { color: var(--text-dim); font-size: 11px; }
.service-item .svc-sm-link { margin-left: 6px; color: var(--text-dim); font-size: 12px; text-decoration: none; opacity: 0.4; }
.service-item:hover .svc-sm-link { opacity: 1; color: var(--route); }

/* ── Bottom controls ──────────────────────────────────────────────── */
.panel-bottom-controls { border-top: 1px solid var(--border); padding-top: 12px; }
.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.control-label { font-size: 12px; color: var(--text-dim); }
.small-select {
    padding: 4px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 12px;
}
.small-select:hover { border-color: var(--accent-dim); }

/* ── Cache section ────────────────────────────────────────────────── */
.cache-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 8px;
}
.cache-label { font-size: 11px; color: var(--text-dim); }
.icon-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}
.icon-btn:hover { background: var(--border); color: var(--euromed); }


/* ── Trade-corridor view (port panel) ─────────────────────────────────── */
.hp-views {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 12px 4px;
}
.hp-vtabs { display: flex; align-items: baseline; gap: 6px; }
/* subtle text-link tabs: active underlined, inactive dimmed — no boxes */
.hp-vtab {
    font-size: 11.5px;
    color: var(--text-dim);
    cursor: pointer;
    background: none; border: none; padding: 0;
    transition: color .12s;
}
.hp-vtab:hover { color: var(--text); }
.hp-vtab.active {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
}
.hp-vsep { color: var(--text-dim); opacity: .5; font-size: 11px; }
/* eraser: clears selected services from the map; dimmed when none selected */
.hp-eraser {
    background: none; border: none; cursor: pointer;
    color: var(--text-dim); font-size: 14px; line-height: 1;
    padding: 2px 4px; border-radius: 4px;
    transition: color .12s, background .12s, opacity .12s;
}
.hp-eraser:hover:not(.disabled) { color: var(--route); background: var(--surface2); }
.hp-eraser.disabled { opacity: .3; cursor: default; }
/* eraser icon (lng-bunkering clear-trails glyph) — center the inline SVG */
.hp-eraser { display: inline-flex; align-items: center; justify-content: center; }
.hp-eraser-ico { display: block; }
.hp-corr-list { padding: 4px 12px 0; }
.hp-corr-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,.04);
}
.hp-corr-dot {
    width: 8px; height: 8px; border-radius: 50%;
    flex: 0 0 auto;
}
.hp-corr-pair { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-corr-n   { flex: 0 0 auto; color: var(--text-dim); font-variant-numeric: tabular-nums; text-align: right; min-width: 48px; }
.hp-corr-pct { flex: 0 0 auto; font-variant-numeric: tabular-nums; text-align: right; min-width: 44px; font-weight: 600; }
.hp-corr-foot {
    font-size: 10.5px;
    color: var(--text-dim);
    padding: 8px 12px 10px;
    line-height: 1.35;
}


/* ── Trade-corridor drill-down (services per corridor) ────────────────── */
.hp-corr-item > .hp-corr-row { cursor: default; }
.hp-corr-item[data-exp="1"] > .hp-corr-row { cursor: pointer; }
.hp-corr-arrow, .hp-corr-arrow-sp {
    width: 10px; flex: 0 0 auto; display: inline-block;
    text-align: center; color: var(--text-dim); font-size: 9px;
    transition: transform .12s;
}
.hp-corr-arrow::before { content: "\25B6"; }   /* ▶ */
.hp-corr-item.open > .hp-corr-row .hp-corr-arrow { transform: rotate(90deg); }
.hp-corr-drill { display: none; padding: 2px 0 6px 26px; }
.hp-corr-item.open > .hp-corr-drill { display: block; }
.hp-corr-side-h {
    font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-dim); margin: 6px 0 2px;
}
.hp-corr-svc {
    display: flex; align-items: center; gap: 8px;
    padding: 2px 8px 2px 0; font-size: 12px;
}
.hp-corr-svc-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* clickable corridor services: route-blue, highlight + draw route on map (like cargo-split) */
.hp-corr-svc-sel { cursor: pointer; border-radius: 4px; transition: background .1s; }
.hp-corr-svc-sel:hover { background: var(--surface2); }
.hp-corr-svc-sel .hp-corr-svc-name { color: #00b8ff; }
.hp-corr-svc-sel.selected { background: rgba(0,184,255,.14); }
.hp-corr-svc-sel.selected .hp-corr-svc-name {
    color: #00b8ff;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.hp-corr-svc-n   { flex: 0 0 auto; color: var(--text-dim); font-variant-numeric: tabular-nums; text-align: right; min-width: 40px; }
.hp-corr-svc-pct { flex: 0 0 auto; font-variant-numeric: tabular-nums; text-align: right; min-width: 40px; }

/* clickable service rows in cargo-split mirror trade-corridors: name in blue
   (affordance) + row hover, so feeder/relay services read as clickable at rest.
   Only .hp-svc-sel nodes carry data-sls — category/port nodes are untouched. */
.hp-node.hp-svc-sel .hp-lab { color: #00b8ff; }
.hp-node.hp-svc-sel > .hp-h:hover { background: var(--surface2); border-radius: 4px; }

/* selected service in the cargo-split tree: blue label. Underline is a border-bottom
   in servicemap.css (text-decoration is clipped by the label's overflow:hidden). */
.hp-node.hp-svc-sel.selected .hp-lab,
.hp-node.selected .hp-lab {
    color: #00b8ff;
}

/* service with port calls but no drawable rotation (missing from service_ranges):
   shown in italics with an explanatory tooltip once the user clicks it. */
.hp-corr-svc-sel.unroutable .hp-corr-svc-name,
.hp-svc-sel.unroutable .hp-lab {
    font-style: italic;
    opacity: .7;
}
.hp-corr-svc-sel.unroutable, .hp-svc-sel.unroutable { cursor: help; }
