/* ── MODAL ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 1.4rem; width: 480px; max-width: 95vw;
  display: flex; flex-direction: column; gap: 0.9rem;
  font-family: 'Montserrat', sans-serif;
}
.modal-title { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.modal-field { display: flex; flex-direction: column; gap: 0.3rem; }
.modal-label { font-size: 0.58rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #1a1a2e; border: 1px solid var(--border); color: var(--text); font-size: 0.7rem; font-weight: 700; padding: 0.4rem 0.6rem; border-radius: 5px; white-space: nowrap; width: max-content; max-width: 280px; text-align: center; line-height: 1.4; pointer-events: none; opacity: 0; transition: opacity 0s; z-index: 10000; }
[data-tip]:hover::after { opacity: 1; }
/* Tooltip vers le bas pour TS/TPE */
.ab-ts-tpe-btn[data-tip]::after, #btnFilterJ1[data-tip]::after { bottom: auto; top: calc(100% + 6px); font-size: 1.05rem; max-width: 420px; }
#btnFilterJ1[data-tip]::after { white-space: pre-line; }
:root[data-theme="light"] [data-tip]::after { background: #ffffff; border-color: #ccc; color: #1a1a2e; }
/* Sidebar: overflow:auto clips ::after → tooltips handled by JS (_sbTip) */
.sidebar [data-tip]::after { display: none; }

.modal-edit-task .permanent-task-help[data-tip]::after,
.modal-edit-task .warn-task-help[data-tip]::after,
.modal-edit-task .domain-help[data-tip]::after,
.modal-edit-task .priority-help[data-tip]::after,
.modal-edit-task .recur-task-help[data-tip]::after,
.modal-edit-task .tasktype-help[data-tip]::after {
  bottom: auto;
  top: calc(100% + 6px);
  white-space: pre-line;
  width: min(320px, calc(100vw - 32px));
  max-width: min(320px, calc(100vw - 32px));
  text-align: left;
  text-transform: none;
  font-size: 1.05rem;
  font-weight: 700;
  overflow-wrap: break-word;
  line-height: 1.35;
}

.modal-edit-task .s2-t-perm + .recur-task-help[data-tip]::after {
  top: auto;
  bottom: calc(100% + 6px);
}

/* JS-driven sidebar tooltip */
#sbTooltip {
  position: fixed; z-index: 10000;
  background: #1a1a2e; border: 1px solid var(--border);
  color: #e8e6f0; font-size: 0.7rem; padding: 0.4rem 0.6rem;
  border-radius: 5px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.08s;
}
:root[data-theme="light"] #sbTooltip {
  background: #ffffff; border-color: #c8c8d8; color: #1a1a2e;
}
.modal-field input, .modal-field select {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 5px;
  color: var(--text); font-family: var(--font); font-size: 0.7rem;
  padding: 0.4rem 0.6rem;
}
.modal-field input:focus, .modal-field select:focus { outline: none; border-color: var(--accent); }
.modal-row { display: flex; gap: 0.6rem; }
.modal-row .modal-field { flex: 1; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.3rem; }
.modal-actions button, .modal-actions input[type="button"], .modal-actions input[type="submit"] { font-size: 0.75rem; padding: 0.4rem 0.8rem; height: 28px; display: flex; align-items: center; justify-content: center; font-family: 'Montserrat', sans-serif; font-weight: 800; }
.modal-hint { font-size: 0.6rem; color: var(--muted); font-style: italic; text-align: center; padding-top: 0.2rem; border-top: 1px solid var(--border); }

/* ── FLIP MODAL (MULTITASKING) ────────────────────────────────────── */
.modal-flip-container { width: 480px; max-width: 95vw; }
.modal-flip-inner { transition: transform 0.6s ease; transform-style: preserve-3d; }
.modal-flip-front, .modal-flip-back { backface-visibility: hidden; }
.modal-flip-back { transform: rotateY(180deg); position: absolute; top: 0; left: 0; width: 100%; }

