/* XV Exchange — Daily Reports
   Light + dark theme via data-theme attribute on <html>.
   Defaults to system preference; explicit choice persists in localStorage. */

:root {
  /* Light */
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-subtle: #f1f1f1;
  --fg: #0a0a0a;
  --muted: #525252;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --accent: #f0a830;       /* XV amber */
  --accent-fg: #0a0a0a;
  --accent-hover: #d99622;
  --link: #b07820;
  --link-hover: #f0a830;
  --header-bg: #1a1a1a;
  --header-fg: #fafafa;
  --header-border: #2a2a2a;
  --footer-bg: #1a1a1a;
  --footer-fg: #fafafa;
  --footer-muted: #a3a3a3;
  --table-header-bg: #1a1a1a;
  --table-header-fg: #fafafa;
}

html[data-theme="dark"] {
  /* Dark — mirrors the XV exchange demo charcoal */
  --bg: #1a1a1a;
  --bg-elevated: #262626;
  --bg-subtle: #2a2a2a;
  --fg: #fafafa;
  --muted: #a3a3a3;
  --border: #333333;
  --border-strong: #404040;
  --accent: #f0a830;
  --accent-fg: #0a0a0a;
  --accent-hover: #f5b850;
  --link: #f0a830;
  --link-hover: #f5b850;
  --header-bg: #0d0d0d;
  --header-fg: #fafafa;
  --header-border: #262626;
  --footer-bg: #0d0d0d;
  --footer-fg: #fafafa;
  --footer-muted: #737373;
  --table-header-bg: #262626;
  --table-header-fg: #fafafa;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.15s ease, color 0.15s ease;
}

/* Header */
header.topbar { background: var(--header-bg); padding: 20px 32px; border-bottom: 1px solid var(--header-border); }
header.topbar .inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 32px;
}
header.topbar .brand { display: flex; align-items: center; flex-shrink: 0; }
header.topbar .brand img { height: 44px; width: auto; display: block; }
header.topbar .nav { display: flex; gap: 28px; flex: 1; }
header.topbar .nav a {
  color: var(--header-fg);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}
header.topbar .nav a:hover { border-bottom-color: var(--header-fg); }
header.topbar .nav a.active { border-bottom-color: var(--header-fg); }
.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--header-fg);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.theme-toggle:hover { background: rgba(255,255,255,0.08); }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
html[data-theme="dark"] .theme-toggle .sun { display: block; }
html[data-theme="dark"] .theme-toggle .moon { display: none; }

/* Main */
main { flex: 1; max-width: 1000px; margin: 56px auto; padding: 0 24px; width: 100%; }
h1 {
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
h1.bordered {
  font-size: 28px;
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  line-height: 1.2;
}
p.lead {
  color: var(--muted);
  margin: 0 0 40px;
  line-height: 1.6;
  font-size: 16px;
  max-width: 720px;
}
h1.bordered + p.lead { padding-left: 17px; }

/* Index cards */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .cards { grid-template-columns: 1fr; } }
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s ease, transform 0.05s ease;
  display: block;
}
.card:hover { border-color: var(--border-strong); }
.card:active { transform: translateY(1px); }
.card h2 { font-size: 18px; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.01em; }
.card p { color: var(--muted); margin: 0; line-height: 1.5; font-size: 14px; }
.card .arrow {
  display: inline-block;
  margin-top: 20px;
  color: var(--fg);
  font-weight: 500;
  font-size: 13px;
}

/* Filters */
.filters {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filters label {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.filters select {
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.filters button {
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: background 0.15s ease;
}
.filters button:hover { background: var(--accent-hover); }

/* Reports list */
table.report-list {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 48px;
}
table.report-list thead th {
  background: var(--table-header-bg);
  color: var(--table-header-fg);
  padding: 14px 20px;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  user-select: none;
}
table.report-list thead th:last-child { text-align: right; }
table.report-list thead th.sortable {
  cursor: pointer;
  transition: background 0.12s ease;
}
table.report-list thead th.sortable:hover { background: var(--bg-elevated); color: var(--fg); }
html[data-theme="dark"] table.report-list thead th.sortable:hover { background: var(--bg-subtle); }
table.report-list thead th .sort-ind {
  display: inline-block;
  margin-left: 6px;
  color: var(--accent);
  font-size: 10px;
  min-width: 12px;
}
table.report-list tbody td {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 15px;
}
table.report-list tbody td:last-child {
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}
table.report-list tbody td a {
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
}
table.report-list tbody td a:hover { color: var(--link-hover); text-decoration: underline; }
table.report-list tbody tr:first-child td { border-top: none; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Column / Status reference — collapsed by default, sits between hero & filters */
details.ref-toggle { margin-bottom: 24px; }
details.ref-toggle summary {
  cursor: pointer;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease;
}
details.ref-toggle summary::-webkit-details-marker { display: none; }
details.ref-toggle summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.15s ease;
  color: var(--accent);
  font-size: 12px;
  flex-shrink: 0;
}
details.ref-toggle[open] summary::before { transform: rotate(90deg); }
details.ref-toggle summary::after {
  content: "Click to expand";
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
details.ref-toggle[open] summary::after { content: "Click to collapse"; }
details.ref-toggle summary:hover { background: var(--bg-subtle); }
details.ref-toggle[open] summary { margin-bottom: 12px; }
table.cols {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
table.cols th, table.cols td {
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
table.cols thead th {
  background: var(--bg-subtle);
  border-top: none;
  font-weight: 600;
  color: var(--fg);
}
table.cols td:first-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  white-space: nowrap;
}
table.cols td:nth-child(2) {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  white-space: nowrap;
}

/* Footer */
footer {
  background: var(--footer-bg);
  color: var(--footer-fg);
  padding: 56px 24px 48px;
  text-align: center;
  margin-top: 64px;
}
footer .logo img { height: 64px; width: auto; display: block; margin: 0 auto 28px; }
footer .contact { font-size: 16px; margin: 0 0 32px; }
footer h2 { font-size: 16px; font-weight: 400; text-decoration: underline; margin: 0 0 16px; }
footer .disclaimer {
  max-width: 900px;
  margin: 0 auto;
  font-size: 13px;
  line-height: 1.6;
  color: var(--footer-muted);
}
footer a { color: inherit; }
