/* MATRIX: an instrument, not a brochure. Flat surfaces, hairline rules, mono for data, green only as a signal. */
:root {
  --ink: #0a0d0b;            /* navbar, headings, rules */
  --text: #1d2420;
  --muted: #69736d;
  --faint: #9aa39e;
  --rule: #e2e6e3;           /* hairlines */
  --surface: #f6f8f7;        /* subtle panels */
  --page: #ffffff;
  --green: #12a150;          /* the one accent: active, positive, links */
  --green-ink: #0b7a3b;
  --green-wash: #eaf6ef;
  --sans: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

body { background: var(--page); color: var(--text); font-family: var(--sans); font-size: 0.92rem; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--green-ink); }
a:hover { color: var(--green); text-decoration: none; }
code, pre, .mono { font-family: var(--mono); }
.mono { font-size: 0.86em; font-variant-numeric: tabular-nums; }
.label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); }
hr { border-top-color: var(--rule); }

/* Navbar */
#mainNavbar { background: var(--ink); border-bottom: 1px solid #000; padding: 0 1rem; min-height: 46px; }
#mainNavbar .navbar-brand { font-family: var(--mono); color: #fff; font-weight: 600; letter-spacing: 0.18em; font-size: 0.95rem; }
#mainNavbar .navbar-brand i { color: var(--green); }
#mainNavbar .nav-link { color: #aeb8b2; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 14px 12px;
                        border-bottom: 2px solid transparent; transition: color 120ms ease, border-color 120ms ease; }
