/* ----- Tokens ----- */
:root {
  --bg: #0b0f17;
  --surface: #131a27;
  --surface-2: #1a2334;
  --surface-3: #212c42;
  --border: #2a364f;
  --border-soft: #1f2940;
  --text: #e6edf6;
  --text-muted: #8ea0bd;
  --text-dim: #5d6b85;
  --accent: #4a9eff;
  --accent-hover: #66adff;

  --covered: #3ecf8e;
  --covered-bg: rgba(62, 207, 142, 0.12);
  --covered-border: rgba(62, 207, 142, 0.35);

  --partial: #f5a623;
  --partial-bg: rgba(245, 166, 35, 0.12);
  --partial-border: rgba(245, 166, 35, 0.35);

  --not-covered: #5a6478;
  --not-covered-bg: rgba(90, 100, 120, 0.18);
  --not-covered-border: rgba(90, 100, 120, 0.5);

  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.45);

  --radius: 10px;
  --radius-sm: 6px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ----- Header ----- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(74, 158, 255, 0.05), transparent);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  background-color: rgba(11, 15, 23, 0.85);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--accent) 0%, #2563eb 100%);
  position: relative;
  box-shadow: 0 0 0 1px rgba(74, 158, 255, 0.4), 0 6px 16px rgba(74, 158, 255, 0.25);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  border-bottom-color: transparent;
  border-right-color: transparent;
  transform: rotate(-45deg);
}
.brand-title { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }

.header-actions { display: flex; gap: 8px; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.btn:hover { background: var(--surface-3); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-small { padding: 6px 10px; font-size: 12px; }
.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.btn-icon:hover { color: var(--text); background: var(--surface-3); }

/* ----- Layout ----- */
.container { max-width: 1600px; margin: 0 auto; padding: 24px 32px 80px; }

/* ----- Summary stat cards ----- */
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 2fr;
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--border);
}
.stat-card[data-status="covered"]::before { background: var(--covered); }
.stat-card[data-status="partial"]::before { background: var(--partial); }
.stat-card[data-status="not-covered"]::before { background: var(--not-covered); }
.stat-card[data-status="score"]::before { background: var(--accent); }
.stat-card[data-status="total"]::before { background: var(--text-muted); }

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-value {
  font-size: 28px;
  font-weight: 600;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-help { font-size: 11px; color: var(--text-dim); margin-top: 6px; }

.score-bar {
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  margin-top: 10px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--covered), var(--accent));
  width: 0%;
  transition: width 300ms ease;
}

/* ----- Filters ----- */
.filters {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.filter-group { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.filter-group-grow { flex: 1; min-width: 240px; }
.filter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}
.select, .input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  height: 36px;
}
.select:focus, .input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.input::placeholder { color: var(--text-dim); }

.pill-group { display: flex; gap: 6px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 120ms;
  height: 36px;
}
.pill:hover { color: var(--text); border-color: var(--accent); }
.pill.is-active { color: var(--text); background: var(--surface-3); border-color: var(--border); }
.pill:not(.is-active) { opacity: 0.5; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-covered { background: var(--covered); }
.dot-partial { background: var(--partial); }
.dot-not-covered { background: var(--not-covered); }

/* ----- Matrix ----- */
.matrix {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 1280px) {
  .matrix { grid-template-columns: repeat(14, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .matrix { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .matrix { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.tactic-column {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tactic-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  padding: 4px 4px 10px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.tactic-count {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.tactic-techniques { display: flex; flex-direction: column; gap: 5px; }

.technique-cell {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--not-covered);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  cursor: pointer;
  transition: transform 120ms, border-color 120ms, background 120ms;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  display: block;
}
.technique-cell:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--surface-3);
}
.technique-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.technique-cell.status-covered { border-left-color: var(--covered); background: var(--covered-bg); }
.technique-cell.status-partial { border-left-color: var(--partial); background: var(--partial-bg); }
.technique-cell.status-not-covered { border-left-color: var(--not-covered); background: var(--not-covered-bg); }

.technique-id {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.technique-name {
  font-size: 12px;
  margin-top: 2px;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-size: 14px;
}

/* ----- Drawer ----- */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 220ms ease;
  z-index: 30;
  overflow-y: auto;
}
.drawer.is-open { transform: translateX(0); }
.drawer-inner { padding: 24px; }
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 18px;
}
.drawer-id { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); margin-bottom: 2px; }
.drawer-title { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.drawer-tactic { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.drawer-row { margin-bottom: 18px; }
.drawer-row-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.drawer-detection { margin: 0; color: var(--text); font-size: 13px; line-height: 1.6; }
.data-sources { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.data-sources li {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.data-sources li:empty, .data-sources:empty::before {
  content: "— none —";
  color: var(--text-dim);
  font-style: italic;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
}
.status-chip.status-covered { color: var(--covered); background: var(--covered-bg); border-color: var(--covered-border); }
.status-chip.status-partial { color: var(--partial); background: var(--partial-bg); border-color: var(--partial-border); }
.status-chip.status-not-covered { color: var(--text-muted); background: var(--not-covered-bg); border-color: var(--not-covered-border); }

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 20;
  animation: fade 180ms ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ----- Footer ----- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 20px 32px;
  color: var(--text-dim);
  font-size: 11px;
  text-align: center;
  max-width: 1600px;
  margin: 0 auto;
}

/* ----- Print ----- */
@media print {
  .site-header, .filters, .header-actions, .drawer, .drawer-scrim { display: none; }
  body { background: #fff; color: #000; }
  .stat-card, .tactic-column, .technique-cell { background: #fff !important; border-color: #ccc !important; }
}
