/* Chavely: abertura, avisos, janelas e estados de erro */
#splash{position:fixed;inset:0;z-index:9999;display:grid;place-items:center;background:var(--bg,#F4F8F7);transition:opacity .45s ease,visibility .45s}
#splash.out{opacity:0;visibility:hidden}
#splash .sp-box{display:grid;justify-items:center;gap:14px}
#splash svg{width:76px;height:76px;filter:drop-shadow(0 10px 24px rgba(12,154,136,.28))}
#splash .sp-sq{transform-origin:50% 50%;animation:spPop .55s cubic-bezier(.2,1.4,.4,1) both}
#splash .sp-house{stroke-dasharray:140;stroke-dashoffset:140;animation:spDraw .7s .25s ease-out forwards}
#splash .sp-key{opacity:0;transform:translateY(10px);animation:spKey .45s .8s ease-out forwards}
#splash .sp-name{font:800 26px/1 var(--f-display,system-ui);color:var(--fg,#10201D);letter-spacing:-.02em;opacity:0;animation:spFade .4s .95s forwards}
#splash .sp-name i{color:var(--accent,#0C9A88);font-style:normal}
#splash .sp-bar{width:120px;height:3px;border-radius:9px;background:var(--line,#D9E3E0);overflow:hidden;opacity:0;animation:spFade .3s 1.1s forwards}
#splash .sp-bar b{display:block;height:100%;width:40%;background:var(--accent,#0C9A88);border-radius:9px;animation:spSlide 1s 1.1s ease-in-out infinite}
@keyframes spPop{from{transform:scale(.4);opacity:0}to{transform:scale(1);opacity:1}}
@keyframes spDraw{to{stroke-dashoffset:0}}
@keyframes spKey{to{opacity:1;transform:none}}
@keyframes spFade{to{opacity:1}}
@keyframes spSlide{from{transform:translateX(-110%)}to{transform:translateX(280%)}}

/* faixa de conexão */
#uxnet{position:fixed;left:50%;top:12px;transform:translate(-50%,-140%);z-index:9000;display:flex;gap:10px;align-items:center;padding:10px 16px;border-radius:99px;background:var(--fg,#10201D);color:#fff;font:600 13.5px/1.3 var(--f-body,system-ui);box-shadow:0 10px 30px rgba(0,0,0,.25);transition:transform .35s cubic-bezier(.2,1.2,.4,1);max-width:calc(100vw - 32px)}
#uxnet.on{transform:translate(-50%,0)}
#uxnet.ok{background:var(--good,#14855F)}
#uxnet i{width:9px;height:9px;border-radius:50%;background:var(--amber,#D99A1E);flex:none;animation:uxBlink 1.2s infinite}
#uxnet.ok i{background:#fff;animation:none}
@keyframes uxBlink{50%{opacity:.25}}

/* janelas (pop-ups) */
#uxpop{position:fixed;inset:0;z-index:8000;display:grid;place-items:center;padding:16px;background:rgba(16,32,29,.45);backdrop-filter:blur(3px);animation:uxIn .25s ease both}
#uxpop .uxm{position:relative;width:min(460px,100%);max-height:calc(100vh - 32px);overflow:auto;background:var(--surface,#fff);color:var(--fg,#10201D);border-radius:22px;padding:26px 24px 20px;box-shadow:0 30px 80px rgba(16,32,29,.35);animation:uxUp .4s cubic-bezier(.2,1.25,.4,1) both;font-family:var(--f-body,system-ui)}
#uxpop .uxm.wide{width:min(560px,100%)}
#uxpop .uxic{width:56px;height:56px;border-radius:16px;display:grid;place-items:center;background:var(--accent-soft,#D3F1EC);color:var(--accent-d,#0A7C6E);font-size:28px;margin-bottom:14px}
#uxpop .uxic.warn{background:#FBEFD9;color:#9A6A0B}
#uxpop .uxic.bad{background:#FBE3E1;color:var(--bad,#D4433B)}
#uxpop h2{font:800 21px/1.2 var(--f-display,system-ui);letter-spacing:-.01em;margin:0 0 8px}
#uxpop p{margin:0 0 12px;color:var(--muted,#586C68);line-height:1.5;font-size:14.5px}
#uxpop .uxx{position:absolute;top:12px;right:12px;width:34px;height:34px;border-radius:50%;border:0;background:transparent;color:var(--muted,#586C68);font-size:20px;cursor:pointer}
#uxpop .uxx:hover{background:var(--bg,#F4F8F7)}
#uxpop .uxbtns{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}
#uxpop .uxbtns .btn{flex:1 1 auto;justify-content:center}
#uxpop .uxstats{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px;margin:6px 0 12px}
#uxpop .uxstats div{background:var(--bg,#F4F8F7);border-radius:14px;padding:12px}
#uxpop .uxstats b{display:block;font:800 24px/1 var(--f-display,system-ui);color:var(--accent-d,#0A7C6E)}
#uxpop .uxstats span{font-size:12.5px;color:var(--muted,#586C68)}
#uxpop .uxsteps{list-style:none;padding:0;margin:8px 0 4px;display:grid;gap:8px}
#uxpop .uxsteps li{display:flex;gap:10px;align-items:flex-start;font-size:14px;line-height:1.4}
#uxpop .uxsteps li b.n{flex:none;width:24px;height:24px;border-radius:50%;background:var(--accent-soft,#D3F1EC);color:var(--accent-d,#0A7C6E);display:grid;place-items:center;font-size:12.5px}
#uxpop .uxopts{display:grid;gap:8px;margin:10px 0}
#uxpop .uxopts label{display:flex;gap:10px;align-items:center;padding:11px 12px;border:1px solid var(--line,#D9E3E0);border-radius:12px;cursor:pointer;font-size:14px}
#uxpop .uxopts label:has(input:checked){border-color:var(--accent,#0C9A88);background:var(--accent-soft,#D3F1EC)}
#uxpop .uxoffer{border:1px solid var(--accent,#0C9A88);background:var(--accent-soft,#D3F1EC);border-radius:14px;padding:12px 14px;margin:10px 0;font-size:14px;line-height:1.45}
#uxpop textarea{width:100%;min-height:64px;border:1px solid var(--line,#D9E3E0);border-radius:12px;padding:10px;font:inherit;resize:vertical}
#uxpop .uxcopy{display:flex;gap:6px;margin-top:8px}
#uxpop .uxcopy input{flex:1;min-width:0;border:1px solid var(--line,#D9E3E0);border-radius:10px;padding:9px 10px;font:inherit;font-size:13px;background:var(--bg,#F4F8F7)}
@keyframes uxIn{from{opacity:0}}
@keyframes uxUp{from{opacity:0;transform:translateY(24px) scale(.96)}}

