:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #1d4ed8;
  --up: #047857;
  --up-bg: #ecfdf5;
  --down: #b91c1c;
  --down-bg: #fef2f2;
  --header: #0f172a;
  --header-text: #f8fafc;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --card: #131c2e;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --line: #1f2a40;
    --accent: #60a5fa;
    --up: #34d399;
    --up-bg: #0d2a22;
    --down: #f87171;
    --down-bg: #2d1416;
    --header: #020617;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

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

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--header);
  color: var(--header-text);
}

.brand { color: inherit; font-weight: 700; text-decoration: none; font-size: 18px; }

.top nav a {
  color: #cbd5e1;
  text-decoration: none;
  margin-left: 16px;
  font-weight: 500;
}

.top nav a.active { color: #fff; border-bottom: 2px solid #60a5fa; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }

h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 17px; margin: 22px 0 8px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

a.card { display: block; color: inherit; text-decoration: none; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.name { font-weight: 600; }
.muted { color: var(--muted); font-size: 14px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.haussier { color: var(--up); background: var(--up-bg); }
.badge.baissier { color: var(--down); background: var(--down-bg); }
.badge.neutre, .badge.account { color: var(--muted); background: var(--bg); border: 1px solid var(--line); }

.score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 20px;
}

.title { margin: 6px 0 4px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.grid div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.grid b { display: block; font-variant-numeric: tabular-nums; }

ul { padding-left: 20px; margin: 6px 0; }
li { margin: 4px 0; }

blockquote {
  margin: 6px 0;
  padding: 6px 10px;
  border-left: 3px solid var(--line);
  color: var(--muted);
  font-style: italic;
}

button, input {
  font: inherit;
  border-radius: 10px;
}

button {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }

input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  margin: 8px 0 12px;
}

.notice { font-size: 14px; color: var(--muted); }
.error { color: var(--down); }

.empty { text-align: center; color: var(--muted); padding: 32px 8px; }

.disclaimer {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 16px 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.break { overflow-wrap: anywhere; }
