/**
 * CIMA — Inicio (UserOverview). Estilos antes inline en app/overview/overview.js,
 * centralizados aquí. Cristal SIEMPRE en función del tema (var(--glass-bg)/var(--glass-blur)).
 */

/* ── Layout raíz ─────────────────────────────────────────────────────────────── */
/* Pegado a la IZQUIERDA (antes margin:0 auto lo centraba dentro del #mode-USUARIO de
   1024px → se veía corrido a la derecha y angosto vs. las ventanas rígidas). */
.ov-root { --ov-w: 640px; max-width: 860px; margin: 0; padding: 2px 16px 16px 4px; }
/* Ancho COMPARTIDO de todos los bloques del Inicio = ancho de las tiles (5 columnas).
   Así el saludo+banner, las citas y los widgets NUNCA se pasan del borde de las tiles.
   Para más/menos ancho, ajusta --ov-w (arriba) — un solo número. */
.ov-greet-row, .ov-today, .ov-tiles-grid, .ov-widgets { max-width: var(--ov-w); }

/* ── Saludo + reloj ──────────────────────────────────────────────────────────── */
.ov-greet-row { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ov-greet-col { min-width: 0; flex: 1 1 200px; }
/* Placeholder a la derecha del saludo (mensaje / publicidad interna).
   Angosto; su borde derecho cae sobre el borde derecho de las tiles (la fila topa en --ov-w). */
.ov-greet-aside { flex: 0 1 300px; min-width: 0; max-width: 320px; display: flex; }
.ov-greet-hello { font-size: 1.1rem; font-weight: 700; color: var(--text-main); }
/* Reloj apilado: línea 2 = fecha (chica/tenue), línea 3 = hora (grande). */
.ov-greet-clock { margin-top: 4px; display: block; }
.ov-clk-date { display: block; font-size: 0.78rem; color: var(--text-muted); }
.ov-clk-time { display: block; font-size: 1.15rem; font-weight: 700; color: var(--text-main); margin-top: 1px; }
.ov-pwa-btn { display: none; margin-top: 10px; align-items: center; gap: 6px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 8px; color: var(--text-main); font-size: 0.78rem; padding: 5px 12px; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

.ov-section-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 10px; color: var(--text-main); }

/* ── Citas de hoy — contenedor ───────────────────────────────────────────────── */
/* Ancho completo: alineado exacto con tiles y widgets (mismo borde izq. y der.). */
.ov-today { margin-bottom: 0; }
/* Tarjeta del TEMA para "Citas de hoy" (antes se veía suelta sobre el wallpaper). Misma
   receta que .glass-panel (--fr-card-*/--glass-*): en temas sólidos queda opaca. */
.ov-block-citas {
    background: rgba(var(--fr-card-rgb, var(--glass-bg-rgb, 20,20,30)), var(--fr-card-op, var(--glass-opacity)));
    -webkit-backdrop-filter: blur(calc(var(--glass-blur, 16px) + var(--fr-card-blur, 0px)));
    backdrop-filter: blur(calc(var(--glass-blur, 16px) + var(--fr-card-blur, 0px)));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 22px;
}

/* ── Tiles ───────────────────────────────────────────────────────────────────── */
.ov-tiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-bottom: 12px; }
.ov-tile { background: rgba(var(--fr-tile-rgb, var(--glass-bg-rgb, 20,20,30)), var(--fr-tile-op, var(--glass-opacity))); backdrop-filter: blur(calc(var(--glass-blur, 16px) + var(--fr-tile-blur, 0px))); -webkit-backdrop-filter: blur(calc(var(--glass-blur, 16px) + var(--fr-tile-blur, 0px))); border: 1px solid var(--glass-border); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 18px 8px; min-height: 88px; cursor: pointer; transition: background .18s, transform .22s cubic-bezier(0.34, 1.56, 0.64, 1); }
.ov-tile.is-muted { opacity: .45; cursor: not-allowed; }
/* Bandeja arranca en columna 1 → baja a la 2ª hilera con Chat a su derecha. */
.ov-tile--inbox { grid-column-start: 1; }
.ov-tile-ico { font-size: 1.7rem; }
.ov-tile-lbl { font-size: 0.75rem; color: var(--text-muted); text-align: center; line-height: 1.2; }

