/* gtd-easy — feuille de style unique, sans dépendance. */

:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-alt: #f2f1ec;
  --border: #e2e0d8;
  --text: #24231f;
  --text-soft: #6e6b62;
  --text-faint: #9a978d;
  --accent: #2f6f4f;
  --accent-soft: #e6f0ea;
  --danger: #a8402f;
  --warn: #8a6a1f;
  --warn-soft: #f7f0dc;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .06);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181a;
    --surface: #1e2124;
    --surface-alt: #262a2e;
    --border: #33383d;
    --text: #e6e5e1;
    --text-soft: #a3a69f;
    --text-faint: #7b7e78;
    --accent: #7fc0a0;
    --accent-soft: #23342b;
    --danger: #e08d7c;
    --warn: #d6b45f;
    --warn-soft: #33301f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

[hidden] { display: none !important; }

/* ---------- connexion ---------- */

.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  letter-spacing: .04em;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: .85rem;
  color: var(--text-soft);
}

.login-card input,
.login-card button {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.login-card button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .login-card button { color: #10201a; }
}

.error { margin: 0; color: var(--danger); font-size: .88rem; }

/* ---------- structure ---------- */

.app {
  min-height: 100%;
  display: grid;
  grid-template-areas: "top" "view" "nav";
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
}

.topbar {
  grid-area: top;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  min-width: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--accent);
  font-size: .95rem;
}

.capture { flex: 1; display: flex; gap: 6px; min-width: 0; }

.capture input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}

.capture input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.capture button {
  flex: none;
  width: 38px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
}

