/* ============================================================
   sidebar.css — barra lateral: logo, lista de proyectos, guardado
   ============================================================ */
#sidebar{background:var(--bg);display:flex;flex-direction:column;padding:12px 8px 12px 12px;min-width:0;overflow:hidden}
.sb-brand{padding:6px 6px 12px;display:flex;flex-direction:column;gap:2px;cursor:pointer}
.sb-brand img{width:170px;height:auto;display:block}
.sb-brand small{color:var(--muted);font-size:11px;font-weight:600;letter-spacing:.6px;text-transform:uppercase;padding-left:2px}
.sb-head{display:flex;align-items:center;justify-content:space-between;padding:6px 6px 8px}
.sb-head h1{font-size:13px;margin:0;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:var(--muted)}
.sb-search{display:flex;align-items:center;gap:6px;background:#fff;border:1px solid var(--border);border-radius:6px;padding:5px 8px;margin-bottom:8px;color:var(--muted)}
.sb-search input{border:none;outline:none;flex:1;background:transparent;font-size:13px;min-width:0;color:var(--text)}
/* ---- Árbol de navegación: Inicio · Cotizaciones · Proyectos ▸ tipo ▸ proyecto ---- */
.sb-tree{flex:1;overflow:auto;display:flex;flex-direction:column;gap:2px;padding-right:2px}
.sb-item{display:flex;align-items:center;gap:8px;padding:7px 8px;border-radius:6px;cursor:pointer;font-size:13px;font-weight:500;color:var(--text);position:relative;user-select:none;min-height:32px}
.sb-item:hover{background:#e9e9ec}
.sb-item .label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sb-item .count{font-size:11px;font-weight:700;background:#e4e5e9;color:var(--muted);border-radius:10px;padding:1px 7px;line-height:16px}
.sb-item .caret{color:var(--muted);transition:transform .15s;flex-shrink:0}
.sb-node.closed > .sb-item .caret{transform:rotate(-90deg)}
.sb-node.closed > .sb-children{display:none}
.sb-item.root{font-weight:600}
.sb-item.root.active{background:var(--text);color:#fff}
.sb-item.root.active .count{background:rgba(255,255,255,.2);color:#fff}
.sb-item.root.current{background:#e4e5e9}
/* Los botones de acción no ocupan sitio hasta pasar el ratón: así los contadores de todas las filas quedan alineados a la derecha */
.sb-item.root .add{opacity:0;width:0;height:24px;margin:-4px 0;padding:0;overflow:hidden;flex-shrink:0;transition:width .12s,opacity .12s}
.sb-item.root:hover .add,.sb-item.root:focus-within .add{opacity:1;width:24px;margin:-4px 2px}
.sb-children{display:flex;flex-direction:column;gap:2px;margin-left:14px;padding-left:8px;border-left:1px solid var(--border)}
.sb-children .sb-search{margin:4px 0 4px}
.sb-item.sub{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.4px;color:var(--muted);padding:6px 8px;min-height:28px}
.sb-item.sub:hover{color:var(--text)}
.sb-item.proj{padding:6px 8px 9px}
.sb-item.proj .dot{width:9px;height:9px;border-radius:50%;flex-shrink:0}
.sb-item.proj.active{background:#fff;box-shadow:var(--shadow-sm);font-weight:600}
.sb-item.proj .pct{font-size:11px;color:var(--muted);font-weight:600}
.sb-item.proj .more{opacity:0;width:24px;height:24px;margin:-4px -4px}
.sb-item.proj:hover .more{opacity:1}
.sb-item.proj .bar{position:absolute;left:8px;right:8px;bottom:3px;height:3px;border-radius:3px;background:var(--border-soft);overflow:hidden}
.sb-item.proj .bar i{display:block;height:100%;background:var(--text)}
.sb-item.proj.paused .label{color:var(--muted)}
.sb-item.proj .risk{color:var(--red);display:inline-flex}
.sb-foot{border-top:1px solid var(--border);padding-top:10px;margin-top:8px;display:flex;flex-direction:column;gap:6px}
.sb-foot .btn{justify-content:center;width:100%}
.sb-toggle{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted);padding:4px 8px;cursor:pointer;user-select:none}
.sb-toggle:hover{color:var(--text)}
.save-state{font-size:11px;color:var(--muted);text-align:center;padding:4px 0 0;display:flex;align-items:center;justify-content:center;gap:5px}
.save-state.dirty{color:#b5661a;font-weight:600}
