/* =========================================================================
   Ocade Todo — styles
   Un socle commun + 5 designs (data-design sur <html> / #app) :
   atelier · nuit · tableau · agenda · pro
   Polices système uniquement (rapide, et fonctionne hors ligne).
   ========================================================================= */

:root, [data-design="atelier"] {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs: 15px;
  --bg: #f7f5f2;
  --sidebar-bg: #efebe5;
  --surface: #ffffff;
  --surface-2: #f3f0eb;
  --hover: rgba(60, 45, 20, .05);
  --border: #e4dfd7;
  --text: #24211d;
  --muted: #8b847a;
  --accent: #2b6f6a;
  --accent-soft: #dcebe8;
  --on-accent: #fff;
  --danger: #c8443b;
  --urgent: #d64545;
  --today: #2b6f6a;
  --late: #c8443b;
  --radius: 12px;
  --radius-sm: 8px;
  --row-py: 9px;
  --sidebar-w: 248px;
  --detail-w: 400px;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 6px 24px rgba(40, 30, 10, .07);
  --shadow-lg: 0 12px 48px rgba(30, 20, 0, .18);
  --max-w: 980px;
  color-scheme: light;
}

[data-design="nuit"] {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, sans-serif;
  --bg: #0e1015;
  --sidebar-bg: #12151b;
  --surface: #171a21;
  --surface-2: #1d212a;
  --hover: rgba(255, 255, 255, .045);
  --border: #262b36;
  --text: #e7e9ef;
  --muted: #858da1;
  --accent: #8aa4ff;
  --accent-soft: rgba(138, 164, 255, .14);
  --on-accent: #0e1015;
  --danger: #ff6b6b;
  --urgent: #ff6b6b;
  --today: #8aa4ff;
  --late: #ff7a7a;
  --radius: 14px;
  --sidebar-w: 68px;
  --detail-w: 560px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 8px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 70px rgba(0, 0, 0, .6);
  --max-w: 760px;
  color-scheme: dark;
}

[data-design="tableau"] {
  --bg: #eef1f6;
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f5fa;
  --hover: rgba(30, 60, 120, .05);
  --border: #dde3ec;
  --text: #1b2433;
  --muted: #7a8699;
  --accent: #3466f6;
  --accent-soft: #e3eafe;
  --today: #3466f6;
  --radius: 10px;
  --sidebar-w: 236px;
  --detail-w: 420px;
  --max-w: none;
}

[data-design="agenda"] {
  --bg: #fbfaf6;
  --sidebar-bg: #f4f1e9;
  --surface: #ffffff;
  --surface-2: #f6f3ec;
  --hover: rgba(90, 60, 20, .05);
  --border: #e8e2d4;
  --text: #2a2620;
  --muted: #8f8778;
  --accent: #d0603a;
  --accent-soft: #fae6dd;
  --today: #d0603a;
  --radius: 10px;
  --sidebar-w: 232px;
  --detail-w: 400px;
  --max-w: none;
}

[data-design="pro"] {
  --fs: 13.5px;
  --bg: #f5f6f8;
  --sidebar-bg: #eceef2;
  --surface: #ffffff;
  --surface-2: #f3f4f7;
  --hover: rgba(20, 30, 50, .045);
  --border: #dfe2e8;
  --text: #1c1f24;
  --muted: #747b88;
  --accent: #1f6feb;
  --accent-soft: #e2ecfd;
  --today: #1f6feb;
  --radius: 7px;
  --radius-sm: 5px;
  --row-py: 4px;
  --sidebar-w: 210px;
  --detail-w: 380px;
  --max-w: none;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

/* ---------- Socle ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: var(--fs)/1.45 var(--font);
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
input, select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="color"] { padding: 2px; width: 34px; height: 30px; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd {
  font: 600 11px/1 var(--font); padding: 3px 5px; border-radius: 5px; min-width: 18px; display: inline-block; text-align: center;
  background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; color: var(--muted);
}
code { font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
a { color: var(--accent); }
.ic { width: 18px; height: 18px; flex: none; }
.hint { color: var(--muted); font-size: .9em; }
.center { text-align: center; }
.scroll-y { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.scroll-x { overflow-x: auto; }
[hidden] { display: none !important; }

.boot { height: 100vh; display: grid; place-items: center; }
.boot-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite ease-in-out; }
@keyframes pulse { 50% { transform: scale(1.6); opacity: .4; } }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 600; white-space: nowrap;
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn.big { width: 100%; justify-content: center; padding: 12px; font-size: 1.05em; }
.btn.sm { padding: 5px 10px; font-size: .88em; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost.danger { background: transparent; color: var(--danger); }
.btn.icon-only { padding: 5px 7px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 24px; height: 24px; }
.icon-btn.sm .ic { width: 15px; height: 15px; }
.icon-btn.danger:hover { color: var(--danger); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.sw { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.sw[style*="transparent"] { box-shadow: inset 0 0 0 1.5px var(--muted); background: repeating-linear-gradient(45deg, transparent 0 2px, var(--border) 2px 3px); }
.sw.big { width: 16px; height: 16px; display: inline-block; vertical-align: middle; margin-right: 10px; }

/* ---------- Connexion ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 20% 0%, var(--accent-soft), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 18px; padding: 32px 28px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 1.5em; margin: 18px 0 14px; }
.auth-card form { display: grid; gap: 14px; }
.auth-card label { display: grid; gap: 6px; font-weight: 600; font-size: .92em; }
.auth-card input { padding: 11px 12px; font-size: 1em; }
.auth-card .links { text-align: center; font-size: .92em; color: var(--muted); }
.msg { color: var(--danger); min-height: 1em; margin: 12px 0 0; }
.msg.ok { color: var(--text); background: var(--accent-soft); padding: 10px 12px; border-radius: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.15em; letter-spacing: -.01em; }
.brand b { color: var(--accent); }
.logo { width: 30px; height: 30px; flex: none; }

/* ---------- Disposition générale ---------- */
#app {
  height: 100vh; height: 100dvh;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 0;
  transition: grid-template-columns .22s ease;
}
#app.has-detail { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--detail-w); }
#app.auth-mode, .auth-mode #app { display: block; }

