/* ================================================================
   SPORADIC-E MONITOR — Stylesheet
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-dark:       #0d1117;
    --bg-card:       #161b22;
    --bg-card2:      #1c2128;
    --border:        #30363d;
    --text-primary:  #e6edf3;
    --text-muted:    #8b949e;
    --accent-blue:   #58a6ff;
    --accent-green:  #3fb950;
    --accent-orange: #d29922;
    --accent-red:    #f85149;
}

html, body {
    height: 100%; margin: 0; padding: 0; overflow: hidden;
    background: var(--bg-dark); color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

/* ===== PAGE WRAPPER ===== */
#page-wrap {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ===== HEADER ===== */
#app-header {
    background: #0f3460;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex; align-items: center;
    height: 54px; flex-shrink: 0; gap: 12px;
    position: relative; z-index: 1100;
}
#app-header h1 {
    font-size: 1.1em; font-weight: 700;
    color: var(--accent-blue); flex: 1; white-space: nowrap;
}
#app-header h1 small {
    color: var(--text-muted); font-weight: 400;
    font-size: 0.8em; margin-left: 6px;
}

.hbadge {
    padding: 3px 10px; border-radius: 20px; font-size: 0.78em; font-weight: 700;
    background: var(--bg-card2); border: 1px solid var(--border); color: var(--text-muted);
    transition: all .3s; white-space: nowrap;
}
.hbadge.active   { background: rgba(248,81,73,.2);  border-color: var(--accent-red);    color: var(--accent-red);    }
.hbadge.elevated { background: rgba(210,153,34,.2); border-color: var(--accent-orange); color: var(--accent-orange); }
.hbadge.low      { background: rgba(63,185,80,.2);  border-color: var(--accent-green);  color: var(--accent-green);  }

#last-upd { font-size: 0.72em; color: var(--text-muted); white-space: nowrap; }

.hbtn {
    background: var(--bg-card2); border: 1px solid var(--border);
    color: var(--text-primary); padding: 5px 10px; border-radius: 6px;
    cursor: pointer; font-size: 0.8em; transition: background .2s; white-space: nowrap;
}
.hbtn:hover { background: #2d333b; }

/* Alert button — red when alerts are enabled */
#btn-notify.alert-active {
    background: rgba(248,81,73,.2);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* ===== API STATUS BAR ===== */
#api-status {
    font-size: .75em; padding: 5px 20px;
    background: var(--bg-card); border-bottom: 1px solid var(--border);
    display: flex; gap: 12px; flex-wrap: wrap; align-items: center; flex-shrink: 0;
    position: relative; z-index: 1090;
}
.api-dot { display: inline-flex; align-items: center; gap: 4px; }
.api-dot .dot { width: 7px; height: 7px; border-radius: 50%; }
.dot-ok   { background: var(--accent-green); }
.dot-err  { background: var(--accent-red); }
.dot-load { background: var(--accent-orange); animation: blink .8s ease infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ===== TABS ===== */
#tab-nav {
    display: flex; background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 20px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0;
    position: relative; z-index: 1080;
}
#tab-nav::-webkit-scrollbar { display: none; }
.tbtn {
    padding: 10px 16px; background: none; border: none;
    border-bottom: 2px solid transparent; color: var(--text-muted);
    cursor: pointer; font-size: 0.85em; font-weight: 500;
    white-space: nowrap; transition: color .2s, border-color .2s;
}
.tbtn:hover { color: var(--text-primary); }
.tbtn.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }

/* ===== MAIN ===== */
#main { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.tab-pane { display: none; position: absolute; inset: 0; }
.tab-pane.scrollable { overflow-y: auto; padding: 14px 20px; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; padding: 14px; margin-bottom: 12px;
    position: relative;
}
.ctitle {
    font-size: 0.78em; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px;
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
}

/* ===== STAT TILES ===== */
.stile {
    background: var(--bg-card2); border: 1px solid var(--border);
    border-radius: 8px; padding: 16px 14px; text-align: center;
    display: flex; flex-direction: column; justify-content: center;
    min-height: 120px; position: relative; cursor: default;
}
.stile .sv { font-size: 3.2em; font-weight: 900; line-height: 1.05; transition: color .4s; }
.stile .sl { font-size: 0.72em; color: var(--text-muted); margin-top: 5px; }
.stile .ss { font-size: 0.68em; color: var(--text-muted); margin-top: 3px; }

