/* =========================================================
   Helix · Layout shell
   Sidebar (desktop, collapse), top bar, bottom nav (mobile),
   master-detail split.
   ========================================================= */

.helix-app .helix-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-page);
  color: var(--text-1);
  font-family: var(--font-sans);
}

/* ---------- Workspace (main area to the right of sidebar) ---------- */
.helix-app .helix-workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ---------- Top bar (desktop) ---------- */
.helix-app .helix-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-1);
  height: 56px;
  flex-shrink: 0;
}
.helix-app .helix-topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}
.helix-app .helix-topbar-breadcrumb-sep { color: var(--text-3); }
.helix-app .helix-topbar-breadcrumb-current { color: var(--text-1); font-weight: 500; }

.helix-app .helix-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Mobile top header ---------- */
.helix-app .helix-mobile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(6px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
  background: var(--bg-page);
}
.helix-app .helix-mobile-header-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-1);
  flex-shrink: 0;
}
.helix-app .helix-mobile-header-text { flex: 1; min-width: 0; }
.helix-app .helix-mobile-header-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.helix-app .helix-mobile-header-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.15;
  color: var(--text-1);
}

/* ---------- Content area (scrollable region) ---------- */
.helix-app .helix-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Bottom nav (mobile) ---------- */
.helix-app .helix-bottom-nav {
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-1);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  display: flex;
}
.helix-app .helix-bottom-nav-item {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: none;
  background: transparent;
  padding: 4px 2px;
  cursor: pointer;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--font-sans);
  transition: color var(--dur-fast) var(--ease-out);
}
.helix-app .helix-bottom-nav-item.is-active { color: var(--accent); }
.helix-app .helix-bottom-nav-item-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Sidebar (desktop, collapse) ---------- */
.helix-app .helix-sidebar {
  display: none;
  flex-direction: column;
  width: 64px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-1);
  padding: 14px 0;
  flex-shrink: 0;
  transition: width var(--dur-base) var(--ease-out);
}
.helix-app .helix-sidebar.is-expanded { width: 240px; }
.helix-app .helix-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 32px;
  margin-bottom: 16px;
  color: var(--text-1);
  text-decoration: none;
}
.helix-app .helix-sidebar.is-expanded .helix-sidebar-brand-text { display: inline; }
.helix-app .helix-sidebar:not(.is-expanded) .helix-sidebar-brand-text { display: none; }
.helix-app .helix-sidebar-brand-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
/* Marca con comet — tamaño por contexto. El comet (::before/::after de
   .helix-brand-mark) provee el borde, así que el header móvil cede su
   bg/borde propios para no doblar el marco. */
.helix-app .helix-sidebar-brand .helix-brand-mark { width: 32px; height: 32px; }
.helix-app .helix-mobile-header-logo.helix-brand-mark {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  display: grid;
  place-items: center;
}
.helix-app .helix-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}
.helix-app .helix-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  text-align: left;
  min-height: 36px;
}
.helix-app .helix-sidebar-item:hover { background: var(--bg-sunken); color: var(--text-1); }
.helix-app .helix-sidebar-item.is-active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}
.helix-app .helix-sidebar-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.helix-app .helix-sidebar:not(.is-expanded) .helix-sidebar-item-label { display: none; }
.helix-app .helix-sidebar-spacer { flex: 1; }
.helix-app .helix-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px 0;
  border-top: 1px solid var(--border-1);
}
.helix-app .helix-sidebar-footer .helix-sidebar-item { color: var(--text-3); }
.helix-app .helix-sidebar-footer .helix-sidebar-item:hover { color: var(--text-1); }

/* ---------- Master-detail split (desktop only) ---------- */
.helix-app .helix-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.helix-app .helix-split-list {
  flex-shrink: 0;
  width: 420px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.helix-app .helix-split-detail {
  flex: 1;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.helix-app .helix-detail-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; padding: 40px; text-align: center;
  color: var(--text-3); font-size: 14px;
}
/* Master-detail (Estudio): panel de detalle solo en desktop + tab Inbox. */
@media (min-width: 1024px) {
  .helix-app .helix-shell.inbox-active .helix-content { flex: 0 0 420px; border-right: 1px solid var(--border-1); }
  .helix-app .helix-shell:not(.inbox-active) .helix-split-detail { display: none; }
  .helix-app .helix-split-detail .helix-lead-detail { height: 100%; }
}

/* ---------- Responsive: mobile hides sidebar + split, shows bottom nav ---------- */
@media (max-width: 1023px) {
  .helix-app .helix-sidebar { display: none !important; }
  .helix-app .helix-split { flex-direction: column; }
  .helix-app .helix-split-list { width: 100%; border-right: 0; }
  .helix-app .helix-split-detail { display: none; }
  .helix-app .helix-bottom-nav { display: flex; }
  .helix-app .helix-topbar { display: none; }
}

@media (min-width: 1024px) {
  .helix-app .helix-shell { flex-direction: row; }
  .helix-app .helix-sidebar { display: flex; }
  .helix-app .helix-bottom-nav { display: none; }
  .helix-app .helix-mobile-header { display: none; }
}