#sidebar {
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
  padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; z-index: 30;
}
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 14px; }
.sb-close { display: none; }
#sidebar nav { display: grid; gap: 1px; }
.nav {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text); text-align: left; transition: background .12s;
}
.nav:hover { background: var(--hover); }
.nav.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .ic { color: var(--muted); }
.nav.on .ic { color: var(--accent); }
.nav .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .count { font-size: .8em; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav .sw { margin: 0 3px; }
.sb-sec { margin-top: 14px; display: grid; gap: 1px; }
.sb-title { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 4px 10px; font-size: .74em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.sb-empty { font-size: .82em; color: var(--muted); padding: 4px 10px; margin: 0; }
.sb-foot { margin-top: auto; padding-top: 14px; display: grid; gap: 1px; }
.sb-user { font-size: .8em; color: var(--muted); padding: 8px 10px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#scrim { display: none; }

#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#topbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; }
.burger { display: none; }
.search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 12px; color: var(--muted); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; background: transparent; padding: 7px 0; flex: 1; box-shadow: none !important; }
.design-switch { display: flex; gap: 2px; margin-left: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.design-switch button { width: 26px; height: 24px; border-radius: 999px; font-size: .8em; font-weight: 700; color: var(--muted); }
.design-switch button.on { background: var(--accent); color: var(--on-accent); }
.net { display: inline-flex; align-items: center; gap: 6px; font-size: .82em; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); white-space: nowrap; }
.net .ic { width: 15px; height: 15px; }
.net.on { color: #2e9e5b; }
.net.slow { color: #d48806; border-color: #f0d394; }
.net.off { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.net.sync .ic { animation: spin 1s linear infinite; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

#update-banner { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 14px; margin: 0 20px 8px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: .92em; }

#quickadd { padding: 0 20px 6px; max-width: calc(var(--max-w) + 40px); width: 100%; margin: 0 auto; }
.qa-box { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; box-shadow: var(--shadow); }
.qa-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.qa-plus { color: var(--accent); display: grid; }
#qa { flex: 1; border: 0; background: transparent; padding: 12px 0; font-size: 1.02em; box-shadow: none !important; }
.qa-kbd { opacity: .7; }
.qa-box:focus-within .qa-kbd { display: none; }
#qa-preview { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 4px 0; min-height: 0; }
#qa-preview:empty { padding: 0; }
.qa-title { font-weight: 600; margin-right: 4px; }

#view { flex: 1; padding: 6px 20px 120px; min-height: 0; }
#view > * { max-width: var(--max-w); margin-left: auto; margin-right: auto; }
.view-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 10px auto 12px; }
.view-h h1 { font-size: 1.6em; margin: 0; letter-spacing: -.02em; display: flex; align-items: center; }
.view-h .sub { margin: 2px 0 0; color: var(--muted); font-size: .9em; }
.view-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
h2.sec { font-size: .78em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px auto 6px; padding-left: 4px; }
h2.sec.late { color: var(--late); }
h2.sec.urgent { color: var(--urgent); }
.empty-msg { color: var(--muted); padding: 18px 8px; text-align: center; margin: 0; }

/* ---------- Groupes & lignes ---------- */
.group { margin-bottom: 14px; }
.group.empty { display: none; }
body.is-dragging .group.empty { display: block; }
body.is-dragging .group.empty .list { min-height: 42px; border: 1.5px dashed var(--border); border-radius: var(--radius-sm); }
.group-h { display: flex; align-items: center; gap: 8px; padding: 6px 8px; cursor: pointer; user-select: none; border-radius: var(--radius-sm); }
.group-h:hover { background: var(--hover); }
.group-h .gname { font-weight: 700; font-size: .92em; }
.group-h .count { color: var(--muted); font-size: .85em; }
.gchev { margin-left: auto; color: var(--muted); display: grid; transform: rotate(90deg); transition: transform .15s; }
.collapsed .gchev { transform: rotate(0); }
.gchev .ic { width: 15px; height: 15px; }

.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; }
.list:empty { display: none; }
.row {
  display: flex; align-items: center; gap: 6px; min-height: 40px;
  padding: var(--row-py) 8px var(--row-py) calc(4px + var(--depth) * var(--indent));
  border-radius: var(--radius-sm); position: relative; cursor: default; user-select: none;
  transition: background .1s;
}
.row:hover { background: var(--hover); }
.row.is-selected { background: var(--accent-soft); }
.row.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); } 100% { background: transparent; } }
.row .main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 2px; }
.row .title { overflow-wrap: anywhere; }
.parent-hint { color: var(--muted); font-size: .88em; }
.row.is-done .title { text-decoration: line-through; color: var(--muted); }
.row.is-urgent:not(.is-done) .title { font-weight: 600; }
.title-edit { flex: 1; padding: 4px 8px; min-width: 200px; }
.grip { display: grid; place-items: center; width: 18px; color: var(--muted); opacity: 0; cursor: grab; touch-action: none; margin-left: -4px; }
.grip .ic { width: 15px; height: 15px; }
.row:hover .grip, .legend-row:hover .grip { opacity: .8; }
.twisty, .twisty-sp { width: 18px; height: 22px; display: grid; place-items: center; color: var(--muted); flex: none; }
.twisty .ic { width: 14px; height: 14px; transition: transform .15s; }
.twisty.open .ic { transform: rotate(90deg); }

