/* AFP Team — charte AFP (systems/website/design.md) : Plus Jakarta Sans + Inter, anneau orange/cyan.
   Pensé pour le téléphone d'abord : cibles de 48 px, actions principales en bas d'écran, sous le pouce. */
:root {
  --bg: #F6F6F8; --surface: #FFFFFF; --sunk: #EFEFF3; --line: #E6E6EC;
  --ink: #0A0A0F; --text: #1A1A1A; --soft: #4A4A55; --muted: #7A7A86;
  --orange: #FF672F; --orange-ink: #C2410C; --orange-bg: #FFF1EA;
  --cyan: #3BD8EA; --cyan-ink: #0E7490; --cyan-bg: #E6FAFC;
  --blue: #5078E7; --blue-bg: #EEF2FD;
  --amber-ink: #A16207; --amber-bg: #FEF6DC;
  --red-ink: #B42318; --red-bg: #FDECEA;
  --green-ink: #15803D; --green-bg: #E8F7EE;
  --violet: #8B5CF6;
  --btn: #0A0A0F; --btn-text: #FFFFFF;
  --shadow: 0 1px 2px rgba(10,10,15,.04), 0 4px 16px rgba(10,10,15,.05);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A0A0F; --surface: #141420; --sunk: #1C1C2A; --line: #262636;
    --ink: #FFFFFF; --text: #E8E8ED; --soft: #B4B4C2; --muted: #8888A0;
    --orange-ink: #FF9A76; --orange-bg: #2A1810;
    --cyan-ink: #67E3F0; --cyan-bg: #0C2529;
    --blue-bg: #161D33;
    --amber-ink: #F5C451; --amber-bg: #2A2210;
    --red-ink: #F49A90; --red-bg: #2E1513;
    --green-ink: #6EE7A0; --green-bg: #0F2619;
    --btn: #FFFFFF; --btn-text: #0A0A0F;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 400 16px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .word, .hello { font-family: "Plus Jakarta Sans", Inter, sans-serif; letter-spacing: -0.02em; }
a { color: var(--blue); text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

/* ---------- barre du haut ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.bar.scrolled { border-bottom-color: var(--line); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); min-height: 44px; }
.mark { width: 28px; height: 28px; flex: none; }
.word { font-size: 1.06rem; font-weight: 800; }
.word b { font-weight: 600; color: var(--muted); }
nav { display: flex; align-items: center; gap: 8px; }
.avatar {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), #FF9A76); color: #fff;
  font: 700 .95rem "Plus Jakarta Sans", sans-serif; letter-spacing: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: .72rem; }
.avatar.c1 { background: linear-gradient(135deg, #3BD8EA, #5078E7); }
.avatar.c2 { background: linear-gradient(135deg, #8B5CF6, #5078E7); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--btn); color: var(--btn-text); border: 0; padding: 0; margin: 0;
}
.icon-btn svg { width: 20px; height: 20px; }

main { max-width: 640px; margin: 0 auto; padding: 8px 16px calc(32px + env(safe-area-inset-bottom)); }
main.has-dock { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

/* ---------- accueil ---------- */
.hello { font-size: 1.75rem; font-weight: 800; line-height: 1.15; margin: 14px 0 4px; color: var(--ink); }
.sub { color: var(--muted); margin: 0 0 18px; font-size: .95rem; }
.sub b { color: var(--text); font-weight: 600; }

.tabs {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
  padding: 4px; margin: 0 0 16px; background: var(--sunk); border-radius: 14px;
  position: sticky; top: calc(64px + env(safe-area-inset-top)); z-index: 5;
}
.tabs button {
  margin: 0; min-height: 40px; padding: 0 8px; border: 0; border-radius: 10px;
  background: transparent; color: var(--soft); font: 600 .9rem Inter, sans-serif;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--line); color: var(--soft); font-size: .72rem; line-height: 20px; text-align: center;
}
.tabs button[aria-selected="true"] .count { background: var(--orange); color: #fff; }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; margin: 0; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--soft); font: 500 .88rem Inter, sans-serif;
}
.chips button[aria-pressed="true"] { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }

/* ---------- carte de tâche ---------- */
.list { display: grid; gap: 10px; }
a.task {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 14px 16px; color: inherit; box-shadow: var(--shadow);
  transition: transform .12s ease, background .12s;
}
a.task:active { transform: scale(.985); background: var(--sunk); }
.task .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task .title { grid-column: 1; font: 600 1.02rem/1.35 Inter, sans-serif; color: var(--ink); }
.task .foot { grid-column: 1; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 4px; color: var(--muted); font-size: .84rem; }
.task .chev { grid-column: 2; grid-row: 1 / span 3; color: var(--muted); width: 20px; height: 20px; }
.foot .it { display: inline-flex; align-items: center; gap: 5px; }
.foot svg { width: 15px; height: 15px; }
.foot .late { color: var(--red-ink); font-weight: 600; }
.foot .soon { color: var(--orange-ink); font-weight: 600; }

.proj { display: inline-flex; align-items: center; gap: 6px; font: 600 .7rem/1 Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); }
.proj::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.proj.mojo::before { background: var(--orange); }
.proj.afp::before { background: var(--blue); }
.proj.perso::before { background: var(--violet); }
.proj.other::before { background: var(--cyan); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font: 600 .74rem Inter, sans-serif; white-space: nowrap; background: var(--sunk); color: var(--soft); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.review { background: var(--amber-bg); color: var(--amber-ink); }
.badge.changes { background: var(--red-bg); color: var(--red-ink); }
.badge.done { background: var(--green-bg); color: var(--green-ink); }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .ring { width: 56px; height: 56px; margin: 0 auto 12px; opacity: .9; }
.empty p { margin: 0; }
.empty strong { display: block; color: var(--ink); font: 700 1.05rem "Plus Jakarta Sans", sans-serif; margin-bottom: 4px; }

/* ---------- détail d'une tâche ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: 0 0 4px -6px; padding: 0 6px; color: var(--soft); font-weight: 500; }
.back svg { width: 20px; height: 20px; }
.head h1 { font-size: 1.55rem; line-height: 1.2; font-weight: 800; margin: 10px 0 12px; color: var(--ink); }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.fact { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .84rem; color: var(--soft); }
.fact svg { width: 15px; height: 15px; }
.fact.late { color: var(--red-ink); border-color: transparent; background: var(--red-bg); font-weight: 600; }
.fact.soon { color: var(--orange-ink); border-color: transparent; background: var(--orange-bg); font-weight: 600; }
.fact.badge { height: 30px; border: 0; }

.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 12px; box-shadow: var(--shadow); }
.block h2 { display: flex; align-items: center; justify-content: space-between; font-size: 1rem; font-weight: 700; margin: 0 0 12px; color: var(--ink); }
.block h2 .n { font: 500 .85rem Inter, sans-serif; color: var(--muted); }
.notes { white-space: pre-wrap; margin: 0; color: var(--text); }
.asked { margin: 12px 0 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.edit-link { display: inline-flex; align-items: center; min-height: 40px; font-weight: 600; font-size: .9rem; }

.files { display: grid; gap: 12px; }
.file { margin: 0; }
.file video, .file img { display: block; width: 100%; max-height: 62vh; border-radius: 14px; background: #000; object-fit: contain; }
.file .heic { display: grid; place-items: center; aspect-ratio: 4/3; border-radius: 14px; background: var(--sunk); color: var(--muted); font-size: .9rem; }
.file figcaption { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: .82rem; color: var(--muted); }
.file figcaption a { font-weight: 600; }

.drop {
  display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 16px;
  border: 1.5px dashed color-mix(in srgb, var(--orange) 55%, var(--line)); border-radius: 16px;
  background: var(--orange-bg); color: var(--ink); cursor: pointer;
}
.files:empty + .drop, .drop.first { margin-top: 0; }
.drop .ico { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--orange); color: #fff; }
.drop .ico svg { width: 24px; height: 24px; }
.drop b { display: block; font-weight: 600; }
.drop small { color: var(--soft); font-size: .82rem; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop:has(input:disabled) { opacity: .55; }
.drop:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
progress { width: 100%; height: 8px; margin-top: 12px; border: 0; border-radius: 4px; overflow: hidden; background: var(--sunk); appearance: none; }
progress::-webkit-progress-bar { background: var(--sunk); }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--orange), var(--cyan)); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--orange); }
.status-line { margin: 8px 0 0; font-size: .85rem; color: var(--soft); }
.status-line:empty { display: none; }

/* commentaires en bulles */
.thread { display: grid; gap: 10px; margin-bottom: 12px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.msg .bubble { background: var(--sunk); border-radius: 16px 16px 16px 4px; padding: 9px 12px; }
.msg .who { display: block; font-size: .74rem; color: var(--muted); margin-bottom: 2px; }
.msg .body { margin: 0; white-space: pre-wrap; word-break: break-word; }
.msg.mine { margin-left: auto; flex-direction: row-reverse; }
.msg.mine .bubble { background: var(--btn); color: var(--btn-text); border-radius: 16px 16px 4px 16px; }
.msg.mine .who { color: color-mix(in srgb, var(--btn-text) 65%, transparent); }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea {
  flex: 1; min-height: 46px; max-height: 160px; margin: 0; resize: none;
  padding: 12px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--bg);
  font: 400 16px/1.35 Inter, sans-serif; color: var(--text);
}
.composer .send { flex: none; width: 46px; height: 46px; margin: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; background: var(--orange); border: 0; color: #fff; }
.composer .send svg { width: 20px; height: 20px; }
.muted { color: var(--muted); font-size: .9rem; margin: 0; }

/* barre d'action collée en bas, sous le pouce */
#dock:empty { display: none; }
#dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
#dock .actions { max-width: 640px; margin: 0 auto; display: flex; gap: 10px; }
#dock .actions button { flex: 1; margin: 0; }
#dock .error { max-width: 640px; margin: 0 auto 8px; }

/* ---------- formulaires et boutons ---------- */
button {
  font: 600 1rem Inter, sans-serif; min-height: 52px; padding: 0 20px; border-radius: 14px;
  border: 1px solid var(--btn); background: var(--btn); color: var(--btn-text); cursor: pointer; margin-top: 14px;
  transition: transform .1s ease, opacity .15s;
}
button:active { transform: scale(.98); }
button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
button.accent { background: var(--orange); border-color: var(--orange); color: #fff; }
button.full { width: 100%; }
button.link { min-height: 0; border: 0; background: none; color: var(--red-ink); padding: 0; margin: 0; font-size: .82rem; font-weight: 600; }
button:disabled { opacity: .45; }
label { display: block; margin: 14px 0 0; font-size: .85rem; font-weight: 500; color: var(--soft); }
label.check { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: .95rem; min-height: 44px; }
label.check input { width: 22px; height: 22px; accent-color: var(--orange); }
input:not([type=checkbox]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: 6px; min-height: 50px; padding: 12px 14px;
  font: 400 16px Inter, sans-serif; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.form h1 { font-size: 1.5rem; font-weight: 800; margin: 10px 0 4px; color: var(--ink); }
.error { color: var(--red-ink); font-size: .9rem; margin: 8px 0 0; }
.error:empty { display: none; }
.ok { color: var(--green-ink); font-size: .9rem; margin: 8px 0 0; }
.ok:empty { display: none; }
.danger-zone { margin-top: 20px; text-align: center; }

/* ---------- connexion ---------- */
.login { min-height: calc(100dvh - 140px); display: flex; flex-direction: column; justify-content: center; }
.login .ring { width: 64px; height: 64px; margin-bottom: 20px; }
.login h1 { font-size: 2rem; font-weight: 800; line-height: 1.1; margin: 0 0 6px; color: var(--ink); }
.login .sub { margin-bottom: 18px; }
body.signed-out .bar { display: none; }

/* ---------- compte ---------- */
.me { display: flex; align-items: center; gap: 14px; margin: 14px 0 18px; }
.me .avatar { width: 56px; height: 56px; font-size: 1.2rem; }
.me h1 { margin: 0; font-size: 1.4rem; font-weight: 800; color: var(--ink); }
.me p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }

.loading { height: 3px; margin: 40px auto; width: 120px; border-radius: 2px; background: linear-gradient(90deg, var(--orange), var(--cyan)); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .3; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Le focus posé par le code sur le titre (lecteurs d'écran) ne doit pas dessiner de cadre. */
[tabindex="-1"]:focus { outline: none; }
.hello + .sub { margin-top: 6px; }
