:root {
  --bg: #f3f4f6; --surface: #ffffff; --surface-2: #f7f8fa;
  --sidebar: #f3f4f6; --sidebar-text: #1f2328; --sidebar-2: #6b7280; --sidebar-hover: #e6e8ec; --sidebar-active: #ffffff;
  --text: #1f2328; --text-2: #6b7280; --text-3: #9ca3af;
  --border: #e5e7eb; --border-soft: #eef0f3; --hover: #f4f5f7;
  --accent: #f06a6a; --primary: #4573d2; --primary-hover: #3b64bd; --danger: #d1395a; --done: #3fa37a;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 14px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, 0.16);
  --s-todo: #9ca3af; --s-doing: #4573d2; --s-stuck: #e8384f; --s-decide: #f1bd6c; --s-check: #9f8fef; --s-done: #3fa37a;
  --radius-lg: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111216; --surface: #1b1c21; --surface-2: #22242a;
    --sidebar: #111216; --sidebar-text: #ececef; --sidebar-2: #8b8f98; --sidebar-hover: #1f2126; --sidebar-active: #26282e;
    --text: #ececef; --text-2: #a1a4ad; --text-3: #6f737c;
    --border: #2e3038; --border-soft: #26282e; --hover: #23252b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    --s-todo: #7c818b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #111216; --surface: #1b1c21; --surface-2: #22242a;
    --sidebar: #111216; --sidebar-text: #ececef; --sidebar-2: #8b8f98; --sidebar-hover: #1f2126; --sidebar-active: #26282e;
    --text: #ececef; --text-2: #a1a4ad; --text-3: #6f737c;
    --border: #2e3038; --border-soft: #26282e; --hover: #23252b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    --s-todo: #7c818b;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }

.btn { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 5px 12px; line-height: 20px; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); }
.btn.complete { display: inline-flex; align-items: center; gap: 6px; }
.btn.complete.on { background: color-mix(in srgb, var(--done) 15%, transparent); border-color: var(--done); color: var(--done); }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: 6px; display: inline-flex; color: var(--text-2); }
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* Logo : pastille avec une coche */
.logo-mark {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: inline-block;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.2 8.4l2.5 2.5 5-5.4' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 70% no-repeat;
}
.logo-mark i { display: none; }
.logo-mark.big { width: 48px; height: 48px; }

/* Connexion */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--surface-2); }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border-radius: 12px; padding: 36px 32px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.login-card .logo-mark { align-self: center; margin-bottom: 6px; }
.login-card h1 { margin: 0; font-size: 26px; font-weight: 500; }
.login-card p { margin: 0 0 8px; color: var(--text-2); }
.login-card input { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; background: var(--surface); }
.login-card input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.error { color: var(--danger); min-height: 1.2em; }

