/* SomaChain.org frontend — Part 38 rebuild.
   Vanilla CSS; no framework.  Palette mirrors the prior Mission Control
   visual (light cream + mint-emerald accent + purple DS mark) so the
   operator's existing brand colours carry over.
*/

:root {
  /* Brand */
  --ds-bg-base:      #faf7ff;      /* page background */
  --ds-bg-surface:   #ffffff;      /* panels */
  --ds-bg-elevated:  #f7f3fb;      /* nested panels, inputs */
  --ds-bg-muted:     #f4ebfb;
  --ds-text-1:       #1a1630;      /* primary text */
  --ds-text-2:       #4b4560;      /* secondary */
  --ds-text-3:       #8e88a5;      /* muted */
  --ds-border:       #ede3f5;      /* subtle panel border */
  --ds-border-2:     #e4d6ef;      /* stronger */
  --ds-accent:       #10b981;      /* mint — primary action */
  --ds-accent-2:     #059669;      /* darker mint for hover */
  --ds-accent-soft:  #d1fae5;
  --ds-purple:       #7c3aed;      /* DS brand purple */
  --ds-purple-soft:  #ede9fe;
  --ds-danger:       #ef4444;
  --ds-warning:      #f59e0b;
  --ds-info:         #3b82f6;
  --ds-gradient:     linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #10b981 100%);

  /* Typography */
  --font-display:    "Orbitron", system-ui, sans-serif;
  --font-body:       "Space Grotesk", -apple-system, "Segoe UI", sans-serif;
  --font-mono:       "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;

  /* Layout */
  --rail-width:      72px;
  --status-height:   28px;
  --radius-1:        8px;
  --radius-2:        14px;
  --radius-3:        20px;
  --shadow-1:        0 1px 2px rgba(26, 22, 48, 0.04);
  --shadow-2:        0 4px 14px rgba(26, 22, 48, 0.06);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ds-bg-base);
  color: var(--ds-text-1);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
* { box-sizing: border-box; }

a { color: inherit; text-decoration: none; }
code, pre, .mono, .num { font-family: var(--font-mono); }

/* ---------- Layout scaffolding ---------- */
.ds-app {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}
.ds-rail {
  width: var(--rail-width);
  flex-shrink: 0;
  background: var(--ds-bg-surface);
  border-right: 1px solid var(--ds-border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 14px 8px 14px;
  gap: 6px;
  user-select: none;
}
.ds-rail-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 6px;
  border-radius: 12px;
  background: var(--ds-gradient);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  letter-spacing: 1px;
  box-shadow: var(--shadow-1);
}
.ds-rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: var(--radius-1);
  color: var(--ds-text-2);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ds-rail-item:hover { background: var(--ds-bg-muted); color: var(--ds-text-1); }
.ds-rail-item.active {
  background: var(--ds-purple-soft);
  color: var(--ds-purple);
  font-weight: 600;
}
.ds-rail-item svg { width: 22px; height: 22px; }
.ds-rail-spacer { flex: 1 1 auto; }
.ds-rail-footer {
  border-top: 1px solid var(--ds-border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ds-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.ds-content {
  padding: 32px 42px 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 800px) {
  .ds-content { padding: 20px; }
}

/* ---------- Status bar ---------- */
.ds-status {
  height: var(--status-height);
  background: var(--ds-bg-surface);
  border-top: 1px solid var(--ds-border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  font-size: 11px;
  color: var(--ds-text-3);
  font-family: var(--font-mono);
}
.ds-status .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ds-text-3);
  margin-right: 5px;
}
.ds-status .dot.ok { background: var(--ds-accent); }
.ds-status .dot.warn { background: var(--ds-warning); }
.ds-status .dot.err { background: var(--ds-danger); }
.ds-status .sep { color: var(--ds-border-2); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: 0.02em; }
h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 6px;
  background: var(--ds-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
h2 { font-size: 18px; margin: 0 0 12px; color: var(--ds-text-1); }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--ds-text-2); text-transform: uppercase; letter-spacing: 0.08em; }
.ds-subtitle { color: var(--ds-text-2); font-size: 13px; margin: 0 0 24px; }

/* ---------- Panels / cards ---------- */
.ds-card {
  background: var(--ds-bg-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--radius-2);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
}
.ds-card + .ds-card { margin-top: 18px; }
.ds-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ds-text-3);
  margin-bottom: 12px;
  font-weight: 600;
  font-family: var(--font-body);
}
.ds-card-title .icon { font-size: 14px; }

.ds-grid {
  display: grid;
  gap: 18px;
}
.ds-grid-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.ds-grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.ds-grid-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

/* Big stat number inside a card */
.ds-stat {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--ds-text-1);
  margin: 0;
  letter-spacing: -0.01em;
}
.ds-stat .unit {
  font-size: 13px;
  color: var(--ds-text-3);
  margin-left: 6px;
  font-weight: 400;
}
.ds-stat-note {
  font-size: 11px;
  color: var(--ds-text-3);
  margin-top: 6px;
  font-family: var(--font-body);
}
.ds-stat.accent { color: var(--ds-accent); }
.ds-stat.purple { color: var(--ds-purple); }

/* Table */
.ds-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ds-table th, .ds-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ds-border);
  font-family: var(--font-mono);
}
.ds-table th {
  color: var(--ds-text-3);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-body);
}
.ds-table tbody tr:hover { background: var(--ds-bg-elevated); }

/* Forms */
input, textarea, select {
  background: var(--ds-bg-elevated);
  border: 1px solid var(--ds-border-2);
  border-radius: var(--radius-1);
  color: var(--ds-text-1);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ds-purple);
  background: #fff;
}
button {
  background: var(--ds-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-1);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  cursor: pointer;
  transition: background 0.15s ease;
}
button:hover { background: var(--ds-accent-2); }
button.ghost {
  background: transparent;
  color: var(--ds-text-1);
  border: 1px solid var(--ds-border-2);
}
button.ghost:hover { background: var(--ds-bg-muted); }
button.purple { background: var(--ds-purple); }
button.purple:hover { background: #6d28d9; }
button.danger { background: var(--ds-danger); }
button[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Badges / chips */
.ds-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--ds-bg-muted);
  color: var(--ds-text-2);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.ds-chip.ok   { background: var(--ds-accent-soft); color: var(--ds-accent-2); }
.ds-chip.warn { background: #fef3c7; color: #92400e; }
.ds-chip.err  { background: #fee2e2; color: #b91c1c; }
.ds-chip.info { background: #dbeafe; color: #1e40af; }
.ds-chip.purple { background: var(--ds-purple-soft); color: var(--ds-purple); }

/* Progress bars */
.ds-bar {
  width: 100%;
  height: 6px;
  background: var(--ds-bg-muted);
  border-radius: 999px;
  overflow: hidden;
}
.ds-bar > div {
  height: 100%;
  background: var(--ds-accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Feed rows */
.ds-feed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-1);
  transition: background 0.15s ease;
}
.ds-feed-row:hover { background: var(--ds-bg-elevated); }
.ds-feed-row .label { flex: 1; min-width: 0; }
.ds-feed-row .label strong { font-weight: 600; color: var(--ds-text-1); }
.ds-feed-row .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ds-text-3);
}

/* Utility */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.muted { color: var(--ds-text-3); }
.small { font-size: 12px; }
.pre { white-space: pre-wrap; word-break: break-word; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.center { text-align: center; }

/* Loader */
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.loader {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ds-purple);
  animation: pulse 1s ease infinite;
  margin-right: 4px;
}
