:root {
  --bg: #0b0f19;
  --card-bg: #111827;
  --border: #1f293d;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
}
body {
  margin: 0;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
h1 { font-size: 22px; margin: 0; }
.btn-group { display: flex; gap: 10px; }
.nav-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 20px;
}
.nav-tab-btn {
  padding: 8px 16px;
  border-radius: 6px;
  background: #1e293b;
  color: #94a3b8;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 13px;
  transition: all 0.15s ease;
}
.nav-tab-btn:hover { background: #334155; color: #fff; }
.nav-tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: #60a5fa;
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #60a5fa;
  margin-bottom: 12px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
}
.badge-yellow { background: rgba(245, 158, 11, 0.2); color: var(--yellow); }
.badge-green { background: rgba(16, 185, 129, 0.2); color: var(--green); }
.badge-red { background: rgba(239, 68, 68, 0.2); color: var(--red); }
.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { background: var(--accent-hover); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #059669; }
.btn-success:hover { background: #047857; }
.btn-secondary { background: #374151; }
.btn-secondary:hover { background: #4b5563; }
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 660px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
}
.form-group { margin-bottom: 14px; }
label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
input, select {
  width: 100%;
  box-sizing: border-box;
  background: #1f2937;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  color: white;
}
.subhead {
  font-weight: bold;
  margin: 18px 0 10px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  color: #93c5fd;
}
.pair-row {
  border: 1px solid var(--border);
  background: #131d2e;
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
code {
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 4px;
  color: #38bdf8;
}
.tile-btn {
  background: #1e293b;
  border: 2px solid #3b82f6;
  border-radius: 4px;
  padding: 8px 4px;
  font-size: 11px;
  color: white;
  cursor: pointer;
  text-align: center;
  user-select: none;
  transition: all 0.15s ease;
}
.tile-btn.selected { background: #1d4ed8; border-color: #60a5fa; }
.tile-btn.deselected { background: #111827; border-color: #4b5563; color: #6b7280; }
.subgroup-box {
  background: #0d1424;
  border: 1px solid #1f293d;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 14px;
}
.subgroup-title {
  font-size: 12px;
  font-weight: bold;
  color: #60a5fa;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
table.inventory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-family: monospace;
}
table.inventory-table th {
  border-bottom: 1px solid #1f293d;
  color: #94a3b8;
  text-align: left;
  padding: 4px 6px;
}
table.inventory-table td {
  border-bottom: 1px solid #151e30;
  padding: 4px 6px;
}
.section-header {
  font-size: 12px;
  font-weight: bold;
  color: #93c5fd;
  padding: 8px 6px 4px 6px;
  border-bottom: 1px solid #2563eb;
  margin-top: 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}
.history-range-btn { padding: 3px 8px; font-size: 11px; border-radius: 4px; }
.history-range-btn.selected { background: var(--accent); color: white; }
.avg-label { font-size: 10px; color: #94a3b8; display: block; margin-top: 2px; }
.sources-strip {
  background: #080d1a;
  border: 1px solid #1e293b;
  border-left: 3px solid #38bdf8;
  border-radius: 4px;
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 11px;
}
.sources-strip-title {
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.source-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px dashed #162033;
}
.source-item:last-child { border-bottom: none; }