/* ============ SHELL LAYOUT ============ */
.shell { display: flex; min-height: 100vh; }

/* ================= SIDEBAR ================= */
.shell-sidebar {
  width: var(--sidebar-w); flex-shrink: 0; height: 100vh; position: sticky; top: 0;
  background: linear-gradient(180deg, #FFFFFF 0%, #FDFBF7 60%, #F8F2FB 100%);
  border-right: 1px solid var(--line-warm);
  display: flex; flex-direction: column;
  transition: width var(--transition-normal);
  z-index: 15;
}
.shell-sidebar.collapsed { width: var(--sidebar-collapsed); }

/* ---- Marca ---- */
.shell-sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 18px;
}
.shell-sidebar-brand img,
.shell-sidebar-brand svg { width: 46px; height: 46px; flex-shrink: 0; }
.shell-sidebar-brand .brand-text { overflow: hidden; white-space: nowrap; line-height: 1.15; }
.shell-sidebar-brand .brand-text .brand-kicker {
  display: block; font-family: var(--font-head); font-weight: 700;
  font-size: .78rem; color: var(--purple); letter-spacing: .01em;
}
.shell-sidebar-brand .brand-text .brand-name {
  display: block; font-family: var(--font-head); font-weight: 800;
  font-size: 1.12rem; color: var(--purple-dark); letter-spacing: -.01em;
}
.shell-sidebar-brand .brand-text .brand-tag {
  display: block; font-size: .56rem; color: var(--text-muted); margin-top: 3px; font-weight: 700;
  white-space: nowrap; letter-spacing: -.005em;
}
.shell-sidebar.collapsed .brand-text { display: none; }

/* ---- Navegación ---- */
.shell-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 6px 12px 12px; display: flex; flex-direction: column; gap: 3px;
}
.shell-nav-group-label {
  font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); padding: 16px 12px 6px;
}
.shell-sidebar.collapsed .shell-nav-group-label { display: none; }

.shell-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-md);
  color: var(--text-soft); font-family: var(--font-body); font-weight: 700; font-size: .89rem;
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; position: relative;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}
.shell-nav-item:hover { background: var(--purple-tint); color: var(--purple-dark); }
.shell-nav-item.active {
  background: linear-gradient(135deg, #7C5CE6, #5A38CE);
  color: #fff; box-shadow: 0 8px 20px rgba(108,75,224,.30);
}
.shell-nav-item .nav-icon {
  width: 22px; height: 22px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--purple); transition: color var(--transition-fast);
}
.shell-nav-item .nav-icon svg { width: 20px; height: 20px; display: block; }
.shell-nav-item:hover .nav-icon { color: var(--purple-dark); }
.shell-nav-item.active .nav-icon { color: #fff; }
.shell-nav-item .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-sidebar.collapsed .shell-nav-item { justify-content: center; padding: 12px; }
.shell-sidebar.collapsed .shell-nav-item .label { display: none; }

/* ---- Ilustración inferior del sidebar ---- */
.sidebar-illustration {
  position: relative; margin: 4px 0 0; padding: 0 10px 10px;
  min-height: 186px; overflow: hidden; flex-shrink: 0;
}
.sidebar-illustration .illus-blob {
  position: absolute; left: 12px; right: 12px; bottom: 10px;
  background: linear-gradient(140deg, #7C5CE6, #5A38CE);
  border-radius: 46% 54% 40% 60% / 52% 42% 58% 48%;
  padding: 46px 18px 24px;
  color: #fff; font-family: var(--font-head); font-weight: 700; font-size: .88rem;
  line-height: 1.35; text-align: left;
  box-shadow: 0 14px 30px rgba(90,56,206,.28);
}
.sidebar-illustration .illus-girl {
  position: absolute; left: 6px; bottom: 78px; width: 122px; z-index: 2;
  pointer-events: none;
  animation: girl-bob 5s ease-in-out infinite;
}
@keyframes girl-bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-5px) } }
.shell-sidebar.collapsed .sidebar-illustration { display: none; }

.shell-sidebar-footer { padding: 12px; border-top: 1px solid var(--line-warm); }
.shell-collapse-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 9px; color: var(--text-muted); font-family: var(--font-body); font-weight: 800; font-size: .78rem; cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.shell-collapse-btn svg { width: 16px; height: 16px; }
.shell-collapse-btn:hover { background: var(--purple-soft); color: var(--purple-dark); }
.shell-sidebar.collapsed .shell-collapse-btn .label { display: none; }
.shell-sidebar.collapsed .shell-collapse-btn svg { transform: rotate(180deg); }

/* ================= ÁREA PRINCIPAL ================= */
.shell-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---- Topbar ---- */
.shell-topbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 30px;
  background: transparent;
  position: sticky; top: 0; z-index: 10;
  min-height: var(--topbar-h);
}
.shell-topbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(250,246,239,.94) 55%, rgba(250,246,239,0) 100%);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.shell-hamburger {
  display: none; background: var(--surface); border: 1px solid var(--line); padding: 6px; cursor: pointer;
  color: var(--text); border-radius: var(--radius-sm);
}

