/* 2Mains Pilot — feuille de style */
:root {
  --brand: #0A8F72;
  --brand-600: #087A61;
  --brand-700: #066650;
  --brand-900: #05463A;
  --brand-400: #13B08A;
  --brand-100: #D5F1E8;
  --brand-50: #ECF8F4;

  --bg: #F3F6F5;
  --surface: #FFFFFF;
  --surface-2: #F8FAF9;
  --border: #E2E8E5;
  --border-strong: #CBD5D1;
  --text: #15201D;
  --text-2: #4A5A55;
  --muted: #7A8A85;

  --todo: #64748B;     --todo-bg: #F1F5F9;
  --doing: #2563EB;    --doing-bg: #EAF1FE;
  --review: #9333EA;   --review-bg: #F5EDFE;
  --done: #16A34A;     --done-bg: #E8F7EE;
  --danger: #DC2626;   --danger-bg: #FDECEC;
  --warning: #D97706;  --warning-bg: #FEF5E7;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 40, 32, .06);
  --shadow: 0 1px 2px rgba(16, 40, 32, .05), 0 4px 14px rgba(16, 40, 32, .06);
  --shadow-lg: 0 12px 40px rgba(10, 47, 40, .18);
  --sidebar-w: 248px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
code { background: var(--brand-50); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 14px; height: 14px; }
svg.i.lg { width: 22px; height: 22px; }

/* ---------- Boutons & champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .input:focus-visible { outline: 3px solid rgba(19, 176, 138, .3); outline-offset: 1px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(14,74,63,.3); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(23, 107, 91, .07); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: #F5C2C2; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-block { width: 100%; height: 42px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.input, .form input:not([type=checkbox]):not([type=range]):not([type=color]), .form select, .form textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.form textarea, textarea.input { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input:focus, .form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(19, 176, 138, .16); }
select.input, .form select { padding-right: 30px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A8A85' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.form label.check { display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 13.5px; color: var(--text); cursor: pointer; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; }
input[type=range] { accent-color: var(--brand); width: 100%; }
input[type=color] { width: 44px; height: 38px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; background: #fff; cursor: pointer; }

.alert { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-bg); color: #9B1C1C; font-weight: 500; margin: 12px 0; border: 1px solid #F5C2C2; }

/* ---------- Page de connexion / installation ---------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #CDEBDD 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 110%, #BFE3D2 0%, transparent 55%), var(--bg);
}
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px; padding: 32px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.auth-card h1 { font-size: 24px; margin: 22px 0 4px; }
.auth-card .form { margin-top: 18px; }
.auth-brand { display: flex; justify-content: center; }
.auth-brand img { height: 120px; width: auto; }
.auth-card h1 { text-align: center; }

/* ---------- Structure ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--surface); color: var(--text-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.brand { flex-direction: column; text-align: center; gap: 8px; }
.brand img { height: 78px; width: auto; flex: none; }
.brand strong { display: block; font-size: 16px; color: var(--text); letter-spacing: -.01em; }
.brand span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.nav-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 16px 10px 6px; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; transition: background .15s, color .15s;
}
.nav a svg { color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: #EEF2F0; color: var(--text); font-weight: 600; }
.nav a.active svg { color: var(--text); }
.nav a .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); padding: 0 7px; border-radius: 99px; }
.nav a .count.alert-count { background: var(--danger-bg); border-color: #F5C2C2; color: var(--danger); }
.sidebar-foot { margin-top: auto; padding-top: 12px; display: grid; gap: 10px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.me-card .who { min-width: 0; flex: 1; }
.me-card strong { display: block; color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card span { font-size: 11.5px; color: var(--muted); }
.me-card .btn-ghost { color: var(--muted); }
.me-card .btn-ghost:hover { background: #E8EEEB; color: var(--text); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: rgba(243, 246, 245, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px; background: var(--surface); }
.search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; background: var(--surface-2); }
.topbar .spacer { flex: 1; }
.sync { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-400); box-shadow: 0 0 0 3px rgba(19, 176, 138,.18); }

.content { padding: 24px 28px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 11px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .12em; }
.page-head h1 { font-size: 26px; margin-top: 4px; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 6px; }
.card-head h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.card-body { padding: 10px 18px 18px; }
.grid { display: grid; gap: 16px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.dash-col > * { min-width: 0; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 16px; cursor: pointer; transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden; border: 0; color: #fff; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15, 30, 60, .22); }
.kpi::after { content: ""; position: absolute; right: -30px; bottom: -40px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.08); }
.kpi .top { display: flex; align-items: center; justify-content: space-between; color: rgba(255,255,255,.88); font-weight: 600; font-size: 12.5px; }
.kpi .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.18); color: #fff; }
.kpi .val { font-size: 28px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; }
.kpi .hint { font-size: 12px; color: rgba(255,255,255,.8); margin-top: 2px; }

/* ---------- Badges, avatars, barres ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid transparent; }
.badge.st-a_faire { background: var(--todo-bg); color: var(--todo); }
.badge.st-en_cours { background: var(--doing-bg); color: var(--doing); }
.badge.st-en_revue { background: var(--review-bg); color: var(--review); }
.badge.st-termine { background: var(--done-bg); color: var(--done); }
.badge.pr-basse { background: #F1F5F9; color: #64748B; }
.badge.pr-normale { background: #EEF4FF; color: #3B5BDB; }
.badge.pr-haute { background: var(--warning-bg); color: #B45309; }
.badge.pr-critique { background: var(--danger-bg); color: var(--danger); }
.badge.late { background: var(--danger-bg); color: var(--danger); }
.badge.soon { background: var(--warning-bg); color: #B45309; }
.badge.blocked { background: var(--danger); color: #fff; }
.badge.outline { background: transparent; border-color: var(--border); }
.badge.pj-actif { background: var(--brand-50); color: var(--brand); }
.badge.pj-en_pause { background: var(--warning-bg); color: #B45309; }
.badge.pj-termine { background: var(--done-bg); color: var(--done); }
.badge.pj-archive { background: #F1F5F9; color: #64748B; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }

.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; letter-spacing: .02em; box-shadow: 0 0 0 2px var(--surface); }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar.empty { background: var(--surface-2); color: var(--muted); border: 1.5px dashed var(--border-strong); box-shadow: none; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.user-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.progress { height: 7px; border-radius: 99px; background: #E7EEEB; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-400), var(--brand)); transition: width .3s; }
.progress.thin { height: 4px; }
.progress-label { display: flex; align-items: center; gap: 10px; }
.progress-label .progress { flex: 1; }
.progress-label b { font-size: 12.5px; min-width: 36px; text-align: right; }

.weather { font-size: 18px; line-height: 1; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table td { padding: 11px 12px; border-bottom: 1px solid #EEF2F0; vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--brand-50); }
.table .ref { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.table .title-cell { font-weight: 600; min-width: 220px; }
.table .num { text-align: center; font-weight: 600; }
.table .num.bad { color: var(--danger); }

/* ---------- Listes compactes (tableau de bord) ---------- */
.list, .feed { display: grid; grid-template-columns: minmax(0, 1fr); }
.list-item { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid #EEF2F0; cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover .li-title { color: var(--brand); }
.li-main { min-width: 0; flex: 1; }
.li-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .1s; }
.li-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-reason { font-size: 12.5px; color: #9B1C1C; background: var(--danger-bg); border-radius: 7px; padding: 4px 8px; margin-top: 5px; white-space: normal; }
.empty { text-align: center; padding: 26px 12px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--brand-400); margin-bottom: 6px; }
.empty strong { display: block; color: var(--text); margin-bottom: 2px; }

.load-row { display: grid; grid-template-columns: 150px 1fr 56px; gap: 12px; align-items: center; padding: 7px 0; }
.stack { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: #EEF2F0; }
.stack i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.donut-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; }
.donut-legend { display: grid; gap: 8px; flex: 1; }
.donut-legend div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.donut-legend b { margin-left: auto; }

.feed { display: grid; }
.feed-item { display: flex; gap: 11px; padding: 9px 0; }
.feed-item .txt { font-size: 13px; color: var(--text-2); min-width: 0; }
.feed-item .txt b { color: var(--text); font-weight: 600; }
.feed-item .txt .tk { color: var(--brand); font-weight: 600; cursor: pointer; }
.feed-item .when { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.change { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.change s { color: var(--muted); }
.quote { margin-top: 4px; padding: 6px 10px; background: var(--surface-2); border-left: 3px solid var(--brand-100); border-radius: 0 7px 7px 0; color: var(--text); white-space: pre-wrap; }

/* ---------- Barre de filtres ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.filters .input { width: auto; height: 34px; font-size: 13px; min-width: 150px; }
.filters .chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.filters .chip:hover { border-color: var(--border-strong); }
.filters .chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.filters .chip.on.red { background: var(--danger); border-color: var(--danger); }
.filters .sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.filters .reset { color: var(--muted); }
.seg { display: inline-flex; background: #E8EEEB; padding: 3px; border-radius: 10px; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 11px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Kanban ---------- */
.board-scroll { overflow-x: auto; padding-bottom: 12px; margin: 0 -28px; padding-left: 28px; padding-right: 28px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(272px, 1fr)); gap: 14px; min-width: 1120px; align-items: start; }
.board-head { display: contents; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.col-head h3 { font-size: 13.5px; font-weight: 700; }
.col-head .n { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.col-head .btn { margin-left: auto; }
.lane-title { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 14px 4px 2px; font-weight: 700; font-size: 14px; }
.lane-title .muted { font-weight: 500; font-size: 12.5px; }
.col {
  min-height: 120px; padding: 8px; border-radius: 14px; background: #E9EFEC;
  display: flex; flex-direction: column; gap: 8px; transition: background .15s, box-shadow .15s;
}
.col.drag-over { background: var(--brand-100); box-shadow: inset 0 0 0 2px var(--brand-400); }
.col .quick-add { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 12.5px; cursor: pointer; border: 1px dashed transparent; }
.col .quick-add:hover { background: rgba(255,255,255,.6); color: var(--brand); border-color: var(--border-strong); }
.col .quick-form { background: var(--surface); border-radius: 12px; padding: 8px; box-shadow: var(--shadow); display: grid; gap: 8px; }
.col .quick-form textarea { min-height: 54px; border: 0; padding: 4px; resize: none; outline: none; }
.col .quick-form .row { display: flex; gap: 6px; justify-content: flex-end; }
.placeholder { height: 64px; border-radius: 12px; border: 2px dashed var(--brand-400); background: rgba(19, 176, 138,.06); }

.tcard {
  background: var(--surface); border-radius: 12px; padding: 12px;
  box-shadow: 0 1px 2px rgba(16,40,32,.08); border: 1px solid #E4EAE7; cursor: grab;
  display: grid; gap: 9px; transition: box-shadow .15s, transform .15s, border-color .15s;
}
.tcard:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
.tcard.dragging { opacity: .45; transform: rotate(1.5deg); }
.tcard.is-blocked { border-color: #F3B1B1; }
.tcard.is-done .t-title { color: var(--text-2); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.t-top { display: flex; align-items: center; gap: 6px; }
.t-ref { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; white-space: nowrap; flex: none; }
.t-top .badge { height: 20px; font-size: 11px; padding: 0 8px; }
.t-title { font-weight: 650; font-size: 14px; line-height: 1.35; word-break: break-word; color: var(--text); }
.t-proj { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; justify-self: start; }
.t-proj span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-proj .dot { width: 7px; height: 7px; }
.t-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.t-label { font-size: 10.5px; font-weight: 600; color: var(--text-2); background: #F1F5F3; border-radius: 6px; padding: 0 6px; }
.t-label::before { content: "#"; color: var(--muted); }
.t-block { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; font-weight: 500; color: #9B1C1C; background: var(--danger-bg); border-radius: 8px; padding: 6px 8px; }
.t-block b { font-weight: 700; }
.t-block svg { margin-top: 1px; color: var(--danger); }
.t-progress { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: var(--text-2); }
.t-progress .lbl { color: var(--muted); font-weight: 600; }
.t-progress .progress { flex: 1; }
.t-foot { display: flex; align-items: center; gap: 8px; padding-top: 9px; border-top: 1px solid #EEF2F0; font-size: 12px; color: var(--muted); }
.t-owner { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; color: var(--text-2); }
.t-owner span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-owner.none span { color: var(--muted); font-weight: 500; font-style: italic; }
.t-foot .m { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; white-space: nowrap; }
.t-foot .m.late { color: var(--danger); }
.t-foot .m.soon { color: #B45309; }
.t-foot .m.ok { color: var(--done); }
.t-foot .m.nodate { color: var(--border-strong); font-weight: 500; }

/* ---------- Projets ---------- */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.pcard { overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.pcard:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.pcard .pc-body { padding: 16px 18px; display: grid; gap: 12px; flex: 1; }
.pcard .pc-head { display: flex; align-items: flex-start; gap: 10px; }
.pcard .pc-code { font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .08em; }
.pcard h3 { font-size: 16px; font-weight: 700; margin-top: 2px; }
.pcard .desc { color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; margin: 0; }
.pcard .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; background: var(--surface-2); border-radius: 10px; padding: 9px 4px; }
.pcard .stats b { display: block; font-size: 17px; }
.pcard .stats span { font-size: 11px; color: var(--muted); font-weight: 600; }
.pcard .stats .bad b { color: var(--danger); }
.pcard .pc-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid #EEF2F0; font-size: 12.5px; color: var(--text-2); }
.pcard .pc-foot .btn { margin-left: auto; }

/* ---------- Planning (Gantt) ---------- */
.gantt { overflow: auto; max-height: calc(100vh - 230px); }
.gantt-grid { display: grid; position: relative; min-width: max-content; }
.g-side { position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--border); padding: 0 12px; display: flex; align-items: center; gap: 8px; min-width: 0; height: 38px; border-bottom: 1px solid #F0F3F2; }
.g-side.proj { background: var(--surface-2); font-weight: 700; }
.g-side .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; cursor: pointer; }
.g-head { position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 11px; color: var(--muted); font-weight: 700; display: flex; align-items: flex-end; padding: 0 0 6px 6px; height: 44px; white-space: nowrap; border-left: 1px solid #EEF2F0; }
.g-head.corner { left: 0; z-index: 5; padding-left: 12px; color: var(--text-2); border-left: 0; border-right: 1px solid var(--border); }
.g-cell { height: 38px; border-bottom: 1px solid #F0F3F2; position: relative; }
.g-cell.proj { background: var(--surface-2); }
.g-bar { position: absolute; top: 9px; height: 20px; border-radius: 6px; background: var(--pc); opacity: .9; color: #fff; font-size: 11px; font-weight: 700; padding: 0 7px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; cursor: pointer; min-width: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.g-bar .fill { position: absolute; inset: 0 auto 0 0; background: rgba(255,255,255,.28); }
.g-bar span { position: relative; }
.g-bar.proj { top: 12px; height: 14px; opacity: .35; }
.g-bar.late { box-shadow: 0 0 0 2px var(--danger); }
.g-bar.done { opacity: .45; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.g-today::after { content: "Aujourd'hui"; position: absolute; top: 48px; left: 4px; font-size: 10px; font-weight: 700; color: var(--danger); background: #fff; padding: 0 4px; border-radius: 4px; }
.g-week { position: absolute; top: 0; bottom: 0; width: 1px; background: #EEF2F0; pointer-events: none; }

/* ---------- Historique ---------- */
.timeline-day { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 6px; }
.timeline-day:first-child { margin-top: 0; }
.act { display: flex; gap: 12px; padding: 11px 14px; border-bottom: 1px solid #EEF2F0; }
.act:last-child { border-bottom: 0; }
.act .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.act .body { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text-2); }
.act .body b { color: var(--text); }
.act .body .tk { color: var(--brand); font-weight: 600; cursor: pointer; }
.act .time { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- Équipe ---------- */
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.member { padding: 18px; display: grid; gap: 14px; }
.member .mh { display: flex; align-items: center; gap: 12px; }
.member .mh strong { display: block; font-size: 15px; }
.member .mh span { color: var(--muted); font-size: 12.5px; }
.member .ms { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; background: var(--surface-2); border-radius: 10px; padding: 8px 4px; }
.member .ms b { display: block; font-size: 17px; }
.member .ms span { font-size: 11px; color: var(--muted); font-weight: 600; }
.member .ms .bad b { color: var(--danger); }
.member.inactive { opacity: .6; }

/* ---------- Panneau de détail & modales ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 30, 26, .38); z-index: 60; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); z-index: 61; background: var(--surface);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s ease;
}
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.drawer-head .ref { font-weight: 800; color: var(--muted); font-size: 13px; }
.drawer-head .saved { font-size: 12px; color: var(--done); font-weight: 600; display: flex; align-items: center; gap: 4px; margin-left: auto; opacity: 0; transition: opacity .3s; }
.drawer-head .saved.show { opacity: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.title-input { width: 100%; font-size: 21px; font-weight: 700; border: 1px solid transparent; border-radius: 9px; padding: 6px 8px; margin: -6px -8px 12px; background: transparent; resize: none; line-height: 1.3; letter-spacing: -.01em; overflow: hidden; }
.title-input:hover { background: var(--surface-2); }
.title-input:focus { outline: none; border-color: var(--brand-400); background: #fff; box-shadow: 0 0 0 3px rgba(19, 176, 138,.16); }
.fields { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; align-items: center; margin-bottom: 18px; }
.fields > .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.fields .input { height: 34px; }
.section { margin-top: 20px; }
.section > h4 { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.section > h4 .muted { font-weight: 500; }
.block-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.block-box.on { border-color: #F3B1B1; background: #FFF8F8; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.toggle input { display: none; }
.toggle .sw { width: 36px; height: 20px; border-radius: 99px; background: #CBD5D1; position: relative; transition: background .2s; }
.toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .sw { background: var(--danger); }
.toggle input:checked + .sw::after { transform: translateX(16px); }
.check-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.check-item:hover { background: var(--surface-2); }
.check-item.done .ct { text-decoration: line-through; color: var(--muted); }
.check-item .ct { flex: 1; }
.check-item .who { font-size: 11px; color: var(--muted); }
.check-item .btn { opacity: 0; }
.check-item:hover .btn { opacity: 1; }
.add-row { display: flex; gap: 8px; margin-top: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment .cb { flex: 1; min-width: 0; }
.comment .ch { font-size: 12.5px; color: var(--muted); }
.comment .ch b { color: var(--text); }
.comment .ctext { margin-top: 3px; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); padding: 8px 11px; border-radius: 4px 12px 12px 12px; }

.modal-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: min(560px, 100%); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.modal.sm { width: min(420px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 4px; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 14px 22px; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 6px 22px 20px; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-row button { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.color-row button.on { box-shadow: 0 0 0 2px var(--text); }
.weather-pick { display: flex; gap: 6px; }
.weather-pick button { flex: 1; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
.weather-pick button.on { border-color: var(--brand); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand); }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; }
.toast { background: var(--brand-900); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; display: flex; gap: 8px; align-items: center; animation: pop .2s ease; }
.toast.error { background: #9B1C1C; }

.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.help-grid .card { padding: 14px 16px; }
.help-grid h4 { font-size: 14px; display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.help-grid p { margin: 0; color: var(--text-2); font-size: 13px; }

.spinner { width: 30px; height: 30px; border: 3px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 80px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.form .row-name-code { grid-template-columns: 1fr 120px; }
.form .row-smtp { grid-template-columns: 1fr 110px 150px; }

/* ---------- Responsive ---------- */
/* Écrans peu hauts : sidebar plus compacte (elle reste défilante) */
@media (max-height: 760px) {
  .brand img { height: 52px; }
  .brand { padding-bottom: 12px; gap: 4px; }
  .nav-label { padding-top: 10px; }
  .nav a { padding: 7px 11px; }
}
/* Écrans tactiles : actions visibles sans survol */
@media (hover: none) {
  .check-item .btn { opacity: 1; }
}
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { width: min(280px, 86vw); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); z-index: 50; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open { overflow: hidden; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .main { margin-left: 0; }
  .topbar { padding: 10px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar .sync, .topbar .spacer, .search kbd { display: none; }
  .content { padding: 18px 16px 40px; }
  .board-scroll { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .fields { grid-template-columns: 1fr; gap: 4px; }
  .fields > .lbl { margin-top: 8px; }
  .form .row, .form .row-3 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .load-row { grid-template-columns: 110px 1fr 40px; }
  .topbar .btn-label { display: none; }
  .form .row-name-code, .form .row-smtp { grid-template-columns: 1fr; }
  .drawer-body { padding: 16px; }
  .drawer-head { padding: 12px 16px; }
  .title-input { font-size: 18px; }
  .gantt { max-height: none; }
}
/* Téléphones */
@media (max-width: 600px) {
  .hide-sm { display: none; }
  .page-head { align-items: flex-start; margin-bottom: 14px; }
  .page-head h1 { font-size: 20px; }
  .page-head .actions { width: 100%; }
  .filters .input { flex: 1 1 140px; min-width: 0; }
  .filters .sep { display: none; }
  .kpi { padding: 13px; }
  .kpi .val { font-size: 23px; }
  .kpi .ico { width: 28px; height: 28px; }
  /* Kanban : une colonne presque pleine largeur, défilement horizontal avec aimantation */
  .board { grid-template-columns: repeat(4, 84vw); min-width: 0; scroll-snap-type: x mandatory; }
  .board-scroll { scroll-snap-type: x mandatory; }
  .col-head, .col { scroll-snap-align: start; }
  .card-head { padding: 14px 14px 6px; }
  .card-body { padding: 8px 14px 14px; }
  .modal-wrap { padding: 10px; align-items: start; }
  .modal-head { padding: 16px 16px 4px; }
  .modal-body { padding: 12px 16px; }
  .modal-foot { padding: 6px 16px 16px; }
  .auth-card { padding: 24px 20px; }
  .load-row { grid-template-columns: 1fr 70px 30px; }
  .load-row .user-chip span { max-width: 100px; }
  .toasts { left: 12px; right: 12px; transform: none; }
  .settings-grid { gap: 12px; }
}
@media print {
  .sidebar, .topbar, .filters, .page-head .actions { display: none !important; }
  .main { margin: 0; }
}

/* ---------- Plusieurs owners ---------- */
.avatars { display: inline-flex; align-items: center; flex: none; }
.avatars .avatar + .avatar { margin-left: -7px; }
.avatar.more { background: #94A3B8; }
.picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pchip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 4px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface-2); font-size: 12.5px; font-weight: 600; }
.pchip > span:not(.avatar) { padding-right: 6px; }
.pchip button { border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; margin-left: -4px; }
.pchip button:hover { background: var(--danger-bg); color: var(--danger); }
.pick-add { width: auto !important; height: 30px !important; font-size: 12.5px; border-radius: 99px !important; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 190px; overflow-y: auto; padding: 2px; }
.form .check-user, .check-user { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 9px; font-weight: 500; font-size: 13px; color: var(--text); cursor: pointer; }
.check-user:has(input:checked) { border-color: var(--brand-400); background: var(--brand-50); }
.check-user span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-grid h3 { display: flex; align-items: center; gap: 8px; }
@media (max-width: 1080px) { .settings-grid { grid-template-columns: 1fr; } }
