/* -------------------------------------------------------------------------- */
/* Cadence — feuille de style unique. Papier crème, encre forêt.               */
/* -------------------------------------------------------------------------- */

:root {
  color-scheme: light;
  --font-sans: "Avenir Next", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", "Courier New", monospace;

  --bg: #f2eee4;
  --bg-deep: #e9e2d3;
  --paper: #fcfaf4;
  --paper-soft: #f7f2e8;
  --field: #fffdf8;
  --ink: #1b211b;
  --ink-soft: #5b6459;
  --ink-faint: #8a9185;
  --line: rgba(30, 40, 30, 0.11);
  --line-strong: rgba(30, 40, 30, 0.2);
  --forest: #244a38;
  --forest-deep: #152c21;
  --forest-soft: #dfe9da;
  --forest-faint: #edf3e9;
  --on-forest: #f7f2e4;
  --accent: #2e5b44;
  --accent-strong: #234a36;
  --accent-soft: #e3ecdf;
  --danger: #a34136;
  --danger-soft: #f7e6e2;
  --amber: #9a6a2f;
  --amber-soft: #f7ecd6;
  --sky: #3f6e8c;
  --focus-ring: rgba(46, 91, 68, 0.2);
  --topbar: rgba(242, 238, 228, 0.86);
  --shadow-sm: 0 1px 0 rgba(24, 32, 24, 0.03), 0 5px 16px rgba(24, 32, 24, 0.045);
  --shadow-md: 0 16px 44px rgba(24, 32, 24, 0.12);
  --shadow-lg: 0 36px 110px rgba(16, 26, 18, 0.28);
  --radius: 18px;
  --hour-height: 58px;
  --gutter: 62px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --tag-forest: #2f5b43;
  --tag-sage: #64825f;
  --tag-sky: #4d7894;
  --tag-butter: #a87d34;
  --tag-blush: #a95e66;
  --tag-lilac: #70628f;
  --tag-peach: #a87148;
  --tag-clay: #8c6654;

  /* Les tâches ont leur propre identité visuelle : bleu, pour les distinguer
     des événements (qui gardent les couleurs de leurs étiquettes). */
  --task-bg: #e6f0f7;
  --task-bg-strong: #d9e9f3;
  --task-ink: #233744;
  --task-line: rgba(61, 96, 120, 0.22);
  --task-accent: #3f6e8c;
  --task-meta: #5d7687;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141a15;
  --bg-deep: #101510;
  --paper: #1d241e;
  --paper-soft: #222a23;
  --field: #1a211b;
  --ink: #f0ede2;
  --ink-soft: #b1b9ac;
  --ink-faint: #7f8a7c;
  --line: rgba(240, 237, 226, 0.11);
  --line-strong: rgba(240, 237, 226, 0.21);
  --forest: #9ec7a8;
  --forest-deep: #0e1a12;
  --forest-soft: #26372b;
  --forest-faint: #202e24;
  --on-forest: #122016;
  --accent: #a5cbb0;
  --accent-strong: #c4e0ca;
  --accent-soft: #26372b;
  --danger: #ff9b90;
  --danger-soft: #3a2421;
  --amber: #e2b672;
  --amber-soft: #3a3122;
  --sky: #9cc4dd;
  --focus-ring: rgba(165, 203, 176, 0.2);
  --topbar: rgba(20, 26, 21, 0.86);
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.2), 0 6px 18px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 16px 44px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 36px 110px rgba(0, 0, 0, 0.55);
  --tag-forest: #9ec7a8;
  --tag-sage: #b6cfa9;
  --tag-sky: #a7c9df;
  --tag-butter: #e5c47d;
  --tag-blush: #e3a7ae;
  --tag-lilac: #c1b0e0;
  --tag-peach: #e0ad83;
  --tag-clay: #c8a58f;

  --task-bg: #24343f;
  --task-bg-strong: #2b3d49;
  --task-ink: #dfeaf3;
  --task-line: rgba(167, 201, 223, 0.17);
  --task-accent: #9cc4dd;
  --task-meta: #a7bccb;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 14.5px;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 6% -4%, rgba(47, 91, 67, 0.07), transparent 28rem),
    radial-gradient(circle at 96% 102%, rgba(163, 111, 56, 0.05), transparent 30rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  z-index: 1000;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: rgba(47, 91, 67, 0.2);
}

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

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 19px;
  height: 19px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon.tiny {
  width: 14px;
  height: 14px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.eyebrow.light {
  color: rgba(247, 242, 228, 0.62);
}

/* -------------------------------------------------------------------------- */
/* Boutons, champs, petits éléments                                           */
/* -------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  background: var(--forest);
  color: var(--on-forest);
  border-color: var(--forest);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset, 0 4px 14px rgba(24, 42, 30, 0.16);
}

:root[data-theme="dark"] .button.primary {
  color: #102015;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.soft {
  background: var(--forest-soft);
  color: var(--forest);
  border-color: transparent;
}

.button.soft:hover {
  background: var(--accent-soft);
}

.button.ghost {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

.button.ghost:hover {
  border-color: var(--line-strong);
  background: var(--paper-soft);
}

.button.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.button.tiny {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 11.5px;
}

.button.full {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.icon-button:hover {
  background: rgba(30, 40, 30, 0.06);
  color: var(--ink);
}

.icon-button.tiny {
  width: 28px;
  height: 28px;
}

:root[data-theme="dark"] .icon-button:hover {
  background: rgba(240, 237, 226, 0.07);
}

.text-button {
  border: 0;
  background: none;
  padding: 6px 0;
  color: var(--ink-soft);
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover {
  color: var(--ink);
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--forest-soft);
  color: var(--forest);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

:root[data-theme="dark"] .badge {
  color: var(--forest);
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: rgba(30, 40, 30, 0.055);
  padding: 1px 4px;
  border-radius: 4px;
}

:root[data-theme="dark"] code {
  background: rgba(240, 237, 226, 0.08);
}

/* -------------------------------------------------------------------------- */
/* Démarrage                                                                  */
/* -------------------------------------------------------------------------- */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.45s var(--ease), visibility 0.45s;
}

.boot-screen.is-leaving {
  opacity: 0;
  visibility: hidden;
}

.boot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.boot-logo {
  width: 58px;
  height: 58px;
  color: var(--forest);
  animation: breathe 2.8s ease-in-out infinite;
}

.boot-word {
  font-family: var(--font-serif);
  font-size: 27px;
  letter-spacing: -0.03em;
}

.boot-status {
  font-size: 11.5px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

@keyframes breathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
    opacity: 0.9;
  }
  50% {
    transform: translateY(-3px) scale(1.02);
    opacity: 1;
  }
}

/* -------------------------------------------------------------------------- */
/* Connexion / installation                                                   */
/* -------------------------------------------------------------------------- */

.auth-screen {
  display: grid;
  grid-template-columns: minmax(380px, 46%) 1fr;
  min-height: 100dvh;
  background: var(--bg);
}

.auth-toolbox {
  position: fixed;
  z-index: 90;
  top: 18px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--forest);
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.auth-toolbox:hover,
.auth-toolbox:focus-visible {
  background: var(--forest-soft);
  border-color: var(--forest);
}

.auth-art {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 40px 46px 38px;
  background:
    radial-gradient(circle at 18% 8%, rgba(199, 221, 177, 0.14), transparent 22rem),
    radial-gradient(circle at 88% 78%, rgba(199, 221, 177, 0.08), transparent 24rem),
    var(--forest-deep);
  color: var(--on-forest);
}

.auth-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(247, 242, 228, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(247, 242, 228, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 42%, #000, transparent 78%);
  pointer-events: none;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-serif);
  font-size: 23px;
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
}

