.todo-tab { padding: 0; height: 100%; display: flex; flex-direction: column; }

/* ===== Toolbar ===== */
.todo-toolbar {
  display: flex;
  gap: .75rem;
  align-items: center;
  padding: .55rem .9rem;
  background: rgba(24, 24, 27, .22);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  flex-wrap: wrap;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.todo-toolbar label { font-size: .82rem; color: #d4d4d8; display: flex; align-items: center; gap: .3rem; }
.todo-toolbar select, .todo-toolbar button {
  background: rgba(39, 39, 42, .45); color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 6px; padding: .22rem .55rem; font-size: .82rem;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.todo-toolbar .todo-count { color: var(--p-light); font-size: .78rem; font-family: 'Menlo', 'Consolas', monospace; }
/* Pilules priorité dans header (ref Vincent 2026-04-29) */
.todo-toolbar .todo-prio-pills { margin-left: auto; display: inline-flex; gap: .25rem; }
.todo-toolbar .todo-pill {
  font-family: 'Menlo','Consolas',monospace;
  font-size: .68rem; font-weight: 700;
  padding: .12rem .45rem; border-radius: 4px;
  border: 1px solid; letter-spacing: .03em;
}
.todo-toolbar .todo-pill.p0 { color: var(--c-state-alarm);    border-color: var(--c-state-alarm);    background: rgba(var(--c-state-alarm-rgb), .12); }
.todo-toolbar .todo-pill.p1 { color: var(--c-state-alert);    border-color: var(--c-state-alert);    background: rgba(var(--c-state-alert-rgb), .12); }
.todo-toolbar .todo-pill.p2 { color: var(--p-base);           border-color: var(--p-base);           background: rgba(var(--p-base-rgb), .12); }
.todo-toolbar .todo-pill.p3 { color: var(--v3);               border-color: var(--v3);               background: rgba(var(--v3-rgb), .1); }
.todo-toolbar .todo-pill.empty { opacity: .35; }   /* count=0 : atténué */

/* ===== Layout : sidebar (catégories) + main (liste) ===== */
.todo-layout {
  display: grid; grid-template-columns: 260px 1fr;
  flex: 1; min-height: 0;
  transition: grid-template-columns .2s;
}
.todo-layout.sidebar-hidden { grid-template-columns: 0 1fr; }
.todo-layout.sidebar-hidden #todo-sidebar { visibility: hidden; border-right: none; }

#todo-sidebar {
  background: rgba(20, 20, 23, .25);
  border-right: 1px solid rgba(255, 255, 255, .1);
  overflow-y: auto;
  min-height: 0;
}
#todo-tree { list-style: none; margin: 0; padding: .4rem 0; }
#todo-tree .tree-cat {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .85rem;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background .12s, border-color .12s, color .12s;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  color: #d4d4d8;
}
#todo-tree .tree-cat:hover { background: rgba(var(--p-base-rgb), .07); }
#todo-tree .tree-cat.active {
  background: rgba(var(--p-glow-rgb), .12);
  box-shadow: inset 2px 0 0 var(--p-base);
  border-left-color: transparent;
}
#todo-tree .tree-cat.active .tc-label { color: var(--p-base); font-weight: 600; }
#todo-tree .tc-icon {
  flex-shrink: 0; opacity: .75;
  width: 22px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--p-base);
}
#todo-tree .tree-cat:hover .tc-icon { opacity: .95; }
#todo-tree .tree-cat.active .tc-icon { opacity: 1; }
#todo-tree .tc-label { color: #e4e4e7; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#todo-tree .tc-badges { display: flex; gap: .22rem; align-items: center; flex-shrink: 0; }
#todo-tree .tc-b {
  font-size: .6rem; font-weight: 700;
  padding: .05rem .32rem; border-radius: 3px; border: 1px solid;
  font-family: 'Menlo','Consolas',monospace; letter-spacing: 0;
}
#todo-tree .tc-b.blocked { color: var(--v2); border-color: var(--v2); background: rgba(var(--v2-rgb),.12); }
#todo-tree .tc-b.prio0   { color: var(--v2); border-color: var(--v2); background: rgba(var(--v2-rgb),.12); }
#todo-tree .tc-b.prio1   { color: #fb923c; border-color: #fb923c; background: rgba(251,146,60,.12); }
#todo-tree .tc-count {
  color: #64748b; font-size: .7rem; font-weight: 400;
  font-family: 'Menlo','Consolas',monospace; letter-spacing: 0;
}

