/* app.evenrail.com — the private portal.
 *
 * Palette and type deliberately match evenrail.com's base.css so the app reads
 * as the same product rather than a bolted-on admin. It does NOT import that
 * file: the marketing site is a separate deploy on a separate host, and a
 * cross-origin stylesheet would make every page here wait on it. Dark only —
 * the light theme over there exists for visitors, and this is one person's
 * workbench. */

:root {
  --bg: #0a0e1a;
  --bg-surface: #0f131f;
  --bg-surface-low: #171b28;
  --bg-surface-high: #262a37;
  --text-primary: #e4e4e7;
  --text-body: #a1a1aa;
  --text-muted: #71717a;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-on: #001e2c;
  --tertiary: #ffc176;
  --danger: #f87171;
  --border: rgba(255, 255, 255, 0.08);
  --card-bg: rgba(255, 255, 255, 0.03);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: 1rem; }
button { cursor: pointer; }

/* ---------- layout ---------- */

.shell { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 5rem; }
.shell-narrow { max-width: 720px; }
.shell-reading { max-width: 780px; }

header[data-header] { border-bottom: 1px solid var(--border); background: var(--bg-surface); }

.nav {
  max-width: 1100px; margin: 0 auto; padding: 0.9rem 1.5rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.nav-brand { font-weight: 800; letter-spacing: -0.02em; color: var(--text-primary); }
.nav-brand:hover { text-decoration: none; color: var(--accent); }
.nav-links { display: flex; gap: 1.1rem; margin-right: auto; }
.nav-links a { color: var(--text-body); font-size: 0.95rem; }
.nav-links a[aria-current='page'] { color: var(--text-primary); font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 0.85rem; }
.nav-who { font-size: 0.9rem; }
@media (max-width: 620px) { .nav-who { display: none; } }

h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 1.35rem; font-weight: 700; }
.page-head {
  display: flex; align-items: flex-start; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1.75rem;
}
.page-head .grow { margin-right: auto; }

.muted { color: var(--text-muted); }
.lede { color: var(--text-body); margin-top: 0.35rem; }

/* ---------- controls ---------- */

.btn {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-surface-low); color: var(--text-primary);
  padding: 0.5rem 0.9rem; font-size: 0.92rem; font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover:not(:disabled) { background: var(--bg-surface-high); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-on); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-quiet { background: transparent; }
.btn-danger { color: var(--danger); }

.field { display: block; margin-bottom: 1.1rem; }
.field > span { display: block; font-size: 0.85rem; color: var(--text-body); margin-bottom: 0.35rem; }
input[type='text'], input[type='email'], input[type='password'], select, textarea {
  width: 100%; padding: 0.6rem 0.75rem;
  background: var(--bg-surface-low); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent;
}
textarea { resize: vertical; min-height: 8rem; line-height: 1.5; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }

.error {
  color: var(--danger); background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25); border-radius: 8px;
  padding: 0.65rem 0.85rem; margin-bottom: 1rem; font-size: 0.92rem;
}
.notice { color: var(--text-muted); padding: 2.5rem 0; text-align: center; }

/* ---------- cards & chips ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.card {
  display: block; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.1rem 1.2rem; color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
a.card:hover { text-decoration: none; border-color: var(--accent); background: var(--bg-surface-low); }
.card h2 { font-size: 1.05rem; margin-bottom: 0.3rem; }
.card p { color: var(--text-body); font-size: 0.92rem; }
.card-soon { opacity: 0.55; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.chip {
  border: 1px solid var(--border); border-radius: 999px; background: transparent;
  color: var(--text-body); padding: 0.3rem 0.8rem; font-size: 0.85rem;
}
.chip[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--accent-on); font-weight: 600; }

.tag {
  display: inline-block; border-radius: 999px; padding: 0.1rem 0.55rem;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em;
  text-transform: uppercase; border: 1px solid var(--border); color: var(--text-muted);
}
.tag-private { color: var(--text-muted); }
.tag-team { color: var(--tertiary); border-color: rgba(255, 193, 118, 0.35); }
.tag-public { color: var(--accent); border-color: rgba(56, 189, 248, 0.35); }

.meta { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: center;
        font-size: 0.85rem; color: var(--text-muted); }

/* ---------- research list ---------- */

.rows { display: flex; flex-direction: column; gap: 0.6rem; }
.row {
  display: block; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.9rem 1.1rem; color: inherit;
}
a.row:hover { text-decoration: none; border-color: var(--accent); background: var(--bg-surface-low); }
.row-top { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }
.row-title { font-weight: 600; font-size: 1.05rem; }
.row-summary { color: var(--text-body); font-size: 0.92rem; margin-top: 0.25rem; }
.row-meta { margin-top: 0.45rem; }

/* ---------- rendered report ---------- */

.md { color: var(--text-body); }
.md > * + * { margin-top: 1rem; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { color: var(--text-primary); line-height: 1.3; }
.md h1 { font-size: 1.7rem; }
.md h2 { font-size: 1.35rem; }
.md h3 { font-size: 1.12rem; }
.md h4, .md h5, .md h6 { font-size: 1rem; }
.md > h1, .md > h2, .md > h3 { margin-top: 2rem; }
.md ul, .md ol { padding-left: 1.4rem; }
.md li + li { margin-top: 0.3rem; }
.md strong { color: var(--text-primary); }
.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em;
  background: var(--bg-surface-low); border: 1px solid var(--border);
  border-radius: 5px; padding: 0.08em 0.35em;
}
.md pre {
  background: var(--bg-surface-low); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.9rem 1rem; overflow-x: auto;
}
.md pre code { background: none; border: 0; padding: 0; font-size: 0.85rem; }
.md blockquote {
  border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--text-muted);
}
.md hr { border: 0; border-top: 1px solid var(--border); }
/* The table scrolls inside its own box rather than making the page scroll
   sideways — a wide crypto table is normal here, not exceptional. */
.md-table { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.md th, .md td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); }
.md th { color: var(--text-primary); font-weight: 600; background: var(--bg-surface-low); white-space: nowrap; }
.md tbody tr:last-child td { border-bottom: 0; }

details.data { margin-top: 2.5rem; border-top: 1px solid var(--border); padding-top: 1.25rem; }
details.data summary { cursor: pointer; color: var(--text-body); font-size: 0.92rem; }
details.data pre {
  margin-top: 0.9rem; background: var(--bg-surface-low); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.9rem 1rem; overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem;
  color: var(--text-body);
}

/* ---------- login ---------- */

.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.login-card {
  width: 100%; max-width: 380px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 1.75rem;
}
.login-card h1 { font-size: 1.5rem; margin-bottom: 0.35rem; }
.login-card .lede { margin-bottom: 1.5rem; }
