/* Vanta Note — style plat : aplats, un seul accent, angles serrés, typo système. */
:root {
  --bg: #efeeeb;
  --bg-2: #e4e2dd;
  --panel: #ffffff;
  --panel-2: #f6f5f2;
  --text: #1c1917;
  --muted: #6b6560;
  --line: #d6d3ce;
  --line-2: #c4c0b9;
  --accent: #b45309;
  --accent-text: #ffffff;
  --danger: #b91c1c;
  --ok: #15803d;
  --list-bg: #e7e5e0;
  --card-bg: #ffffff;
  --card-hover: #fafaf8;
  --shadow: 0 1px 0 rgba(0,0,0,.08);
  --topbar: #1c1917;
  --topbar-text: #f5f5f4;
  --radius: 3px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1a1917;
  --bg-2: #232120;
  --panel: #242220;
  --panel-2: #2c2a27;
  --text: #ece9e4;
  --muted: #9b958d;
  --line: #3a3733;
  --line-2: #4a4641;
  --accent: #e08a1f;
  --accent-text: #1a1917;
  --danger: #ef6b6b;
  --ok: #4ade80;
  --list-bg: #232120;
  --card-bg: #2e2c29;
  --card-hover: #35322e;
  --shadow: 0 1px 0 rgba(0,0,0,.4);
  --topbar: #111010;
  --topbar-text: #f5f5f4;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1917; --bg-2: #232120; --panel: #242220; --panel-2: #2c2a27; --text: #ece9e4; --muted: #9b958d;
    --line: #3a3733; --line-2: #4a4641; --accent: #e08a1f; --accent-text: #1a1917; --danger: #ef6b6b; --ok: #4ade80;
    --list-bg: #232120; --card-bg: #2e2c29; --card-hover: #35322e; --shadow: 0 1px 0 rgba(0,0,0,.4); --topbar: #111010;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100%; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::placeholder { color: var(--muted); opacity: .8; }
[hidden] { display: none !important; }

/* Boutons et champs */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); color: var(--text);
  white-space: nowrap;
}
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(127,127,127,.12); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn .ico { width: 16px; height: 16px; flex: none; }
.ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }

.input, textarea.input, select.input {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--panel); color: var(--text);
}
textarea.input { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--accent); outline: none; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--danger); font-size: 13px; margin: 6px 0 0; }

/* Barre du haut */
.topbar {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px;
  background: var(--topbar); color: var(--topbar-text); flex: none;
}
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .01em; color: var(--topbar-text); font-size: 15px; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand svg { width: 20px; height: 20px; }
.topbar .nav { display: flex; gap: 2px; margin-left: 8px; }
.topbar .nav a, .topbar .tbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--radius);
  color: var(--topbar-text); border: 0; background: transparent; opacity: .85;
}
.topbar .nav a:hover, .topbar .tbtn:hover { background: rgba(255,255,255,.1); text-decoration: none; opacity: 1; }
.topbar .nav a.active { background: rgba(255,255,255,.14); opacity: 1; }
.topbar .search { margin-left: auto; position: relative; width: 260px; max-width: 40vw; }
.topbar .search input {
  width: 100%; height: 30px; padding: 0 10px 0 30px; border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius);
  background: rgba(255,255,255,.08); color: var(--topbar-text);
}
.topbar .search input::placeholder { color: rgba(255,255,255,.55); }
.topbar .search .ico { position: absolute; left: 9px; top: 8px; opacity: .7; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; flex: none; text-transform: uppercase; user-select: none;
}
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatars { display: flex; }
.avatars .avatar { margin-left: -6px; border: 2px solid var(--panel); }
.avatars .avatar:first-child { margin-left: 0; }

/* Menus contextuels */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 200px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,.14);
  padding: 4px;
}
.menu.left { right: auto; left: 0; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 10px; border: 0; background: transparent; text-align: left; border-radius: 2px; color: var(--text); }
.menu button:hover, .menu a:hover { background: var(--panel-2); text-decoration: none; }
.menu .sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu .head { padding: 6px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }

