/* Linux/IoT Tiny Malwares Tracker — dark theme */
:root {
  color-scheme: light;
  --page-bg:   #000000;   /* same black backdrop as futex.re */
  --bg:        #ffffff;
  --surface:   #ffffff;
  --surface-2: #f6f6f4;
  --border:    #e2e2e2;
  --text:      #222222;
  --text-2:    #373737;
  --muted:     #6b6a65;
  --accent:    #1982d1;   /* Twenty Eleven link blue */
  --accent-2:  #1982d1;
  --unknown:   #d64545;
  --failed:    #a6a6a6;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--page-bg); color: var(--text); font: 14px/1.5 var(--sans); }

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

.wrap { max-width: 1280px; margin: 24px auto; padding: 0 24px 24px; background: var(--bg); }
@media (max-width: 1328px) { .wrap { margin: 0 auto; } }
@media (max-width: 600px)  { .wrap { padding: 0 16px 16px; } }

/* ---------- header ---------- */
.top { padding-top: 24px; }
.banner { display: block; width: 100%; height: auto; max-height: 288px; object-fit: cover; }
.titlebar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  border-bottom: 2px solid var(--border); padding: 16px 0;
}
.titlebar h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.2px; }
.titlebar h1 a { color: var(--text); }

.search { display: flex; gap: 6px; flex: 0 1 380px; }
.search input {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: 6px;
  border: 1px solid #d0d0cc; background: #fafafa; color: var(--text); font: 13px var(--mono);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.search button, .range button {
  padding: 7px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); font: inherit; cursor: pointer;
}
.search button:hover, .range button:hover { color: var(--text); border-color: var(--muted); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 16px 0; }
.kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi-value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.kpi.exports span:last-child { font-size: 16px; padding-top: 6px; }

/* ---------- charts ---------- */
.charts-head, .table-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 24px 0 12px; }
h2 { margin: 0; font-size: 16px; font-weight: 600; }
h2 code { font: 13px var(--mono); color: var(--accent); background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.range { display: flex; gap: 4px; }
.range button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.charts-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; }
@media (max-width: 900px) { .charts-grid { grid-template-columns: minmax(0, 1fr); } }

.card { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; min-width: 0; }
.card figcaption { font-weight: 600; margin-bottom: 12px; }
.muted { color: var(--muted); font-weight: 400; font-size: 12px; }

.doughnut-box { position: relative; height: 240px; }
.map { width: 100%; aspect-ratio: 16 / 9; min-height: 180px; overflow: hidden; }

.legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-2); }
.legend .sw { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.legend .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .val { color: var(--text); font-variant-numeric: tabular-nums; }
.legend.countries { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

/* ---------- table ---------- */
.reset { font-size: 13px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }

table.tracker { width: 100%; min-width: 1100px; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.tracker col.c-date    { width: 150px; }
.tracker col.c-url     { width: auto; }
.tracker col.c-type    { width: 190px; }
.tracker col.c-hash    { width: 280px; }
.tracker col.c-country { width: 120px; }
.tracker col.c-as      { width: 210px; }

.tracker th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--muted); text-align: left; font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.tracker td {
  padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2);
}
.tracker tbody tr:last-child td { border-bottom: 0; }
.tracker tbody tr:hover td { background: var(--surface-2); }

.tracker td.date  { font-variant-numeric: tabular-nums; color: var(--muted); }
.tracker td.url,
.tracker td.hash  { font-family: var(--mono); font-size: 12px; }
.tracker td.hash  { color: var(--text-2); }
.tracker td.url a { color: var(--accent); }

.tracker tr.row-unknown td:first-child { box-shadow: inset 3px 0 0 var(--unknown); }
.tracker tr.row-failed  td:first-child { box-shadow: inset 3px 0 0 var(--failed); }
.tracker tr.row-failed  td { color: var(--muted); }
.tracker tr.row-failed  td.url a { color: var(--muted); }

.badge {
  display: inline-block; max-width: 100%; vertical-align: middle;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 1px 8px; border-radius: 999px; font-size: 12px;
  background: #e8f2fb; color: #12609b; border: 1px solid #b9d8f0;
}
a.badge:hover { text-decoration: none; filter: brightness(.95); }
.badge-unknown { background: #fdecec; color: #b42f2f; border-color: #f3c2c2; }
.badge-failed  { background: #f1f1ef; color: var(--muted); border-color: var(--border); }
.tracker td.type { overflow: visible; }
.tracker td.type .badge { max-width: calc(100% - 20px); }
.ref { color: var(--muted); margin-left: 2px; }

.legend-rows { color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.empty { color: var(--muted); padding: 24px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }

.foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; text-align: center; }

/* Google GeoChart tooltip */
.google-visualization-tooltip { background: #fff !important; border: 1px solid var(--border) !important; border-radius: 6px !important; box-shadow: 0 2px 8px rgba(0,0,0,.12) !important; }
.google-visualization-tooltip * { color: var(--text) !important; font-family: var(--sans) !important; }
