/* Estructura general: topbar de ancho completo + (rail | sidebar | main) */

.app-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.app { display: flex; flex: 1; overflow: hidden; }

/* ---- Topbar ---- */
.topbar {
  height: 50px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.ws-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 9px;
  border-radius: var(--radius);
  font-weight: 600;
}
.ws-chip:hover { background: var(--bg-hover); }
.ws-logo {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 700;
}
.topbar-search {
  flex: 1;
  max-width: 440px;
  margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-3);
  justify-content: flex-start;
}
.topbar-search:hover { border-color: var(--border-2); }
.topbar-search kbd {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text-3);
  font-family: inherit;
}
.topbar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

/* ---- Rail izquierdo de iconos ---- */
.rail {
  width: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.rail-item {
  width: 46px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 0;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 10.5px;
}
.rail-item:hover { background: var(--bg-hover); color: var(--text); }
.rail-item.active { color: var(--accent); background: var(--accent-soft); }
.rail-sep { flex: 1; }

/* ---- Sidebar de navegación ---- */
.sidebar {
  width: 252px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.sidebar.collapsed { display: none; }
.sidebar-head {
  display: flex; align-items: center; gap: 2px;
  padding: 12px 12px 6px 16px;
  font-size: 15px;
}
.icon-btn.sm { width: 26px; height: 26px; }
.sidebar-new {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 10px 10px;
  padding: 7px 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text-2);
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.sidebar-new:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 0 10px 12px; }

.side-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--text-2);
  margin-bottom: 1px;
  text-align: left;
}
.side-item:hover { background: var(--bg-hover); color: var(--text); }
.side-item.active { background: var(--bg-3); color: var(--text); font-weight: 500; }
.side-item .grow { flex: 1; }

.side-section {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px 4px;
  margin-top: 14px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  width: 100%;
  border-radius: var(--radius);
}
.side-section:hover { color: var(--text); }
.side-section .chev { transition: transform .15s; }
.side-section.collapsed .chev { transform: rotate(-90deg); }
.side-section .icon-btn { visibility: hidden; }
.side-section:hover .icon-btn { visibility: visible; }

.side-project { margin-bottom: 2px; }
.side-project-head {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border-radius: var(--radius);
  color: var(--text);
}
.side-project-head:hover { background: var(--bg-hover); }
.side-project-head .emoji { font-size: 15px; }
.side-project-head .name { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-sub { margin-left: 22px; border-left: 1px solid var(--border); padding-left: 6px; }
.side-sub .side-item { padding: 4.5px 8px; font-size: 13px; }

.side-bottom {
  border-top: 1px solid var(--border);
  padding: 6px 10px 10px;
}
/* ---- Main ---- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.crumbbar {
  display: flex; align-items: center; gap: 10px;
  min-height: 46px;
  padding: 6px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.crumb { display: flex; align-items: center; gap: 8px; color: var(--text-2); min-width: 0; }
.crumb b { color: var(--text); font-weight: 600; white-space: nowrap; }
.sidebar-toggle { flex-shrink: 0; }
.sidebar-toggle.active { color: var(--accent); }

.view { flex: 1; overflow-y: auto; position: relative; }

.view-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg);
  z-index: 5;
  min-height: 54px;
}
.view-head h2 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.view-head .spacer { flex: 1; }

.view-body { padding: 24px; }
.view-body.narrow { max-width: 1080px; margin: 0 auto; }
