/* MosquiSenseAI — application styles. Loaded after /css/seo-pages.min.css
 * (inherits :root tokens: --bg --bg2 --surface --border --text --text2 --accent).
 * Mobile-first. */
.msa-wrap { max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.msa-wrap--wide { max-width: 1140px; }

/* status chips */
.msa-status {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: .32rem .7rem; border-radius: 99px;
  background: rgba(240, 165, 0, .1); border: 1px solid rgba(240, 165, 0, .35); color: var(--accent);
}
.msa-status--ok { background: rgba(16, 185, 129, .1); border-color: rgba(16, 185, 129, .4); color: #34d399; }
.msa-status--warn { background: rgba(240, 165, 0, .1); border-color: rgba(240, 165, 0, .4); color: var(--accent); }
.msa-status--off { background: rgba(152, 150, 184, .1); border-color: rgba(152, 150, 184, .3); color: var(--text2); }
.msa-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* cards */
.msa-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.15rem; margin-bottom: 1rem;
}
.msa-card__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.msa-card__title { font-size: .95rem; font-weight: 800; letter-spacing: .01em; }
.msa-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.55rem; height: 1.55rem; border-radius: 50%;
  background: rgba(240, 165, 0, .14); color: var(--accent);
  font-size: .78rem; font-weight: 800; margin-right: .5rem; flex: none;
}
.msa-note { font-size: .8rem; color: var(--text2); line-height: 1.65; }
.msa-note--warn {
  background: rgba(240, 165, 0, .07); border: 1px solid rgba(240, 165, 0, .3);
  border-radius: 10px; padding: .7rem .85rem; color: #ffe9c4;
}
.msa-note--stop {
  background: rgba(255, 90, 90, .08); border: 1px solid rgba(255, 90, 90, .35);
  border-radius: 10px; padding: .7rem .85rem; color: #ffd7d7;
}
.msa-note--calm {
  background: rgba(56, 189, 248, .07); border: 1px solid rgba(56, 189, 248, .3);
  border-radius: 10px; padding: .7rem .85rem; color: #bfe7ff;
}

/* drop zone + preview */
.msa-drop {
  border: 1.6px dashed rgba(255, 255, 255, .16); border-radius: 14px;
  padding: 1.4rem 1rem; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s; background: var(--bg2);
}
.msa-drop:hover, .msa-drop:focus-visible, .msa-drop.is-over,
.msa-drop:has(input[type=file]:focus-visible) { border-color: var(--accent); background: rgba(240, 165, 0, .05); }
.msa-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.msa-drop-title { font-weight: 800; font-size: .95rem; margin-bottom: .3rem; }
.msa-drop-sub { font-size: .78rem; color: var(--text2); }
.msa-preview { display: none; gap: .9rem; margin-top: .9rem; align-items: flex-start; }
.msa-preview.show { display: flex; flex-wrap: wrap; }
.msa-preview img {
  width: 160px; height: 160px; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg2);
}
.msa-preview-meta { font-size: .8rem; color: var(--text2); line-height: 1.8; min-width: 180px; }
.msa-preview-meta b { color: var(--text); font-weight: 700; }

/* buttons */
.msa-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: 700 .88rem/1 var(--b); padding: .78rem 1.3rem; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer; transition: all .18s;
  background: var(--accent); color: #000;
}
.msa-btn:hover { box-shadow: 0 0 22px rgba(240, 165, 0, .3); }
.msa-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.msa-btn--ghost { background: transparent; border-color: var(--border); color: var(--text2); }
.msa-btn--ghost:hover { border-color: var(--accent); color: var(--text); box-shadow: none; }
.msa-btn--danger { background: rgba(255, 90, 90, .12); border-color: rgba(255, 90, 90, .45); color: #ffb4b4; }
.msa-btn--sm { padding: .5rem .85rem; font-size: .8rem; border-radius: 8px; }
.msa-btnrow { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .9rem; }

/* forms */
.msa-field { margin-bottom: .85rem; }
.msa-label { display: block; font-size: .78rem; font-weight: 700; color: var(--text2); margin-bottom: .38rem; text-transform: uppercase; letter-spacing: .05em; }
.msa-input, .msa-select, .msa-textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); font: 500 .88rem/1.4 var(--b);
  padding: .62rem .7rem; min-height: 42px;
}
.msa-textarea { min-height: 74px; resize: vertical; }
.msa-input:focus, .msa-select:focus, .msa-textarea:focus { outline: 2px solid rgba(240, 165, 0, .5); outline-offset: 1px; }
/* WCAG: site token --text3 (#55536a) measures 2.46:1 on --surface (#141420) —
 * below the 4.5:1 minimum for small text. Override ONLY on MosquiSenseAI pages. */
