/* ============================================================
   Apache Log Analyzer — style.css
   Palette : fond lavande clair, accent bleu-indigo, tokens HTTP
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --white:     #FFFFFF;
  --bg:        #F7F8FC;
  --surface:   #FFFFFF;
  --surface2:  #F0F2FA;
  --border:    #E2E5F0;
  --ink:       #1C2033;
  --muted:     #7A82A0;
  --accent:    #4F6EF7;
  --accent-lt: #EEF1FE;
  --ok:        #22C076;
  --ok-lt:     #E8FAF2;
  --warn:      #F5A623;
  --warn-lt:   #FEF4E3;
  --err:       #E8384F;
  --err-lt:    #FDEAEC;
  --info:      #8B5CF6;
  --info-lt:   #F3EFFE;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 1px 4px rgba(28,32,51,.06), 0 4px 16px rgba(28,32,51,.06);
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Fira Mono', monospace;
}

.gradient {
  background: linear-gradient(to bottom right, var(--accent), var(--info));
}

/* ── Reset & base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────── */
#app {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.site-header .logo-icon {
  width: 40px;
  height: 40px;
  /* background: var(--accent); */
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.site-header .logo-alsacreations {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-header .logo-icon svg {
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
}

.site-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
}

.site-header p {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 1px;
}

/* ── Intro block ───────────────────────────────────────── */
.intro-block {
  /* background: var(--surface); */
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.intro-block .intro-lead {
  font-size: 2rem;
  background-color: var(--accent);
  mix-blend-mode: multiply;
  line-height: 1.6;
  margin-top: 3rem;
  text-wrap: balance;
  text-align: center;
  display: inline-flex;
  color: var(--white);
  padding: 0.5rem 1rem;
  align-self: center;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.intro-block .intro-args {
  display: flex;
  flex-direction: column;
}

.intro-block .intro-arg {
  font-size: 1.1rem;
  color: var(--muted);
  text-wrap: balance;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  & svg {
    color: var(--ok);
    height: 1.2rem;
  }
  background: var(--white);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  &:first-child { border-bottom-right-radius: 0; border-bottom-left-radius: 0; border-bottom: none; transform: translateY(1px); }
  &:last-child { border-top-right-radius: 0; border-top-left-radius: 0; border-top: none; transform: translateY(-1px); }
}

.intro-features {
  margin-top: 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 20rem));
  justify-content: center;
  gap: 12px;
}

.intro-feature {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: var(--radius);
  & svg {
    width: 2rem;
    height: 2rem;
    color: var(--ok);
    &.ok { color: var(--ok); }
    &.warn { color: var(--warn); }
    &.err { color: var(--err); }
    &.info { color: var(--info); }
  }
}

.intro-feature strong {
  font-weight: 600;
  /* color: var(--accent); */
  letter-spacing: .03em;
}

.intro-feature span {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.45;
}

.intro-block .intro-log-code {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: .82rem;
  padding: 6px 10px;
  display: inline-block;
  opacity: 0.15;
  position: absolute;
  top: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

/* ── Drop zone ──────────────────────────────────────────── */
#drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
  padding: 5rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}

#drop-zone:hover,
#drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-lt);
}

#drop-zone .drop-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  background: var(--accent-lt);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#drop-zone .drop-icon svg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
}

#drop-zone .drop-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

#drop-zone .drop-sub {
  font-size: .82rem;
  color: var(--muted);
}

#drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* ── Progress ───────────────────────────────────────────── */
#progress-wrap {
  display: none;
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
}

#progress-wrap p {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.progress-bar-bg {
  height: 6px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .15s ease;
}

/* ── Dashboard (caché avant analyse) ───────────────────── */
#dashboard {
  display: none;
  margin-top: 36px;
}

/* ── Section title ──────────────────────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  margin-top: 36px;
}

.section-title:first-of-type { margin-top: 0; }

/* ── File info banner ───────────────────────────────────── */
#file-info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin-bottom: 28px;
  font-size: .82rem;
}

#file-info-bar .fi-name {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  font-size: .8rem;
}

#file-info-bar .fi-sep {
  color: var(--border);
  font-size: 1.1rem;
}

#file-info-bar .fi-item {
  color: var(--muted);
}

#file-info-bar .fi-item strong {
  color: var(--ink);
  font-weight: 600;
}

#file-info-bar .fi-format {
  color: var(--accent);
  background: var(--accent-lt);
  padding: 2px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-size: .78rem;
}

#file-info-bar .fi-match-ok {
  color: var(--ok);
}

#file-info-bar .fi-match-warn {
  color: var(--warn);
}

#file-info-bar .fi-match-err {
  color: var(--err);
}