/* ── Modo edición del escritorio (arrastrar-para-reordenar) ──────────────────── */
/* Feedback claro pero sobrio: contorno punteado del acento con pulso lento y
   cursor de agarre. Todo con variables del tema (light/dark). */
.ov-tiles-grid.ov-edit-mode .ov-tile-primary {
    cursor: grab;
    outline: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent);
    outline-offset: 3px;
    animation: ovEditPulse 1.8s ease-in-out infinite;
}
.ov-tiles-grid.ov-edit-mode .ov-tile-primary:active { cursor: grabbing; }
.ov-tile-primary.ov-dragging {
    opacity: .55;
    transform: scale(.95);
    outline-style: solid;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
    animation: none;
}
@keyframes ovEditPulse {
    0%, 100% { outline-color: color-mix(in srgb, var(--accent) 28%, transparent); }
    50%      { outline-color: color-mix(in srgb, var(--accent) 70%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
    .ov-tiles-grid.ov-edit-mode .ov-tile-primary { animation: none; outline-color: color-mix(in srgb, var(--accent) 55%, transparent); }
    .ov-edit-dock { transition: opacity .2s ease; }
}

/* Bloques del Inicio arrastrables (saludo, estadísticas, banner, instalar, citas, accesos). */
.ov-block { display: block; }
#ov-main-view.ov-editing [data-ov-drag] { cursor: grab; }
#ov-main-view.ov-editing [data-ov-drag].ov-dragging { cursor: grabbing; }
/* Solo el bloque más interno bajo el cursor se resalta (sin marcos anidados). */
[data-ov-drag].ov-drag-hot {
    outline: 1.5px dashed color-mix(in srgb, var(--accent) 60%, transparent);
    outline-offset: 4px;
    border-radius: 14px;
    transition: outline-color .12s ease;
}
[data-ov-drag].ov-dragging { opacity: .5; }

/* Redimensión por elemento: 8 tiradores alrededor de cada área (solo en modo edición). */
#ov-main-view.ov-editing [data-ov-resize] { position: relative; }
.ov-rz {
    position: absolute; width: 12px; height: 12px; z-index: 6;
    background: var(--accent); border: 1.5px solid #fff; border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}
[data-ov-resize].ov-resizing { outline: 1.5px solid var(--accent); outline-offset: 3px; }
.ov-rz-nw { top: -6px;  left: -6px;  cursor: nwse-resize; }
.ov-rz-n  { top: -6px;  left: 50%;   transform: translateX(-50%); cursor: ns-resize; }
.ov-rz-ne { top: -6px;  right: -6px; cursor: nesw-resize; }
.ov-rz-e  { top: 50%;   right: -6px; transform: translateY(-50%); cursor: ew-resize; }
.ov-rz-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.ov-rz-s  { bottom: -6px; left: 50%;  transform: translateX(-50%); cursor: ns-resize; }
.ov-rz-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.ov-rz-w  { top: 50%;   left: -6px;  transform: translateY(-50%); cursor: ew-resize; }
/* Pista global sutil de que el modo edición está activo. */
#ov-main-view.ov-editing { outline: 1px dashed color-mix(in srgb, var(--accent) 22%, transparent); outline-offset: 8px; border-radius: 16px; }

/* Controles de edición DENTRO del dock/barra de CIMA (grupo compacto, no .dock-item). */
.ov-edit-dock {
    display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 8px;
    margin: 0 6px; padding: 4px 6px; border-radius: 12px;
    background: color-mix(in srgb, var(--text-main) 6%, transparent);
    border: 1px solid var(--glass-border);
    opacity: 0; transform: scale(.96);
    transition: opacity .18s ease, transform .18s cubic-bezier(0.22, 1, 0.36, 1);
}
.ov-edit-dock.ov-edit-dock-in { opacity: 1; transform: scale(1); }

/* Grupos de control (tamaño / posición) — pequeños */
.ov-edit-group { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 9px; background: color-mix(in srgb, var(--text-main) 6%, transparent); border: 1px solid var(--glass-border); }
.ov-edit-group > i { color: var(--accent); font-size: .82rem; }
.ov-edit-group input[type="range"] { width: 86px; accent-color: var(--accent); cursor: pointer; }
.ov-edit-num { font-size: .72rem; color: var(--text-main); min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }

/* D-pad de posición en UNA FILA (izquierda · arriba · centrar · abajo · derecha) */
.ov-edit-dpad { gap: 2px; padding: 2px 6px; }
.ov-dir-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--text-muted); cursor: pointer; transition: background .15s, color .15s; }
.ov-dir-btn:hover { background: var(--btn-ghost-hover, rgba(255, 255, 255, 0.08)); color: var(--accent); }
.ov-dir-btn i { font-size: .78rem; }
.ov-dir-up i  { transform: rotate(180deg); }   /* chevron-down girado = arriba (no hay icono up mapeado) */
.ov-dir-home  { color: var(--accent); }

/* Acciones (Restablecer / Cancelar / Guardar) — pequeñas */
.ov-edit-actions { display: flex; align-items: center; gap: 6px; }
.ov-edit-btn { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 600; padding: 6px 10px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; transition: background .15s, border-color .15s, filter .15s; }
.ov-edit-btn i { font-size: .82rem; }
.ov-edit-btn-ghost { background: transparent; border-color: var(--glass-border); color: var(--text-muted); }
.ov-edit-btn-ghost:hover { background: var(--btn-ghost-hover, rgba(255, 255, 255, 0.08)); color: var(--text-main); }
.ov-edit-btn-save { background: var(--accent); color: #fff; }
.ov-edit-btn-save:hover { filter: brightness(1.08); }

/* ── Config sub-panel (toggle) ───────────────────────────────────────────────── */
.ov-config-sub { display: none; margin-bottom: 16px; }
.ov-config-title { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 8px; padding-left: 2px; }
.ov-config-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }

/* ── Fila de widgets (estadística + publicidad, lado a lado 50/50) ───────────── */
.ov-widgets { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; margin-bottom: 22px; }
.ov-widget-col { flex: 1 1 300px; min-width: 0; }
.ov-widget-col--banner { display: flex; }

/* Cristal esmerilado compartido: claro + blur fuerte proporcional, igual que cmd+k. */
.ov-glass { background: var(--glass-bg); border: 1px solid var(--glass-border); -webkit-backdrop-filter: blur(calc(var(--glass-blur, 16px) + 48px)); backdrop-filter: blur(calc(var(--glass-blur, 16px) + 48px)); }

/* ── Widget de estadística ───────────────────────────────────────────────────── */
/* Altura = la de las tiles (88px). Centrado vertical; recorta lo que sobre. */
.ov-stats-card { cursor: pointer; height: 88px; box-sizing: border-box; border-radius: 13px; padding: 8px 12px; transition: background .18s, transform .18s; display: flex; flex-direction: column; justify-content: center; gap: 4px; overflow: hidden; }
.ov-stats-card:hover { background: rgba(255, 255, 255, 0.07); }
.ov-stats-head { display: flex; align-items: center; gap: 6px; margin-bottom: 0; }
/* El sparkline no cabe en la altura de tile → eliminado de los widgets compactos. */
.ov-spark { display: none; }
.ov-stats-head > .bi { color: var(--accent); font-size: 0.84rem; }
.ov-stats-title { font-size: 0.72rem; font-weight: 700; color: var(--text-main); }
.ov-stats-more { margin-left: auto; font-size: 0.6rem; color: var(--primary); }
.ov-stats-kpis { display: flex; gap: 11px; flex-wrap: wrap; align-items: flex-end; }
.ov-kpi { flex: 1; min-width: 54px; }
.ov-kpi-val { font-size: 1.05rem; font-weight: 700; line-height: 1; }
.ov-kpi-lbl { font-size: 0.56rem; color: var(--text-muted); margin-top: 2px; }
.ov-stats-loading { color: var(--text-muted); font-size: 0.78rem; }

/* ── Banner publicidad (aurora translúcida sobre vidrio esmerilado tipo cmd+k) ── */
/* Publicidad como ESTABA ANTES (altura natural). flex:1 → llena el placeholder del saludo. */
.ov-banner { flex: 1; position: relative; overflow: hidden; border-radius: 14px; box-sizing: border-box; border: 1px solid var(--glass-border); background: linear-gradient(120deg, rgba(56, 189, 248, 0.20) 0%, rgba(16, 185, 129, 0.16) 45%, rgba(124, 58, 237, 0.20) 100%); -webkit-backdrop-filter: blur(calc(var(--glass-blur, 16px) + 48px)); backdrop-filter: blur(calc(var(--glass-blur, 16px) + 48px)); padding: 13px 15px; display: flex; flex-direction: column; gap: 7px; justify-content: center; }
.ov-banner-kicker { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); }
.ov-banner-title { font-size: 0.94rem; font-weight: 700; line-height: 1.25; color: #fff; }
.ov-banner-sub { font-size: 0.72rem; color: rgba(255, 255, 255, 0.6); line-height: 1.35; }
.ov-banner-cta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.ov-banner-badge { display: inline-flex; align-items: center; gap: 4px; background: rgba(16, 185, 129, 0.22); border: 1px solid rgba(16, 185, 129, 0.5); border-radius: 40px; padding: 3px 9px; }
.ov-banner-badge > .bi { color: #34d399; font-size: 0.66rem; }
.ov-banner-badge > span { font-size: 0.66rem; font-weight: 800; color: #34d399; }
.ov-banner-cta { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 9px; background: linear-gradient(135deg, #1d4ed8, #7c3aed); color: #fff; font-weight: 700; font-size: 0.76rem; border: none; cursor: pointer; white-space: nowrap; }

/* ── Citas de hoy — tarjetas ─────────────────────────────────────────────────── */
.today-apt-row { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; cursor: pointer; transition: background 0.15s; }
.today-apt-time { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); min-width: 42px; }
.today-apt-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.today-apt-name { flex: 1; min-width: 0; font-size: 0.88rem; font-weight: 600; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-apt-note { font-size: 0.72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 36%; }
.today-apt-qhead { font-size: 0.68rem; color: var(--text-muted); margin: 6px 2px 6px; letter-spacing: 0.3px; }
.today-apt-empty { text-align: center; padding: 30px 16px; color: var(--text-muted); font-size: 0.85rem; }
.today-apt-empty > .bi { font-size: 1.5rem; display: block; margin-bottom: 8px; opacity: 0.6; }
/* Hero (cita en curso / próxima) — overrides sobre .today-apt-row (va después). */
.today-apt-hero { gap: 13px; background: var(--glass-bg); border: 2px solid var(--primary); border-radius: 14px; padding: 14px 16px; -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur)); margin-bottom: 10px; }
.today-apt-hero-ava { width: 46px; height: 46px; border-radius: 50%; background: color-mix(in srgb, var(--primary) 22%, transparent); color: var(--text-main); display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 700; flex-shrink: 0; }
.today-apt-hero-body { flex: 1; min-width: 0; }
.today-apt-hero-kicker { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.5px; color: var(--accent); }
.today-apt-hero-name { font-size: 1.02rem; font-weight: 700; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-apt-hero-note { font-size: 0.74rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-apt-hero-time { font-size: 1.25rem; font-weight: 700; color: var(--text-main); flex-shrink: 0; }