/* ===== STAT ROW ===== */
#stat-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
#stat-row.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media(max-width:1100px){ #stat-row { grid-template-columns: repeat(3,1fr); } }
@media(max-width:700px)  { #stat-row { grid-template-columns: repeat(2,1fr); } }
@media(max-width:400px)  { #stat-row { grid-template-columns: 1fr; } }

/* ===== SCORE WIDGET ===== */
#score-widget {
    text-align: center; padding: 16px 14px; border-radius: 10px;
    background: linear-gradient(145deg,var(--bg-card2),var(--bg-card));
    border: 1px solid var(--border); transition: all .5s;
    display: flex; flex-direction: column; justify-content: center;
    min-height: 120px; cursor: default; position: relative;
}
#score-num  { font-size: 3.8em; font-weight: 900; line-height: 1; transition: color .5s; color: var(--text-muted); }
#score-lbl  { font-size: 0.72em; color: var(--text-muted); margin-top: 3px; }
.divider    { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
#score-stat { font-size: .88em; font-weight: 600; margin-top: 4px; }
#score-sub  { font-size: .68em; color: var(--text-muted); margin-top: 3px; }
@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0   rgba(248,81,73,.5); }
    70%  { box-shadow: 0 0 0 14px rgba(248,81,73,0); }
    100% { box-shadow: 0 0 0 0   rgba(248,81,73,0); }
}
#score-widget.pulsing { animation: pulse-ring 2s ease infinite; }

/* ===== GRIDS ===== */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media(max-width:900px) { .g3 { grid-template-columns: 1fr 1fr; } .g2 { grid-template-columns: 1fr; } }
@media(max-width:550px) { .g3 { grid-template-columns: 1fr; } }