.auth-brand .brand-mark {
  width: 34px;
  height: 34px;
  color: var(--on-forest);
}

.auth-pitch {
  position: relative;
  z-index: 1;
  margin-top: auto;
  max-width: 480px;
}

.auth-pitch .eyebrow {
  margin-bottom: 18px;
}

.auth-pitch h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(44px, 5.4vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.auth-pitch h1 em {
  color: #c7ddb1;
  font-weight: 400;
}

.auth-pitch p:not(.eyebrow) {
  margin-top: 22px;
  max-width: 400px;
  color: rgba(247, 242, 228, 0.68);
  font-size: 14.5px;
  line-height: 1.65;
}

.auth-points {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 11px;
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid rgba(247, 242, 228, 0.14);
}

.auth-points li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: rgba(247, 242, 228, 0.82);
}

.auth-points .icon {
  width: 17px;
  height: 17px;
  color: #c7ddb1;
}

.auth-art-foot {
  position: relative;
  z-index: 1;
  margin-top: 28px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: rgba(247, 242, 228, 0.42);
}

.auth-grid-art {
  position: absolute;
  right: -42px;
  top: 48px;
  width: 210px;
  height: 158px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  opacity: 0.16;
  transform: rotate(8deg);
}

.auth-grid-art span {
  border: 1px solid rgba(247, 242, 228, 0.5);
  border-radius: 8px;
}

.auth-grid-art span:nth-child(6),
.auth-grid-art span:nth-child(7) {
  background: rgba(199, 221, 177, 0.35);
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 42px 32px;
  background:
    radial-gradient(circle at 70% 12%, rgba(47, 91, 67, 0.05), transparent 24rem),
    var(--bg);
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  animation: rise 0.55s var(--ease) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-card .eyebrow {
  margin-bottom: 12px;
}

.auth-card h2 {
  font-family: var(--font-serif);
  font-size: clamp(34px, 4vw, 44px);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.auth-intro {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.auth-form .hint {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--ink-faint);
  line-height: 1.5;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--ink-faint);
}

.password-toggle:hover {
  color: var(--ink);
  background: rgba(30, 40, 30, 0.06);
}

.primary-button {
  width: 100%;
  min-height: 47px;
  margin-top: 2px;
  border: 0;
  border-radius: 11px;
  background: var(--forest);
  color: var(--on-forest);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset, 0 8px 22px rgba(24, 42, 30, 0.16);
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}

:root[data-theme="dark"] .primary-button {
  color: #102015;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button.is-busy {
  pointer-events: none;
  opacity: 0.7;
}

.code-input {
  font-family: var(--font-mono);
  font-size: 20px !important;
  letter-spacing: 0.18em;
  text-align: center;
}

.form-error {
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.45;
}

.security-footnote {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--ink-faint);
  line-height: 1.5;
}

.security-footnote .icon {
  width: 15px;
  height: 15px;
}

.auth-help {
  margin-top: 14px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-faint);
}

.auth-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-family: var(--font-serif);
  font-size: 21px;
}

.auth-mobile-brand .brand-mark {
  width: 32px;
  height: 32px;
  color: var(--forest);
}

.strength {
  display: flex;
  gap: 4px;
  margin-top: 9px;
}

.strength span {
  height: 3px;
  flex: 1;
  border-radius: 3px;
  background: var(--line);
  transition: background 0.2s var(--ease);
}

.strength[data-score="1"] span:nth-child(1) {
  background: var(--danger);
}

.strength[data-score="2"] span:nth-child(-n + 2) {
  background: var(--amber);
}

.strength[data-score="3"] span:nth-child(-n + 3) {
  background: #7e9b62;
}

.strength[data-score="4"] span {
  background: var(--accent);
}

/* -------------------------------------------------------------------------- */
/* Coquille application                                                       */
/* -------------------------------------------------------------------------- */

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  animation: fade 0.4s var(--ease);
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.topbar {
  position: relative;
  z-index: 60;
  flex: none;
  display: flex;
  align-items: center;
  gap: 20px;
  height: calc(70px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 22px 0;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(16px) saturate(1.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
}

.brand-mark {
  width: 33px;
  height: 33px;
  color: var(--forest);
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 21px;
  letter-spacing: -0.035em;
}

.period-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.nav-buttons {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.nav-buttons .icon-button {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.today-button {
  height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
}

.today-button:hover {
  background: var(--paper-soft);
  color: var(--ink);
}

.period-heading {
  min-width: 0;
}

.period-heading h1 {
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.period-heading p {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-switch {
  display: flex;
  gap: 2px;
  margin-left: auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.view-switch button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.view-switch button:hover {
  color: var(--ink);
}

.view-switch button.active {
  background: var(--forest);
  color: var(--on-forest);
  box-shadow: 0 2px 8px rgba(24, 42, 30, 0.15);
}

:root[data-theme="dark"] .view-switch button.active {
  color: #102015;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 5px;
}

.app-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

.app-switch a {
  display: grid;
  place-items: center;
  width: 31px;
  height: 28px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.app-switch a:hover,
.app-switch a:focus-visible {
  background: var(--forest-soft);
  color: var(--forest);
  outline: none;
}

.app-switch a.is-active {
  background: var(--forest);
  color: var(--on-forest);
  box-shadow: 0 2px 8px rgba(24, 42, 30, 0.15);
}

:root[data-theme="dark"] .app-switch a.is-active {
  color: #102015;
}

.app-switch .icon {
  width: 15px;
  height: 15px;
}

.toolbox-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.toolbox-link .icon {
  width: 13px;
  height: 13px;
  color: var(--forest);
}

.toolbox-link:hover,
.toolbox-link:focus-visible {
  border-color: var(--forest);
  color: var(--forest);
  background: var(--forest-soft);
}

.toolbox-label-short {
  display: none;
}

@media (max-width: 1080px) {
  .toolbox-link {
    padding: 0 9px;
  }
  .toolbox-label {
    display: none;
  }
  .toolbox-label-short {
    display: inline;
  }
}

.new-event-button {
  height: 36px;
  margin-left: 3px;
}

.new-event-button .icon {
  width: 16px;
  height: 16px;
}

.search-pop {
  position: absolute;
  z-index: 80;
  top: 62px;
  right: 98px;
  width: min(460px, calc(100vw - 24px));
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-md);
  animation: pop 0.18s var(--ease);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--field);
}

.search-field .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-faint);
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 0;
  background: transparent;
  font-size: 13px;
  outline: none;
}

.search-results {
  max-height: 380px;
  overflow-y: auto;
  margin-top: 7px;
}

.search-group-label {
  padding: 8px 10px 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.search-result:hover,
.search-result.is-active {
  background: var(--paper-soft);
}

.search-result .icon {
  width: 15px;
  height: 15px;
  color: var(--ink-faint);
}

.search-result-body {
  min-width: 0;
  flex: 1;
}

.search-result-title {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--ink-faint);
}

.search-empty {
  padding: 22px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
}

.app-menu {
  position: absolute;
  z-index: 80;
  top: 62px;
  right: 18px;
  width: 250px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  box-shadow: var(--shadow-md);
  animation: pop 0.18s var(--ease);
}

.app-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  text-align: left;
}

.app-menu button:hover {
  background: var(--paper-soft);
}

.app-menu button .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-faint);
}

.app-menu button.danger {
  color: var(--danger);
}

.app-menu button.danger .icon {
  color: currentColor;
}

.menu-label {
  padding: 7px 10px 5px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.menu-separator {
  height: 1px;
  margin: 6px 4px;
  background: var(--line);
}

.offline-banner {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 16px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11.5px;
  border-bottom: 1px solid rgba(154, 106, 47, 0.15);
}

.offline-banner .icon {
  width: 15px;
  height: 15px;
}

/* -------------------------------------------------------------------------- */
/* Espace de travail                                                          */
/* -------------------------------------------------------------------------- */

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 352px minmax(0, 1fr);
}

.task-rail {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 16px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(252, 250, 244, 0.42), rgba(242, 238, 228, 0.15));
  overflow: hidden;
}

