@font-face {
  font-family: 'Mona Sans';
  src: url('/fonts/mona-sans.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ─────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;
  --font: 'Mona Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

  --bg:       light-dark(oklch(98.3% 0.002 265), oklch(17% 0.004 265));
  --sidebar:  light-dark(oklch(96.7% 0.003 265), oklch(15.2% 0.004 265));
  --sunken:   light-dark(oklch(95.5% 0.004 265), oklch(20% 0.005 265));
  --surface:  light-dark(oklch(100% 0 0), oklch(23.4% 0.006 265));
  --raised:   light-dark(oklch(100% 0 0), oklch(22% 0.006 265));
  --hover:    light-dark(oklch(93.4% 0.004 265), oklch(25.5% 0.006 265));
  --active:   light-dark(oklch(91% 0.005 265), oklch(29% 0.007 265));
  --line:     light-dark(oklch(91.5% 0.004 265), oklch(27.5% 0.006 265));
  --line-2:   light-dark(oklch(86% 0.006 265), oklch(34% 0.008 265));
  --text:     light-dark(oklch(23% 0.012 265), oklch(94.5% 0.004 265));
  --text-2:   light-dark(oklch(43% 0.014 265), oklch(77% 0.008 265));
  --text-3:   light-dark(oklch(52% 0.012 265), oklch(65% 0.01 265));
  --ink:      light-dark(oklch(24% 0.012 265), oklch(93% 0.004 265));
  --ink-2:    light-dark(oklch(33% 0.014 265), oklch(100% 0 0));
  --on-ink:   light-dark(oklch(99% 0 0), oklch(18% 0.006 265));
  --focus:    light-dark(oklch(57% 0.17 255), oklch(72% 0.13 255));

  --red:      light-dark(oklch(54% 0.19 25), oklch(71% 0.16 25));
  --orange:   light-dark(oklch(60% 0.16 52), oklch(77% 0.14 60));
  --blue:     light-dark(oklch(54% 0.15 255), oklch(72% 0.12 255));
  --green:    light-dark(oklch(54% 0.13 150), oklch(74% 0.13 150));
  --amber:    light-dark(oklch(66% 0.15 75), oklch(81% 0.14 82));

  --shadow-card: 0 1px 1.5px light-dark(oklch(20% 0.02 265 / 0.06), oklch(0% 0 0 / 0.35));
  --shadow-lift: 0 14px 30px -10px light-dark(oklch(20% 0.02 265 / 0.28), oklch(0% 0 0 / 0.7)),
                 0 3px 8px light-dark(oklch(20% 0.02 265 / 0.08), oklch(0% 0 0 / 0.4));
  --shadow-pop:  0 16px 40px -12px light-dark(oklch(20% 0.02 265 / 0.22), oklch(0% 0 0 / 0.65)),
                 0 2px 6px light-dark(oklch(20% 0.02 265 / 0.06), oklch(0% 0 0 / 0.35));
  --ring: 0 0 0 3px color-mix(in oklch, var(--focus) 22%, transparent);

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 10px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sidebar-w: 232px;
}
:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

[data-color='slate']  { --c: oklch(62% 0.02 265); }
[data-color='red']    { --c: oklch(62% 0.18 25); }
[data-color='orange'] { --c: oklch(69% 0.15 52); }
[data-color='amber']  { --c: oklch(78% 0.14 82); }
[data-color='green']  { --c: oklch(65% 0.13 150); }
[data-color='teal']   { --c: oklch(66% 0.1 195); }
[data-color='blue']   { --c: oklch(61% 0.14 255); }
[data-color='violet'] { --c: oklch(61% 0.15 295); }
[data-color='pink']   { --c: oklch(67% 0.15 350); }

/* ── Base ───────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font: 400 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: color-mix(in oklch, var(--focus) 28%, transparent); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.mark { width: 18px; height: 18px; flex: none; color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--text-3)); flex: none; }
kbd {
  font: 500 11px/1 var(--font);
  color: var(--text-3);
  padding: 3px 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 4px;
}

/* ── Contrôles ──────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 7px;
  font-size: 13px; font-weight: 550; letter-spacing: -0.003em;
  white-space: nowrap; cursor: pointer; user-select: none; text-decoration: none;
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 38px; font-size: 14px; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover:not(:disabled) { background: var(--ink-2); }
.btn-secondary { background: var(--surface); border-color: var(--line-2); color: var(--text); box-shadow: var(--shadow-card); }
.btn-secondary:hover:not(:disabled) { background: var(--hover); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.btn-danger { background: var(--surface); border-color: var(--line-2); color: var(--red); box-shadow: var(--shadow-card); }
.btn-danger:hover:not(:disabled) { background: color-mix(in oklch, var(--red) 9%, var(--surface)); border-color: color-mix(in oklch, var(--red) 35%, var(--line-2)); }
.btn-danger-solid { background: var(--red); color: oklch(99% 0 0); }
.btn-danger-solid:hover { background: color-mix(in oklch, var(--red) 88%, black); }
.btn .kbd-inline { color: inherit; opacity: .6; border-color: currentColor; border-bottom-width: 1px; padding: 2px 4px; font-size: 10.5px; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2);
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 24px; height: 24px; border-radius: 5px; }

.input, .select {
  height: 32px;
  border: 1px solid var(--line-2); border-radius: 7px;
  background: var(--surface);
  font-size: 13.5px;
  transition: border-color .12s, box-shadow .12s;
}
.input { width: 100%; padding: 0 10px; }
.textarea { height: auto; padding: 7px 10px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus-visible { outline: none; border-color: var(--focus); box-shadow: var(--ring); }
.input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
.select {
  appearance: none; -webkit-appearance: none;
  max-width: 100%;
  padding: 0 28px 0 10px;
  color: var(--text-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23878b94' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4.5 6.2 3.5 3.5 3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
  cursor: pointer;
}
.select:hover { border-color: var(--text-3); }
.select.is-set { color: var(--text); font-weight: 550; border-color: var(--text-3); background-color: var(--hover); }

.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > span, .field > legend { font-size: 12.5px; font-weight: 550; color: var(--text-2); padding: 0; }
.field em { font-style: normal; font-weight: 400; color: var(--text-3); }
.form-error { font-size: 13px; color: var(--red); }

/* ── Connexion ──────────────────────────────────────────────── */

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-form { width: min(340px, 100%); display: grid; gap: 14px; }
.login-form .brand { padding: 0; margin-bottom: 18px; }
.login h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; margin-bottom: 4px; }
.login .input { height: 38px; }
.login .btn { margin-top: 6px; }

