*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Neutral scale (cool, modern) */
  --bg: #eef1f6;
  --bg2: #ffffff;
  --bg3: #e7ebf2;
  --border: #dde3ec;
  --border2: #c3ccda;
  --text: #0e1c2b;
  --text2: #40536a;
  --text3: #74849a;

  /* Brand */
  --accent-rgb: 0, 100, 184;
  --accent: rgb(var(--accent-rgb));
  --accent2: #004a89;
  --accent-soft: rgba(var(--accent-rgb), 0.1);
  --accent-soft2: rgba(var(--accent-rgb), 0.16);
  --accent-ring: rgba(var(--accent-rgb), 0.28);

  --danger: #d63a3a;
  --success: #16a34a;

  /* Statuts */
  --st-prevu: #2563eb;
  --st-fait: #16a34a;
  --st-retard: #f59e0b;
  --st-bloque: #dc2626;
  --brand-argos: #e8552d;

  /* Layout */
  --cell-w: 124px;
  --cell-h: 140px;
  --label-w: 220px;
  --header-h: 58px;
  --cal-h: 78px;

  /* Shape */
  --radius: 8px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* Elevation (soft, layered) */
  --shadow-sm:
    0 1px 2px rgba(16, 28, 43, 0.06), 0 1px 3px rgba(16, 28, 43, 0.08);
  --shadow-md:
    0 4px 10px rgba(16, 28, 43, 0.08), 0 2px 4px rgba(16, 28, 43, 0.06);
  --shadow-lg:
    0 12px 32px rgba(16, 28, 43, 0.16), 0 4px 10px rgba(16, 28, 43, 0.08);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-d: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-m: 'DM Mono', 'Consolas', monospace;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-d);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* ── HEADER ── */
.header {
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg2) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  -webkit-backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow:
    0 1px 0 rgba(16, 28, 43, 0.02),
    0 6px 18px rgba(16, 28, 43, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  gap: 12px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    #4fa8e8 55%,
    #7cc4f2 100%
  );
}
.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 410px;
}
.header-center {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
  min-width: 240px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand-argos {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--brand-argos);
  line-height: 1;
  flex-shrink: 0;
  font-family: var(--font-d);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  color: var(--accent);
  flex-shrink: 0;
  display: flex;
}
.logo-text {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--text);
}
.logo-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border2);
  flex-shrink: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text3);
  transition: background 0.3s var(--ease);
  flex-shrink: 0;
}
.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
}
.status-dot.disconnected {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(214, 58, 58, 0.18);
}
.status-label {
  font-size: 12px;
  color: var(--text3);
  font-family: var(--font-d);
  font-weight: 500;
}
.connection-status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  background: var(--bg3);
  border-radius: var(--radius-pill);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease),
    transform 0.1s var(--ease);
}
.nav-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-btn:active {
  transform: scale(0.92);
}
/* Cible de dépôt d'un post-it → décale d'une semaine */
.nav-btn.week-drop {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 3px var(--accent-ring);
  transform: scale(1.12);
}
.today-btn {
  color: var(--accent);
}
.period-label {
  font-family: var(--font-d);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 240px;
  text-align: center;
  user-select: none;
  padding: 0 8px;
}
.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text2);
  padding: 7px 13px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-d);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease),
    border-color 0.15s var(--ease);
  white-space: nowrap;
  height: 36px;
}
.icon-btn svg {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s var(--ease);
}
.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
.icon-btn:hover svg {
  opacity: 1;
}

.display-mode-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}
.display-mode-btn {
  min-width: 92px;
  justify-content: center;
  padding: 7px 10px;
  letter-spacing: -0.01em;
}
.display-mode-btn.active,
.display-mode-btn.active:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.display-mode-btn.active svg {
  opacity: 1;
}

/* Avatar */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #4fa8e8);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
  margin-left: 4px;
  box-shadow: var(--shadow-sm);
}

.presence {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg3);
  border: 1px solid var(--border);
}

.presence-btn {
  cursor: pointer;
  border: 1px solid var(--border);
  transition:
    background 0.15s var(--ease),
    border-color 0.15s var(--ease);
}

.presence-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
}

.presence-stack {
  display: flex;
  align-items: center;
}

.presence-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--bg2);
  background: linear-gradient(135deg, var(--accent), #4fa8e8);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -7px;
}

.presence-avatar:first-child {
  margin-left: 0;
}

