/* ============================================================
   WIFIRED · Layout — shell, sidebar, topbar, grids
   ============================================================ */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.brand { display:flex; align-items:center; gap:12px; padding: 4px 8px 20px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display:grid; place-items:center; color:#fff;
  background: linear-gradient(135deg, var(--brand-600), var(--accent));
  box-shadow: var(--shadow-sm);
}
.brand-text { display:flex; flex-direction:column; line-height:1.1; }
.brand-text strong { font-size: 17px; letter-spacing: .3px; }
.brand-text span { font-size: 11.5px; color: var(--text-3); font-weight:500; }

.nav { display:flex; flex-direction:column; gap:4px; margin-top: 6px; }
.nav-item {
  display:flex; align-items:center; gap:12px;
  padding: 11px 14px; border-radius: 11px;
  color: var(--text-2); font-weight: 600; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: color-mix(in srgb, var(--brand-500) 12%, transparent);
  color: var(--brand-700);
}
:root[data-theme="dark"] .nav-item.active,
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .nav-item.active{ color:#93c5fd; } }
.nav-ico { width: 20px; text-align:center; font-size: 15px; opacity:.9; }
.nav-badge { margin-left:auto; min-width:20px; height:20px; padding:0 6px; border-radius:999px;
  background: var(--st-canc-dot); color:#fff; font-size:11px; font-weight:800; display:grid; place-items:center;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--st-canc-dot) 25%, transparent); }

.sidebar-foot { margin-top: auto; display:flex; flex-direction:column; gap:12px; padding-top: 16px; }
.sidebar-foot .muted-sm { text-align:center; }

/* ---------- Main ---------- */
.main { display:flex; flex-direction:column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display:flex; align-items:center; gap: 16px;
  padding: 14px 26px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 18px; font-weight: 800; letter-spacing: -.2px; }
.topbar-actions { margin-left:auto; display:flex; align-items:center; gap: 16px; }

.search-box {
  display:flex; align-items:center; gap:8px;
  background: var(--surface-2); border:1px solid var(--border);
  border-radius: 11px; padding: 8px 12px; width: 300px; max-width: 40vw;
}
.search-box input { border:0; background:transparent; outline:0; width:100%; font-size: 13.5px; }
.search-ico { color: var(--text-3); font-size: 15px; }

.user-chip { display:flex; align-items:center; gap:10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display:grid; place-items:center; font-weight:700; font-size:13px; color:#fff;
  background: linear-gradient(135deg, var(--brand-600), var(--accent));
}
.user-meta { display:flex; flex-direction:column; line-height:1.15; }
.user-meta strong { font-size: 13.5px; }
.user-meta span { font-size: 11.5px; color: var(--text-3); }

.view { padding: 26px; animation: fadeUp .25s ease; }

/* ---------- Section grids ---------- */
.grid { display:grid; gap: 18px; }
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.two-col { grid-template-columns: 1.4fr 1fr; }
.section { margin-top: 24px; }
.section-head { display:flex; align-items:center; justify-content:space-between; margin-bottom: 14px; gap: 12px; }
.section-head h2 { font-size: 16px; font-weight: 800; letter-spacing:-.2px; }

/* ---------- Mobile ---------- */
.only-mobile { display: none; }
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 280px;
    transform: translateX(-105%); transition: transform .28s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .only-mobile { display: inline-grid; }
  .two-col { grid-template-columns: 1fr; }
  .search-box { width: 180px; }
}

/* Modo incrustado (sistema ISP): solo el calendario, sin menú ni barra superior */
.embed .sidebar, .embed .topbar, .embed .no-db-bar { display: none !important; }
.embed .app-shell { display: block; }
.embed .main { margin-left: 0 !important; width: 100%; }

