/* A-FORCE — styles communs. Fond sombre, une teinte par page. */

:root {
  --bg: #120F15;
  --surface: #1D191F;
  --row: #221D25;
  --border: #372E3D;
  --line: #2C2730;
  --text: #ECEDF1;
  --muted: #A6ABB6;
  --grip: #6C6473;

  /* Organisation : violet vif (~275) */
  --accent: #AC4DFF;
  --accent-soft: #E1B9FD;
  --accent-btn: #8D30CF;
  --accent-deep: #2F1740;
  --accent-border: #5C3678;

  /* Ocre (urgences, avertissements) */
  --ocre: #F0C877;
  --ocre-deep: #3A2B0F;

  --danger: #F4A3A3;
  --radius: 18px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-title: "Space Grotesk", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-title); margin: 0; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

.wrap { max-width: 1440px; margin: 0 auto; padding: 24px 24px 48px; display: flex; flex-direction: column; gap: 22px; }

/* En-tête de page */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.brand { display: block; font-family: var(--font-title); font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.page-title { font-size: 64px; font-weight: 700; line-height: 1; letter-spacing: -.02em; color: var(--accent); }
.small-title { font-size: 40px; }

/* Navigation entre les pages */
.head-nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn.nav-elan { min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid #6B5220; background: #241B0B; color: #F0C877; font-weight: 700; text-decoration: none; }
.btn.nav-orga { min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid #5C3678; background: #2F1740; color: #D9B2FF; font-weight: 700; text-decoration: none; }

/* Grille : 3 colonnes dès ~1000 px (écran vertical de 1080 compris) */
.layout { display: grid; grid-template-columns: minmax(190px, 270px) minmax(0, 1fr) minmax(240px, 330px); gap: 16px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.count { font-family: var(--font-title); font-size: 22px; font-weight: 700; color: var(--accent-soft); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; background: transparent; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.primary { background: var(--accent-btn); color: var(--on-accent, #fff); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.ghost { border-color: var(--accent-border); }
.btn.ghost.dim { border-color: var(--border); font-weight: 500; }
.btn.ghost:hover { background: var(--accent-deep); }
.btn.danger { color: var(--danger); margin-left: auto; font-weight: 500; }
.btn.danger.confirm { background: #4a1d22; }
.btn:focus-visible, .link:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--accent); cursor: pointer; font-size: 14px; text-align: left; }
.link:hover { color: var(--accent-soft); text-decoration: underline; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: transparent; cursor: pointer; }

input[type="text"], input[type="password"], input[type="date"], select, textarea {
  min-height: 44px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; background: var(--bg); width: 100%;
}
textarea { padding: 10px 12px; resize: vertical; }
input[type="date"] { color-scheme: dark; }
select { color-scheme: dark; }
input::placeholder, textarea::placeholder { color: #8A8F99; }

/* Colonne projets */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree { display: flex; flex-direction: column; gap: 2px; }
.tree .children { display: flex; flex-direction: column; gap: 2px; min-height: 8px; padding-bottom: 6px; }
.meta-head { display: flex; align-items: center; gap: 8px; padding: 12px 8px 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.meta-head .name { flex: 1 1 auto; min-width: 0; background: none; border: 0; padding: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: left; cursor: pointer; }
.proj { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 8px; border-radius: 10px; border: 1px solid transparent; }
.proj.active { background: var(--accent-deep); border-color: var(--accent-border); }
.proj .name { flex: 1 1 auto; min-width: 0; background: none; border: 0; padding: 6px 0; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.proj.active .name { font-weight: 700; }
.badge-n { flex: none; min-width: 22px; text-align: center; font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 999px; color: var(--muted); }
.badge-n.hot { background: var(--ocre-deep); color: var(--ocre); }
.grip { flex: none; width: 18px; height: 24px; display: inline-flex; align-items: center; justify-content: center; cursor: grab; color: var(--grip); touch-action: none; }
.grip:active { cursor: grabbing; }
.nav-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Projet ouvert */
.main { gap: 18px; padding: 22px; }
.project-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.project-head h2 { font-size: 26px; }
.project-tools { display: flex; align-items: center; gap: 12px; }
.add-task { display: flex; flex-wrap: wrap; gap: 8px; }
.add-task input { flex: 1 1 200px; min-width: 0; width: auto; }
.add-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

#groups { display: flex; flex-direction: column; gap: 20px; }
.group { display: flex; flex-direction: column; gap: 6px; }
.group h3.p1 { color: var(--ocre); }
.group h3.p2 { color: var(--accent); }
.group h3.p3 { color: var(--muted); }
.tasklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-height: 12px; }
.tasklist:empty { min-height: 44px; border: 1px dashed var(--line); border-radius: 12px; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 12px; background: var(--row); border: 1px solid var(--line); }
.task .grip { margin-top: 2px; }
.task input[type="checkbox"] { flex: none; width: 20px; height: 20px; margin: 4px 0 0; accent-color: var(--accent-btn); cursor: pointer; }
.task .body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.task .title { background: none; border: 0; padding: 2px 0; text-align: left; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; }
.task .title:hover { color: var(--accent-soft); }
.task .desc { font-size: 13px; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.chip { flex: none; align-self: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--accent-deep); color: var(--accent-soft); border: 1px solid var(--accent-border); }
.sortable-ghost { opacity: .35; }
.sortable-chosen { outline: 1px solid var(--accent-border); }

.scheduled-here summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 0; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.plain-list li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.plain-list li:first-child { border-top: 0; }
.plain-list .when { flex: none; min-width: 92px; font-size: 13px; font-weight: 700; color: var(--accent); }
.plain-list .what { flex: 1 1 auto; min-width: 0; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.plain-list .what.static { cursor: default; }
.plain-list .where { flex: none; font-size: 13px; color: var(--muted); }
.scroll { max-height: 60vh; overflow: auto; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

/* À trier */
.inbox { background: var(--accent-deep); border-color: var(--accent-border); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1 1 auto; min-width: 0; width: auto; }
.inbox-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.inbox-item { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.inbox-item .top { display: flex; gap: 6px; align-items: center; }
.inbox-item .text { flex: 1 1 auto; width: auto; min-width: 0; min-height: 36px; font-weight: 600; background: transparent; border-color: transparent; padding: 0 6px; }
.inbox-item .text:hover, .inbox-item .text:focus { border-color: var(--border); background: var(--bg); }
.inbox-item .controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inbox-item select { width: auto; min-height: 34px; font-size: 13px; padding: 0 8px; flex: 1 1 0; min-width: 0; }
.inbox-item .x { flex: none; width: 34px; height: 34px; color: var(--muted); }

.day { display: flex; flex-direction: column; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.day:last-child { border-bottom: 0; }
.day .d { font-size: 13px; font-weight: 700; color: var(--accent); }
.day .it { font-size: 14px; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.day .it span { color: var(--muted); }

/* Fenêtres */
.dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--accent-border); border-radius: 20px; background: var(--surface); color: var(--text); }
.dialog.narrow { width: min(520px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(6, 4, 8, .7); }
.dialog-body { padding: 24px 26px; display: flex; flex-direction: column; gap: 18px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.eyebrow { font-family: var(--font-title); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > label, .field > legend, .field > .label { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0; }
.field > legend { margin-bottom: 6px; }
.big { font-size: 17px; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row.end { align-items: flex-end; }
.grow { flex: 1 1 200px; }
.box { border: 1px solid var(--border); border-radius: 14px; margin: 0; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.box > legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--accent); }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.segmented button { min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: transparent; cursor: pointer; }
.segmented button[aria-pressed="true"][data-value="1"] { border-color: var(--ocre); background: var(--ocre-deep); color: var(--ocre); font-weight: 700; }
.segmented button[aria-pressed="true"][data-value="2"] { border-color: var(--accent); background: var(--accent-deep); color: var(--accent-soft); font-weight: 700; }
.segmented button[aria-pressed="true"][data-value="3"] { border-color: var(--muted); background: var(--row); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; font-size: 14px; cursor: pointer; }
.chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-deep); color: var(--accent-soft); font-weight: 700; }
.next { padding-bottom: 8px; }
.next b { font-size: 17px; color: var(--accent-soft); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Connexion */
.login { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.login-card { width: min(420px, 100%); padding: 28px; gap: 14px; }
.error { color: var(--danger); margin: 0; }
.hash { white-space: pre-wrap; word-break: break-all; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 13px; margin: 0; }

/* Messages */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(560px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: #2A2430; border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast .msg { flex: 1 1 auto; min-width: 0; }
.toast.err { border-color: #7a3036; }
