:root {
  /* Noir & or : fond noir chaud, or brossé en accent */
  --bg: #0a0908; --panel: #131210; --panel2: #1c1a16; --line: #2b261d;
  --text: #f5f0e6; --muted: #a49b8a; --accent: #c9a24a; --accent2: #f0dc9c; --gold-ink: #1a1408;
  --ok: #8cc9a0; --warn: #e2b45c; --bad: #e0705f; --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Nunito", ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.btn { text-decoration: none; display: inline-block; border: 0; border-radius: 10px; padding: 10px 14px; background: var(--panel2); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--gold-ink); }
.btn.ok { background: var(--ok); color: #06210f; }
.btn.bad { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pill { white-space: nowrap; display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel2); }
.pill.todo { background: #2a2a3a; color: #c9c9ff; }
.pill.submitted { background: #3a2f12; color: var(--warn); }
.pill.approved { background: #12301f; color: var(--ok); }
.pill.redo, .pill.late, .pill.banned { background: #3a1616; color: var(--bad); }
.pill.warning { background: #3a2f12; color: var(--warn); }
.pill.ok { background: #12301f; color: var(--ok); }
.bar { height: 8px; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .3s; }
.bar.done > i { background: var(--ok); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 14px); transform: translate(-50%, -20px); opacity: 0; background: var(--accent2); color: var(--gold-ink);
  padding: 10px 16px; border-radius: 99px; font-weight: 600; transition: .25s; z-index: 100; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); color: #fff; }
.embed { width: 100%; aspect-ratio: 9/16; max-height: 70vh; border: 0; border-radius: 12px; background: #000; display: block; }
.linkcard { display: flex; align-items: center; justify-content: center; width: 100%; height: 150px; border-radius: 12px;
  background: linear-gradient(160deg, var(--panel2), #241d12); text-decoration: none; font-weight: 600; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; width: min(520px, 94vw);
  max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
dialog::backdrop { background: rgba(0,0,0,.6); }
h1, h2, h3 { margin: 0; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

/* ---------- App modèle (mobile) ---------- */
.m-head { position: sticky; top: 0; z-index: 5; background: rgba(10,9,8,.92); backdrop-filter: blur(12px);
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; border-bottom: 1px solid var(--line); }
.m-main { padding: 14px 16px calc(90px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.m-nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: rgba(19,18,16,.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.m-nav button { flex: 1; background: none; border: 0; padding: 10px 0 8px; color: var(--muted); font-size: 11px; cursor: pointer; position: relative; }
.m-nav button .ic { display: block; font-size: 21px; line-height: 1.2; }
.m-nav button.on { color: var(--text); }
.m-nav .badge { position: absolute; top: 4px; left: calc(50% + 6px); background: var(--accent); color: var(--gold-ink); font-size: 10px; border-radius: 99px; padding: 1px 6px; }
.counter { display: flex; align-items: center; gap: 12px; }
.counter button { width: 44px; height: 44px; border-radius: 50%; border: 0; font-size: 22px; font-weight: 700; cursor: pointer; background: var(--panel2); }
.counter button.plus { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--gold-ink); }
.counter .n { font-size: 26px; font-weight: 800; min-width: 54px; text-align: center; }

/* App modèle : écran « Aujourd'hui » simplifié */
.hero { text-align: center; padding: 14px 0 18px; }
.hero-n { font-size: 54px; font-weight: 800; line-height: 1; background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-t { font-size: 18px; font-weight: 700; margin-top: 6px; }
.acc-count { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.acc-ok { border-color: #1f5a3c; }
.acc-ok .acc-count { color: var(--ok); }
.btn.big { padding: 14px 16px; font-size: 16px; flex: 1; }
.btn.undo { width: 50px; padding: 14px 0; font-size: 20px; flex-shrink: 0; }
.cta { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 16px; cursor: pointer; color: var(--text); }
.fix { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: #3a1616; color: #ffb3b3; }

/* To-do du jour */
.sec { margin: 22px 0 10px; font-size: 16px; }
.todo-list { display: flex; flex-direction: column; gap: 8px; }
.todo-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); cursor: pointer; font-size: 16px; transition: opacity .2s, transform .2s; }
.todo-item .box { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center;
  font-size: 14px; font-weight: 800; }
.todo-item:active .box { border-color: var(--ok); }
.todo-item.leaving { opacity: 0; transform: translateX(30px); }
.todo-item.leaving .box, .todo-item.done .box { background: var(--ok); border-color: var(--ok); color: #06210f; }
.todo-item.done { opacity: .6; }
.todo-item.done span:last-child { text-decoration: line-through; }
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 10px 0 2px; font-size: 13px; }

/* Idées façon TikTok */
.seg-m { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 10px; }
.seg-m button { flex: 1; border: 0; background: none; color: var(--muted); padding: 8px 2px; border-radius: 9px; font-size: 12px; white-space: nowrap; font-weight: 600; cursor: pointer; }
.seg-m button.on { background: var(--panel2); color: var(--text); }
.swipe-feed { overflow-y: auto; scroll-snap-type: y mandatory; border-radius: var(--radius); overscroll-behavior: contain; scrollbar-width: none; }
.swipe-feed::-webkit-scrollbar { display: none; }
.slide { height: 100%; scroll-snap-align: start; scroll-snap-stop: always; padding-bottom: 10px; overflow: hidden; }
.slide-card { --like: 0; --nope: 0; position: relative; height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); touch-action: pan-y; user-select: none; transition: transform .2s; }
.slide-card.dragging { transition: none; }
.slide-media { flex: 1; min-height: 0; border-radius: 12px; overflow: hidden; background: #000; }
.slide-media iframe { width: 100%; height: 100%; border: 0; display: block; }
.linkcard.tall { height: 100%; font-size: 17px; }
.slide-info { display: flex; flex-direction: column; gap: 4px; }
.slide-actions { display: flex; align-items: center; justify-content: space-between; }
.round { width: 60px; height: 60px; border-radius: 50%; border: 0; font-size: 24px; font-weight: 800; cursor: pointer; }
.round.nope { background: var(--panel2); color: var(--bad); border: 2px solid var(--bad); }
.round.like { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--gold-ink); }
.stamp { position: absolute; top: 26px; z-index: 2; padding: 6px 12px; border: 3px solid; border-radius: 10px; font-weight: 900; font-size: 20px;
  letter-spacing: .04em; pointer-events: none; }
.stamp.like { left: 22px; color: var(--ok); transform: rotate(-12deg); opacity: var(--like); }
.stamp.nope { right: 22px; color: var(--bad); transform: rotate(12deg); opacity: var(--nope); }

/* ---------- Espace manager ---------- */
.todo-edit { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.todo-edit .row { flex-wrap: wrap; }
.todo-edit-row { padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: nowrap !important; }
.todo-edit input { flex: 1; min-width: 0; }
.a-wrap { display: flex; min-height: 100vh; }
.a-side { width: 250px; background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; flex-shrink: 0; }
.a-side .logo { font-weight: 800; font-size: 18px; padding: 0 8px 18px; }
.a-side .logo span { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.a-side button { display: flex; width: 100%; gap: 10px; align-items: flex-start; background: none; border: 0; padding: 9px 10px; border-radius: 10px; cursor: pointer; color: var(--muted); text-align: left; }
.a-side button .ic { font-size: 17px; line-height: 1.3; }
.a-side button b { display: block; font-weight: 600; color: var(--text); }
.a-side button small { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; margin-top: 1px; }
.a-side button:hover { background: var(--panel2); }
.a-side button.on { background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); }
.a-side button.on b { color: var(--accent); }
.a-col { flex: 1; min-width: 0; }
.a-top { display: none; }
.a-scrim { display: none; }
.intro { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 0 0 18px; color: var(--muted); max-width: 75ch; }
.intro b { color: var(--text); }
.guide-step { display: flex; gap: 14px; align-items: flex-start; }
.guide-n { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--gold-ink); }
.a-main { flex: 1; padding: 24px; max-width: 1200px; min-width: 0; }
.a-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
.insp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.insp-grid .embed { max-height: 420px; }
.insp-preview { margin-top: 12px; max-width: 320px; }
.insp-preview .embed { max-height: 520px; }
.login { max-width: 360px; margin: 12vh auto; padding: 0 16px; }
@media (max-width: 760px) {
  .a-main { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
/* Menu burger : en dessous de 900px de large, le menu se replie sur le côté */
@media (max-width: 900px) {
  .a-side { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(290px, 85vw); overflow-y: auto;
    transform: translateX(-105%); transition: transform .25s ease; box-shadow: 8px 0 30px rgba(0,0,0,.4); }
  .a-wrap.menu-open .a-side { transform: none; }
  .a-wrap.menu-open .a-scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.55); }
  .a-top { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; padding: 10px 16px;
    background: rgba(10,9,8,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .a-main { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

/* Fenêtre « Accès de la modèle » (espace manager) */
.access { display: grid; gap: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.access > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.access b { word-break: break-all; }

/* ============ Téléphone : espace manager ============ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.ftable-wrap { overflow-x: auto; }
@media (max-width: 760px) {
  /* champs à 16px : l'iPhone ne zoome plus quand on touche un champ */
  input, select, textarea { font-size: 16px; }
  .btn.sm { min-height: 38px; padding: 8px 12px; }
  .grid2.keep { grid-template-columns: 1fr 1fr; }
  /* le titre de la page est déjà dans la barre du haut */
  .a-head h2 { display: none; }
  .a-head { margin-bottom: 12px; }
  .a-head > .btn { flex: 1; text-align: center; }
  .intro { font-size: 14px; }

  /* tableaux -> lignes empilées lisibles */
  .ftable-wrap { overflow: visible; }
  .ftable thead { display: none; }
  .ftable, .ftable tbody { display: block; }
  .ftable tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .ftable td { display: block; border: 0; padding: 0; }
  .ftable td:last-child { margin-left: auto; }
  .ftable.acc td:first-child { flex-basis: 100%; font-weight: 700; }
  .ftable.reqs tr { padding: 14px; }
  .ftable.reqs td:nth-child(1) { flex-basis: 100%; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
  .ftable.reqs td:nth-child(2) { flex-basis: 100%; }

  /* fenêtres : panneau qui monte du bas, bouton toujours accessible */
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; border-bottom: 0;
    max-height: 92dvh; padding: 20px 16px 0; }
  dialog .row:last-child { position: sticky; bottom: 0; z-index: 2; background: var(--panel); border-top: 1px solid var(--line);
    margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  dialog .row:last-child .btn { flex: 1; }
  dialog .row:last-child .spacer { display: none; }
}
/* app installée sur l'iPhone : rien ne passe sous l'encoche */
.a-top { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.a-side { padding-top: calc(18px + env(safe-area-inset-top, 0px)); padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
.a-main { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }

.todo-cat { border-bottom: 1px solid var(--line); padding: 8px 0; }
.todo-cat summary { cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.todo-add select { width: auto; flex-shrink: 0; max-width: 46%; }
@media (max-width: 760px) { .todo-add { flex-wrap: wrap; } .todo-add select { max-width: none; flex: 1 1 100%; } }