:root[data-theme="dark"] .task-rail {
  background: linear-gradient(180deg, rgba(29, 36, 30, 0.5), rgba(20, 26, 21, 0.1));
}

.rail-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 5px;
}

.rail-head h2 {
  margin-top: 5px;
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1;
}

.rail-head .badge {
  margin-top: 3px;
}

.quick-task {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 15px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.quick-task:focus-within {
  border-color: rgba(46, 91, 68, 0.4);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.quick-task input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  outline: none;
}

.quick-task input::placeholder {
  color: var(--ink-faint);
}

.quick-add {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--forest);
  color: var(--on-forest);
  transition: background 0.16s var(--ease);
}

:root[data-theme="dark"] .quick-add {
  color: #102015;
}

.quick-add:hover {
  background: var(--accent-strong);
}

.quick-add .icon {
  width: 16px;
  height: 16px;
}

.quick-hint {
  flex: none;
  margin: 7px 4px 0;
  font-size: 9.5px;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}

.quick-hint code {
  font-size: 9px;
  padding: 0 3px;
}

.drag-hint {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 5px 4px 0;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--task-accent);
}

.drag-hint .icon {
  width: 11px;
  height: 11px;
}

.rail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 10px -4px 0;
  padding: 0 4px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.rail-scroll::-webkit-scrollbar,
.cal-scroll::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.rail-scroll::-webkit-scrollbar-thumb,
.cal-scroll::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: var(--line-strong);
}

.task-section {
  margin-top: 15px;
}

.task-section:first-child {
  margin-top: 4px;
}

.task-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  margin-bottom: 7px;
}

.task-section-head span:first-child {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}

.task-section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.task-section-head .count {
  font-size: 9.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.task-card.is-selected {
  outline: 2px solid var(--forest);
  outline-offset: 2px;
}

.task-card {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  margin-bottom: 6px;
  padding: 9px 30px 9px 8px;
  border: 1px solid var(--task-line);
  border-left: 3px solid var(--task-accent);
  border-radius: 11px;
  background: linear-gradient(160deg, var(--task-bg) 0%, var(--task-bg-strong) 100%);
  color: var(--task-ink);
  box-shadow: 0 1px 1px rgba(24, 32, 24, 0.025);
  cursor: pointer;
  touch-action: pan-y;
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.task-card:hover {
  border-color: var(--task-accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(63, 110, 140, 0.14);
}

.task-card:focus-visible {
  outline: 2px solid var(--task-accent);
  outline-offset: 2px;
}

.task-card.is-dragging {
  opacity: 0.35;
}

.task-card.is-scheduled {
  background: linear-gradient(160deg, var(--task-bg) 0%, var(--task-bg-strong) 100%);
  border-color: var(--task-line);
  opacity: 0.72;
}

.task-card.is-overdue {
  border-left-color: var(--danger);
}

.task-card.is-done {
  background: linear-gradient(160deg, var(--task-bg) 0%, var(--task-bg-strong) 100%);
  border-color: var(--task-line);
  border-left-color: var(--task-accent);
  opacity: 0.62;
  color: var(--ink-soft);
}

.task-card.is-done .task-title {
  text-decoration: line-through;
  color: var(--ink-faint);
}

.task-card.is-done .task-meta {
  color: var(--ink-faint);
}

.task-check {
  position: relative;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  padding: 0;
  border: 1.5px solid var(--task-accent);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.task-check:hover {
  border-color: var(--task-accent);
  background: var(--task-bg);
}

.task-check .icon {
  width: 11px;
  height: 11px;
  margin: auto;
  color: #f7fbfd;
  opacity: 0;
  stroke-width: 2.6;
}

.task-card.is-done .task-check {
  border-color: var(--task-accent);
  background: var(--task-accent);
}

:root[data-theme="dark"] .task-check {
  background: rgba(0, 0, 0, 0.14);
}

:root[data-theme="dark"] .task-grip:hover {
  background: rgba(156, 196, 221, 0.14);
}

.task-card.is-done .task-check .icon {
  opacity: 1;
}

.task-body {
  min-width: 0;
}

.task-title {
  font-size: 12.8px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
  color: var(--task-ink);
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 7px;
  margin-top: 5px;
  font-size: 9.5px;
  color: var(--task-meta);
}

.task-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.task-meta .icon {
  width: 11px;
  height: 11px;
}

.task-meta .overdue {
  color: var(--danger);
  font-weight: 600;
}

.priority-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.priority-dot.high {
  background: var(--amber);
}

.priority-dot.urgent {
  background: var(--danger);
}

.priority-dot.low {
  background: var(--ink-faint);
  opacity: 0.5;
}

.task-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tag-color, var(--accent));
}

.task-source {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent);
  font-weight: 600;
}

.task-source .icon {
  width: 10px;
  height: 10px;
}

.task-grip {
  position: absolute;
  top: 7px;
  right: 5px;
  left: auto;
  transform: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--task-accent);
  opacity: 0.6;
  cursor: grab;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease);
  touch-action: none;
}

.task-grip:hover {
  background: rgba(63, 110, 140, 0.12);
}

.task-grip .icon {
  width: 13px;
  height: 13px;
}

.task-card:hover .task-grip,
.task-card:focus-within .task-grip {
  opacity: 1;
}

.task-grip:active {
  cursor: grabbing;
}

.rail-empty {
  padding: 30px 18px;
  text-align: center;
  color: var(--ink-faint);
}

.rail-empty .icon {
  width: 26px;
  height: 26px;
  margin: 0 auto 10px;
  opacity: 0.55;
}

.rail-empty p {
  font-size: 11.5px;
  line-height: 1.6;
}

.rail-empty strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
}

details.task-group {
  margin-top: 4px;
}

details.task-group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 4px;
  list-style: none;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

details.task-group > summary::-webkit-details-marker {
  display: none;
}

details.task-group > summary::before {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s var(--ease);
}

details.task-group[open] > summary::before {
  transform: rotate(45deg) translateY(-2px);
}

details.task-group > summary .rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.rail-actions {
  flex: none;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.rail-actions > .button {
  height: 38px;
}

.anonykeep-card {
  position: relative;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--forest-faint), var(--paper));
  overflow: hidden;
}

.anonykeep-card::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -22px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(47, 91, 67, 0.06);
}

.anonykeep-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-mark {
  width: 27px;
  height: 27px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--forest);
  color: var(--on-forest);
}

.mini-mark svg {
  width: 27px;
  height: 27px;
}

