/* ============================================================
   Home Core — camada UX v3 (2026-11-07)
   Objectivo: uma entrada única para tudo (paleta "Pedir"), Início
   que resume a casa numa frase, navegação simples, feedback visível.
   Carrega depois de styles.css e styles-ai.css; só acrescenta.
   ============================================================ */

:root {
  /* Escala de espaço e tipo — todas as peças novas usam estes tokens. */
  --ux-1: 4px; --ux-2: 8px; --ux-3: 12px; --ux-4: 16px; --ux-5: 20px;
  --ux-6: 24px; --ux-8: 32px; --ux-10: 40px; --ux-12: 48px;
  --ux-fs-xs: clamp(11px, 0.2vw + 10px, 12.5px);
  --ux-fs-sm: clamp(12.5px, 0.25vw + 11px, 14px);
  --ux-fs-md: clamp(14px, 0.3vw + 12px, 16px);
  --ux-fs-lg: clamp(17px, 0.6vw + 13px, 21px);
  --ux-fs-xl: clamp(24px, 1.8vw + 14px, 36px);
  --ux-fs-hero: clamp(28px, 3vw + 14px, 46px);
  --ux-radius: 18px;
  --ux-radius-sm: 12px;
  --ux-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  /* Texto secundário mais legível do que o cinzento anterior. */
  --muted: #94a3b8;
  --shell-muted: #94a3b8;
  --ux-glass: linear-gradient(180deg, rgba(255,255,255,0.065), rgba(255,255,255,0.02)), rgba(12, 18, 34, 0.55);
  --ux-line: rgba(255,255,255,0.10);
  --ux-line-strong: rgba(255,255,255,0.18);
  --ux-accent: #22d3ee;
  --ux-accent-2: #a78bfa;
  --ux-ok: #6ee7b7;
  --ux-warn: #fbbf24;
  --ux-danger: #fca5a5;
}

/* Foco visível em tudo o que se clica (teclado + TV). */
:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--ux-accent) !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.18) !important;
}

/* Transição suave de vista. */
@keyframes uxViewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-mount > * { animation: uxViewIn 220ms var(--ux-ease) both; }
@media (prefers-reduced-motion: reduce) { .view-mount > * { animation: none; } }

/* ------------------------------------------------------------
   SIDEBAR (desktop): botão "Pedir" no topo, ajuda em baixo.
   ------------------------------------------------------------ */
.ux-sidebar-ask {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(34,211,238,0.14), rgba(34,211,238,0.06));
  color: #cffafe; padding: 10px 12px;
  font-weight: 700; font-size: 13px; text-align: left;
  box-shadow: 0 0 24px rgba(34,211,238,0.10);
}
.ux-sidebar-ask:hover { border-color: rgba(34,211,238,0.5); background: rgba(34,211,238,0.16); }
.ux-sidebar-ask svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.ux-sidebar-ask kbd {
  margin-left: auto; font: 600 10.5px/1 ui-monospace, "JetBrains Mono", monospace;
  color: rgba(207,250,254,0.7); border: 1px solid rgba(207,250,254,0.25); border-radius: 6px; padding: 3px 5px;
}
.ux-sidebar-foot { display: grid; gap: 6px; margin-top: auto; }
.ux-sidebar-foot .logout-button { margin-top: 0; }
.ux-help-button {
  border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  padding: 10px 14px; text-align: left; font-weight: 700; font-size: 13px;
}
.ux-help-button:hover { background: rgba(255,255,255,0.08); color: var(--text-bright); }