.presence-label {
  font-size: 12px;
  color: var(--text2);
  font-weight: 600;
  white-space: nowrap;
}

.presence-modal {
  max-width: 420px;
}

.presence-popup-count {
  font-size: 13px;
  color: var(--text2);
  font-weight: 600;
}

.presence-popup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.presence-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--bg3);
  border: 1px solid var(--border);
}

.presence-popup-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #4fa8e8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.presence-popup-name {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.icon-btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── AUTH ── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1a2d42 0%, #2d4059 100%);
}

.auth-backdrop {
  position: absolute;
  inset: -18%;
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.02) 16px,
    rgba(255, 255, 255, 0) 16px,
    rgba(255, 255, 255, 0) 32px
  );
}

@keyframes authDrift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(48px);
  }
}

.auth-panel-wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 32px 16px;
}

.auth-panel {
  background: #ffffff;
  border: 1px solid #eef0f2;
  border-radius: 12px;
  box-shadow: 0 12px 0 -4px rgba(0, 0, 0, 0.08);
  padding: 48px 40px 36px;
  width: min(100%, 480px);
}

.auth-brand {
  display: block;
  height: 40px;
  width: auto;
  margin: 0 auto 20px;
}

.auth-panel h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #1a1a1a;
  text-align: center;
  font-weight: 700;
}

.auth-subtitle {
  margin-top: 12px;
  color: #666666;
  font-size: 14px;
  text-align: center;
}

.auth-form {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form label {
  margin: 0 0 6px 0;
  font-size: 13px;
  font-weight: 600;
  color: #333333;
  display: block;
}

.auth-form input[type='email'],
.auth-form input[type='password'] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #f9f9f9;
}

.auth-form input[type='email']:focus,
.auth-form input[type='password']:focus {
  outline: none;
  border-color: #0064b8;
  background: #fff;
}

.auth-checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.auth-checkbox-group input[type='checkbox'] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #ffd166;
}

.auth-checkbox-group label {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  cursor: pointer;
}

.auth-error {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #ffcccc;
  background: #ffe6e6;
  color: #cc0000;
  font-size: 13px;
  font-weight: 600;
}

.auth-submit {
  margin-top: 24px;
  width: 100%;
  min-height: 44px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 0 -1px rgba(0, 0, 0, 0.25);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease,
    background 0.15s ease;
}

.auth-submit:hover:not(:disabled) {
  background: #333333;
}

.auth-submit:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 -1px rgba(0, 0, 0, 0.25);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-shell-loading {
  background: linear-gradient(145deg, #edf2f7 0%, #dfe7f0 100%);
}

.auth-loading-card {
  padding: 16px 22px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg2);
  box-shadow: var(--shadow-md);
  font-weight: 600;
  color: var(--text2);
}

