/* todo : la liste de tâches de Noak, même plan gris froid, même bleu et même police que noakmon */

@font-face {
  font-family: "Schibsted Grotesk";
  src: url(/schibsted.woff2) format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Une colonne de 36 rem au plus : la date du jour, le champ d'ajout, les tâches rangées par échéance,
   puis les tâches faites repliées en bas. */
:root {
  color-scheme: light;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --hover: #f0f2f5;
  --line: #e3e6ea;
  --line-2: #d0d5db;
  --check: #8b939f;
  --text: #10151c;
  --text-2: #4a5462;
  --muted: #626c7a;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: rgb(42 120 214 / .1);
  --accent-soft: rgb(42 120 214 / .2);
  --btn: #2368bd;
  --btn-hover: #1c5cab;
  --on-btn: #ffffff;
  --crit-ink: #b42323;
  --crit-wash: rgb(208 59 59 / .09);
  --toast: #10151c;
  --on-toast: #eef0f3;
  --toast-action: #79b0f0;
  --shadow: 0 18px 40px -12px rgb(16 21 28 / .24), 0 3px 10px -2px rgb(16 21 28 / .1);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1013;
    --panel: #15181d;
    --hover: #1c2027;
    --line: #242930;
    --line-2: #343a43;
    --check: #6b7480;
    --text: #eef0f3;
    --text-2: #b4bbc5;
    --muted: #8b939f;
    --accent: #3987e5;
    --accent-ink: #79b0f0;
    --accent-wash: rgb(57 135 229 / .14);
    --accent-soft: rgb(57 135 229 / .28);
    --crit-ink: #f07070;
    --crit-wash: rgb(208 59 59 / .16);
    --toast: #eef0f3;
    --on-toast: #10151c;
    --toast-action: #1c5cab;
    --shadow: 0 0 0 1px #3a414b;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap {
  max-width: 36rem;
  margin: 0 auto;
  padding-top: calc(28px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 22px;
}
.stack { display: grid; gap: 22px; }

/* en-tête */
.top { display: grid; gap: 2px; padding: 0 2px; }
.top h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.015em;
}
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.date-line { margin: 0; color: var(--text-2); font-size: 15px; }

/* connexion */
.login { display: grid; gap: 10px; padding: 20px 18px 18px; }
.login-head { display: grid; gap: 4px; margin-bottom: 6px; }
.login h2 { margin: 0; font-size: 18px; font-weight: 600; }
.login-head p { margin: 0; color: var(--text-2); font-size: 15px; }
.login-lab { font-size: 14px; font-weight: 500; color: var(--text-2); }
.login .btn { justify-self: start; height: 44px; padding: 0 18px; }
.login-err { margin: 0; color: var(--crit-ink); font-size: 15px; }
.login-err:empty { margin-top: -10px; }   /* reste dans la page pour être annoncé, sans laisser de vide */

/* champ d'ajout */
.add {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.add:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.add-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; }
#new {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 17px;
  outline: none;
}
#new::placeholder { color: var(--muted); }
.btn {
  flex: none;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--btn);
  color: var(--on-btn);
  font-size: 15px;
  font-weight: 600;
  transition: background-color .15s var(--ease), opacity .15s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--btn-hover); }
.btn:disabled { opacity: .4; }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; }

/* choix de l'échéance */
.when { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.add .when { padding: 8px 10px 10px; border-top: 1px solid var(--line); }
.chip {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.chip:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.chip[aria-pressed="true"], .chip[aria-pressed="true"]:hover:not(:disabled) {
  background: var(--accent-wash);
  border-color: var(--accent-soft);
  color: var(--accent-ink);
}
.pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
}
.pick.on { background: var(--accent-wash); border-color: var(--accent-soft); color: var(--accent-ink); }
.pick input {
  min-width: 7.5rem;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 16px;
}
.pick input:focus { outline: none; }
.pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.clear-date {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
}
.clear-date:hover { background: var(--hover); color: var(--text); }

/* note d'état (connexion perdue) */
.note {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 10px 8px 10px 14px;
  border-radius: 12px;
  background: var(--crit-wash);
  font-size: 15px;
}

/* listes */
.groups { display: grid; gap: 22px; }
.group { display: grid; gap: 8px; }
.group h2, .done-toggle {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}
.n { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.g-late h2, .g-late h2 .n { color: var(--crit-ink); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.tasks { list-style: none; margin: 0; padding: 0; }
.task {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  padding-right: 14px;
  transition: background-color .15s var(--ease);
}
.task + .task { border-top: 1px solid var(--line); }
@media (hover: hover) { .task:not(.editing):hover { background: var(--hover); } }
.hit { align-self: stretch; display: grid; place-items: center; cursor: pointer; }
.check {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--check);
  border-radius: 50%;
  background: var(--panel);
  cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.check:hover:not(:disabled) { border-color: var(--accent); }
.check:checked {
  border-color: var(--accent);
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.5 12.5l3.6 3.6 7.4-8.1' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.check:disabled { cursor: default; }
.txt {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 13px 0;
  border: 0;
  background: none;
  text-align: left;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  transition: color .15s var(--ease);
}
.task.is-done .txt { color: var(--muted); text-decoration: line-through; }
.due { padding-left: 12px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.g-late .due { color: var(--crit-ink); font-weight: 500; }

/* modification d'une tâche */
.task.editing { display: block; padding: 12px 12px 12px 14px; }
.edit { display: grid; gap: 10px; }
.field {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--panel);
  font-size: 16px;
}
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.edit-actions .grow { flex: 1; }
.link {
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
}
.link:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.link.danger, .link.danger:hover { color: var(--crit-ink); }
.link:disabled { opacity: .45; }

/* tâches faites */
.done { display: grid; gap: 8px; }
.done-toggle {
  justify-self: start;
  align-items: center;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: none;
  padding: 0 10px 0 2px;
}
.done-toggle:hover { color: var(--text); }
.done-toggle svg { transition: transform .15s var(--ease); }
.done-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.done-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 8px 8px 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--text-2);
}
.done-foot .acts { display: flex; gap: 4px; margin-left: auto; }

/* états vides */
.empty { display: grid; gap: 4px; padding: 20px 18px; }
.empty p { margin: 0; }
.empty .e1 { font-weight: 600; }
.empty .e2 { color: var(--text-2); font-size: 15px; max-width: 34em; }

.foot { display: flex; justify-content: center; padding-top: 8px; }
.foot .link { color: var(--muted); }

/* message en bas d'écran */
.toast {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding-top: 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  pointer-events: none;
}
.toast-in {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 34rem;
  min-height: 48px;
  padding: 6px 6px 6px 16px;
  border-radius: 12px;
  background: var(--toast);
  color: var(--on-toast);
  box-shadow: var(--shadow);
  font-size: 15px;
}
.toast-in span { flex: 1; }
.toast-in button {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--toast-action);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