.btn-reset {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: .78rem;
  font-family: var(--font-body);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.btn-reset:hover {
  border-color: var(--err);
  color: var(--err);
}

/* ── KPI Cards ──────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow);
}

.kpi-card .kpi-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.kpi-card .kpi-value {
  font-size: 1.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--ink);
  letter-spacing: -.03em;
  line-height: 1;
}

.kpi-card .kpi-sub {
  font-size: .75rem;
  color: var(--muted);
  margin-top: 5px;
}

.kpi-card.accent  { border-top: 3px solid var(--accent); }
.kpi-card.ok      { border-top: 3px solid var(--ok); }
.kpi-card.warn    { border-top: 3px solid var(--warn); }
.kpi-card.err     { border-top: 3px solid var(--err); }
.kpi-card.info    { border-top: 3px solid var(--info); }

/* ── Status codes breakdown ─────────────────────────────── */
#status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.status-family {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.status-family .sf-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.status-family .sf-badge {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}

.sf-2xx .sf-badge { background: var(--ok-lt);   color: var(--ok); }
.sf-3xx .sf-badge { background: var(--ok-lt);  color: var(--ok); }
.sf-4xx .sf-badge { background: var(--warn-lt);  color: var(--warn); }
.sf-5xx .sf-badge { background: var(--err-lt);   color: var(--err); }
.sf-other .sf-badge { background: var(--surface2); color: var(--muted); }

.status-family .sf-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
}

.status-family .sf-total {
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-top: 1px solid var(--border);
}

.status-row:first-of-type { border-top: none; }

.status-row .sr-code {
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 600;
  width: 38px;
  flex-shrink: 0;
}

.sf-2xx .sr-code { color: var(--ok); }
.sf-3xx .sr-code { color: var(--ok); }
.sf-4xx .sr-code { color: var(--warn); }
.sf-5xx .sr-code { color: var(--err); }

.status-row .sr-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
}

.status-row .sr-bar {
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease;
}

.sf-2xx .sr-bar    { background: var(--ok); }
.sf-3xx .sr-bar    { background: var(--ok); }
.sf-4xx .sr-bar    { background: var(--warn); }
.sf-5xx .sr-bar    { background: var(--err); opacity: .7; }
.sf-other .sr-bar  { background: var(--muted); }

.status-row .sr-count {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--muted);
  text-align: right;
  width: 48px;
  flex-shrink: 0;
}

.status-row .sr-label {
  font-size: .7rem;
  color: var(--muted);
  flex: 1.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Chart section ──────────────────────────────────────── */
#chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

#chart-wrap .chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

#chart-wrap .chart-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink);
}

.chart-controls {
  display: flex;
  gap: 6px;
}

.chart-controls button {
  font-family: var(--font-body);
  font-size: .75rem;
  font-weight: 500;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}

.chart-controls button.active,
.chart-controls button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#timeline-canvas {
  width: 100%;
  display: block;
}

/* ── Day/night controls ──────────────────────────────────── */
#daynight-controls {
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 4px 0;
  font-size: .78rem;
  color: var(--muted);
}

.daynight-legend {
  display: flex;
  align-items: center;
  gap: 6px;
}

.daynight-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.daynight-night { background: #0F1B3E; }
.daynight-day   { background: #87CEEB; }

.daynight-tz {
  display: flex;
  align-items: center;
  gap: 6px;
}

#tz-select {
  font-family: var(--font-body);
  font-size: .78rem;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

/* ── Tops grid ──────────────────────────────────────────── */
.tops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 16px;
}

.top-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.top-card .tc-head {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-card .tc-head svg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  flex-shrink: 0;
}

.top-card .tc-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink);
}

.top-card .tc-body {
  padding: 4px 0;
}

.top-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 18px;
  position: relative;
  transition: background .12s;
}

.top-row::before {
  content: '';
  position: absolute;
  inset-block: 0;
  left: 0;
  width: var(--pct, 0%);
  background: var(--accent-lt);
  border-radius: 0 4px 4px 0;
  z-index: 0;
}

.top-row:hover::before { background: var(--surface2); }

.top-row > * { position: relative; z-index: 1; }

.top-row .tr-rank {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--muted);
  text-align: right;
}

