/* Self-hosted fonts (latin subset) — no third-party requests. */
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/chakra-petch-500.woff2") format("woff2");
}
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/chakra-petch-600.woff2") format("woff2");
}
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/chakra-petch-700.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-500.woff2") format("woff2");
}

:root {
  --bg: #101419;
  --panel: #161C23;
  --panel-2: #1B222B;
  --line: #2A333D;
  --text: #D8DEE4;
  --muted: #7E8A96;
  --caldari: #6B93BD;
  /* Lightened from Warzone Companion's #C4574A — that shade fails WCAG AA
     (3.9:1) at normal text size against --panel/--panel-2; this passes
     4.5:1+ against both. */
  --danger: #D6695C;
  --good: #3FA98C;
  --font-display: "Chakra Petch", "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Consolas", monospace;
}

/* Same roles, re-tuned for a light background — darker accents throughout
   since the mid-tones above only clear WCAG AA against the dark panels. */
:root[data-theme="light"] {
  --bg: #F2F4F6;
  --panel: #FFFFFF;
  --panel-2: #E8EBEE;
  --line: #D3D8DD;
  --text: #1A2027;
  --muted: #5B6570;
  --caldari: #2E5E8C;
  --danger: #B23A2C;
  --good: #1D7A5C;
}

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

/* Always reserve the scrollbar gutter — without this, switching between
   boards/tabs whose content is sometimes taller than the viewport and
   sometimes not makes the whole page shift sideways by the scrollbar's
   width every time it appears or disappears. */
html { scrollbar-gutter: stable; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 24px 64px; }

/* ---------- Header ---------- */
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 28px 0 16px;
}
.brand h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand h1 span { color: var(--muted); font-weight: 500; }
.brand p { color: var(--muted); font-size: 13px; margin-top: 2px; }

.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}
.btn:hover { border-color: var(--muted); }
.btn.active-mode { border-color: var(--caldari); color: var(--caldari); }

button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--caldari);
  outline-offset: 2px;
}

/* min-width reserves space for the "As of ..." text that only arrives after
   the first ESI load resolves — without it, the header reflows a second
   time once the timestamp is set, adding another layout shift. */
.timestamp { display: inline-block; min-width: 150px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* ---------- Board switcher (New Eden / Exordium — no route between them) ---------- */
.board-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}
.board-nav a {
  display: inline-block;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  transition: color 150ms ease, border-color 150ms ease;
}
.board-nav a:hover { color: var(--text); }
.board-nav a.active { color: var(--text); border-bottom-color: var(--caldari); }

/* ---------- Section title ---------- */
.section-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 32px 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title:first-child { margin-top: 0; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Dashboard ---------- */
.dash-ticker {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
/* The one number on the page most worth noticing first. */
.dash-ticker-isk { font-size: 20px; font-weight: 500; color: var(--text); }

.deals-list { display: flex; flex-direction: column; margin-bottom: 32px; }
.deal-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 8px;
  transition: border-color 150ms ease, background-color 150ms ease;
}
.deal-row:hover { border-color: var(--muted); background: var(--panel-2); }
.deal-name { flex: 1; font-size: 14px; min-width: 0; }
.deal-name .sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.deal-reward { font-size: 14px; white-space: nowrap; }
.dash-deals-empty { color: var(--muted); font-family: var(--font-mono); font-size: 13px; padding: 4px 0 12px; }
.deal-expand {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--muted);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 16px;
  margin: -8px 0 0;
  transition: max-height 200ms ease, opacity 200ms ease, padding 200ms ease, margin 200ms ease;
}
.deal-expand.open { max-height: 120px; opacity: 1; padding: 10px 16px; margin: -4px 0 8px; }
.deal-expand b { color: var(--text); font-weight: 500; }

.dash-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 700px) {
  .dash-two-col { grid-template-columns: 1fr; gap: 0; }
}