@media (prefers-color-scheme: dark) { .capture button { color: #10201a; } }

.capture.flash input {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 1.05rem;
  line-height: 1;
}

.icon-btn:hover { background: var(--surface-alt); }

.search-bar {
  grid-area: top;
  align-self: end;
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.search-bar input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

/* ---------- navigation ---------- */

.nav {
  grid-area: nav;
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  font-size: .68rem;
  text-decoration: none;
  color: var(--text-soft);
}

.nav a .nav-icon { font-size: 1.05rem; line-height: 1; }

.nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* Sur mobile la barre du bas ne tient que cinq entrées : les quatre vues
   quotidiennes, plus « Plus » qui ouvre le reste. */
.nav a[data-group="secondary"] { display: none; }

.nav .badge {
  position: absolute;
  transform: translate(14px, -4px);
  min-width: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  text-align: center;
}

@media (prefers-color-scheme: dark) { .nav .badge { color: #10201a; } }

/* ---------- vue ---------- */

.view {
  grid-area: view;
  padding: 16px 12px 28px;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  outline: none;
}

.view-head { margin: 0 0 14px; }
.view-head h1 { margin: 0; font-size: 1.3rem; }
.view-head p { margin: 4px 0 0; color: var(--text-soft); font-size: .88rem; }

.section-title {
  margin: 22px 0 8px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* ---------- listes ---------- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card.is-cursor { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card.is-done .row-title { color: var(--text-faint); text-decoration: line-through; }

.row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
}

.check {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: transparent;
  font-size: .7rem;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
}

.check:hover { border-color: var(--accent); color: var(--text-faint); }
.check[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

@media (prefers-color-scheme: dark) { .check[aria-pressed="true"] { color: #10201a; } }

.row-main {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font: inherit;
}

.row-title { display: block; overflow-wrap: anywhere; }

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: .74rem;
  color: var(--text-soft);
}

.tag {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-soft);
  white-space: nowrap;
}

.tag.context { background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- panneau déplié ---------- */

.panel {
  border-top: 1px solid var(--border);
  padding: 12px;
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .74rem;
  color: var(--text-soft);
}

.panel input,
.panel textarea,
.panel select {
  font-size: 1rem;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  width: 100%;
}

.panel textarea { resize: vertical; min-height: 60px; }

/* Droits d'un jeton : la case à côté de son intitulé, pas au-dessus. */
.panel label.token-right {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: .86rem;
  color: var(--text);
}
.panel label.token-right input { width: auto; flex: none; margin: 0; }

/* Le jeton tout juste créé : un champ qui prend la largeur, et son bouton. */
.token-show { flex-wrap: nowrap; }
.token-show input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; }

.panel-hint { margin: 0; font-size: .76rem; color: var(--text-faint); }

.actions { display: flex; flex-wrap: wrap; gap: 6px; }

.btn {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: .82rem;
}

.btn:hover { background: var(--bg); border-color: var(--text-faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

@media (prefers-color-scheme: dark) { .btn.primary { color: #10201a; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

/* ---------- projets ---------- */

.project-actions {
  list-style: none;
  margin: 0;
  padding: 0 12px 10px 42px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-actions li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
  color: var(--text-soft);
  padding: 2px 0;
}

.quick-add {
  display: flex;
  gap: 6px;
  padding: 0 12px 12px 42px;
}

.quick-add input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 1rem;
}

/* ---------- revue ---------- */

.review-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.review-step .num {
  flex: none;
  border: none;
  padding: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: .78rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.review-step.clear .num { background: var(--accent); color: #fff; }
button.num { cursor: pointer; }
button.num:hover { outline: 2px solid var(--accent); outline-offset: 1px; }

@media (prefers-color-scheme: dark) { .review-step.clear .num { color: #10201a; } }

.review-step > div { min-width: 0; }
.review-step h2 { margin: 0; font-size: .95rem; }
.review-step p { margin: 3px 0 0; font-size: .85rem; color: var(--text-soft); }
.review-step ul { margin: 6px 0 0; padding-left: 18px; font-size: .85rem; color: var(--text-soft); }

/* ---------- menu, dialogue, toast ---------- */

.menu {
  position: fixed;
  top: 54px;
  right: 10px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 8px;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.menu a, .menu button {
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  text-align: left;
  text-decoration: none;
  color: var(--text);
  font-size: .88rem;
}

.menu a:hover, .menu button:hover { background: var(--surface-alt); }
.menu-user { margin: 0 0 4px; padding: 0 10px; font-size: .76rem; color: var(--text-faint); }

dialog {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 20px;
  max-width: 340px;
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog h2 { margin: 0 0 12px; font-size: 1.05rem; }
dialog dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; font-size: .88rem; }
dialog dt { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); }
dialog dd { margin: 0; color: var(--text-soft); }
dialog button { padding: 7px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-alt); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(72px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: .85rem;
  box-shadow: var(--shadow);
}

.toast.error { background: var(--danger); color: #fff; }

.toast-action {
  margin-left: 6px;
  padding: 2px 8px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- écrans larges ---------- */

@media (min-width: 760px) {
  .app {
    grid-template-areas: "top top" "nav view";
    grid-template-columns: 210px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }

  .nav {
    position: sticky;
    top: 57px;
    align-self: start;
    flex-direction: column;
    gap: 2px;
    padding: 12px 8px;
    border-top: none;
    border-right: 1px solid var(--border);
    background: transparent;
    height: calc(100vh - 57px);
  }

  .nav a {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: .9rem;
  }

  .nav a[data-group="secondary"] { display: flex; }
  .nav a[data-group="more"] { display: none; }
  .nav a[data-starts-group] {
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
  }
  .nav a[aria-current="page"] { background: var(--accent-soft); }
  .nav .badge { position: static; transform: none; margin-left: auto; }
  .view { padding: 22px 24px 40px; margin: 0; }
  .toast { bottom: 24px; }
}


/* ---------- arbre de clarification ---------- */

.step {
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.step-q {
  margin: 0 0 6px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-soft);
}

.branch {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.inline-label { font-size: .82rem; color: var(--text-soft); }

.small-input {
  width: auto;
  min-width: 0;
  flex: 0 1 auto;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 1rem;
}

.small-input[type="text"] { flex: 0 1 240px; }

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.field-row > * { flex: 1 1 140px; }

.section-note {
  margin-left: 8px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-faint);
}

.tag.time {
  background: var(--accent);
  color: #fff;
  font-variant-numeric: tabular-nums;
}

@media (prefers-color-scheme: dark) { .tag.time { color: #10201a; } }

.row-link {
  width: 100%;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  text-align: left;
}

.row-link:hover { background: var(--surface-alt); }
.row-link .nav-icon { color: var(--text-soft); }

.quick-add.flush { padding-left: 0; padding-right: 0; }

/* ---------- revue hebdomadaire ---------- */

.review-phase {
  margin: 26px 0 10px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
}

.review-phase:first-of-type { margin-top: 18px; }

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .2s ease;
}

.progress-count {
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
}

.trigger-group { margin-top: 12px; }

.trigger-title {
  margin: 0 0 6px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.triggers { display: flex; flex-wrap: wrap; gap: 5px; }

.trigger {
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: .78rem;
  text-align: left;
}

.trigger:hover { border-color: var(--accent); color: var(--accent); }

.trigger[aria-pressed="true"] {
  background: var(--surface-alt);
  color: var(--text-faint);
  border-color: transparent;
  text-decoration: line-through;
}

.review-projects {
  list-style: none;
  margin: 8px 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.review-projects li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .9rem;
}

.review-projects li.reviewed { color: var(--text-faint); }
.review-projects li.reviewed > span { text-decoration: line-through; }

/* ---------- les quatre critères de choix ---------- */

.filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.filter-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.filter-label {
  flex: none;
  width: 68px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--text-faint);
  text-align: right;
}

.filter-row .chips { margin-bottom: 0; }

.filter-count {
  margin: 0 0 12px 78px;
  font-size: .82rem;
  color: var(--text-soft);
}

.criteria {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.criteria .inline-label {
  flex: none;
  width: 58px;
  font-weight: 600;
  color: var(--text-faint);
}

.criteria .btn { padding: 4px 10px; font-size: .78rem; }

.tag.energy { background: var(--warn-soft); color: var(--warn); }

.star {
  margin-right: 5px;
  font-size: .9em;
}

.card.is-starred { border-left: 3px solid var(--warn); }

/* ---------- règle des deux minutes ---------- */

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

.countdown {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.countdown.over {
  background: var(--warn-soft);
  color: var(--warn);
  font-size: .82rem;
  font-weight: 600;
}

@media (prefers-color-scheme: dark) { .countdown { color: #10201a; } }

@media (max-width: 520px) {
  .filter-row { flex-direction: column; gap: 3px; }
  .filter-label { width: auto; text-align: left; }
  .filter-count { margin-left: 0; }
}

/* ---------- questions refermées ---------- */

.btn.ghost {
  border-color: transparent;
  color: var(--text-faint);
}

.btn.ghost:hover {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
}

.step-folded {
  display: flex;
  width: 100%;
  align-items: baseline;
  gap: 8px;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: .82rem;
  color: var(--text-faint);
  text-align: left;
}

.step-folded:hover { color: var(--text-soft); }

.step-folded .answer {
  font-weight: 700;
  color: var(--text-soft);
}

.step-folded::after {
  margin-left: auto;
  opacity: 0;
}

.step-folded.answered::after { content: "↺"; }
.step-folded.upcoming::after { content: "↓"; }
.step-folded.upcoming { opacity: .55; }

.step-folded:hover::after, .step-folded:focus-visible::after { opacity: .6; }

/* La question du moment est la seule à respirer. */
.step-current { padding-bottom: 2px; }
.step-current .step-q { color: var(--text); }

/* ---------- gestion des contextes ---------- */

.context-row {
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.context-name {
  flex: 1 1 160px;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-weight: 600;
}

.context-name:hover { border-color: var(--border); }
.context-name:focus { border-color: var(--accent); background: var(--bg); outline: none; }

.context-row .row-meta { margin-top: 0; }
.context-row .actions { margin-left: auto; }

.context-row .icon-btn {
  width: 30px;
  height: 30px;
  font-size: .9rem;
}

.context-row .icon-btn:disabled {
  opacity: .35;
  cursor: default;
  background: var(--surface);
}

/* ---------- rendez-vous venus de l'agenda relié ---------- */

.card.is-external {
  background: var(--surface-alt);
  border-style: dashed;
}

.card.is-external .row { padding-left: 42px; }
.card.is-external .row-main { cursor: default; }
.card.is-external .row-title { color: var(--text-soft); }

.tag[data-hue] { font-weight: 600; }

/* ---------- palette des contextes et des priorités ----------
   Chaque teinte ne fait que poser deux variables ; tout ce qui la porte les
   consomme. Le thème sombre a ses propres valeurs, sinon la moitié de la
   palette deviendrait illisible. */

[data-hue="neutre"]    { --hue-bg: #f2f1ec; --hue-fg: #6e6b62; }
[data-hue="vert"]      { --hue-bg: #e6f0ea; --hue-fg: #2f6f4f; }
[data-hue="turquoise"] { --hue-bg: #dff0ef; --hue-fg: #1f6b6b; }
[data-hue="bleu"]      { --hue-bg: #e4ecf7; --hue-fg: #2f5b8f; }
[data-hue="violet"]    { --hue-bg: #ece7f5; --hue-fg: #5c4b8f; }
[data-hue="rose"]      { --hue-bg: #f8e7ee; --hue-fg: #8f3f63; }
[data-hue="rouge"]     { --hue-bg: #f8e8e4; --hue-fg: #a8402f; }
[data-hue="ambre"]     { --hue-bg: #f7f0dc; --hue-fg: #8a6a1f; }

@media (prefers-color-scheme: dark) {
  [data-hue="neutre"]    { --hue-bg: #262a2e; --hue-fg: #a3a69f; }
  [data-hue="vert"]      { --hue-bg: #23342b; --hue-fg: #7fc0a0; }
  [data-hue="turquoise"] { --hue-bg: #1e3333; --hue-fg: #6fbdbb; }
  [data-hue="bleu"]      { --hue-bg: #1f2c3d; --hue-fg: #8db4e2; }
  [data-hue="violet"]    { --hue-bg: #2a2438; --hue-fg: #b3a0e0; }
  [data-hue="rose"]      { --hue-bg: #3a2430; --hue-fg: #e0a0bd; }
  [data-hue="rouge"]     { --hue-bg: #3a2622; --hue-fg: #e08d7c; }
  [data-hue="ambre"]     { --hue-bg: #33301f; --hue-fg: #d6b45f; }
}

.tag[data-hue] { background: var(--hue-bg); color: var(--hue-fg); }
.card.is-starred[data-hue] { border-left-color: var(--hue-fg); }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--hue-fg, var(--text-faint));
  vertical-align: baseline;
}

.btn[data-hue] .dot { margin-right: 5px; }
.section-title .dot { margin-right: 8px; }
.star { color: var(--hue-fg, var(--warn)); }

/* ---------- choix de la couleur ---------- */

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--hue-bg);
  box-shadow: inset 0 0 0 2px var(--hue-fg);
}

.swatch:hover { border-color: var(--border); }

.swatch[aria-pressed="true"] {
  border-color: var(--hue-fg);
  background: var(--hue-fg);
}

.swatch-row {
  padding: 0 12px 10px 30px;
}

.context-row .dot { margin-right: 0; }


/* ---------- au doigt ----------
   Les cibles de 20 à 30 px passent à la souris, pas au pouce. On agrandit ce
   qui peut l'être, et on étend la zone sensible des pastilles par un
   pseudo-élément : la cible grandit, le dessin ne bouge pas. */

@media (pointer: coarse) {
  .btn { padding: 9px 14px; }
  .icon-btn { width: 40px; height: 40px; }
  .context-row .icon-btn { width: 38px; height: 38px; }
  .quick-add input, .quick-add .btn { padding: 10px 12px; }
  .trigger { padding: 8px 12px; }

  .check { position: relative; }
  .check::after {
    content: "";
    position: absolute;
    /* Vers le haut, le bas et la gauche, il y a la marge de la carte ; à
       droite, on s'arrête avant de mordre sur la zone qui déplie l'élément. */
    inset: -12px -4px -12px -12px;
  }

  .review-step .num { width: 30px; height: 30px; position: relative; }
  .review-step button.num::after { content: ""; position: absolute; inset: -7px; }

  /* On clique une question repliée pour y revenir ou la sauter : 19 px de haut
     ne suffisent pas au pouce. */
  .step-folded { padding: 8px 0; }
  .capture button { width: 44px; }

  .swatches { gap: 10px; }
  .swatch { width: 30px; height: 30px; position: relative; }
  .swatch::after { content: ""; position: absolute; inset: -6px; }
}

@media (max-width: 520px) {
  /* Repliées sur une seconde ligne, les commandes se lisent mieux à gauche,
     sous le nom, qu'alignées au bord droit. */
  .context-row .actions { margin-left: 0; }
}
