/* =============================================================================
   IGE AI - Componentes (CSS plano; complementa a Tailwind vía CDN)
   ============================================================================= */
:root {
  --primary: #08785F;
  --primary-hover: #066B54;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
}

[x-cloak] { display: none !important; }

/* ----------------------------- Logo Rody ---------------------------------- */
/* El logotipo (rody.webp) es blanco. Se adapta automáticamente:
   - Modo claro: se invierte a negro para verse sobre fondos claros.
   - Modo oscuro: se mantiene blanco. */
.logo-rody { filter: invert(1) brightness(0.15); transition: filter .2s; }
.dark .logo-rody { filter: none; }

/* Variante sobre fondo primario (sidebar header): siempre blanco */
.logo-rody-onprimary { filter: none; }

/* Pie "Powered by Rody" */
.powered-by {
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  font-size: .78rem; color: #94a3b8; font-weight: 600;
}
.powered-by img { width: 18px; height: 18px; }

* { -webkit-tap-highlight-color: transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
.dark ::-webkit-scrollbar-thumb { background: #334155; }

/* ------------------------------- Botones ---------------------------------- */
.btn-primary {
  display: inline-flex; align-items: center; gap: .5rem; justify-content: center;
  background: var(--primary); color: #fff; font-weight: 600; font-size: .875rem;
  padding: .55rem 1rem; border-radius: .75rem; transition: all .15s; cursor: pointer;
  box-shadow: 0 1px 2px rgba(8,120,95,.25);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: .5rem; justify-content: center;
  background: #fff; color: #334155; font-weight: 600; font-size: .875rem;
  padding: .55rem 1rem; border-radius: .75rem; border: 1px solid #e2e8f0; transition: all .15s; cursor: pointer;
}
.btn-secondary:hover { background: #f8fafc; border-color: var(--primary); color: var(--primary); }
.dark .btn-secondary { background: #1e293b; color: #e2e8f0; border-color: #334155; }
.dark .btn-secondary:hover { background: #334155; }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff; font-weight: 600; font-size: .875rem;
  padding: .55rem 1rem; border-radius: .75rem; transition: all .15s; cursor: pointer;
}
.btn-danger:hover { filter: brightness(.92); }

/* -------------------------------- Forms ----------------------------------- */
.form-label { display:block; font-size: .8rem; font-weight: 600; color:#475569; margin-bottom: .35rem; }
.dark .form-label { color:#cbd5e1; }
.form-input {
  width: 100%; padding: .6rem .85rem; border-radius: .75rem; border: 1px solid #e2e8f0;
  background: #fff; color: #0f172a; font-size: .9rem; transition: all .15s; outline: none;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8,120,95,.15); }
.dark .form-input { background:#0f172a; border-color:#334155; color:#f1f5f9; }

/* Inputs grandes para las pantallas de autenticación (sin card contenedor) */
.auth-input {
  width: 100%; padding: .9rem 1.1rem; border-radius: .9rem; font-size: .95rem;
  border: 1px solid #e8edf3; background: #fff; color: #0f172a; outline: none;
  box-shadow: 0 1px 3px rgba(15,23,42,.05); transition: all .15s;
}
.auth-input::placeholder { color: #94a3b8; }
.auth-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8,120,95,.15); }
.dark .auth-input { background:#111c30; border-color:#243149; color:#f1f5f9; box-shadow:none; }
.dark .auth-input::placeholder { color:#64748b; }

/* -------------------------------- Cards ----------------------------------- */
.card {
  background: #fff; border: 1px solid #f1f5f9; border-radius: 1rem; padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(15,23,42,.04);
}
.dark .card { background:#0f172a; border-color:#1e293b; }

.stat-card { display:flex; align-items:center; gap: 1rem; background:#fff; border:1px solid #f1f5f9; border-radius:1rem; padding:1.25rem; box-shadow:0 1px 3px rgba(15,23,42,.04); }
.dark .stat-card { background:#0f172a; border-color:#1e293b; }
.stat-icon { width:3rem; height:3rem; border-radius:.85rem; display:flex; align-items:center; justify-content:center; }
.stat-value { font-size:1.6rem; font-weight:800; line-height:1.1; }
.stat-label { font-size:.78rem; color:#64748b; margin-top:.15rem; }

/* -------------------------------- Badges ---------------------------------- */
.badge { display:inline-flex; align-items:center; padding:.2rem .6rem; border-radius:9999px; font-size:.72rem; font-weight:600; }

/* ------------------------------- Sidebar ---------------------------------- */
.sidebar-link {
  display:flex; align-items:center; gap:.75rem; padding:.6rem .85rem; border-radius:.75rem;
  color:#475569; font-weight:500; font-size:.9rem; transition: all .15s;
}
.sidebar-link:hover { background:#f1f5f9; color: var(--primary); }
.dark .sidebar-link { color:#cbd5e1; }
.dark .sidebar-link:hover { background:#1e293b; }
.sidebar-link-active { background: rgba(8,120,95,.1); color: var(--primary); font-weight:600; }
.dark .sidebar-link-active { background: rgba(8,120,95,.18); color:#5eead4; }

/* --------------------------------- Tabs ----------------------------------- */
.tab { padding:.7rem 1rem; font-size:.9rem; font-weight:600; color:#64748b; border-bottom:2px solid transparent; white-space:nowrap; cursor:pointer; background:transparent; }
.tab:hover { color: var(--primary); }
.tab-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ------------------------------- Progress --------------------------------- */
.progress-track { height:.45rem; background:#e2e8f0; border-radius:9999px; overflow:hidden; flex:1; }
.dark .progress-track { background:#334155; }
.progress-bar { height:100%; border-radius:9999px; transition: width .3s; }
.bg-emerald-500 { background:#10b981; } .bg-teal-500 { background:#14b8a6; }
.bg-amber-500 { background:#f59e0b; } .bg-slate-300 { background:#cbd5e1; }

/* --------------------------------- Chips ---------------------------------- */
.chip { padding:.35rem .75rem; border-radius:9999px; font-size:.78rem; background:#f1f5f9; color:#475569; border:1px solid #e2e8f0; cursor:pointer; transition:all .15s; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.dark .chip { background:#1e293b; color:#cbd5e1; border-color:#334155; }

/* --------------------------------- Toast ---------------------------------- */
.toast-container {
  position: fixed; top: 1.25rem; right: 1.25rem; z-index: 200;
  display: flex; flex-direction: column; gap: .65rem;
  width: 360px; max-width: calc(100vw - 2.5rem); pointer-events: none;
}
.toast {
  pointer-events: auto; position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem .9rem .85rem 1rem; border-radius: 1rem;
  background: #fff; color: #0f172a;
  box-shadow: 0 12px 30px -8px rgba(15,23,42,.25), 0 4px 10px -4px rgba(15,23,42,.12);
  border: 1px solid #eef2f7; border-left: 4px solid var(--primary);
  transform: translateX(120%); opacity: 0;
  transition: transform .35s cubic-bezier(.21,1.02,.73,1), opacity .35s;
}
.dark .toast { background:#0f172a; color:#e2e8f0; border-color:#1e293b; border-left-color: var(--primary); }
.toast.show { transform: translateX(0); opacity: 1; }
.toast.hide { transform: translateX(120%); opacity: 0; }
.toast-icon {
  flex-shrink: 0; width: 2.1rem; height: 2.1rem; border-radius: .7rem;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.toast-body { flex: 1; min-width: 0; padding-top: .1rem; }
.toast-title { font-weight: 700; font-size: .85rem; line-height: 1.2; }
.toast-msg { font-size: .8rem; color: #64748b; margin-top: .12rem; word-break: break-word; }
.dark .toast-msg { color:#94a3b8; }
.toast-close { flex-shrink:0; color:#cbd5e1; cursor:pointer; padding:.1rem; line-height:1; font-size:1rem; background:none; border:none; }
.toast-close:hover { color:#64748b; }
.toast-progress { position:absolute; left:0; bottom:0; height:3px; width:100%; transform-origin:left; }

.toast.t-success { border-left-color: var(--success); }
.toast.t-success .toast-icon { background: var(--success); }
.toast.t-success .toast-progress { background: var(--success); }
.toast.t-error { border-left-color: var(--danger); }
.toast.t-error .toast-icon { background: var(--danger); }
.toast.t-error .toast-progress { background: var(--danger); }
.toast.t-warning { border-left-color: var(--warning); }
.toast.t-warning .toast-icon { background: var(--warning); }
.toast.t-warning .toast-progress { background: var(--warning); }
.toast.t-info { border-left-color: var(--primary); }
.toast.t-info .toast-icon { background: var(--primary); }
.toast.t-info .toast-progress { background: var(--primary); }

@keyframes toastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ------------------------------- Diálogos --------------------------------- */
.dialog-overlay {
  position: fixed; inset: 0; z-index: 210; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(15,23,42,.55); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .2s;
}
.dialog-overlay.show { opacity: 1; }
.dialog-card {
  width: 100%; max-width: 26rem; background: #fff; border-radius: 1.25rem; padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.4); text-align: center;
  transform: scale(.92) translateY(8px); transition: transform .22s cubic-bezier(.21,1.02,.73,1);
}
.dialog-overlay.show .dialog-card { transform: scale(1) translateY(0); }
.dark .dialog-card { background:#0f172a; color:#e2e8f0; }
.dialog-icon { width:3.5rem; height:3.5rem; border-radius:1rem; margin:0 auto .9rem; display:flex; align-items:center; justify-content:center; color:#fff; }
.dialog-title { font-size:1.15rem; font-weight:800; }
.dialog-msg { font-size:.9rem; color:#64748b; margin-top:.4rem; }
.dark .dialog-msg { color:#94a3b8; }
.dialog-actions { display:flex; gap:.6rem; margin-top:1.4rem; }
.dialog-actions .btn-primary, .dialog-actions .btn-secondary, .dialog-actions .btn-danger { flex:1; justify-content:center; padding:.65rem 1rem; }

.line-clamp-2 { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }

/* ----------------------- Nota de voz (reproductor) ------------------------ */
.voice-note { display:flex; align-items:center; gap:.6rem; width:240px; max-width:62vw; }
.voice-play { flex-shrink:0; width:2.2rem; height:2.2rem; border-radius:9999px; border:none; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:transform .12s, background .15s; background: var(--primary); color:#fff; }
.voice-play:hover { transform:scale(1.06); }
.voice-play:active { transform:scale(.96); }
.voice-icon { display:flex; }
.voice-icon svg { width:1.05rem; height:1.05rem; }
.voice-icon.pause { display:none; }
.voice-note.playing .voice-icon.play { display:none; }
.voice-note.playing .voice-icon.pause { display:flex; }

.voice-wave { flex:1; height:30px; display:flex; align-items:center; gap:2px; cursor:pointer; }
.voice-bar { flex:1; min-width:2px; border-radius:9999px; background:#cbd5e1; transition: background .1s, height .2s; }
.voice-bar.played { background: var(--primary); }
.voice-time { flex-shrink:0; font-size:.7rem; font-weight:600; color:#64748b; min-width:1.8rem; text-align:right; font-variant-numeric:tabular-nums; }
.dark .voice-bar { background:#475569; }

/* Variante para mis mensajes (burbuja primaria): blanco sobre verde */
.voice-note--mine .voice-play { background:#fff; color: var(--primary); }
.voice-note--mine .voice-bar { background: rgba(255,255,255,.45); }
.voice-note--mine .voice-bar.played { background:#fff; }
.voice-note--mine .voice-time { color: rgba(255,255,255,.8); }

/* ----------------------- Chat: menciones y autocompletado ---------------- */
.mention-list { position:absolute; z-index:40; left:0; bottom:calc(100% + .5rem); width:min(22rem,calc(100vw - 7rem)); max-height:16rem; overflow-y:auto; padding:.35rem; border:1px solid #e2e8f0; border-radius:.85rem; background:#fff; box-shadow:0 14px 34px rgba(15,23,42,.16); }
.dark .mention-list { background:#0f172a; border-color:#334155; }
.mention-option { width:100%; display:flex; align-items:center; gap:.65rem; padding:.55rem .65rem; border-radius:.65rem; text-align:left; transition:background .12s; }
.mention-option:hover,.mention-option.is-active { background:rgba(8,120,95,.09); }
.mention-option > span:last-child { min-width:0; }
.mention-option b { display:block; font-size:.78rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mention-option small { display:block; margin-top:.05rem; color:#94a3b8; font-size:.66rem; }
.mention-avatar { flex:none; width:30px; height:30px; display:flex; align-items:center; justify-content:center; border-radius:999px; background:rgba(8,120,95,.12); color:var(--primary); font-size:.62rem; font-weight:800; }
.chat-mention { display:inline-block; padding:0 .22rem; border-radius:.3rem; background:rgba(14,165,233,.14); color:#0369a1; font-weight:700; }
.bg-primary .chat-mention { background:rgba(255,255,255,.2); color:#fff; }
.dark .chat-mention { color:#7dd3fc; background:rgba(14,165,233,.16); }
.chat-message-mentioned { border-radius:1rem; background:rgba(14,165,233,.06); box-shadow:0 0 0 5px rgba(14,165,233,.06); }
.chat-message-target { animation:messageTarget 2.5s ease; }
@keyframes messageTarget { 0%,35% { transform:translateY(-2px); filter:drop-shadow(0 0 10px rgba(14,165,233,.4)); } 100% { transform:none; filter:none; } }

/* ====================== GANTT (visualizador propio) ======================= */
.gantt-container { width:100%; height:min(68vh,720px); min-height:420px; overflow:auto; position:relative; user-select:none; background:#fff; scrollbar-color:#cbd5e1 transparent; }
.dark .gantt-container { background:#0f172a; scrollbar-color:#475569 transparent; }
.gantt-grid { position:relative; min-width:100%; }
.gantt-header { display:flex; position:sticky; top:0; z-index:20; height:66px; background:#f8fafc; border-bottom:1px solid #cbd5e1; box-shadow:0 2px 8px rgba(15,23,42,.06); }
.dark .gantt-header { background:#0b1220; border-color:#334155; }
.gantt-sidebar-head { min-width:410px; width:410px; padding:0 14px; display:grid; grid-template-columns:1fr 120px; align-items:center; gap:10px; font-weight:700; font-size:.72rem; color:#64748b; text-transform:uppercase; letter-spacing:.04em; border-right:1px solid #cbd5e1; position:sticky; left:0; background:inherit; z-index:22; }
.dark .gantt-sidebar-head { border-color:#334155; color:#94a3b8; }
.gantt-timeline-head { display:flex; flex-direction:column; overflow:hidden; }
.gantt-months, .gantt-days { display:flex; flex-shrink:0; }
.gantt-months { height:30px; background:#f1f5f9; border-bottom:1px solid #e2e8f0; }
.dark .gantt-months { background:#111c2e; border-color:#334155; }
.gantt-month-tick { flex-shrink:0; display:flex; align-items:center; justify-content:center; border-right:1px solid #cbd5e1; color:#475569; font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; }
.dark .gantt-month-tick { border-color:#334155; color:#cbd5e1; }
.gantt-days { height:36px; }
.gantt-tick { flex-shrink:0; display:flex; flex-direction:column; align-items:center; justify-content:center; border-right:1px solid #e2e8f0; color:#64748b; font-size:.66rem; line-height:.78rem; }
.gantt-tick small { font-size:.55rem; text-transform:uppercase; color:#94a3b8; }
.gantt-tick b { font-size:.7rem; }
.gantt-tick.weekend { background:rgba(148,163,184,.1); }
.gantt-tick.compact { flex-direction:row; font-weight:600; white-space:nowrap; }
.dark .gantt-tick { border-color:#263449; color:#94a3b8; }
.dark .gantt-tick.weekend { background:rgba(2,6,23,.34); }
.gantt-body { position:relative; min-height:120px; }
.gantt-phase-row { display:flex; height:38px; border-bottom:1px solid #e2e8f0; background:#f8fafc; }
.dark .gantt-phase-row { border-color:#334155; background:#101a2b; }
.gantt-phase-label { min-width:410px; width:410px; padding:0 14px; display:flex; align-items:center; gap:8px; position:sticky; left:0; z-index:12; background:inherit; border-right:1px solid #cbd5e1; }
.dark .gantt-phase-label { border-color:#334155; }
.gantt-phase-dot { width:9px; height:9px; border-radius:3px; background:var(--phase-color); box-shadow:0 0 0 3px color-mix(in srgb, var(--phase-color) 14%, transparent); }
.gantt-phase-label b { min-width:0; max-width:210px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.76rem; color:#334155; }
.dark .gantt-phase-label b { color:#e2e8f0; }
.gantt-phase-label > span:last-child { margin-left:auto; font-size:.63rem; color:#94a3b8; }
.gantt-phase-track { flex:none; display:flex; align-items:center; padding-left:12px; color:#94a3b8; font-size:.62rem; background-image:repeating-linear-gradient(90deg,transparent 0,transparent 41px,rgba(148,163,184,.08) 42px); }
.gantt-row { display:flex; border-bottom:1px solid #edf2f7; height:66px; }
.dark .gantt-row { border-color:#1e293b; }
.gantt-row:hover .gantt-track { background-color:#f8fafc; }
.dark .gantt-row:hover .gantt-track { background-color:#111c2e; }
.gantt-row-label { min-width:410px; width:410px; height:66px; padding:0 12px 0 14px; display:grid; grid-template-columns:minmax(0,1fr) 120px; gap:10px; align-items:center; text-align:left; border-right:1px solid #cbd5e1; position:sticky; left:0; background:#fff; z-index:11; cursor:pointer; }
.gantt-row-label:hover { background:#f8fafc; }
.dark .gantt-row-label { background:#0f172a; border-color:#334155; }
.dark .gantt-row-label:hover { background:#111c2e; }
.gantt-task-copy { min-width:0; display:flex; flex-direction:column; }
.gantt-row-label .t-name { font-size:.76rem; font-weight:650; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:#334155; }
.dark .gantt-row-label .t-name { color:#e2e8f0; }
.gantt-row-label .t-role { margin-top:2px; font-size:.61rem; line-height:.8rem; color:#94a3b8; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.gantt-assignee { min-width:0; display:flex; align-items:center; gap:5px; font-size:.63rem; color:#475569; }
.dark .gantt-assignee { color:#cbd5e1; }
.gantt-assignee i { flex:none; width:23px; height:23px; display:flex; align-items:center; justify-content:center; border-radius:999px; background:rgba(8,120,95,.12); color:var(--primary); font-style:normal; font-weight:800; font-size:.56rem; }
.gantt-assignee span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.gantt-assignee.is-empty { color:#94a3b8; }
.gantt-assignee.is-empty i { background:#f1f5f9; color:#94a3b8; }
.dark .gantt-assignee.is-empty i { background:#1e293b; }
.gantt-track { position:relative; flex:none; height:66px; background-image:repeating-linear-gradient(90deg,transparent 0,transparent calc(var(--day-width) - 1px),rgba(148,163,184,.13) var(--day-width)); transition:background-color .12s; }
.gantt-bar { position:absolute; top:17px; height:32px; min-width:22px; background:var(--phase-color,var(--primary)); border-radius:8px; display:flex; align-items:center; gap:8px; padding:0 8px; color:#fff; font-size:.66rem; cursor:grab; box-shadow:0 3px 8px color-mix(in srgb,var(--phase-color,var(--primary)) 34%,transparent); overflow:hidden; white-space:nowrap; z-index:5; transition:filter .15s,box-shadow .15s,transform .15s; }
.gantt-bar:hover { filter:saturate(1.12) brightness(1.04); box-shadow:0 5px 13px color-mix(in srgb,var(--phase-color,var(--primary)) 42%,transparent); transform:translateY(-1px); }
.gantt-bar.dragging { cursor:grabbing; filter:brightness(1.08); z-index:9; }
.gantt-bar .bar-progress { position:absolute; left:0; top:0; bottom:0; background:rgba(255,255,255,.23); border-right:1px solid rgba(255,255,255,.38); }
.gantt-bar .bar-label { position:relative; z-index:1; overflow:hidden; text-overflow:ellipsis; font-weight:650; }
.gantt-bar .bar-percent { position:relative; z-index:1; margin-left:auto; padding-left:4px; font-size:.58rem; opacity:.8; }
.gantt-bar .bar-handle { position:absolute; top:0; bottom:0; width:9px; cursor:ew-resize; z-index:3; opacity:0; transition:opacity .15s; }
.gantt-bar:hover .bar-handle { opacity:1; }
.gantt-bar .bar-handle::after { content:""; position:absolute; top:9px; bottom:9px; width:2px; border-radius:2px; background:rgba(255,255,255,.8); }
.gantt-bar .bar-handle.left { left:0; } .gantt-bar .bar-handle.left::after { left:3px; }
.gantt-bar .bar-handle.right { right:0; } .gantt-bar .bar-handle.right::after { right:3px; }
.gantt-bar.done { background:var(--success); --phase-color:var(--success) !important; }
.gantt-bar.blocked { background:var(--danger); --phase-color:var(--danger) !important; }
.gantt-bar.milestone { width:22px!important; height:22px; top:22px; padding:0; overflow:visible; background:transparent; box-shadow:none; }
.gantt-milestone-core { width:16px; height:16px; margin-left:3px; transform:rotate(45deg); border-radius:3px; background:var(--warning); border:2px solid #fff; box-shadow:0 2px 7px rgba(217,119,6,.4); }
.gantt-no-date { position:absolute; left:12px; top:20px; color:#94a3b8; font-size:.65rem; font-style:italic; }
.gantt-dep-svg { position:absolute; inset:0; pointer-events:none; overflow:visible; z-index:4; }
.gantt-dependency { fill:none; stroke:#94a3b8; stroke-width:1.4; opacity:.8; }
.gantt-today { position:absolute; top:0; bottom:0; width:2px; background:#ef4444; z-index:7; pointer-events:none; box-shadow:0 0 0 1px rgba(239,68,68,.08); }
.gantt-today span { position:sticky; top:3px; display:inline-block; transform:translate(-50%,-2px); padding:2px 5px; border-radius:5px; background:#ef4444; color:#fff; font-size:.55rem; font-weight:700; }
.gantt-empty { position:sticky; left:0; width:min(100vw,700px); padding:70px 20px; text-align:center; color:#94a3b8; font-size:.82rem; }
@media (max-width:640px) {
  .gantt-sidebar-head,.gantt-phase-label,.gantt-row-label { min-width:300px; width:300px; }
  .gantt-sidebar-head,.gantt-row-label { grid-template-columns:minmax(0,1fr) 88px; }
  .gantt-assignee span { display:none; }
}

/* ----- Generador IA: chip activo, spinner y barra de progreso por etapas ----- */
.chip-active { background: var(--primary) !important; color:#fff !important; border-color: var(--primary) !important; }
.dark .chip-active { background: var(--primary) !important; color:#fff !important; }
.ai-spinner { width:22px; height:22px; border-radius:9999px; border:3px solid #e2e8f0; border-top-color: var(--primary); display:inline-block; animation: aiSpin .7s linear infinite; flex-shrink:0; }
.dark .ai-spinner { border-color:#334155; border-top-color: var(--primary); }
@keyframes aiSpin { to { transform: rotate(360deg); } }
.ai-progress-bar { width:100%; height:6px; border-radius:9999px; background:#e2e8f0; overflow:hidden; }
.dark .ai-progress-bar { background:#334155; }
.ai-progress-fill { height:100%; width:8%; border-radius:9999px; background:linear-gradient(90deg, var(--primary), #10b981); transition:width .8s ease; }

.ai-choice { display:flex; align-items:center; gap:.6rem; padding:.65rem .7rem; text-align:left; border:1px solid #e2e8f0; border-radius:.8rem; background:#fff; color:#334155; transition:border-color .15s, background .15s, transform .15s, box-shadow .15s; }
.ai-choice:hover { border-color:color-mix(in srgb, var(--primary) 45%, #e2e8f0); transform:translateY(-1px); }
.ai-choice b { display:block; font-size:.78rem; line-height:1rem; }
.ai-choice small { display:block; color:#94a3b8; font-size:.65rem; line-height:.9rem; margin-top:.08rem; }
.ai-choice-icon { font-size:1.05rem; }
.ai-choice-active { border-color:var(--primary); background:color-mix(in srgb, var(--primary) 8%, white); box-shadow:0 0 0 2px color-mix(in srgb, var(--primary) 14%, transparent); color:var(--primary); }
.dark .ai-choice { background:#0f172a; border-color:#334155; color:#cbd5e1; }
.dark .ai-choice-active { background:color-mix(in srgb, var(--primary) 18%, #0f172a); border-color:var(--primary); color:#6ee7b7; }
.ai-choice-attention { animation:choiceAttention .42s ease-in-out 2; }
@keyframes choiceAttention { 50% { transform:translateX(4px); filter:drop-shadow(0 0 5px rgba(239,68,68,.25)); } }
.ai-textarea-error { border-color:var(--danger)!important; box-shadow:0 0 0 3px rgba(239,68,68,.1)!important; }

/* ----------------------------- Dashboard (Turbo) --------------------------- */
.team-card { display:block; background:#fff; border:1px solid #f1f5f9; border-radius:1rem; padding:1.1rem; box-shadow:0 1px 3px rgba(15,23,42,.04); transition: box-shadow .2s, transform .2s, border-color .2s; }
.team-card:hover { box-shadow:0 8px 24px rgba(15,23,42,.08); transform: translateY(-2px); border-color: color-mix(in srgb, var(--team) 35%, transparent); }
.dark .team-card { background:#0f172a; border-color:#1e293b; }

/* Filas del cronograma */
.sched-row { display:grid; grid-template-columns: 130px 1fr 48px; align-items:center; gap:.75rem; padding:.35rem .25rem; border-radius:.6rem; transition: background .15s; }
.sched-row:hover { background:#f8fafc; }
.dark .sched-row:hover { background:rgba(30,41,59,.5); }
.sched-label { min-width:0; }
.sched-track { position:relative; height:30px; background:#f1f5f9; border-radius:9999px; overflow:hidden; }
.dark .sched-track { background:#1e293b; }
.sched-bar { position:absolute; left:0; top:0; height:100%; min-width:42px; border-radius:9999px; display:flex; align-items:center; padding:0 .6rem; box-shadow:0 2px 6px color-mix(in srgb, var(--barcolor) 45%, transparent); transition: width .4s ease; }
.sched-pct { text-align:right; font-size:.78rem; font-weight:700; color:#475569; }
.dark .sched-pct { color:#cbd5e1; }
@media (max-width: 640px) {
  .sched-row { grid-template-columns: 1fr 44px; }
  .sched-label { display:none; }
}

/* ----------------------- Lista de proyectos (cards) ------------------------ */
.project-card { position:relative; display:block; overflow:hidden; background:#fff; border:1px solid #f1f5f9; border-radius:1.1rem; padding:1.25rem 1.25rem 1.1rem; box-shadow:0 1px 3px rgba(15,23,42,.04); transition: box-shadow .2s, transform .2s, border-color .2s; }
.project-card:hover { box-shadow:0 12px 28px -8px rgba(15,23,42,.12); transform: translateY(-3px); border-color: rgba(8,120,95,.35); }
.dark .project-card { background:#0f172a; border-color:#1e293b; }
.project-card-bar { position:absolute; left:0; top:0; bottom:0; width:4px; border-radius:4px 0 0 4px; opacity:.9; }

/* Tabs de filtro por estado */
.filter-tab { display:inline-flex; align-items:center; gap:.45rem; padding:.5rem .9rem; border-radius:9999px; font-size:.82rem; font-weight:600; color:#64748b; background:#fff; border:1px solid #e2e8f0; white-space:nowrap; transition:all .15s; }
.filter-tab:hover { border-color: var(--primary); color: var(--primary); }
.dark .filter-tab { background:#0f172a; color:#94a3b8; border-color:#1e293b; }
.filter-tab-active { background: var(--primary); color:#fff; border-color: var(--primary); }
.dark .filter-tab-active { background: var(--primary); color:#fff; }
.filter-tab-count { display:inline-flex; align-items:center; justify-content:center; min-width:1.3rem; height:1.3rem; padding:0 .35rem; border-radius:9999px; font-size:.7rem; font-weight:700; background:rgba(100,116,139,.12); color:inherit; }
.filter-tab-active .filter-tab-count { background:rgba(255,255,255,.25); }

/* ===================== Asistente IA (chat coherente) ====================== */
.ai-surface { background:#f8fafc; border:1px solid #eef2f7; border-radius:1.25rem; padding:1.25rem; min-height:200px; }
.dark .ai-surface { background:#0b1220; border-color:#1e293b; }

.ai-avatar-bot { width:2.25rem; height:2.25rem; border-radius:.85rem; flex-shrink:0; display:flex; align-items:center; justify-content:center; color:#fff; background:linear-gradient(135deg, var(--primary), #10b981); box-shadow:0 4px 10px rgba(8,120,95,.25); }
.ai-avatar-user { width:2.25rem; height:2.25rem; border-radius:.85rem; flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:.72rem; font-weight:700; color:#fff; background:#475569; }
.dark .ai-avatar-user { background:#334155; }

.ai-bubble-bot { background:#fff; border:1px solid #eef2f7; border-radius:.25rem 1rem 1rem 1rem; padding:.9rem 1rem; box-shadow:0 1px 2px rgba(15,23,42,.04); }
.dark .ai-bubble-bot { background:#0f172a; border-color:#1e293b; }
.ai-bubble-user { background: var(--primary); color:#fff; border-radius:1rem .25rem 1rem 1rem; padding:.7rem 1rem; max-width:80%; box-shadow:0 2px 8px rgba(8,120,95,.25); }
.ai-bubble-user p { color:#fff; }

/* Composer */
.ai-composer { margin-top:1rem; background:#fff; border:1px solid #e2e8f0; border-radius:1.25rem; box-shadow:0 8px 24px -10px rgba(15,23,42,.12); transition: border-color .15s, box-shadow .15s; }
.ai-composer:focus-within { border-color: var(--primary); box-shadow:0 8px 24px -10px rgba(8,120,95,.3); }
.dark .ai-composer { background:#0f172a; border-color:#1e293b; }
.ai-textarea { width:100%; border:none; outline:none; resize:none; background:transparent; font-size:.95rem; color:#0f172a; line-height:1.5; }
.ai-textarea::placeholder { color:#94a3b8; }
.dark .ai-textarea { color:#f1f5f9; }
.ai-opt { display:inline-flex; align-items:center; gap:.4rem; padding:.4rem .7rem; border-radius:.7rem; border:1px solid #e2e8f0; background:#f8fafc; cursor:pointer; transition:border-color .15s; }
.ai-opt:hover { border-color: var(--primary); }
.dark .ai-opt { background:#111c30; border-color:#243149; }
.ai-opt input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.4); }
.ai-date-opt { align-items:center; min-width:9.75rem; }
.ai-opt-copy { display:flex; flex-direction:column; line-height:1.1; }
.ai-opt-copy small { color:#94a3b8; font-size:.65rem; font-weight:700; margin-bottom:.2rem; text-transform:uppercase; letter-spacing:.04em; }
.ai-opt-error { border-color:var(--danger)!important; box-shadow:0 0 0 3px rgba(239,68,68,.1); }

/* Banner de saludo del dashboard */
.dash-banner { position:relative; overflow:hidden; border-radius:1.25rem; padding:1.5rem 1.75rem; background:linear-gradient(120deg, var(--primary) 0%, #0a8d6f 55%, #10b981 100%); box-shadow:0 10px 30px -12px rgba(8,120,95,.5); }
.dash-banner::before { content:""; position:absolute; right:-40px; top:-60px; width:220px; height:220px; border-radius:9999px; background:rgba(255,255,255,.12); }
.dash-banner::after { content:""; position:absolute; right:60px; bottom:-90px; width:180px; height:180px; border-radius:9999px; background:rgba(255,255,255,.08); }
.dash-pill { display:inline-flex; align-items:center; gap:.5rem; padding:.35rem .8rem; border-radius:9999px; background:rgba(255,255,255,.18); color:#fff; font-size:.8rem; font-weight:600; backdrop-filter:blur(4px); }

/* ------------------- Tabs del proyecto (control segmentado) ----------------- */
.proj-tabs { display:flex; gap:.3rem; padding:.4rem; background:#fff; border:1px solid #f1f5f9; border-radius:1rem; overflow-x:auto; box-shadow:0 1px 3px rgba(15,23,42,.04); }
.dark .proj-tabs { background:#0f172a; border-color:#1e293b; }
.proj-tab { display:inline-flex; align-items:center; gap:.5rem; padding:.6rem 1rem; border-radius:.7rem; font-size:.85rem; font-weight:600; color:#64748b; white-space:nowrap; cursor:pointer; background:transparent; border:none; transition:all .15s; }
.proj-tab svg { width:1.05rem; height:1.05rem; flex-shrink:0; }
.proj-tab:hover { background:#f1f5f9; color:#334155; }
.dark .proj-tab { color:#94a3b8; }
.dark .proj-tab:hover { background:#1e293b; color:#e2e8f0; }
.proj-tab-active, .proj-tab-active:hover { background: var(--primary); color:#fff; box-shadow:0 2px 8px rgba(8,120,95,.3); }
.dark .proj-tab-active, .dark .proj-tab-active:hover { background: var(--primary); color:#fff; }

/* ===================== Detalle de proyecto (resumen) ===================== */
.project-page { width:100%; max-width:1600px; margin:0 auto; }
.project-hero {
  position:relative; overflow:visible; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:2rem;
  padding:1.6rem 1.7rem; border:1px solid #e5ebf1; border-radius:1.25rem;
  background:#fff;
  box-shadow:0 10px 35px -26px rgba(15,23,42,.28);
}
.project-hero::before { content:""; position:absolute; left:0; top:1.6rem; bottom:1.6rem; width:4px; border-radius:0 999px 999px 0; background:var(--primary); }
.dark .project-hero { border-color:#233148; background:#0f172a; box-shadow:none; }
.project-hero-main { min-width:0; max-width:980px; }
.project-breadcrumb { display:flex; align-items:center; gap:.45rem; margin-bottom:.6rem; font-size:.72rem; color:#94a3b8; }
.project-breadcrumb a { font-weight:600; color:var(--primary); }
.project-breadcrumb a:hover { text-decoration:underline; }
.project-title { max-width:58rem; color:#172033; font-size:clamp(1.45rem,2vw,2rem); line-height:1.15; font-weight:800; letter-spacing:-.035em; }
.dark .project-title { color:#f8fafc; }
.project-description { max-width:54rem; margin-top:.65rem; color:#64748b; font-size:.9rem; line-height:1.55; }
.dark .project-description { color:#94a3b8; }
.project-meta-row { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:1rem; }
.project-meta-pill { display:inline-flex; align-items:center; gap:.4rem; padding:.38rem .62rem; border:1px solid #e2e8f0; border-radius:.65rem; color:#526174; background:rgba(255,255,255,.7); font-size:.72rem; font-weight:600; }
.project-meta-pill svg { width:.92rem; height:.92rem; color:#94a3b8; }
.project-meta-accent { color:var(--primary); border-color:rgba(8,120,95,.16); background:rgba(8,120,95,.06); }
.dark .project-meta-pill { color:#cbd5e1; border-color:#2b3a52; background:rgba(15,23,42,.62); }
.dark .project-meta-accent { color:#6ee7b7; border-color:rgba(16,185,129,.22); background:rgba(16,185,129,.08); }
.project-progress { max-width:46rem; margin-top:1.05rem; }
.project-progress-copy { display:flex; align-items:center; justify-content:space-between; margin-bottom:.4rem; color:#64748b; font-size:.72rem; font-weight:600; }
.project-progress-copy strong { color:var(--primary); font-size:.8rem; }
.project-progress .progress-track { height:.55rem; box-shadow:inset 0 1px 2px rgba(15,23,42,.05); }

.project-actions { align-self:start; display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:.55rem; max-width:31rem; }
.project-actions .btn-primary,.project-actions .btn-secondary,.project-actions .btn-danger-soft { min-height:2.55rem; }
.btn-danger-soft { display:inline-flex; align-items:center; justify-content:center; gap:.45rem; min-height:2.45rem; padding:.55rem .85rem; border:1px solid rgba(239,68,68,.22); border-radius:.75rem; background:rgba(239,68,68,.07); color:#dc2626; font-size:.875rem; font-weight:650; transition:all .15s; }
.btn-danger-soft:hover { background:#ef4444; border-color:#ef4444; color:#fff; }
.dark .btn-danger-soft { color:#fca5a5; border-color:rgba(239,68,68,.25); background:rgba(239,68,68,.08); }
.project-export-menu { position:absolute; right:0; top:calc(100% + .55rem); z-index:60; width:20.5rem; padding:.4rem; border:1px solid #e2e8f0; border-radius:1rem; background:#fff; box-shadow:0 20px 45px -14px rgba(15,23,42,.3); }
.project-export-menu a { display:flex; align-items:center; gap:.7rem; padding:.68rem; border-radius:.75rem; transition:background .15s; }
.project-export-menu a:hover { background:#f8fafc; }
.project-export-menu a > span:last-child { min-width:0; display:flex; flex-direction:column; }
.project-export-menu b { color:#334155; font-size:.78rem; line-height:1rem; }
.project-export-menu small { margin-top:.08rem; color:#94a3b8; font-size:.65rem; line-height:.9rem; }
.project-export-icon { width:2rem; height:2rem; flex:none; display:flex; align-items:center; justify-content:center; border-radius:.65rem; font-size:.72rem; font-weight:800; }
.dark .project-export-menu { border-color:#334155; background:#101b30; }
.dark .project-export-menu a:hover { background:#1e293b; }
.dark .project-export-menu b { color:#e2e8f0; }

.project-page .proj-tabs { position:sticky; top:4.7rem; z-index:35; }
.project-kpi-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.85rem; }
.project-kpi { position:relative; overflow:hidden; min-height:7.1rem; display:flex; align-items:center; gap:.9rem; padding:1rem 1.05rem; border:1px solid #e8edf3; border-radius:1rem; background:#fff; box-shadow:0 6px 18px -18px rgba(15,23,42,.4); }
.project-kpi::after { content:""; position:absolute; left:0; right:0; bottom:0; height:3px; background:var(--kpi); opacity:.8; }
.project-kpi-icon { width:2.75rem; height:2.75rem; flex:none; display:flex; align-items:center; justify-content:center; border-radius:.85rem; color:var(--kpi); background:color-mix(in srgb,var(--kpi) 10%,transparent); }
.project-kpi-copy { min-width:0; display:grid; grid-template-columns:auto 1fr; align-items:end; column-gap:.55rem; }
.project-kpi-copy p { grid-column:1/-1; color:#64748b; font-size:.72rem; font-weight:650; }
.project-kpi-copy strong { color:var(--kpi); font-size:1.65rem; line-height:1.15; font-weight:800; letter-spacing:-.03em; }
.project-kpi-copy small { align-self:center; color:#94a3b8; font-size:.64rem; white-space:nowrap; }
.dark .project-kpi { border-color:#223047; background:#101b30; box-shadow:none; }

.project-overview-grid { display:grid; grid-template-columns:minmax(0,2fr) minmax(18rem,.8fr); gap:1rem; align-items:stretch; }
.project-plan-card,.project-team-card { border-color:#e6ecf2; }
.dark .project-plan-card,.dark .project-team-card { border-color:#223047; background:#101b30; }
.project-plan-card { display:flex; flex-direction:column; }
.project-card-heading { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1rem; }
.project-eyebrow { margin-bottom:.2rem; color:var(--primary); font-size:.64rem; font-weight:800; letter-spacing:.09em; text-transform:uppercase; }
.project-card-heading h2 { color:#263246; font-size:1rem; font-weight:750; }
.dark .project-card-heading h2 { color:#f1f5f9; }
.project-text-action { display:inline-flex; align-items:center; gap:.25rem; color:var(--primary); font-size:.72rem; font-weight:700; }
.project-text-action svg { width:.85rem; height:.85rem; transition:transform .15s; }
.project-text-action:hover svg { transform:translateX(2px); }
.project-detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.65rem; }
.project-detail-item { min-width:0; display:flex; align-items:center; gap:.72rem; padding:.8rem; border:1px solid #eef2f6; border-radius:.85rem; background:#fafcfd; }
.project-detail-icon { width:2.15rem; height:2.15rem; flex:none; display:flex; align-items:center; justify-content:center; border-radius:.7rem; color:var(--primary); background:rgba(8,120,95,.08); }
.project-detail-icon svg { width:1.05rem; height:1.05rem; }
.project-detail-item dt { color:#94a3b8; font-size:.64rem; font-weight:600; }
.project-detail-item dd { max-width:20rem; margin-top:.1rem; overflow:hidden; color:#334155; font-size:.77rem; font-weight:700; text-overflow:ellipsis; white-space:nowrap; }
.project-detail-budget { border-color:rgba(8,120,95,.14); background:rgba(8,120,95,.045); }
.project-detail-budget dd { color:var(--primary); }
.dark .project-detail-item { border-color:#29374d; background:#0f192b; }
.dark .project-detail-item dd { color:#e2e8f0; }
.dark .project-detail-budget { border-color:rgba(16,185,129,.2); background:rgba(16,185,129,.06); }
.dark .project-detail-budget dd { color:#6ee7b7; }
.project-plan-footer { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-top:1rem; padding:1rem; border-radius:.9rem; background:linear-gradient(110deg,#edf9f5,#f6fcfa); }
.project-plan-footer > div { min-width:0; display:flex; flex-direction:column; }
.project-plan-footer b { color:#265546; font-size:.76rem; }
.project-plan-footer span { margin-top:.1rem; color:#668176; font-size:.66rem; }
.project-plan-footer .btn-primary { flex:none; }
.dark .project-plan-footer { background:linear-gradient(110deg,rgba(8,120,95,.16),rgba(16,185,129,.06)); }
.dark .project-plan-footer b { color:#a7f3d0; }
.dark .project-plan-footer span { color:#94a3b8; }

.project-team-card { display:flex; flex-direction:column; min-height:100%; }
.project-team-count { min-width:1.8rem; height:1.8rem; display:flex; align-items:center; justify-content:center; border-radius:999px; color:var(--primary); background:rgba(8,120,95,.1); font-size:.7rem; font-weight:800; }
.project-team-list { display:flex; flex-direction:column; gap:.35rem; margin-bottom:1rem; }
.project-team-member { display:grid; grid-template-columns:2.35rem minmax(0,1fr) .45rem; align-items:center; gap:.65rem; padding:.52rem .45rem; border-radius:.8rem; }
.project-team-member:hover { background:#f8fafc; }
.project-team-avatar { width:2.35rem; height:2.35rem; display:flex; align-items:center; justify-content:center; border-radius:.78rem; color:var(--primary); background:rgba(8,120,95,.11); font-size:.65rem; font-weight:800; }
.project-team-member p { overflow:hidden; color:#334155; font-size:.76rem; font-weight:700; text-overflow:ellipsis; white-space:nowrap; }
.project-team-member span { display:block; margin-top:.08rem; color:#94a3b8; font-size:.63rem; }
.project-team-member .project-team-status { width:.42rem; height:.42rem; margin:0; border-radius:999px; background:#10b981; box-shadow:0 0 0 3px rgba(16,185,129,.1); }
.project-team-empty { padding:1.5rem .5rem; color:#94a3b8; text-align:center; font-size:.75rem; }
.dark .project-team-member:hover { background:#162238; }
.dark .project-team-member p { color:#e2e8f0; }

@media (max-width:1450px) {
  .project-hero { grid-template-columns:1fr; gap:1.2rem; }
  .project-actions { justify-content:flex-start; max-width:none; }
}
@media (max-width:1200px) {
  .project-kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:900px) {
  .project-overview-grid { grid-template-columns:1fr; }
  .project-page .proj-tabs { top:4.15rem; }
}
@media (max-width:640px) {
  .project-hero { padding:1.2rem 1rem; border-radius:1rem; }
  .project-hero::before { top:1.2rem; bottom:1.2rem; }
  .project-title { font-size:1.35rem; }
  .project-actions { display:grid; grid-template-columns:1fr 1fr; width:100%; }
  .project-actions > *,.project-actions form,.project-actions button,.project-actions a { width:100%; }
  .project-export-menu { left:0; right:auto; width:min(20.5rem,calc(100vw - 3rem)); }
  .project-kpi-grid { gap:.65rem; }
  .project-kpi { min-height:6.5rem; padding:.85rem; }
  .project-kpi-icon { width:2.35rem; height:2.35rem; }
  .project-kpi-copy { display:block; }
  .project-kpi-copy strong { display:block; margin-top:.1rem; font-size:1.35rem; }
  .project-kpi-copy small { display:none; }
  .project-detail-grid { grid-template-columns:1fr; }
  .project-plan-footer { align-items:flex-start; flex-direction:column; }
  .project-plan-footer .btn-primary { width:100%; }
}
