/* Slot : feuille de style commune (connexion et application). Inspiration Apple, comme « Mes Finances » et « Pilotage des risques ». */
:root {
  color-scheme: light;
  --bg: #f5f5f7; --card: #ffffff; --ink: #1d1d1f; --ink-2: #6e6e73; --ink-3: #86868b;
  --hair: rgba(0,0,0,.08); --hair-strong: rgba(0,0,0,.14); --fill: rgba(118,118,128,.12); --fill-2: rgba(118,118,128,.07);
  --accent: #0071e3; --bad: #ff3b30; --good: #34c759; --warn: #ff9500;
  --bad-text: #c9302c; --good-text: #1a7f37; --warn-text: #b45f00;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 32px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000; --card: #1c1c1e; --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #8e8e93;
    --hair: rgba(255,255,255,.09); --hair-strong: rgba(255,255,255,.16); --fill: rgba(118,118,128,.24); --fill-2: rgba(118,118,128,.14);
    --accent: #0a84ff; --bad-text: #ff6961; --good-text: #30d158; --warn-text: #ff9f0a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 32px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000; --card: #1c1c1e; --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #8e8e93;
  --hair: rgba(255,255,255,.09); --hair-strong: rgba(255,255,255,.16); --fill: rgba(118,118,128,.24); --fill-2: rgba(118,118,128,.14);
  --accent: #0a84ff; --bad-text: #ff6961; --good-text: #30d158; --warn-text: #ff9f0a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 32px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, sans-serif;
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.bad-text { color: var(--bad-text); } .good-text { color: var(--good-text); }

/* ---------- Champs et boutons ---------- */
input, select, textarea {
  width: 100%; border-radius: 10px; border: 1px solid var(--hair-strong); background: var(--card); padding: 0 12px; height: 38px; outline: none;
}
textarea { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; padding: 0; accent-color: var(--accent); flex: none; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
label.f .hint { font-weight: 400; color: var(--ink-3); }
.btn {
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--hair-strong); background: var(--card); cursor: pointer;
  font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: var(--fill-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.danger { color: var(--bad-text); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--fill); }
.btn.sm { height: 30px; padding: 0 10px; border-radius: 8px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; color: var(--ink-3); display: grid; place-items: center; font-size: 16px; line-height: 1; }
.icon-btn:hover { background: var(--fill); color: var(--ink); }
.msg { font-size: 13px; line-height: 1.45; border-radius: 10px; padding: 10px 12px; }
.msg:empty { display: none; }
.msg.err { color: var(--bad-text); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.msg.info { color: var(--ink-2); background: var(--fill); }
.msg.ok { color: var(--good-text); background: color-mix(in srgb, var(--good) 12%, transparent); }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Connexion ---------- */
body.login { display: grid; place-items: center; padding: 24px 16px; min-height: 100vh; }
.wrap { width: 100%; max-width: 380px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; text-align: center; }
.mark { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, #30d5c8, #0a84ff 55%, #5e5ce6); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 8px 24px rgba(10,132,255,.25); }
.brand h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.brand p { color: var(--ink-2); margin: 4px 0 0; }
.login .card { padding: 22px; border-radius: 20px; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login input { height: 44px; border-radius: 11px; font-size: 15px; }
.login .btn.primary { height: 44px; font-size: 15px; margin-top: 4px; }
.foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* ---------- Application ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--hair); background: var(--card); position: sticky; top: 0; z-index: 5; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo .mk { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, #30d5c8, #0a84ff 55%, #5e5ce6); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--ink-2); font-size: 13px; }
main { padding: 28px 24px 60px; max-width: 920px; width: 100%; margin: 0 auto; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.head .sub { color: var(--ink-2); margin-top: 2px; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 10px; font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--hair); border-radius: 18px; box-shadow: var(--shadow); }
.pad { padding: 18px 20px; }
.card h2 { font-size: 16px; font-weight: 650; }
.card .ch { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; color: var(--ink); font-weight: 400; }
.opt .hint { display: block; color: var(--ink-3); font-size: 12.5px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--fill); color: var(--ink-2); }
.pill.open { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good-text); }
.pill.closed { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn-text); }

/* Liste des sondages */
.polls { display: flex; flex-direction: column; }
.poll-row { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 0; border-bottom: 1px solid var(--hair); }
.poll-row:last-child { border-bottom: 0; }
.poll-row:hover { background: var(--fill-2); }
.poll-link { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 8px 12px 20px; color: var(--ink); }
.poll-link:hover { text-decoration: none; }
.poll-link b { font-weight: 600; overflow-wrap: anywhere; }
.poll-link .meta { color: var(--ink-3); font-size: 12.5px; }
.poll-link .meta.good-text { color: var(--good-text); }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters input[type="search"] { width: auto; flex: 1; min-width: 180px; max-width: 320px; }
.seg { flex: none; }
.empty { text-align: center; color: var(--ink-2); padding: 44px 20px; }
.empty p { margin: 0 0 14px; }

/* Lien de partage */
.share { display: flex; gap: 8px; }
.share input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* Générateur de créneaux (dates × heures) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--fill); border-radius: 99px; padding: 3px 4px 3px 10px; font-size: 13px; font-weight: 500; }
.chip .icon-btn { width: 20px; height: 20px; font-size: 14px; }
.addrow { display: flex; gap: 8px; align-items: center; }
.addrow input { width: auto; flex: 1; max-width: 200px; }
.grid-wrap { overflow-x: auto; border: 1px solid var(--hair); border-radius: 12px; }
table.grid { border-collapse: collapse; width: 100%; }
.grid th, .grid td { padding: 8px 12px; border-bottom: 1px solid var(--hair); text-align: center; white-space: nowrap; }
.grid th { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.grid th:first-child, .grid td:first-child { text-align: left; font-weight: 600; position: sticky; left: 0; background: var(--card); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td input[type="checkbox"] { margin: 0; }
.slot-days { display: flex; flex-direction: column; gap: 8px; }
.slot-day { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.slot-day b { min-width: 150px; }
.slot-day b::first-letter { text-transform: uppercase; }
.slot-day span { color: var(--ink-2); }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0; }
dl.kv dt { color: var(--ink-3); } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 14px; }

/* Contrôle à trois choix (Oui / Peut-être / Non) */
.seg { display: inline-flex; background: var(--fill); border-radius: 10px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 34px; min-width: 64px; padding: 0 12px; border-radius: 8px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.seg button:hover:not([disabled]):not(.on) { background: var(--fill); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.14); font-weight: 600; }
.seg button.opt-yes.on { background: var(--good); color: #fff; }
.seg button.opt-maybe.on { background: var(--warn); color: #fff; }
.seg button[disabled] { opacity: .4; cursor: not-allowed; }

/* Page participant */
body.public main { max-width: 760px; display: flex; flex-direction: column; gap: 16px; }
.ptitle { font-size: 26px; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.sub { color: var(--ink-2); margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vlist { display: flex; flex-direction: column; gap: 16px; }
.vday h3 { font-size: 14px; font-weight: 650; text-transform: none; margin-bottom: 8px; }
.vday h3::first-letter { text-transform: uppercase; }
.vrow { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--hair); border-radius: 12px; margin-bottom: 8px; }
.vinfo { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; }
.vnote { flex-basis: 100%; }

/* Résultats */
.g { font-weight: 700; }
.g.yes { color: var(--good-text); } .g.maybe { color: var(--warn-text); } .g.no { color: var(--ink-3); font-weight: 400; }
.grid td .g { display: inline-block; min-width: 18px; }
.grid th { line-height: 1.3; }
.grid.results th:first-child, .grid.results td:first-child { min-width: 120px; }
.grid.results th:first-child { background: var(--card); }
.grid .col-top { background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.grid tr.sum th, .grid tr.sum td { background-color: color-mix(in srgb, var(--ink) 5%, var(--card)); border-bottom-color: var(--hair-strong); font-weight: 500; vertical-align: middle; }
.grid tr.sum th { color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.grid tr.sum td.col-top { background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.grid tr.sum td .pill { margin: 1px 2px; }
.rank { color: var(--ink-2); font-weight: 600; }

/* Résumé du créateur */
textarea.mono { font-family: inherit; min-height: 150px; }
.ok-box { border-left: 3px solid var(--good); }

/* Fenêtre de confirmation */
.layer { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; padding: 16px; z-index: 20; }
.dialog { background: var(--card); border-radius: 18px; padding: 22px; width: 100%; max-width: 420px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 500; z-index: 30; }

@media (max-width: 640px) {
  main { padding: 18px 16px 48px; }
  .topbar { padding: 10px 16px; }
  .row, .row3 { grid-template-columns: 1fr; }
  .head h1 { font-size: 23px; }
  .topbar .who { display: none; }
  .share { flex-direction: column; }
  .slot-day b { min-width: 0; width: 100%; }
  .ptitle { font-size: 22px; }
  .poll-row { flex-wrap: wrap; padding-left: 0; }
  .poll-link { flex-basis: 100%; padding-bottom: 0; }
  .poll-row .pill { margin: 0 0 8px 20px; }
  .poll-row .btn { margin: 0 0 8px; }
  .vrow .seg { width: 100%; }
  .vrow .seg button { flex: 1; min-width: 0; }
}