/* ── BOARD ── */
.board-wrapper {
  position: fixed;
  top: calc(var(--header-h) + var(--cal-h));
  left: 0;
  right: 0;
  bottom: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.board {
  display: flex;
  flex-direction: column;
  min-width: max-content;
}

/* ── BOARD HEADER ── */
.board-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg2);
  border-bottom: 2px solid var(--border2);
  box-shadow: 0 2px 6px rgba(16, 28, 43, 0.04);
}
.board-header-corner {
  width: var(--label-w);
  min-width: var(--label-w);
  background: var(--bg2);
  border-right: 2px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-d);
  padding: 8px;
  position: sticky;
  left: 0;
  z-index: 2;
}
.day-group {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  margin-right: -1px;
}
.day-group.week-start {
  margin-left: -1px;
  border-left: 1px solid var(--border);
}
.day-label {
  font-family: var(--font-d);
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  text-align: center;
  padding: 7px 4px 4px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.day-label.today-col {
  color: var(--accent);
}
.day-slots {
  display: flex;
}
.slot-label {
  width: var(--cell-w);
  min-width: var(--cell-w);
  text-align: center;
  font-family: var(--font-d);
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  padding: 4px 2px 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-right: 1px solid var(--border);
}
.day-slots .slot-label:last-child {
  border-right: 0;
}

/* ── SWIMLANES ── */
.swimlanes {
  display: flex;
  flex-direction: column;
}

/* Chantier group header */
.chantier-header {
  display: flex;
  align-items: stretch;
  background:
    linear-gradient(var(--bg2), var(--bg2)) padding-box,
    var(--bg3);
  background: var(--bg2);
  border-bottom: 1px solid var(--border2);
  position: sticky;
  left: 0;
  z-index: 20;
}
.chantier-header-label {
  width: var(--label-w);
  min-width: var(--label-w);
  display: flex;
  align-items: center;
  padding: 11px 12px;
  border-right: 2px solid var(--border2);
  gap: 9px;
  position: sticky;
  left: 0;
  z-index: 21;
  background: var(--bg2);
}
.chantier-bullet {
  width: 4px;
  min-height: 20px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  flex-shrink: 0;
  align-self: stretch;
}
.chantier-name {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.chantier-header-fill {
  flex: 1;
}

/* Swimlane = one sous-activité row */
.swimlane {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  min-height: var(--cell-h);
}
.swimlane:hover .row-label {
  background: color-mix(in srgb, var(--accent-soft) 40%, var(--bg));
}

/* Each week inside a swimlane (showing one at a time) */
.week-group {
  display: flex;
  align-items: stretch;
}
.day-column {
  display: flex;
  align-items: stretch;
}
.day-column.week-start {
  margin-left: -1px;
  border-left: 1px solid var(--border);
}

.row-label {
  width: var(--label-w);
  min-width: var(--label-w);
  display: flex;
  align-items: flex-start;
  padding: 11px 12px 11px 24px;
  border-right: 2px solid var(--border2);
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--bg);
  gap: 7px;
  transition: background 0.15s var(--ease);
}
.row-label-bar {
  width: 3px;
  min-height: 20px;
  border-radius: var(--radius-pill);
  background: var(--border2);
  flex-shrink: 0;
  margin-top: 3px;
}
.row-label-name {
  font-size: 14px;
  color: var(--text2);
  font-weight: 600;
  line-height: 1.4;
}

/* ── CELLS ── */
.cell {
  width: var(--cell-w);
  min-width: var(--cell-w);
  min-height: var(--cell-h);
  border-right: 1px solid var(--border);
  padding: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.12s var(--ease);
}
.cell.today-col {
  background: rgba(var(--accent-rgb), 0.05);
}
.cell.drop-target {
  background: rgba(var(--accent-rgb), 0.12) !important;
  outline: 2px dashed var(--accent);
  outline-offset: -3px;
  border-radius: 4px;
}

.cell-add-btn {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1.5px dashed var(--accent-ring);
  color: var(--accent);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: all 0.18s var(--ease);
  opacity: 0;
  transform: scale(0.85);
}
.cell:hover .cell-add-btn {
  opacity: 1;
  transform: scale(1);
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.4);
}
.cell-add-btn:hover {
  transform: scale(1.15);
}
.cell-add-btn:active {
  transform: scale(0.95);
}

