/* Family Hub · Acomodo de la app real.
   Solo distribuye en la pantalla las piezas de la guía (posición, scroll, rejillas).
   No define colores, radios, sombras ni tamaños de letra propios: todo sale de fh-tokens.css,
   fh-components.css, fh-estilos.css y fh-disenos.css. */

body.fh-app { margin: 0; min-height: 100dvh; }
/* Lo oculto se queda oculto aunque su clase declare display (avisos, toasts, botones) */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
.fh-app :where(p, h1, h2, h3, h4) { margin: 0; }
.fh-app img { max-width: 100%; }

/* ---------- Marco: computador ---------- */
.fh-shell { min-height: 100dvh; grid-template-rows: 56px 1fr; }
.fh-side { position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.fh-header { position: sticky; top: 0; z-index: 10; }
.fh-header-actions { margin-left: auto; display: flex; gap: var(--s-3); align-items: center; }
.fh-main { min-width: 0; max-width: 1200px; width: 100%; }
.fh-tabbar { display: none; }

/* ---------- Marco: celular ---------- */
@media (max-width: 900px) {
  /* En el celular la guía deja ver el fondo del diseño (agua, horizonte) detrás de las tarjetas */
  .fh-shell { display: block; background: none; }
  .fh-side, .fh-header { display: none; }
  .fh-main { padding: var(--s-2) var(--s-3) 120px; }
  .fh-tabbar { display: grid; position: fixed; left: 0; right: 0; bottom: max(0px, env(safe-area-inset-bottom)); z-index: 20; }
}
@media (min-width: 901px) { .fh-only-movil { display: none !important; } }
@media (max-width: 900px) { .fh-only-pc { display: none !important; } }

/* Botón que abre el buscador en el encabezado */
button.fh-search { cursor: pointer; text-align: left; font: inherit; font-size: var(--fs-14); }

/* ---------- Pantallas de referencia (Hoy y Empresa) dentro de la app ----------
   fh-disenos.css las dibuja como un teléfono de alto fijo; aquí fluyen con la página
   y usan el mismo fondo, que ya pone body.fh-app. */
.scr.scr-app { height: auto; overflow: visible; background: none; }
.scr.scr-app .s-body { padding: 0; }
.scr.scr-app[data-d="relieve"] { background: none; }
.fh-pantalla { display: grid; gap: var(--s-3); max-width: 560px; }
@media (min-width: 901px) { .fh-pantalla { margin: 0 auto; } }
button.s-item, button.s-area, button.r-q { width: 100%; text-align: left; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
button.r-q { text-align: center; }
button.s-area { text-align: left; }

/* ---------- Rejillas de la vista de computador ---------- */
.fh-grid-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.fh-grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; align-items: start; }
.fh-stack { display: grid; gap: 12px; align-content: start; }
@media (max-width: 1100px) { .fh-grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fh-grid-2 { grid-template-columns: 1fr; } }
.fh-titulo { display: flex; justify-content: space-between; align-items: end; gap: var(--s-3); flex-wrap: wrap; }
.fh-fila-num { display: flex; justify-content: space-between; }

/* ---------- Configuración · Apariencia ---------- */
.fh-apariencia { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 600px) { .fh-apariencia { grid-template-columns: 1fr; } }
.fh-apariencia .fh-area { min-height: 0; width: 100%; }
.fh-apariencia img { display: block; width: 100%; border-radius: var(--r-control); }

/* ---------- Hojas (crear, buscar) ---------- */
dialog.fh-hoja { border: 0; padding: 0; background: none; width: min(560px, calc(100% - 32px)); max-height: 80dvh; }
dialog.fh-hoja::backdrop, dialog.dlg::backdrop { background: color-mix(in srgb, var(--text-1) 32%, transparent); }
.fh-cmdk-item { width: 100%; border: 0; background: none; cursor: pointer; text-align: left; font: inherit; }
.fh-cmdk-input input { flex: 1; border: 0; background: none; outline: none; font: inherit; color: var(--text-1); }
.fh-cmdk-list { max-height: 50dvh; overflow-y: auto; }

/* ---------- Avisos y mensajes del sistema ---------- */
.fh-banner { margin: 0 0 var(--s-3); }
.fh-toast { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); z-index: 40; max-width: calc(100% - 32px); }
@media (min-width: 901px) { .fh-toast { bottom: 24px; } }

/* Panel plegable de funciones del cargo (details nativo): solo el cursor y la zona táctil */
.fdet summary { cursor: pointer; min-height: var(--touch); display: flex; align-items: center; gap: var(--s-2); }

button.fh-row { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
button.s-avatar { border: 0; cursor: pointer; font: inherit; color: inherit; }
/* La cifra de la esfera de agua se escribe oscura mientras el agua no la cubre y pasa a blanco cuando sí
   (misma regla que fh-estilos.css usa para .fh-ring-label en Agua). */
.a-orb b { color: hsl(215 59% clamp(15%, calc((var(--p) - 58) * 1000%), 100%)); }
/* Chat con una conversación abierta en el celular: la conversación ocupa la pantalla, como en la guía */
@media (max-width: 900px) {
  body:has([data-chat-abierto]) .fh-tabbar { display: none; }
  body:has([data-chat-abierto]) .fh-main { padding-bottom: 0; }
}
/* La conversación puede tener alto fijo: las burbujas no se estiran para llenarlo */
.fh-chat { align-content: start; }
/* Celular: el «+» abre los formularios de Tareas, Novatos y Stands, así que el botón azul de la pantalla
   solo aparece cuando el formulario ya está abierto (para cerrarlo). Un solo azul a la vista. */
@media (max-width: 900px) {
  .fh-main [data-novato-form][aria-expanded="false"],
  .fh-main [data-stand-form][aria-expanded="false"],
  .fh-main .fh-btn--primary[data-asignar-toggle][aria-pressed="false"] { display: none; }
}
/* En la tarjeta de avance del chat las etiquetas de estado van a su medida, como en la guía (justify-self:start) */
.fh-msg-task .fh-status { justify-self: start; }