/* Mise en page */
.app { display: flex; height: 100%; overflow: hidden; }
.sidebar {
  width: 240px; flex: none; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; overflow-y: auto; padding: 14px 8px calc(14px + env(safe-area-inset-bottom));
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 18px; font-weight: 600; font-size: 17px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left;
  padding: 6px 12px; border-radius: 6px; color: var(--sidebar-text); font-size: 14px;
}
.nav-item:hover { background: var(--sidebar-hover); }
.nav-item.active { background: var(--sidebar-active); }
.nav-item .count { margin-left: auto; color: var(--sidebar-2); font-size: 12px; }
.nav-item svg { flex: none; color: var(--sidebar-2); }
.nav-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; margin: 0 3px; }
.nav-act { margin-left: 4px; display: none; color: var(--sidebar-2); border-radius: 4px; padding: 2px; line-height: 0; }
.nav-act:hover { color: var(--sidebar-text); background: var(--sidebar-active); }
.nav-item:hover .nav-act { display: inline-flex; }
.nav-item:hover .count { display: none; }
.nav-act.show { display: inline-flex; font-size: 11px; line-height: 16px; padding: 1px 6px; margin-left: auto; border: 1px solid var(--sidebar-hover); }
.nav-item.archived .label { color: var(--sidebar-2); }
.nav-rename { flex: 1; min-width: 0; font: inherit; color: var(--sidebar-text); background: var(--sidebar); border: 1px solid var(--primary); border-radius: 4px; padding: 1px 6px; outline: none; }
.nav-toggle { border: 0; background: none; text-align: left; padding: 0; cursor: pointer; }
.nav-toggle:hover { color: var(--sidebar-text); }
.head-btn { margin-left: auto; flex: none; font-size: 13px; }
.page-head { flex: 1; }
.arch-badge { font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 50px; padding: 1px 8px; vertical-align: middle; }
@media (hover: none) { .nav-item .nav-act:not(.show) { display: none !important; } .nav-item .count { display: inline; } }
.nav-section { margin: 20px 12px 6px; font-size: 12px; font-weight: 500; color: var(--sidebar-2); }
.sidebar-foot { margin-top: auto; padding: 16px 12px 0; font-size: 12px; color: var(--sidebar-2); display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--sidebar-hover); }
.sidebar-foot button { border: 0; background: none; color: var(--sidebar-2); padding: 0; text-align: left; }
.sidebar-foot button:hover { color: var(--sidebar-text); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 24px 0; padding-top: max(18px, env(safe-area-inset-top)); }
.menu-btn { display: none; }
.page-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-icon { width: 36px; height: 36px; border-radius: 8px; flex: none; display: grid; place-items: center; color: #fff; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-head p { margin: 0; color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 760px; }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); padding: 0 24px; margin-top: 8px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 0 8px; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 24px; border-bottom: 1px solid var(--border-soft); }
.toolbar .search { border: 1px solid var(--border); border-radius: 50px; padding: 5px 14px; min-width: 200px; background: var(--surface); }
.toolbar .search:focus, .toolbar select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.toolbar select { border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; background: var(--surface); }
.toolbar label { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); font-size: 13px; }
.toolbar .total { color: var(--text-3); font-size: 13px; margin-left: auto; }
.content { flex: 1; overflow: auto; padding: 0 24px 60px; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

/* Liste */
.list { width: 100%; }
.row {
  display: grid; grid-template-columns: var(--grid, minmax(300px, 1fr) 170px 150px 130px 190px);
  border-bottom: 1px solid var(--border-soft); min-height: 37px;
}
.row > div { display: flex; align-items: center; padding: 0 8px; border-left: 1px solid var(--border-soft); min-width: 0; }
.row > div:first-child { border-left: 0; padding-left: 4px; }
.row.head { font-size: 12px; color: var(--text-2); min-height: 34px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.row.item:hover { background: var(--hover); }
.row.item .cell-title { gap: 8px; }
.title-input { flex: 1; min-width: 0; border: 1px solid transparent; background: transparent; border-radius: 4px; padding: 3px 6px; margin-left: -2px; text-overflow: ellipsis; }

.title-input:focus { border-color: var(--primary); outline: none; background: var(--surface); }
.row.done .title-input { color: var(--text-2); }
.open-btn { border: 0; background: none; color: var(--text-2); padding: 3px; border-radius: 4px; display: inline-flex; opacity: 0; flex: none; }
.row.item:hover .open-btn { opacity: 1; }
.open-btn:hover { background: var(--border-soft); color: var(--text); }
.owner-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; background: none; border-radius: 6px; padding: 3px 6px; margin-left: -6px; max-width: 100%; min-width: 0; text-align: left; }
.owner-btn::after {
  content: ""; width: 10px; height: 10px; flex: none; opacity: 0; transition: opacity .1s;
  background: currentColor; color: var(--text-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5l5 5 5-5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5l5 5 5-5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.owner-btn:hover::after, .row.item:hover .owner-btn::after { opacity: 1; }
.owner-btn:hover span:last-child { color: var(--text); }
.owner-btn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.owner-btn.unassigned span:last-child { color: var(--text-3); }
.owner-cell .owner-btn { max-width: 100%; }
.pop-search { border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; margin: 2px 2px 6px; background: var(--surface); }
.pop-search:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.people-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; min-width: 220px; }
.person-opt { align-items: center; gap: 8px; }
.person-opt.sel { background: var(--hover); font-weight: 500; }
.popover .opt.muted { color: var(--text-2); font-size: 13px; border-top: 1px solid var(--border-soft); border-radius: 0 0 6px 6px; margin-top: 2px; }
.sec-edit { opacity: 0; padding: 4px; }
.section-head:hover .sec-edit { opacity: 1; }
.head-edit { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.h1-input, .p-input { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 1px 6px; margin-left: -6px; min-width: 0; width: 100%; max-width: 760px; text-overflow: ellipsis; }
.h1-input { font-size: 20px; font-weight: 500; }
.p-input { font-size: 13px; color: var(--text-2); }

.h1-input:focus, .p-input:focus { border-color: var(--primary); outline: none; }
.head-edit .arch-badge { align-self: flex-start; }
@media (hover: none) { .open-btn, .sec-edit { opacity: 1; } }
.row.item .title { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.row.done .title { color: var(--text-2); }
.row.add input { border: 0; background: transparent; width: 100%; padding: 8px 0 8px 28px; outline: none; }
.row.add input::placeholder { color: var(--text-3); }
.row.add { border-bottom: 0; grid-template-columns: 1fr !important; }

/* Cellules de choix : couleur sur toute la cellule */
.row > div.fillcell { padding: 0; }
.fill {
  width: 100%; height: 100%; min-height: 36px; border: 0; padding: 0 8px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--sc) 10%, transparent);
}
.fill .status { --sc: inherit; max-width: 100%; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--sc) 26%, var(--surface)); }
.fill:hover { background: color-mix(in srgb, var(--sc) 17%, transparent); }
.fill.blank { background: transparent; }
.fill.blank:hover { background: var(--hover); }
.fill-grid { display: grid; gap: 4px; min-width: 180px; }
.fill-grid .fill { min-height: 34px; border-radius: 6px; justify-content: flex-start; }