.anonykeep-head div {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.anonykeep-head strong {
  font-size: 11.5px;
  font-weight: 650;
}

.anonykeep-head span {
  font-size: 9px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.anonykeep-card p {
  margin-top: 7px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.anonykeep-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
}

.ak-auto {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.ak-auto input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--accent);
}

.ak-auto:has(input:checked) {
  color: var(--accent);
}

.ak-auto-status {
  margin-top: 5px;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.4;
}

.ak-auto-status.is-locked {
  color: var(--amber);
}

.ai-assistant {
  flex: none;
  margin: 10px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(155deg, rgba(63, 110, 140, 0.06), rgba(46, 91, 68, 0.035));
}

.ai-assistant-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ai-badge {
  flex: none;
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--forest);
  color: var(--on-forest);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

:root[data-theme="dark"] .ai-badge {
  color: #102015;
}

.ai-title {
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.ai-privacy {
  margin-left: auto;
  padding: 2px 5px;
  border: 1px solid var(--task-line);
  border-radius: 99px;
  color: var(--task-accent);
  font-size: 8px;
  font-weight: 650;
  white-space: nowrap;
  cursor: help;
}

.ai-assistant-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

.ai-assistant-row input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font-size: 11px;
  outline: none;
}

.ai-assistant-row input:focus {
  border-color: var(--task-accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.ai-assistant-row input::placeholder {
  color: var(--ink-faint);
}

.ai-submit {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--forest);
  color: var(--on-forest);
  cursor: pointer;
  transition: background 0.16s var(--ease), transform 0.16s var(--ease);
}

:root[data-theme="dark"] .ai-submit {
  color: #102015;
}

.ai-submit:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.ai-submit:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.ai-submit .icon {
  width: 15px;
  height: 15px;
}

.ai-assistant-hint {
  margin: 5px 1px 0;
  color: var(--ink-faint);
  font-size: 8.5px;
  line-height: 1.4;
}

.ai-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  padding: 4px 7px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 650;
}

.ai-source .icon {
  width: 11px;
  height: 11px;
}

.ai-source.is-local {
  background: var(--forest-faint);
  color: var(--accent);
}

.ai-source.is-external {
  background: var(--amber-soft);
  color: var(--amber);
}

.ai-summary {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

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

.ai-action {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-soft);
}

.ai-action .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  color: var(--accent);
}

.ai-action strong {
  display: block;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.ai-action small {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 9.5px;
}

/* -------------------------------------------------------------------------- */
/* Calendrier                                                                 */
/* -------------------------------------------------------------------------- */

.calendar-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  padding: 16px 18px 18px;
  overflow: hidden;
}

.calendar-root {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
}

.calendar-shell {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.cal-head {
  flex: none;
  display: grid;
  grid-template-columns: var(--gutter) repeat(var(--days, 7), minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--paper), var(--paper-soft));
}

.cal-head .head-gutter {
  border-right: 1px solid transparent;
}

.cal-task-row {
  flex: none;
  display: grid;
  grid-template-columns: var(--gutter) repeat(var(--days, 7), minmax(0, 1fr));
  max-height: 78px;
  overflow-y: auto;
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
}

.cal-task-row .task-gutter {
  padding: 8px 7px;
  border-right: 1px solid transparent;
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: right;
  text-transform: uppercase;
}

.cal-task-row .task-day {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 5px 6px;
  border-left: 1px solid var(--line);
}

/* Point 4 du 08/11 : le bandeau des « journée entière » et des 24 h et plus,
   entre les en-têtes de jours et la grille. Il n'apparaît que s'il y a
   quelque chose à y mettre. */
.cal-band {
  flex: none;
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
}

.cal-band .band-gutter {
  padding: 6px 7px;
  border-right: 1px solid transparent;
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: right;
  text-transform: uppercase;
}

.band-grid {
  display: grid;
  grid-template-columns: repeat(var(--days, 7), minmax(0, 1fr));
  grid-auto-rows: 22px;
  align-content: start;
  padding: 4px 0;
}

.allday-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 1px 3px;
  padding: 0 8px;
  border: 1px solid var(--event-line);
  border-radius: 6px;
  background: var(--event-bg);
  color: var(--event-ink);
  font-size: 11.5px;
  line-height: 1.2;
  text-align: left;
  cursor: grab;
  overflow: hidden;
  white-space: nowrap;
}

.allday-bar .allday-time {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

.allday-bar .allday-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.allday-bar .allday-mark {
  font-size: 10px;
  opacity: 0.65;
}

.allday-bar.is-dragging {
  opacity: 0.4;
}

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

.cal-task-chip {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 18px;
  padding: 3px 6px;
  overflow: hidden;
  border: 1px solid var(--task-line);
  border-radius: 5px;
  background: var(--task-bg);
  color: var(--task-ink);
  font: inherit;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.15;
  text-align: left;
  cursor: pointer;
}

.cal-task-chip::before {
  flex: none;
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--task-accent);
  content: "";
}

.cal-task-chip:hover,
.cal-task-chip:focus-visible {
  border-color: var(--task-accent);
  background: var(--task-bg-strong);
}

.cal-task-chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-head {
  min-width: 0;
  padding: 10px 11px 9px;
  border-left: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.16s var(--ease);
}

.day-head:hover {
  background: var(--forest-faint);
}

.day-head .dow {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.day-head .dom-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
}

.day-head .dom {
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.day-head.is-today .dom {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  margin: -4px 0 -2px -5px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--on-forest);
  font-size: 17px;
}

:root[data-theme="dark"] .day-head.is-today .dom {
  color: #102015;
}

.day-head .month-tag {
  font-size: 9.5px;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}

.day-head .day-count {
  margin-left: auto;
  font-size: 9px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.day-head.is-weekend .dow {
  color: var(--ink-faint);
}

.cal-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.cal-body {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  position: relative;
}

.time-gutter {
  position: relative;
  border-right: 1px solid transparent;
}

.time-label {
  position: absolute;
  right: 11px;
  transform: translateY(-50%);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.time-label.hour-start {
  color: var(--ink-soft);
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(var(--days, 7), minmax(0, 1fr));
  min-width: 0;
}

.day-col {
  position: relative;
  min-width: 0;
  border-left: 1px solid var(--line);
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--hour-height) - 1px),
      var(--line) calc(var(--hour-height) - 1px),
      var(--line) var(--hour-height)
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--hour-height) / 2 - 1px),
      rgba(30, 40, 30, 0.035) calc(var(--hour-height) / 2 - 1px),
      rgba(30, 40, 30, 0.035) calc(var(--hour-height) / 2)
    );
  cursor: default;
}

:root[data-theme="dark"] .day-col {
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--hour-height) - 1px),
      var(--line) calc(var(--hour-height) - 1px),
      var(--line) var(--hour-height)
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--hour-height) / 2 - 1px),
      rgba(240, 237, 226, 0.025) calc(var(--hour-height) / 2 - 1px),
      rgba(240, 237, 226, 0.025) calc(var(--hour-height) / 2)
    );
}

.day-col.is-today {
  background-color: rgba(46, 91, 68, 0.028);
}

:root[data-theme="dark"] .day-col.is-today {
  background-color: rgba(165, 203, 176, 0.035);
}

.day-col.is-weekend {
  background-color: rgba(30, 40, 30, 0.014);
}

.off-hours {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(30, 40, 30, 0.022);
}

:root[data-theme="dark"] .off-hours {
  background: rgba(240, 237, 226, 0.02);
}

.now-line {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  height: 1px;
  background: var(--danger);
  pointer-events: none;
}

.now-line::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -3.5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--paper);
}

.event-block.is-selected,
.month-chip.is-selected,
.month-task.is-selected,
.cal-task-chip.is-selected {
  box-shadow: 0 0 0 2px var(--forest), var(--shadow-sm);
}

.agenda-popover {
  position: fixed;
  z-index: 120;
  width: min(330px, calc(100vw - 24px));
  padding: 12px 13px 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}

.agenda-popover-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agenda-popover-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--sky);
}

.agenda-popover-dot.is-task {
  background: var(--task-accent);
}

.agenda-popover-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-popover-actions {
  display: flex;
  gap: 1px;
  margin: -4px -4px -4px 0;
}

.agenda-popover-actions .icon-button {
  width: 28px;
  height: 28px;
}

.agenda-popover-delete {
  color: var(--danger) !important;
}

.agenda-popover-date {
  margin: 9px 0 0 17px;
  color: var(--ink-faint);
  font-size: 11.5px;
}