/* ── CARDS (POST-ITS) — blancs, colorés par statut ── */
.card {
  --st-color: var(--st-prevu);
  --svc-color: #94a3b8;
  /* Fond = teinte de la couleur du pôle/service ; bordure = statut */
  background: color-mix(in srgb, var(--svc-color) 18%, #fff);
  border: 1.5px solid var(--st-color);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 7px 10px 8px 11px;
  min-height: 62px;
  max-height: 98px;
  cursor: grab;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.16s var(--ease),
    box-shadow 0.16s var(--ease),
    opacity 0.15s var(--ease);
  user-select: none;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  z-index: 5;
}
.card.dragging {
  opacity: 0.4;
  transform: scale(0.97);
  cursor: grabbing;
  box-shadow: var(--shadow-lg);
}
.card.card-dim {
  opacity: 0.22;
  filter: grayscale(0.5);
}

.card-status-icon {
  position: absolute;
  top: 6px;
  right: 7px;
  color: var(--st-color);
  display: flex;
  z-index: 1;
}
.card-title {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
  padding-right: 16px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 1px;
}
.card-meta-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.card-period {
  font-family: var(--font-m);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  line-height: 1.5;
  flex-shrink: 0;
}
.card-period-am {
  background: rgba(245, 158, 11, 0.2);
  color: #b45309;
}
.card-period-pm {
  background: rgba(99, 102, 241, 0.2);
  color: #4338ca;
}
.card-team {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}
.card-team span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-team-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.card-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.card-team-count {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}
.card-team-count svg {
  color: var(--text3);
}

/* Move counter (dans la ligne méta) */
.card-moves {
  font-family: var(--font-m);
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
}

/* Stickers */
.card-stickers {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
}
.sticker {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

/* ── DRAG GHOST ── */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  border-radius: 6px;
  padding: 7px 10px;
  font-family: var(--font-d);
  font-size: 11px;
  font-weight: 700;
  color: rgba(14, 28, 43, 0.8);
  box-shadow: var(--shadow-lg);
  display: none;
  max-width: 150px;
  word-break: break-word;
}

/* ── MODALS ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 28, 43, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: overlayIn 0.18s var(--ease);
}
@keyframes overlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.24s var(--ease-spring);
}
.modal-wide {
  max-width: 580px;
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 0;
}
.modal-header h2 {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.modal-close {
  background: var(--bg3);
  border: none;
  color: var(--text2);
  font-size: 16px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease);
}
.modal-close:hover {
  color: var(--text);
  background: var(--border);
}
.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.modal-hint {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.6;
}
.modal-footer {
  padding: 0 22px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.form-row {
  display: flex;
  gap: 10px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 0.01em;
  font-family: var(--font-d);
}

input[type='text'],
input[type='number'],
input[type='date'],
textarea,
select {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
  font-family: var(--font-d);
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
  width: 100%;
  resize: vertical;
}
input[type='text']::placeholder,
textarea::placeholder {
  color: var(--text3);
}
input[type='text']:focus,
input[type='number']:focus,
input[type='date']:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
select option {
  background: var(--bg2);
}
input[type='color'] {
  width: 36px;
  height: 36px;
  padding: 2px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--bg3);
  cursor: pointer;
  flex-shrink: 0;
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 9px 22px;
  border-radius: var(--radius);
  font-family: var(--font-d);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition:
    background 0.15s var(--ease),
    box-shadow 0.15s var(--ease),
    transform 0.1s var(--ease);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.28);
}
.btn-primary:hover {
  background: var(--accent2);
  box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.36);
}
.btn-primary:active {
  transform: translateY(1px);
}
/* Modifs non enregistrées : contour rouge pulsant sur « Enregistrer » */
.btn-primary.needs-save {
  background: var(--danger);
  outline: 2px solid var(--danger);
  outline-offset: 2px;
  box-shadow:
    0 0 0 3px rgba(214, 58, 58, 0.5),
    0 2px 10px rgba(214, 58, 58, 0.4);
  animation: needsSavePulse 1.3s var(--ease) infinite;
}
.btn-primary.needs-save:hover {
  background: #b83030;
}
@keyframes needsSavePulse {
  0%,
  100% {
    box-shadow:
      0 0 0 3px rgba(214, 58, 58, 0.5),
      0 2px 10px rgba(214, 58, 58, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 7px rgba(214, 58, 58, 0.2),
      0 2px 12px rgba(214, 58, 58, 0.5);
  }
}
.btn-secondary {
  background: var(--bg2);
  color: var(--text2);
  border: 1px solid var(--border2);
  padding: 9px 22px;
  border-radius: var(--radius);
  font-family: var(--font-d);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.btn-secondary:hover {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border2);
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(214, 58, 58, 0.28);
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font-d);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.btn-danger:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-add {
  background: none;
  border: 1.5px dashed var(--border2);
  color: var(--text3);
  padding: 11px 16px;
  border-radius: var(--radius);
  font-family: var(--font-d);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.15s var(--ease);
  margin-top: 6px;
}
.btn-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Config rows (services, sticker types) */
.config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--bg3);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: border-color 0.15s var(--ease);
}
.config-row:hover {
  border-color: var(--border2);
}
.config-row input[type='text'] {
  flex: 1;
}
.config-row select {
  width: auto;
  min-width: 110px;
  flex-shrink: 0;
}
.btn-icon {
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--text3);
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s var(--ease);
}
.btn-icon:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(214, 58, 58, 0.06);
}
.btn-icon.save:hover {
  color: var(--success);
  border-color: var(--success);
  background: rgba(22, 163, 74, 0.06);
}
.shape-preview {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Chantier config */
.chantier-config {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.chantier-config-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.chantier-config-header input {
  flex: 1;
}
.chantier-config-body {
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.subact-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.subact-row input {
  flex: 1;
  font-size: 13px;
}

/* Sticker picker */
.sticker-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.sticker-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all 0.15s var(--ease);
  min-width: 60px;
}
.sticker-option:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.sticker-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft2);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.sticker-option span {
  font-size: 10px;
  color: var(--text2);
  text-align: center;
  font-family: var(--font-m);
  line-height: 1.2;
}

/* Move history */
.move-history {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 140px;
  overflow-y: auto;
}
.move-entry {
  font-family: var(--font-d);
  font-size: 12px;
  color: var(--text2);
  padding: 7px 11px;
  background: var(--bg3);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  line-height: 1.5;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--text);
  border-radius: 10px;
  padding: 11px 22px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  z-index: 999;
  box-shadow: var(--shadow-lg);
  transition: transform 0.28s var(--ease-spring);
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: var(--radius-pill);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text3);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