/* ── Structure ──────────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100dvh; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  padding: 12px 8px 8px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 14px; font-size: 14.5px; font-weight: 650; letter-spacing: -0.015em; }
.nav { display: flex; flex-direction: column; gap: 1px; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  height: 30px; padding: 0 8px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  text-decoration: none;
  transition: background-color .12s, color .12s;
}
.nav-item .icon { color: var(--text-3); }
.nav-item .dot { margin: 0 4px; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item[aria-current='page'] { background: var(--active); color: var(--text); }
.nav-item[aria-current='page'] .icon { color: var(--text); }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: 12px; color: var(--text-3); }
.nav-section {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 4px 4px 8px;
  font-size: 12px; font-weight: 600; color: var(--text-3);
}
.project-list { display: flex; flex-direction: column; gap: 1px; }
.project-list .empty-hint { padding: 4px 8px; font-size: 12.5px; color: var(--text-3); }
.sidebar-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.foot-row { display: flex; align-items: center; gap: 2px; padding: 6px 0 0 8px; }
.foot-row .user { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrim { display: none; }

/* ── Barre d'outils ─────────────────────────────────────────── */

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  grid-template-areas: 'title tools new';
  align-items: center; gap: 8px 12px;
  padding: 12px 16px 10px;
}
.menu-btn { display: none; grid-area: menu; }
.view-title { grid-area: title; display: flex; align-items: center; gap: 8px; min-width: 0; }
.view-title h1 { font-size: 17px; font-weight: 650; letter-spacing: -0.018em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-title .dot { width: 10px; height: 10px; }
.tools { grid-area: tools; display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.new-task { grid-area: new; }
.search {
  position: relative; display: flex; align-items: center;
  width: 232px; height: 32px; flex: 0 1 auto;
  border: 1px solid var(--line-2); border-radius: 7px;
  background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.search .icon { position: absolute; left: 9px; color: var(--text-3); pointer-events: none; }
.search input {
  flex: 1; min-width: 0; height: 100%;
  padding: 0 8px 0 31px; border: 0; background: transparent;
  font-size: 13.5px; outline: none;
}
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { margin-right: 7px; }
.search:focus-within { border-color: var(--focus); box-shadow: var(--ring); }
.search:focus-within kbd { visibility: hidden; }
.filters { display: flex; align-items: center; gap: 6px; }
.filters .select { font-size: 13px; }
.filter-toggle { display: none; }
.badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--ink); color: var(--on-ink);
  font-size: 11px; font-weight: 600; line-height: 17px; text-align: center;
}

/* ── Tableau ────────────────────────────────────────────────── */

.board-view { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.board {
  flex: 1; min-height: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(216px, 1fr);
  gap: 10px;
  padding: 2px 16px 16px;
  overflow-x: auto; overscroll-behavior-x: contain;
}
.col {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--sunken);
  border-radius: var(--r-lg);
}
.col-head { display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 6px 0 12px; flex: none; }
.col-head h2 { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.col-count { font-size: 12px; color: var(--text-3); }
.col-actions { margin-left: auto; display: flex; gap: 2px; }
.status-icon { width: 14px; height: 14px; }
.st-backlog { color: var(--text-3); }
.st-todo { color: var(--text-2); }
.st-doing { color: var(--amber); }
.st-done { color: var(--green); }

.col-body {
  position: relative;
  flex: 0 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 0 6px 6px;
  overflow-y: auto; overscroll-behavior-y: contain;
}
.col-empty { padding: 6px; font-size: 12.5px; color: var(--text-3); }
.col-body .card ~ .col-empty { display: none; }
.col-foot { flex: none; padding: 0 6px 6px; }
.add-task {
  display: flex; align-items: center; gap: 7px; width: 100%;
  height: 32px; padding: 0 8px;
  border: 0; border-radius: var(--r-sm); background: transparent;
  font-size: 13px; color: var(--text-3); cursor: pointer; text-align: left;
  transition: background-color .12s, color .12s;
}
.add-task:hover { background: var(--hover); color: var(--text); }
.col-foot .archive-done { display: none; }

.card {
  position: relative; flex: none;
  padding: 9px 11px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: border-color .12s, box-shadow .15s;
}
.card:hover { border-color: var(--line-2); }
.card:focus-visible { outline-offset: 1px; }
.card.is-open { border-color: var(--text-3); }
.card-title {
  font-size: 13.5px; font-weight: 520; line-height: 1.38; letter-spacing: -0.004em;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden;
}
.card-desc {
  margin-top: 3px;
  font-size: 12.5px; line-height: 1.42; color: var(--text-2);
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 9px;
  margin-top: 7px;
  font-size: 12px; line-height: 18px; color: var(--text-3);
}
.card-meta > span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.card-meta .icon { width: 13px; height: 13px; }
.card.is-done .card-title { color: var(--text-2); }
.prio-1 { color: var(--blue); }
.prio-2 { color: var(--orange); }
.prio-3 { color: var(--red); }
.card-meta .prio-label { font-weight: 550; }
.due { }
.due.is-overdue { color: var(--red); font-weight: 550; }
.due.is-today { color: var(--orange); font-weight: 550; }
.tag {
  padding: 0 6px; border-radius: 4px;
  background: var(--sunken); color: var(--text-2);
  font-size: 11.5px; line-height: 18px;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: inline-block;
}
.card-project { margin-left: auto; max-width: 100%; }
.card-project .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-project .dot { width: 7px; height: 7px; }

/* Glisser-déposer */
.card.is-placeholder { background: var(--active); border-color: transparent; box-shadow: none; }
.card.is-placeholder > * { visibility: hidden; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none; will-change: transform; }
.drag-ghost .card { border-color: var(--line-2); box-shadow: var(--shadow-lift); transition: none; }
.is-dragging, .is-dragging * { cursor: grabbing !important; }
.is-dragging .board { scroll-snap-type: none !important; }
.is-dragging .card:hover { border-color: var(--line); }

/* Composer de colonne */
.composer { display: grid; gap: 6px; }
.composer textarea {
  width: 100%; min-height: 60px; resize: none;
  padding: 8px 10px;
  border: 1px solid var(--focus); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--ring);
  font-size: 13.5px; line-height: 1.38; outline: none;
}
.composer-row { display: flex; align-items: center; gap: 6px; }
.composer-row .select { height: 28px; font-size: 12.5px; flex: 1; min-width: 0; }
.composer-row .btn { margin-left: auto; }

/* Onglets de colonnes (mobile) */
.col-tabs { display: none; }

/* État vide */
.empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px; text-align: center;
}
.empty-mark { width: 28px; height: 28px; color: var(--text-3); margin-bottom: 6px; }
.empty h2 { font-size: 15px; font-weight: 600; }
.empty p { max-width: 36ch; font-size: 13.5px; color: var(--text-2); margin-bottom: 10px; }