.shell-search {
  flex: 1; max-width: 440px; margin: 0 auto 0 0;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: .6rem 1.1rem; color: var(--text-muted); cursor: pointer; font-size: .86rem; font-weight: 600;
  box-shadow: var(--shadow-1);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.shell-search svg { width: 17px; height: 17px; flex-shrink: 0; }
.shell-search > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-search:hover { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-glow); }
.shell-search kbd {
  margin-left: auto; font-size: .66rem; font-family: var(--font-body); font-weight: 800;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px;
  padding: 3px 8px; color: var(--text-muted);
}

.shell-topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.shell-icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--purple-dark); box-shadow: var(--shadow-1);
  transition: transform var(--transition-fast), background var(--transition-fast);
}
.shell-icon-btn svg { width: 19px; height: 19px; }
.shell-icon-btn:hover { transform: translateY(-2px); background: var(--purple-soft); }
.shell-notif-badge {
  position: absolute; top: -2px; right: -2px; background: var(--pink); color: #fff;
  font-size: .58rem; font-weight: 800; border-radius: 999px; min-width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--background);
}

.shell-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 1rem;
  border: 2px solid var(--surface);
  box-shadow: 0 4px 12px var(--purple-glow);
}

.shell-profile { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.shell-profile-text { line-height: 1.25; }
.shell-profile-text strong { display: block; font-size: .85rem; font-weight: 800; }
.shell-profile-text span { display: block; font-size: .7rem; color: var(--text-muted); font-weight: 600; }

.shell-workspace {
  flex: 1; padding: 8px 30px 60px;
  max-width: 1320px; width: 100%; margin: 0 auto;
}

/* ---- Command palette ---- */
.cmdk-overlay { position: fixed; inset: 0; background: rgba(48,41,65,.42); backdrop-filter: blur(3px); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cmdk-overlay[hidden] { display: none; }
.cmdk-box { width: min(560px, 92vw); max-height: 68vh; background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-hover); overflow: hidden; display: flex; flex-direction: column; }
.cmdk-input-row { display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.cmdk-input-row input { border: none; outline: none; font-size: 1rem; flex: 1; padding: 0; background: transparent; box-shadow: none; }
.cmdk-results { overflow-y: auto; padding: 8px; }
.cmdk-item { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: var(--radius-md); cursor: pointer; font-weight: 700; font-size: .88rem; color: var(--text); }
.cmdk-item svg { width: 18px; height: 18px; color: var(--purple); }
.cmdk-item:hover { background: var(--purple-soft); color: var(--purple-dark); }

/* ---- Modal genérico ---- */
.shell-modal-overlay { position: fixed; inset: 0; background: rgba(48,41,65,.42); backdrop-filter: blur(3px); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 20px; }
.shell-modal-overlay[hidden] { display: none; }
.shell-modal { width: min(470px, 92vw); background: var(--surface); border-radius: var(--radius-xl); padding: var(--space-5); box-shadow: var(--shadow-hover); }
.shell-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.shell-modal-head h3 { font-size: 1.15rem; color: var(--purple-dark); }
.shell-modal-head button { background: var(--surface-2); border: 1px solid var(--line); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: var(--text-muted); font-size: 1rem; }

/* ---- Responsive ---- */
@media (max-width: 1080px) {
  .shell-sidebar { position: fixed; left: 0; top: 0; height: 100dvh; width: 268px;
    transform: translateX(-100%); box-shadow: 0 12px 40px rgba(90,60,180,.25);
    transition: transform 300ms cubic-bezier(.4,0,.2,1); z-index: 15; }
  .shell-sidebar.mobile-open { transform: translateX(0); }
  .shell-sidebar.collapsed { width: 268px; transform: translateX(-100%); }
  .shell-sidebar.collapsed.mobile-open { transform: translateX(0); }
  .shell-sidebar.collapsed .sidebar-illustration { display: block; }
  .shell-sidebar.collapsed .brand-text,
  .shell-sidebar.collapsed .shell-nav-item .label,
  .shell-sidebar.collapsed .shell-collapse-btn .label { display: block; }
  .shell-sidebar.collapsed .shell-nav-item { justify-content: flex-start; padding: 11px 14px; }
  .shell-hamburger { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; flex-shrink: 0; }
  .shell-hamburger svg { width: 20px; height: 20px; }
  .shell-search { max-width: none; }
  .shell-workspace { padding: 6px 16px 50px; }
  .shell-topbar { padding: 12px 16px; }
  .shell-profile-text { display: none; }
}

@media (max-width: 640px) {
  .shell-search kbd { display: none; }
  .shell-search { padding: .55rem .9rem; }
}

/* La ilustracion del sidebar cede espacio en pantallas bajas */
@media (max-height: 760px) { .sidebar-illustration { display: none; } }