.main-nav button { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.main-nav .nav-symbol svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------
   TOPBAR (vistas secundárias): título + data + estado + Pedir.
   ------------------------------------------------------------ */
.ux-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.ux-topbar h1 { margin: 0; font-size: var(--ux-fs-xl); }
.ux-topbar p { margin: 2px 0 0; color: var(--muted); font-size: var(--ux-fs-sm); }
.ux-topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ux-status {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--ux-line); border-radius: 999px; padding: 7px 12px;
  background: rgba(255,255,255,0.03); color: var(--text); font-size: 12.5px; font-weight: 600;
}
.ux-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ux-ok); box-shadow: 0 0 10px var(--ux-ok); }
.ux-status.warn i { background: var(--ux-warn); box-shadow: 0 0 10px var(--ux-warn); }
.ux-status.bad i { background: var(--ux-danger); box-shadow: 0 0 10px var(--ux-danger); }
.ux-topbar-ask {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid rgba(34,211,238,0.3); border-radius: 999px; padding: 8px 14px;
  background: rgba(34,211,238,0.10); color: #cffafe; font-weight: 700; font-size: 13px;
}
.ux-topbar-ask svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.view-home .ux-topbar { display: none; }

/* Barra flutuante "Pedir" nas vistas secundárias (desktop). */
.ux-cmdbar {
  position: fixed; z-index: 25; left: calc(176px + 18%); right: 18%; bottom: 18px;
  min-height: 54px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  border: 1px solid rgba(34,211,238,0.22); border-radius: 999px;
  background: rgba(5,10,21,0.86); color: var(--muted); padding: 0 10px 0 16px; text-align: left;
  backdrop-filter: blur(18px) saturate(140%); box-shadow: 0 18px 46px rgba(0,0,0,0.42);
  cursor: text;
}
.ux-cmdbar:hover { border-color: rgba(34,211,238,0.45); color: var(--text); }
.ux-cmdbar .mini-mic { background: radial-gradient(circle at 35% 30%, #67e8f9, #2563eb 62%, #1e1b4b); }
.ux-cmdbar .mini-mic svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; }
.ux-cmdbar kbd { font: 600 11px/1 ui-monospace, monospace; color: var(--muted-2); border: 1px solid var(--ux-line); border-radius: 6px; padding: 5px 7px; }
.view-home .ux-cmdbar { display: none; }

/* ------------------------------------------------------------
   INÍCIO "AGORA"
   ------------------------------------------------------------ */
.ux-home { display: grid; gap: var(--ux-5); max-width: 1240px; margin: 0 auto; }
.ux-home-head { display: grid; justify-items: center; text-align: center; gap: 8px; padding-top: 6px; }
.ux-home-head .alex-orb { width: 76px; height: 76px; margin-bottom: 6px; }
.ux-home-head h1 { margin: 0; font-size: var(--ux-fs-hero); font-weight: 760; letter-spacing: -0.03em; }
.ux-home-summary { margin: 0; color: var(--muted); font-size: var(--ux-fs-md); max-width: 60ch; line-height: 1.5; }
.ux-home-summary b { color: var(--text-bright); font-weight: 650; }

.ux-ask {
  width: min(680px, 100%); margin: 8px auto 0;
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center;
  border: 1px solid rgba(34,211,238,0.28); border-radius: 999px;
  background: linear-gradient(180deg, rgba(10,17,32,0.92), rgba(6,11,22,0.95));
  padding: 7px 7px 7px 16px; box-shadow: 0 14px 40px rgba(0,0,0,0.4), 0 0 30px rgba(34,211,238,0.08);
  transition: border-color 160ms, box-shadow 200ms;
}
.ux-ask:focus-within { border-color: rgba(34,211,238,0.6); box-shadow: 0 14px 40px rgba(0,0,0,0.4), 0 0 0 5px rgba(34,211,238,0.14); }
.ux-ask > svg { width: 20px; height: 20px; fill: none; stroke: var(--ux-accent); stroke-width: 2; stroke-linecap: round; }
.ux-ask input { min-width: 0; border: 0 !important; background: transparent !important; color: var(--text-bright); font-size: var(--ux-fs-md); padding: 10px 4px; box-shadow: none !important; }
.ux-ask input:focus { outline: none !important; box-shadow: none !important; }
.ux-ask input::placeholder { color: var(--muted-2); }
.ux-ask button {
  width: 46px; height: 46px; display: grid; place-items: center; border: 0; border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #67e8f9, #2563eb 62%, #1e1b4b); color: #fff;
  box-shadow: 0 0 20px rgba(34,211,238,0.45); padding: 0;
}
.ux-ask button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.ux-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.ux-chip {
  border: 1px solid var(--ux-line); border-radius: 999px; background: rgba(255,255,255,0.03);
  color: var(--text); padding: 9px 14px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.ux-chip:hover { border-color: rgba(34,211,238,0.45); background: rgba(34,211,238,0.08); color: #cffafe; }
.ux-chip.warn { border-color: rgba(251,191,36,0.4); color: #fde68a; background: rgba(251,191,36,0.08); }
.ux-chip svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ux-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--ux-4); }
.ux-card {
  grid-column: span 4; min-width: 0;
  background: var(--ux-glass); backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--ux-line); border-radius: var(--ux-radius);
  padding: var(--ux-5); display: grid; align-content: start; gap: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 20px 40px rgba(0,0,0,0.35);
  transition: border-color 200ms, transform 240ms var(--ux-ease);
}
.ux-card:hover { border-color: var(--ux-line-strong); }
.ux-card.span-6 { grid-column: span 6; }
.ux-card.span-8 { grid-column: span 8; }
.ux-card.span-12 { grid-column: span 12; }
.ux-card-head { display: flex; align-items: center; gap: 10px; }
.ux-card-head .ux-ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: rgba(34,211,238,0.10); color: #7dd3fc; flex: 0 0 auto; }
.ux-card-head .ux-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ux-card-head h3 { margin: 0; font-size: var(--ux-fs-lg); font-weight: 650; }
.ux-card-head small { display: block; color: var(--muted); font-size: var(--ux-fs-xs); margin-top: 1px; }
.ux-card-head .ux-open {
  margin-left: auto; border: 1px solid var(--ux-line); border-radius: 999px; background: transparent;
  color: var(--muted); padding: 6px 11px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.ux-card-head .ux-open:hover { color: #cffafe; border-color: rgba(34,211,238,0.45); }
.ux-card .ux-big { font-size: var(--ux-fs-xl); font-weight: 720; letter-spacing: -0.02em; color: var(--text-bright); line-height: 1; }
.ux-card .ux-sub { color: var(--muted); font-size: var(--ux-fs-sm); }
.ux-empty { color: var(--muted); font-size: var(--ux-fs-sm); line-height: 1.5; display: grid; gap: 8px; }
.ux-empty button, .ux-card .ux-action {
  justify-self: start; border: 1px solid rgba(34,211,238,0.3); border-radius: 999px; background: rgba(34,211,238,0.10);
  color: #cffafe; padding: 8px 14px; font-size: 12.5px; font-weight: 700;
}

/* Lista (agenda / ficheiros) */
.ux-list { display: grid; gap: 6px; }
.ux-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  border: 1px solid transparent; border-radius: 12px; padding: 9px 10px; background: rgba(255,255,255,0.025);
  color: var(--text); text-align: left; text-decoration: none; min-width: 0;
}
.ux-row:hover { border-color: var(--ux-line); background: rgba(255,255,255,0.05); }
.ux-row time, .ux-row .ux-tag {
  font: 700 11.5px/1 ui-monospace, "JetBrains Mono", monospace; color: #7dd3fc;
  background: rgba(34,211,238,0.10); border-radius: 8px; padding: 7px 8px; min-width: 52px; text-align: center;
}
.ux-row strong { display: block; font-size: var(--ux-fs-sm); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ux-row small { display: block; color: var(--muted); font-size: var(--ux-fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ux-row b { color: var(--muted-2); font-weight: 800; }

/* Tempo */
.ux-weather-now { display: flex; align-items: center; gap: 14px; }
.ux-weather-now .weather-symbol { font-size: 40px; line-height: 1; }
.ux-weather-days { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ux-weather-days span { display: grid; gap: 3px; text-align: center; border-radius: 10px; background: rgba(255,255,255,0.03); padding: 8px 4px; font-size: 12px; color: var(--muted); }
.ux-weather-days strong { color: var(--text-bright); font-size: 12px; text-transform: capitalize; }

/* Casa: câmaras */
.ux-cams { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ux-cam {
  position: relative; aspect-ratio: 16/10; border: 1px solid var(--ux-line); border-radius: 12px; overflow: hidden;
  background: #0a0f1c; padding: 0; color: var(--text);
}
.ux-cam img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ux-cam.offline img { display: none; }
.ux-cam .ux-cam-fallback { position: absolute; inset: 0; display: none; place-items: center; color: var(--muted-2); font-size: 11px; gap: 4px; }
.ux-cam.offline .ux-cam-fallback { display: grid; }
.ux-cam .ux-cam-fallback svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.ux-cam b { position: absolute; left: 8px; bottom: 6px; font-size: 11.5px; font-weight: 700; text-shadow: 0 1px 4px #000; }
.ux-cam i { position: absolute; right: 8px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--ux-ok); box-shadow: 0 0 8px var(--ux-ok); }
.ux-cam.offline i { background: var(--ux-danger); box-shadow: 0 0 8px var(--ux-danger); }
.ux-kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ux-kv span { display: grid; gap: 2px; border-radius: 10px; background: rgba(255,255,255,0.03); padding: 9px 10px; font-size: 11.5px; color: var(--muted); }
.ux-kv strong { font-size: 17px; color: var(--text-bright); font-weight: 720; }
.ux-kv strong.warn { color: var(--ux-warn); }
.ux-kv strong.bad { color: var(--ux-danger); }

/* Escola */
.ux-kids { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.ux-kid {
  display: grid; justify-items: center; gap: 4px; border: 1px solid var(--ux-line); border-radius: 14px;
  background: rgba(255,255,255,0.03); padding: 12px 8px 10px; color: var(--text); text-align: center;
}
.ux-kid:hover { border-color: rgba(167,139,250,0.5); background: rgba(167,139,250,0.08); }
.ux-kid img { width: 56px; height: 56px; }
.ux-kid strong { font-size: 14px; }
.ux-kid small { color: var(--muted); font-size: 11.5px; }
.ux-kid em { font-style: normal; color: #c4b5fd; font-size: 11.5px; font-weight: 700; }

/* Barras de sistema */
.ux-bars { display: grid; gap: 8px; }
.ux-bar { display: grid; grid-template-columns: 64px 1fr 44px; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.ux-bar i { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; display: block; }
.ux-bar i::after { content: ""; display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: linear-gradient(90deg, #22d3ee, #a78bfa); }
.ux-bar.warn i::after { background: linear-gradient(90deg, #fbbf24, #f97316); }
.ux-bar.bad i::after { background: linear-gradient(90deg, #f97316, #ef4444); }
.ux-bar b { text-align: right; color: var(--text-bright); }

/* ------------------------------------------------------------
   PALETA "PEDIR" (Ctrl+K)
   ------------------------------------------------------------ */
.ux-overlay {
  position: fixed; inset: 0; z-index: 900; display: grid; align-content: start; justify-items: center;
  padding: min(12vh, 120px) 16px 16px; background: rgba(2,4,10,0.62); backdrop-filter: blur(8px);
  animation: uxFade 140ms var(--ux-ease) both;
}
@keyframes uxFade { from { opacity: 0; } to { opacity: 1; } }
.ux-palette {
  width: min(680px, 100%); display: grid; gap: 0; overflow: hidden;
  border: 1px solid rgba(34,211,238,0.3); border-radius: 22px;
  background: linear-gradient(180deg, rgba(14,21,38,0.97), rgba(7,11,22,0.98));
  box-shadow: 0 40px 100px rgba(0,0,0,0.6), 0 0 60px rgba(34,211,238,0.10);
  animation: uxPop 180ms var(--ux-ease) both;
}
@keyframes uxPop { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
.ux-palette-input { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--ux-line); }
.ux-palette-input > svg { width: 20px; height: 20px; fill: none; stroke: var(--ux-accent); stroke-width: 2; stroke-linecap: round; }
.ux-palette-input input { min-width: 0; border: 0 !important; background: transparent !important; color: var(--text-bright); font-size: 17px; padding: 12px 4px; box-shadow: none !important; }
.ux-palette-input input:focus { outline: none !important; }
.ux-palette-input input::placeholder { color: var(--muted-2); }
.ux-palette-mic, .ux-palette-close {
  width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--ux-line); border-radius: 999px;
  background: rgba(255,255,255,0.04); color: var(--text); padding: 0;
}
.ux-palette-mic svg, .ux-palette-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ux-palette-mic.listening { border-color: var(--ux-accent); color: #cffafe; background: rgba(34,211,238,0.14); animation: uxPulse 1.1s ease-in-out infinite; }
@keyframes uxPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(34,211,238,0.35); } 50% { box-shadow: 0 0 0 9px rgba(34,211,238,0); } }
.ux-palette-list { max-height: min(56vh, 520px); overflow: auto; padding: 8px; display: grid; gap: 2px; }
.ux-palette-group { padding: 10px 12px 4px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); }
.ux-cmd {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--text);
  padding: 10px 12px; text-align: left; min-height: 48px; width: 100%;
}
.ux-cmd .ux-ico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,0.05); color: #a5f3fc; }
.ux-cmd .ux-ico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ux-cmd .ux-ico img { width: 22px; height: 22px; }
.ux-cmd strong { display: block; font-size: 14.5px; font-weight: 600; }
.ux-cmd small { display: block; color: var(--muted); font-size: 12px; }
.ux-cmd kbd { font: 600 11px/1 ui-monospace, monospace; color: var(--muted-2); border: 1px solid var(--ux-line); border-radius: 6px; padding: 4px 6px; }
.ux-cmd.active, .ux-cmd:hover { background: rgba(34,211,238,0.10); border-color: rgba(34,211,238,0.3); }
.ux-cmd.alex .ux-ico { background: linear-gradient(135deg, rgba(34,211,238,0.3), rgba(167,139,250,0.3)); color: #fff; }
.ux-palette-foot { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--ux-line); color: var(--muted-2); font-size: 11.5px; }
.ux-palette-foot kbd { font: 600 10.5px/1 ui-monospace, monospace; border: 1px solid var(--ux-line); border-radius: 5px; padding: 3px 5px; margin-right: 4px; color: var(--muted); }

/* Ajuda */
.ux-help { width: min(760px, 100%); max-height: 86vh; overflow: auto; border: 1px solid var(--ux-line-strong); border-radius: 22px; background: linear-gradient(180deg, rgba(14,21,38,0.98), rgba(7,11,22,0.99)); padding: 24px; display: grid; gap: 18px; box-shadow: 0 40px 100px rgba(0,0,0,0.6); animation: uxPop 180ms var(--ux-ease) both; }
.ux-help-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ux-help-head h2 { margin: 0; font-size: var(--ux-fs-xl); }
.ux-help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.ux-help-grid section { display: grid; gap: 8px; border: 1px solid var(--ux-line); border-radius: 14px; padding: 14px; background: rgba(255,255,255,0.025); }
.ux-help-grid h3 { margin: 0; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: #7dd3fc; }
.ux-help-grid button { border: 0; border-radius: 10px; background: rgba(255,255,255,0.04); color: var(--text); text-align: left; padding: 9px 11px; font-size: 13.5px; }
.ux-help-grid button:hover { background: rgba(34,211,238,0.12); color: #cffafe; }
.ux-help-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.ux-help-grid kbd { font: 600 11px/1 ui-monospace, monospace; border: 1px solid var(--ux-line); border-radius: 5px; padding: 3px 6px; color: var(--text-bright); }

/* ------------------------------------------------------------
   TOASTS (feedback de acções)
   ------------------------------------------------------------ */
.ux-toasts { position: fixed; z-index: 950; left: 50%; bottom: max(84px, calc(env(safe-area-inset-bottom) + 84px)); transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; width: min(420px, calc(100% - 32px)); }
.ux-toast {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--ux-line-strong); border-radius: 14px;
  background: rgba(10,16,30,0.94); color: var(--text-bright); padding: 12px 16px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5); backdrop-filter: blur(16px); animation: uxToastIn 200ms var(--ux-ease) both; pointer-events: auto;
}
.ux-toast i { width: 9px; height: 9px; border-radius: 50%; background: var(--ux-accent); box-shadow: 0 0 10px var(--ux-accent); flex: 0 0 auto; }
.ux-toast.ok i { background: var(--ux-ok); box-shadow: 0 0 10px var(--ux-ok); }
.ux-toast.warn i { background: var(--ux-warn); box-shadow: 0 0 10px var(--ux-warn); }
.ux-toast.bad i { background: var(--ux-danger); box-shadow: 0 0 10px var(--ux-danger); }
.ux-toast.leaving { animation: uxToastOut 220ms var(--ux-ease) both; }
@keyframes uxToastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes uxToastOut { to { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------
   MOBILE / TABLET (≤ 860px)
   ------------------------------------------------------------ */
@media (max-width: 860px) {
  .ux-home { gap: 14px; }
  .ux-home-head { text-align: left; justify-items: start; }
  .ux-home-head .alex-orb { display: none; }
  .ux-home-summary { max-width: none; }
  .ux-ask { margin: 4px 0 0; }
  .ux-chips { justify-content: flex-start; }
  .ux-grid { grid-template-columns: 1fr; gap: 12px; }
  .ux-card, .ux-card.span-6, .ux-card.span-8, .ux-card.span-12 { grid-column: span 1; padding: 16px; }
  .ux-overlay { padding: 10px 10px calc(env(safe-area-inset-bottom) + 10px); align-content: start; }
  .ux-palette { border-radius: 18px; }
  .ux-palette-list { max-height: calc(100vh - 200px); max-height: calc(100dvh - 200px); }
  .ux-palette-foot { display: none; }
  .ux-cmd { min-height: 54px; }

  /* Navegação inferior: 5 posições com o Alex ao centro. */
  .bottom-nav.ux-bottom-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; overflow: visible; }
  .ux-bottom-nav .ux-nav-center {
    width: 60px; height: 60px; margin: -26px auto 0; border-radius: 999px; padding: 0 !important;
    display: grid !important; place-items: center; min-height: 0 !important;
    background: radial-gradient(circle at 35% 30%, #67e8f9, #2563eb 62%, #1e1b4b) !important;
    color: #fff !important; box-shadow: 0 10px 30px rgba(34,211,238,0.45), 0 0 0 5px rgba(5,10,21,0.9);
  }
  .ux-bottom-nav .ux-nav-center svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; }
  .ux-bottom-nav .ux-nav-center .nav-label { display: none; }
}

@media (min-width: 861px) and (max-width: 1180px) {
  .ux-card { grid-column: span 6; }
  .ux-card.span-8 { grid-column: span 12; }
  .ux-cmdbar { left: calc(176px + 6%); right: 6%; }
}

/* TV / ecrãs grandes: mais ar, tipografia maior. */
@media (min-width: 1800px) {
  .ux-home { max-width: 1480px; }
  .ux-card { padding: 26px; }
  .ux-cmd { min-height: 56px; }
}

/* ------------------------------------------------------------
   Correcções após pré-visualização (v82)
   ------------------------------------------------------------ */
/* A barra "Pedir" é sempre fixa ao fundo nas vistas secundárias. */
.alex-command-bar.ux-cmdbar { position: fixed !important; top: auto !important; margin: 0 !important; width: auto !important; }

/* Avatar sem emoji: inicial sobre gradiente, cor estável por nome. */
.ux-avatar {
  width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, hsl(var(--h, 190) 90% 75%), hsl(calc(var(--h, 190) + 40) 70% 45%) 65%, hsl(calc(var(--h, 190) + 70) 60% 20%));
  color: #fff; font: 800 24px/1 "Space Grotesk", ui-sans-serif, sans-serif; letter-spacing: -0.02em;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.35);
}
.ux-avatar.lg { width: 84px; height: 84px; font-size: 36px; }

/* Escola: escolha da criança e dos jogos. */
.ux-school { display: grid; gap: 22px; max-width: 1240px; margin: 0 auto; }
.ux-school-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ux-school-head h2 { margin: 0; font-size: var(--ux-fs-xl); }
.ux-school-head p { margin: 4px 0 0; color: var(--muted); font-size: var(--ux-fs-sm); }
.ux-kids.big { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.ux-kid.big { padding: 20px 14px 16px; gap: 6px; border-radius: 18px; background: var(--ux-glass); backdrop-filter: blur(24px) saturate(160%); }
.ux-kid.big strong { font-size: 18px; }
.ux-kid.big.active { border-color: rgba(34,211,238,0.6); box-shadow: 0 0 0 4px rgba(34,211,238,0.14), 0 20px 40px rgba(0,0,0,0.35); }
.ux-kid .ux-gift { width: 100%; display: grid; gap: 4px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.ux-kid .ux-gift i { display: block; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.ux-kid .ux-gift i::after { content: ""; display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, #a78bfa, #f472b6); border-radius: inherit; }
.ux-games-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ux-games-head h3 { margin: 0; font-size: var(--ux-fs-lg); }
.ux-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.ux-game {
  position: relative; display: grid; justify-items: center; gap: 8px; padding: 22px 12px 18px; text-align: center;
  border: 1px solid var(--ux-line); border-radius: 18px; background: var(--ux-glass); backdrop-filter: blur(24px) saturate(160%);
  color: var(--text); transition: transform 200ms var(--ux-ease), border-color 160ms;
}
.ux-game:hover { transform: translateY(-3px); border-color: rgba(167,139,250,0.55); }
.ux-game .ux-game-ico { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(135deg, rgba(34,211,238,0.16), rgba(167,139,250,0.18)); }
.ux-game strong { font-size: 15.5px; }
.ux-game small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.ux-game em { position: absolute; top: 10px; right: 10px; font-style: normal; font-size: 10.5px; font-weight: 800; color: #c4b5fd; background: rgba(167,139,250,0.14); border-radius: 999px; padding: 3px 7px; }
.ux-school-hint { color: var(--muted); font-size: var(--ux-fs-md); text-align: center; padding: 24px; border: 1px dashed var(--ux-line-strong); border-radius: 18px; }
.monitor-school .ux-school { gap: 14px; }
.monitor-school .ux-games { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.monitor-school .ux-game { padding: 14px 8px 12px; }
@media (max-width: 860px) {
  .ux-kids.big { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .ux-games { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ux-game { padding: 16px 10px 14px; }
}

/* v84: topbar sem título duplicado; ilustrações nos jogos; mobile */
.ux-topbar-date { color: var(--muted); font-size: var(--ux-fs-sm); }
.ux-game .ux-game-ico { width: 100%; height: auto; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 14px; background: #0b1120; }
.ux-game-art { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 300ms var(--ux-ease); }
.ux-game:hover .ux-game-art { transform: scale(1.04); }
.ux-game { padding: 10px 10px 16px; }
.ux-games { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
@media (max-width: 860px) {
  .ux-cmdbar { display: none !important; }
  .ux-topbar { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  .ux-topbar .ux-status:not(.warn) { display: none; }
  .ux-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px 6px; }
  .ux-chips::-webkit-scrollbar { display: none; }
  .ux-chip { flex: 0 0 auto; }
  .ux-games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ux-game { padding: 8px 8px 12px; }
}

/* VendaHub dentro do Home Core */
.ux-sales-frame { position: fixed; z-index: 15; top: 0; right: 0; bottom: 0; left: 176px; background: #0b0f17; }
.ux-sales-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.view-sales .ux-cmdbar { display: none; }
.ux-kv.ux-kv-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) {
  .ux-sales-frame { left: 0; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .ux-kv.ux-kv-4 { grid-template-columns: repeat(2, 1fr); }
}

.ux-kid .ux-lesson { display: block; margin-top: 8px; padding: 6px 8px; border-radius: 10px; background: rgba(34,211,238,0.08); color: #a5f3fc; font-size: 11.5px; line-height: 1.35; text-align: left; }


/* Rotinas e diário do Alex */
.ux-routines .ux-view-head p{color:var(--ux-muted,#94a3b8);max-width:60ch}
.ux-routine-opts{display:flex;flex-wrap:wrap;gap:12px 18px;align-items:center;margin-top:10px;font-size:14px}
.ux-routine-opts label{display:flex;align-items:center;gap:8px}
.ux-routine-opts input{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.14);border-radius:8px;color:inherit;padding:6px 8px;font:inherit}
.ux-days b{display:inline-block;font-weight:600;font-size:12px;padding:3px 6px;border-radius:6px;opacity:.35;margin-right:2px}
.ux-days b.on{opacity:1;background:rgba(96,165,250,.18)}
.ux-switch{position:relative;display:inline-block;width:42px;height:24px;flex:none}
.ux-switch input{opacity:0;width:0;height:0}
.ux-switch span{position:absolute;inset:0;border-radius:24px;background:rgba(255,255,255,.18);transition:.2s}
.ux-switch span::before{content:"";position:absolute;width:18px;height:18px;left:3px;top:3px;border-radius:50%;background:#fff;transition:.2s}
.ux-switch input:checked+span{background:#22c55e}
.ux-switch input:checked+span::before{transform:translateX(18px)}
.ux-section-title{margin:22px 0 10px;font-size:16px}
.ux-journal-day h4{margin:0 0 8px;font-size:14px;opacity:.8}
.ux-list{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.ux-list li{display:block;line-height:1.35}
.ux-time{opacity:.6;font-variant-numeric:tabular-nums;margin-right:6px}
.ux-journal-text{opacity:.8;font-size:14px;margin:2px 0 6px}


/* Correio */
.ux-form{display:grid;gap:10px;margin-top:10px}
.ux-form label{display:grid;gap:4px;font-size:14px}
.ux-form input{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.14);border-radius:8px;color:inherit;padding:8px 10px;font:inherit}
.ux-form details{font-size:14px}.ux-form details label{margin-top:6px}
.ux-link{background:none;border:0;color:#93c5fd;cursor:pointer;font:inherit;padding:0}
.ux-link.danger{color:#f87171}
.ux-imp{display:inline-block;font-size:11px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;padding:2px 7px;border-radius:999px;margin-right:6px;vertical-align:middle;background:rgba(255,255,255,.12)}
.ux-imp-2{background:rgba(251,191,36,.25);color:#fde68a}.ux-imp-3{background:rgba(248,113,113,.3);color:#fecaca}
.ux-mail-item.seen{opacity:.65}
.ux-draft textarea{width:100%;box-sizing:border-box;margin-top:8px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.14);border-radius:8px;color:inherit;padding:8px 10px;font:inherit;line-height:1.4}
.ux-kv-3{grid-template-columns:repeat(3,1fr)}
.ux-empty.warn{color:#fbbf24}