/* ===== BOTTOM GRID ROW 1 (DX Spots | Active Stations | ES Ticker) ===== */
#bottom-grid-row1 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
#bottom-grid-row1.ticker-hidden { grid-template-columns: 1fr 1fr; }
@media(max-width:900px) { #bottom-grid-row1 { grid-template-columns: 1fr 1fr; } }
@media(max-width:550px) { #bottom-grid-row1 { grid-template-columns: 1fr; } }

/* ===== BOTTOM GRID ROW 2 (Kp | Monthly | Hourly) ===== */
#bottom-grid-row2 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
@media(max-width:900px) { #bottom-grid-row2 { grid-template-columns: 1fr 1fr; } }
@media(max-width:550px) { #bottom-grid-row2 { grid-template-columns: 1fr; } }

/* ===== ACTIVE STATIONS ===== */
#active-stations-card { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
#active-st-inner { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ===== DASHBOARD MAP ===== */
#dash-map-legend {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    font-size: .74em; color: var(--text-muted); margin-bottom: 8px;
    padding: 5px 2px; border-bottom: 1px solid var(--border);
}
#dash-map-legend span { display: inline-flex; align-items: center; gap: 4px; }
.leg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

#es-map-mini {
    border-radius: 6px; border: 1px solid var(--border);
    height: 290px; width: 100%;
}

/* ===== LEAFLET POPUPS ===== */
.leaflet-popup-content-wrapper {
    background: var(--bg-card2) !important; color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,.6) !important; border-radius: 8px !important;
}
.leaflet-popup-tip { background: var(--bg-card2) !important; }
.leaflet-popup-content { font-size: .82em; line-height: 1.6; }
.pu-title { color: var(--accent-blue); font-weight: 700; margin-bottom: 3px; }
.pu-val   { color: var(--accent-green); font-weight: 700; }
.pu-alert { color: var(--accent-red);   font-weight: 700; }

#loc-picker-map { cursor: crosshair !important; }
#loc-picker-map .leaflet-container { cursor: crosshair !important; }

/* ===== FORECAST ===== */
#fc-card { display: flex; flex-direction: column; height: 344px; }
#fc-mini { flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 4px 0; overflow: hidden; }
.fc-row  { display: flex; align-items: center; gap: 8px; flex: 1; min-height: 14px; }
.fc-lbl  { width: 58px; font-size: .71em; color: var(--text-muted); text-align: right; flex-shrink: 0; }
.fc-track { flex: 1; background: rgba(255,255,255,.07); border-radius: 4px; height: 100%; min-height: 12px; max-height: 26px; overflow: hidden; }
.fc-fill  { height: 100%; border-radius: 4px; transition: width .7s ease; }
.fc-pct   { width: 32px; font-size: .71em; font-weight: 700; text-align: right; flex-shrink: 0; }
.fc-lvl   { width: 40px; font-size: .62em; padding: 2px 3px; border-radius: 3px; text-align: center; flex-shrink: 0; }
.lv-h { background: rgba(248,81,73,.2);  color: var(--accent-red);    }
.lv-m { background: rgba(210,153,34,.2); color: var(--accent-orange); }
.lv-l { background: rgba(63,185,80,.2);  color: var(--accent-green);  }

/* ===== IONOSONDE TABLE ===== */
#tab-iono { flex-direction: column; overflow: hidden; }
#iono-scroll { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.itbl { width: 100%; border-collapse: collapse; font-size: 1em; }
.itbl th {
    text-align: left; padding: 11px 14px; color: var(--text-muted); font-size: .86em; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--bg-card); z-index: 2;
}
.itbl td { padding: 11px 14px; border-bottom: 1px solid rgba(48,54,61,.45); vertical-align: middle; font-size: .97em; }
.itbl tr:last-child td { border-bottom: none; }
.itbl tr:hover td { background: rgba(255,255,255,.04); }
.itbl tr.rfm td { background: rgba(248,81,73,.09); }
.itbl tr.res td { background: rgba(210,153,34,.09); }
.fv   { font-weight: 800; font-size: 1.2em; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: .78em; font-weight: 700; }
.pfm  { background: rgba(248,81,73,.2);  color: var(--accent-red);    border: 1px solid rgba(248,81,73,.4); }
.p6m  { background: rgba(210,153,34,.2); color: var(--accent-orange); border: 1px solid rgba(210,153,34,.4); }
.plo  { background: rgba(63,185,80,.2);  color: var(--accent-green);  border: 1px solid rgba(63,185,80,.4); }
.pno  { background: rgba(139,148,158,.2);color: var(--text-muted);    border: 1px solid rgba(139,148,158,.3); }

/* ===== SPOTS / TICKER ===== */
.spot-list { display: flex; flex-direction: column; gap: 4px; }
.sitem {
    display: flex; align-items: center; gap: 7px;
    background: var(--bg-card2); border: 1px solid var(--border);
    border-radius: 6px; padding: 6px 9px; font-size: .78em;
}
.sitem.ses { border-left: 3px solid var(--accent-red); }
.sband  { flex-shrink:0; padding:1px 6px; border-radius:4px; font-weight:700; font-size:.75em; background:rgba(88,166,255,.15); color:var(--accent-blue); border:1px solid rgba(88,166,255,.3); }
.sfreq  { font-weight: 700; color: var(--accent-green); flex-shrink: 0; min-width: 72px; }
.sdx    { font-weight: 600; flex-shrink: 0; min-width: 75px; }
.scmt   { color: var(--text-muted); font-style: italic; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stim   { color: var(--text-muted); flex-shrink: 0; font-size: .82em; }

/* DX Spots status info row */
.dx-status-info {
    font-size: .74em; color: var(--text-muted); margin-bottom: 8px;
    padding: 6px 10px; background: rgba(88,166,255,.06); border: 1px solid rgba(88,166,255,.15);
    border-radius: 6px; display: none; line-height: 1.5;
}
.dx-status-info.visible { display: block; }
.api-live-badge {
    font-size: .7em; font-weight: 700; color: var(--accent-green);
    background: rgba(63,185,80,.12); border: 1px solid rgba(63,185,80,.3);
    padding: 1px 7px; border-radius: 10px; white-space: nowrap;
}
.cnt-badge {
    background: rgba(88,166,255,.15); color: var(--accent-blue);
    padding: 2px 7px; border-radius: 10px; font-size: .85em;
}
.ticker-age {
    background: rgba(248,81,73,.15); color: var(--accent-red);
    padding: 2px 7px; border-radius: 10px; font-size: .85em;
}

/* ===== TICKER FILTER BADGE ===== */
#ticker-filter-badge {
    background: rgba(88,166,255,.12); color: var(--accent-blue);
    border: 1px solid rgba(88,166,255,.3);
    padding: 1px 8px; border-radius: 10px; font-size: .78em;
    font-weight: 500; white-space: nowrap; font-style: normal;
    letter-spacing: 0;
}

