/* =====================================================
   SHELL.CSS — Paleta de Obra (modo claro)
   Topbar + sidebar + auth pages, todo pensado para
   legibilidad bajo sol caribeño.
   ===================================================== */

/* =====================================================
   SHELL LAYOUT
   ===================================================== */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 60px 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar content";
  min-height: 100dvh;
}

/* ===== TOPBAR ===== */
.shell-topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 10;
}
.shell-topbar-brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Brand mark — cuadrado amarillo Caterpillar con diamante azul plano */
.shell-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--amber);
  box-shadow: 0 2px 6px rgba(234, 179, 8, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.shell-brand-mark::after {
  content: '';
  width: 11px; height: 11px;
  background: var(--text);
  border-radius: 2px;
  transform: rotate(45deg);
}

.shell-org-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
}
.shell-org-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 8px 14px 8px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.12s ease;
}
.shell-org-name::after {
  content: '';
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text2);
}
.shell-org-name:hover {
  background: var(--bg-elev);
  border-color: var(--border-strong);
}

.shell-user-menu {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.12s ease;
}
.shell-user-menu:hover {
  background: var(--bg-elev);
  color: var(--text);
  border-color: var(--border-strong);
}

/* ===== SIDEBAR ===== */
.shell-sidebar {
  grid-area: sidebar;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.shell-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  transition: all 0.1s ease;
  position: relative;
}
.shell-nav-item:hover {
  background: var(--bg-soft);
  color: var(--text);
}
.shell-nav-item.active {
  background: var(--amber-soft);
  color: var(--text);
  font-weight: 700;
}
.shell-nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--amber);
  border-radius: 0 3px 3px 0;
}
.shell-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.9;
}
.shell-nav-item.active svg {
  opacity: 1;
  color: var(--amber-deep);
}

.shell-nav-section {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 18px 12px 8px;
}

.shell-content {
  grid-area: content;
  padding: 28px 32px;
  overflow-y: auto;
}

/* =====================================================
   RESPONSIVE — mobile colapsa sidebar a footer
   ===================================================== */
@media (max-width: 768px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 56px 1fr auto;
    grid-template-areas:
      "topbar"
      "content"
      "sidebar";
  }
  .shell-topbar { padding: 0 16px; }
  .shell-topbar-brand { font-size: 15px; gap: 10px; }
  .shell-org-name {
    padding: 7px 12px 7px 10px;
    font-size: 12px;
  }
  .shell-user-menu { width: 38px; height: 38px; font-size: 15px; }
  .shell-sidebar {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -1px 0 var(--border);
  }
  .shell-nav-section { display: none; }
  .shell-nav-item {
    padding: 9px 14px;
    font-size: 12.5px;
    flex-shrink: 0;
    border-radius: 100px;
  }
  .shell-nav-item.active::before { display: none; }
  .shell-nav-item.active {
    background: var(--amber);
    color: var(--text);
  }
  .shell-content {
    padding: 20px 18px;
    /* Espacio para FAB */
    padding-bottom: 100px;
  }
}

/* =====================================================
   AUTH PAGES — login, onboarding, callback
   ===================================================== */
.auth-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  position: relative;
}

/* Background pattern sutil para diferenciar de pantalla blanca pura
   (líneas técnicas tipo blueprint, muy discretas) */
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

.auth-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.auth-brand {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.auth-brand .shell-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.auth-brand .shell-brand-mark::after {
  width: 13px;
  height: 13px;
}
.auth-sub {
  font-size: 13.5px;
  color: var(--text2);
  font-weight: 500;
  margin-bottom: 28px;
  line-height: 1.5;
}

/* Variants para auth-brand sin icon (compatibility) */
.auth-brand-text-only {
  text-align: center;
  display: block;
  font-size: 26px;
  margin-bottom: 8px;
}
.auth-sub-center {
  text-align: center;
}
