/* Rate Parity Monitor — styled to match the internal admin dashboard system */

:root {
    --primary: #0352F7;
    --primary-light: #1D99FB;
    --primary-dark: #033397;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --secondary: #6c757d;
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --border: #ddd;
    --text: #333;
    --text-muted: #666;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    /* Matches the Webparsers app shell. */
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    tab-size: 4;
    line-height: 1.6;
    font-size: 15px;
}

a { color: var(--primary); }

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ── Layout: sidebar (filters) + main content ── */
.container {
    display: flex;
    min-height: 100vh;
    align-items: flex-start;
}

.sidebar {
    width: 400px;
    flex: none;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 1.75rem 0;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
    flex: none;
}

.brand h1 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--text);
}

.brand .tag {
    font-size: 0.64rem;
    font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--primary);
    background: #e3f2fd;
    padding: 2px 7px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.subtitle {
    margin: 0 0 0.9rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.4;
    flex: none;
}

.filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem 0.75rem;
    padding-bottom: 0;
    flex: 1;
    align-content: start;
    min-height: 0;
    overflow-y: auto;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.field.span-2 { grid-column: 1 / -1; }

.field label {
    font-size: 0.66rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-transform: none;
    font-size: 0.78rem;
    color: var(--text);
    font-weight: 400;
    letter-spacing: normal;
}
.checkbox-field input[type="checkbox"] { flex: none; }

