:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e3e6ea;
  --text: #1c1e21;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 10px 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.brand { font-size: 17px; margin-right: 8px; white-space: nowrap; }
.brand b { color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; }
.chip {
  background: var(--accent-soft); color: var(--accent);
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.chip-dim { background: #f1f3f5; color: var(--muted); }
.chip-ok { background: #e8f7ee; color: var(--ok); }
.chip-err { background: #fdeaea; color: var(--err); }
input, select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; background: #fff; color: var(--text);
}
input#q { width: 160px; min-width: 90px; flex-shrink: 1; }
.btn {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* ---------- 세계지도 ---------- */
#map-wrap {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 10px 18px; display: flex; flex-direction: column; gap: 8px;
}
#region-bar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.region-btn {
  padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--muted); transition: all .15s;
}
.region-btn:hover { border-color: var(--accent); color: var(--accent); }
.region-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#region-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; }
#map-flex { display: flex; flex-direction: column; gap: 12px; align-items: center; }
#map-box { width: 100%; }
#worldmap { width: 100%; height: auto; display: block; border-radius: 8px; background: #eef2f7; max-height: 465px; cursor: grab; }
.mp {
  fill: #c7d0dc; stroke: #fff; stroke-width: .4; cursor: pointer;
  transition: fill .12s;
}
.mp:hover { fill: #8fa3bd; }
.mp.s1 { fill: #d6e4fc; }
.mp.s2 { fill: #b3cefa; }
.mp.s3 { fill: #8ab2f6; }
.mp.s4 { fill: #5f92ee; }
.mp.s5 { fill: #3d72dd; }
.mp.s6 { fill: #2b55bd; }
.mp.s7 { fill: #1e3c94; }
.mp.s1:hover, .mp.s2:hover, .mp.s3:hover, .mp.s4:hover, .mp.s5:hover, .mp.s6:hover, .mp.s7:hover { fill: #1d3a7d; }
.shade-scale { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.shade-scale .sw { display: inline-block; width: 14px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 3px; border: 1px solid rgba(0,0,0,.12); }
.mp.active { fill: #d64545; stroke: #fff; stroke-width: .6; }
.mp.active:hover { fill: #b83333; }
#map-legend { width: 100%; font-size: 12px; color: var(--muted); }
#map-legend h4 { margin: 0 0 6px; font-size: 12px; color: var(--text); }
#map-legend p { margin: 0; line-height: 1.5; }
#active-filter { margin-top: 8px; }
#active-filter .chip a { color: inherit; text-decoration: none; margin-left: 4px; font-weight: 700; }

main { display: flex; flex-wrap: wrap; gap: 16px; padding: 16px; align-items: flex-start; }
aside.filters {
  width: 240px; flex: 0 0 240px; display: flex; flex-direction: column; gap: 12px;
}
.statbox {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px;
}
.statbox h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 600; text-align: right; }
.muted { color: var(--muted); font-size: 12px; }
.runs { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.runs li { padding: 5px 0; border-bottom: 1px dashed var(--border); }
.runs li:last-child { border-bottom: 0; }
.runs .t { color: var(--muted); }

section.list { flex: 1; min-width: 0; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; transition: box-shadow .15s, border-color .15s;
  display: flex; gap: 12px;
}
.card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.06); border-color: #cfd6de; }
.card .imp { width: 4px; border-radius: 4px; flex-shrink: 0; }
.imp-high { background: var(--err); }
.imp-medium { background: var(--warn); }
.imp-low { background: #cbd5e1; }
.card .body { flex: 1; min-width: 0; }
.card .topline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.tag { padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.tag-country { background: var(--accent-soft); color: var(--accent); }
.tag-cat { background: #f1f5f9; color: #475569; }
.tag-imp.high { background: #fdeaea; color: var(--err); }
.tag-imp.medium { background: #fef3c7; color: var(--warn); }
.tag-imp.low { background: #f1f5f9; color: var(--muted); }
.tag-status { background: #e8f7ee; color: var(--ok); }
.tag-status.pending { background: #fef3c7; color: #92400e; }
.tag-status.failed { background: #fdeaea; color: var(--err); }
.card h4 { margin: 0 0 6px; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.card p.ko { margin: 0; color: #374151; line-height: 1.55; overflow-wrap: anywhere; }
.card .orig { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.5;
  display: none; }
.card.open .orig { display: block; }
.card .meta { margin-top: 8px; font-size: 11px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.card .meta a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }

.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 16px; }
#load-more { min-width: 140px; }
#pg-info { font-size: 13px; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex;
  align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal.hidden { display: none; }
.modal-box { background: var(--card); border-radius: 16px; max-width: 720px; width: 100%;
  max-height: 85vh; overflow: auto; padding: 24px; position: relative; }
.modal-close { position: absolute; top: 12px; right: 14px; border: 0; background: #f1f3f5;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.modal .m-tags { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.modal .sec { margin-top: 16px; }
.modal .sec h5 { margin: 0 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.modal .sec p, .modal .sec pre { margin: 0; line-height: 1.6; white-space: pre-wrap;
  word-break: break-word; font-size: 14px; }
.modal .sec pre { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-size: 13px; color: #475569; }
.modal .m-actions { margin-top: 20px; display: flex; gap: 10px; }
.modal .m-meta { margin-top: 12px; font-size: 11px; color: var(--muted); }

@media (max-width: 800px) {
  main { flex-direction: column; }
  aside.filters { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .statbox { flex: 1; min-width: 180px; }
  input#q { width: 120px; }

}