.agenda-popover-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 5px 0 0 17px;
  color: var(--ink-soft);
  font-size: 12px;
}

.agenda-popover-meta .icon {
  width: 13px;
  height: 13px;
  color: var(--ink-faint);
}

@media (max-width: 720px) {
  .agenda-popover {
    width: auto;
  }
}

.event-block {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 6px 4px 8px;
  border: 1px solid var(--event-line);
  border-radius: 8px;
  background: var(--event-bg);
  color: var(--event-ink);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(24, 32, 24, 0.05);
  transition: box-shadow 0.16s var(--ease), filter 0.16s var(--ease);
  user-select: none;
  touch-action: manipulation;
}

.event-block::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--event-accent);
}

.event-block:hover {
  z-index: 5;
  box-shadow: 0 6px 18px rgba(24, 32, 24, 0.14);
  filter: saturate(1.04);
}

/* Un événement issu d'une tâche est bleu, quelle que soit son étiquette :
   on distingue ainsi d'un coup d'œil les tâches planifiées des réunions. */
.event-block.is-linked,
.month-chip.is-linked {
  --event-bg: var(--task-bg);
  --event-ink: var(--task-ink);
  --event-line: var(--task-line);
  --event-accent: var(--task-accent);
}

.event-block.is-linked {
  box-shadow: inset 0 0 0 1px var(--task-line);
}

.event-block.is-dragging {
  opacity: 0.25;
}

.event-block.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.event-block.is-clipped {
  border-style: dashed;
}

.event-time {
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.03em;
  opacity: 0.72;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-title {
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.event-meta {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  opacity: 0.7;
}

.event-meta .icon {
  width: 10px;
  height: 10px;
}

.event-block.is-short {
  padding-top: 2px;
  padding-bottom: 2px;
  justify-content: center;
}

.event-block.is-short .event-time,
.event-block.is-short .event-meta {
  display: none;
}

.event-block.is-short .event-title {
  font-size: 10.5px;
  -webkit-line-clamp: 1;
}

.resize-handle {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 0;
  height: 7px;
  cursor: ns-resize;
  touch-action: none;
}

.resize-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0;
  transform: translateX(-50%);
}

.event-block:hover .resize-handle::after {
  opacity: 0.28;
}

.drop-preview {
  position: absolute;
  z-index: 3;
  left: 4px;
  right: 4px;
  padding: 4px 7px;
  border: 1.5px dashed var(--accent);
  border-radius: 8px;
  background: rgba(46, 91, 68, 0.09);
  color: var(--accent);
  font-size: 10px;
  font-weight: 650;
  pointer-events: none;
  overflow: hidden;
}

.drop-preview.is-task {
  border-color: var(--task-accent);
  background: rgba(63, 110, 140, 0.11);
  color: var(--task-accent);
}

.drop-preview .drop-time {
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.event-menu {
  position: fixed;
  z-index: 300;
  min-width: 238px;
  max-width: calc(100vw - 16px);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}

.event-menu-item {
  width: 100%;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.event-menu-item:hover,
.event-menu-item:focus-visible {
  background: var(--forest-faint);
  outline: none;
}

.event-menu-item .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--accent);
}

.event-menu-item.is-danger,
.event-menu-item.is-danger .icon {
  color: var(--danger);
}

.event-menu-item.is-danger:hover,
.event-menu-item.is-danger:focus-visible {
  background: var(--danger-soft);
}

.event-menu-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.event-menu-label {
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.event-menu-hint {
  color: var(--ink-faint);
  font-size: 9.5px;
  line-height: 1.35;
}

.event-menu-separator {
  height: 1px;
  margin: 4px 8px;
  background: var(--line);
}

.series-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
}

.series-summary strong {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.series-summary span {
  color: var(--ink-faint);
  font-size: 10.5px;
}

.recurrence-preview {
  color: var(--accent);
  font-weight: 600;
}

.drag-ghost {
  position: fixed;
  z-index: 500;
  pointer-events: none;
  opacity: 0.92;
  transform: rotate(1.2deg) translate(-4px, -4px);
  box-shadow: 0 18px 40px rgba(24, 32, 24, 0.24);
  border-radius: 8px;
}

.drag-ghost.task-card {
  width: 280px;
  background: linear-gradient(160deg, var(--task-bg) 0%, var(--task-bg-strong) 100%);
  border: 1px solid var(--task-line);
  border-left: 3px solid var(--task-accent);
  color: var(--task-ink);
  padding: 10px 30px 10px 8px;
}

.drag-ghost.event-block {
  position: fixed;
  padding: 4px 6px 4px 8px;
}

.event-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.event-tag::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--event-accent);
}

.cal-empty {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 30px;
  text-align: center;
  color: var(--ink-faint);
}

.cal-empty strong {
  display: block;
  margin-bottom: 5px;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--ink-soft);
}

/* Vue mois */

.month-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.month-dow-head {
  flex: none;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
}

.month-dow-head > span {
  min-width: 0;
  padding: 9px 10px;
  border-left: 1px solid var(--line);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.month-dow-head > span:first-child {
  border-left: 0;
}

/* 16/11 — le nom court ne sert que sur un petit écran (voir plus bas). */
.month-dow-head .dow-court {
  display: none;
}

.month-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(72px, 1fr));
}

.month-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 6px 7px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  transition: background 0.14s var(--ease);
}

.month-cell:nth-child(7n + 1) {
  border-left: 0;
}

.month-cell:hover {
  background: var(--forest-faint);
}

.month-cell.is-outside {
  background: rgba(30, 40, 30, 0.018);
}

.month-cell.is-outside .month-date {
  color: var(--ink-faint);
  opacity: 0.55;
}

.month-cell.is-weekend {
  background: rgba(30, 40, 30, 0.012);
}

.month-cell.is-today {
  background: rgba(46, 91, 68, 0.045);
  box-shadow: inset 0 0 0 1.5px rgba(46, 91, 68, 0.24);
}

.month-cell.is-drop-target {
  background: rgba(63, 110, 140, 0.13);
  box-shadow: inset 0 0 0 2px var(--task-accent);
}

.month-date-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.month-date {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  font-family: var(--font-serif);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.month-cell.is-today .month-date {
  background: var(--forest);
  color: var(--on-forest);
}

:root[data-theme="dark"] .month-cell.is-today .month-date {
  color: #102015;
}

.month-month-label {
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.month-events {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.month-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 2px 5px 2px 4px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--event-bg);
  color: var(--event-ink);
  font-size: 9.5px;
  line-height: 1.35;
  text-align: left;
  overflow: hidden;
  cursor: grab;
}

.month-chip:hover {
  border-color: var(--event-line);
  filter: brightness(0.98);
}

.month-chip.is-dragging,
.month-task.is-dragging {
  opacity: 0.35;
  cursor: grabbing;
}

.month-chip::before {
  content: "";
  width: 3px;
  height: 3px;
  flex: none;
  border-radius: 50%;
  background: var(--event-accent);
}

.month-chip .chip-time {
  flex: none;
  font-size: 8.5px;
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}

.month-chip .chip-title {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 600;
}

.month-more {
  padding: 1px 4px;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font-size: 9px;
  text-align: left;
}

.month-more:hover {
  color: var(--ink);
}

.month-task {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 1px 3px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 9px;
  text-align: left;
  cursor: grab;
}

.month-task:hover {
  background: var(--paper-soft);
}

.month-task::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  border: 1px solid var(--ink-faint);
  border-radius: 50%;
}

.month-task .chip-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* -------------------------------------------------------------------------- */
/* Modales et formulaires                                                     */
/* -------------------------------------------------------------------------- */