/* confete */
#uxconf{position:fixed;inset:0;pointer-events:none;z-index:8500;overflow:hidden}
#uxconf i{position:absolute;top:-14px;width:9px;height:14px;border-radius:2px;animation:uxFall linear forwards}
@keyframes uxFall{to{transform:translate3d(var(--dx),110vh,0) rotate(var(--r));opacity:.9}}

/* aviso de erro do servidor */
#uxnote{position:fixed;right:16px;bottom:16px;z-index:8600;max-width:min(380px,calc(100vw - 32px));background:var(--surface,#fff);border:1px solid var(--line,#D9E3E0);border-left:4px solid var(--bad,#D4433B);border-radius:14px;padding:12px 14px;box-shadow:0 16px 40px rgba(16,32,29,.18);font:14px/1.45 var(--f-body,system-ui);color:var(--fg,#10201D);animation:uxUp .35s cubic-bezier(.2,1.25,.4,1) both}
#uxnote b{display:block;margin-bottom:2px}
#uxnote button{margin-top:8px}

/* tela de erro geral */
#uxcrash{position:fixed;inset:0;z-index:9500;display:grid;place-items:center;padding:20px;background:var(--bg,#F4F8F7);font-family:var(--f-body,system-ui)}
#uxcrash .bx{max-width:440px;text-align:center}
#uxcrash h1{font:800 26px/1.2 var(--f-display,system-ui);margin:18px 0 8px;color:var(--fg,#10201D)}
#uxcrash p{color:var(--muted,#586C68);line-height:1.5;margin:0 0 18px}
#uxcrash .row{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}
#uxcrash svg{width:120px;height:120px}
#uxcrash code{display:block;margin-top:16px;font-size:11.5px;color:var(--muted,#586C68);opacity:.7}

/* esqueleto de carregamento */
.uxsk{display:grid;gap:14px}
.uxsk i{display:block;border-radius:14px;background:linear-gradient(90deg,var(--line,#D9E3E0) 0,#eef3f2 50%,var(--line,#D9E3E0) 100%);background-size:200% 100%;animation:uxSk 1.2s ease-in-out infinite;opacity:.7}
@keyframes uxSk{from{background-position:200% 0}to{background-position:-200% 0}}

/* telas vazias */
.uxempty{display:grid;justify-items:center;text-align:center;gap:6px;padding:34px 20px;border:1.5px dashed var(--line,#D9E3E0);border-radius:20px;background:var(--surface,#fff);margin-top:14px;animation:uxUp .4s ease both}
.uxempty svg{width:110px;height:90px;margin-bottom:6px}
.uxempty h3{margin:0;font:800 18px/1.25 var(--f-display,system-ui)}
.uxempty p{margin:0 0 10px;color:var(--muted,#586C68);max-width:380px;line-height:1.5}

/* aviso de sessão vencida no login */
.uxsess{background:#FBEFD9;border:1px solid #F0D49A;color:#6B4A07;border-radius:12px;padding:10px 12px;font-size:13.5px;margin:0 0 12px}

/* abertura mais lenta: "Seja bem-vindo ao Chavely" */
#splash{transition:opacity .8s ease,visibility .8s}
#splash .sp-box{gap:8px}
#splash svg{width:92px;height:92px}
#splash .sp-sq{animation-duration:.9s}
#splash .sp-house{animation:spDraw 1.2s .45s ease-out forwards}
#splash .sp-key{animation:spKey .7s 1.45s ease-out forwards}
#splash .sp-hi{font:600 18px/1.2 var(--f-body,system-ui);color:var(--muted,#586C68);letter-spacing:.01em;opacity:0;margin-top:18px;animation:spRise .7s 1.9s cubic-bezier(.2,.9,.3,1) forwards}
#splash .sp-name{font-size:38px;animation:spRise .8s 2.2s cubic-bezier(.2,.9,.3,1) forwards}
#splash .sp-bar{margin-top:14px;animation:spFade .5s 2.7s forwards}
#splash .sp-bar b{animation-delay:2.7s}
@keyframes spRise{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
@media (display-mode:standalone){#splash .sp-hi{color:rgba(255,255,255,.88)!important}}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
  #uxconf{display:none}
}
