/* Season Dashboard — see shared/season-dashboard.js */
.sd {
    --sd-surface: #fbfaf6;
    --sd-panel: #ffffff;
    --sd-line: #e7e3d8;
    --sd-grid: #eeebe3;
    --sd-ink: #1d2a1f;
    --sd-ink-2: #4a5249;
    --sd-muted: #7d8378;
    --sd-deep: #0d3318;
    --sd-green: #2f7d45;
    --sd-gold: #c8a951;
    --sd-gold-ink: #8a6a1c;
    --sd-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;

    background: var(--sd-surface);
    color: var(--sd-ink);
    border-radius: 12px;
    padding: 22px 24px 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
    transition: opacity .15s;
}
.sd.sd-busy { opacity: .55; pointer-events: none; }
.sd * { box-sizing: border-box; }
.sd button { font: inherit; }
.sd-loading, .sd-error { padding: 28px; text-align: center; color: var(--sd-ink-2); font-size: 14px; }
.sd-error { text-align: left; background: #fdf3e1; border-radius: 8px; color: #5e3a12; }

/* ---- header ---------------------------------------------------------- */
.sd-head {
    display: flex; align-items: center; gap: 16px;
    padding-bottom: 14px; border-bottom: 4px solid var(--sd-deep);
}
.sd-crest {
    width: 54px; height: 60px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 26px;
    border: 1.5px solid var(--sd-gold); border-radius: 6px 6px 27px 27px; background: #fff;
}
.sd-eyebrow { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--sd-gold-ink); font-weight: 700; }
.sd-title { font-family: var(--sd-serif); font-size: 30px; font-weight: 700; color: var(--sd-deep); margin: 2px 0 0; line-height: 1.1; }
.sd-window { margin-left: auto; text-align: right; font-size: 12px; color: var(--sd-ink-2); line-height: 1.6; }
.sd-window strong { color: var(--sd-deep); }