/* ── NOTEBOOK (cahier d'école) ───────────────────────────────────── */
.subtask-notebook {
  background: #fff !important;
  color: #111 !important;
  width: 485px !important;
  max-width: 95vw !important;
}
.subtask-notebook .modal-title { color: #1a3a6e !important; }
.subtask-notebook .modal-actions { position: relative; z-index: 2; }
.subtask-notebook .modal-actions .btn-ghost { color: #666 !important; }

.notebook-line {
  height: 2.2rem;
  display: flex;
  align-items: flex-end;
  padding: 0 0.6rem;
  cursor: text;
  position: relative;
  border-bottom: 1px solid #1a3a6e;
}
.notebook-line .nb-text {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: #111;
  line-height: 1;
  padding-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.notebook-line.notebook-main .nb-text {
  font-size: 1rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.subtask-notebook .notebook-line .nb-edit {
  font-family: var(--font) !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  color: #111 !important;
  line-height: 1 !important;
  padding: 0 !important;
  padding-bottom: 3px !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  outline: none !important;
  min-height: unset !important;
  width: 100%;
}
.subtask-notebook .notebook-line .nb-edit:focus {
  background: transparent !important;
  border: none !important;
  color: #111 !important;
}
.subtask-notebook .notebook-line.notebook-main .nb-edit {
  font-size: 1rem !important;
  font-weight: 800 !important;
}
.notebook-line .nb-num {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 700;
  color: #999;
  min-width: 1.6rem;
  line-height: 1;
  padding-bottom: 3px;
  flex-shrink: 0;
}
.notebook-line.notebook-main .nb-num {
  color: #1a3a6e;
  font-weight: 800;
}
.notebook-line .nb-delete {
  position: absolute;
  right: 0.3rem;
  bottom: 1px;
  background: none;
  border: none;
  color: #cc0000;
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0 0.2rem;
  line-height: 1;
  display: none;
}
.notebook-line:hover .nb-delete { display: block; }

/* ── TOOLTIP ──────────────────────────────────────────────────────── */
.tooltip {
  position: fixed; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 4px; font-size: 0.6rem; padding: 0.25rem 0.5rem;
  pointer-events: none; opacity: 0; transition: opacity 0.15s; z-index: 200;
}
.empty-state { text-align: center; color: var(--muted); font-size: 0.72rem; padding: 3rem; }
.empty-state .big { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* ── TASK BADGES ──────────────────────────────────────────────────── */
.task-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  font-size: 0.55rem; flex-shrink: 0; line-height: 1;
}
.badge-warn   { background: #ff404033; color: #ff4040; border: 1px solid #ff404055; }
.badge-recur  { background: #00e5ff1a; color: #00e5ff; border: 1px solid #00e5ff44; }
.modal-overlay .notif-recur { font-size: 1.37em; }
.notif-recur { filter: drop-shadow(0 0 3px rgba(0,229,255,0.6)); }
.recur-selector { display:none; flex-direction:column; gap:0.5rem; margin-top:0.4rem;
  padding:0.6rem 0.7rem; background:var(--surface2); border:1px solid var(--border);
  border-radius:6px; font-size:0.68rem; }
.recur-selector.open { display:flex; }
.recur-select { background:var(--surface2); color:var(--text); border:1px solid var(--border);
  border-radius:4px; padding:0.25rem 0.4rem; font-family:var(--font); font-size:0.68rem;
  cursor:pointer; width:100%; }
.recur-select:focus { outline:none; border-color:var(--accent); }
.recur-custom { display:none; align-items:center; gap:0.4rem; margin-top:0.2rem; }
.recur-custom.open { display:flex; }
.recur-custom input { width:60px; background:var(--surface2); color:var(--text);
  border:1px solid var(--border); border-radius:4px; padding:0.2rem 0.4rem;
  font-family:var(--font); font-size:0.68rem; }
.badge-quick  { background: #ff9e7a33; color: var(--accent2); border: 1px solid #ff9e7a55; }
.badge-perm   { background: #c8b8ff22; color: var(--accent);  border: 1px solid #c8b8ff44; font-size: 0.6rem; font-weight: 700; }
.task-domain-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 3px;
  font-size: 0.5rem; font-weight: 700; flex-shrink: 0; letter-spacing: 0;
  background: #7affd422; color: var(--accent3); border: 1px solid #7affd444;
}

/* ── MODAL 3-STEPS : ZOOM IN & CUBE TRANSITION ─────────────────────── */
@keyframes zoomIn {
  from { transform: scale(0.82); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
/* ── DEMI-TOUR : aller (→) et retour (←) ──────────────────────────── */
@keyframes htOut    { from { transform: perspective(900px) rotateY(0);      opacity: 1;   } to { transform: perspective(900px) rotateY(-90deg); opacity: 0;   } }
@keyframes htIn     { from { transform: perspective(900px) rotateY(90deg);  opacity: 0;   } to { transform: perspective(900px) rotateY(0);      opacity: 1;   } }
@keyframes htOutRev { from { transform: perspective(900px) rotateY(0);      opacity: 1;   } to { transform: perspective(900px) rotateY(90deg);  opacity: 0;   } }
@keyframes htInRev  { from { transform: perspective(900px) rotateY(-90deg); opacity: 0;   } to { transform: perspective(900px) rotateY(0);      opacity: 1;   } }
.modal-ht-out     { animation: htOut    0.26s ease-in  forwards; transform-origin: center center; }
.modal-ht-in      { animation: htIn     0.26s ease-out forwards; transform-origin: center center; }
.modal-ht-out-rev { animation: htOutRev 0.26s ease-in  forwards; transform-origin: center center; }
.modal-ht-in-rev  { animation: htInRev  0.26s ease-out forwards; transform-origin: center center; }

/* ── ÉTAPE 1 TYPOLOGIES : DOMAINE ──────────────────────────────────── */
.modal-s1 { width: 870px; }
.modal-s1 .modal-label { font-size: 1.08rem; }
.modal-s1 .modal-title { font-size: 1.3rem; }

.modal-edit-task input,
.modal-edit-task select,
.modal-edit-task textarea {
  font-family: var(--font) !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  color: var(--muted) !important;
  background: var(--surface2) !important;
  border: 2px solid var(--border) !important;
  border-radius: 8px !important;
}

.modal-edit-task select,
.modal-edit-task input:not([type="checkbox"]):not([type="radio"]),
.modal-edit-task textarea {
  padding: 0.5rem 0.55rem !important;
  min-height: 2.55rem;
}

.modal-edit-task input:focus,
.modal-edit-task select:focus,
.modal-edit-task textarea:focus {
  outline: none;
  border-color: var(--text) !important;
  color: var(--text) !important;
}

.modal-edit-task #nModalTPPBtns button,
.modal-edit-task [id^="eModalTPPBtns_"] button {
  font-size: 1.05rem !important;
  opacity: 1;
}

.modal-edit-task #eTaskRecur + span > span:first-child {
  font-family: var(--font);
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--muted) !important;
  text-shadow: none !important;
}

.modal-edit-task #eRecurSelect,
.modal-edit-task #eRecurCustomVal,
.modal-edit-task #eRecurEndDate,
.modal-edit-task #eRecurCustom span,
.modal-edit-task #eRecurEndDateRow span {
  font-size: 1.05rem !important;
}

.modal-edit-task #s3RecurSelect,
.modal-edit-task #s3RecurCustomVal,
.modal-edit-task #s3RecurEndDate,
.modal-edit-task #s3RecurCustom span,
.modal-edit-task #s3RecurEndDateRow span {
  font-size: 1.4rem !important;
}

.modal-edit-task .edit-signal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
}

.modal-edit-task .edit-signal-row .edit-signal-item:first-child {
  justify-self: start;
}

.modal-edit-task .edit-signal-row .edit-signal-item:last-child {
  justify-self: end;
}

.modal-edit-task .edit-signal-item {
  min-width: 0;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}

.modal-edit-task .edit-signal-item > span {
  font-size: 1.05rem;
  white-space: nowrap;
}

.modal-edit-task .edit-signal-sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: center;
  color: var(--muted);
  opacity: 0.8;
  font-size: 1rem;
  line-height: 1.2;
}

.modal-edit-task .modal-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.8rem 0 0.4rem;
}
.modal-edit-task .modal-divider.double hr {
  flex: 1;
  border: none;
  border-top: 1px solid var(--border);
}
.modal-edit-task .modal-divider.double span {
  white-space: nowrap;
  margin: 0;
}

.modal-edit-task .special-task-flag-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.1rem 0;
}

.modal-edit-task .special-task-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--muted);
}