.top-row .tr-value {
  font-size: .8rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.top-row .tr-value a {
  color: inherit;
}

.top-row .tr-value a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.top-row .tr-count {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

/* ── Error rates ─────────────────────────────────────────── */
.error-rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.er-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.er-card .er-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.er-card .er-rate {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -.03em;
  line-height: 1;
}

.er-card.low  .er-rate { color: var(--ok); }
.er-card.mid  .er-rate { color: var(--warn); }
.er-card.high .er-rate { color: var(--err); }

.er-card .er-bar-bg {
  height: 6px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.er-card .er-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.er-card.low  .er-bar-fill { background: var(--ok); }
.er-card.mid  .er-bar-fill { background: var(--warn); }
.er-card.high .er-bar-fill { background: var(--err); }

.er-card .er-sub {
  font-size: .72rem;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Bytes top ───────────────────────────────────────────── */
.top-row .tr-bytes {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 600;
  color: var(--info);
  white-space: nowrap;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: .85rem;
}

/* ── Tooltip (canvas) ───────────────────────────────────── */
#chart-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: .75rem;
  padding: 6px 12px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity .1s;
  z-index: 9999;
  white-space: nowrap;
}

/* ── Bots summary ──────────────────────────────────────── */
.bots-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

/* ── Top card expand ────────────────────────────────────── */
.top-row-hidden { display: none; }
.top-card.expanded .top-row-hidden { display: grid; }
.top-card.expanded { grid-column: 1 / -1; }

.btn-show-more {
  display: block;
  width: 100%;
  padding: 10px;
  border: none;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.btn-show-more:hover {
  background: var(--accent-lt);
  color: var(--accent);
}

/* ── Copy Markdown button ────────────────────────────────── */
.btn-copy-md {
  margin-left: auto;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  transition: color .15s, border-color .15s;
}
.btn-copy-md:hover {
  color: var(--accent);
  border-color: var(--border);
}
.btn-copy-md.copied {
  color: var(--ok);
  border-color: var(--ok-lt);
}

/* ── Error rate neutral ────────────────────────────────────── */
.er-card.neutral .er-rate { color: var(--ink); }
.er-card.neutral .er-bar-fill { background: var(--muted); }

/* ── Help link ─────────────────────────────────────────────── */
.help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .65rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  transition: background .15s, color .15s, border-color .15s;
}

.help-link:hover {
  background: var(--accent-lt);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 32, 51, .45);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(28, 32, 51, .2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}

.modal-close:hover {
  background: var(--surface2);
  color: var(--ink);
}

.modal-body {
  padding: 16px 24px 24px;
}

.modal-family {
  margin-bottom: 20px;
}

.modal-family:last-child {
  margin-bottom: 0;
}

.modal-family-header {
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 10px;
}

.modal-code-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: .82rem;
}

.modal-code-row:first-of-type {
  border-top: none;
}

.modal-code-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: .8rem;
}

.modal-code-name {
  font-weight: 600;
  font-size: .78rem;
  color: var(--muted);
  margin-right: 4px;
}

.modal-code-desc {
  color: var(--ink);
  font-size: .8rem;
  line-height: 1.5;
  margin-top: 2px;
}

.modal-help-text {
  font-size: .85rem;
  line-height: 1.65;
  color: var(--ink);
}
.modal-help-text h3 {
  font-size: .9rem;
  font-weight: 700;
  margin: 20px 0 8px;
  color: var(--ink);
}
.modal-help-text h3:first-child {
  margin-top: 0;
}
.modal-help-text p {
  margin: 0 0 10px;
}
.modal-help-text ul {
  margin: 0 0 12px;
  padding-left: 20px;
}
.modal-help-text li {
  margin-bottom: 4px;
}
.modal-help-text code {
  font-family: var(--font-mono);
  font-size: .8rem;
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ── Methods grid ──────────────────────────────────────── */
#methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.sf-methods .sf-badge { background: var(--accent-lt); color: var(--accent); }
.sf-methods .sr-code  { color: var(--accent); width: auto; }
.sf-methods .sr-bar   { background: var(--accent); }

/* ── Scan detection ───────────────────────────────────────── */
#scan-detection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 16px;
}

#scan-detection .tc-head svg {
  stroke: var(--err);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 700px) {
  #app { padding: 16px 12px 48px; }
  .tops-grid { grid-template-columns: 1fr; }
  .kpi-grid  { grid-template-columns: repeat(2, 1fr); }
  #status-grid { grid-template-columns: 1fr; }
  #methods-grid { grid-template-columns: 1fr; }
  #scan-detection { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.footer {
  text-align: center;
  font-size: .75rem;
  color: var(--muted);
  margin-top: 48px;
  padding-bottom: 24px;
}

/* ── Theme toggle button ─────────────────────────────────── */
.btn-theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  transition: color .15s, border-color .15s;
}
.btn-theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.btn-theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .btn-theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .btn-theme-toggle .icon-sun { display: inline; }

/* ── Dark theme ──────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:        #0F1117;
  --surface:   #1A1C28;
  --surface2:  #232636;
  --border:    #2E3148;
  --ink:       #E4E6F0;
  --muted:     #8A90AB;
  --accent-lt: #1C2444;
  --ok-lt:     #0F2A1C;
  --warn-lt:   #2A2210;
  --err-lt:    #2A1216;
  --info-lt:   #1C1530;
  --shadow:    0 1px 4px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3);
  --white:     #1A1C28;
}

[data-theme="dark"] .intro-lead {
  mix-blend-mode: normal;
  color: #FFFFFF;
}

[data-theme="dark"] #chart-tooltip {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, .6);
}