/* ── Panneau de tâche ───────────────────────────────────────── */

.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
  width: min(480px, 100vw);
  display: flex; flex-direction: column;
  background: var(--raised);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  animation: panel-in .22s var(--ease);
}
@keyframes panel-in { from { transform: translateX(14px); opacity: 0; } }
.panel-head { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 10px 0 20px; flex: none; }
.panel-back { display: none; }
.panel-crumb { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.panel-crumb .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-link { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--text-2); text-decoration: none; border-radius: 4px; }
.crumb-link:hover { color: var(--text); }
.crumb-link:hover .name { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.save-state { margin-left: auto; font-size: 12px; color: var(--text-3); transition: opacity .3s; }
.save-state.is-fading { opacity: 0; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 20px 20px; }
.title-input, .desc-input {
  display: block; width: 100%;
  margin: 0; padding: 4px 6px; margin-left: -6px; width: calc(100% + 12px);
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; resize: none; overflow: hidden;
  outline: none;
  transition: border-color .12s, background-color .12s;
}
.title-input { font-size: 19px; font-weight: 650; line-height: 1.3; letter-spacing: -0.018em; }
.desc-input { margin-top: 4px; min-height: 64px; font-size: 14px; line-height: 1.55; color: var(--text); }
.title-input:hover, .desc-input:hover { background: var(--sunken); }
.title-input:focus, .desc-input:focus { background: var(--surface); border-color: var(--line-2); }

.props {
  display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center;
  gap: 6px 12px;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.prop-label { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.prop-value { min-width: 0; display: flex; align-items: center; gap: 4px; min-height: 32px; }
.prop-value .select, .prop-value .input { height: 30px; font-size: 13px; }
.prop-value .select { color: var(--text); }
.date-value .input { width: auto; min-width: 150px; }
.segmented {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--sunken); border-radius: 7px;
}
.segmented button {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 7px;
  border: 0; border-radius: 5px; background: transparent;
  font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer;
  transition: background-color .12s, color .12s, box-shadow .12s;
}
.segmented button .icon { width: 13px; height: 13px; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card), 0 0 0 1px var(--line); }
.segmented button[data-p='0'] .icon { color: var(--text-3); }
.segmented button[data-p='1'] .icon { color: var(--blue); }
.segmented button[data-p='2'] .icon { color: var(--orange); }
.segmented button[data-p='3'] .icon { color: var(--red); }

.tag-field {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  width: 100%; min-height: 30px; padding: 3px 4px;
  border: 1px solid var(--line-2); border-radius: 7px;
  background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.tag-field:focus-within { border-color: var(--focus); box-shadow: var(--ring); }
.tag-field input { flex: 1; min-width: 90px; height: 22px; padding: 0 4px; border: 0; background: transparent; font-size: 13px; outline: none; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 2px;
  height: 22px; padding: 0 2px 0 7px; border-radius: 4px;
  background: var(--sunken); color: var(--text-2); font-size: 12px;
}
.tag-chip button {
  display: grid; place-items: center; width: 18px; height: 18px; padding: 0;
  border: 0; border-radius: 3px; background: transparent; color: var(--text-3); cursor: pointer;
}
.tag-chip button:hover { background: var(--active); color: var(--text); }
.tag-chip .icon { width: 11px; height: 11px; }

.panel-foot {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.panel-meta { flex: 1; min-width: 0; font-size: 12px; color: var(--text-3); }
.panel-actions { display: flex; gap: 6px; }

/* ── Menus, dialogues, toasts ───────────────────────────────── */

.menu {
  position: fixed; z-index: 80;
  min-width: 220px; padding: 4px;
  background: var(--raised);
  border: 1px solid var(--line); border-radius: 9px;
  box-shadow: var(--shadow-pop);
  animation: pop .12s var(--ease);
}
.menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  height: 32px; padding: 0 9px;
  border: 0; border-radius: var(--r-sm); background: transparent;
  font-size: 13px; text-align: left; cursor: pointer;
}
.menu button .icon { color: var(--text-3); }
.menu button:hover, .menu button:focus-visible { background: var(--hover); outline: none; }
.menu .danger, .menu .danger .icon { color: var(--red); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px -4px; }
@keyframes pop { from { opacity: 0; transform: translateY(-3px) scale(.985); } }

.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--raised); color: var(--text);
  box-shadow: var(--shadow-pop);
}
.dialog[open] { animation: pop .16s var(--ease); }
.dialog::backdrop { background: oklch(18% 0.01 265 / 0.38); }
.dialog form { display: grid; gap: 16px; padding: 20px; }
.dialog h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.014em; }
.dialog p { font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches legend { margin-bottom: 8px; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.swatch span {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px oklch(0% 0 0 / 0.08);
  transition: box-shadow .12s;
}
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--c); }
.swatch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 4px; }