#mainNavbar .nav-link i { color: #6e7a73; margin-right: 5px; }
#mainNavbar .nav-link:hover { color: #fff; }
#mainNavbar .nav-current { color: #fff; border-bottom-color: var(--green); }
#mainNavbar .nav-current i { color: var(--green); }
#mainNavbar .navbar-text { color: #aeb8b2; font-family: var(--mono); font-size: 0.75rem; }
#mainNavbar .dropdown-menu { border-radius: 2px; border-color: var(--rule); font-size: 0.85rem; }
#mainNavbar .dropdown-item:active { background: var(--ink); }
.btn-nav { color: #aeb8b2; border: 1px solid #2c3530; border-radius: 2px; }
.btn-nav:hover { color: #fff; border-color: var(--green); }

/* Controls: flat, near-square */
.btn, .form-control, .badge, .card, .alert { border-radius: 2px; }
.btn { font-size: 0.82rem; font-weight: 500; letter-spacing: 0.02em; }
.btn-primary { background: var(--ink); border-color: var(--ink); }
.btn-primary:hover, .btn-primary:focus { background: var(--green-ink); border-color: var(--green-ink); }
.btn-outline-primary { color: var(--ink); border-color: #c5ccc8; }
.btn-outline-primary:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.form-control { border-color: #cfd6d2; font-size: 0.85rem; }
.form-control:focus { border-color: var(--ink); box-shadow: none; }

.env-banner { background: #f2c94c; color: var(--ink); text-align: center; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; padding: 1px; }
footer { border-top: 1px solid var(--rule); font-family: var(--mono); font-size: 0.72rem !important; color: var(--faint) !important; }
.page-head { border-bottom: 1px solid var(--ink); padding-bottom: 0.6rem; margin-bottom: 1rem; }
.page-head .meta { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }

/* Home */
.hero { padding: 2.5rem 0 1.25rem; }
.hero h1 { font-family: var(--mono); font-size: 2.1rem; letter-spacing: 0.14em; }
.hero h1 i { color: var(--green); }
.hero .lead { color: var(--muted); max-width: 48rem; font-size: 1.05rem; }
.hero .meta { font-family: var(--mono); font-size: 0.78rem; color: var(--faint); }
.pipeline { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--rule); }
.pipeline .stage { padding: 0.9rem 1rem; border-right: 1px solid var(--rule); }
.pipeline .stage:last-child { border-right: none; }
.pipeline .stage .num { font-family: var(--mono); font-size: 0.68rem; color: var(--faint); }
.pipeline .stage .num i { margin-left: 6px; color: var(--green); }
.pipeline .stage .value { font-family: var(--mono); font-size: 1.7rem; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2; }
.pipeline .stage.pending .value, .pipeline .stage.pending .num i { color: var(--faint); }
.pipeline .stage.done { box-shadow: inset 0 2px 0 var(--green); }
.pipeline .in-progress { display: block; margin-top: 0.3rem; font-family: var(--mono); font-size: 0.72rem; color: var(--green-ink); }
.pipeline .in-progress.idle { color: var(--faint); }
@media (max-width: 992px) { .pipeline { grid-template-columns: repeat(2, 1fr); } .pipeline .stage { border-bottom: 1px solid var(--rule); } }
.facets { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; }   /* wrap within the column */
.facets a { font-family: var(--mono); font-size: 0.8rem; white-space: nowrap; }
.facets a span { color: var(--faint); }

/* Tables */
.table { color: var(--text); }
.table thead th { border-top: none; border-bottom: 1px solid var(--ink); font-size: 0.68rem; font-weight: 600; text-transform: uppercase;
                  letter-spacing: 0.08em; color: var(--muted); background: var(--page); position: sticky; top: 0; z-index: 1; }
.table td { border-top: 1px solid var(--rule); }
.table-hover tbody tr:hover { background: var(--surface); }
.obs-table td { vertical-align: top; }
.obs-table .tight { width: 1%; white-space: nowrap; }   /* short fields: only as wide as their content */
.obs-table .measured { min-width: 9rem; max-width: 16rem; }
.obs-table .readout { min-width: 14rem; }
.obs-table .result { min-width: 26rem; }                /* the main text column takes the remaining space */

mark.hit { background: #cdeedb; color: inherit; padding: 0 1px; border-radius: 2px; }  /* search matches */

/* Status tags: flat, outlined, mono */
.tag { display: inline-block; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase;
       border: 1px solid #c5ccc8; color: var(--muted); padding: 0 5px; border-radius: 2px; line-height: 1.6; vertical-align: 1px; }
.tag-increase, .tag-decrease, .tag-biphasic, .tag-mixed, .tag-done { border-color: var(--green); color: var(--green-ink); }
.tag-failed { border-color: #c0392b; color: #c0392b; }
.tag-figure { border-color: #d8b24a; color: #8a6d12; }

/* Records */
dl.record dt { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding-top: 0.15rem; }
dl.record dd { border-bottom: 1px solid var(--rule); padding-bottom: 0.5rem; }
blockquote.evidence { border-left: 2px solid var(--rule); padding-left: 0.75rem; margin-bottom: 0.6rem; }
blockquote.evidence.verbatim { border-left-color: var(--green); }
blockquote.evidence footer { border: none; font-size: 0.68rem !important; }
pre.raw { background: var(--surface); border: 1px solid var(--rule); padding: 0.75rem; font-size: 0.75rem; }
pre.notes { white-space: pre-wrap; font-family: var(--sans); font-size: 0.85rem; }
details summary { color: var(--green-ink); cursor: pointer; }

/* Docs */
.markdown { line-height: 1.6; }
.markdown table { width: auto; margin-bottom: 1rem; }
.markdown table td, .markdown table th { border: 1px solid var(--rule); padding: 3px 8px; }
.markdown pre { background: var(--surface); border: 1px solid var(--rule); padding: 0.75rem; border-radius: 2px; }
.markdown code { color: var(--ink); }

/* Ingest */
.dropzone { border: 1px dashed #9aa39e; border-radius: 2px; padding: 2.25rem; text-align: center; color: var(--muted); background: var(--surface); }
.dropzone.over { border-color: var(--green); background: var(--green-wash); color: var(--green-ink); }

/* Sign-in */
.auth-page { min-height: 100vh; background: var(--ink); color: #aeb8b2; }
.auth-page h1 { font-family: var(--mono); color: #fff; letter-spacing: 0.2em; font-weight: 600; }
.auth-page h1 i { color: var(--green); }
.auth-page .rule { width: 48px; height: 2px; background: var(--green); margin: 1rem auto 1.25rem; }

/* Loading spinner (loading.js) */
#loadingSpinner { position: fixed; inset: 46px 0 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
#loadingSpinner[hidden] { display: none; }
.loading-message { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.balls { display: flex; gap: 8px; }
.balls div { width: 10px; height: 10px; background: var(--green); border-radius: 1px; animation: pulse 0.9s ease-in-out infinite; }
.balls div:nth-child(2) { animation-delay: 0.15s; }
.balls div:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.2; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-6px); } }