/* ===== KP CHART ===== */
.kp-wrap { display: flex; align-items: flex-end; gap: 3px; height: 55px; }
.kp-bw   { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; height: 100%; justify-content: flex-end; }
.kp-bar  { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; }
.kp-lb   { font-size: .58em; color: var(--text-muted); }

/* ===== STATIC CHARTS (season / hourly) ===== */
.schart-wrap { display: flex; flex-direction: column; gap: 0; }
.schart-bars { display: flex; align-items: flex-end; gap: 2px; height: 52px; }
.schart-axis { display: flex; align-items: flex-start; padding-top: 3px; }
.schart-axis-cell {
    font-size: .58em; color: var(--text-muted);
    text-align: center; flex: 1; line-height: 1;
    white-space: nowrap; overflow: hidden;
}

/* ===== SETTINGS ===== */
.scard {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; padding: 16px; margin-bottom: 12px;
}
.scard-title {
    font-size: .85em; font-weight: 700; color: var(--accent-blue);
    margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 6px;
}
.sg { margin-bottom: 12px; }
.sg:last-child { margin-bottom: 0; }
.sg label { display: block; font-size: .78em; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.sg input[type=number], .sg input[type=text], .sg select {
    width: 150px; padding: 8px 10px;
    background: var(--bg-card2); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary); font-size: .84em; outline: none; transition: border-color .2s;
}
.sg input:focus, .sg select:focus { border-color: var(--accent-blue); }
.sg .hint { font-size: .69em; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }

