:root {
  --bg: #101113;
  --bg-elevated: #16181b;
  --card: #1b1d21;
  --card-border: #2a2d32;
  --text: #f2f3f5;
  --muted: #8b8f98;
  --accent: #6c8cff;
  --accent-soft: rgba(108, 140, 255, 0.15);
  --green: #34c759;
  --orange: #ff9f0a;
  --red: #ff453a;
  --gray: #2e3136;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 15% -10%, rgba(108,140,255,0.10), transparent),
    var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(16, 17, 19, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brandMark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #a06cff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  box-shadow: 0 4px 14px rgba(108,140,255,0.35);
}

.brandText h1 {
  font-size: 17px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
}
.tagline {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 520px) {
  .tagline { display: none; }
  header { padding: 16px 18px; }
  .brandText h1 { font-size: 15px; }
  /* 02/11/2026 : téléphone — le sélecteur de restaurant et le bouton compte dépassaient de l'écran (page décalable à droite) */
  header { gap: 10px; }
  #restaurantBar { flex: 1 1 0; min-width: 0; gap: 8px; }
  #restaurantBar select { flex: 1 1 0; min-width: 0; width: 100%; text-overflow: ellipsis; }
  #restaurantBar > * { flex-shrink: 0; } #restaurantBar > select { flex-shrink: 1; }
  main { padding: 18px 14px 48px; }
  .weekdayRow, #calendarGrid { gap: 4px; } .dayCell { padding: 3px; font-size: 10px; } .weekTotal { font-size: 10px; }
}

#restaurantBar { display: flex; align-items: center; gap: 10px; }

select {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
}

.statusDot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52,199,89,0.18);
  cursor: pointer;
  display: inline-block;
}
.statusDot.down { background: var(--red); box-shadow: 0 0 0 3px rgba(255,69,58,0.18); }

main { max-width: 880px; margin: 0 auto; padding: 28px 24px 60px; }

.liveCard { }
.liveUpdated { font-size: 11px; color: var(--muted); }

.liveBar {
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  text-align: center;
  margin-bottom: 12px;
}

.liveRows { display: flex; gap: 12px; }
.liveRows .statCard { flex: 1; margin: 0; padding: 14px 14px 12px; }
.liveRows .statCard .statValue { font-size: 22px; }
.liveRows .statCard .statIcon { width: 26px; height: 26px; font-size: 12px; margin-bottom: 8px; }

.liveIdle, .liveError {
  text-align: center;
  padding: 20px 0;
  color: var(--muted);
  font-size: 13px;
}
.liveError { color: var(--red); }

.liveSummaryTitle {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
}