.toasts {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 14px;
  min-height: 38px; padding: 6px 6px 6px 14px;
  background: var(--ink); color: var(--on-ink);
  border-radius: 9px; box-shadow: var(--shadow-pop);
  font-size: 13px; font-weight: 500;
  pointer-events: auto;
  animation: toast-in .22s var(--ease);
}
.toast:not(:has(button)) { padding-right: 14px; }
.toast.is-error { background: var(--red); color: oklch(99% 0 0); }
.toast button {
  height: 26px; padding: 0 9px; border: 0; border-radius: 6px;
  background: color-mix(in oklch, currentColor 14%, transparent); color: inherit;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.toast.is-leaving { opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ── Pages (archives, administration) ───────────────────────── */

.page { flex: 1; min-height: 0; overflow-y: auto; }
.page-inner { max-width: 920px; padding: 6px 16px 56px; }
.page-section + .page-section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.section-head h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.008em; }
.section-head .count { font-size: 12.5px; color: var(--text-3); }
.rows {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden;
}
.row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 7px 8px 7px 14px; }
.row + .row { border-top: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 520; }
.row-title .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { display: flex; align-items: center; gap: 6px; margin-top: 1px; font-size: 12px; color: var(--text-3); }
.row-sub .dot { width: 7px; height: 7px; }
.row-actions { display: flex; gap: 4px; flex: none; }
.muted-note { padding: 14px; font-size: 13px; color: var(--text-3); }