/* ===== TOGGLE SWITCH ===== */
.toggle-row {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 10px; padding: 8px 0;
    border-bottom: 1px solid rgba(48,54,61,.5); width: 100%;
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row-info { text-align: right; }
.toggle-row-info span { font-size: .82em; color: var(--text-primary); font-weight: 500; }
.toggle-row-info small { display: block; font-size: .69em; color: var(--text-muted); margin-top: 1px; }
.tgl { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.tgl input { opacity: 0; width: 0; height: 0; }
.tgl-s { position: absolute; cursor: pointer; inset: 0; background: #444d56; border-radius: 20px; transition: .3s; }
.tgl-s:before { content:''; position: absolute; width: 14px; height: 14px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: .3s; }
.tgl input:checked + .tgl-s { background: var(--accent-blue); }
.tgl input:checked + .tgl-s:before { transform: translateX(16px); }

/* Map pick button */
.btn-map-pick {
    width: 100%; padding: 9px 14px; border-radius: 6px; border: 1px dashed var(--accent-blue);
    background: rgba(88,166,255,.08); color: var(--accent-blue); font-size: .83em;
    font-weight: 600; cursor: pointer; transition: background .2s; text-align: left;
}
.btn-map-pick:hover { background: rgba(88,166,255,.18); }

/* ===== BAND FILTER BUTTONS ===== */
.bands-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.band-btn {
    padding: 4px 13px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card2);
    color: var(--text-muted);
    cursor: pointer;
    font-size: .80em;
    font-weight: 600;
    transition: all .2s;
    user-select: none;
    /* de-selected = dimmed, no colour */
}
.band-btn:hover {
    background: rgba(255,255,255,.06);
    border-color: var(--text-muted);
    color: var(--text-primary);
}
/* Selected state — each band gets its own accent colour */
.band-btn.sel[data-band="6m"]   { background: rgba(248,81,73,.2);  border-color: rgba(248,81,73,.6);  color: var(--accent-red);    }
.band-btn.sel[data-band="4m"]   { background: rgba(210,153,34,.2); border-color: rgba(210,153,34,.6); color: var(--accent-orange); }
.band-btn.sel[data-band="2m"]   { background: rgba(88,166,255,.2); border-color: rgba(88,166,255,.6); color: var(--accent-blue);   }
.band-btn.sel[data-band="70cm"] { background: rgba(139,148,158,.15);border-color: rgba(139,148,158,.5);color: var(--text-primary); }
.band-btn.sel[data-band="FM"]   { background: rgba(63,185,80,.2);  border-color: rgba(63,185,80,.6);  color: var(--accent-green);  }
.band-btn.sel[data-band="VHF"]  { background: rgba(88,166,255,.12);border-color: rgba(88,166,255,.4); color: var(--accent-blue);   }

/* ===== COUNTRY FILTER ===== */
.country-group-header {
    grid-column: 1 / -1;
    font-size: .72em; font-weight: 700; color: var(--accent-blue);
    text-transform: uppercase; letter-spacing: .07em;
    padding: 6px 4px 3px; border-bottom: 1px solid var(--border); margin-top: 4px;
}
.continent-btns { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.cbtn {
    padding: 4px 12px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-card2); color: var(--text-muted); cursor: pointer;
    font-size: .78em; transition: all .2s; user-select: none;
}
.cbtn:hover, .cbtn.sel {
    background: rgba(88,166,255,.2); border-color: var(--accent-blue); color: var(--accent-blue);
}
.country-tag-wrap {
    display: flex; flex-wrap: wrap; gap: 5px; padding: 8px;
    background: var(--bg-card2); border: 1px solid var(--border);
    border-radius: 6px; min-height: 36px; margin-bottom: 10px;
}
.ctag {
    display: inline-flex; align-items: center; gap: 3px;
    background: rgba(88,166,255,.15); border: 1px solid rgba(88,166,255,.35);
    border-radius: 12px; padding: 2px 8px 2px 6px;
    font-size: .76em; color: var(--accent-blue); cursor: pointer;
    transition: all .2s; white-space: nowrap;
}
.ctag:hover { background: rgba(248,81,73,.2); border-color: var(--accent-red); color: var(--accent-red); }
.ctag .cx { font-weight: 700; font-size: .9em; margin-left: 2px; }
.country-search-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.country-search-row input {
    flex: 1; padding: 7px 10px; background: var(--bg-card2); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary); font-size: .83em; outline: none;
}
.country-search-row input:focus { border-color: var(--accent-blue); }
.country-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr));
    gap: 3px; max-height: 320px; overflow-y: auto; padding: 4px;
    background: var(--bg-card2); border: 1px solid var(--border);
    border-radius: 6px; scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.citem {
    display: flex; align-items: center; gap: 6px; padding: 5px 8px;
    border-radius: 5px; cursor: pointer; font-size: .78em;
    transition: background .15s; border: 1px solid transparent; user-select: none;
}
.citem:hover { background: rgba(255,255,255,.06); }
.citem.sel { background: rgba(88,166,255,.15); border-color: rgba(88,166,255,.4); color: var(--accent-blue); }
.citem.cont-mode { opacity: .5; pointer-events: none; }
.citem .cflag { width: 18px; height: auto; flex-shrink: 0; border-radius: 2px; }
.citem .cname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citem .ccode { font-size: .7em; color: var(--text-muted); flex-shrink: 0; font-weight: 600; }
.citem.sel .ccode { color: var(--accent-blue); opacity: .8; }