.modal-edit-task .special-task-text,
.modal-edit-task .special-task-text > span {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}

.modal-edit-task .edit-title-case {
  text-transform: capitalize !important;
}

.modal-edit-task .new-inline-field {
  display: flex;
  align-items: flex-end;
}

.modal-edit-task .edit-signal-row.edit-signal-row-single {
  grid-template-columns: 1fr;
}

.modal-edit-task .edit-signal-row.edit-signal-row-single .edit-signal-item {
  justify-self: start;
}

.modal-edit-task .signal-task-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: capitalize;
  line-height: 1.2;
  margin: 0;
  white-space: nowrap;
}

.modal-edit-task .permanent-task-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.modal-edit-task .permanent-task-title {
  margin-right: 0.1rem;
}

:root:not([data-theme="light"]) .modal-s1 .modal-label,
:root:not([data-theme="light"]) .modal-s1 .s1-type-btn:not(.active),
:root:not([data-theme="light"]) .modal-s1 .s1-badge-btn:not(.active),
:root:not([data-theme="light"]) .modal-s1 .s2-prio-btn:not(.active) {
  color: #f3ecd6;
}

@keyframes domainGlowAlpha  { 0%,100% { box-shadow: 0 0 8px rgba(255,64,64,0.4); } 50% { box-shadow: 0 0 22px rgba(255,64,64,0.7); } }
@keyframes domainGlowCharlie{ 0%,100% { box-shadow: 0 0 8px rgba(80,160,255,0.4); } 50% { box-shadow: 0 0 22px rgba(80,160,255,0.7); } }
@keyframes domainGlowTango  { 0%,100% { box-shadow: 0 0 8px rgba(255,210,60,0.4); } 50% { box-shadow: 0 0 22px rgba(255,210,60,0.7); } }

