/* Estructura de página: barra lateral + contenido. En móvil la barra se convierte en menú desplegable. */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }

.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  background: var(--sand);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: var(--sage); color: var(--gold-soft);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 22px;
}
.brand-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 8px 12px;
  border-radius: 10px; color: var(--ink-2);
  font-size: 14px; text-decoration: none;
}
.nav-link:hover { background: #EEF2EC; }
.nav-link.is-active { background: var(--sage); color: #fff; }
.nav-link svg { flex: none; }

.sidebar-footer { margin-top: auto; }
.user-box {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}

.main { flex: 999 1 560px; min-width: 0; padding: 32px 40px; display: flex; flex-direction: column; gap: 24px; }

.page-header { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.page-header .crumbs { font-size: 13px; color: var(--muted); }
.page-header .subtitle { font-size: 14px; color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split > .col-2 { flex: 2 1 520px; min-width: 0; }
.split > .col-1 { flex: 1 1 300px; min-width: 0; }

/* Se declara con .btn para ganar a la regla display de .btn (components.css se carga después). */
.btn.menu-toggle { display: none; }

@media (max-width: 880px) {
  .sidebar {
    position: static; width: 100%; height: auto; flex-basis: 100%;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 14px 16px; gap: 12px;
  }
  .btn.menu-toggle { display: inline-flex; }
  .sidebar .nav, .sidebar .sidebar-footer { display: none; }
  .sidebar.is-open .nav, .sidebar.is-open .sidebar-footer { display: flex; }
  .sidebar-head { display: flex; align-items: center; justify-content: space-between; }
  .main { padding: 20px 16px; }
  h1 { font-size: 28px; }
}

/* Logotipo del negocio en el encabezado lateral (cuando existe) */
.brand-logo { object-fit: cover; background: #fff; border: 1px solid var(--line); }
.brand-name { overflow-wrap: anywhere; }

/* Nombre comercial largo (p. ej. «SECRET LOOK STUDIO SPA») en la barra superior de celulares: menos alto, sin ocupar tres líneas. */
@media (max-width: 520px) {
  .brand-name { font-size: 15.5px; line-height: 1.15; letter-spacing: .01em; }
  .brand-sub { font-size: 11px; }
}

/* Tablas en tabletas y celulares: los enlaces dentro de las filas (nombres, códigos) tienen un área táctil cómoda. */
@media (max-width: 820px) {
  .table td a:not(.btn):not(.chip) { display: inline-block; padding: 9px 0; }
}