#todo-main { display: flex; flex-direction: column; background: transparent; position: relative; overflow: hidden; min-height: 0; }
#todo-main .sidebar-handle {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 12px; height: 64px;
  background: rgba(39, 39, 42, .55);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, .08);
  border-left: none; border-radius: 0 4px 4px 0;
  cursor: pointer; font-size: .82rem;
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
  transition: background .15s, color .15s;
}
#todo-main .sidebar-handle:hover { background: rgba(var(--p-base-rgb), .18); color: var(--p-base); }

/* ===== Liste + groupes ===== */
.todo-list { flex: 1; overflow-y: auto; padding: .85rem 1.1rem; display: flex; flex-direction: column; gap: .9rem; }
.todo-empty { color: #64748b; font-style: italic; text-align: center; padding: 2rem 0; }

.todo-group { display: flex; flex-direction: column; gap: .3rem; }
.todo-group-header {
  display: flex; align-items: baseline; gap: .5rem;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(var(--p-base-rgb), .18);
  cursor: pointer;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--p-light);
  padding: .1rem .2rem .25rem;
  text-align: left;
  font-family: inherit;
  transition: background .12s;
}
.todo-group-header:hover { background: rgba(var(--p-base-rgb), .06); }
.todo-group-header .g-chevron {
  display: inline-block; width: 12px;
  color: var(--p-base); font-size: .72rem;
  transition: transform .15s; line-height: 1;
}
.todo-group.collapsed .g-chevron { transform: rotate(-90deg); }
.todo-group-header .g-name  { font-weight: 600; color: var(--p-base); }
.todo-group-header .g-count { color: #64748b; font-size: .68rem; margin-left: auto; }
.todo-group-items { display: flex; flex-direction: column; gap: .3rem; }
.todo-group.collapsed .todo-group-items { display: none; }

/* ===== Card — chrome .card-pri (ref design Vincent 2026-04-29)
   Couleur par PRIORITÉ : P0 rouge, P1 orange, P2 --p-base, P3 turquoise.
   Done → opacity .5. ===== */
.todo-card {
  --card-rgb: var(--p-base-rgb);   /* fallback */
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  border-top:    1px solid rgba(var(--card-rgb), .4);
  border-right:  1px solid rgba(var(--card-rgb), .4);
  border-bottom: 1px solid rgba(var(--card-rgb), .4);
  border-left:   2px solid rgba(var(--card-rgb), .9);
  background:
    radial-gradient(circle at top right, rgba(var(--card-rgb), .14), transparent 60%),
    linear-gradient(135deg, rgba(var(--card-rgb), .1) 0%, rgba(var(--card-rgb), .03) 50%, rgba(24, 24, 27, .55) 100%);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  box-shadow: inset 8px 0 14px -8px rgba(var(--card-rgb), .55), inset 0 1px 0 rgba(255, 255, 255, .08), 0 4px 18px rgba(0, 0, 0, .28);
  transition: opacity .2s, border-color .2s, box-shadow .2s;
}
.todo-card.prio-0  { --card-rgb: var(--c-state-alarm-rgb); }
.todo-card.prio-1  { --card-rgb: var(--c-state-alert-rgb); }
.todo-card.prio-2  { --card-rgb: var(--p-base-rgb);        }
.todo-card.prio-3  { --card-rgb: var(--v3-rgb);            }
.todo-card.expanded { border-color: rgba(var(--card-rgb), .55); box-shadow: 0 4px 20px rgba(0, 0, 0, .3); }
.todo-card.pinned   { box-shadow: 0 2px 12px rgba(var(--card-rgb), .25); }
.todo-card.done     { opacity: .5; }
.todo-card.done .t-title-compact { text-decoration: line-through; color: #94a3b8; }

/* ===== Ligne compacte ===== */
.t-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .65rem;
  min-height: 38px;
  cursor: pointer;
}
.t-row > * { flex-shrink: 0; }

.t-expand-chevron {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0 .1rem;
  font-size: .75rem;
  width: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, color .15s;
}
.todo-card.expanded .t-expand-chevron { transform: rotate(90deg); color: var(--p-base); }

.t-check input { margin: 0; }
.t-check input[disabled] { opacity: .35; cursor: not-allowed; }

.t-badges { display: flex; gap: .22rem; }
.badge {
  display: inline-block;
  font-size: .65rem;
  padding: .1rem .4rem;
  border-radius: 3px;
  font-family: 'Menlo', 'Consolas', monospace;
  letter-spacing: .04em;
  border: 1px solid transparent;
  line-height: 1.3;
  font-weight: 600;
  text-align: center;
  box-sizing: border-box;
}
.badge-prio-0, .badge-prio-1, .badge-prio-2, .badge-prio-3 { min-width: 32px; }
.badge-sev-critical, .badge-sev-high, .badge-sev-medium, .badge-sev-low { min-width: 56px; }
.badge-eff { min-width: 26px; }
.badge-prio-0 { background: rgba(239, 68, 68, .22);  color: #fca5a5; border-color: rgba(239, 68, 68, .4); }
.badge-prio-1 { background: rgba(251, 146, 60, .22); color: #fdba74; border-color: rgba(251, 146, 60, .4); }
.badge-prio-2 { background: rgba(var(--p-base-rgb), .18); color: var(--p-light); border-color: rgba(var(--p-base-rgb), .35); }
.badge-prio-3 { background: rgba(100, 116, 139, .2); color: #94a3b8; border-color: rgba(100, 116, 139, .35); }
.badge-sev-critical { background: rgba(239, 68, 68, .2);   color: var(--c-state-critical); border-color: rgba(239, 68, 68, .4); }
.badge-sev-high     { background: rgba(251, 146, 60, .18); color: var(--c-state-alert);    border-color: rgba(251, 146, 60, .35); }
.badge-sev-medium   { background: rgba(148, 163, 184, .15); color: #cbd5e1;                 border-color: rgba(148, 163, 184, .3); }
.badge-sev-low      { background: rgba(74, 222, 128, .15);  color: var(--c-state-notif);    border-color: rgba(74, 222, 128, .3); }
.badge-eff          { background: rgba(255, 255, 255, .05); color: #a1a1aa;                 border-color: rgba(255, 255, 255, .12); }

.t-title-compact {
  flex: 1;
  min-width: 0;
  color: #e4e4e7;
  font-size: .88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.t-ref { color: #64748b; font-family: 'Menlo', 'Consolas', monospace; font-size: .7rem; font-weight: 600; margin-right: .45rem; letter-spacing: .02em; }

.t-meta-compact {
  display: flex; gap: .55rem; align-items: center;
  color: #64748b; font-size: .7rem; font-family: 'Menlo', 'Consolas', monospace;
}
.t-meta-compact .m-node { color: var(--p-light); }
.t-meta-compact .m-due { color: var(--c-state-alert); }
.t-meta-compact .m-due.overdue { color: var(--c-state-critical); font-weight: 600; }
.t-meta-compact .m-pin { color: var(--p-base); }
.t-meta-compact .m-downtime { color: var(--c-state-alert); }

.t-pin-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: .1rem .25rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}
.t-pin-btn:hover { background: rgba(var(--p-base-rgb), .12); color: var(--p-base); }
.t-pin-btn.on { color: var(--p-base); }
.t-pin-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== Section expand (inline) ===== */
.t-expand {
  display: none;
  padding: .75rem 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, .08);
  gap: .8rem;
  flex-direction: column;
}
.todo-card.expanded .t-expand { display: flex; }

.t-sec h4 {
  margin: 0 0 .35rem;
  font-size: .7rem;
  color: var(--p-light);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}
.t-sec p, .t-sec pre { margin: 0; }
.t-desc-full {
  color: #d4d4d8;
  font-size: .84rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.t-raw-input {
  color: #94a3b8;
  font-size: .78rem;
  font-style: italic;
  font-family: 'Menlo', 'Consolas', monospace;
  padding: .4rem .6rem;
  background: rgba(0, 0, 0, .2);
  border-left: 2px solid rgba(255, 255, 255, .08);
  border-radius: 4px;
  white-space: pre-wrap;
}

.t-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .35rem .8rem;
  font-size: .74rem;
  color: #a1a1aa;
  font-family: 'Menlo', 'Consolas', monospace;
}
.t-meta-grid .k { color: #64748b; }
.t-meta-grid .v { color: #d4d4d8; }

.t-score-parts { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; font-size: .68rem; }
.t-score-parts .sp {
  padding: .05rem .35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, .05);
  color: #a1a1aa;
  font-family: 'Menlo', 'Consolas', monospace;
}
.t-score-parts .sp.neg { color: #fca5a5; }
.t-score-parts .sp.total { background: rgba(var(--p-base-rgb), .15); color: var(--p-base); font-weight: 600; }

.t-notes-timeline {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .78rem;
  color: #d4d4d8;
  padding: .4rem .6rem;
  background: rgba(0, 0, 0, .18);
  border-radius: 6px;
  max-height: 180px;
  overflow-y: auto;
  font-family: 'Menlo', 'Consolas', monospace;
}
.t-notes-timeline .tn-line { white-space: pre-wrap; padding: .15rem 0; border-bottom: 1px dashed rgba(255, 255, 255, .05); }
.t-notes-timeline .tn-line:last-child { border-bottom: none; }

.t-verify-out {
  margin-top: .4rem;
  padding: .4rem .6rem;
  font-size: .75rem;
  font-family: 'Menlo', 'Consolas', monospace;
  background: rgba(0, 0, 0, .25);
  border-radius: 4px;
  color: #cbd5e1;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
}
.t-verify-out.ok { border-left: 3px solid var(--c-state-notif); }
.t-verify-out.ko { border-left: 3px solid var(--c-state-critical); }

.t-actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding-top: .4rem;
  border-top: 1px dashed rgba(255, 255, 255, .06);
}

.t-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: rgba(39, 39, 42, .5);
  color: #e4e4e7;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 6px;
  padding: .3rem .65rem;
  font-size: .78rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.t-btn:hover:not(:disabled) { background: rgba(63, 63, 70, .65); border-color: rgba(var(--p-base-rgb), .3); }
.t-btn:disabled { opacity: .4; cursor: not-allowed; }
.t-btn.primary {
  background: linear-gradient(135deg, rgba(var(--p-base-rgb), .85), rgba(var(--p-glow-rgb), .75));
  color: var(--p-text-on);
  border-color: rgba(var(--p-soft-rgb), .8);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(var(--p-glow-rgb), .3);
}
.t-btn.primary:hover:not(:disabled) { box-shadow: 0 0 18px rgba(var(--p-glow-rgb), .5); }
.t-btn.danger       { color: #fca5a5; border-color: rgba(239, 68, 68, .3); }
.t-btn.danger:hover:not(:disabled) { background: rgba(239, 68, 68, .15); color: #fecaca; }

.t-err-inline {
  margin-top: .3rem;
  color: var(--c-state-critical);
  font-size: .75rem;
}

.t-origin-link { color: var(--p-light); text-decoration: none; border-bottom: 1px dashed rgba(var(--p-light-rgb), .4); }
.t-origin-link:hover { color: var(--p-base); }

/* ===== Modals (structure partagée avec portal.css .modal-backdrop) ===== */
.todo-modal {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.todo-modal h2 { margin: 0 0 .3rem; font-size: 1.05rem; color: var(--p-base); font-weight: 600; }
.todo-modal .tm-row { display: grid; grid-template-columns: 110px 1fr; gap: .4rem .7rem; align-items: center; }
.todo-modal .tm-row label { font-size: .78rem; color: #a1a1aa; }
.todo-modal input, .todo-modal select, .todo-modal textarea {
  background: rgba(0, 0, 0, .3);
  color: #e4e4e7;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 6px;
  padding: .35rem .55rem;
  font-size: .84rem;
  font-family: inherit;
  width: 100%;
}
.todo-modal textarea { min-height: 80px; resize: vertical; }
.todo-modal input:focus, .todo-modal select:focus, .todo-modal textarea:focus {
  outline: none; border-color: var(--p-base); box-shadow: 0 0 0 2px rgba(var(--p-base-rgb), .15);
}
.todo-modal .tm-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .4rem; }
.todo-modal .tm-err { color: var(--c-state-critical); font-size: .78rem; }

.todo-modal.wide .modal, .todo-modal-wide { max-width: 560px !important; width: 90vw !important; }

.snooze-choices { display: flex; flex-wrap: wrap; gap: .4rem; }
.snooze-choices button { flex: 0 0 auto; padding: .35rem .7rem; font-size: .82rem; }

/* ===== A3a Responsive Mobile (minimal safe) ===== */
@media (max-width: 768px) {
  .todo-tab { height: auto; }
  .todo-toolbar { flex-wrap: wrap; gap: .35rem; padding: .4rem .5rem; }
  .todo-toolbar label { font-size: .75rem; }
  .todo-toolbar select, .todo-toolbar button { font-size: .78rem; padding: .2rem .45rem; }
  .todo-toolbar input[type="search"] { min-width: 140px; font-size: 16px; }
  .todo-toolbar .todo-count { margin-left: 0; }

  /* Card todo : restructuration en 3 lignes mobile pour respiration
     Ligne 1 : chevron · check · ref · titre · pin (titre flex 1 wrap)
     Ligne 2 : badges (P0 + crit/high/etc + effort)
     Ligne 3 : meta-compact (node, due, downtime)
  */
  .t-row {
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .4rem;
    padding: .45rem .6rem;
    min-height: 0;
  }
  .t-row > * { flex-shrink: 1; min-width: 0; }
  .t-expand-chevron { flex: 0 0 auto; order: 1; }
  .t-check { flex: 0 0 auto; order: 2; }
  .t-ref {
    flex: 0 0 auto; order: 3;
    font-size: .65rem;
    margin-right: 0;
  }
  .t-title-compact {
    flex: 1 1 0%; order: 4;
    min-width: 0;
    white-space: normal;
    line-height: 1.3;
    font-size: .92rem;
  }
  .t-pin-btn {
    flex: 0 0 auto; order: 5;
    margin-left: auto;
  }
  /* Badges : ligne dédiée */
  .t-badges {
    flex: 0 0 100%;
    order: 6;
    padding-left: 22px;   /* aligne avec le début du titre (chevron offset) */
    gap: .25rem;
  }
  .t-badges .badge { font-size: .62rem; padding: .08rem .35rem; }
  .badge-prio-0, .badge-prio-1, .badge-prio-2, .badge-prio-3 { min-width: 28px; }
  .badge-sev-critical, .badge-sev-high, .badge-sev-medium, .badge-sev-low { min-width: 44px; }
  .badge-eff { min-width: 22px; }
  /* Meta-compact (node, due, downtime) : ligne dédiée */
  .t-meta-compact {
    flex: 0 0 100%;
    order: 7;
    padding-left: 22px;
    flex-wrap: wrap;
    gap: .35rem;
    font-size: .7rem;
  }
}

/* ============================================================================
   STANDARD TOOLBAR — uniforme reference Biometrie sante (Vincent 2026-05-10)
   Zone figee (min-height 3.15rem) + controls cohérents (bg .45, radius 6, h 28).
   ============================================================================ */
.todo-toolbar {
  min-height: 3.15rem !important;
  box-sizing: border-box !important;
}
.todo-toolbar input[type="search"],
.todo-toolbar input[type="text"],
.todo-toolbar input[type="date"],
.todo-toolbar input[type="number"],
.todo-toolbar select,
.todo-toolbar button.t-btn {
  background: rgba(39, 39, 42, .45);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 6px;
  padding: .22rem .55rem;
  font-size: .82rem;
  font-family: 'Menlo','Consolas',monospace;
  height: 28px;
  box-sizing: border-box;
  line-height: 1.2;
}
.todo-toolbar button.t-btn:hover:not(:disabled) {
  background: rgba(var(--p-base-rgb), .18);
  color: var(--p-base);
  border-color: rgba(var(--p-base-rgb), .35);
}
.todo-toolbar label {
  font-size: .82rem;
  color: #d4d4d8;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  line-height: 1.2;
}
