:root{--b:#0B3954;--t:#16A39A;--td:#11857E;--g:#3E9B45;--gl:#7BC67E;--r:#D64545;--y:#B7791F;--bg:#F2F4F7}
*{box-sizing:border-box}body{margin:0;font:14px/1.45 Inter,"Segoe UI",Roboto,"Helvetica Neue",Arial,system-ui,sans-serif;background:var(--bg);color:#1d2939}
header{display:flex;gap:1.2rem;align-items:center;flex-wrap:wrap;background:var(--b);color:#fff;padding:.55rem 1.2rem}
header a{color:#fff;text-decoration:none}.brand{font-weight:700}
nav{display:flex;gap:.15rem;flex-wrap:wrap}
nav a{padding:.28rem .68rem;border-radius:6px;opacity:.72;font-size:.93em}
nav a:hover{opacity:1;background:#ffffff17}
nav a.on{opacity:1;background:var(--t);color:#fff}
header .user{margin-left:auto;font-size:.9em;display:flex;gap:.3rem;align-items:center}header input{border:0;border-radius:4px;padding:.2rem .4rem;width:11rem}header button{padding:.15rem .5rem}
main{padding:1rem 1.4rem;max-width:1400px;margin:auto}footer{color:#777;font-size:.8em;padding:1rem 1.4rem}
h1{margin:.3rem 0 .6rem;font-size:1.5rem}h2{font-size:1.1rem;margin:1.4rem 0 .5rem}
a{color:var(--b)}.muted{color:#6b7280}.crumbs{margin:0;font-size:.9em}.nowrap{white-space:nowrap}
table{width:100%;border-collapse:collapse;background:#fff;box-shadow:0 1px 2px #0001}th,td{padding:.4rem .55rem;border-bottom:1px solid #e5e7eb;text-align:left;vertical-align:top}
th{background:#eef2f6;font-weight:600;font-size:.9em}tr.dim td{color:#999}
.kpis{display:flex;flex-wrap:wrap;gap:.6rem;margin:.6rem 0}.kpi{background:#fff;border-radius:8px;padding:.5rem .9rem;box-shadow:0 1px 2px #0001;min-width:110px;color:#555;font-size:.85em}
.kpi span{display:block;font-size:1.5rem;font-weight:700;color:#111}.kpi.big span{color:var(--g);font-size:2rem}.kpi.warn span{color:var(--r)}
.kpi.sec{min-width:0;padding:.25rem .6rem;box-shadow:none;border:1px solid #e3e8ee;background:#fbfcfd;border-radius:6px;font-size:.78em;color:#5b6b78}
.kpi.sec span{display:inline;font-size:1em;margin-right:.3rem;color:#0B3954}
.bar{position:relative;background:#e5e7eb;border-radius:6px;height:20px}.bar div{background:var(--gl);height:100%;border-radius:6px}.bar b{position:absolute;left:6px;top:1px;font-size:.85em}
.tag{display:inline-block;background:#eef2f6;border-radius:10px;padding:0 .5rem;font-size:.8em;margin-right:.2rem}
.st{display:inline-block;border-radius:10px;padding:0 .55rem;font-size:.8em;font-weight:600;background:#e5e7eb}
.st.cumple,.st.aprobado{background:#E3F4E4;color:var(--g)}.st.no_cumple,.st.rechazado{background:#fde2e0;color:var(--r)}.st.pendiente,.st.candidato{background:#fff3d6;color:var(--y)}
.ok{color:var(--g);font-weight:600}.bad{color:var(--r);font-weight:600}.warn{color:var(--y)}
.card{background:#fff;border-radius:8px;padding:.8rem 1rem;box-shadow:0 1px 2px #0001;margin:.6rem 0}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:.6rem;align-items:end}
.grid4{display:grid;grid-template-columns:1fr 1fr 1.3fr 2fr;gap:.5rem;align-items:end}
label{display:flex;flex-direction:column;font-size:.8em;color:#555;gap:.15rem}
input,select,textarea{font:inherit;padding:.35rem .45rem;border:1px solid #cfd6de;border-radius:5px;background:#fff;width:100%}
textarea{width:100%;margin:.4rem 0}button{font:inherit;padding:.35rem .8rem;border:1px solid #cfd6de;border-radius:5px;background:#fff;cursor:pointer}
button.primary{background:var(--t);color:#fff;border-color:var(--t)}button.primary:hover{background:var(--td)}button.danger{color:var(--r)}button.link{border:0;background:none;padding:0;color:var(--r);text-decoration:underline}
form.inline{display:inline}.right{float:right}
blockquote{margin:.3rem 0;padding:.4rem .7rem;border-left:3px solid var(--t);background:#f3f7fa;font-size:.9em;color:#333}
.req-head{display:flex;flex-wrap:wrap;gap:.4rem;align-items:center;font-size:.9em}.actions{margin-top:.5rem;display:flex;gap:.4rem}
.filters{margin:.5rem 0}.pill{display:inline-block;padding:.15rem .6rem;border-radius:12px;background:#fff;border:1px solid #cfd6de;margin:.1rem;text-decoration:none;font-size:.85em}
.pill.on{background:var(--t);color:#fff;border-color:var(--t)}
.mermaid-wrap{background:#fff;overflow:auto;border-radius:8px;padding:.5rem;max-height:720px}.legend{font-size:.85em;margin:.3rem 0}
ul.ev{margin:.4rem 0 0;padding-left:1rem}code{font-size:.9em}
/* ---- administración */
.btn{display:inline-block;padding:.4rem .8rem;border:1px solid #cfd6de;border-radius:6px;background:#fff;text-decoration:none}.btn.primary{background:var(--t);color:#fff;border-color:var(--t)}
.btn-s{font-size:.8em;margin-left:auto}
.admin-grid{display:grid;grid-template-columns:280px 1fr;gap:1rem}
.side{background:#fff;border-radius:8px;box-shadow:0 1px 2px #0001;padding:.5rem;max-height:calc(100vh - 110px);overflow:auto}
.side-head{display:flex;align-items:center;padding:.3rem .4rem .6rem}
.lugar{display:flex;gap:.6rem;padding:.55rem .5rem;border-radius:6px;text-decoration:none;color:inherit;border-bottom:1px solid #eef2f6}.lugar:hover{background:#f3f7fa}
.pdot{flex:0 0 14px;height:14px;border-radius:50%;margin-top:.25rem}
#map{height:430px;border-radius:8px;box-shadow:0 1px 2px #0001;background:#dfe7ee}#map.offline{background:repeating-linear-gradient(0deg,#e8eef3,#e8eef3 39px,#d5dee6 40px),repeating-linear-gradient(90deg,#e8eef3,#e8eef3 39px,#d5dee6 40px)}
.two{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
.tabs{display:flex;gap:.3rem;border-bottom:2px solid #dbe3ea;margin:.6rem 0 .8rem}.tabs a{padding:.5rem .9rem;text-decoration:none;border-radius:6px 6px 0 0;color:#444}
.tabs a.on{background:var(--t);color:#fff}
.lugar-grid{display:grid;grid-template-columns:1fr 360px;gap:1rem;align-items:start}
.chat{position:sticky;top:.6rem;background:#fff;border-radius:8px;box-shadow:0 1px 3px #0002;display:flex;flex-direction:column;height:calc(100vh - 100px)}
.chat-head{padding:.7rem .8rem;border-bottom:1px solid #eef2f6;font-weight:600}
.chat-log{flex:1;overflow:auto;padding:.6rem}.msg{margin:.4rem 0;padding:.5rem .65rem;border-radius:8px;font-size:.88em}
.msg.user{background:var(--t);color:#fff;margin-left:2.5rem}.msg.bot{background:#f3f7fa}
.cites{padding-left:1.2rem;margin:.4rem 0;font-size:.92em}.cites li{margin:.3rem 0}.cites q{color:#333;font-style:italic}
.chips-s{padding:.3rem .5rem;display:flex;flex-wrap:wrap;gap:.2rem}.chips-s .pill{cursor:pointer;font-size:.75em}
#chat-form{display:flex;gap:.3rem;padding:.5rem;border-top:1px solid #eef2f6}#chat-form input{flex:1}

/* ---- marca Katta */
.brand,.brand-m{display:flex;align-items:center;gap:.45rem;font-weight:800;letter-spacing:.02em}
.brand-name{font-size:1.2rem}.brand-sub{font-weight:400;opacity:.75;font-size:.8rem;margin-left:.3rem}
.brand-logo{height:30px;width:auto}.brand-m .brand-name{font-size:1rem}
.brand-pill{background:#fff;border-radius:8px;padding:2px 8px;display:inline-flex;align-items:center}.brand-logo{height:30px}

/* ---- botones */
.btn:hover{border-color:#9aa8b5;background:#f6f9fb}
.btn.primary:hover{background:var(--td);border-color:var(--td)}
button.primary:hover{background:var(--td)}

/* ---- flujo admin: stepper y siguiente paso */
.stepper{display:flex;flex-wrap:wrap;gap:.3rem;align-items:center;margin:.2rem 0 .9rem;font-size:.85em}
.stepper .stp{display:inline-flex;align-items:center;gap:.35rem;padding:.26rem .65rem;border-radius:999px;background:#fff;
  border:1px solid #d7dee4;color:#51616e;text-decoration:none}
.stepper .stp b{font-weight:700;color:inherit}
.stepper a.stp:hover{border-color:var(--t);color:var(--b)}
.stepper .stp.done{background:#F2FAF5;border-color:#BFE0D2;color:#2F7A38}
.stepper .stp.cur{background:var(--b);border-color:var(--b);color:#fff}
.stepper .sep{color:#9aa8b5;margin:0 .1rem}
.nextstep{display:flex;flex-wrap:wrap;gap:.6rem;align-items:center;margin:1rem 0;padding:.7rem .95rem;
  background:#F0FAF9;border:1px solid #CBE9E6;border-radius:10px}
.nextstep .ns-txt{font-size:.9em;color:#3D5566}

/* ---- sala de control: grafo del pipeline (desde admin/agentes.html) */
.pipe-card{background:#fff;border:1px solid #D7DEE4;border-radius:12px;overflow:hidden;position:relative}
#pipe{width:100%;height:500px;cursor:grab;touch-action:none;display:block;
      background:radial-gradient(circle,#E9EEF2 1.2px,transparent 1.2px) 0 0/24px 24px}
#pipe.dragging{cursor:grabbing}
.pnode{cursor:pointer}
.pnode rect{stroke-width:2;rx:10}
.pnode:hover rect,.pnode.sel rect{stroke-width:3.5;filter:drop-shadow(0 3px 5px rgba(11,57,84,.3))}
.rol-det rect{fill:#E3F4E4;stroke:#3E9B45}
.rol-orch rect{fill:#E3ECFF;stroke:#3B5BDB}
.rol-work rect{fill:#E6F6F5;stroke:#16A39A}
.rol-humano rect{fill:#FFF3E0;stroke:#E8590C}
.pnode text{fill:#0B3954;font-family:Inter,'Segoe UI',Roboto,sans-serif}
.pnode .pt{font-size:12.5px;font-weight:700}
.pnode .pl{font-size:11px;fill:#3D5566}
.pedge{stroke:#9AA8B5;stroke-width:2;fill:none;stroke-dasharray:7 5;animation:pdash 1.1s linear infinite}
.pedge.hl{stroke:#0B3954;stroke-width:3.5}
@keyframes pdash{to{stroke-dashoffset:-12}}
.pipe-tools{position:absolute;top:10px;right:12px;display:flex;gap:8px;align-items:center}
.pipe-tools button{border:1px solid #C4CFD8;background:#fff;border-radius:8px;padding:4px 10px;cursor:pointer;font-size:12px}
.pipe-legend{position:absolute;bottom:10px;left:12px;font-size:11.5px;color:#3D5566;background:#ffffffcc;
             padding:4px 10px;border-radius:8px}
.pipe-panel{border:1px solid #D7DEE4;border-radius:12px;padding:.85rem 1.1rem;margin-top:.7rem;background:#F8FAFC;min-height:58px}
.pipe-panel h3{margin:.1rem 0 .3rem;font-size:1rem}
.pipe-panel .pl2{margin:.1rem 0;font-size:.9rem;color:#2A3B47}
.tlbar{display:flex;gap:4px;margin:.6rem 0;flex-wrap:wrap}
.tlseg{padding:.5rem .7rem;border-radius:8px;color:#fff;font-size:.8rem;text-align:center;min-width:70px}

/* ---- ejecución en vivo (desde admin/agentes_live.html) */
.live-bar{display:flex;align-items:center;gap:.7rem;padding:.7rem 1rem;border-radius:10px;background:#0B3954;
          color:#fff;font-size:.95rem;margin:.4rem 0 .8rem;flex-wrap:wrap}
.live-dot{width:11px;height:11px;border-radius:50%;background:#4ADE80;animation:pulse 1s infinite}
.live-dot.err{background:#F87171}
@keyframes pulse{50%{opacity:.35}}
.steps{display:flex;gap:.4rem;flex-wrap:wrap}
.step{padding:.15rem .55rem;border-radius:999px;background:#ffffff22;font-size:.75rem;opacity:.55}
.step.done{opacity:.95;background:#3E9B45}
.step.cur{opacity:1;background:#3B5BDB;animation:pulse 1.2s infinite}
.live-time{margin-left:auto;font-variant-numeric:tabular-nums;opacity:.9}
.live-grid{display:grid;grid-template-columns:40% 1fr;gap:.8rem}
.panel{background:#fff;border:1px solid #D7DEE4;border-radius:12px;overflow:hidden;display:flex;flex-direction:column}
.panel h3{margin:0;padding:.55rem .9rem;background:#F2F4F7;font-size:.8rem;letter-spacing:.04em;
          border-bottom:1px solid #D7DEE4;color:#3D5566}
.pbody{overflow-y:auto;max-height:60vh;padding:.55rem .8rem;font-size:.8rem}
#docTree .gh{font-weight:700;margin:.55rem 0 .15rem;color:#0B3954;display:flex;gap:.45rem;align-items:baseline}
#docTree .row{display:flex;gap:.45rem;padding:1px 0;align-items:baseline}
#docTree .nid{font-family:ui-monospace,Menlo,monospace;font-size:.72rem;color:#5B7183;min-width:58px}
#docTree .dim{color:#A5B3C0}
#docTree .st{margin-left:auto;white-space:nowrap;font-size:.72rem}
#docTree .ok{color:#2F7A38;font-weight:600}
#docTree .run{color:#3B5BDB;font-weight:600}
#conLog{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.73rem;line-height:1.5;
        background:#0B3954;color:#DCE8F2;max-height:60vh;overflow-y:auto;padding:.6rem .8rem}
#conLog .ct{color:#7FA3C0}
#conLog .cp{font-weight:700}
#conLog .build_graph .cp{color:#7BE3A0}
#conLog .plan .cp{color:#9DB9FF}
#conLog .dispatch .cp{color:#7BE3D9}
#conLog .merge .cp{color:#FFD59E}
.fin-banner{margin-top:.8rem;padding:1rem 1.2rem;border-radius:12px;background:#E3F4E4;border:1px solid #3E9B45}
.fin-banner.err{background:#FEECEC;border-color:#D64545}
.fin-banner h3{margin:0 0 .4rem}
.fin-kpis{display:flex;gap:.6rem;flex-wrap:wrap;margin:.6rem 0}
.fin-kpi{background:#fff;border:1px solid #CBE3CC;border-radius:10px;padding:.5rem .9rem;text-align:center}
.fin-kpi b{display:block;font-size:1.25rem;color:#0B3954}
@media (max-width:900px){.live-grid{grid-template-columns:1fr}}
