html, body { height: 100%; margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

/* ── Variables de thème (toutes les couleurs custom de l'app) ────────────── */
:root {
    --board-bg:          #E9EBF8;
    --board-dot:         rgba(99,102,241,.2);
    --board-loading-bg:  rgba(233,235,248,.82);
    --board-muted:       #8A90B4;

    --group-bg:          rgba(255,255,255,.55);
    --group-header-bg:   rgba(255,255,255,.82);
    --group-border:      #BEC5D8;
    --group-name-col:    #252D4A;
    --group-count-col:   #6E7592;
    --group-handle-col:  #9AA3B8;
}
html.dark {
    --board-bg:          #0D0F1C;
    --board-dot:         rgba(255,255,255,.045);
    --board-loading-bg:  rgba(8,10,20,.85);
    --board-muted:       rgba(255,255,255,.32);

    --group-bg:          rgba(255,255,255,.04);
    --group-header-bg:   rgba(255,255,255,.07);
    --group-border:      rgba(255,255,255,.1);
    --group-name-col:    #CBD5E1;
    --group-count-col:   #94A3B8;
    --group-handle-col:  #3D4663;
}

/* ---------- Pages simples ---------- */
.auth-wrap { min-height: calc(100vh - 48px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; }
.google-btn { min-height: 44px; display: flex; justify-content: center; }
.projects-wrap { max-width: 1200px; margin: 0 auto; padding: 24px; }
.project-card { cursor: pointer; height: 100%; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.project-card:hover { transform: translateY(-2px); }
.project-card .mud-card-content { flex: 1; }

/* ---------- Tableau ---------- */
.board-page { height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; }
.board-toolbar { gap: 6px; flex-wrap: nowrap; border-bottom: 1px solid var(--mud-palette-lines-default); background: var(--mud-palette-surface); z-index: 2; overflow-x: auto; }
.board-toolbar .project-title { font-weight: 600; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.quick-add { min-width: 240px; max-width: 320px; }
.swatches { display: flex; gap: 4px; align-items: center; }
.swatch { width: 20px; height: 20px; border-radius: 4px; border: 1px solid rgba(0,0,0,.18); cursor: pointer; padding: 0; transition: transform .1s; }
.swatch:hover { transform: scale(1.15); }
.swatch.active { outline: 2.5px solid var(--mud-palette-primary); outline-offset: 2px; }
.swatch.lg { width: 28px; height: 28px; border-radius: 6px; }
.zoom-label { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.board-viewport {
    position: relative; flex: 1; overflow: hidden; outline: none; cursor: default;
    background-color: var(--board-bg);
    background-image: radial-gradient(circle, var(--board-dot) 1px, transparent 1.2px);
    touch-action: none; user-select: none;
}
.board-viewport.can-pan  { cursor: grab; }
.board-viewport.panning  { cursor: grabbing; }
.board-world   { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
.board-overlay { position: absolute; inset: 0; pointer-events: none; }
.marquee { position: absolute; border: 1.5px solid var(--mud-palette-primary); background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent); border-radius: 2px; }
.board-empty   { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; color: var(--board-muted); text-align: center; }
.board-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--board-loading-bg); z-index: 5; }
.board-help    { position: absolute; right: 12px; bottom: 10px; font-size: 12px; color: var(--board-muted); pointer-events: none; }

/* Groupe */
.group-frame {
    position: absolute; z-index: 0; box-sizing: border-box;
    border: 2px dashed var(--group-color, var(--group-handle-col)); border-radius: 16px;
    background: var(--group-bg);
    transition: border-color .15s, background-color .15s;
}
.group-frame.drop-target {
    border-color: var(--mud-palette-primary); border-style: solid;
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
}
.group-frame.dragging { opacity: .85; }
.group-header {
    position: absolute; left: 0; right: 0; top: 0; height: 38px; padding: 0 4px 0 12px;
    display: flex; align-items: center; gap: 6px; cursor: move;
    border-bottom: 1px solid var(--group-border); border-radius: 14px 14px 0 0;
    background: var(--group-header-bg);
}
.group-dot  { width: 9px; height: 9px; border-radius: 50%; flex: none; border: 1.5px solid rgba(255,255,255,.8); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.group-name { font-weight: 600; font-size: 13.5px; color: var(--group-name-col); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.group-count { font-size: 12px; color: var(--group-count-col); }
.group-resize {
    position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize;
    background: linear-gradient(135deg,
        transparent 50%,
        var(--group-handle-col) 50%, var(--group-handle-col) 60%, transparent 60%,
        transparent 70%, var(--group-handle-col) 70%, var(--group-handle-col) 80%, transparent 80%);
    border-radius: 0 0 14px 0;
}

/* Pastille groupe sur post-it */
.group-badge {
    position: absolute; top: 6px; right: 6px; width: 9px; height: 9px;
    border-radius: 50%; border: 1.5px solid rgba(255,255,255,.8);
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

/* Post-it */
.postit {
    position: absolute; box-sizing: border-box; padding: 10px 12px 8px; border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 4px 14px rgba(0,0,0,.09);
    display: flex; flex-direction: column; gap: 4px; cursor: grab; overflow: hidden;
    transition: box-shadow .15s, transform .1s;
}
.postit:hover { box-shadow: 0 2px 6px rgba(0,0,0,.13), 0 8px 24px rgba(0,0,0,.13); transform: translateY(-1px); }
.postit.selected { outline: 2.5px solid var(--mud-palette-primary); outline-offset: 2px; }
.postit.dragging { cursor: grabbing; box-shadow: 0 12px 32px rgba(0,0,0,.24); opacity: .95; transform: scale(1.01); }
.postit-title {
    font-weight: 600; font-size: 15px; line-height: 1.25; color: #1a1e2e; letter-spacing: .01em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}
.postit-title.empty { color: rgba(0,0,0,.38); font-style: italic; font-weight: 400; }
.postit-desc {
    font-size: 12.5px; line-height: 1.4; color: rgba(0,0,0,.65); flex: 1; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; white-space: pre-line; word-break: break-word;
}
.postit-fields { display: flex; flex-wrap: wrap; gap: 4px; }
.postit-field  { font-size: 11px; background: rgba(255,255,255,.6); border-radius: 4px; padding: 1px 6px; color: #2d3250; white-space: nowrap; }
.postit-footer { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: rgba(0,0,0,.5); }

/* Badges de statut */
.status-badge { border-radius: 10px; padding: 1px 8px; font-size: 10.5px; font-weight: 500; }
.status-badge::before { margin-right: 3px; }
.status-badge[data-status="sandbox"]    { background: rgba(0,0,0,.07);   color: #555; }
.status-badge[data-status="sandbox"]::before { content: "✏"; }
.status-badge[data-status="todo"]       { background: rgba(99,102,241,.14); color: #3730A3; }
.status-badge[data-status="todo"]::before { content: "○"; }
.status-badge[data-status="in_progress"]{ background: rgba(245,158,11,.16); color: #92400E; }
.status-badge[data-status="in_progress"]::before { content: "◑"; }
.status-badge[data-status="done"]       { background: rgba(20,184,166,.16); color: #0F766E; }
.status-badge[data-status="done"]::before { content: "✓"; }
.status-badge[data-status="canceled"]   { background: rgba(239,68,68,.1);  color: #991B1B; }
.status-badge[data-status="canceled"]::before { content: "✕"; }

.creator-badge {
    width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.18); color: #fff;
    font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

/* Historique */
.history-list { max-height: 360px; overflow-y: auto; }
.history-item { padding: 8px 0; border-bottom: 1px solid var(--mud-palette-lines-default); font-size: 14px; }
.history-item .meta { font-size: 12px; color: var(--mud-palette-text-secondary); }
.history-change { font-size: 13px; margin-left: 8px; }
.inline-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.2); vertical-align: middle; }

/* ── Mode sombre : surcharges non couvertes par les variables ────────────── */
html.dark .status-badge[data-status="sandbox"]    { background: rgba(255,255,255,.08); color: #94A3B8; }
html.dark .status-badge[data-status="todo"]       { background: rgba(129,140,248,.2);  color: #A5B4FC; }
html.dark .status-badge[data-status="in_progress"]{ background: rgba(251,191,36,.18);  color: #FCD34D; }
html.dark .status-badge[data-status="done"]       { background: rgba(45,212,191,.18);  color: #5EEAD4; }
html.dark .status-badge[data-status="canceled"]   { background: rgba(248,113,113,.12); color: #FCA5A5; }
html.dark .postit-title { color: #1a1e2e; }
html.dark .postit-desc  { color: rgba(0,0,0,.62); }
