/* ==========================================================================
   dashboard.css — dashboard.html (interactive explorer)
   ========================================================================== */
.dash-hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(800px 300px at 90% 0%, rgba(210, 43, 63, .25), transparent 60%),
    linear-gradient(180deg, var(--navy-900), var(--navy-800));
  padding: 44px 0 92px;
}
.dash-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 10%);
}
.dash-hero .wrap { position: relative; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.dash-hero .eyebrow { color: #ff8a98; }
.dash-hero h1 { font-size: clamp(48px, 7vw, 88px); font-weight: 800; text-transform: uppercase; line-height: .9; margin: 10px 0 12px; }
.dash-hero p { color: #c9d4e3; max-width: 60ch; margin: 0; font-size: 16.5px; }
.dash-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-badges span { font-size: 12.5px; font-weight: 600; padding: 7px 11px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); color: #d6dfeb; }

.dash-main { margin-top: -64px; position: relative; padding-bottom: 64px; }

/* ------------------------------------------------------------------ filter panel */
.filters { padding: 18px 20px 16px; }
.filters-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.filters-head h2 { font: 800 22px/1 var(--font-display); text-transform: uppercase; letter-spacing: .02em; color: var(--navy-900); }
.filters-head .count { font-size: 12px; font-weight: 700; background: var(--red); color: #fff; border-radius: 999px; padding: 3px 8px; }
.filters-head .count[hidden] { display: none; }
.filters-toggle { display: none; margin-left: auto; }
.filters-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.1fr; gap: 16px 20px; }
.f-group { min-width: 0; }
.f-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 7px; }
.f-label output { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

/* segmented + chips */
.seg { display: inline-flex; width: 100%; background: var(--paper); border: 1px solid var(--hair); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button, .chips button {
  flex: 1; font: 600 13px/1 var(--font-body); color: var(--ink-2); background: transparent; border: 0; border-radius: 7px;
  padding: 9px 8px; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; white-space: nowrap;
}
.seg button:hover { color: var(--ink); background: rgba(255, 255, 255, .7); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--navy-900); box-shadow: var(--shadow-1), 0 0 0 1px var(--hair-2); }
.chips { display: flex; gap: 6px; }
.chips button { border: 1.5px solid var(--hair-2); background: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.chips button i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); opacity: .35; transition: opacity .15s; }
.chips button[aria-pressed="true"] { border-color: var(--navy-800); color: var(--navy-900); background: #f6f8fb; }
.chips button[aria-pressed="true"] i { opacity: 1; }

/* dual range */
.range { position: relative; height: 38px; }
.range input[type=range] { position: absolute; left: 0; right: 0; top: 12px; width: 100%; margin: 0; pointer-events: none; -webkit-appearance: none; appearance: none; background: none; height: 14px; }
.range input[type=range]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--red); box-shadow: var(--shadow-1); cursor: grab; position: relative; z-index: 2; }
.range input[type=range]::-moz-range-thumb { pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--red); cursor: grab; }
.range input[type=range]:focus-visible::-webkit-slider-thumb { outline: 3px solid rgba(210, 43, 63, .35); outline-offset: 2px; }
.range .track { position: absolute; left: 10px; right: 10px; top: 17px; height: 4px; border-radius: 4px; background: var(--hair-2); }
.range .fill { position: absolute; top: 0; bottom: 0; background: var(--red); border-radius: 4px; }
.range .ticks { position: absolute; left: 10px; right: 10px; top: 28px; display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* selects */
.select, .input {
  width: 100%; font: 550 14px/1.2 var(--font-body); color: var(--ink); background: #fff;
  border: 1.5px solid var(--hair-2); border-radius: 10px; padding: 10px 34px 10px 12px; appearance: none; -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23445066' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.select:hover, .input:hover { border-color: var(--navy-600); }
.select:focus, .input:focus { outline: none; border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(24, 50, 87, .15); }
.input { padding-right: 12px; }

/* team multi-select */
.ms { position: relative; }
.ms-btn { text-align: left; display: flex; align-items: center; gap: 8px; }
.ms-btn .ms-logos { display: flex; }
.ms-btn .ms-logos .team-badge { width: 20px; height: 20px; margin-right: -5px; box-shadow: 0 0 0 2px #fff; }
.ms-pop {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; width: min(560px, 92vw);
  background: #fff; border: 1px solid var(--hair-2); border-radius: 12px; box-shadow: var(--shadow-2); padding: 12px;
}
.ms-pop[hidden] { display: none; }
.ms-top { display: flex; gap: 8px; margin-bottom: 10px; }
.ms-top .input { flex: 1; }
.ms-top button { font: 600 12.5px/1 var(--font-body); border: 1px solid var(--hair-2); background: #fff; border-radius: 8px; padding: 0 10px; cursor: pointer; color: var(--ink-2); }
.ms-top button:hover { border-color: var(--navy-700); color: var(--ink); }
.ms-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; max-height: 340px; overflow: auto; }
.ms-div h5 { margin: 0 0 4px; font: 700 10.5px/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ms-opt { display: flex; align-items: center; gap: 7px; padding: 4px 4px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.ms-opt:hover { background: var(--paper); }
.ms-opt input { accent-color: var(--red); margin: 0; }
.ms-opt .team-badge { width: 20px; height: 20px; }
.ms-opt[hidden] { display: none; }
@media (max-width: 640px) { .ms-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ms-pop { width: calc(100vw - 32px); left: 0; } }

/* player search */
.ac { position: relative; }
.ac .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: var(--paper); width: 24px; height: 24px; border-radius: 50%; cursor: pointer; color: var(--ink-2); font-size: 14px; line-height: 1; }
.ac .clear[hidden] { display: none; }
.ac-list { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--hair-2); border-radius: 10px; box-shadow: var(--shadow-2); max-height: 300px; overflow: auto; margin: 0; padding: 4px; list-style: none; }
.ac-list[hidden] { display: none; }
.ac-list li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.ac-list li .avatar { width: 30px; height: 30px; font-size: 11px; }
.ac-list li small { display: block; color: var(--muted); font-size: 11.5px; }
.ac-list li[aria-selected="true"], .ac-list li:hover { background: var(--paper); }

/* active chips + reset */
.filters-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--hair); }
.active-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; align-items: center; }
.active-chips .none { font-size: 13px; color: var(--muted); }
.achip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--navy-900); background: #eef2f8; border: 1px solid #d9e1ee; border-radius: 999px; padding: 5px 6px 5px 11px; animation: pop .2s ease-out; }
.achip button { border: 0; background: rgba(24, 50, 87, .12); color: var(--navy-900); width: 18px; height: 18px; border-radius: 50%; cursor: pointer; font-size: 12px; line-height: 1; display: grid; place-items: center; }
.achip button:hover { background: var(--red); color: #fff; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.btn-reset { background: #fff; color: var(--red); border-color: var(--red); padding: 11px 18px; }
.btn-reset:hover { background: var(--red); color: #fff; }
.btn-reset svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ control bar (sticky) */
.controlbar {
  position: sticky; top: calc(var(--nav-h) + 3px); z-index: 50;
  margin: 16px 0; padding: 12px 16px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px; align-items: end;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.controlbar .f-label { margin-bottom: 5px; }
.controlbar .select { padding-top: 9px; padding-bottom: 9px; }
.cb-read { font-size: 12.5px; color: var(--muted); max-width: 260px; line-height: 1.35; }
.cb-read b { color: var(--ink); display: block; font-size: 13.5px; }

/* ------------------------------------------------------------------ KPIs */
.dkpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.dkpi { padding: 16px 16px 14px; position: relative; overflow: hidden; }
.dkpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--navy-700); transform: scaleX(0); transform-origin: left; transition: transform .5s; }
.dkpi.flash::after { transform: scaleX(1); }
.dkpi.accent { background: linear-gradient(160deg, var(--navy-900), var(--navy-700)); color: #fff; border-color: transparent; }
.dkpi.accent .dkpi-label, .dkpi.accent .dkpi-sub { color: #b9c7da; }
.dkpi.accent .dkpi-value { color: #fff; }
.dkpi.accent::after { background: var(--red); }
.dkpi-label { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); min-height: 2.6em; line-height: 1.3; }
.dkpi-value { font: 800 clamp(28px, 2.6vw, 36px)/1 var(--font-display); color: var(--navy-900); margin: 6px 0 4px; white-space: nowrap; }
.dkpi-sub { font-size: 12px; color: var(--muted); line-height: 1.35; }

/* ------------------------------------------------------------------ chart grid */
.dgrid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.panel { padding: 18px 18px 14px; grid-column: span 6; transition: opacity .2s; min-width: 0; }
.panel.wide { grid-column: span 12; }
.panel.w7 { grid-column: span 7; } .panel.w5 { grid-column: span 5; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.panel-head h3 { font: 700 16.5px/1.3 var(--font-body); color: var(--ink); letter-spacing: 0; }
.panel-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.panel-tag { flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--hair); border-radius: 6px; padding: 4px 7px; background: var(--paper); }
.panel .chart-legend { margin-top: 2px; }
.panel .note { font-size: 11.5px; color: var(--muted); margin: 8px 0 0; }
.is-updating .panel { opacity: .6; }
@media (max-width: 1100px) {
  .dkpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .panel, .panel.w7, .panel.w5 { grid-column: span 12; }
  .filters-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .controlbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cb-read { display: none; }
  .filters-toggle { display: inline-flex; }
  .filters-body[data-collapsed="true"] { display: none; }
}
@media (max-width: 640px) {
  .filters-grid { grid-template-columns: minmax(0, 1fr); }
  .controlbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 10px 12px; gap: 8px; top: calc(var(--nav-h) + 3px); }
  .controlbar .f-group:first-child { grid-column: 1 / -1; }
  .dkpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dash-hero { padding-bottom: 84px; }
}

/* ------------------------------------------------------------------ team map */
.tmap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tmap-conf h4 { font: 800 15px/1 var(--font-display); letter-spacing: .1em; color: var(--ink-2); margin-bottom: 8px; }
.tmap-divs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.tmap-div h5 { margin: 0 0 5px; font: 700 10.5px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tmap-teams { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 7px 2px 6px; border-radius: 8px; min-width: 0;
  background: var(--bg, #eef1f5); color: var(--fg, var(--ink)); border: 0; font: inherit; text-align: center; cursor: pointer;
  transition: background .4s, color .4s, transform .15s, box-shadow .15s;
}
.tile:hover, .tile:focus-visible { transform: translateY(-1px); box-shadow: 0 0 0 2px var(--navy-900); }
.tile .team-badge { width: 26px; height: 26px; }
.tile b { font-size: 11px; font-weight: 700; letter-spacing: .04em; line-height: 1; }
.tile .tv { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.tile.off { background: repeating-linear-gradient(135deg, #f3f4f7 0 6px, #e8ebf0 6px 12px); color: var(--muted); }
.tile.off .team-badge { opacity: .45; }
.tile.selected { box-shadow: 0 0 0 2px var(--red); }
.scale { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); margin-top: 10px; font-variant-numeric: tabular-nums; }
.scale i { flex: 0 1 180px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #cde2fb, #86b6ef, #2a78d6, #1c5cab, #0d366b); }
@media (max-width: 760px) { .tmap { grid-template-columns: minmax(0, 1fr); } }


/* ------------------------------------------------------------------ data table */
.table-panel { margin-top: 16px; padding: 18px; }
.table-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0 12px; }
.table-tools .input { max-width: 280px; }
.table-tools .meta { font-size: 12.5px; color: var(--muted); margin-left: auto; }
.table-wrap { overflow-x: auto; border: 1px solid var(--hair); border-radius: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.data th { position: sticky; top: 0; background: #f7f8fa; text-align: right; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); padding: 0; border-bottom: 1px solid var(--hair-2); white-space: nowrap; }
table.data th button { all: unset; box-sizing: border-box; display: flex; justify-content: flex-end; align-items: center; gap: 4px; width: 100%; padding: 10px 12px; cursor: pointer; }
table.data th button:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
table.data th:first-child button { justify-content: flex-start; }
table.data th .arrow { opacity: .3; font-size: 10px; }
table.data th[aria-sort] .arrow { opacity: 1; color: var(--red); }
table.data th.measure { background: #eef2f8; color: var(--navy-900); }
table.data td { text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.data td.measure { background: #f7f9fc; font-weight: 700; color: var(--navy-900); }
table.data td:first-child, table.data th:first-child { text-align: left; }
table.data td:first-child { font-weight: 600; }
table.data td:first-child .cell-id { display: flex; align-items: center; gap: 8px; }
table.data td:first-child .team-badge { width: 20px; height: 20px; }
table.data tbody tr:hover td { background: #f3f6fa; }
table.data tfoot td { font-weight: 700; background: #f7f8fa; border-top: 1px solid var(--hair-2); border-bottom: 0; }
.pager { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-top: 12px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.pager button { font: 600 13px/1 var(--font-body); border: 1px solid var(--hair-2); background: #fff; border-radius: 8px; padding: 8px 11px; cursor: pointer; color: var(--ink); }
.pager button:disabled { opacity: .4; cursor: default; }
.pager button:not(:disabled):hover { border-color: var(--navy-700); }
.btn-sm { padding: 9px 13px; font-size: 12px; }

.load-error { background: #fff4f4; border: 1px solid #f3c2c8; color: #8a1c2b; padding: 14px 16px; border-radius: 10px; font-size: 14px; }
.loading { display: grid; place-items: center; min-height: 240px; color: var(--muted); font-size: 14px; }
.loading::before { content: ""; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--hair-2); border-top-color: var(--red); animation: spin .8s linear infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ 3D stadium */
.stadium-panel { padding-bottom: 16px; }
.stadium-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 12px; }
.stadium-tools .tool-gap { flex: 1; }
.seg-sm { width: auto; }
.seg-sm button { flex: none; padding: 8px 12px; font-size: 12.5px; }
.stadium { position: relative; height: clamp(360px, 44vw, 540px); border-radius: 12px; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, #183257, #0a1628 70%); }
.stadium canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: grab; }
.stadium canvas:active { cursor: grabbing; }
.stadium .loading { color: #9fb0c8; position: absolute; inset: 0; }
.stadium .loading::before { border-color: rgba(255, 255, 255, .15); border-top-color: var(--red); }
.stadium .no-webgl { position: absolute; inset: 0; display: grid; place-items: center; color: #c9d4e3; text-align: center; padding: 24px; font-size: 14px; }
.stadium-legend { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; background: rgba(10, 22, 40, .72); color: #c9d4e3; font-size: 11.5px; padding: 7px 10px; border-radius: 8px; pointer-events: none; font-variant-numeric: tabular-nums; }
.stadium-legend i { width: 110px; height: 7px; border-radius: 4px; background: linear-gradient(90deg, #cde2fb, #86b6ef, #2a78d6, #1c5cab, #0d366b); }
.stadium-hint { position: absolute; right: 12px; top: 12px; background: rgba(10, 22, 40, .72); color: #c9d4e3; font-size: 11.5px; padding: 6px 10px; border-radius: 8px; pointer-events: none; transition: opacity .5s; }
.stadium-hint.hide { opacity: 0; }
@media (max-width: 640px) { .stadium { height: 360px; } .stadium-tools .tool-gap { display: none; } .seg-sm button { padding: 8px 9px; } }

/* click-to-filter hints + toast */
.click-hint { color: var(--red); font-weight: 600; }
.click-hint:empty { display: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--navy-950); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 400; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