.summaryRow {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.statCard {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.statIcon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  margin-bottom: 10px;
}
.statCard .statLabel { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.statCard .statValue { font-size: 30px; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }
.statDelta { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700; }
.statDelta.good { color: var(--green); }
.statDelta.bad { color: var(--red); }
.statDelta.flat { color: var(--muted); font-weight: 500; }
.statSubnote { font-size: 10px; color: var(--muted); margin-top: 2px; font-style: italic; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.cardHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.cardHeader h2 { font-size: 14px; font-weight: 700; margin: 0; color: var(--text); }

.monthNav {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}
.monthNav button {
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  color: var(--text);
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
}
.monthNav button:hover { border-color: var(--accent); }

.todayBtn {
  width: auto !important;
  padding: 0 10px;
  font-size: 11px !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.periodBtn {
  width: auto !important;
  padding: 0 10px;
  font-size: 11px !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.periodBtn.on { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.legendSwatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

.emptyMsg { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 0; }

.trendBody { display: flex; gap: 16px; align-items: stretch; }
.trendBody canvas { flex: 1; min-width: 0; }
.trendSideStats {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  min-width: 84px;
  border-left: 1px solid var(--card-border);
  padding-left: 16px;
}
.trendSideStat .trendSideLabel { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.trendSideStat .trendSideValue { font-size: 20px; font-weight: 800; margin-top: 2px; }
@media (max-width: 520px) {
  .trendBody { flex-direction: column; }
  .trendSideStats { flex-direction: row; border-left: none; border-top: 1px solid var(--card-border); padding-left: 0; padding-top: 12px; justify-content: flex-start; }
}

.trendLegend { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.trendLegendItem {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.trendLegendItem .legendSwatch { width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.trendLegendItem.isOff { opacity: 0.35; }
.trendLegendItem.isOff .legendSwatch { background: var(--muted) !important; }

.weekdayRow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 0.6fr);
  gap: 6px;
  margin-bottom: 6px;
}
.weekdayRow span {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#calendarGrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 0.6fr);
  gap: 6px;
}

.dayCell {
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--gray);
  display: flex;
  flex-direction: column;
  padding: 5px;
  font-size: 11px;
  font-weight: 500;
  cursor: default;
  opacity: 0.3;
  transition: transform 0.1s ease;
  border: 1px solid transparent;
}
.dayCell.hasData { cursor: pointer; opacity: 1; }
.dayCell.hasData:hover { transform: scale(1.04); }
.dayCell .dayNum { color: var(--muted); }
.dayCell.hasData .dayNum { color: var(--text); }
.dayCell.isToday { border-color: var(--accent); }
.dayCell.bestDay { background: var(--green); }
.dayCell.worstDay { background: var(--red); }
.dayCell.bestDay .dayNum, .dayCell.worstDay .dayNum { color: rgba(0,0,0,0.6); font-weight: 700; }

.weekTotal {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.dayCell .halves { flex: 1; display: flex; gap: 2px; margin-top: 3px; }
.dayCell .half {
  flex: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: rgba(0,0,0,0.55);
}

.dayPanel, .errorsPanel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  min-width: 280px;
  max-width: 90vw;
  z-index: 10;
}
.dayPanel h3, .errorsPanel h3 { margin: 0 0 12px; font-size: 15px; }
.dayPanel p { font-size: 13px; line-height: 1.5; margin: 8px 0; }
.dayPanel button, .errorsPanel button {
  margin-top: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

#errorsList { list-style: none; padding: 0; font-size: 12px; color: var(--muted); max-height: 40vh; overflow-y: auto; }
#errorsList li { padding: 6px 0; border-bottom: 1px solid var(--card-border); }

.accountPanel { text-align: left; width: 320px; }
.accountEmail { color: var(--muted); font-size: 13px; margin-top: -6px; }
.accountBlock { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--card-border); }
.accountBlock h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.accountBlock input, .accountBlock select {
  width: 100%; box-sizing: border-box; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--card-border); background: var(--bg-elevated); color: var(--text);
  font-family: inherit; font-size: 13px; margin-bottom: 8px;
}
.accountBlock button, #genInviteBtn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.accountResult { margin-top: 8px; font-size: 12px; color: var(--muted); word-break: break-all; }
.accountResult a { color: var(--accent); }
.logoutBtn { margin-top: 18px; width: 100%; background: var(--red) !important; color: #fff !important; }

/* 04/11/2026 : style de la vidéo de présentation — halo violet/bleu, gros chiffre dans un cadre coloré, tuiles bordées, cartes arrondies */
body {
  background:
    radial-gradient(700px 420px at 10% -8%, rgba(108,140,255,0.22), transparent 70%),
    radial-gradient(640px 460px at 100% 12%, rgba(168,85,247,0.16), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.card { border-radius: 22px; }
.cardHeader h2 { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.hero {
  --c: #34c759;
  border: 2px solid var(--c); border-radius: 22px; padding: 16px 20px 14px;
  background: color-mix(in srgb, var(--c) 10%, var(--card)); text-align: left;
  box-shadow: 0 0 28px color-mix(in srgb, var(--c) 18%, transparent);
}
.hero.idle { --c: #3a3d44; box-shadow: none; background: var(--card); }
.heroLbl { font-size: 13px; font-weight: 700; color: var(--text); opacity: .9; }
.heroVal { font-size: clamp(64px, 22vw, 120px); font-weight: 800; line-height: 1.02; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--c); margin: 2px 0 0; }
.hero.idle .heroVal { color: var(--text); } .heroVal.sm { font-size: clamp(40px, 13vw, 72px); }
.heroSub { font-size: 12px; color: var(--muted); font-weight: 600; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.tiles.t3 { grid-template-columns: repeat(3, 1fr); }
.tile {
  --c: #3a3d44; border: 2px solid color-mix(in srgb, var(--c) 70%, transparent); border-radius: 16px;
  padding: 10px 12px; background: color-mix(in srgb, var(--c) 8%, var(--card));
}
.tile .k { font-size: 12px; font-weight: 600; color: var(--muted); }
.tile .v { font-size: clamp(22px, 7vw, 32px); font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.liveCard .liveRows, .liveCard .liveBar { display: none; }
.statCard { border-radius: 18px; }
.statCard .statValue { letter-spacing: -0.03em; }
@media (max-width: 520px) {
  .card { padding: 16px 14px; }
  .liveCard { padding: 14px 12px; }
  .tiles.t3 .tile { padding: 8px 8px; } .tiles.t3 .tile .k { font-size: 11px; }
}
.liveChartBox { margin-top: 12px; padding: 10px 8px 4px; border-radius: 16px; background: var(--bg-elevated); border: 1px solid var(--card-border); }
.liveChartBox canvas { max-width: 100%; }
.liveChartBox:has(canvas[style*="none"]) { display: none; }

/* 04/11/2026 : la page ne doit jamais bouger sur le côté (appli iPhone) */
html, body { max-width: 100%; overflow-x: hidden; overscroll-behavior-x: none; }
main, .card, .trendBody, .tiles, header { min-width: 0; max-width: 100%; }
canvas { max-width: 100% !important; }

/* 04/11/2026 — accessibilité : cibles tactiles d'au moins 44 px (Apple HIG), zoom du texte autorisé, contraste du texte secondaire >= 4,5:1 */
.authCard input, .authCard button { min-height: 48px; font-size: 16px; }
#restaurantSelect, #accountBtn, .todayBtn, .monthNav button, .logoutBtn { min-height: 44px; }
#accountBtn, .monthNav button { min-width: 44px; }
.todayBtn { min-width: 44px; padding-left: 12px; padding-right: 12px; }
.dayCell .dayNum { color: #a9adb6; }
.mem { min-height: 44px; } .mem input[type=checkbox] { width: 24px; height: 24px; flex: none; }
.qui a, .authCard p a { display: inline-block; padding: 15px 8px; }

/* ============================================================================================================================================
   04/11/2026 — MÊME DA QUE LA TABLETTE (site de base) : fond plat #101113, cartes #1a1b1e / #222428, police système, grands arrondis, gros chiffres,
   boutons en pilule, onglet actif #3a3d44, chrono dans un cadre plein vert / orange / rouge. Ces règles remplacent le style « halo violet » précédent.
   ============================================================================================================================================ */
:root {
  --bg: #101113; --bg-elevated: #222428; --card: #1a1b1e; --card-border: #2c2e33; --text: #f4f5f7; --muted: #8a8f98;
  --accent: #0a84ff; --green: #34c759; --orange: #ffb020; --red: #ff453a; --radius: 18px; --shadow: none;
}
html, body { background: var(--bg) !important; }
body { background-image: none !important; font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif !important; }
button, input, select, textarea { font-family: inherit; }
.card, .statCard, .dayPanel, .accountPanel, .errorsPanel { background: var(--card); border: 0; border-radius: 22px; box-shadow: none; }
.card { padding: 18px 18px 16px; }
.cardHeader h2, .card h2 { font-weight: 700; letter-spacing: -.01em; }
header { background: var(--bg) !important; border-bottom: 0 !important; backdrop-filter: none !important; padding: 16px 16px 8px; }
.brandText h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.brandMark { background: var(--bg-elevated) !important; box-shadow: none !important; color: #fff; border-radius: 12px; }
#restaurantSelect, select { background: var(--bg-elevated); border: 0; border-radius: 14px; color: var(--text); font-size: 16px; font-weight: 600; padding: 0 14px; }
.todayBtn, .monthNav button, #accountBtn { background: var(--bg-elevated) !important; border: 0 !important; border-radius: 12px !important; color: var(--text) !important; font-weight: 700; }
.logoutBtn, .btn { border-radius: 14px; }
/* chrono en direct : cadre PLEIN (vert → orange → rouge) comme sur la tablette */
.hero { border: 0 !important; background: var(--c) !important; box-shadow: none !important; border-radius: 22px; padding: 18px 20px 14px; }
.hero .heroLbl, .hero .heroVal, .hero .heroSub { color: #fff !important; opacity: 1; }
.hero.idle { background: var(--bg-elevated) !important; } .hero.idle .heroLbl { color: var(--muted) !important; }
.tile { background: var(--card) !important; border: 0 !important; border-radius: 16px; padding: 12px 14px; }
.tile .k { color: var(--muted); font-size: 13px; font-weight: 600; } .tile .v { font-size: clamp(24px, 7vw, 34px); font-weight: 700; }
.liveChartBox { background: var(--bg-elevated) !important; border: 0 !important; border-radius: 18px; }
.statCard .statLabel { text-transform: none; letter-spacing: 0; font-size: 13px; }
.statCard .statValue { font-size: 34px; font-weight: 700; }
.authCard .brandMark { margin-bottom: 14px; }
.authCard button, .authCard input { border-radius: 14px; }
.authCard button { background: var(--accent) !important; background-image: none !important; color: #fff; }
.authCard input { background: var(--bg-elevated); border: 0; }
.choix { background: var(--card) !important; border: 0 !important; border-radius: 20px; }
.choix.manager { box-shadow: inset 4px 0 0 #6c8cff; } .choix.devant { box-shadow: inset 4px 0 0 var(--green); } .choix.cuisine { box-shadow: inset 4px 0 0 var(--orange); } .choix.appli { box-shadow: inset 4px 0 0 #a855f7; }