/* ── MINI CALENDAR BAR ── */
/* Barre calendrier mini */
.mini-cal-bar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  height: var(--cal-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(16, 28, 43, 0.04);
  z-index: 90;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

/* Panneau « Statut de la semaine » */
.week-status {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 6px 16px;
  min-width: 210px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.ws-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
}
.ws-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.ws-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.ws-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--st-color);
  flex-shrink: 0;
}
.ws-num {
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
  line-height: 1;
}
.ws-lbl {
  font-size: 12px;
  color: var(--text2);
}

.mini-cal-scroll {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  height: 100%;
  overflow-x: auto;
  padding: 5px 10px;
  gap: 6px;
  scrollbar-width: none;
}
.mini-cal-scroll::-webkit-scrollbar {
  display: none;
}

/* Bloc semaine : regroupe et étiquette les 5 jours ouvrés */
.mc-week {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 3px 6px 4px;
  border-radius: 12px;
  flex-shrink: 0;
  transition: background 0.15s var(--ease);
}
.mc-week:not(:last-child) {
  border-right: 1px solid var(--border);
  border-radius: 12px 0 0 12px;
  padding-right: 12px;
  margin-right: 0;
}
.mc-week--active {
  background: var(--accent-soft);
  border-right-color: transparent;
}

.mc-week-head {
  font-family: var(--font-d);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text3);
  text-align: center;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
  transition:
    color 0.15s var(--ease),
    background 0.15s var(--ease);
}
.mc-week-head:hover {
  color: var(--accent);
  background: var(--accent-soft2);
}
.mc-week--active .mc-week-head {
  color: var(--accent);
}

.mc-week-days {
  display: flex;
  gap: 3px;
}

.mc-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 34px;
  padding: 4px 4px 3px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.15s var(--ease),
    transform 0.1s var(--ease);
  gap: 4px;
  flex-shrink: 0;
}
.mc-day:hover {
  background: var(--bg3);
}
.mc-day:active {
  transform: scale(0.94);
}
.mc-today {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  background: var(--bg2);
}

.mc-label {
  font-family: var(--font-d);
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  line-height: 1;
}
.mc-today .mc-label {
  color: var(--accent);
  font-weight: 800;
}

.mc-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  max-width: 34px;
  min-height: 20px;
  align-content: flex-start;
}

.mc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.88;
  transition: transform 0.12s var(--ease);
}
.mc-dot:hover {
  transform: scale(1.4);
  opacity: 1;
}

/* ── CARD RESIZE HANDLE ── */
.card-resize-handle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: col-resize;
  color: rgba(14, 28, 43, 0.4);
  font-size: 10px;
  border-radius: 6px 0 0 6px;
  background: rgba(16, 28, 43, 0.1);
  opacity: 0;
  transition:
    opacity 0.15s var(--ease),
    background 0.15s var(--ease);
  user-select: none;
  z-index: 10;
}
.card:hover .card-resize-handle {
  opacity: 1;
}
.card.resizing .card-resize-handle {
  opacity: 1;
  background: rgba(16, 28, 43, 0.25);
}

/* ── CARD SPAN BADGE ── */
.card-span-badge {
  font-family: var(--font-m);
  font-size: 9px;
  color: rgba(14, 28, 43, 0.5);
  margin-top: 2px;
  letter-spacing: 0.03em;
}

