/* ============================================================
   Báti reports — CSS-styled table viewer
   Deployed at batoragent-reports.pages.dev; content lives in the URL hash.
   Design: warm cream + gold Active Vision derivative, Inter typography.
   ============================================================ */
:root {
  --bg:      #f7f5f0;
  --card:    #fdfcf9;
  --border:  #ece9e1;
  --ink:     #1a1a18;
  --text:    #3d3d3a;
  --muted:   #8a877e;
  --accent:  #fcb813;
  --accent-soft: #fdf4dd;
  --danger:  #f05a22;
  --ok:      #2e7d32;
  --info:    #0088cf;
  --radius:  10px;
  --radius-sm: 6px;
  --f-body:  "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --f-mono:  "JetBrains Mono", ui-monospace, monospace;
  --shadow:  0 12px 40px -20px rgba(0,0,0,0.15);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--f-body); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent); color: var(--ink); }

/* ---------- Loading ---------- */
.loading {
  min-height: 100vh; display: grid; place-items: center; gap: 16px;
  color: var(--muted); font-size: 14px; text-align: center;
}
.loading__dot {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); opacity: 0.5;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.4; }
  50% { transform: scale(1.05); opacity: 0.9; }
}

/* ---------- Report layout ---------- */
.report {
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.report__head {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.report__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.brand-mark {
  width: 20px; height: 20px; border-radius: 5px;
  background: linear-gradient(135deg, var(--accent) 0%, #e8a90c 100%);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 5px;
  border-radius: 2px; background: var(--ink);
}
.report__title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.report__subtitle {
  font-size: 1.0625rem;
  color: var(--text);
  margin: 0 0 12px;
  max-width: 64ch;
  text-wrap: pretty;
}
.report__meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  font-family: var(--f-mono);
}

.report__body {
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.report__footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.report__footer b { color: var(--ink); font-weight: 600; }
.report__id { font-family: var(--f-mono); }

/* ---------- Section ---------- */
.section { display: flex; flex-direction: column; gap: 12px; }
.section__title {
  font-size: 1.25rem;
  color: var(--ink);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.section__lead {
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 0;
  max-width: 64ch;
}
.section__prose {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  max-width: 68ch;
}
.section__prose b, .section__prose strong { color: var(--ink); font-weight: 600; }
.section__prose code {
  font-family: var(--f-mono);
  font-size: 0.85em;
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink);
}
.section__prose p { margin: 0 0 0.75em; }
.section__prose p:last-child { margin-bottom: 0; }

/* ---------- Table ---------- */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  min-width: 320px;
}
.table thead {
  background: linear-gradient(180deg, #f2ede0 0%, #ece9e1 100%);
  border-bottom: 1.5px solid var(--ink);
}
.table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}
.table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.table tbody tr:first-child td { border-top: none; }
.table td b, .table td strong { color: var(--ink); font-weight: 600; }
.table td code {
  font-family: var(--f-mono);
  font-size: 0.85em;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 3px;
}

/* Status pills inside table cells */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill--ok      { background: #e6f2e6; color: var(--ok);     border-color: #bcd8bc; }
.pill--warn    { background: #fff4d4; color: #a06b00;       border-color: #f0d68c; }
.pill--err     { background: #fce6dc; color: var(--danger); border-color: #f2b39c; }
.pill--info    { background: #d9edf7; color: var(--info);   border-color: #a9d1e6; }
.pill--neutral { background: var(--bg); color: var(--text); border-color: var(--border); }

/* ---------- Cards grid ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color 200ms ease;
}
.card:hover { border-color: var(--ink); }
.card__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}
.card__value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.card__hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
}

/* ---------- List ---------- */
.list {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}
.list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
}
.list li:first-child { border-top: none; }
.list li::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ---------- Error state ---------- */
.error {
  max-width: 520px;
  margin: 80px auto 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  text-align: center;
  font-size: 14px;
}
.error h2 { color: var(--danger); margin: 0 0 8px; font-size: 1.125rem; }
.error code {
  display: block;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--muted);
  overflow-x: auto;
  text-align: left;
}

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  .report { padding: 24px 16px 48px; }
  .table th, .table td { padding: 10px 12px; font-size: 0.875rem; }
}

@media (prefers-color-scheme: dark) {
  /* Telegram often uses dark theme — keep readable but stay in the light system to preserve brand */
}