.check {
  width: 21px; height: 21px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--muted) 70%, transparent); flex: none;
  display: grid; place-items: center; color: transparent; transition: all .15s; background: var(--surface);
}
.check .ic { width: 13px; height: 13px; stroke-width: 3; }
.check:hover { border-color: var(--accent); color: color-mix(in srgb, var(--accent) 60%, transparent); }
.check[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.is-urgent .check:not([aria-checked="true"]) { border-color: var(--urgent); }
.check.sm { width: 17px; height: 17px; }
.check.sm .ic { width: 11px; height: 11px; }
.check.big { width: 26px; height: 26px; }
.check.static { cursor: default; }
.cdot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.cdot.empty { box-shadow: inset 0 0 0 1.5px var(--border); opacity: 0; }
.row:hover .cdot.empty, .row.is-selected .cdot.empty { opacity: 1; }
.cdot:hover { transform: scale(1.3); }
.flag, .arch { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; color: var(--muted); opacity: 0; flex: none; }
.flag .ic, .arch .ic { width: 16px; height: 16px; }
.row:hover .flag, .row:hover .arch, .row.is-selected .flag, .row.is-selected .arch { opacity: .75; }
.flag:hover, .arch:hover { background: var(--hover); opacity: 1 !important; }
.flag.on { opacity: 1; color: var(--urgent); }
.flag.on .ic { fill: var(--urgent); }
.row.is-done .arch { opacity: .75; }

.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .78em; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; white-space: nowrap; line-height: 1.6; }
.chip .ic { width: 12px; height: 12px; }
.chip.ic-only { padding: 1px 5px; }
.chip.now { color: var(--today); background: var(--accent-soft); font-weight: 600; }
.chip.late { color: var(--late); background: color-mix(in srgb, var(--late) 12%, transparent); font-weight: 600; }
.chip.urgent { color: var(--urgent); }
.chip.cat { color: var(--cc); background: color-mix(in srgb, var(--cc) 13%, transparent); font-weight: 600; }
.chip.prog { font-variant-numeric: tabular-nums; }
.chip .sw { width: 9px; height: 9px; }

.add-here { display: flex; align-items: center; gap: 6px; color: var(--muted); padding: 3px 10px; min-height: 26px; border-radius: var(--radius-sm); width: 100%; font-size: .9em; opacity: 0; transition: opacity .15s; }
.list:hover .add-here, .cards .add-here, .add-here:focus { opacity: 1; }
.add-here:hover { background: var(--hover); color: var(--accent); }
.add-here .ic { width: 15px; height: 15px; }
.inline-add { padding: 4px; }
.inline-add input { width: 100%; }

/* Glisser-déposer */
body.is-dragging, body.is-dragging * { user-select: none !important; cursor: grabbing !important; }
.dnd-hidden { display: none !important; }
.dnd-ghost {
  position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; opacity: .95;
  background: var(--surface) !important; box-shadow: var(--shadow-lg); border-radius: var(--radius-sm); padding-left: 10px !important;
  rotate: 1.2deg;
}
.dnd-ghost[data-count]::after { content: attr(data-count); position: absolute; right: -8px; top: -8px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 7px; }
.dnd-placeholder { height: 3px; border-radius: 3px; background: var(--accent); margin: 3px 8px; position: relative; transition: margin-left .08s; }
.dnd-placeholder::before { content: ""; position: absolute; left: -4px; top: -4px; width: 11px; height: 11px; border-radius: 50%; border: 2.5px solid var(--accent); background: var(--surface); }
.drop-over.day, .drop-over.cards { background: var(--accent-soft) !important; }

/* Fenêtre couleurs */
.pop { position: fixed; z-index: 500; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; display: grid; gap: 1px; }
.swatch-btn { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); text-align: left; color: var(--text) !important; }
.swatch-btn:hover { background: var(--hover); }
.swatch-btn.on { background: var(--accent-soft); font-weight: 600; }
.swatch-btn kbd { margin-left: auto; }
.swatch-btn .sw { width: 14px; height: 14px; }
.swatch-btn.link { color: var(--muted) !important; font-size: .9em; border-top: 1px solid var(--border); border-radius: 0; margin-top: 4px; padding-top: 9px; }