.msa-hint, .msa-score-den { color: #8b89a6; } /* ≈5.2:1 on #141420 */
.msa-hint { font-size: .73rem; margin-top: .3rem; line-height: 1.55; }
.msa-radios { display: flex; gap: .45rem; flex-wrap: wrap; }
.msa-radios label {
  font-size: .8rem; font-weight: 600; padding: .5rem .8rem; border-radius: 99px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--text2);
  cursor: pointer; transition: all .15s;
}
.msa-radios input { position: absolute; opacity: 0; pointer-events: none; }
.msa-radios label:hover { border-color: rgba(240, 165, 0, .5); color: var(--text); }
.msa-radios input:checked + span, .msa-radios label.is-on { color: #000; }
.msa-radios label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #000; }
.msa-radios label:has(input:focus-visible) { outline: 2px solid rgba(240, 165, 0, .6); outline-offset: 2px; }
.msa-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 640px) { .msa-grid2 { grid-template-columns: 1fr; } .msa-preview img { width: 120px; height: 120px; } }

/* results */
.msa-result { display: none; }
.msa-result.show { display: block; animation: msa-fade .3s ease; }
@keyframes msa-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .msa-result.show { animation: none; } }

.msa-badge { display: inline-block; font-size: .72rem; font-weight: 800; padding: .3rem .65rem; border-radius: 99px; letter-spacing: .04em; }
.msa-badge--higher { background: rgba(255, 90, 90, .16); color: #ff8f8f; border: 1px solid rgba(255, 90, 90, .45); }
.msa-badge--moderate { background: rgba(240, 165, 0, .14); color: var(--accent); border: 1px solid rgba(240, 165, 0, .45); }
.msa-badge--lower { background: rgba(16, 185, 129, .14); color: #34d399; border: 1px solid rgba(16, 185, 129, .45); }
.msa-badge--insufficient-information, .msa-badge--unknown { background: rgba(152, 150, 184, .14); color: var(--text2); border: 1px solid rgba(152, 150, 184, .4); }
.msa-badge--demo { background: rgba(124, 58, 237, .16); color: #c4b5fd; border: 1px solid rgba(124, 58, 237, .5); }

/* contribution bars */
.msa-contrib { display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; padding: .55rem 0; border-bottom: 1px dashed var(--border); font-size: .82rem; }
.msa-contrib:last-child { border-bottom: 0; }
.msa-contrib-name { font-weight: 700; }
.msa-contrib-val { color: var(--text2); font-size: .78rem; }
.msa-contrib-pts { font-weight: 800; color: var(--accent); white-space: nowrap; }
.msa-contrib-bar { grid-column: 1 / -1; height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.msa-contrib-bar i { display: block; height: 100%; background: linear-gradient(90deg, rgba(240,165,0,.65), var(--accent)); border-radius: 99px; }

/* prediction rows */
.msa-pred { display: grid; grid-template-columns: 1fr 74px; gap: .4rem 1rem; align-items: center; padding: .5rem 0; border-bottom: 1px dashed var(--border); font-size: .82rem; }
.msa-pred:last-child { border-bottom: 0; }
.msa-pred-label { font-weight: 600; overflow-wrap: anywhere; }
.msa-pred-conf { font-weight: 800; text-align: right; color: #7dd3fc; }
.msa-pred-bar { grid-column: 1 / -1; height: 5px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.msa-pred-bar i { display: block; height: 100%; background: #38bdf8; }

/* score readout */
.msa-score { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; margin: .4rem 0 .8rem; }
.msa-score-num { font-family: var(--d); font-size: 3rem; line-height: 1; color: var(--text); }
.msa-score-den { color: var(--text3); font-size: .85rem; font-weight: 700; }

/* spinners */
.msa-busy { display: none; align-items: center; gap: .6rem; font-size: .84rem; color: var(--text2); margin-top: .7rem; }
.msa-busy.show { display: inline-flex; }
.msa-spin {
  width: 15px; height: 15px; border: 2px solid rgba(240, 165, 0, .25);
  border-top-color: var(--accent); border-radius: 50%; animation: msa-spin .8s linear infinite;
}
@keyframes msa-spin { to { transform: rotate(360deg); } }

/* stats cards */
.msa-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.msa-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: .9rem; }
.msa-stat-num { font-family: var(--d); font-size: 2rem; line-height: 1.1; color: var(--text); }
.msa-stat-lbl { font-size: .72rem; color: var(--text2); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }

/* charts */
.msa-chart { width: 100%; overflow: visible; }
.msa-bars { display: flex; flex-direction: column; gap: .55rem; }
.msa-bar { display: grid; grid-template-columns: 130px 1fr 34px; gap: .6rem; align-items: center; font-size: .8rem; }
.msa-bar-track { height: 13px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.msa-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.msa-bar-lbl { color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msa-bar-num { font-weight: 800; text-align: right; }
@media (max-width: 560px) { .msa-bar { grid-template-columns: 96px 1fr 30px; font-size: .74rem; } }

/* table */
.msa-tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.msa-table { width: 100%; border-collapse: collapse; font-size: .8rem; min-width: 560px; }
.msa-table th, .msa-table td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border); }
.msa-table th { background: var(--bg2); color: var(--text2); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.msa-table tr:last-child td { border-bottom: 0; }
.msa-empty { text-align: center; padding: 1.6rem 1rem; color: var(--text2); font-size: .85rem; line-height: 1.7; }
.msa-empty b { color: var(--text); }

/* map */
.msa-map { height: 320px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg2); }
.msa-map-fallback { display: none; padding: .9rem; border: 1px dashed var(--border); border-radius: 12px; font-size: .8rem; color: var(--text2); }
.msa-map-fallback.show { display: block; }
.leaflet-container { border-radius: 12px; background: #0a0a12; font: inherit; }

/* filters */
.msa-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }
.msa-check { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--text2); min-height: 42px; }
.msa-check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* toast */
.msa-toast {
  position: fixed; left: 50%; bottom: -80px; transform: translateX(-50%);
  background: #101020; color: var(--text); border: 1px solid var(--accent);
  padding: .7rem 1.1rem; border-radius: 10px; font-size: .84rem; font-weight: 600;
  z-index: 2000; transition: bottom .28s ease; max-width: 92vw; text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
.msa-toast.show { bottom: 24px; }
.msa-toast.error { border-color: #ff5b5b; color: #ffd7d7; }
.msa-toast.ok { border-color: #10b981; color: #c9f5e3; }

/* landing feature grid */
.msa-feat { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .85rem; }
.msa-feat .msa-card { margin-bottom: 0; height: 100%; }
.msa-feat-icon { font-size: 1.35rem; margin-bottom: .5rem; }
.msa-kv { display: grid; grid-template-columns: 150px 1fr; gap: .4rem .9rem; font-size: .83rem; line-height: 1.6; }
.msa-kv dt { color: var(--text2); font-weight: 700; }
.msa-kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
@media (max-width: 560px) { .msa-kv { grid-template-columns: 1fr; gap: .15rem; } .msa-kv dd { margin-bottom: .5rem; } }

.msa-list { margin: .4rem 0 0 1.1rem; font-size: .84rem; color: var(--text2); line-height: 1.8; }
.msa-list li::marker { color: var(--accent); }

/* anchor targets under fixed nav */
.msa-anchor { scroll-margin-top: 84px; }

/* focus visibility everywhere */
/* WCAG link-in-text-block + contrast: Leaflet's default link (#0078a8 on the
 * semi-transparent plate) measures 3.14:1 — darken to #005a8c (≥4.5:1 on white
 * and on #ceced0) and distinguish by shape. */
.leaflet-control-attribution a { color: #005a8c; text-decoration: underline; text-underline-offset: 2px; }

/* WCAG link-in-text-block: links inside running text are distinguished by
 * shape (underline), not colour alone. Nav/CTA links are outside these containers. */
main p a[href], main li a[href], main dd a[href], main .msa-empty a[href] {
  text-decoration: underline; text-underline-offset: 2px;
}

a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--accent); color: #000;
  padding: .6rem 1rem; z-index: 3000; font-weight: 800;
}
.skip-link:focus { left: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