/* En-têtes de colonnes */
.col-head { border: 0; background: none; color: var(--text-2); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 4px; margin-left: -6px; max-width: 100%; }
.col-head:hover { background: var(--hover); color: var(--text); }
.col-head svg { opacity: 0; flex: none; }
.col-head:hover svg { opacity: 1; }
.col-add { border: 0; background: none; color: var(--text-2); font-size: 18px; width: 28px; height: 28px; border-radius: 6px; line-height: 1; }
.col-add:hover { background: var(--hover); color: var(--text); }
.cell-input { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 4px; padding: 4px 6px; font-size: 13px; }

.cell-input:focus { border-color: var(--primary); outline: none; background: var(--surface); }
.cell-input.num { text-align: right; }
.date-cell { position: relative; display: flex; align-items: center; width: 100%; height: 100%; cursor: pointer; }
.date-cell input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.date-cell:hover { background: var(--hover); }

.pop-title { font-size: 12px; color: var(--text-2); padding: 6px 8px 2px; font-weight: 500; }
.pop-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 8px 4px 2px; }
.popover .opt.danger { color: var(--danger); }
.choice-editor { display: flex; flex-direction: column; gap: 4px; padding: 4px; min-width: 260px; max-height: 50vh; overflow-y: auto; }
.choice-row { display: flex; align-items: center; gap: 6px; }
.choice-row input { flex: 1; border: 1px solid var(--border); border-radius: 4px; padding: 5px 8px; background: var(--surface); }
.swatch-btn { width: 24px; height: 24px; border-radius: 4px; border: 0; flex: none; }