/* ── STICKER CHIP (sur le post-it) ── */
.sticker-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(16, 28, 43, 0.16);
  border-radius: var(--radius-pill);
  padding: 1px 5px 1px 3px;
  cursor: pointer;
  transition:
    background 0.15s var(--ease),
    opacity 0.15s var(--ease);
  user-select: none;
}
.sticker-chip:hover {
  background: rgba(16, 28, 43, 0.28);
}
.sticker-chip.sticker-done {
  background: rgba(16, 28, 43, 0.1);
  opacity: 0.6;
  text-decoration: line-through;
}
.sticker-chip.sticker-done svg {
  filter: grayscale(1);
}
.sticker-count {
  font-family: var(--font-m);
  font-size: 9px;
  font-weight: 600;
  color: rgba(14, 28, 43, 0.68);
  line-height: 1;
}

/* ── STICKER PICKER (dans le modal) ── */
.sticker-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg3);
  transition:
    border-color 0.15s var(--ease),
    background 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}
.sticker-picker-row--active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.sticker-picker-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.sticker-picker-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stp-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease);
  flex-shrink: 0;
}
.stp-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.stp-btn:active:not(:disabled) {
  transform: scale(0.9);
}
.stp-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.stp-count {
  font-family: var(--font-m);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-width: 22px;
  text-align: center;
}
.sticker-picker-row--active .stp-count {
  color: var(--accent);
}

/* ── STATUS PICKER (modal) ── */
.status-picker {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.status-opt {
  --st-color: var(--st-prevu);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-family: var(--font-d);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s var(--ease);
}
.status-opt svg {
  color: var(--st-color);
}
.status-opt:hover {
  border-color: var(--st-color);
  background: color-mix(in srgb, var(--st-color) 8%, var(--bg2));
}
.status-opt.selected {
  border-color: var(--st-color);
  color: var(--st-color);
  background: color-mix(in srgb, var(--st-color) 12%, var(--bg2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-color) 22%, transparent);
}

/* ── CHANTIER header extras (icône, chevron, repli) ── */
.chantier-icon {
  color: var(--accent);
  display: flex;
  flex-shrink: 0;
}
.chantier-header {
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.chantier-header:hover {
  background: var(--bg3);
}
.chantier-chevron {
  color: var(--text3);
  display: flex;
  margin-left: 6px;
  transition: transform 0.18s var(--ease);
}
.chantier-header.collapsed .chantier-chevron {
  transform: rotate(-90deg);
}

/* ── ROW menu (⋮) ── */
.row-menu {
  margin-left: auto;
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition:
    opacity 0.15s var(--ease),
    background 0.15s var(--ease),
    color 0.15s var(--ease);
}
.swimlane:hover .row-menu {
  opacity: 1;
}
.row-menu:hover {
  background: var(--bg3);
  color: var(--accent);
}

/* ── TODAY column highlight ── */
.day-label.today-col {
  background: var(--accent);
  color: #fff;
  border-radius: 6px 6px 0 0;
}

/* ── RESPONSIVE / MOBILE ── */
@media (max-width: 900px) {
  .logo-sub {
    display: none;
  }
  .period-label {
    min-width: 180px;
  }
  .icon-btn {
    padding: 7px 10px;
  }

  .presence-label {
    display: none;
  }
}

@media (max-width: 680px) {
  :root {
    --cell-w: 92px;
    --cell-h: 118px;
    --label-w: 148px;
    --header-h: 54px;
    --cal-h: 72px;
  }
  .header {
    padding: 0 12px;
    gap: 8px;
  }
  .header-divider,
  .status-label {
    display: none;
  }
  .brand-logo {
    height: 22px;
  }
  .brand-argos {
    font-size: 18px;
  }
  .avatar {
    display: none;
  }
  .presence {
    display: none;
  }
  .week-status {
    display: none;
  }
  .connection-status {
    padding: 5px;
  }
  .header-center {
    gap: 2px;
  }
  .period-label {
    font-size: 12px;
    min-width: 0;
    padding: 0 4px;
  }
  .icon-btn {
    padding: 7px;
  }
  .icon-btn span,
  .icon-btn {
    font-size: 0;
  }
  .icon-btn svg {
    width: 18px;
    height: 18px;
    opacity: 0.85;
  }
  .board-header-corner,
  .row-label {
    padding-left: 12px;
  }
  .row-label {
    padding-right: 8px;
  }
  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-header {
    padding: 18px 18px 0;
  }
  .modal-body {
    padding: 16px 18px;
  }
  .modal-footer {
    padding: 0 18px 18px;
  }
  .form-row {
    flex-direction: column;
  }

  .auth-panel {
    padding: 24px 18px 20px;
    border-radius: 16px;
  }

  .auth-panel h1 {
    font-size: 25px;
  }
}