.domain-radio-label {
  display: flex; align-items: center; justify-content: center;
  flex: 1; padding: 0.7rem 0.5rem; border-radius: 8px;
  border: 2px solid; cursor: pointer;
  font-family: 'Rajdhani', sans-serif; font-weight: 700;
  font-size: 1.5rem; letter-spacing: 0.12em;
  transition: background 0.15s;
  user-select: none;
}
.domain-radio-label[data-domain="Alpha"]   { animation: domainGlowAlpha 3s ease-in-out infinite; }
.domain-radio-label[data-domain="Charlie"] { animation: domainGlowCharlie 3s ease-in-out infinite; }
.domain-radio-label[data-domain="Tango"]   { animation: domainGlowTango 3s ease-in-out infinite; }
.domain-radio-label:hover { background: rgba(255,255,255,0.05); }
.domain-radio-label[data-domain="Alpha"].selected  { background: rgba(255,64,64,0.18); }
.domain-radio-label[data-domain="Charlie"].selected{ background: rgba(80,160,255,0.18); }
.domain-radio-label[data-domain="Tango"].selected  { background: rgba(255,210,60,0.18); }

/* ── ÉTAPE 1 TYPOLOGIES : TYPE DE TÂCHE ────────────────────────────── */
.s1-type-btn {
  padding: 0.75rem 0.5rem; border-radius: 10px;
  border: 2px solid var(--border); cursor: pointer;
  font-size: 1.25rem; font-weight: 700; font-family: var(--font);
  text-align: center; line-height: 1.4;
  background: var(--surface2); color: var(--muted);
  transition: all 0.15s; width: 100%;
}
.s1-type-btn:hover:not(.active) { border-color: var(--text); color: var(--text); }
.s1-type-btn.active.s1-type-standard { background: var(--accent);  color: #000; border-color: var(--accent); }
.s1-type-btn.active.s1-type-dense    { background: var(--accent2); color: #000; border-color: var(--accent2); }

/* ── ÉTAPE 1 TYPOLOGIES : BADGES ───────────────────────────────────── */
.s1-badge-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.45rem 0.85rem; border-radius: 20px;
  border: 1px solid; cursor: pointer;
  font-size: 1rem; font-weight: 700; font-family: var(--font);
  background: transparent; transition: all 0.15s;
  opacity: 0.45; white-space: nowrap;
}
.s1-badge-btn:hover  { opacity: 0.8; }
.s1-badge-btn.active { opacity: 1; background: rgba(255,255,255,0.07); }

/* ── ÉTAPE 2 : BOUTONS PRIORITÉ ────────────────────────────────────── */
.s2-prio-btn {
  padding: 0.6rem 0.3rem; border-radius: 8px; cursor: pointer;
  font-size: 0.75rem; font-weight: 700; font-family: var(--font);
  text-align: center; line-height: 1.3;
  border: 2px solid var(--border);
  background: var(--surface2); color: var(--muted);
  transition: all 0.15s; width: 100%;
}
.s2-prio-btn:hover:not(.active) { border-color: var(--pc, var(--text)); color: var(--pc, var(--text)); }
.s2-prio-btn.active { background: var(--pc, var(--accent)); border-color: var(--pc, var(--accent)); color: #000; }

#taskModal .s2-t-dated,
#taskModal .s2-t-recur,
#taskModal .s2-t-perm {
  transition: box-shadow 0.22s ease, filter 0.22s ease, border-color 0.22s ease, color 0.22s ease, background 0.22s ease;
}

#taskModal .s2-t-dated:hover {
  box-shadow: 0 0 14px rgba(200, 184, 255, 0.32);
  filter: brightness(1.05);
}

#taskModal .s2-t-recur:hover {
  box-shadow: 0 0 14px rgba(255, 158, 122, 0.28);
  filter: brightness(1.05);
}

#taskModal .s2-t-perm:hover {
  box-shadow: 0 0 14px rgba(57, 217, 138, 0.30);
  filter: brightness(1.05);
}