dialog.modal {
  width: min(560px, calc(100vw - 24px));
  max-width: none;
  max-height: 92dvh;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

dialog.modal.wide {
  width: min(760px, calc(100vw - 24px));
}

dialog.modal::backdrop {
  background: rgba(18, 27, 20, 0.46);
  backdrop-filter: blur(4px);
}

.modal-card {
  display: flex;
  flex-direction: column;
  max-height: 92dvh;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in 0.22s var(--ease);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 24px 0;
}

.modal-head-main {
  min-width: 0;
  flex: 1;
}

.modal-head .eyebrow {
  margin-bottom: 6px;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.modal-subtitle {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.5;
}

.modal-close {
  flex: none;
  width: 30px;
  height: 30px;
  margin-top: 2px;
}

.modal-body {
  flex: 1;
  min-height: 0;
  padding: 18px 24px 20px;
  overflow-y: auto;
}

.modal-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--paper-soft);
}

.modal-foot .spacer {
  flex: 1;
}

.modal-danger-link {
  border: 0;
  background: none;
  color: var(--danger);
  font-size: 12px;
  padding: 6px 2px;
}

.modal-danger-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.field > label {
  margin-bottom: 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--field);
  padding: 9px 11px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.field input {
  height: 39px;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(46, 91, 68, 0.5);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-faint);
}

.field .hint {
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.45;
  color: var(--ink-faint);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Point 3 du 08/11 : la case « Journée entière », entre les dates et les
   heures. */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
}

.checkbox-row input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}

.segmented button {
  flex: 1;
  min-height: 31px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.segmented.priority button.active[data-value="urgent"] {
  color: var(--danger);
}

.segmented.priority button.active[data-value="high"] {
  color: var(--amber);
}

.quick-durations {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.quick-durations button {
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font-size: 9.5px;
  color: var(--ink-soft);
}

.quick-durations button:hover {
  border-color: var(--line-strong);
  background: var(--paper-soft);
}

.linked-task {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--forest-faint);
}

.linked-task .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.linked-task div {
  min-width: 0;
  flex: 1;
}

.linked-task strong {
  display: block;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.linked-task span {
  font-size: 9.5px;
  color: var(--ink-faint);
}

.source-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.source-note .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--accent);
}

.plan-preview {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  font-size: 11.5px;
}

.plan-preview .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.plan-preview strong {
  display: block;
  font-size: 12px;
}

.plan-preview span {
  font-size: 10.5px;
  color: var(--ink-faint);
}

/* Réglages */

.settings-layout {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  min-height: 420px;
}

.settings-nav {
  padding: 8px 10px 18px 0;
  border-right: 1px solid var(--line);
}

.settings-nav button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: left;
}

.settings-nav button .icon {
  width: 15px;
  height: 15px;
  color: var(--ink-faint);
}

.settings-nav button:hover {
  background: var(--paper-soft);
  color: var(--ink);
}

.settings-nav button.active {
  background: var(--forest-soft);
  color: var(--forest);
  font-weight: 650;
}

:root[data-theme="dark"] .settings-nav button.active {
  color: var(--forest);
}

.settings-nav button.active .icon {
  color: currentColor;
}

.settings-content {
  padding-left: 22px;
  min-width: 0;
}

.settings-section h3 {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.settings-section > p.lede {
  margin-top: 4px;
  margin-bottom: 16px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-faint);
}

.settings-block {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.settings-block:first-of-type {
  border-top: 0;
}

.settings-block h4 {
  margin-bottom: 4px;
  font-size: 12.5px;
  font-weight: 650;
}

.settings-block > p {
  margin-bottom: 10px;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--ink-faint);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.setting-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}

.setting-inline > div {
  min-width: 0;
}

.setting-inline strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
}

.setting-inline span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--ink-faint);
  line-height: 1.45;
}

.switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.18s var(--ease);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s var(--ease);
}

.switch[aria-checked="true"] {
  background: var(--accent);
}

.switch[aria-checked="true"]::after {
  transform: translateX(16px);
}

.session-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}

.session-row .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-faint);
}

.session-row div {
  flex: 1;
  min-width: 0;
}

.session-row strong {
  display: block;
  font-size: 11px;
  font-weight: 600;
}

.session-row span {
  display: block;
  margin-top: 1px;
  font-size: 9.5px;
  color: var(--ink-faint);
}

.audit-list {
  max-height: 190px;
  overflow-y: auto;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.audit-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.audit-row:first-child {
  border-top: 0;
}

.audit-row span {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.audit-row strong {
  font-weight: 500;
  color: var(--ink-soft);
  text-align: right;
}

.secret-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: var(--paper-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  word-break: break-all;
}

.secret-box code {
  flex: 1;
  background: none;
  padding: 0;
}

.recovery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-soft);
}

.recovery-grid code {
  font-size: 11px;
  letter-spacing: 0.06em;
  background: none;
}

/* AnonyKeep */

.ak-intro {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--forest-faint);
}

.ak-intro .icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
  margin-top: 1px;
}

.ak-intro p {
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.ak-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.ak-progress {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-soft);
}

.ak-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-faint);
}

.ak-step .icon {
  width: 14px;
  height: 14px;
}

.ak-step.is-active {
  color: var(--ink);
}

.ak-step.is-done {
  color: var(--accent);
}

.ak-notes {
  display: grid;
  gap: 7px;
  max-height: 340px;
  overflow-y: auto;
  margin-top: 12px;
  padding-right: 2px;
}

.ak-note {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  overflow: hidden;
}

.ak-note summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  list-style: none;
  cursor: pointer;
}

.ak-note summary::-webkit-details-marker {
  display: none;
}

.ak-note summary input {
  accent-color: var(--accent);
}

.ak-note summary strong {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ak-note summary span {
  font-size: 9.5px;
  color: var(--ink-faint);
}

.ak-items {
  display: grid;
  gap: 3px;
  padding: 2px 10px 9px 30px;
}

.ak-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 10.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.ak-item input {
  margin-top: 1px;
  accent-color: var(--accent);
}

.ak-item.is-imported {
  color: var(--ink-faint);
  text-decoration: line-through;
}

/* Raccourcis */

.shortcut-list {
  display: grid;
  gap: 2px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.shortcut-row:first-child {
  border-top: 0;
}

.shortcut-row span:last-child {
  display: flex;
  gap: 4px;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 21px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-soft);
}

/* -------------------------------------------------------------------------- */
/* Toasts, état vide, divers                                                  */
/* -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  z-index: 700;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  width: min(460px, calc(100vw - 24px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  width: auto;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(247, 242, 228, 0.12);
  border-radius: 10px;
  background: var(--forest-deep);
  color: var(--on-forest);
  box-shadow: var(--shadow-md);
  font-size: 11.5px;
  line-height: 1.4;
  pointer-events: auto;
  animation: toast-in 0.24s var(--ease);
}

.toast .icon {
  width: 15px;
  height: 15px;
  flex: none;
  color: #c7ddb1;
}

.toast.is-error {
  background: #4a241f;
  border-color: rgba(255, 155, 144, 0.2);
}

.toast.is-error .icon {
  color: #ffb3aa;
}

.toast-message {
  flex: 1;
}

.toast-action {
  flex: none;
  border: 0;
  background: rgba(247, 242, 228, 0.12);
  color: var(--on-forest);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
}

.toast-action:hover {
  background: rgba(247, 242, 228, 0.2);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.noscript,
.app-error {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 30px;
  background: var(--bg);
  font-size: 13px;
  text-align: center;
}

.mobile-nav {
  display: none;
}

.fab {
  display: none;
}

/* -------------------------------------------------------------------------- */
/* PWA : installation, zones sûres, confort mobile                            */
/* -------------------------------------------------------------------------- */

.install-sheet {
  display: grid;
  gap: 14px;
}

.install-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--forest-faint), var(--paper));
}

