:root {
  --bg: #0f1020;
  --card: #1a1c33;
  --line: #2c2f52;
  --text: #eceefb;
  --muted: #9aa0c8;
  --accent: #ff4f8b;
  --ok: #3ddc97;
  --pos: #3ddc97;
  --neg: #ff6b7d;
  --grid: #262946;
  --series: #7aa2ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 20% 10%, #2a1d55 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 90%, #13325a 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.card {
  width: 400px;
  padding: 36px 32px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.02em; }
.sub { margin: 0 0 24px; color: var(--muted); }

label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--muted); }

#login input {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
}
#login input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-main { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-main:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-google { background: #fff; color: #1f1f1f; border-color: #fff; }

.sep { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 13px; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.msg { min-height: 1.5em; margin: 14px 0 0; font-size: 14px; color: var(--ok); }

code { background: var(--bg); padding: 1px 6px; border-radius: 6px; }

/* PC uniquement : sur petit ecran, un simple message. */
.mobile-only { display: none; text-align: center; padding: 16px; max-width: 100vw; overflow-wrap: anywhere; }
@media (max-width: 899px) {
  .mobile-only { display: block; }
  .desktop-only { display: none; }
}

/* --- Page connectee ------------------------------------------------------ */
body:has(#app:not([hidden])) { place-items: start center; }
.page { width: min(1600px, calc(100vw - 48px)); padding: 20px 0 48px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.logo { font-size: 20px; letter-spacing: -0.02em; }
.who { color: var(--muted); font-size: 14px; }
.link { background: none; border: 0; padding: 0 0 0 10px; color: var(--accent); font: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }
.center { text-align: center; }

/* Filtres : une seule ligne au-dessus de ce qu'ils filtrent. */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
select, input[type="search"] {
  padding: 7px 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px;
}
input[type="search"] { width: 220px; margin: 0; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; padding: 5px 14px; border-radius: 7px; cursor: pointer; }
.seg button.active { background: var(--line); color: var(--text); }

.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 16px 0 18px; }
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.tile-label { color: var(--muted); font-size: 13px; }
.tile-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile-sub { color: var(--muted); font-size: 12px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.chart-head { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.chart { position: relative; height: clamp(220px, 32vh, 380px); }

.bottom { display: grid; grid-template-columns: minmax(300px, 1fr) 2.6fr; gap: 16px; margin-top: 16px; align-items: start; }

.drop {
  padding: 28px 16px;
  text-align: center;
  background: var(--bg);
  border: 2px dashed var(--line);
  border-radius: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.drop.over { border-color: var(--accent); background: #22244a; }
.drop.busy { opacity: 0.6; pointer-events: none; }
.drop-title { margin: 0; font-size: 17px; font-weight: 700; }
.drop-sub { margin: 4px 0 14px; color: var(--muted); font-size: 14px; }
.btn-inline { width: auto; padding: 9px 26px; }
.btn-small { width: auto; padding: 6px 12px; font-size: 13px; }
.btn-small:disabled { opacity: 0.4; cursor: default; }
.help { margin-top: 12px; color: var(--muted); font-size: 13px; }
.help summary { cursor: pointer; }
.help p { margin: 8px 0 0; }

.status { min-height: 1.5em; margin: 12px 0 4px; color: var(--muted); font-size: 14px; }
.report { margin: 0; padding-left: 18px; font-size: 14px; }
.report li { margin: 4px 0; }
.warn { color: #ffb454; }

.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list th[data-sort] { cursor: pointer; user-select: none; }
.list th[data-sort]:hover { color: var(--text); }
.list th.sort-asc::after { content: " ▲"; font-size: 10px; }
.list th.sort-desc::after { content: " ▼"; font-size: 10px; }
.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.list tr:hover td { background: #1f2140; }
.list tbody tr { cursor: pointer; }
.list .play { width: 1%; text-align: right; }
.play-btn {
  padding: 3px 10px; border: 1px solid var(--line); border-radius: 7px; background: none;
  color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.list tr:hover .play-btn { border-color: var(--accent); color: #fff; background: var(--accent); }
.list .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list small { color: var(--muted); }
.list .empty { text-align: center; color: var(--muted); padding: 24px; }
.room { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.room-betclic { background: #3a1730; color: #ff8fb8; }
.room-unibet { background: #123a2a; color: #6fe3a8; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.pick-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Fichiers en cours de glisser : toute la page devient une zone de depot. */
body.dragging #app::after {
  content: "Lâche pour importer";
  position: fixed;
  inset: 12px;
  display: grid;
  place-items: center;
  border: 3px dashed var(--accent);
  border-radius: 20px;
  background: rgba(15, 16, 32, 0.85);
  color: var(--text);
  font-size: 28px;
  font-weight: 700;
  pointer-events: none;
  z-index: 10;
}
.drop-note { margin: 12px auto 0; max-width: 340px; color: var(--muted); font-size: 12px; }

/* --- Partage -------------------------------------------------------------- */
.shared-only { display: none; }
body.shared .shared-only { display: inline-block; }
body.shared .who, body.shared .owner-only, body.shared #rp-back { display: none; }
.rp-settings .btn-small { text-decoration: none; }

.share-dlg {
  width: 520px; max-width: calc(100vw - 32px); padding: 28px 28px 22px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.share-dlg::backdrop { background: rgba(5, 6, 16, 0.6); }
.share-dlg h2 { margin: 0 0 4px; font-size: 20px; }
.share-sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.share-x { position: absolute; top: 12px; right: 14px; background: none; border: 0; color: var(--muted); font-size: 24px; cursor: pointer; }
.share-x:hover { color: var(--text); }
.share-opt { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--text); font-size: 14px; cursor: pointer; }
.share-opt input { accent-color: var(--accent); }
#share-create { margin-top: 6px; }
.share-result { display: flex; gap: 8px; margin-top: 14px; }
.share-result input {
  flex: 1; min-width: 0; padding: 7px 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: 13px ui-monospace, Consolas, monospace;
}
.share-h3 { margin: 22px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.share-list { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; }
.share-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.share-list .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-list .d { color: var(--muted); }
.share-list .empty { color: var(--muted); border: 0; }

/* Abonnement (web/billing.js) */
.paywall {
  padding: 24px 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.paywall-title { margin: 0; font-size: 17px; font-weight: 700; }
.paywall-price { margin: 6px 0 12px; color: var(--muted); font-size: 14px; }
.paywall-price strong { color: var(--text); font-size: 24px; }
.paywall-list { margin: 0 0 18px; padding-left: 18px; font-size: 14px; line-height: 1.5; }
.paywall-list li { margin-bottom: 4px; }
.paywall-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.sub-note { color: var(--accent); margin-right: 8px; }
.sub-dlg { width: 460px; }
.sub-dlg-actions { display: flex; gap: 10px; margin-top: 18px; }
.sub-dlg-actions form { margin: 0; }

/* Mon compte (web/account.js) */
.account { width: min(760px, 100%); margin: 0 auto; }
.acc-title { margin: 18px 0 16px; font-size: 26px; letter-spacing: -0.02em; }
.acc-panel { margin-bottom: 16px; }
.acc-plan { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.acc-plan strong { color: var(--text); font-size: 18px; }
.acc-text p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; }
.acc-badge { padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); }
.acc-badge.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.acc-badge.warn { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.acc-actions { display: flex; gap: 10px; margin-top: 14px; }
.acc-actions [hidden] { display: none; }
.acc-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.acc-list { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.acc-list dt { color: var(--muted); }
.acc-list dd { margin: 0; font-variant-numeric: tabular-nums; }
#acc-msg:empty { display: none; }

/* Contact en cas de probleme (haut du site et page de connexion) */
.contact { color: var(--muted); margin-right: 18px; }
.contact strong { color: var(--text); font-weight: 600; }
.login-contact { margin: 18px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.login-contact strong { color: var(--text); font-weight: 600; }
.welcome-dlg { width: 560px; }
.welcome-steps { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.welcome-steps li { margin-bottom: 10px; }
.welcome-steps code { font-size: 12px; }
.welcome-note { margin: 16px 0 0; color: var(--muted); font-size: 13px; }
.welcome-note strong { color: var(--text); }