.settings { display: grid; }
.setting { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 12px 40px; padding: 22px 0; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting-intro h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.008em; margin-bottom: 4px; }
.setting-intro p { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.setting-body { display: grid; gap: 12px; align-content: start; max-width: 420px; }
.setting-body .btn { justify-self: start; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stats { display: grid; margin: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.stats div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 14px; font-size: 13px; }
.stats div + div { border-top: 1px solid var(--line); }
.stats dt { color: var(--text-2); }
.stats dd { margin: 0; font-weight: 550; }
.file-pick { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick .file-name { min-width: 0; font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ok-note { font-size: 13px; color: var(--green); }

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .toolbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'title new' 'tools tools'; }
  .tools { justify-content: flex-start; }
  .search { flex: 1 1 auto; width: auto; max-width: 320px; }
}

@media (max-width: 1160px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50;
    width: min(290px, 84vw);
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    transform: translateX(-100%);
    transition: transform .24s var(--ease), visibility 0s .24s;
    visibility: hidden;
    box-shadow: var(--shadow-pop);
  }
  .nav-open .sidebar { transform: none; visibility: visible; transition: transform .24s var(--ease); }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 45;
    background: oklch(15% 0.01 265 / 0.4);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .toolbar { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'menu title new' 'tools tools tools'; }
  .menu-btn { display: inline-grid; }
}

@media (max-width: 760px) {
  .toolbar {
    gap: 8px 6px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px 8px;
  }
  .view-title h1 { font-size: 16px; }
  .new-task { width: 36px; height: 36px; padding: 0; border-radius: 9px; }
  .new-task span { display: none; }
  .tools { flex-wrap: wrap; gap: 6px; padding-left: 4px; }
  .search { flex: 1 1 0; max-width: none; height: 36px; }
  .search kbd { display: none; }
  .filter-toggle { display: inline-flex; height: 36px; }
  .filters { display: none; width: 100%; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .filters.is-open { display: flex; }
  .filters .select { height: 34px; flex: none; }

  .col-tabs {
    display: flex; gap: 2px; flex: none;
    margin: 0 12px 8px; padding: 2px;
    background: var(--sunken); border-radius: 9px;
    overflow-x: auto; scrollbar-width: none;
  }
  .col-tabs::-webkit-scrollbar { display: none; }
  .col-tab {
    flex: 1 1 auto;
    display: flex; align-items: center; justify-content: center; gap: 5px;
    height: 32px; padding: 0 6px;
    border: 0; border-radius: 7px; background: transparent;
    font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; cursor: pointer;
  }
  .col-tab .status-icon { width: 13px; height: 13px; }
  .col-tab .n { color: var(--text-3); }
  .col-tab[aria-selected='true'] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-card), 0 0 0 1px var(--line); }
  .board {
    grid-auto-columns: calc(100% - 24px);
    gap: 8px; padding: 0 12px calc(12px + env(safe-area-inset-bottom));
    scroll-snap-type: x mandatory; scroll-padding: 0 12px;
    scrollbar-width: none;
  }
  .board::-webkit-scrollbar { display: none; }
  .col { scroll-snap-align: start; scroll-snap-stop: always; }
  .col-head { display: none; }
  .col-body { padding-top: 6px; }
  .col-foot .archive-done { display: flex; }

  .panel { width: 100vw; border-left: 0; animation-name: sheet-in; }
  @keyframes sheet-in { from { transform: translateY(18px); opacity: 0; } }
  .panel-head { padding: env(safe-area-inset-top) 8px 0 4px; height: calc(52px + env(safe-area-inset-top)); }
  .panel-back { display: inline-grid; }
  .panel-x { display: none; }
  .panel-body { padding: 4px 16px 20px; }
  .panel-foot { padding-left: 16px; padding-right: 16px; }
  .props { grid-template-columns: 84px minmax(0, 1fr); }
  .segmented button { padding: 0 8px; }
  .segmented button span { display: none; }
  .segmented button[aria-checked='true'] span { display: inline; }

  .setting { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .row { flex-wrap: wrap; }
  .page-inner { padding: 4px 12px 48px; }
}

@media (max-width: 420px) {
  .col-tab .status-icon { display: none; }
}

@media (pointer: coarse) {
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn.sm { width: 32px; height: 32px; }
  .nav-item { height: 40px; font-size: 15px; }
  .btn { height: 38px; }
  .btn-sm { height: 34px; }
  .add-task { height: 40px; font-size: 14px; }
  .card { padding: 11px 13px 12px; }
  .card-title { font-size: 15px; }
  .card-desc { font-size: 13.5px; }
  .card-meta { font-size: 13px; line-height: 20px; }
  .card-meta .icon { width: 14px; height: 14px; }
  .tag { font-size: 12.5px; line-height: 20px; }
  .input, .select, .search input, .composer textarea, .tag-field input, .title-input, .desc-input { font-size: 16px; }
  .title-input { font-size: 19px; }
  .prop-value .select, .prop-value .input { height: 36px; font-size: 16px; }
  .segmented button { height: 32px; }
  .menu button { height: 42px; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.select:disabled { opacity: .55; cursor: default; }
.select:disabled:hover { border-color: var(--line-2); }
.file-pick input:focus-visible + .btn { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── Sécurité : code 2FA, confirmation d'identité, journal ─── */

.login-hint { margin-top: -6px; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.code-input { height: 44px; font-size: 20px; font-weight: 550; letter-spacing: .32em; text-align: center; padding-left: calc(10px + .32em); }
.login .code-input { height: 48px; font-size: 22px; }

.unlock { display: grid; gap: 14px; width: min(360px, 100%); margin: 40px auto 0; }
.unlock-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--sunken); color: var(--text-2); }
.unlock h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.015em; }
.unlock p { font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.unlock .btn { margin-top: 4px; }

.admin-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 6px; padding: 6px 6px 6px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  font-size: 13px; color: var(--text-2);
}
.admin-bar > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.admin-bar .icon { color: var(--text-3); }
.admin-bar strong { color: var(--text); font-weight: 600; }

.status-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.status-dot.is-on { background: var(--green); }
.setting-note { margin-top: -6px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.setting-note code, .secret {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace; font-size: 12.5px;
  padding: 2px 6px; border-radius: 5px; background: var(--sunken); color: var(--text);
}
.secret { display: inline-block; margin-top: 4px; padding: 5px 8px; letter-spacing: .04em; user-select: all; overflow-wrap: anywhere; }
.setting-link { font-size: 13px; color: var(--text-2); text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.setting-link:hover { color: var(--text); }
.steps { display: grid; gap: 14px; margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.steps li::marker { color: var(--text-3); font-weight: 600; }
.qr { width: 176px; margin: 10px 0 8px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.totp-form { display: grid; gap: 12px; }
.totp-form .code-input { width: 180px; }
.setting-body.wide { max-width: 560px; }

.events .row { min-height: 46px; gap: 10px; }
.event-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--text-3); }
.event.is-ok .event-dot { background: var(--green); }
.event.is-fail .event-dot { background: var(--red); }
.event.is-fail .row-title { color: var(--red); }
.events .row-title { font-size: 13px; }