.install-hero img {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.install-hero strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.install-hero span {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-faint);
}

.install-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.install-steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

.install-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: var(--paper-soft);
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.install-note .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--accent);
}

.install-installed {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--forest-faint);
}

.install-installed .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.install-installed strong {
  display: block;
  font-size: 11.5px;
  font-weight: 650;
}

.install-installed span {
  display: block;
  margin-top: 1px;
  font-size: 9.5px;
  color: var(--ink-faint);
}

/* -------------------------------------------------------------------------- */
/* Compléments : planification, réglages, pont AnonyKeep                      */
/* -------------------------------------------------------------------------- */

.plan-summary {
  font-size: 13px;
  font-weight: 600;
}

.plan-list {
  display: grid;
  gap: 1px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--line);
}

.plan-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--paper);
}

.plan-date {
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: capitalize;
  color: var(--ink-faint);
}

.plan-row strong {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11.5px;
  font-weight: 600;
}

.plan-time {
  font-size: 9.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.confirm-message {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.preview-label {
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 8.5px;
  color: var(--accent);
}

.settings-actions-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pill-current {
  flex: none;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--forest-soft);
  color: var(--forest);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

:root[data-theme="dark"] .pill-current {
  color: var(--forest);
}

.tag-manage-list {
  display: grid;
  gap: 3px;
  margin: 10px 0;
}

.tag-manage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-size: 11.5px;
}

.tag-manage-row > span:nth-child(2) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Point 6 du 08/11 : « Colorer d'après l'intitulé », une case par étiquette. */
.tag-manage-auto {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  color: var(--ink-faint);
  font-size: 10px;
  cursor: pointer;
}

.tag-manage-auto input[type='checkbox'] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.tag-swatch {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--tag-color, var(--accent));
}

.tag-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px auto;
  gap: 7px;
}

.tag-add input,
.tag-add select {
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  font-size: 11px;
}

.code-block {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}

.about-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
}

.about-row:first-of-type {
  border-top: 0;
}

.about-row span {
  color: var(--ink-faint);
}

.about-row strong {
  font-weight: 600;
  text-align: right;
}

.ak-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ak-summary strong {
  display: block;
  font-size: 12.5px;
}

.ak-summary span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--ink-faint);
}