.position-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    margin-left: 0.5rem;
    vertical-align: middle;
}
.position-badge.position-appealing { background: #e8f5e9; color: #1e7c34; }
.position-badge.position-mid { background: #fff3cd; color: #856404; }
.position-badge.position-not_appealing { background: #f8d7da; color: #a71d2a; }
.position-badge.position-not_offered { background: #e9ecef; color: var(--secondary); }
.position-badge.position-sold_out { background: #e9ecef; color: var(--secondary); }

.form-control {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.sidebar-actions {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    grid-column: 1 / -1;
    margin-top: 0.25rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.date-field .form-control {
    border: 1px solid var(--primary-light);
    background: #eaf6ff;
    font-weight: 500;
    color: var(--primary-dark);
}

.form-control:focus,
a:focus-visible,
button:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(3, 82, 247, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: #f8f9fa;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.btn-outline:disabled:hover {
    border-color: var(--border);
    color: var(--text);
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
}

.summary-bar {
    display: flex;
    gap: 2rem;
    padding: 1.25rem 0 0.5rem;
    flex-wrap: wrap;
}

.stat .n {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    color: var(--text);
    line-height: 1.2;
}

.stat .l {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat.alert .n { color: #b9760a; }

#app-shell.loading { opacity: 0.55; transition: opacity 0.15s ease; }
#app-shell { transition: opacity 0.15s ease; }

.grid {
    padding: 0.5rem 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.room-divider {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 1.25rem 0 -0.15rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px dashed var(--border);
}
.room-divider .rd-sep { color: #bbb; margin: 0 4px; }

.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.offer-card {
    padding: 1.1rem 1.35rem;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.card-head h3 {
    font-size: 1.02rem;
    margin: 0;
    font-weight: 600;
}

.card-head .meta {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.room-line {
    font-size: 0.86rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.room-line .rt { color: var(--text); font-weight: 500; }

.channels {
    display: grid;
    grid-template-columns: 148px 84px 160px 132px 150px;
    column-gap: 0.75rem;
    row-gap: 0.375rem;
    align-items: center;
}

.ch-head {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.ch-row { display: contents; }

.ch-row > div {
    padding: 0.3rem 0;
    font-size: 0.86rem;
    min-width: 0;
}

.channel-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.channel-link {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px dotted var(--text-muted);
}
.channel-link:hover { color: var(--primary); border-bottom-color: var(--primary); }

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}
.dot.booking { background: var(--primary); }
.dot.p1 { background: #d64550; }
.dot.p2 { background: #9a63c9; }
.dot.p3 { background: #17a398; }
.dot.slevomat { background: #e0a300; }

/* .ch-row is `display: contents`, so background has to go on each cell */
.ch-row-own > div { background: #fff9ec; }
.ch-row-own > div:first-child { padding-left: 0.4rem; border-radius: 6px 0 0 6px; }
.ch-row-own > div:last-child { padding-right: 0.4rem; border-radius: 0 6px 6px 0; }

.own-tag {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #a3760a;
    background: #fbe6b8;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.parity-tick.is-own { box-shadow: 0 0 0 2px #fbe6b8; z-index: 1; }

.price {
    font-family: "Courier New", monospace;
    font-weight: 600;
    white-space: nowrap;
}

.price.alert { color: #b9760a; }

.price-cell {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.parity-track {
    position: relative;
    height: 20px;
    background: #eef2f6;
    border-radius: 999px;
    overflow: visible;
    margin-top: 2px;
}

.parity-tick {
    position: absolute;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    transform: translateX(-50%);
}

.parity-tick.sold-out {
    background: transparent;
    border: 2px dashed var(--text-muted);
}

.parity-tick.alert {
    box-shadow: 0 0 0 3px rgba(185, 118, 10, 0.28);
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: #e8f5e9; color: var(--success); }
.badge-danger { background: #f8d7da; color: var(--danger); }
.badge-secondary { background: #e9ecef; color: var(--secondary); }

.deviation {
    font-family: "Courier New", monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.deviation.alert { color: #b9760a; font-weight: 600; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state h3 { color: var(--text); margin-bottom: 0.5rem; }

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

.pager-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

footer {
    padding: 1.5rem 0 3rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.tab {
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
}

.tab:hover { background: var(--bg); color: var(--text); }

.tab.active {
    background: var(--primary);
    color: #fff;
}

/* ── Shared misc ── */
.filter-banner {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffe8a1;
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-size: 0.82rem;
    margin: 1.25rem 0 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.stat-link {
    text-decoration: none;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    margin: -0.4rem -0.6rem;
    transition: background 0.15s;
}
.stat-link:hover { background: var(--bg); }

/* ── Analytics panels ── */
.panel {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1.25rem 1.5rem;
    margin-top: 1.25rem;
}

.panel h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.panel-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0 0 1rem;
}

.panel-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.panel-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 1100px) {
    .panel-grid { grid-template-columns: 1fr; }
}

/* Heatmap */
.heatmap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-x: auto;
}

.heatmap-row {
    display: grid;
    grid-template-columns: 200px repeat(4, 90px);
    gap: 4px;
    align-items: center;
}

.heatmap-head { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.heatmap-col-head { text-align: center; }

.heatmap-hotel {
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: none;
    padding: 0.3rem 0.1rem;
}
.heatmap-hotel:hover { color: var(--primary); }

.heatmap-cell {
    display: block;
    text-align: center;
    padding: 0.45rem 0;
    border-radius: 6px;
    font-family: "Courier New", monospace;
    font-weight: 600;
    font-size: 0.82rem;
    text-decoration: none;
    color: #1a1a1a;
}
.heatmap-cell.sev-0 { background: #e8f5e9; color: #1e7c34; }
.heatmap-cell.sev-1 { background: #dcedc8; color: #33691e; }
.heatmap-cell.sev-2 { background: #fff3cd; color: #856404; }
.heatmap-cell.sev-3 { background: #ffe0b2; color: #b9540a; }
.heatmap-cell.sev-4,
.heatmap-cell.sev-5 { background: #f8d7da; color: #a71d2a; }

.heatmap-col-own { color: #a3760a; font-weight: 700; }
.heatmap-cell-own { box-shadow: inset 0 0 0 2px #e0a300; }

/* Price trend charts */
.trend-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 1100px) {
    .trend-grid { grid-template-columns: 1fr; }
}

.trend-card {
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 0.9rem 0.6rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}
.trend-card:hover { border-color: var(--primary); }

.trend-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.chart-svg { width: 100%; height: 200px; display: block; overflow: visible; }

.chart-gridline {
    stroke: var(--border);
    stroke-width: 1;
    stroke-dasharray: 3 3;
}

.chart-axis-line {
    stroke: var(--border);
    stroke-width: 1;
}

.chart-axis-label {
    /* The SVG scales down to fit its container, so these need to be set
       generously in user units or the tick labels end up unreadable. */
    font-size: 14px;
    fill: var(--text);
    font-family: "Courier New", monospace;
}

.chart-axis-label-y { text-anchor: end; }
.chart-axis-label-x { text-anchor: middle; }

.chart-dot {
    fill: #0352F7;
    stroke: #fff;
    stroke-width: 1;
}
.chart-dot:hover { r: 5.5; fill: #022e9e; }

.trend-range {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: "Courier New", monospace;
    margin-top: 0.3rem;
}

.chart-axis-title {
    font-size: 15px;
    font-weight: 700;
    fill: var(--text);
}

/* Axis title as HTML above the plot — inside the SVG it collided with the
   top gridline once the label font size was raised. */
.chart-caption {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

/* Explore tab: single big multi-series chart + legend */
.explore-chart-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.explore-chart { width: 100%; height: 360px; }

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text);
    text-decoration: none;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    transition: background 0.15s;
}
.legend-item:hover { background: var(--bg); color: var(--primary); }

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: none;
}

.table-scroll { overflow-x: auto; }

/* Offers tab: Tabulator table */
#offers-table {
    margin-top: 0.5rem;
    font-size: 0.82rem;
}
#offers-table-note {
    margin-top: 0.5rem;
}
.cell-muted { color: var(--text-muted); }
.tabulator-cell.cell-bold { font-weight: 700; }
.cell-good { color: #1e7c34; font-weight: 600; }
.cell-bad { color: #a71d2a; font-weight: 600; }

/* ── Offers tab: full-width layout, no sidebar ───────────────────────── */
.offers-body { background: var(--bg); }

/* Header — adopts the Webparsers app-shell styling: sticky, 70px, dark navy,
   hairline light border. Logo and tabs both sit on the left. */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    height: 70px;
    flex-shrink: 0;
    align-items: center;
    gap: 1.75rem;
    padding-left: 2rem;
    padding-right: 2rem;
    background: rgb(11, 21, 53);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: none;
    text-decoration: none;
    opacity: 1;
    transition: opacity 0.15s;
}
.topbar-brand:hover { opacity: 0.8; }

/* The full logo artwork is white-on-transparent, so it only reads on the
   dark header — never place it on a light background. */
.topbar-logo { height: 42px; width: auto; display: block; }

.topbar-brand .tag {
    font-size: 0.62rem;
    font-weight: 600;
    color: #9fc0ff;
    border: 1px solid rgba(159, 192, 255, 0.35);
    background: rgba(3, 82, 247, 0.18);
    padding: 2px 7px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.topbar-sep {
    width: 1px;
    height: 26px;
    background: rgba(255, 255, 255, 0.12);
    flex: none;
}

/* Tabs sit on the left, immediately after the logo. */
.topbar-tabs {
    display: flex;
    gap: 0.25rem;
    margin-right: auto;
}

.topbar-tabs .tab {
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.62);
    border: 1px solid transparent;
    transition: all 0.15s;
}
.topbar-tabs .tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
}
.topbar-tabs .tab.active {
    color: #fff;
    background: rgba(3, 82, 247, 0.9);
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.78rem;
}

.page-full {
    padding: 1.25rem 1.5rem 2rem;
    max-width: 100%;
}

.toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.toolbar-left { display: flex; gap: 1rem; align-items: flex-end; }
.toolbar-field { min-width: 170px; }
.toolbar-actions { display: flex; gap: 0.5rem; }

/* Applied-filter chips */
.applied-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.55rem 0.75rem;
    background: #eef4ff;
    border: 1px solid #cfe0ff;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.applied-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
}

.applied-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.15rem 0.3rem 0.15rem 0.6rem;
    font-size: 0.76rem;
}
.chip-server { border-color: #e0a300; background: #fff9ec; }
.chip-label { color: var(--text-muted); }

.chip-x {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1;
    padding: 0 0.25rem;
    border-radius: 50%;
}
.chip-x:hover { color: #a71d2a; background: #f8d7da; }

/* Rank pill + "our channel" row highlight */
.rank-num {
    display: inline-block;
    font-family: "Courier New", monospace;
    font-size: 0.82rem;
    font-weight: 700;
    min-width: 1.6em;
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
    color: var(--secondary);
}
.rank-num.rank-first { background: #e8f5e9; color: #1e7c34; }
.rank-num.rank-last { background: #f8d7da; color: #a71d2a; }

/* ── Alerts tab: saved views as filter buttons over one table ───────── */
.views {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.9rem;
}

.views-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.views-label {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    min-width: 120px;
}

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
}
.view-btn:hover { border-color: var(--primary); color: var(--primary); }
.view-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.view-n {
    font-family: "Courier New", monospace;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 999px;
    padding: 0 0.35rem;
}
.view-btn.active .view-n { background: rgba(255, 255, 255, 0.25); }

.view-inline { display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

.rank-n-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.rank-n-select { width: auto; padding: 0.15rem 0.35rem; font-size: 0.76rem; }
.date-sel { width: auto; }

.hist-changes { display: inline-flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.hist-changes .channel-check { font-size: 0.75rem; }

/* Historical compare — one line, but its own bordered block so it reads as a
   separate tool: the views above fire on click, this one is staged then run. */
.history-panel {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--secondary);
    border-radius: 8px;
    padding: 0.55rem 0.9rem;
    margin-bottom: 0.9rem;
}
.history-panel.running { border-left-color: var(--primary); background: #f5f9ff; }

.history-title { min-width: 0; white-space: nowrap; }
.views-label-inline { min-width: 0; white-space: nowrap; }
.history-arrow { color: var(--text-muted); }

.btn-primary {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* Download chooser */
.modal-box-narrow { max-width: 560px; }

.dl-choices { display: flex; flex-direction: column; gap: 0.6rem; }

.dl-choice {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    text-align: left;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.dl-choice:hover { border-color: var(--primary); background: #f5f9ff; }

.dl-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.dl-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    background: #e3f2fd;
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
    margin-left: 0.35rem;
}
.dl-sub { font-size: 0.76rem; color: var(--text-muted); line-height: 1.35; }
.dl-file {
    font-family: "Courier New", monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Custom Hotel-aware Room type header filter — match Tabulator's own inputs */
.room-header-filter {
    box-sizing: border-box;
    width: 100%;
    padding: 3px 4px;
    border: 1px solid #dedede;
    border-radius: 3px;
    background: #fff;
    font-family: inherit;
    font-size: 0.78rem;
    color: var(--text);
}
.room-header-filter:focus { outline: none; border-color: var(--primary); }

/* Row-detail modal: summary + history chart + run-by-run table */
.modal-section {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
}
.modal-summary { margin-bottom: 0.5rem; align-items: flex-start; }

/* Optional third line on a stat tile — e.g. naming which providers undercut us */
.stat .d {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
    max-width: 22rem;
    text-transform: none;
    letter-spacing: normal;
}
.stat.alert .d { color: #a71d2a; }
.hist-chart { width: 100%; height: 300px; }

/* Rows open the detail/history modal, so they need to read as clickable */
.tabulator-row { cursor: pointer; }

/* Rank colours the row: cheapest of all providers green, priciest red. */
.tabulator-row.row-rank-first { background-color: #e6f6ea !important; }
.tabulator-row.row-rank-last { background-color: #fdeaec !important; }
.tabulator-row.row-rank-first:hover { background-color: #d6efdd !important; }
.tabulator-row.row-rank-last:hover { background-color: #fbdadd !important; }

/* Slevomat is marked with a diagonal hatch rather than a colour, so it stays
   legible on top of whichever rank colour the row happens to carry. Uses
   background-image, which layers over the background-color above. */
.tabulator-row.row-own {
    background-image: repeating-linear-gradient(
        45deg,
        rgba(20, 24, 33, 0.07) 0 5px,
        rgba(0, 0, 0, 0) 5px 11px
    );
}

.own-star {
    margin-left: 4px;
    font-weight: 700;
    color: #a3760a;
    cursor: help;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: -0.35rem;
}

.legend-key {
    display: inline-block;
    width: 26px;
    height: 13px;
    border: 1px solid var(--border);
    border-radius: 3px;
    vertical-align: middle;
}
.legend-key:not(:first-child) { margin-left: 0.9rem; }
.legend-key-first { background-color: #e6f6ea; }
.legend-key-last { background-color: #fdeaec; }
.legend-key-own {
    background-color: #fff;
    background-image: repeating-linear-gradient(
        45deg,
        rgba(20, 24, 33, 0.07) 0 5px,
        rgba(0, 0, 0, 0) 5px 11px
    );
}

.data-table .th-own, .data-table .td-own { background: #fff9ec; font-weight: 600; }

/* Alerts tab: quick-view blocks */
.quickview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
@media (max-width: 1100px) {
    .quickview-grid { grid-template-columns: 1fr; }
}

.quickview-block {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.quickview-block h3 { margin: 0; font-size: 0.85rem; }

.quickview-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.quickview-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.quickview-n { width: 60px; flex: none; }

.quickview-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Alerts tab: historical A/B compare */
.history-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1rem;
}
@media (max-width: 900px) {
    .history-controls { grid-template-columns: 1fr 1fr; }
}

.channel-checklist-row {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

.row-rank-changed { background: #fff9ec; }

/* Explore: sidebar section headers */
.filter-section-head {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    padding-top: 0.6rem;
    margin-top: 0.2rem;
    border-top: 1px solid var(--border);
}
.filter-section-head:first-child { border-top: none; padding-top: 0; margin-top: 0; }

.channel-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.channel-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text);
    text-transform: none;
    font-weight: 400;
}
.channel-check input { flex: none; }
.channel-check-own { color: #a3760a; font-weight: 600; }

.field-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0.3rem 0 0;
}

/* Explore chart: legend toggle + raw-data icon button */
.legend-item {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.legend-item-hidden { opacity: 0.4; text-decoration: line-through; }

.legend-raw-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    margin-right: 0.5rem;
}
.legend-raw-btn:hover { color: var(--primary); background: var(--bg); }

/* Raw-data modal */
body.modal-open { overflow: hidden; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 33, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

/* A class-selector `display: flex` above beats the UA [hidden] default, so
   the overlay would stay visible (and block the whole page) even with the
   `hidden` attribute set unless this is spelled out explicitly. */
.modal-overlay[hidden] { display: none; }

.modal-box {
    background: var(--card-bg);
    border-radius: 10px;
    max-width: 1000px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.modal-box-wide { max-width: 1200px; }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 0.95rem; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.2rem 0.4rem;
}
.modal-close:hover { color: var(--text); }

.modal-body {
    padding: 1rem 1.25rem 1.25rem;
    overflow-y: auto;
}

/* Frequent-changers bars */
.bar-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bar-row {
    display: grid;
    grid-template-columns: 170px 1fr 56px;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
    font-size: 0.82rem;
}
.bar-row:hover .bar-label { color: var(--primary); }

.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bar-track {
    background: var(--bg);
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 999px;
}

.bar-value {
    font-family: "Courier New", monospace;
    text-align: right;
}

/* Data tables (room/meal ranking, coverage) */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    padding: 0.5rem 0.6rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover { background: var(--bg); }

@media (max-width: 900px) {
    .container { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .filters { flex-direction: row; flex-wrap: wrap; }
    .field { min-width: 160px; flex: 1 1 160px; }
    .sidebar-actions { flex-direction: row; margin-top: 0.5rem; }
}

@media (max-width: 768px) {
    .content-wrapper { padding: 0 1rem; }

    .channels { grid-template-columns: 110px 60px 1fr; }
    .channels .ch-head:nth-child(4), .channels .ch-head:nth-child(5),
    .ch-row > div:nth-child(4), .ch-row > div:nth-child(5) { display: none; }
}


/* ── Page note ────────────────────────────────────────────────────────
   Deliberately not a bar: a styled footer with a logo read as a second
   header stacked at the bottom of the page. */
.site-note {
    margin: 2rem 0 0;
    padding: 1rem 2rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.5;
    max-width: 90ch;
}
.site-note a { color: var(--primary); text-decoration: none; }
.site-note a:hover { text-decoration: underline; }

/* ── Explore: controls beside the chart ───────────────────────────────── */
.explore-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 1100px) {
    .explore-layout { grid-template-columns: 1fr; }
}

.explore-controls {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 86px;   /* clears the 70px sticky header */
}

.ctl-group { display: flex; flex-direction: column; gap: 0.6rem; }

.ctl-head {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.explore-main { min-width: 0; }

/* Panel header with an action on the right (e.g. per-table CSV download) */
.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.panel-head h2 { margin: 0; }
.panel-head .panel-hint { margin-bottom: 0.5rem; }

#series-table { margin-top: 0.5rem; }
#series-table .tabulator-row { cursor: pointer; }

/* Explore: per-line summary strip above the per-day table */
.series-totals {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.25rem 0 0.5rem;
}

.series-chip {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.series-chip:hover { border-color: var(--primary); background: #f5f9ff; }

.series-chip .sc-label { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.series-chip .sc-val { font-size: 0.78rem; color: var(--primary); font-weight: 600; }
.series-chip .sc-sub { font-size: 0.7rem; color: var(--text-muted); }