/* ===== BUTTONS ===== */
.btn-p {
    background: var(--accent-blue); color: #000; border: none;
    padding: 8px 18px; border-radius: 6px; cursor: pointer; font-size: .85em; font-weight: 700;
}
.btn-p:hover { background: #79c0ff; }
.btn-d {
    background: rgba(248,81,73,.15); color: var(--accent-red);
    border: 1px solid var(--accent-red); padding: 8px 18px;
    border-radius: 6px; cursor: pointer; font-size: .85em; font-weight: 700;
}
.btn-d:hover { background: rgba(248,81,73,.25); }
.btn-sm {
    padding: 6px 12px; border-radius: 6px; border: none; cursor: pointer;
    font-size: .78em; font-weight: 600; background: var(--accent-blue); color: #000; white-space: nowrap;
}
.btn-sm:hover { background: #79c0ff; }
.btn-sm-danger {
    background: rgba(248,81,73,.15); color: var(--accent-red); border: 1px solid rgba(248,81,73,.5);
}
.btn-sm-danger:hover { background: rgba(248,81,73,.3); }

/* ===== GLOBAL HOVER TOOLTIP ===== */
.card-tooltip { display: none !important; }

#card-tooltip-box {
    display: none; position: fixed; z-index: 99998;
    background: var(--bg-card2); border: 1px solid var(--accent-blue);
    border-radius: 8px; padding: 10px 13px; font-size: .76em;
    color: var(--text-muted); max-width: 300px; line-height: 1.55;
    box-shadow: 0 4px 24px rgba(0,0,0,.8); pointer-events: none;
}
#card-tooltip-box b { color: var(--accent-blue); display: block; margin-bottom: 4px; font-size: 1.05em; }
#card-tooltip-box .tip-row { margin-bottom: 2px; }
#card-tooltip-box .tip-row span { color: var(--text-primary); font-weight: 600; }

/* ===== LOCATION PICKER MODAL ===== */
.loc-modal {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(3px);
}
.loc-modal-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; width: min(92vw, 740px);
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,.8);
}
.loc-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px; background: var(--bg-card2); border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: .95em; color: var(--accent-blue);
}
.loc-modal-close {
    background: none; border: none; color: var(--text-muted); font-size: 1.1em;
    cursor: pointer; padding: 2px 6px; border-radius: 4px; transition: color .2s;
}
.loc-modal-close:hover { color: var(--accent-red); }
.loc-modal-hint {
    padding: 8px 18px; font-size: .75em; color: var(--text-muted);
    background: rgba(88,166,255,.06); border-bottom: 1px solid var(--border);
}
#loc-picker-map { height: 400px; width: 100%; }
.loc-modal-footer {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    padding: 12px 18px; background: var(--bg-card2); border-top: 1px solid var(--border);
}
.loc-coords { font-size: .82em; color: var(--accent-green); font-weight: 700; font-family: monospace; }

.picker-crosshair { width: 32px; height: 32px; position: relative; }
.picker-crosshair::before,
.picker-crosshair::after { content: ''; position: absolute; background: var(--accent-red); }
.picker-crosshair::before { left: 50%; top: 0; width: 2px; height: 100%; transform: translateX(-50%); }
.picker-crosshair::after  { top: 50%; left: 0; height: 2px; width: 100%; transform: translateY(-50%); }

/* ===== MISC ===== */
.no-data { color: var(--text-muted); font-style: italic; padding: 10px 0; text-align: center; }
.spinner {
    display: inline-block; width: 13px; height: 13px;
    border: 2px solid rgba(255,255,255,.12); border-top-color: var(--accent-blue);
    border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skel {
    background: linear-gradient(90deg, var(--bg-card2) 25%, rgba(255,255,255,.05) 50%, var(--bg-card2) 75%);
    background-size: 200% 100%; animation: skel-anim 1.4s infinite;
    border-radius: 4px; height: 14px;
}
@keyframes skel-anim { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ===== TIME CHART WRAP (Hourly Es Probability) ===== */
.time-chart-wrap { display: flex; flex-direction: column; gap: 4px; }
.time-chart-bars { display: flex; align-items: flex-end; gap: 1px; height: 50px; }
.time-chart-bars .tc-bar { flex: 1; border-radius: 2px 2px 0 0; min-height: 2px; transition: opacity .2s; }
.time-chart-bars .tc-bar:hover { opacity: .75; }
.time-chart-axis { display: flex; justify-content: space-between; padding: 0 1px; }
.time-chart-axis span {
    font-size: .60em; color: var(--text-muted);
    width: 0; text-align: center; white-space: nowrap; overflow: visible;
}

/* ===== MAP TAB — kept to prevent stale cache issues ===== */
#tab-map { display: none !important; }
#map-legend { display: none !important; }
#es-map { display: none !important; }