.ak-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.ak-counter {
  font-size: 10px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.ak-archived {
  padding: 1px 5px;
  border-radius: 99px;
  background: var(--bg);
  color: var(--ink-faint);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ak-open-link {
  justify-content: center;
  margin-top: 4px;
  font-size: 10.5px;
}

.ak-status {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--forest-faint);
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.5;
}

.app-menu button.active {
  background: var(--forest-soft);
  color: var(--forest);
}

.modal-foot .button {
  min-width: 88px;
}

.modal-foot .button.align-left {
  margin-right: 2px;
}

.month-task .chip-title {
  font-weight: 500;
}

@media (max-width: 860px) {
  .task-grip {
    opacity: 0.85;
  }

  .plan-row {
    grid-template-columns: 105px minmax(0, 1fr);
  }

  .plan-time {
    display: none;
  }

  .tag-add {
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  .tag-add .button {
    grid-column: 1 / -1;
  }
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 322px minmax(0, 1fr);
  }

  .period-nav {
    gap: 10px;
  }

  .period-heading h1 {
    font-size: 21px;
  }

  .brand-name {
    display: none;
  }

  .topbar {
    gap: 12px;
  }

  .new-event-button span {
    display: none;
  }

  .new-event-button {
    width: 36px;
    padding: 0;
  }
}

@media (max-width: 1020px) {
  .auth-screen {
    grid-template-columns: 42% 1fr;
  }

  .auth-art {
    padding: 34px 32px;
  }

  .auth-pitch h1 {
    font-size: 50px;
  }

  .workspace {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .period-heading p {
    display: none;
  }

  .view-switch button {
    padding: 0 9px;
  }

  .task-rail {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (max-width: 860px) {
  body {
    overflow: hidden;
  }

  .auth-screen {
    grid-template-columns: 1fr;
  }

  .auth-art {
    display: none;
  }

  .auth-panel {
    padding: calc(34px + env(safe-area-inset-top, 0px)) 22px 34px;
  }

  .auth-mobile-brand {
    display: flex;
  }

  .topbar {
    height: calc(60px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0;
    gap: 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .period-nav {
    gap: 7px;
  }

  .nav-buttons {
    padding: 2px;
  }

  .nav-buttons .icon-button {
    width: 26px;
    height: 26px;
  }

  .today-button {
    display: none;
  }

  .period-heading h1 {
    font-size: 18px;
    max-width: 36vw;
  }

  .view-switch {
    display: none;
  }

  .topbar-tools {
    margin-left: auto;
  }

  .topbar-tools .toolbox-link,
  .topbar-tools .new-event-button {
    display: none;
  }

  .search-pop {
    top: 54px;
    right: 8px;
    width: calc(100vw - 16px);
  }

  .app-menu {
    top: 54px;
    right: 8px;
  }

  .workspace {
    display: block;
    position: relative;
    height: calc(100dvh - 60px - env(safe-area-inset-top, 0px));
  }

  .calendar-main {
    height: 100%;
    padding: 8px 8px calc(74px + env(safe-area-inset-bottom, 0px));
    overflow: auto;
  }

  .calendar-shell,
  .month-shell {
    min-width: 0;
    border-radius: 16px;
  }

  /* 16/11 — plus de largeur forcée pour la semaine et le mois : sur le
     téléphone, la grille débordait de l'écran, et un glissement la faisait
     défiler *et* changeait de période (E4). Elle tient désormais dans la
     largeur, comme dans Google Agenda. */
  .calendar-shell.is-week,
  .month-shell {
    min-width: 0;
  }

  .task-rail {
    position: fixed;
    z-index: 70;
    inset: calc(60px + env(safe-area-inset-top, 0px)) 0 calc(62px + env(safe-area-inset-bottom, 0px)) 0;
    width: 100%;
    max-width: none;
    padding: 18px 16px 14px;
    border-right: 0;
    background: var(--bg);
    transform: translateY(12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
  }

  .app.tasks-open .task-rail {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .app.tasks-open .calendar-main {
    visibility: hidden;
  }

  .mobile-nav {
    position: fixed;
    z-index: 80;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-columns: 1fr 1fr 64px;
    align-items: center;
    border-top: 1px solid var(--line);
    background: var(--topbar);
    backdrop-filter: blur(16px);
    padding: 0 18px env(safe-area-inset-bottom, 0px);
  }

  .mobile-nav button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--ink-faint);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
  }

  .mobile-nav button .icon {
    width: 20px;
    height: 20px;
  }

  .mobile-nav button.active {
    color: var(--accent);
  }

  .mobile-nav .mobile-new {
    width: 46px;
    height: 46px;
    margin: 0 auto;
    border-radius: 50%;
    background: var(--forest);
    color: var(--on-forest);
    box-shadow: 0 6px 18px rgba(24, 42, 30, 0.24);
  }

  :root[data-theme="dark"] .mobile-nav .mobile-new {
    color: #102015;
  }

  .mobile-nav .mobile-new .icon {
    width: 22px;
    height: 22px;
  }

  .mobile-badge {
    position: absolute;
    top: 8px;
    margin-left: 18px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 99px;
    background: var(--accent);
    color: var(--on-forest);
    font-size: 8px;
    display: grid;
    place-items: center;
  }

  .fab {
    display: none;
  }

  .toasts {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  input,
  select,
  textarea,
  .field input,
  .field select,
  .field textarea,
  .quick-task input,
  .search-field input {
    font-size: 16px;
  }

  .modal-foot {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .modal-head {
    padding: 18px 16px 0;
  }

  .modal-body {
    padding: 16px;
  }

  .settings-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .settings-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 14px;
  }

  .settings-nav button {
    width: auto;
    white-space: nowrap;
  }

  .settings-content {
    padding-left: 0;
  }

  .month-grid {
    grid-template-rows: repeat(6, minmax(82px, 1fr));
  }
}

@media (max-width: 560px) {
  .period-heading h1 {
    max-width: 30vw;
  }

  .period-heading h1 .long {
    display: none;
  }

  .topbar-tools #search-toggle {
    display: none;
  }

  .calendar-main {
    padding: 6px 6px calc(70px + env(safe-area-inset-bottom, 0px));
  }

  /* 16/11 — la même gouttière pour l'en-tête, les bandeaux et la grille :
     seul l'en-tête la réduisait, et les colonnes de la semaine ne tombaient
     plus en face de leur jour. */
  .calendar-shell {
    --gutter: 46px;
  }

  .cal-task-row .task-gutter,
  .cal-band .band-gutter {
    padding: 6px 3px;
    font-size: 7px;
    letter-spacing: 0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .time-label {
    right: 6px;
    font-size: 8.5px;
  }

  .day-head {
    padding: 8px 7px;
  }

  .day-head .dom {
    font-size: 18px;
  }

  .day-head.is-today .dom {
    width: 25px;
    height: 25px;
    font-size: 15px;
  }

  .event-block {
    padding-right: 4px;
  }

  .event-title {
    font-size: 10.5px;
  }

  /* 16/11 — la semaine tient dans la largeur du téléphone (sept colonnes
     d'environ 45 px) : en-têtes de jour et blocs plus serrés. */
  .calendar-shell.is-week .day-head {
    padding: 6px 1px;
    text-align: center;
  }

  .calendar-shell.is-week .day-head .dow {
    letter-spacing: 0.04em;
  }

  .calendar-shell.is-week .day-head .dom-row {
    justify-content: center;
  }

  .calendar-shell.is-week .day-head .day-count {
    display: none;
  }

  .calendar-shell.is-week .day-head.is-today .dom {
    margin: -3px 0 -2px;
  }

  .calendar-shell.is-week .event-block {
    padding: 3px 2px 3px 5px;
  }

  .calendar-shell.is-week .event-title {
    font-size: 10px;
  }

  .calendar-shell.is-week .task-day {
    padding: 4px 2px;
  }

  .calendar-shell.is-week .cal-task-chip {
    padding: 2px 3px;
  }

  .calendar-shell.is-week .cal-task-chip::before {
    display: none;
  }

  .calendar-shell.is-week .allday-bar {
    gap: 2px;
    margin: 1px;
    padding: 0 3px;
    font-size: 10px;
  }

  .month-shell {
    min-width: 0;
  }

  .month-dow-head > span {
    padding: 7px 2px;
    letter-spacing: 0.06em;
    text-align: center;
  }

  .month-dow-head .dow-long {
    display: none;
  }

  .month-dow-head .dow-court {
    display: inline;
  }

  .month-cell {
    padding: 3px 2px;
  }

  .month-chip {
    gap: 2px;
    padding: 1px 2px;
    font-size: 9px;
  }

  .month-chip .chip-time {
    display: none;
  }

  .month-date {
    font-size: 12px;
  }

  .auth-card h2 {
    font-size: 34px;
  }

  .toasts {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    width: calc(100vw - 16px);
  }

  .form-grid,
  .form-row {
    grid-template-columns: 1fr;
  }

  .recovery-grid {
    grid-template-columns: 1fr;
  }

  .modal-title {
    font-size: 23px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Couleurs des étiquettes : appliquées aux blocs d'événements et pastilles. */

.tag-forest {
  --event-bg: #e2ece0;
  --event-ink: #1f3a2b;
  --event-line: rgba(36, 74, 56, 0.15);
  --event-accent: #2f5b43;
  --tag-color: #2f5b43;
}

.tag-sage {
  --event-bg: #e4eddd;
  --event-ink: #2b3825;
  --event-line: rgba(76, 98, 66, 0.16);
  --event-accent: #64825f;
  --tag-color: #64825f;
}

.tag-sky {
  --event-bg: #e0ecf3;
  --event-ink: #233744;
  --event-line: rgba(61, 96, 120, 0.16);
  --event-accent: #4d7894;
  --tag-color: #4d7894;
}

.tag-butter {
  --event-bg: #f8edc9;
  --event-ink: #413719;
  --event-line: rgba(120, 94, 34, 0.16);
  --event-accent: #a87d34;
  --tag-color: #a87d34;
}

.tag-blush {
  --event-bg: #f6e1e2;
  --event-ink: #432428;
  --event-line: rgba(136, 71, 80, 0.15);
  --event-accent: #a95e66;
  --tag-color: #a95e66;
}

.tag-lilac {
  --event-bg: #eae4f3;
  --event-ink: #312a42;
  --event-line: rgba(93, 78, 124, 0.15);
  --event-accent: #70628f;
  --tag-color: #70628f;
}

.tag-peach {
  --event-bg: #f8e6d5;
  --event-ink: #44301f;
  --event-line: rgba(134, 91, 53, 0.15);
  --event-accent: #a87148;
  --tag-color: #a87148;
}

.tag-clay {
  --event-bg: #eee2da;
  --event-ink: #3a2d26;
  --event-line: rgba(112, 82, 65, 0.15);
  --event-accent: #8c6654;
  --tag-color: #8c6654;
}

.tag-default {
  --event-bg: #e2ece0;
  --event-ink: #1f3a2b;
  --event-line: rgba(36, 74, 56, 0.15);
  --event-accent: #2f5b43;
  --tag-color: #2f5b43;
}

:root[data-theme="dark"] .tag-forest,
:root[data-theme="dark"] .tag-default {
  --event-bg: #26382b;
  --event-ink: #e1edda;
  --event-line: rgba(158, 199, 168, 0.14);
  --event-accent: #9ec7a8;
}

:root[data-theme="dark"] .tag-sage {
  --event-bg: #2c3927;
  --event-ink: #e7efdd;
  --event-line: rgba(182, 207, 169, 0.13);
  --event-accent: #b6cfa9;
}

:root[data-theme="dark"] .tag-sky {
  --event-bg: #24343f;
  --event-ink: #dfeaf3;
  --event-line: rgba(167, 201, 223, 0.13);
  --event-accent: #a7c9df;
}

:root[data-theme="dark"] .tag-butter {
  --event-bg: #3a321f;
  --event-ink: #f3e7c7;
  --event-line: rgba(229, 196, 125, 0.13);
  --event-accent: #e5c47d;
}

:root[data-theme="dark"] .tag-blush {
  --event-bg: #3a2729;
  --event-ink: #f4dfe1;
  --event-line: rgba(227, 167, 174, 0.13);
  --event-accent: #e3a7ae;
}

:root[data-theme="dark"] .tag-lilac {
  --event-bg: #2f2a3b;
  --event-ink: #eae1f4;
  --event-line: rgba(193, 176, 224, 0.13);
  --event-accent: #c1b0e0;
}

:root[data-theme="dark"] .tag-peach {
  --event-bg: #3a2d22;
  --event-ink: #f4e4d3;
  --event-line: rgba(224, 173, 131, 0.13);
  --event-accent: #e0ad83;
}

:root[data-theme="dark"] .tag-clay {
  --event-bg: #342a24;
  --event-ink: #ecdfd7;
  --event-line: rgba(200, 165, 143, 0.13);
  --event-accent: #c8a58f;
}
