*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  background: #f0f2f5;
  color: #333;
}

header {
  background: #1a1a2e;
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

header h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
}

select#execution,
select#sortBy {
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  background: #2d2d4e;
  color: white;
  outline: none;
  cursor: pointer;
}
select#execution:focus,
select#sortBy:focus { background: #3a3a5e; }

input[type="search"] {
  padding: 5px 12px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  width: 240px;
  background: #2d2d4e;
  color: white;
  outline: none;
}
input[type="search"]::placeholder { color: #888; }
input[type="search"]:focus { background: #3a3a5e; }

.toggle-group { display: flex; gap: 12px; }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #bbb;
  font-size: 12px;
  user-select: none;
}
.toggle-label input { cursor: pointer; accent-color: #4ade80; }
.toggle-label:hover { color: white; }

.stats { font-size: 11px; color: #888; white-space: nowrap; }

.latest-tag-badge {
  margin-left: auto;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  color: #d1fae5;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 6px;
}
.latest-label {
  background: #22c55e;
  color: #000;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 3px;
}
.latest-date {
  color: #6ee7b7;
  font-size: 11px;
}

.table-wrapper { overflow: auto; height: calc(100vh - 50px); }

table { border-collapse: collapse; white-space: nowrap; }

thead th {
  position: sticky;
  top: 0;
  background: #16213e;
  color: #ccd;
  padding: 4px 3px 8px;
  text-align: left;
  font-weight: 500;
  border-right: 1px solid #0f3460;
  z-index: 10;
  vertical-align: bottom;
  width: 42px;
  min-width: 42px;
}
thead th .th-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
thead th .inst-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 120px;
}
thead th .version {
  font-size: 10px;
  color: #99aabb;
  padding-top: 4px;
  font-weight: 700;
}
thead th .version.version-match { color: #22c55e; }
thead th .version.version-old   { color: #facc15; }
thead th.module-header {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 20;
  width: 210px;
  min-width: 210px;
  padding: 8px 8px 8px 14px;
  writing-mode: horizontal-tb;
  transform: none;
  font-size: 11px;
  color: #aab;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

tbody tr { background: white; }
tbody tr:nth-child(even) { background: #f8f9fb; }
tbody tr:hover { background: #e8f0fe !important; }

td {
  padding: 2px 3px;
  border-right: 1px solid #eee;
  border-bottom: 1px solid #eee;
  text-align: center;
}
td.module-name {
  text-align: left;
  position: sticky;
  left: 0;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 11px;
  padding-left: 14px;
  min-width: 210px;
  width: 210px;
  border-right: 2px solid #dde;
  z-index: 5;
  background: inherit;
  color: #444;
}
tr.has-diff td.module-name { color: #b91c1c; font-weight: 700; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.on  { background: #22c55e; }
.dot.off { background: #e5e7eb; }

#loading, #error {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  font-size: 15px;
  color: #666;
}
#error { color: #dc2626; display: none; }