.check {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--text-3); background: transparent;
  display: inline-grid; place-items: center; padding: 0; flex: none; color: var(--text-3);
}
.check svg { opacity: 0; }
.check:hover { border-color: var(--done); color: var(--done); }
.check:hover svg { opacity: 1; }
.check.on { background: var(--done); border-color: var(--done); color: #fff; }
.check.on svg { opacity: 1; }

.section { margin-top: 18px; }
.section-head { display: flex; align-items: center; gap: 6px; padding: 6px 0; }
.section-head button { border: 0; background: none; display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px; border-radius: 6px; font-weight: 600; font-size: 16px; }
.section-head button:hover { background: var(--hover); }
.section-head .chev { transition: transform .15s; color: var(--text-2); }
.section.collapsed .chev { transform: rotate(-90deg); }
.section-head .meta { color: var(--text-3); font-size: 13px; }
.section-head .swatch { width: 8px; height: 8px; border-radius: 50%; background: var(--g); }
.section.collapsed .rows { display: none; }

.status {
  --sc: var(--s-todo);
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 50px; padding: 1px 10px 1px 8px;
  font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap;
  background: color-mix(in srgb, var(--sc) 18%, transparent); color: var(--text);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sc); }
.status:hover { background: color-mix(in srgb, var(--sc) 30%, transparent); }

.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: #1e1f21; font-size: 10px; font-weight: 600;
}
.avatar.none { border: 1px dashed var(--text-3); background: none; color: var(--text-3); }
.person { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.person span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.due { font-size: 13px; color: var(--text-2); }
.due.late { color: var(--danger); }
.due.soon { color: var(--done); }
.proj { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); min-width: 0; padding: 1px 8px; border-radius: 50px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.proj i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.proj span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--text-2); padding: 60px 0; text-align: center; }

/* Tableau (colonnes) */
.kanban { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding: 16px 0 12px; }
.kcol { flex: 0 0 280px; border-radius: 10px; background: var(--surface-2); }
.kcol-head { font-weight: 600; padding: 10px 12px 4px; display: flex; gap: 8px; align-items: center; }
.kcol-head .n { color: var(--text-3); font-weight: 400; }
.kcol-head::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sc); }
.kcol-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kcol.over { outline: 2px dashed var(--primary); outline-offset: -2px; }
.card {
  background: var(--surface); border-radius: 8px; padding: 12px; border: 1px solid var(--border);
  cursor: pointer; display: flex; flex-direction: column; gap: 10px;
}
.card:hover { border-color: var(--text-3); box-shadow: var(--shadow); }
.card .card-top { display: flex; gap: 8px; align-items: flex-start; }
.card .card-top .check { margin-top: 1px; }
.card .card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card.done .card-title { color: var(--text-2); }

/* Échéancier */
.agenda { padding-top: 8px; }
.agenda-day { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.agenda-date { color: var(--text-2); font-size: 12px; padding-top: 4px; text-transform: uppercase; letter-spacing: .03em; }
.agenda-date strong { display: block; color: var(--text); font-size: 22px; font-weight: 500; line-height: 1.1; letter-spacing: 0; }
.agenda-day.late .agenda-date, .agenda-day.late .agenda-date strong { color: var(--danger); }
.agenda-day.today .agenda-date strong { color: var(--accent); }
.agenda-list { display: flex; flex-direction: column; gap: 4px; }
.agenda-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.agenda-item:hover { background: var(--hover); }
.agenda-item .t { flex: 1; min-width: 0; }
.agenda-item .t small { display: block; color: var(--text-2); }

/* Popover statut */
.popover {
  position: fixed; z-index: 50; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg);
  padding: 6px; display: flex; flex-direction: column; gap: 2px; min-width: 180px; border: 1px solid var(--border);
}
.popover .opt { border: 0; background: none; text-align: left; padding: 6px 8px; border-radius: 6px; display: flex; }
.popover .opt:hover { background: var(--hover); }