.secbar { display: flex; height: 30px; border-radius: 5px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 10px; }
.secbar div { display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
.sec-hs { background: #2E5B3E; color: #8FE0A8; }
.sec-ls { background: #5C4A1E; color: #F0C567; }
.sec-ns { background: #5C2A26; color: #F09188; }
.seclegend { display: flex; gap: 20px; font-size: 12px; color: var(--muted); font-family: var(--font-mono); margin-bottom: 32px; }
.seclegend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.leg-hs::before { background: #8FE0A8; }
.leg-ls::before { background: #F0C567; }
.leg-ns::before { background: #F09188; }

.corps-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 32px; }
.corp-row { display: flex; align-items: center; gap: 12px; padding: 9px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.corp-row .rank { color: var(--muted); width: 16px; font-size: 12px; }
.corp-row .cname { flex: 1; }
.corp-row .bar { height: 6px; background: var(--caldari); border-radius: 3px; opacity: 0.55; transition: width 300ms ease; }
.corp-row .count { font-size: 12px; color: var(--muted); white-space: nowrap; }

.board-split { display: flex; flex-direction: column; gap: 10px; }
.board-split-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 150ms ease;
}
.board-split-row:hover { border-color: var(--muted); }

/* ---------- Skeleton loading placeholders ---------- */
@keyframes skeleton-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.7; } }
.skeleton { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; animation: skeleton-pulse 1.4s ease-in-out infinite; }
.skeleton-row { height: 46px; margin-bottom: 8px; }
.skeleton-bar { height: 30px; margin-bottom: 10px; }
.board-split-row span:first-child {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex: 1;
}
.board-split-row .mono { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
/* Each label+control pair wraps as one unit — never splits the label onto
   one line and its input onto the next. */
.field {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toolbar label { font-size: 13px; color: var(--muted); }
.toolbar select,
.toolbar input[type="text"],
.toolbar input[type="number"] {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 10px;
  transition: border-color 150ms ease;
}
.toolbar select:hover,
.toolbar input[type="text"]:hover,
.toolbar input[type="number"]:hover { border-color: var(--muted); }
.toolbar input[type="text"] { width: 180px; }
.toolbar input[type="number"] { width: 90px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] { accent-color: var(--caldari); cursor: pointer; }
.jobs-count { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* ---------- Table ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 620px; }

/* On narrow screens the table is wider than the viewport (Reward/Value/State
   sit off-screen) and there's otherwise no hint that it scrolls sideways —
   mobile browsers auto-hide scrollbars, so without this the columns are
   effectively invisible. */
.scroll-hint { display: none; }
@media (max-width: 700px) {
  .scroll-hint {
    display: block;
    font-size: 11px;
    color: var(--muted);
    text-align: right;
    margin: -6px 0 8px;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
thead th {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
tbody td { padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color 150ms ease; }
tbody tr:hover { background: var(--panel-2); }

td.mono { font-family: var(--font-mono); font-size: 13px; }
td .sub { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
td .sub.soon { color: var(--danger); font-weight: 600; }

.vp-bar {
  position: relative;
  height: 10px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
  min-width: 120px;
}
.vp-bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 2px; }

.status-pill { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.status-pill.hot { color: var(--danger); }
.status-pill.good { color: var(--good); }
/* De-emphasized state, without opacity — --muted is already at the WCAG AA
   contrast floor against --panel-2, so dimming it further would fail. */
.status-pill.dim { font-style: italic; }

/* ---------- Freelance job rows ---------- */
.job-row { cursor: pointer; }
.job-detail td {
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 24px;
  font-size: 13px;
  margin-bottom: 8px;
}
.dlabel { color: var(--muted); margin-right: 6px; }
.job-desc { font-size: 13px; color: var(--text); white-space: pre-line; }

/* ---------- States ---------- */
.error-box {
  padding: 32px 20px;
  text-align: center;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 13px;
}
.hidden { display: none !important; }

/* ---------- FAQ ---------- */
.faq { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.faq-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 16px;
}
.faq-item summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: color 150ms ease;
}
.faq-item summary:hover { color: var(--caldari); }
.faq-item p {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}

/* ---------- Legal ---------- */
.legal { max-width: 760px; }
.legal h2 {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 32px 0 10px;
}
.legal h2:first-child { margin-top: 0; }
.legal h3 { font-size: 15px; margin: 18px 0 6px; }
.legal p, .legal li { font-size: 14px; line-height: 1.7; }
.legal ul { margin: 6px 0 6px 20px; }
.legal a { color: var(--caldari); }

/* ---------- Footer ---------- */
footer {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
footer .mono { font-family: var(--font-mono); }
footer a { color: var(--muted); transition: color 150ms ease; }
footer a:hover { color: var(--text); }
.footer-family a { margin-right: 12px; }

/* ---------- Small screens ---------- */
@media (max-width: 700px) {
  .wrap { padding: 0 12px 48px; }
  header { padding: 18px 0 12px; }
  .brand h1 { font-size: 20px; }
  thead th { padding: 8px 8px; font-size: 11px; }
  tbody td { padding: 7px 8px; font-size: 12.5px; }
  td.mono { font-size: 11.5px; }
  .vp-bar { min-width: 70px; }
  .toolbar input[type="text"] { width: 140px; }
}
