/* ============================================================
   RLDX-1 Dashboard — Theme Tokens
   Edit this file to re-skin without touching layout/logic.
   ============================================================ */

:root {
  /* Surfaces — warm off-white, easy on eyes but bright */
  --bg-page: #f7f6f3;
  --bg-card: #ffffff;
  --bg-subtle: #f0eeea;
  --bg-hover: #faf9f7;

  /* Borders */
  --border-soft: #e9e6df;
  --border-medium: #d6d1c7;

  /* Text */
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #8a857c;

  /* Accent */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #dbeafe;

  /* Status */
  --positive: #059669;
  --negative: #dc2626;

  /* Chart palette — 10 distinct, slightly desaturated for non-fatigue */
  --c-1:  #3b82f6;  /* blue   */
  --c-2:  #10b981;  /* emerald*/
  --c-3:  #f59e0b;  /* amber  */
  --c-4:  #ef4444;  /* red    */
  --c-5:  #8b5cf6;  /* violet */
  --c-6:  #06b6d4;  /* cyan   */
  --c-7:  #f97316;  /* orange */
  --c-8:  #ec4899;  /* pink   */
  --c-9:  #84cc16;  /* lime   */
  --c-10: #6366f1;  /* indigo */

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Pretendard",
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono",
               Menlo, Consolas, monospace;

  /* Shape */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Shadow */
  --shadow-card: 0 1px 2px rgba(28, 25, 23, 0.04), 0 1px 1px rgba(28, 25, 23, 0.02);
  --shadow-card-hover: 0 4px 12px rgba(28, 25, 23, 0.06);
}

/* ====== Base ====== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }

/* ====== Layout ====== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
}

/* ====== Header ====== */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 246, 243, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
}
.header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 2px;
}
.header .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}
.header .meta {
  text-align: right;
  flex-shrink: 0;
}
.header .meta-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.header .meta-value { font-size: 13px; font-family: var(--font-mono); color: var(--text-primary); }
.header .meta-hint  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 0; }
  .header h1 { font-size: 17px; }
  .header .meta { text-align: left; }
}

/* ====== Section ====== */
.section { margin: 32px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-head h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.section-head .head-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.section-head .head-link:hover { text-decoration: underline; }
.section-head .head-note {
  font-size: 12px;
  color: var(--text-muted);
}

/* ====== Card ====== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 900px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; } }

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 16px;
}
.metric-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.metric-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 420px) { .metric-value { font-size: 22px; } }

/* ====== Chart ====== */
.chart-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.chart-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin: 0; }
.chart-note  { font-size: 11px; color: var(--text-muted); }
.chart-wrap {
  position: relative;
  height: 280px;
  width: 100%;
}
.chart-wrap-tall {
  position: relative;
  height: 380px;
  width: 100%;
}
@media (max-width: 640px) {
  .chart-wrap { height: 220px; }
  .chart-wrap-tall { height: 280px; }
}

/* ====== HF Paper section ====== */
.paper-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
}
@media (max-width: 768px) { .paper-grid { grid-template-columns: 1fr; } }

.paper-stat .metric-value-xl {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
}
.paper-title-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 16px;
  word-break: keep-all;
}

/* ====== Section 3: Models — Chart + Right Sidebar ====== */
.models-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.models-tab {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
  white-space: nowrap;
}
.models-tab:hover { color: var(--text-primary); }
.models-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(28,25,23,0.06);
}

.models-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 12px;
}
@media (max-width: 1024px) {
  .models-layout { grid-template-columns: 1fr; }
}

.models-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 12px;
  max-height: 380px;
  overflow-y: auto;
}
@media (max-width: 1024px) {
  .models-sidebar { max-height: none; }
}
.models-sidebar h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 4px 8px 8px;
}
.models-sidebar .sidebar-actions {
  display: flex;
  gap: 6px;
  margin: 0 4px 8px;
  font-size: 11px;
}
.models-sidebar .sidebar-actions button {
  appearance: none;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}
.models-sidebar .sidebar-actions button:hover { background: var(--bg-hover); color: var(--text-primary); }

.model-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 100ms;
  user-select: none;
  min-width: 0;
}
.model-item:hover { background: var(--bg-hover); }
.model-item.dimmed .model-name,
.model-item.dimmed .model-value { color: var(--text-muted); }
.model-item.dimmed .model-dot   { opacity: 0.25; }

.model-checkbox {
  appearance: none;
  width: 14px; height: 14px;
  border: 1.5px solid var(--border-medium);
  border-radius: 4px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  background: var(--bg-card);
}
.model-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.model-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 3px; top: 0px;
  width: 4px; height: 8px;
  border: solid white;
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(45deg);
}

.model-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid currentColor;
  background: transparent;
}
.model-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.model-value {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ====== Table ====== */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 12px;
}
.table-scroll { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px;
}
.table thead {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table th, .table td {
  padding: 12px 18px;
  text-align: right;
  white-space: nowrap;
}
.table th:first-child, .table td:first-child {
  text-align: left;
}
.table tbody tr { border-top: 1px solid var(--border-soft); }
.table tbody tr:hover { background: var(--bg-hover); }
.table td.num { font-variant-numeric: tabular-nums; }
.table .positive { color: var(--positive); font-weight: 500; }
.table a { color: var(--accent); text-decoration: none; }
.table a:hover { text-decoration: underline; }

/* ====== Footer ====== */
.footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 32px 0 24px;
}
