:root {
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-dim: #666;
  --accent: #4a6cf7;
  --accent-light: rgba(74,108,247,0.1);
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --border: #e5e7eb;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
  --radius: 10px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.header {
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  padding: 16px 0; margin-bottom: 24px;
}
.header .container { display: flex; align-items: center; justify-content: space-between; }
.header h1 { font-size: 1.3rem; }
.header nav { display: flex; gap: 20px; font-size: 0.9rem; }
.header nav a { color: var(--text-dim); font-weight: 500; }
.header nav a:hover, .header nav a.active { color: var(--accent); text-decoration: none; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card .label { font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.card .value { font-size: 2rem; font-weight: 700; margin-top: 4px; }
.card .sub { font-size: 0.8rem; color: var(--text-dim); margin-top: 4px; }

/* Tables */
.panel {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 24px;
}
.panel-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
table { width: 100%; border-collapse: collapse; }
th {
  background: #f8f9fb; padding: 10px 12px; text-align: left;
  font-size: 0.78rem; color: var(--text-dim); cursor: pointer; user-select: none;
  white-space: nowrap; border-bottom: 2px solid var(--border);
}
th:hover { color: var(--accent); }
td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; font-size: 0.83rem; vertical-align: top; }
tr:hover { background: #fafbff; }

/* Controls */
.controls {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.controls-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.controls-row:last-child { margin-bottom: 0; }
.search-box {
  flex: 1; min-width: 250px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.9rem; outline: none;
}
.search-box:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.slider-group { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-dim); }
.slider-group input[type=range] { width: 100px; cursor: pointer; }
.slider-val { font-weight: 600; min-width: 24px; text-align: center; }

/* Chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 0.75rem; cursor: pointer; border: 1px solid var(--border);
  background: var(--card-bg); transition: all 0.15s; user-select: none;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip:hover { border-color: var(--accent); }

/* Badges */
.score-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-weight: 600; font-size: 0.8rem;
}
.score-high { background: #d4edda; color: #155724; }
.score-mid { background: #fff3cd; color: #856404; }
.score-low { background: #f8d7da; color: #721c24; }
.cat-badge {
  display: inline-block; padding: 1px 7px; border-radius: 8px;
  font-size: 0.68rem; margin: 1px 2px; background: #e8eaf6; color: #3949ab;
}
.source-badge {
  display: inline-block; padding: 1px 7px; border-radius: 8px;
  font-size: 0.68rem; margin: 1px 2px;
}
.source-ietf { background: #e3f2fd; color: #1565c0; }
.source-w3c { background: #fce4ec; color: #c62828; }

/* Severity */
.sev-critical { color: var(--red); font-weight: 600; }
.sev-high { color: var(--orange); font-weight: 600; }
.sev-medium { color: var(--text); }
.sev-low { color: var(--text-dim); }

/* Bar */
.bar { display: inline-block; height: 10px; border-radius: 3px; background: var(--accent); vertical-align: middle; }

/* Detail */
.detail-row td { padding: 12px 20px; background: #f8faff; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 800px; }
.detail-item { font-size: 0.82rem; }
.detail-item strong { color: #333; }
.detail-item .note { color: var(--text-dim); font-size: 0.78rem; }
.summary-text { font-size: 0.82rem; color: #444; margin-top: 6px; line-height: 1.4; }

/* Chart container */
.chart-container {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 24px;
}

/* Gap cards */
.gap-card {
  background: var(--card-bg); border-radius: var(--radius);
  border-left: 4px solid var(--accent); padding: 16px 20px;
  box-shadow: var(--shadow); margin-bottom: 12px;
}
.gap-card h3 { font-size: 0.95rem; margin-bottom: 4px; }
.gap-card p { font-size: 0.83rem; color: var(--text-dim); margin-bottom: 4px; }
.gap-card .meta { font-size: 0.75rem; color: var(--text-dim); }
.gap-card.critical { border-left-color: var(--red); }
.gap-card.high { border-left-color: var(--orange); }

.dim { font-size: 0.75rem; color: var(--text-dim); }
.clickable { cursor: pointer; }
.reset-btn {
  padding: 4px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--card-bg); cursor: pointer; font-size: 0.78rem; color: var(--text-dim);
}
.reset-btn:hover { border-color: var(--accent); color: var(--accent); }
.result-count { font-size: 0.85rem; color: var(--text-dim); margin: 10px 0 8px; }

/* Timeline bars */
.tl-bar {
  display: inline-block; height: 16px; border-radius: 3px;
  vertical-align: middle; min-width: 2px;
}

@media (max-width: 768px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .controls-row { flex-direction: column; align-items: stretch; }
  .detail-grid { grid-template-columns: 1fr; }
}
