/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #1e293b;
  --brand-light: #334155;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --surface: #ffffff;
  --bg: #f1f5f9;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --green: #16a34a;
  --red: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 24px rgba(0,0,0,.10);
}

html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

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

/* ── Header ────────────────────────────────────────────── */
.site-header {
  background: var(--brand);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.site-header .logo:hover { text-decoration: none; opacity: .9; }
.site-header nav { display: flex; align-items: center; gap: .75rem; }
.site-header nav a {
  color: rgba(255,255,255,.8);
  font-size: .875rem;
  padding: .35rem .75rem;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.site-header nav a:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}
.site-header button {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.15);
  padding: .35rem .85rem;
  font-size: .875rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.site-header button:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ── Main Layout ───────────────────────────────────────── */
.main {
  max-width: 1500px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}
.main h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: var(--text);
}

.preview-notice {
  background: #fef3c7;
  color: #92400e;
  padding: .6rem 1rem;
  border-radius: 8px;
  font-size: .875rem;
  border: 1px solid #fde68a;
  margin-bottom: 1.25rem;
}
.preview-notice a { color: #b45309; font-weight: 600; }

/* ── Table Card ────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.table-wrap { overflow-x: auto; }

/* ── Data Table ────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  white-space: nowrap;
}

/* Header */
.data-table thead th {
  background: #f8fafc;
  color: var(--text);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: .65rem .75rem;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
}
.data-table thead th:last-child { border-right: none; }

.data-table .subhead th {
  background: #f8fafc;
  font-weight: 500;
  font-size: .75rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  padding: .4rem .75rem;
  border-bottom: 2px solid #cbd5e1;
}

/* Sortable headers */
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { background: #eef2f7; }
.data-table th.sortable::after { content: ' \2195'; color: var(--red); font-size: .85em; }
.data-table th.sort-asc::after { content: ' \2191'; }
.data-table th.sort-desc::after { content: ' \2193'; }

/* Group header borders */
.data-table thead th[colspan] {
  border-left: 2px solid #cbd5e1;
  border-right: 2px solid #cbd5e1;
}

/* Body */
.data-table tbody td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tbody td:last-child { border-right: none; }

.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: #f0f7ff; }
.data-table tbody tr:nth-child(even) { background: #fafbfc; }
.data-table tbody tr:nth-child(even):hover { background: #f0f7ff; }

/* Ticker link */
.data-table .ticker-cell a {
  font-weight: 600;
  color: var(--accent);
  transition: color .15s;
}
.data-table .ticker-cell a:hover { color: var(--accent-hover); text-decoration: underline; }

/* Numeric cells */
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Positive / Negative coloring for QoQ */
.data-table .pct-positive { color: var(--green); font-weight: 500; }
.data-table .pct-negative { color: var(--red); font-weight: 500; }

/* ── Checkbox Cells ────────────────────────────────────── */
.data-table .cb {
  text-align: center;
  white-space: nowrap;
  padding: .4rem .5rem;
}

.cb-val {
  font-size: .75rem;
  color: var(--text-muted);
  margin-left: 2px;
  font-variant-numeric: tabular-nums;
}

.check-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  transition: all .15s;
}
.check-box.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.check-box.checked svg {
  display: block;
}
.check-box svg {
  display: none;
  width: 13px;
  height: 13px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Catalysts Column ──────────────────────────────────── */
.data-table .catalysts-cell {
  font-size: .8rem;
  max-width: 320px;
  white-space: normal;
  line-height: 1.45;
  color: var(--text-muted);
}

/* ── Login Page ────────────────────────────────────────── */
.login-card {
  max-width: 380px;
  margin: 3rem auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}
.login-card h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}
.login-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
}
.login-form input {
  width: 100%;
  padding: .6rem .75rem;
  margin-top: .3rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.login-form button {
  width: 100%;
  padding: .65rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  margin-top: .5rem;
}
.login-form button:hover { background: var(--accent-hover); }

.error {
  color: #b91c1c;
  background: #fef2f2;
  padding: .5rem .75rem;
  border-radius: 6px;
  border: 1px solid #fecaca;
  font-size: .875rem;
  margin-bottom: 1rem;
}

/* ── Company Page ──────────────────────────────────────── */
.company-card {
  max-width: 600px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.report-links { list-style: none; }
.report-links li { margin-bottom: .75rem; }
.report-links a {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 500;
  padding: .5rem .75rem;
  border-radius: 6px;
  transition: background .15s;
}
.report-links a:hover {
  background: #eff6ff;
  text-decoration: none;
}

/* ── Error Page ────────────────────────────────────────── */
.error-page {
  text-align: center;
  padding: 4rem 1rem;
}
.error-page h1 {
  font-size: 4rem;
  font-weight: 800;
  color: #cbd5e1;
  margin-bottom: .5rem;
}
.error-page p { color: var(--text-muted); margin-bottom: 1rem; }
.error-page a {
  display: inline-block;
  padding: .5rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-weight: 500;
  transition: background .15s;
}
.error-page a:hover { background: var(--accent-hover); text-decoration: none; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-header { padding: 0 1rem; }
  .main { padding: 0 .75rem; margin: 1rem auto; }
  .main h1 { font-size: 1.25rem; }
  .data-table { font-size: .8rem; }
  .data-table thead th { font-size: .7rem; padding: .5rem; }
  .data-table tbody td { padding: .5rem; }
  .check-box { width: 17px; height: 17px; }
  .check-box svg { width: 11px; height: 11px; }
}