/* Panneau de détail */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface);
  box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .2s ease; z-index: 40;
  display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); border-left: 1px solid var(--border);
}
.drawer.open { transform: none; }
.drawer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.drawer-head { padding: 18px 24px 6px; }
.drawer-head textarea { width: 100%; border: 1px solid transparent; border-radius: 6px; font-size: 22px; font-weight: 500; resize: none; padding: 4px 6px; margin-left: -6px; background: transparent; }
.drawer-head textarea:hover, .drawer-head textarea:focus { border-color: var(--border); outline: none; }
.drawer-body { padding: 4px 24px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.field { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 12px; min-height: 40px; }
.field > span { color: var(--text-2); font-size: 13px; }
.field input, .field select, .field textarea { border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; background: transparent; width: 100%; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--border); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); outline: none; }
.field.top { align-items: start; margin-top: 10px; }
.field.top > span { padding-top: 7px; }
.field textarea { min-height: 120px; resize: vertical; border-color: var(--border); }
.status-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.status-picks .status { opacity: .55; }
.status-picks .status.sel { opacity: 1; box-shadow: inset 0 0 0 1.5px var(--sc); }
.source-box { margin-top: 14px; background: var(--surface-2); border-radius: 8px; padding: 12px 14px; font-size: 13px; color: var(--text-2); }
.source-box code { color: var(--text); word-break: break-all; font-size: 12px; }
.drawer-foot { margin-top: auto; padding: 12px 24px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }

.scrim { display: none; }
.toast-undo { margin-left: 14px; border: 0; background: none; color: #8fb4ff; font-weight: 600; padding: 0; }
.toast-undo:hover { text-decoration: underline; }
.toast {
  display: flex; align-items: center;
  position: fixed; left: 24px; bottom: calc(24px + env(safe-area-inset-bottom));
  background: #1e1f21; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; box-shadow: var(--shadow-lg);
}

/* Mobile */
@media (max-width: 760px) {
  .sidebar {
    position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; transform: translateX(-105%); transition: transform .2s;
    padding-top: max(14px, env(safe-area-inset-top)); width: 270px;
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 12px 0; padding-top: max(10px, env(safe-area-inset-top)); gap: 6px; }
  .page-icon { width: 30px; height: 30px; }
  .page-head p { display: none; }
  .tabs { padding: 0 16px; }
  .toolbar { padding: 10px 16px; }
  .toolbar .search { flex: 1; min-width: 0; }
  .toolbar .total { display: none; }
  .content { padding: 0 12px 60px; }
  .list { min-width: 0 !important; }
  .row.head { display: none; }
  .row.item {
    grid-template-columns: 1fr auto !important; grid-template-areas: "title title" "meta due";
    padding: 10px 6px; gap: 6px 10px; min-height: 0;
  }
  .row.item > div { border: 0; padding: 0; }
  .row.item > .c-title { grid-area: title; align-items: flex-start; }
  .row.item > .c-title .check { margin-top: 1px; }
  .row.item .title { white-space: normal; }
  .p-input { display: none; }
  .h1-input { font-size: 18px; }
  .row.item > .c-source, .row.item > .cx { display: none; }
  .row.item { grid-template-areas: "title title" "meta due" "owner owner"; }
  .row.item > .c-owner { grid-area: owner; padding-left: 26px; }
  .row.item > .c-status { grid-area: meta; padding-left: 26px; }
  .row.item > .c-status .fill { min-height: 0; width: auto; padding: 0; background: none; }
  .row.item > .c-due { grid-area: due; justify-content: flex-end; }
  .row.item > .c-due .date-btn { min-height: 0; width: auto; }
  .list { min-width: 0 !important; }
  .field { grid-template-columns: 100px 1fr; }
  .agenda-day { grid-template-columns: 56px 1fr; }
  .drawer-head, .drawer-body { padding-left: 16px; padding-right: 16px; }
}

/* Vues et outils de vue */
.tab-wrap { display: inline-flex; align-items: center; gap: 2px; border-bottom: 2px solid transparent; }
.tab-wrap.active { border-bottom-color: var(--text); }
.tab-wrap .tab { border-bottom: 0; }
.tab-ic { font-size: 12px; color: var(--text-3); margin-right: 2px; }
.tab-menu { border: 0; background: none; color: var(--text-2); padding: 3px; border-radius: 4px; display: inline-flex; }
.tab-menu:hover { background: var(--hover); color: var(--text); }
.tab-add { font-size: 17px; line-height: 1; color: var(--text-3); padding: 6px 6px 6px; }
.tab-add:hover { color: var(--text); }
.tool { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: none; color: var(--text-2); border-radius: 6px; padding: 4px 8px; font-size: 13px; }
.tool:hover { background: var(--hover); color: var(--text); }
.tool.on { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.tool-pop { display: flex; flex-direction: column; gap: 4px; min-width: 300px; max-width: min(560px, calc(100vw - 32px)); }
.rule { display: flex; gap: 6px; align-items: center; padding: 2px 4px; flex-wrap: wrap; }
.rule select, .rule input { border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; background: var(--surface); font-size: 13px; max-width: 180px; }
.pop-empty { margin: 4px 8px; color: var(--text-3); font-size: 13px; }
.check-opt { gap: 8px; align-items: center; cursor: pointer; font-size: 14px; }
.popover .opt.sel { font-weight: 500; }

/* Cellule date et calendrier */
.date-btn { width: 100%; height: 100%; min-height: 36px; border: 0; background: none; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px; text-align: left; }
.date-btn .cal-ic { color: var(--text-3); opacity: 0; display: inline-flex; flex: none; }
.row.item:hover .date-btn .cal-ic, .date-btn:focus-visible .cal-ic { opacity: 1; }
.date-btn:hover .cal-ic { color: var(--text); }
.cal { padding: 4px; width: 252px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 8px; }
.cal-head strong { font-weight: 500; }
.cal-head .icon-btn { font-size: 18px; line-height: 1; padding: 2px 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--text-3); padding-bottom: 4px; }
.cal-day { border: 0; background: none; border-radius: 50%; width: 32px; height: 32px; justify-self: center; font-size: 13px; }
.cal-day:hover { background: var(--hover); }
.cal-day.today { color: var(--accent); font-weight: 600; }
.cal-day.sel { background: var(--primary); color: #fff; }
.cal-quick { display: flex; flex-direction: column; border-top: 1px solid var(--border-soft); margin-top: 8px; padding-top: 4px; }
@media (hover: none) { .date-btn .cal-ic { opacity: .6; } }

/* Sections */
.add-section { margin: 22px 0 8px; border: 0; background: none; color: var(--text-2); font-weight: 500; font-size: 15px; padding: 6px 4px; border-radius: 6px; }
.add-section:hover { color: var(--text); background: var(--hover); }
.drag-handle { color: var(--text-3); opacity: 0; cursor: grab; display: inline-flex; padding: 2px 1px; margin-left: -12px; flex: none; }
.row.item:hover .drag-handle { opacity: 1; }
.section.over { outline: 2px dashed var(--primary); outline-offset: 2px; border-radius: 6px; }
@media (hover: none) { .drag-handle { display: none; } }

/* Déplacement des projets */
.nav-item.dragging { opacity: .4; }
.nav-item.drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.nav-item.drop-after { box-shadow: inset 0 -2px 0 var(--primary); }
.nav-section.drop-into { color: var(--sidebar-text); box-shadow: inset 0 -2px 0 var(--primary); }

/* --- DA claire et aérée : fond gris doux, panneau principal blanc arrondi --- */
body { background: var(--bg); }
.sidebar { background: var(--sidebar); padding-left: 10px; padding-right: 10px; }
.nav-item { border-radius: 8px; }
.nav-item.active { background: var(--sidebar-active); box-shadow: var(--shadow); font-weight: 500; }
.nav-item .dot { border-radius: 50%; width: 9px; height: 9px; }
.nav-act:hover { background: var(--sidebar-hover); }
.nav-act.show { border-color: var(--border); }
.sidebar-foot { border-top-color: var(--border); }
.main { margin: 10px 10px 10px 0; border-radius: var(--radius-lg); border: 1px solid var(--border-soft); box-shadow: var(--shadow); background: var(--surface); }
.topbar { padding: 22px 28px 0; }
.tabs { padding: 0 28px; border-bottom-color: var(--border-soft); }
.toolbar { padding: 12px 28px; border-bottom: 0; }
.content { padding: 0 28px 60px; }
.page-icon { border-radius: 10px; }
.toolbar .search { background: var(--surface-2); border-color: var(--border-soft); }
.tool { border-radius: 8px; }
.list { border: 1px solid var(--border-soft); border-radius: 12px; overflow: hidden; background: var(--surface); }
.row.head { background: var(--surface-2); }
.section { margin-top: 0; }
.section-head { padding: 12px 8px 6px; }
.section-head button { font-size: 15px; }
.row.item:hover { background: var(--surface-2); }
.status { border-radius: 6px; padding: 1px 8px 1px 7px; font-size: 12px; }
.proj { border-radius: 6px; }
.fill .status { background: color-mix(in srgb, var(--sc) 22%, var(--surface)); }
.kcol { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 14px; }
.card { border-radius: 12px; border-color: var(--border-soft); box-shadow: var(--shadow); }
.popover { border-radius: 12px; border-color: var(--border-soft); }
.drawer { border-radius: var(--radius-lg) 0 0 var(--radius-lg); border-left-color: var(--border-soft); }
.btn { border-radius: 8px; }
.login { background: var(--bg); }
.login-card { border-radius: 18px; border: 1px solid var(--border-soft); }
.theme-switch { display: flex; background: var(--sidebar-hover); border-radius: 8px; padding: 2px; margin-bottom: 6px; }
.theme-switch button { flex: 1; text-align: center !important; padding: 4px 0 !important; border-radius: 6px; font-size: 12px; color: var(--sidebar-2); }
.theme-switch button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pw-form { display: flex; flex-direction: column; gap: 8px; padding: 4px; min-width: 260px; }
.pw-form input { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.pw-form .error { margin: 0; font-size: 13px; min-height: 0; }
@media (max-width: 760px) {
  .main { margin: 0; border-radius: 0; border: 0; box-shadow: none; }
  .sidebar { background: var(--surface); }
  .topbar { padding: 10px 12px 0; }
  .tabs { padding: 0 16px; }
  .toolbar { padding: 10px 16px; }
  .content { padding: 0 12px 60px; }
  .list { border: 0; border-radius: 0; }
}
.tab-rename { font: inherit; font-weight: 500; padding: 4px 8px; margin: 4px 0; border: 1px solid var(--accent); border-radius: 6px; background: var(--surface); color: var(--text); outline: none; }
.col-menu { min-width: 250px; }
.opt.mi { display: flex; align-items: center; gap: 10px; }
.opt.mi svg { flex: none; color: var(--text-2); }
.opt.mi.danger svg { color: inherit; }
.pop-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.field-form { display: flex; flex-direction: column; gap: 8px; min-width: 260px; }
.field-form input, .field-form select { width: 100%; }
.nav-space { display: flex; align-items: center; justify-content: space-between; padding-right: 0; }
.nav-add { border: 0; background: none; color: var(--sidebar-2); width: 22px; height: 22px; border-radius: 6px; font-size: 17px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.nav-add:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.nav-empty { margin: 0 12px 4px; padding: 8px 10px; border: 1px dashed var(--border); border-radius: 8px; font-size: 12px; color: var(--sidebar-2); }
.nav-empty.drop-into { border-color: var(--primary); color: var(--sidebar-text); }