/* Pages centrées */
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.page.narrow { max-width: 560px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel + .panel { margin-top: 16px; }
.panel h2 { margin-bottom: 12px; }

/* Authentification */
.auth { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth .box { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.auth .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-bottom: 20px; }
.auth .logo svg { width: 28px; height: 28px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { flex: 1; height: 36px; border: 0; background: transparent; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

/* Accueil : tableaux */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile {
  display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
  overflow: hidden; min-height: 96px; position: relative;
}
.tile:hover { text-decoration: none; border-color: var(--line-2); background: var(--panel-2); }
.tile .band { height: 6px; }
.tile .body { padding: 12px; }
.tile .title { font-weight: 600; font-size: 15px; display: flex; align-items: flex-start; gap: 6px; }
.tile .meta { color: var(--muted); font-size: 12px; margin-top: 8px; display: flex; gap: 12px; }
.tile .star { position: absolute; right: 8px; top: 12px; border: 0; background: transparent; color: var(--muted); padding: 4px; border-radius: 2px; }
.tile .star:hover { color: var(--accent); background: rgba(127,127,127,.12); }
.tile .star.on { color: var(--accent); }
.tile.new { display: flex; align-items: center; justify-content: center; border-style: dashed; color: var(--muted); font-weight: 600; background: transparent; cursor: pointer; }
.tile.new:hover { color: var(--text); border-color: var(--line-2); }
.section-title { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }

/* Tableau */
.board-view { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.board-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg-2);
  flex-wrap: wrap;
}
.board-head .swatch { width: 14px; height: 26px; border-radius: 2px; flex: none; }
.board-head .title-input {
  font-weight: 700; font-size: 17px; height: 32px; padding: 0 8px; border: 1px solid transparent; background: transparent; border-radius: var(--radius); max-width: 40vw;
}
.board-head .title-input:hover { border-color: var(--line-2); }
.board-head .title-input:focus { border-color: var(--accent); background: var(--panel); outline: none; }
.board-head .spacer { flex: 1; }
.board-head .btn.on { border-color: var(--accent); color: var(--accent); }
.filter-badge { background: var(--accent); color: var(--accent-text); font-size: 11px; border-radius: 9px; padding: 0 6px; font-weight: 700; }

.lists {
  flex: 1; display: flex; gap: 10px; align-items: flex-start; padding: 12px; overflow-x: auto; overflow-y: hidden; min-height: 0;
  scrollbar-width: thin;
}
.list {
  width: 272px; flex: none; max-height: 100%; display: flex; flex-direction: column;
  background: var(--list-bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.list.dragging { opacity: .4; }
.list.drop-before { box-shadow: -4px 0 0 var(--accent); }
.list.drop-after { box-shadow: 4px 0 0 var(--accent); }
.list-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 4px 10px; cursor: grab; }
.list-head .title {
  flex: 1; min-width: 0; font-weight: 600; height: 28px; padding: 0 6px; border: 1px solid transparent; background: transparent; border-radius: 2px;
  overflow: hidden; text-overflow: ellipsis;
}
.list-head .title:focus { border-color: var(--accent); background: var(--panel); outline: none; }
.list-head .count { color: var(--muted); font-size: 12px; padding: 0 4px; }
.cards { flex: 1; overflow-y: auto; padding: 2px 6px 6px; display: flex; flex-direction: column; gap: 6px; min-height: 8px; scrollbar-width: thin; }
.card {
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; cursor: pointer;
  box-shadow: var(--shadow); position: relative;
}
.card:hover { background: var(--card-hover); border-color: var(--line-2); }
.card.dragging { opacity: .35; }
.card.done .title { text-decoration: line-through; color: var(--muted); }
.card .labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.card .labels span { height: 8px; width: 36px; border-radius: 2px; }
.card .labels span.named { height: auto; width: auto; padding: 0 6px; font-size: 11px; font-weight: 600; color: #fff; line-height: 18px; }
.card .title { word-wrap: break-word; }
.card .badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; color: var(--muted); font-size: 12px; }
.card .badges .b { display: inline-flex; align-items: center; gap: 3px; }
.card .badges .b.ok { color: var(--ok); }
.card .badges .due { padding: 1px 5px; border-radius: 2px; }
.card .badges .due.late { background: var(--danger); color: #fff; }
.card .badges .due.soon { background: #ca8a04; color: #fff; }
.card .badges .due.done { background: var(--ok); color: #fff; }
.card .badges .avatars { margin-left: auto; }
.card .badges .avatars .avatar { border-color: var(--card-bg); }
.card-placeholder { height: var(--ph, 60px); border: 1px dashed var(--line-2); border-radius: var(--radius); background: rgba(127,127,127,.08); }
.list-foot { padding: 4px 6px 6px; }
.list-foot .add { width: 100%; justify-content: flex-start; color: var(--muted); border-color: transparent; background: transparent; }
.list-foot .add:hover { background: rgba(127,127,127,.12); color: var(--text); }
.composer textarea.input { min-height: 60px; margin-bottom: 6px; background: var(--card-bg); }
.add-list { width: 272px; flex: none; }
.add-list .btn { width: 100%; justify-content: flex-start; background: rgba(127,127,127,.1); border-color: transparent; color: var(--muted); }
.add-list .btn:hover { color: var(--text); }
.add-list .composer { background: var(--list-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; }
.add-list .composer .input { margin-bottom: 6px; }

/* Panneau latéral */
.side {
  position: fixed; top: 46px; right: 0; bottom: 0; width: 340px; max-width: 100vw; background: var(--panel); border-left: 1px solid var(--line);
  z-index: 40; display: flex; flex-direction: column; box-shadow: -4px 0 12px rgba(0,0,0,.08);
}
.side .side-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.side .side-head h2 { flex: 1; text-align: center; font-size: 14px; }
.side .side-body { flex: 1; overflow-y: auto; padding: 12px; }
.side h3 { margin: 14px 0 8px; }
.side h3:first-child { margin-top: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches button { width: 36px; height: 26px; border: 2px solid transparent; border-radius: var(--radius); padding: 0; }
.swatches button.on { border-color: var(--text); }
.label-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.label-row .chip { flex: 1; }
.chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: var(--radius); color: #fff; font-weight: 600; font-size: 12px; }
.chip.pick { cursor: pointer; border: 2px solid transparent; opacity: .55; }
.chip.pick.on { opacity: 1; border-color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.member-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; }
.member-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row .role { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.activity li:last-child { border-bottom: 0; }
.activity .who { font-weight: 600; }
.activity .when { color: var(--muted); font-size: 12px; margin-left: 4px; }
.activity .cardref { color: var(--accent); cursor: pointer; }

/* Fenêtre carte */
.overlay { position: fixed; inset: 0; background: rgba(20,18,16,.55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; overflow-y: auto; }
.modal { width: 100%; max-width: 780px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.modal.sm { max-width: 440px; padding: 20px; }
.modal-head { display: flex; align-items: flex-start; gap: 8px; padding: 16px 16px 8px; }
.modal-head .title-input { flex: 1; font-weight: 700; font-size: 18px; min-height: 34px; padding: 4px 8px; border: 1px solid transparent; background: transparent; border-radius: var(--radius); resize: none; overflow: hidden; line-height: 1.3; }
.modal-head .title-input:hover { border-color: var(--line-2); }
.modal-head .title-input:focus { border-color: var(--accent); outline: none; }
.modal-sub { padding: 0 16px 12px 24px; color: var(--muted); font-size: 13px; }
.modal-body { display: grid; grid-template-columns: 1fr 180px; gap: 20px; padding: 0 16px 20px; }
.modal-main > section { margin-bottom: 20px; }
.modal-main h3 { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.modal-main h3 .ico { width: 14px; height: 14px; }
.modal-aside h3 { margin: 0 0 6px; }
.modal-aside .btn { width: 100%; justify-content: flex-start; margin-bottom: 6px; }
.modal-aside .group { margin-bottom: 16px; }
.desc-view { white-space: pre-wrap; word-wrap: break-word; padding: 8px 10px; background: var(--panel-2); border-radius: var(--radius); cursor: text; min-height: 40px; }
.desc-view.empty { color: var(--muted); }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 6px 0 8px; }
.progress span { display: block; height: 100%; background: var(--accent); }
.progress span.full { background: var(--ok); }
.check-item { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; }
.check-item input[type="checkbox"] { margin-top: 3px; accent-color: var(--accent); }
.check-item .text { flex: 1; word-wrap: break-word; }
.check-item.done .text { text-decoration: line-through; color: var(--muted); }
.check-item .del { opacity: 0; }
.check-item:hover .del { opacity: 1; }
.comment { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment .body { flex: 1; min-width: 0; }
.comment .body .who { font-weight: 600; }
.comment .body .when { color: var(--muted); font-size: 12px; margin-left: 6px; }
.comment .body p { margin: 2px 0 0; white-space: pre-wrap; word-wrap: break-word; }
.due-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.due-row input[type="datetime-local"] { width: auto; }
.done-toggle { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); }
.done-toggle.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.done-toggle input { accent-color: #fff; }
.pick-list { display: flex; flex-direction: column; gap: 4px; }
.pick-list button { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-align: left; }
.pick-list button.on { border-color: var(--accent); }
.pick-list button .check { margin-left: auto; color: var(--accent); }

/* Tableaux de données (admin) */
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
table.data tr:last-child td { border-bottom: 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 36px; height: 20px; appearance: none; background: var(--line-2); border-radius: 10px; position: relative; margin: 0; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .12s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 18px; }
.tag { display: inline-block; padding: 0 6px; border-radius: 2px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.tag.admin { color: var(--accent); border-color: var(--accent); }

/* Recherche */
.result { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); margin-bottom: 8px; }
.result:hover { text-decoration: none; background: var(--panel-2); }
.result .path { color: var(--muted); font-size: 12px; }

/* Notifications */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: var(--topbar); color: var(--topbar-text); padding: 8px 14px; border-radius: var(--radius); font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.toast.error { background: var(--danger); color: #fff; }

.empty { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 0 4px; border: 1px solid var(--line-2); border-radius: 2px; background: var(--panel-2); }

@media (max-width: 720px) {
  .topbar .nav { display: none; }
  .topbar .search { width: 160px; }
  .modal-body { grid-template-columns: 1fr; }
  .modal-aside { display: flex; flex-wrap: wrap; gap: 6px; }
  .modal-aside .group { display: contents; }
  .modal-aside h3 { display: none; }
  .modal-aside .btn { width: auto; margin: 0; }
  .side { width: 100vw; }
  .overlay { padding: 12px 8px; }
  .board-head .title-input { max-width: 60vw; }
}
