/* =========================================================================
   Orbit — toile 3D des besoins + bascule Taches / Besoins
   ========================================================================= */

/* ------------------------- Bascule Taches / Besoins ---------------------- */
.view-seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 12px; background: var(--sunken); }
.view-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 9px; background: #fff; box-shadow: var(--sh-sm); transition: transform 0.35s var(--spring), background 0.3s; }
.view-seg[data-v="besoins"] .view-thumb { transform: translateX(100%); background: #0f1430; }
.view-btn { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border: 0; background: none; font-weight: 600; font-size: 13.5px; color: var(--ink-3); transition: color 0.2s; }
.view-btn[aria-selected="true"] { color: var(--ink); }
.view-seg[data-v="besoins"] .view-btn[data-v="besoins"] { color: #e0e7ff; }
.map-wrap.web-mode .toolbar, .map-wrap.web-mode .map-hint, .map-wrap.web-mode .member-tip { display: none; }

/* --------------------------------- Toile --------------------------------- */
.web {
  position: absolute; inset: 0; z-index: 18; overflow: hidden; color: #e2e8f0;
  background:
    radial-gradient(1100px 700px at 50% 45%, rgba(91, 76, 255, 0.22), transparent 65%),
    radial-gradient(800px 500px at 85% 10%, rgba(236, 72, 153, 0.12), transparent 60%),
    radial-gradient(700px 500px at 10% 90%, rgba(14, 165, 233, 0.12), transparent 60%),
    #05070f;
  opacity: 0; scale: 1.04; transition: opacity 0.45s ease, scale 0.6s var(--ease);
}
.web.in { opacity: 1; scale: 1; }
.web-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.web.rotating .web-canvas { cursor: grabbing; }

.web-top { position: absolute; left: 18px; top: 16px; right: 70px; display: flex; align-items: center; gap: 12px; pointer-events: none; }
.web.panel-open .web-top { right: 378px; }
.web-crumbs, .web-counter {
  background: rgba(15, 20, 48, 0.6); border: 1px solid rgba(148, 163, 255, 0.16);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.web-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; padding: 4px; border-radius: 13px; pointer-events: auto; }
.crumb { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 9px; background: none; color: #a5b4fc; font-size: 13.5px; font-weight: 600; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.crumb:hover { background: rgba(165, 180, 252, 0.12); color: #fff; }
.crumb.current { color: #fff; background: rgba(165, 180, 252, 0.16); }
.crumb-sep { color: rgba(165, 180, 252, 0.45); }
.web-counter { margin-left: auto; flex: none; padding: 8px 14px; border-radius: 99px; font-size: 13.5px; color: #cbd5e1; }

/* Recherche */
.web-search { position: relative; flex: 0 1 280px; min-width: 170px; pointer-events: auto; }
.web-search-box {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 12px; border-radius: 13px;
  background: rgba(15, 20, 48, 0.6); border: 1px solid rgba(148, 163, 255, 0.16);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: border-color 0.15s, box-shadow 0.2s, background 0.15s;
}
.web-search-box:focus-within { border-color: rgba(253, 230, 138, 0.6); box-shadow: 0 0 0 4px rgba(253, 230, 138, 0.12); background: rgba(15, 20, 48, 0.85); }
.web-search-icon { display: flex; color: #64748b; flex: none; }
.web-search-box:focus-within .web-search-icon, .web-search.active .web-search-icon { color: #fde68a; }
.web-search-input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: #f1f5f9; font-size: 14px; }
.web-search-input::placeholder { color: #64748b; }
.web-search-input::-webkit-search-cancel-button { display: none; }
.web-search-count:not(:empty) { flex: none; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 99px; display: grid; place-items: center; font-size: 11.5px; font-weight: 800; color: #1c1917; background: #fde68a; }
.web-search-clear { display: none; width: 26px; height: 26px; border: 0; border-radius: 8px; background: none; color: #94a3b8; place-items: center; flex: none; }
.web-search-clear:hover { background: rgba(148, 163, 255, 0.12); color: #fff; }
.web-search.active .web-search-clear { display: grid; }
.web-search-results {
  position: absolute; left: 0; top: calc(100% + 6px); width: max(100%, 340px); max-height: 380px; overflow-y: auto; z-index: 8;
  padding: 6px; border-radius: 14px; background: rgba(10, 14, 36, 0.96); border: 1px solid rgba(148, 163, 255, 0.2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55); display: none;
}
.web-search.open.active .web-search-results { display: block; animation: fadeUpT 0.18s var(--ease) both; }
.wsr-head { padding: 6px 8px 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #64748b; }
.wsr-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; text-align: left; color: #e2e8f0; }
.wsr-item:hover, .wsr-item.first { background: rgba(148, 163, 255, 0.1); }
.wsr-item .kdot { box-shadow: none; }
.wsr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wsr-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wsr-title mark { background: rgba(253, 230, 138, 0.25); color: #fde68a; border-radius: 3px; padding: 0 1px; }
.wsr-main small { font-size: 12px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wsr-level { flex: none; font-size: 11px; font-weight: 700; color: #a5b4fc; }
.wsr-more, .wsr-empty { padding: 8px; font-size: 12.5px; color: #64748b; }
.web-counter b { color: #34d399; font-size: 14.5px; }

.web-legend { position: absolute; left: 18px; bottom: 44px; display: flex; flex-wrap: wrap; gap: 6px 14px; max-width: 560px; font-size: 12.5px; color: #94a3b8; pointer-events: none; }
.web-legend span { display: inline-flex; align-items: center; gap: 7px; }
.web-legend i, .kdot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); display: inline-block; flex: none; }
.web-legend i.lg-contrainte, .kdot.k-contrainte { border-radius: 2px; rotate: 45deg; scale: 0.85; }
.web-legend i.lg-member { background: transparent; border: 2px dashed #94a3b8; box-shadow: none; }
.web-legend i.lg-link { width: 18px; height: 0; border-radius: 0; background: none; border-top: 2px dashed #fbbf24; box-shadow: none; }
.crumb-lvl { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 6px; background: rgba(165, 180, 252, 0.18); color: #c7d2fe; font-size: 10.5px; font-weight: 800; }

/* Niveau + dependance dans le panneau */
.wp-level { margin-left: 4px; padding: 2px 8px; border-radius: 99px; background: rgba(165, 180, 252, 0.16); color: #c7d2fe; letter-spacing: 0.02em; }
.wp-link { padding: 0; border: 0; background: none; color: #a5b4fc; font: inherit; text-decoration: underline; text-decoration-color: rgba(165, 180, 252, 0.4); text-underline-offset: 2px; cursor: pointer; }
.wp-link:hover { color: #fff; }
.wp-more-add { flex: 1 1 100%; justify-content: center; color: #a5b4fc !important; }
.wp-more-add:hover { background: rgba(165, 180, 252, 0.1) !important; }

/* Modale d'ajout : "Depend de" + liens vers d'autres branches */
.dep-form .stack, .dep-form { gap: 16px; }
.dep-where { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.dep-level { padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; color: var(--primary-ink); background: var(--primary-soft); }
.dep-more { border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; }
.dep-more summary { display: flex; align-items: center; gap: 8px; padding: 11px 0; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); list-style: none; }
.dep-more summary::-webkit-details-marker { display: none; }
.dep-more[open] { padding-bottom: 12px; }
.dep-more .field-hint { display: block; margin-bottom: 8px; }
.dep-links { max-height: 210px; overflow-y: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.dep-link { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.dep-link:hover { background: var(--surface-2); }
.dep-link input { accent-color: var(--primary); margin: 0; }
.dep-link .kdot { box-shadow: none; }
.dep-link-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dep-link small { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }
.dep-empty { padding: 8px; font-size: 13px; color: var(--ink-3); }
.web-hint { position: absolute; left: 18px; bottom: 16px; font-size: 12px; color: #64748b; pointer-events: none; }

.web-add {
  position: absolute; right: 22px; bottom: 22px; width: 54px; height: 54px; border: 0; border-radius: 18px;
  display: grid; place-items: center; color: #fff; background: var(--grad);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 12px 30px -6px rgba(124, 58, 237, 0.7), 0 0 40px rgba(99, 102, 241, 0.35);
  transition: transform 0.25s var(--spring), right 0.45s var(--ease);
}
.web-add:hover { transform: translateY(-2px) rotate(90deg); }
.web.panel-open .web-add { right: 382px; }

.web-tip {
  position: absolute; z-index: 5; max-width: 280px; padding: 10px 12px; border-radius: 12px; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: #cbd5e1;
  background: rgba(10, 14, 36, 0.92); border: 1px solid rgba(148, 163, 255, 0.22); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: translateY(4px); transition: opacity 0.12s, transform 0.15s;
}
.web-tip.show { opacity: 1; transform: none; }
.web-tip b { color: #fff; font-size: 14.5px; }
.web-tip small { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #a5b4fc; }
.web-tip small.k-solution { color: #fbbf24; }
.web-tip small.k-contrainte { color: #f87171; }
.web-tip em { font-style: normal; color: #818cf8; font-size: 12px; margin-top: 3px; }

.web-empty {
  position: absolute; left: 50%; top: 60%; translate: -50% 0; width: min(420px, calc(100% - 40px)); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px; animation: fadeUpT 0.6s 0.3s var(--ease) both;
}
.web.panel-open .web-empty { left: calc((100% - 360px) / 2); }
.web-empty h3 { color: #fff; font-size: 20px; }
.web-empty p { color: #94a3b8; font-size: 14px; margin-bottom: 10px; }
.web-empty-star { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #c4b5fd; background: rgba(139, 92, 246, 0.16); box-shadow: 0 0 30px rgba(139, 92, 246, 0.35); }

/* ---------------------------- Panneau lateral ---------------------------- */
.web-panel-toggle {
  position: absolute; right: 18px; top: 16px; z-index: 7; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: #c7d2fe; background: rgba(15, 20, 48, 0.7); border: 1px solid rgba(148, 163, 255, 0.2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: right 0.45s var(--ease), background 0.15s;
}
.web-panel-toggle:hover { background: rgba(30, 38, 90, 0.85); }
.web.panel-open .web-panel-toggle { right: 26px; top: 26px; background: transparent; border-color: transparent; }
.web-panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: 348px; z-index: 6;
  border-radius: 22px; overflow: hidden; display: flex; flex-direction: column;
  background: rgba(12, 16, 40, 0.8); border: 1px solid rgba(148, 163, 255, 0.16);
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  transform: translateX(calc(100% + 20px)); transition: transform 0.45s var(--ease);
}
.web.panel-open .web-panel { transform: none; }
.web-panel-body { flex: 1; overflow-y: auto; padding: 20px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.web-panel-body::-webkit-scrollbar { width: 8px; }
.web-panel-body::-webkit-scrollbar-thumb { background: rgba(148, 163, 255, 0.2); border-radius: 99px; }
.wp-head { padding-right: 40px; }
.wp-kind { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #a5b4fc; }
.wp-head h2 { margin-top: 6px; color: #fff; font-size: 21px; line-height: 1.25; word-break: break-word; }
.wp-title { display: inline; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.wp-title .icon { display: inline-block; margin-left: 6px; color: #64748b; vertical-align: middle; opacity: 0; transition: opacity 0.15s; }
.wp-title:hover .icon { opacity: 1; }
.wp-sub { margin-top: 4px; font-size: 13px; color: #94a3b8; }
.wp-progress { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600; color: #cbd5e1; }
.wp-progress .bar { background: rgba(148, 163, 255, 0.15); }
.wp-progress .bar i { background: linear-gradient(90deg, #34d399, #10b981); }
.web-panel h4 { margin-top: 8px; font-family: var(--font); font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: #64748b; }
.wp-list { display: flex; flex-direction: column; gap: 4px; }
.wp-empty { font-size: 13px; color: #64748b; padding: 4px 2px; }
.wp-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 11px; transition: background 0.15s; }
.wp-item:hover { background: rgba(148, 163, 255, 0.1); }
.wp-item-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 5px 2px; border: 0; background: none; color: #e2e8f0; text-align: left; font-size: 14px; }
.wp-item-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp-item-main small { font-size: 11.5px; font-weight: 700; color: #94a3b8; }
.wp-item.done .wp-item-title { color: #6ee7b7; text-decoration: line-through; text-decoration-color: rgba(110, 231, 183, 0.5); }
.wp-check { flex: none; width: 22px; height: 22px; border-radius: 50%; padding: 0; display: grid; place-items: center; border: 2px solid rgba(148, 163, 255, 0.35); background: none; color: transparent; transition: all 0.2s; }
.wp-check:hover { border-color: #34d399; color: #34d399; }
.wp-item.done .wp-check { background: #10b981; border-color: #10b981; color: #fff; }
.wp-unlink { width: 28px; height: 28px; color: #64748b; }
.wp-unlink:hover { background: rgba(248, 113, 113, 0.14); color: #f87171; }
.wp-item .avatar { border: 2px solid rgba(12, 16, 40, 0.9); box-sizing: content-box; }
.wp-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.wp-quick .input:first-child { flex: 1 1 100%; min-width: 0; }
.wp-quick select { flex: 1; min-width: 0; }
.wp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.web-panel .field-label { color: #94a3b8; font-size: 12px; }
.web-panel .input { background-color: rgba(5, 8, 22, 0.6); border-color: rgba(148, 163, 255, 0.2); color: #e2e8f0; }
.web-panel .input:hover { border-color: rgba(148, 163, 255, 0.35); }
.web-panel .input:focus { border-color: #818cf8; box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2); }
.web-panel select.input option { background: #0f1430; color: #e2e8f0; }
.input-sm { height: 36px; font-size: 13.5px; padding: 0 10px; border-radius: 9px; }
select.input.input-sm { padding-right: 28px; background-position: right 10px center; }
.wp-desc { font-size: 13px; line-height: 1.5; min-height: 190px; }
.wp-switch { color: #cbd5e1; }
.wp-switch .switch-ui { background: rgba(148, 163, 255, 0.25); }
.wp-delete { align-self: flex-start; margin-top: 10px; }
.web-panel .danger-text:hover { background: rgba(248, 113, 113, 0.12) !important; }
.web-panel-body > .input { flex: none; }

/* -------------------- Choix du type dans la modale ----------------------- */
.kind-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kind-opt { display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 8px; border: 1.5px solid var(--line-strong); border-radius: 11px; background: #fff; font-size: 13px; font-weight: 600; color: var(--ink-2); transition: all 0.15s; }
.kind-opt .kdot { box-shadow: none; }
.kind-opt:hover { border-color: var(--c); }
.kind-opt.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 20%, transparent); }

/* ------------------------------ Responsive ------------------------------- */
@media (max-width: 900px) {
  .web-panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 62%; transform: translateY(calc(100% + 20px)); }
  .web.panel-open .web-top { right: 70px; }
  .web.panel-open .web-add { right: 22px; bottom: calc(62% + 24px); }
  .web.panel-open .web-panel-toggle { top: auto; bottom: calc(62% - 46px); right: 18px; }
  .web.panel-open .web-empty { left: 50%; }
  .web-legend, .web-hint { display: none; }
}
@media (max-width: 720px) {
  .view-btn span { display: none; }
  .view-btn { padding: 0 12px; }
  .web-top { flex-wrap: wrap; }
  .web-counter { margin-left: 0; }
  .kind-picker { grid-template-columns: 1fr; }
  .web-search { flex: 1 1 100%; order: 3; }
  .web-search-results { width: 100%; }
}
