/* Tipzo — shared design system for the landing page, tenant
   dashboard/overlay-editor, and admin panel. NOT used by the OBS overlay
   pages themselves (alert/goalbar/leaderboard) — those stay self-contained
   single files since OBS loads each as its own isolated Browser Source. */

/* Palette: dark navy base, one vivid violet standout. --accent is deep
   enough (violet-700-ish) to hold white text as a button background AND
   read clearly as link/text color against the near-black --bg — one
   token serves both roles instead of splitting into a text-accent and a
   button-accent. --accent-bright is lighter, for decorative-only use
   (glows, chart lines, gradients) where nothing sits on top of it. --good
   and --warn stay clearly apart in hue from --accent so neither reads as
   just another button. */
:root {
  --bg: #0F1224;
  --surface: #1B1F3B;
  --text: #F7F7FB;
  --text-muted: #A6ABD1;
  --accent: #8358F1;
  --accent-bright: #A98BFF;
  --accent-2: #2F6B4F;
  --good: #3ECF8E;
  --warn: #FF6B6B;
  --border: #40488A;
  --mono-bg: #05060D;
  --mono-text: #C9BFFF;

  --font-display: "Archivo", system-ui, sans-serif;
  --font-body: "Public Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

a { color: var(--accent); }

p { margin: 0 0 8px; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); font-size: 0.85em; }

.container { max-width: 960px; margin: 0 auto; padding: 32px 16px; }
.container-narrow { max-width: 640px; margin: 0 auto; padding: 32px 16px; }

nav.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--surface);
}
nav.topbar .brand { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
nav.topbar .links { display: flex; align-items: center; gap: 16px; font-size: 0.9rem; }

.lang-toggle { display: flex; gap: 4px; }
.lang-toggle button {
  font-family: var(--font-mono); font-size: 0.72rem; padding: 4px 8px;
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer;
}
.lang-toggle button.active { color: #fff; background: var(--accent); border-color: var(--accent); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 16px;
  box-shadow: 0 12px 30px -18px rgba(0, 0, 0, 0.6);
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.stat-tile .label {
  font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
}
.stat-tile .value { font-family: var(--font-display); font-size: 1.8rem; margin-top: 4px; font-variant-numeric: tabular-nums; }

label { display: block; margin-top: 12px; font-size: 0.85rem; color: var(--text-muted); }
input, select, textarea {
  width: 100%; padding: 9px 10px; margin-top: 4px; box-sizing: border-box;
  font-size: 0.95rem; font-family: var(--font-body); border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="color"] { padding: 3px; height: 40px; cursor: pointer; }
input[type="checkbox"] { width: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 14px; padding: 10px 18px;
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  font-size: 0.92rem; font-family: var(--font-body); cursor: pointer;
}
.btn:hover { opacity: 0.92; }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.small { padding: 6px 12px; font-size: 0.82rem; margin-top: 0; }
.btn.danger { background: var(--warn); color: var(--bg); }
.btn:disabled { opacity: 0.5; cursor: default; }

table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.9rem; }
th {
  text-align: left; font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border); padding: 8px 10px;
}
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
}
.pill-good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.pill-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill-accent { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.pill-muted { background: color-mix(in srgb, var(--text-muted) 14%, transparent); color: var(--text-muted); }

.urlbox {
  background: var(--mono-bg); color: var(--mono-text); padding: 9px 12px; border-radius: 6px;
  font-family: var(--font-mono); font-size: 0.8rem; word-break: break-all; margin-top: 6px;
}

.chart-wrap { position: relative; height: 220px; margin-top: 12px; }

.section-title {
  font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent); margin: 0 0 6px;
}

.notice { font-size: 0.85rem; color: var(--text-muted); padding: 10px 12px; background: var(--bg); border-radius: 8px; margin-top: 8px; }

/* Legal/contact footer — landing, donation, and tenant-login pages. */
.footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 24px 16px; text-align: center; }
.footer-links { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.footer-links a { color: var(--text-muted); font-size: 0.85rem; text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.footer p { font-size: 0.78rem; }

/* Cookie-consent banner — see /public/cookie-consent.js. */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1000;
  max-width: 640px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.5);
}
.cookie-banner p { margin: 0; font-size: 0.85rem; color: var(--text-muted); flex: 1 1 260px; }

/* Simple legal-page prose (Terms/Privacy/Cookie policy/Contact). */
.legal-content h2 { font-size: 1.05rem; margin-top: 28px; }
.legal-content h2:first-child { margin-top: 0; }
.legal-content p, .legal-content li { font-size: 0.92rem; line-height: 1.6; color: var(--text); }
.legal-content ul { padding-left: 20px; }
.legal-content table {
  width: 100%; margin-top: 10px; border-collapse: collapse;
  /* Without this, long cell text (e.g. the cookie-policy table's purpose
     column) forces columns to their content width instead of wrapping,
     pushing the table wider than .card/.container-narrow and spilling
     text past the page edge. Fixed layout + break-word keeps every
     column within its 100%-divided share instead. */
  table-layout: fixed;
}
.legal-content td, .legal-content th { overflow-wrap: break-word; word-break: break-word; }

/* App shell — sidebar navigation for admin/tenant panels, replacing a
   single stacked page with actual sections. */
.app-shell { display: flex; min-height: calc(100vh - 53px); }
.app-sidebar {
  width: 220px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 20px 12px;
}
.app-sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.app-sidebar a {
  display: block; padding: 9px 12px; border-radius: 8px;
  color: var(--text-muted); text-decoration: none; font-size: 0.92rem;
}
.app-sidebar a:hover { background: var(--bg); color: var(--text); }
.app-sidebar a.active { background: var(--accent); color: #fff; }
.app-main { flex: 1; min-width: 0; padding: 28px 32px; }
.app-main h1 { font-size: 1.4rem; margin-bottom: 4px; }
.app-main .page-intro { margin-bottom: 20px; }

@media (max-width: 800px) {
  .app-shell { flex-direction: column; }
  .app-sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 10px 12px; }
  .app-sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .app-main { padding: 20px 16px; }
}

/* Connected timeline — for a genuine sequence (steps, stages), a line
   running through numbered points rather than N identical cards. */
.timeline { display: flex; flex-direction: column; margin-top: 20px; }
.timeline-item { display: flex; gap: 18px; }
.timeline-marker { display: flex; flex-direction: column; align-items: center; }
.timeline-dot {
  width: 30px; height: 30px; border-radius: 50%; background: var(--surface);
  border: 2px solid var(--accent); color: var(--accent); font-family: var(--font-mono);
  font-size: 0.8rem; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.timeline-line { width: 2px; flex: 1; background: var(--border); margin: 2px 0; }
.timeline-item:last-child .timeline-line { display: none; }
.timeline-body { padding-bottom: 28px; }
.timeline-body h3 { margin-bottom: 4px; }

@media (max-width: 640px) {
  .container, .container-narrow { padding: 20px 16px; }
  nav.topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
}