/* Toasts */
#toasts { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 900; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: #23262d; color: #f3f4f6; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .92em; animation: tin .2s ease; max-width: min(560px, 92vw); }
.toast button { color: #9fc4ff; font-weight: 700; padding: 2px 4px; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .25s; }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Panneau de détail ---------- */
#detail { background: var(--surface); border-left: 1px solid var(--border); min-width: 0; overflow-x: hidden; }
#app:not(.has-detail) #detail { visibility: hidden; }
.detail-inner { padding: 18px 20px 60px; display: grid; gap: 16px; min-width: 320px; }
.detail-empty { padding: 60px 30px; text-align: center; color: var(--muted); }
.detail-empty .ic { width: 40px; height: 40px; opacity: .5; }
.d-top { display: flex; align-items: flex-start; gap: 10px; }
.d-top .check { margin-top: 5px; }
.d-title { flex: 1; border: 0; background: transparent; font-size: 1.3em; font-weight: 650; resize: none; padding: 2px 4px; line-height: 1.3; overflow: hidden; box-shadow: none !important; }
.d-title:focus { background: var(--surface-2); }
.d-parent { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .88em; text-align: left; }
.d-parent .ic { width: 14px; height: 14px; }
.d-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border); font-size: .88em; }
.pill .ic { width: 15px; height: 15px; }
.pill:hover { background: var(--hover); }
.pill.on.urgent { color: var(--urgent); border-color: var(--urgent); background: color-mix(in srgb, var(--urgent) 10%, transparent); }
.pill.on.urgent .ic { fill: var(--urgent); }
.pill.danger:hover { color: var(--danger); border-color: var(--danger); }
.d-sec { display: grid; gap: 8px; }
.d-label { display: flex; align-items: center; gap: 7px; font-size: .78em; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.d-label .ic { width: 15px; height: 15px; }
.d-label .count { text-transform: none; letter-spacing: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { padding: 5px 11px; border-radius: 999px; font-size: .86em; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--text); border: 1.5px solid transparent; }
.swatch::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.swatch.on { background: var(--c); color: var(--fg); font-weight: 600; }
.swatch.on::before { background: var(--fg); }
.swatch.none { --c: var(--muted); background: var(--surface-2); }
.swatch.none.on { border-color: var(--text); background: var(--surface-2); color: var(--text); }
.swatch.none::before { display: none; }
.grid2 { grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 > div { display: grid; gap: 6px; align-content: start; }
.dt { display: flex; gap: 6px; }
.dt input[type="date"] { flex: 1.4; }
.dt input[type="time"] { flex: 1; }
.mini-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-btns button, .mini { font-size: .8em; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.mini-btns button:hover, .mini:hover { color: var(--accent); }
.mini-btns button:disabled { opacity: .4; }
.remind { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.remind-rep { font-size: .9em; color: var(--muted); }
.remind-rep input { width: 64px; padding: 4px 6px; }
.subs { display: grid; gap: 2px; }
.sub-row { display: flex; align-items: center; gap: 8px; padding: 4px 2px; }
.sub-row .t { cursor: pointer; flex: 1; }
.sub-row.is-done .t { text-decoration: line-through; color: var(--muted); }
.sub-add { border-style: dashed; }
.d-notes { min-height: 120px; resize: vertical; line-height: 1.5; }
.d-dates { display: grid; gap: 2px; color: var(--muted); font-size: .82em; border-top: 1px solid var(--border); padding-top: 12px; }

/* ---------- Tableau (colonnes) ---------- */
.board { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 20px; max-width: none !important; height: calc(100% - 70px); min-height: 400px; }
.col { flex: 0 0 290px; display: flex; flex-direction: column; max-height: 100%; background: var(--surface-2); border-radius: var(--radius); border-top: 4px solid var(--c); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; font-weight: 700; }
.col-h .count { color: var(--muted); font-weight: 500; font-size: .88em; margin-left: auto; }
.cards { display: flex; flex-direction: column; gap: 8px; padding: 6px 8px 10px; min-height: 60px; border-radius: 0 0 var(--radius) var(--radius); }
.card { background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 10px; display: grid; gap: 8px; cursor: grab; user-select: none; border: 1.5px solid transparent; }
.card:hover { border-color: var(--border); }
.card.is-selected { border-color: var(--accent); }
.card.is-done { opacity: .6; }
.card.is-done .title { text-decoration: line-through; }
.card.is-urgent { box-shadow: inset 3px 0 0 var(--urgent), var(--shadow); }
.card-top { display: flex; gap: 8px; align-items: flex-start; }
.card-top .title { flex: 1; font-weight: 550; }
.card .flag { opacity: 0; width: 22px; height: 22px; }
.card:hover .flag, .card .flag.on { opacity: 1; }
.card-subs { list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; gap: 3px; font-size: .9em; }
.row-mini { display: flex; gap: 7px; align-items: center; }
.row-mini.is-done span { text-decoration: line-through; color: var(--muted); }
.card-subs .more { color: var(--muted); font-size: .85em; }
.cards .add-here { opacity: .7; }

/* ---------- Calendrier ---------- */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; max-width: none !important; }
.cal-side h3 { font-size: .78em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 4px 4px 8px; }
.cal-side .row { min-height: 34px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.seg button { padding: 4px 10px; border-radius: 6px; font-size: .86em; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mh { background: var(--surface-2); text-align: center; font-size: .75em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 0; font-weight: 700; }
.day { background: var(--surface); min-height: 112px; display: flex; flex-direction: column; min-width: 0; transition: background .1s; }
.day.outside { background: var(--surface-2); }
.day.outside .dnum { opacity: .45; }
.day.we:not(.outside) { background: color-mix(in srgb, var(--surface) 92%, var(--surface-2)); }
.day-h { display: flex; align-items: center; gap: 4px; padding: 5px 6px 2px; }
.month .dname { display: none; }
.dnum { font-weight: 700; font-size: .85em; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.day.today .dnum { background: var(--today); color: var(--on-accent); }
.day-add { margin-left: auto; opacity: 0; color: var(--muted); display: grid; }
.day-add .ic { width: 15px; height: 15px; }
.day:hover .day-add { opacity: 1; }
.day-items { display: grid; gap: 2px; padding: 2px 4px 6px; align-content: start; flex: 1; max-height: 160px; }
.cal-item, .cal-ev { display: flex; align-items: center; gap: 5px; font-size: .78em; padding: 2px 5px; border-radius: 5px; min-width: 0; line-height: 1.35; }
.cal-item { background: color-mix(in srgb, var(--c) 15%, var(--surface)); box-shadow: inset 2.5px 0 0 var(--c); cursor: grab; }
.cal-item.is-selected { outline: 2px solid var(--accent); }
.cal-item.is-done .t { text-decoration: line-through; opacity: .6; }
.cal-item.is-urgent .t { color: var(--urgent); font-weight: 600; }
.cal-item .t, .cal-ev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item .check.sm { width: 14px; height: 14px; border-width: 1.5px; }
.cal-ev { color: var(--text); background: transparent; border: 1px dashed color-mix(in srgb, var(--c) 70%, transparent); }
.cal-ev::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week .day { border-radius: var(--radius); box-shadow: var(--shadow); min-height: 360px; }
.week .day-h { flex-direction: column; align-items: flex-start; padding: 8px 10px 4px; position: relative; }
.week .dname { font-size: .72em; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.week .dnum { font-size: 1.15em; width: 32px; height: 32px; margin-left: -4px; }
.week .day-add { position: absolute; right: 8px; top: 10px; }
.week .day-items { max-height: none; padding: 4px 6px 10px; }
.week .cal-item, .week .cal-ev { white-space: normal; font-size: .82em; padding: 4px 6px; }
.week .cal-item .t, .week .cal-ev { white-space: normal; }

/* ---------- Archives ---------- */
.arch-row { gap: 10px; }
.arch-row .btn { opacity: .85; }

/* ---------- Réglages ---------- */
.set-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px !important; position: sticky; top: -6px; background: var(--bg); padding: 8px 0; z-index: 2; }
.set-nav a { text-decoration: none; color: var(--muted); padding: 5px 11px; border-radius: 999px; font-size: .88em; border: 1px solid var(--border); background: var(--surface); }
.set-nav a:hover { color: var(--accent); }
.set-sec { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px !important; scroll-margin-top: 60px; }
.set-sec h2 { display: flex; align-items: center; gap: 9px; font-size: 1.1em; margin: 0 0 6px; }
.set-sec h2 .ic { color: var(--accent); }
.set-sec h3 { font-size: .95em; margin: 18px 0 6px; }
.set-sec .intro { color: var(--muted); margin: 0 0 14px; font-size: .92em; }
.designs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.design-card { text-align: left; display: grid; gap: 4px; padding: 10px; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); font-size: .86em; align-content: start; }
.design-card span:last-child { color: var(--muted); font-size: .92em; }
.design-card.on { border-color: var(--accent); background: var(--accent-soft); }
.design-thumb { height: 74px; border-radius: 8px; position: relative; overflow: hidden; margin-bottom: 6px; display: block; }
.design-thumb i { position: absolute; display: block; border-radius: 3px; }
.t-atelier { background: #f7f5f2; } .t-atelier i:nth-child(1) { left: 0; top: 0; bottom: 0; width: 24%; background: #efebe5; } .t-atelier i:nth-child(2) { left: 30%; right: 30%; top: 14%; height: 12%; background: #fff; box-shadow: 0 1px 3px #0002; } .t-atelier i:nth-child(3) { left: 30%; right: 30%; top: 32%; height: 46%; background: #fff; box-shadow: 0 1px 3px #0002; } .t-atelier i:nth-child(4) { right: 0; top: 0; bottom: 0; width: 25%; background: #fff; border-left: 2px solid #2b6f6a; }
.t-nuit { background: #0e1015; } .t-nuit i:nth-child(1) { left: 0; top: 0; bottom: 0; width: 9%; background: #171a21; } .t-nuit i:nth-child(2) { left: 26%; right: 26%; top: 14%; height: 12%; background: #1d212a; } .t-nuit i:nth-child(3) { left: 26%; right: 26%; top: 32%; height: 52%; background: #171a21; } .t-nuit i:nth-child(4) { left: 40%; top: 20%; width: 30%; height: 60%; background: #262b36; border: 1px solid #8aa4ff; }
.t-tableau { background: #eef1f6; } .t-tableau i:nth-child(1) { left: 0; top: 0; bottom: 0; width: 20%; background: #fff; } .t-tableau i:nth-child(2) { left: 25%; top: 12%; width: 22%; height: 76%; background: #f2f5fa; border-top: 3px solid #f2b705; } .t-tableau i:nth-child(3) { left: 51%; top: 12%; width: 22%; height: 56%; background: #f2f5fa; border-top: 3px solid #2e9e5b; } .t-tableau i:nth-child(4) { left: 77%; top: 12%; width: 22%; height: 66%; background: #f2f5fa; border-top: 3px solid #2f7de1; }
.t-agenda { background: #fbfaf6; } .t-agenda i:nth-child(1) { left: 0; top: 0; bottom: 0; width: 20%; background: #f4f1e9; } .t-agenda i:nth-child(2) { left: 24%; top: 12%; width: 30%; height: 76%; background: #fff; box-shadow: 0 1px 3px #0002; } .t-agenda i:nth-child(3) { left: 58%; top: 12%; width: 40%; height: 76%; background: repeating-linear-gradient(90deg, #fff 0 13%, #fbfaf6 13% 14.3%); box-shadow: 0 1px 3px #0002; } .t-agenda i:nth-child(4) { left: 64%; top: 30%; width: 10%; height: 10%; background: #d0603a; }
.t-pro { background: #f5f6f8; } .t-pro i:nth-child(1) { left: 0; top: 0; bottom: 0; width: 18%; background: #eceef2; } .t-pro i:nth-child(2) { left: 20%; top: 6%; width: 46%; height: 88%; background: repeating-linear-gradient(180deg, #fff 0 9%, #eef0f4 9% 10%); } .t-pro i:nth-child(3) { right: 0; top: 0; bottom: 0; width: 32%; background: #fff; border-left: 1px solid #dfe2e8; } .t-pro i:nth-child(4) { right: 6%; top: 10%; width: 20%; height: 8%; background: #1f6feb; }
.legend-list { display: grid; gap: 4px; margin-bottom: 12px; }
.legend-row { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: var(--radius-sm); background: var(--surface-2); }
.legend-row .grip { opacity: .6; cursor: grab; }
.legend-row.none { opacity: .85; }
.legend-name { flex: 1; }
.legend-name.static { padding: 8px 0; }
.legend-row .count { color: var(--muted); font-size: .85em; min-width: 20px; text-align: right; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input:not([type="color"]) { flex: 1; min-width: 180px; }
.stack-form { display: grid; gap: 10px; max-width: 420px; margin-bottom: 16px; }
.stack-form label { display: grid; gap: 4px; font-size: .9em; font-weight: 600; }
.stack-form .btn { justify-self: start; }
.form-row { margin: 8px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-row input[type="number"] { width: 70px; padding: 5px 8px; }
.hk-current kbd { font-size: 13px; padding: 4px 8px; margin-right: 3px; }
.hk-recorder input { width: 320px; text-align: center; font-weight: 600; }
.keys { columns: 2; padding-left: 18px; }
.keys li { margin: 3px 0; }
.copy { display: inline-block; cursor: copy; padding: 6px 10px; margin: 4px 0; }
.copy.block { display: block; }
.copy:hover { outline: 1px solid var(--accent); }
.token-box { background: var(--accent-soft); padding: 10px 14px; border-radius: var(--radius-sm); margin: 10px 0; }
.steps li { margin: 6px 0; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.cal-err { font-size: .8em; color: var(--muted); }
details summary { cursor: pointer; margin: 8px 0; }

/* =========================================================================
   Particularités de chaque design
   ========================================================================= */

/* 1. ATELIER — groupes en cartes, détail qui pousse la liste */
[data-design="atelier"] .group-h .gname { font-size: .95em; }
[data-design="atelier"] .list { border-top: 3px solid transparent; }
[data-design="atelier"] .view-h h1 { font-weight: 750; }

/* 2. NUIT — barre d'icônes qui s'ouvre au survol, liste centrée, détail en fenêtre */
[data-design="nuit"] #app, #app[data-design="nuit"] { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 0 !important; }
#app[data-design="nuit"] #sidebar { width: var(--sidebar-w); transition: width .18s ease, box-shadow .18s; overflow-x: hidden; position: relative; }
@media (min-width: 761px) {
  #app[data-design="nuit"] #sidebar:hover { width: 250px; box-shadow: var(--shadow-lg); }
  #app[data-design="nuit"] #sidebar:not(:hover) .lbl, #app[data-design="nuit"] #sidebar:not(:hover) .count, #app[data-design="nuit"] #sidebar:not(:hover) .sb-title .icon-btn { display: none; }
  #app[data-design="nuit"] #sidebar:not(:hover) .sb-title { height: 1px; background: var(--border); margin: 6px 10px; padding: 0; }
  #app[data-design="nuit"] #sidebar:not(:hover) .nav { justify-content: center; padding: 9px 0; }
  #app[data-design="nuit"] #sidebar:not(:hover) .sb-head { justify-content: center; padding: 4px 0 14px; }
}
#app[data-design="nuit"] #detail {
  position: fixed; left: 50%; top: 50%; width: min(var(--detail-w), 94vw); max-height: 88vh; transform: translate(-50%, -48%) scale(.98);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); z-index: 60; opacity: 0; pointer-events: none; transition: all .18s ease;
}
#app[data-design="nuit"].has-detail #detail { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); visibility: visible; }
#app[data-design="nuit"].has-detail #scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 55; backdrop-filter: blur(2px); }
#app[data-design="nuit"] .list { background: transparent; box-shadow: none; padding: 0; border-top: 1px solid var(--border); border-radius: 0; }
#app[data-design="nuit"] .row { border-radius: 10px; min-height: 44px; }
#app[data-design="nuit"] .qa-box { background: var(--surface-2); border-color: transparent; box-shadow: none; border-radius: 16px; }
#app[data-design="nuit"] #qa { padding: 15px 0; font-size: 1.08em; }
#app[data-design="nuit"] .view-h h1 { font-weight: 600; font-size: 1.9em; }
#app[data-design="nuit"] .group-h .gname { text-transform: uppercase; font-size: .76em; letter-spacing: .1em; color: var(--muted); }
#app[data-design="nuit"] .check { background: transparent; }
#app[data-design="nuit"] .toast { background: #e7e9ef; color: #0e1015; }
#app[data-design="nuit"] .toast button { color: #3046c9; }
#app[data-design="nuit"] .search, #app[data-design="nuit"] .design-switch, #app[data-design="nuit"] .net { background: var(--surface); }

/* 3. TABLEAU — colonnes, détail en tiroir par-dessus */
#app[data-design="tableau"], #app[data-design="tableau"].has-detail,
#app[data-design="agenda"], #app[data-design="agenda"].has-detail { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 0; }
#app[data-design="tableau"] #detail, #app[data-design="agenda"] #detail {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(var(--detail-w), 100vw); z-index: 60;
  box-shadow: var(--shadow-lg); transform: translateX(102%); transition: transform .22s ease; visibility: visible;
}
#app[data-design="tableau"].has-detail #detail, #app[data-design="agenda"].has-detail #detail { transform: none; }
#app[data-design="tableau"] #view { padding-right: 20px; }
#app[data-design="tableau"] #quickadd { max-width: 760px; margin-left: 0; }
#app[data-design="tableau"] #view > .view-h { max-width: none; }
#app[data-design="tableau"][data-view="all"] #view, #app[data-design="tableau"][data-view="cat"] #view { padding-bottom: 20px; display: flex; flex-direction: column; }
#app[data-design="tableau"][data-view="all"] .board, #app[data-design="tableau"][data-view="cat"] .board { flex: 1; height: auto; }
#app[data-design="tableau"] .nav.on { background: var(--accent); color: var(--on-accent); }
#app[data-design="tableau"] .nav.on .ic, #app[data-design="tableau"] .nav.on .count { color: var(--on-accent); }

/* 4. AGENDA — liste + semaine côte à côte */
#app[data-design="agenda"] #quickadd { max-width: none; }
#app[data-design="agenda"] #view > .view-h { max-width: none; }
.agenda-split { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(0, 1.5fr); gap: 16px; max-width: none !important; height: calc(100% - 70px); min-height: 480px; }
.agenda-list { padding-right: 4px; }
.agenda-week { display: flex; flex-direction: column; min-width: 0; gap: 8px; }
.aw-h { display: flex; gap: 6px; justify-content: flex-end; }
.agenda-week .week { flex: 1; gap: 6px; }
.agenda-week .week .day { min-height: 0; }
#app[data-design="agenda"][data-view="all"] #view { padding-bottom: 16px; }
#app[data-design="agenda"] .day.today { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
#app[data-design="agenda"] .view-h h1 { font-family: ui-serif, Georgia, "Times New Roman", serif; font-weight: 600; }

/* 5. PRO — dense, trois volets permanents */
#app[data-design="pro"], #app[data-design="pro"].has-detail { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--detail-w); }
#app[data-design="pro"] #detail { visibility: visible; }
#app[data-design="pro"] #topbar { padding: 6px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
#app[data-design="pro"] #quickadd { padding: 8px 14px 4px; max-width: none; }
#app[data-design="pro"] .qa-box { box-shadow: none; border-radius: var(--radius-sm); }
#app[data-design="pro"] #qa { padding: 8px 0; }
#app[data-design="pro"] #view { padding: 4px 14px 80px; }
#app[data-design="pro"] .view-h { margin: 6px 0 8px; }
#app[data-design="pro"] .view-h h1 { font-size: 1.25em; }
#app[data-design="pro"] .list { border-radius: var(--radius-sm); box-shadow: none; border: 1px solid var(--border); padding: 0; }
#app[data-design="pro"] .row { min-height: 32px; border-radius: 0; border-bottom: 1px solid var(--surface-2); }
#app[data-design="pro"] .row:last-of-type { border-bottom: 0; }
#app[data-design="pro"] .group { margin-bottom: 8px; }
#app[data-design="pro"] .group-h { padding: 3px 6px; }
#app[data-design="pro"] .group-h .gname { font-size: .82em; text-transform: uppercase; letter-spacing: .06em; }
#app[data-design="pro"] .row .main { flex-wrap: nowrap; }
#app[data-design="pro"] .row .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
#app[data-design="pro"] .chips { flex-wrap: nowrap; }
#app[data-design="pro"] .flag, #app[data-design="pro"] .arch { width: 24px; height: 24px; }
#app[data-design="pro"] .nav { padding: 5px 9px; }
#app[data-design="pro"] .check { width: 17px; height: 17px; border-radius: 5px; }
#app[data-design="pro"] .check .ic { width: 11px; height: 11px; }
#app[data-design="pro"] .detail-inner { padding: 14px 16px 40px; gap: 12px; min-width: 0; }
#app[data-design="pro"] .d-title { font-size: 1.12em; }

/* =========================================================================
   Téléphone et tablette étroite
   ========================================================================= */
@media (pointer: coarse) {
  .grip { opacity: .45; width: 22px; }
  .flag.on, .row.is-selected .flag, .row.is-selected .arch { opacity: 1; }
  .row { min-height: 46px; }
  .add-here { opacity: .8; }
  .day-add { opacity: .7; }
}
@media (max-width: 760px) {
  :root { --sidebar-w: 280px; }
  #app, #app.has-detail, #app[data-design] { display: block !important; grid-template-columns: none !important; }
  #main { height: 100%; }
  #sidebar {
    position: fixed !important; left: 0; top: 0; bottom: 0; width: min(290px, 84vw) !important; transform: translateX(-102%);
    transition: transform .24s ease; box-shadow: var(--shadow-lg); padding-top: max(14px, env(safe-area-inset-top));
  }
  #app.sidebar-open #sidebar { transform: none; }
  #app.sidebar-open #scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 25; }
  #app #sidebar .lbl, #app #sidebar .count { display: inline !important; }
  #app #sidebar .nav { justify-content: flex-start !important; padding: 10px 10px !important; }
  #app #sidebar .sb-title { height: auto !important; background: none !important; margin: 0 !important; padding: 0 6px 4px 10px !important; }
  .sb-close { display: inline-grid; }
  .burger { display: inline-grid; }
  #topbar { padding: max(8px, env(safe-area-inset-top)) 10px 8px; gap: 6px; }
  .search { max-width: none; }
  .design-switch { display: none; }
  .net .lbl { display: none; }
  .net { padding: 6px; }
  #quickadd, #view { padding-left: 10px; padding-right: 10px; }
  #app #detail {
    position: fixed !important; inset: 0 !important; width: 100% !important; max-height: none !important; border-radius: 0 !important;
    transform: translateY(102%) !important; transition: transform .25s ease !important; z-index: 70 !important; opacity: 1 !important; visibility: visible !important; left: 0 !important; top: 0 !important;
    padding-top: env(safe-area-inset-top); pointer-events: auto !important;
  }
  #app.has-detail #detail { transform: none !important; }
  #app.has-detail #scrim { display: none !important; }
  .detail-inner { min-width: 0; padding-bottom: 100px; }
  .grid2 { grid-template-columns: 1fr; }
  .view-h h1 { font-size: 1.35em; }
  .cal-wrap { grid-template-columns: 1fr; }
  .cal-side { order: 2; }
  .day { min-height: 74px; }
  .day-items { max-height: 90px; }
  .cal-item .check { display: none; }
  .month .cal-item, .month .cal-ev { font-size: .68em; padding: 1px 3px; }
  .week { grid-template-columns: 1fr; }
  .week .day { min-height: 0; }
  .agenda-split { grid-template-columns: 1fr; height: auto; }
  .agenda-week { display: none; }
  .board { height: auto; scroll-snap-type: x mandatory; }
  .col { flex-basis: 84vw; scroll-snap-align: start; }
  .keys { columns: 1; }
  .row .arch { display: none; }
  .title-edit { min-width: 0; }
  #toasts { bottom: max(16px, env(safe-area-inset-bottom)); }
}
#app[data-design="tableau"][data-view="all"] #view > *, #app[data-design="tableau"][data-view="cat"] #view > * { margin-left: 0; margin-right: 0; width: 100%; }
.agenda-split { grid-template-columns: minmax(300px, .85fr) minmax(0, 1.7fr); }
.agenda-week .cal-item .check { display: none; }
.agenda-week .cal-item, .agenda-week .cal-ev { font-size: .76em; padding: 3px 5px; }
.agenda-week .day-h { padding: 6px 8px 2px; }
@media (max-width: 1180px) and (min-width: 761px) {
  .agenda-split { grid-template-columns: 1fr; height: auto; }
  .agenda-week .week .day { min-height: 160px; }
}

/* Adaptation à la largeur réelle de la zone centrale */
#view { container-type: inline-size; container-name: view; }
@container view (max-width: 900px) {
  .cal-wrap { grid-template-columns: 1fr; }
  .cal-side { order: 2; }
  .agenda-split { grid-template-columns: 1fr; height: auto; }
  .agenda-week .week .day { min-height: 140px; }
}
@container view (max-width: 620px) {
  .month .cal-item .check { display: none; }
  .month .cal-item, .month .cal-ev { font-size: .68em; padding: 1px 3px; }
  .day { min-height: 80px; }
  .week { grid-template-columns: 1fr; }
}
/* Écran moyen : le détail passe en tiroir par-dessus pour garder la liste lisible */
@media (min-width: 761px) and (max-width: 1280px) {
  #app[data-design="atelier"], #app[data-design="atelier"].has-detail { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 0; }
  #app[data-design="atelier"] #detail {
    position: fixed; right: 0; top: 0; bottom: 0; width: min(var(--detail-w), 100vw); z-index: 60;
    box-shadow: var(--shadow-lg); transform: translateX(102%); transition: transform .22s ease; visibility: visible;
  }
  #app[data-design="atelier"].has-detail #detail { transform: none; }
  #app[data-design="pro"], #app[data-design="pro"].has-detail { --detail-w: 320px; }
}

/* ---------- Couleurs personnalisables de chaque design ---------- */
.theme-editor { margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.te-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.te-head h3 { margin: 0; font-size: 1em; }
.te-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.te-tabs button { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .85em; }
.te-tabs button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.theme-editor .hint { margin: 8px 0 12px; color: var(--muted); font-size: .88em; }
.te-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.te-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); cursor: pointer; }
.te-row.changed { border-color: var(--accent); }
.te-row input[type=color] { width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; flex: none; }
.te-row input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.te-row input[type=color]::-webkit-color-swatch { border: none; border-radius: 6px; }
.te-row span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.te-row b { font-weight: 600; font-size: .92em; }
.te-row small { color: var(--muted); font-size: .8em; }
.te-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- Administration des comptes ---------- */
.auth .contact { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: .9em; text-align: center; line-height: 1.5; }
.auth .contact a { color: var(--accent); font-weight: 600; }
.user-form { max-width: 640px; }
.user-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 620px) { .user-form { max-width: 640px; }
.user-form .two { grid-template-columns: 1fr; } }
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { flex: 1 1 200px; padding: 7px 10px; border-radius: 8px; color: var(--muted); font-size: .88em; }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.stack-form label.check-line { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.u-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.user-list { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.user-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.u-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.u-main small { color: var(--muted); font-size: .82em; }
.u-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: .72em; font-weight: 600; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }
.pill.warn { background: color-mix(in srgb, #d48806 16%, transparent); color: #b06f00; }
.pill.muted { background: var(--surface-2); color: var(--muted); }