.sd-filters { display: flex; flex-wrap: wrap; gap: 10px 26px; padding: 12px 0 2px; }
.sd-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sd-filter-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--sd-muted); margin-right: 4px; font-weight: 600; }
.sd-pill {
    border: 1px solid var(--sd-line); background: #fff; color: var(--sd-ink-2);
    border-radius: 999px; padding: 5px 13px; font-size: 13px; cursor: pointer; min-height: 30px;
}
.sd-pill:hover { border-color: var(--sd-green); color: var(--sd-deep); }
.sd-pill.on { background: var(--sd-deep); border-color: var(--sd-deep); color: #fff; }
.sd-pill-sub { font-size: 11px; opacity: .7; }
.sd-caveat { margin-top: 12px; padding: 10px 14px; background: #fdf3e1; border-left: 3px solid var(--sd-gold); border-radius: 4px; font-size: 13px; color: #5e3a12; }

/* ---- KPI strip ------------------------------------------------------- */
.sd-kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.sd-kpi { background: var(--sd-panel); border: 1px solid var(--sd-line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.sd-kpi-value { font-size: 24px; font-weight: 700; color: var(--sd-deep); line-height: 1.15; white-space: nowrap; }
.sd-kpi-label { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--sd-ink-2); margin-top: 4px; }
.sd-kpi-sub { font-size: 11.5px; color: var(--sd-green); margin-top: 2px; }

/* ---- layout ---------------------------------------------------------- */
.sd-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.sd-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sd-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sd-panel { background: var(--sd-panel); border: 1px solid var(--sd-line); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.sd-panel.sd-compact { padding: 12px 12px 8px; }
.sd-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sd-panel h3 { font-family: var(--sd-serif); font-size: 17px; font-weight: 700; color: var(--sd-deep); margin: 0; line-height: 1.25; }
.sd-sub { font-size: 11.5px; color: var(--sd-muted); margin-top: 2px; }
.sd-empty { font-size: 13px; color: var(--sd-muted); margin: 6px 0; }
.sd-link { border: 0; background: none; color: var(--sd-green); font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 0; white-space: nowrap; }
.sd-link:hover { text-decoration: underline; }
.sd-seg { display: inline-flex; border: 1px solid var(--sd-line); border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.sd-seg button { border: 0; background: #fff; padding: 3px 10px; font-size: 12px; color: var(--sd-ink-2); cursor: pointer; }
.sd-seg button.on { background: var(--sd-deep); color: #fff; }

/* ---- hole column chart ---------------------------------------------- */
.sd-cols { position: relative; height: 170px; display: flex; align-items: flex-end; gap: 2px; margin: 18px 0 0 28px; }
.sd-grid-lines { position: absolute; inset: 0; pointer-events: none; }
.sd-tick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--sd-grid); }
.sd-tick span { position: absolute; left: -28px; top: -7px; width: 22px; text-align: right; font-size: 10px; color: var(--sd-muted); font-variant-numeric: tabular-nums; }
.sd-col-slot { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; cursor: default; outline: none; }
.sd-col-slot:focus-visible { box-shadow: inset 0 0 0 2px var(--sd-gold); border-radius: 4px; }
.sd-bar { width: 100%; max-width: 24px; background: var(--sd-green); border-radius: 4px 4px 0 0; position: relative; min-height: 1px; }
.sd-col-slot:hover .sd-bar, .sd-col-slot:focus .sd-bar { background: var(--sd-deep); }
.sd-cap { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 2px; font-size: 10.5px; font-weight: 700; color: var(--sd-ink); white-space: nowrap; }
.sd-xaxis { display: flex; gap: 2px; margin-left: 28px; border-top: 1px solid #cfcabd; padding-top: 4px; }
.sd-xaxis div { flex: 1 1 0; text-align: center; font-size: 10.5px; color: var(--sd-ink-2); line-height: 1.2; min-width: 0; }
.sd-xaxis b { display: block; font-weight: 600; }
.sd-xaxis span { display: block; font-size: 9px; color: var(--sd-muted); }

/* ---- score mix stacked bar ------------------------------------------ */
.sd-stack { display: flex; gap: 2px; height: 34px; border-radius: 4px; overflow: hidden; }
.sd-seg-fill { display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; min-width: 3px; outline: none; }
.sd-seg-fill:focus-visible { box-shadow: inset 0 0 0 2px var(--sd-ink); }
.sd-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--sd-ink-2); }
.sd-key { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.sd-key i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sd-key b { color: var(--sd-ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- tables ---------------------------------------------------------- */
.sd-table-wrap { max-height: 300px; overflow: auto; }
/* portal-base.css gives every table a 500px min-width on phones and a coloured
   thead — neither belongs here. */
.sd table.sd-table { width: 100%; min-width: 0; margin: 0; border-collapse: collapse; font-size: 12.5px; }
.sd .sd-table thead { background: none; color: inherit; }
.sd-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--sd-muted); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--sd-line); background: transparent; }
.sd-table td { padding: 6px 6px; border-bottom: 1px solid var(--sd-grid); color: var(--sd-ink); }
.sd-table tr:last-child td { border-bottom: 0; }
.sd-table .n { text-align: right; font-variant-numeric: tabular-nums; }
.sd-table.sd-dark-head thead th { background: var(--sd-deep); color: #fff; }
.sd-table.sd-dark-head thead th:first-child { border-radius: 4px 0 0 4px; }
.sd-table.sd-dark-head thead th:last-child { border-radius: 0 4px 4px 0; }
.sd-table td.sd-gold { color: var(--sd-gold-ink); font-weight: 600; }
.sd-table th small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.sd-dd td { vertical-align: top; }
.sd-dd-score { font-size: 11px; color: var(--sd-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sd-dd-none td { color: var(--sd-muted); font-style: italic; }

/* ---- months ---------------------------------------------------------- */
.sd-months { display: flex; gap: 4px; align-items: stretch; }
.sd-mcol { flex: 1 1 0; min-width: 0; text-align: center; outline: none; }
.sd-mcol:focus-visible { box-shadow: 0 0 0 2px var(--sd-gold); border-radius: 4px; }
.sd-mbar-wrap { height: 92px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 1px solid #cfcabd; }
.sd-mbar { width: 100%; max-width: 24px; background: var(--sd-green); border-radius: 4px 4px 0 0; }
.sd-mcol:hover .sd-mbar { background: var(--sd-deep); }
.sd-mval { font-size: 10.5px; color: var(--sd-ink-2); margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.sd-mlab { font-size: 10.5px; color: var(--sd-ink-2); margin-top: 4px; }
.sd-mcol.future .sd-mlab { color: #c4c0b4; }

/* ---- highlight cards ------------------------------------------------- */
.sd-hl { background: var(--sd-panel); border: 1px solid var(--sd-line); border-top: 3px solid var(--sd-gold); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.sd-hl-label { font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--sd-muted); font-weight: 600; }
.sd-hl-value { font-size: 30px; font-weight: 700; color: var(--sd-deep); line-height: 1.15; margin-top: 6px; }
.sd-hl-value small { font-size: 14px; font-weight: 600; color: var(--sd-ink-2); }
.sd-hl-who .sd-player { font-weight: 700; font-size: 14px; }
.sd-hl-when { font-size: 11.5px; color: var(--sd-green); }
.sd-hl-tie { font-size: 11px; color: var(--sd-muted); margin-top: 4px; }

/* ---- leaderboards ---------------------------------------------------- */
.sd-board { list-style: none; margin: 0; padding: 0; }
.sd-board li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--sd-grid); font-size: 13.5px; }
.sd-board li:last-child { border-bottom: 0; }
.sd-medal { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: #efece4; color: var(--sd-ink-2); }
.sd-medal.gold { background: var(--sd-gold); color: #fff; }
.sd-board-name { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sd-board-note { font-size: 11px; color: var(--sd-muted); }
.sd-board-val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sd-board-val small { font-weight: 400; color: var(--sd-muted); font-size: 11.5px; }
.sd-player { border: 0; background: none; padding: 0; color: var(--sd-ink); cursor: pointer; text-align: left; font-weight: 600; }
.sd-player:hover, .sd-player:focus-visible { color: var(--sd-green); text-decoration: underline; outline: none; }

.sd-foot { font-size: 11px; color: var(--sd-muted); margin: 14px 0 0; line-height: 1.5; border-top: 1px solid var(--sd-line); padding-top: 10px; }

.sd-tooltip {
    position: fixed; z-index: 10000; pointer-events: none; display: none;
    background: #10261a; color: #fff; border-radius: 6px; padding: 7px 10px;
    font-size: 12px; line-height: 1.45; box-shadow: 0 4px 14px rgba(0,0,0,.25); max-width: 240px;
}
.sd-tooltip b { display: block; margin-bottom: 1px; }

/* ---- responsive ------------------------------------------------------ */
@media (max-width: 1180px) {
    .sd-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sd-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .sd-col-a { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .sd { padding: 16px 14px 12px; border-radius: 10px; }
    .sd-head { flex-wrap: wrap; gap: 10px; }
    .sd-crest { width: 42px; height: 48px; font-size: 20px; }
    .sd-title { font-size: 23px; }
    .sd-window { margin-left: 0; text-align: left; width: 100%; }
    .sd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .sd-kpi-value { font-size: 21px; }
    .sd-grid { grid-template-columns: minmax(0, 1fr); }
    .sd-pair { grid-template-columns: minmax(0, 1fr); }
    .sd-cols { height: 150px; gap: 1px; }
    .sd-xaxis { gap: 1px; }
    .sd-xaxis span { display: none; }
    .sd-filter-label { width: 100%; }
}
@media (max-width: 420px) {
    .sd-months { gap: 2px; }
    .sd-mval { font-size: 9px; }
    .sd-mlab { font-size: 9px; }
}
