/* ============================================================
   Arbitrage Console — Editorial Operator Terminal
   Designed for operators. Dense, confident, monochrome with
   intentional accents. Display: Fraunces serif. Body: Geist.
   Numerics: Geist Mono.
   ============================================================ */

:root {
  /* Surfaces */
  --bg:        #0b0b0c;
  --bg-2:     #111114;
  --surface:  #15161a;
  --surface-2:#1c1d22;
  --border:   #26282f;
  --border-2: #353742;

  /* Type */
  --fg:       #f5f3ee;
  --fg-2:     #b8b4ac;
  --fg-3:     #807d77;
  --fg-4:     #535055;

  /* Accents */
  --accent:    #d4b878;       /* warm gold — primary */
  --accent-2:  #e8d4a3;
  --positive:  #4cc38a;
  --negative:  #e26464;
  --warn:      #e0a956;
  --info:      #76a9d8;

  /* Geometry */
  --radius:   2px;
  --radius-2: 6px;

  /* Type scale */
  --display: "Fraunces", Georgia, serif;
  --sans:    "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "Geist Mono", ui-monospace, "JetBrains Mono", "Menlo", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.005em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
}

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

/* Faint grain overlay for atmosphere */
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: .025;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/></svg>");
  mix-blend-mode: overlay;
}

/* ---- top bar ---------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 14px 28px;
  background: rgba(11,11,12,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-family: var(--display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--fg); }
.brand__mark {
  color: var(--accent);
  font-size: 16px;
  transform: translateY(-1px);
}
.nav {
  display: flex;
  gap: 2px;
  margin-left: auto;
  flex-wrap: wrap;
}
.nav a {
  color: var(--fg-2);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.005em;
  transition: color 120ms ease, background 120ms ease;
  white-space: nowrap;
}
.nav a:hover { color: var(--fg); background: var(--surface); }
.nav__active { color: var(--fg) !important; background: var(--surface) !important; }
.user-menu {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
.user-menu__email {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg-3);
}
.link-btn {
  background: none;
  border: 0;
  color: var(--fg-2);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13.5px;
  padding: 0;
}
.link-btn:hover { color: var(--accent); }

/* ---- main / sections ------------------------------------------- */

.main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 28px 96px;
  position: relative;
  z-index: 2;
}

.h1, h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(36px, 5vw, 56px);
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 8px;
  color: var(--fg);
}
.h2, h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 6px;
  color: var(--fg);
}
.h3, h3 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin: 0 0 12px;
}

.lede {
  color: var(--fg-2);
  font-size: 17px;
  line-height: 1.6;
  max-width: 65ch;
  margin: 0 0 36px;
}

.section { margin-bottom: 56px; }

/* ---- cards / panels -------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
  padding: 28px;
}
.panel--tight { padding: 20px; }

.grid {
  display: grid;
  gap: 16px;
}
.grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 800px) {
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
}

/* ---- forms ----------------------------------------------------- */

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
label {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-3);
}
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="date"], input[type="number"], select, textarea {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13.5px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 120ms ease, background 120ms ease;
}
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5l5 5 5-5' stroke='%23807d77' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
textarea {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
}
input[type="date"] {
  color-scheme: dark;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: var(--bg);
}
input::placeholder, textarea::placeholder {
  color: var(--fg-4);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #1a1410;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease;
}
.btn:hover { background: var(--accent-2); }
.btn:active { transform: translateY(1px); }
.btn--ghost {
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--border);
}
.btn--ghost:hover { background: var(--surface); color: var(--fg); }
.btn--danger {
  background: transparent;
  color: var(--negative);
  border: 1px solid var(--border);
}
.btn--danger:hover { background: rgba(226,100,100,0.1); border-color: var(--negative); }

/* ---- alerts ---------------------------------------------------- */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 13.5px;
  margin-bottom: 24px;
}
.alert--ok { border-color: var(--positive); color: var(--positive); background: rgba(76,195,138,0.06); }
.alert--err { border-color: var(--negative); color: var(--negative); background: rgba(226,100,100,0.06); }
.alert--info { border-color: var(--info); color: var(--info); background: rgba(118,169,216,0.06); }

/* ---- badges & tags --------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--fg-2);
}
.badge--ok { color: var(--positive); border-color: rgba(76,195,138,0.3); background: rgba(76,195,138,0.06); }
.badge--warn { color: var(--warn); border-color: rgba(224,169,86,0.3); background: rgba(224,169,86,0.06); }
.badge--err { color: var(--negative); border-color: rgba(226,100,100,0.3); background: rgba(226,100,100,0.06); }
.badge--neutral { color: var(--fg-3); }

/* ---- numerics -------------------------------------------------- */

.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.metric__label {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.metric__value {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--fg);
}

/* ---- score bars ------------------------------------------------ */

.score-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.score-row:last-child { border-bottom: 0; }
.score-row__label {
  flex: 0 0 120px;
  font-size: 13px;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.score-row__bar {
  flex: 1;
  height: 4px;
  background: var(--bg-2);
  border-radius: 2px;
  overflow: hidden;
}
.score-row__fill {
  height: 100%;
  background: var(--accent);
  transition: width 400ms ease;
}
.score-row__num {
  flex: 0 0 60px;
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg-2);
}

/* ---- issue cards ----------------------------------------------- */

.issue {
  display: grid;
  grid-template-columns: 90px 80px 1fr;
  gap: 16px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.issue:last-child { border-bottom: 0; }
.issue__pillar {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-3);
}
.issue__sev { font-size: 11px; }
.issue__msg { font-size: 13.5px; color: var(--fg-2); line-height: 1.55; }

/* ---- htmx loading ---------------------------------------------- */

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.htmx-request.btn { opacity: 0.6; pointer-events: none; }

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- footer ---------------------------------------------------- */

.foot {
  border-top: 1px solid var(--border);
  padding: 18px 28px;
  display: flex;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-4);
  position: relative;
  z-index: 2;
}
.dot { color: var(--fg-4); }

/* ---- auth pages ------------------------------------------------ */

.auth-shell {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
}
.auth-card .h1 {
  font-size: 32px;
  margin-bottom: 4px;
}
.auth-card .lede {
  font-size: 14.5px;
  margin-bottom: 28px;
}
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.btn-google {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border-2);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 120ms ease;
}
.btn-google:hover { border-color: var(--fg-3); }
.full { width: 100%; justify-content: center; }

/* ---- landing --------------------------------------------------- */

.hero {
  padding-top: 32px;
  padding-bottom: 64px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 56px;
}
.hero__eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
  padding: 4px 10px;
  border: 1px solid rgba(212,184,120,0.3);
  border-radius: 2px;
  background: rgba(212,184,120,0.05);
}
.hero__cta { margin-top: 28px; display: flex; gap: 12px; }
