/* ================= Hair Labs — design system (preto & dourado) ============ */
:root{
  --bg:#0B0B0D; --bg-2:#0E0E12; --surface:#141418; --surface-2:#1B1B21;
  --line:rgba(201,162,75,.16); --line-soft:rgba(255,255,255,.06);
  --gold:#C9A24B; --gold-bright:#E7C56B; --gold-deep:#9C7A34;
  --grad-gold:linear-gradient(135deg,#E7C56B 0%,#C9A24B 45%,#A9822F 100%);
  --text:#ECEBE8; --muted:#9A9AA2; --muted-2:#6E6E77;
  --danger:#E5675E; --ok:#5FB98B;
  --r-lg:22px; --r-md:16px; --r-sm:12px;
  --shadow:0 18px 50px -20px rgba(0,0,0,.75);
  --safe-top:env(safe-area-inset-top,0px); --safe-bot:env(safe-area-inset-bottom,0px);
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%}
body{
  background:var(--bg); color:var(--text); font-family:var(--font);
  font-size:15px; line-height:1.5; -webkit-font-smoothing:antialiased;
  overscroll-behavior-y:none;
}
body::before{ /* brilho dourado sutil ao fundo */
  content:""; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(201,162,75,.10), transparent 60%),
    radial-gradient(90% 50% at 100% 0%, rgba(201,162,75,.05), transparent 55%),
    var(--bg);
}
a{color:inherit;text-decoration:none}
button{font-family:inherit}
img{max-width:100%;display:block}

.app-root{min-height:100%;display:flex;flex-direction:column}

/* ---------- Boot ---------- */
.boot{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:22px}
.boot-logo{width:240px;height:auto;max-width:72%}
.spinner{width:34px;height:34px;border-radius:50%;border:2.5px solid rgba(201,162,75,.25);border-top-color:var(--gold);animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- Layout de tela ---------- */
.screen{flex:1;display:flex;flex-direction:column;min-height:100%}
.screen-scroll{flex:1;overflow-y:auto;padding:calc(16px + var(--safe-top)) 18px 120px}
.center-wrap{flex:1;display:flex;align-items:center;justify-content:center;padding:24px 18px calc(24px + var(--safe-bot))}
.stack{width:100%;max-width:420px;margin:0 auto}

/* ---------- Marca ---------- */
.brand{display:flex;flex-direction:column;align-items:center;text-align:center;gap:14px;margin-bottom:26px}
.brand .mark{width:78px;height:78px;border-radius:20px;box-shadow:var(--shadow),0 0 0 1px var(--line)}
.brand h1{margin:0;font-family:Georgia,serif;letter-spacing:2px;font-size:20px;color:var(--gold);font-weight:700}
.brand p{margin:0;color:var(--muted);font-size:13.5px}

/* ---------- Cartão ---------- */
.card{background:linear-gradient(180deg,rgba(255,255,255,.02),transparent),var(--surface);
  border:1px solid var(--line);border-radius:var(--r-lg);padding:26px 22px;box-shadow:var(--shadow)}
.card + .card{margin-top:14px}
.card-title{font-size:17px;font-weight:700;margin:0 0 4px}
.card-sub{color:var(--muted);font-size:13.5px;margin:0 0 18px}

/* ---------- Campos ---------- */
.field{margin-bottom:14px}
.label{display:block;font-size:11px;text-transform:uppercase;letter-spacing:.09em;color:var(--muted);margin-bottom:7px;font-weight:600}
.input-wrap{display:flex;align-items:center;gap:9px;background:var(--bg-2);border:1px solid var(--line-soft);
  border-radius:var(--r-sm);padding:0 12px;transition:border-color .15s,box-shadow .15s}
.input-wrap:focus-within{border-color:var(--gold);box-shadow:0 0 0 3px rgba(201,162,75,.16)}
.input-wrap svg{width:17px;height:17px;color:var(--muted);flex:none}
.input-wrap input{flex:1;min-width:0;background:transparent;border:0;outline:0;color:var(--text);
  font-size:15px;padding:13px 0}
.input-wrap input::placeholder{color:var(--muted-2)}
.row-2{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px}

/* ---------- Botões ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;width:100%;
  border:0;border-radius:var(--r-sm);padding:15px 18px;font-size:15.5px;font-weight:700;
  cursor:pointer;transition:transform .06s,filter .15s,opacity .15s}
.btn:active{transform:translateY(1px)}
.btn-primary{background:var(--grad-gold);color:#20180A;box-shadow:0 10px 24px -12px rgba(201,162,75,.9)}
.btn-primary:hover{filter:brightness(1.05)}
.btn-ghost{background:transparent;color:var(--text);border:1px solid var(--line)}
.btn-ghost:hover{background:rgba(255,255,255,.03)}
.btn-danger{background:transparent;color:var(--danger);border:1px solid rgba(229,103,94,.4)}
.btn[disabled]{opacity:.55;pointer-events:none}
.btn-sm{padding:10px 14px;font-size:13.5px;width:auto;border-radius:10px}
.link{color:var(--gold);font-weight:600}
.link-muted{color:var(--muted);font-weight:600}
.text-c{text-align:center}
.mt-2{margin-top:10px}.mt-4{margin-top:18px}.mt-6{margin-top:26px}

/* ---------- Segmented (corte/coloração) ---------- */
.segment{display:flex;background:var(--bg-2);border:1px solid var(--line-soft);border-radius:14px;padding:4px;gap:4px}
.segment button{flex:1;border:0;background:transparent;color:var(--muted);font-weight:700;font-size:14px;
  padding:11px;border-radius:10px;cursor:pointer;transition:.15s}
.segment button.active{background:var(--grad-gold);color:#20180A}

/* ---------- Pills / badges ---------- */
.pill{display:inline-flex;align-items:center;gap:6px;background:rgba(201,162,75,.12);
  border:1px solid var(--line);color:var(--gold);border-radius:999px;padding:6px 12px;font-size:12.5px;font-weight:700}
.badge{display:inline-block;font-size:11px;font-weight:700;padding:3px 9px;border-radius:999px}
.badge-ok{background:rgba(95,185,139,.14);color:var(--ok)}
.badge-warn{background:rgba(229,103,94,.14);color:var(--danger)}
.badge-muted{background:rgba(255,255,255,.06);color:var(--muted)}

/* ---------- Topbar ---------- */
.topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;
  gap:12px;padding:calc(8px + var(--safe-top)) 18px 8px;
  background:linear-gradient(180deg,var(--bg) 60%,transparent);backdrop-filter:blur(6px)}
.topbar .tb-brand{display:flex;align-items:center;gap:10px;font-family:Georgia,serif;letter-spacing:1.5px;color:var(--gold);font-weight:700;font-size:15px}
.topbar .tb-brand img{width:30px;height:30px;border-radius:9px}

/* ---------- Bottom nav ---------- */
.tabbar{position:fixed;left:0;right:0;bottom:0;z-index:30;display:flex;justify-content:space-around;
  padding:8px 10px calc(8px + var(--safe-bot));background:rgba(14,14,18,.9);backdrop-filter:blur(14px);
  border-top:1px solid var(--line-soft)}
.tabbar a{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;color:var(--muted-2);
  font-size:10.5px;font-weight:600;padding:5px 0}
.tabbar a svg{width:22px;height:22px}
.tabbar a.active{color:var(--gold)}
.tab-cta{margin-top:-26px}
.tab-cta .fab{width:54px;height:54px;border-radius:50%;background:var(--grad-gold);display:flex;align-items:center;justify-content:center;
  box-shadow:0 12px 26px -8px rgba(201,162,75,.8);color:#20180A}
.tab-cta .fab svg{width:26px;height:26px}

/* ---------- Grid de resultados / histórico ---------- */
.grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.thumb{position:relative;border-radius:var(--r-md);overflow:hidden;border:1px solid var(--line-soft);background:var(--surface);aspect-ratio:3/4}
.thumb img{width:100%;height:100%;object-fit:cover}
.thumb .meta{position:absolute;left:0;right:0;bottom:0;padding:9px 10px;font-size:12px;font-weight:600;
  background:linear-gradient(180deg,transparent,rgba(0,0,0,.82))}
.thumb .meta small{color:var(--gold-bright);display:block;font-size:10.5px;text-transform:uppercase;letter-spacing:.05em}

/* ---------- Before/After ---------- */
.ba{position:relative;border-radius:var(--r-md);overflow:hidden;border:1px solid var(--line);user-select:none;touch-action:none;aspect-ratio:3/4;background:#000}
.ba img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.ba .after{clip-path:inset(0 0 0 var(--split,50%))}
.ba .handle{position:absolute;top:0;bottom:0;left:var(--split,50%);width:2px;background:var(--gold);transform:translateX(-1px)}
.ba .handle::after{content:"";position:absolute;top:85%;left:50%;width:34px;height:34px;transform:translate(-50%,-50%);
  border-radius:50%;background:var(--grad-gold);box-shadow:0 4px 14px rgba(0,0,0,.5)}
.ba .tag{position:absolute;top:10px;padding:4px 10px;border-radius:999px;font-size:11px;font-weight:700;background:rgba(0,0,0,.55);color:#fff}
.ba .tag.l{left:10px}.ba .tag.r{right:10px;color:var(--gold-bright)}

/* ---------- Uploader ---------- */
.uploader{border:1.5px dashed var(--line);border-radius:var(--r-md);background:var(--bg-2);
  aspect-ratio:3/4;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;
  color:var(--muted);cursor:pointer;overflow:hidden;position:relative}
.uploader svg{width:34px;height:34px;color:var(--gold)}
.uploader img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.uploader .hint{font-size:12.5px;text-align:center;padding:0 20px}

/* ---------- Estilos selecionáveis ---------- */
.style-list{display:flex;flex-wrap:wrap;gap:8px}
.chip{border:1px solid var(--line-soft);background:var(--bg-2);color:var(--text);border-radius:999px;
  padding:9px 14px;font-size:13.5px;font-weight:600;cursor:pointer;transition:.12s}
.chip.active{background:rgba(201,162,75,.16);border-color:var(--gold);color:var(--gold-bright)}
.chip:disabled{opacity:.4}

/* ---------- Listas admin ---------- */
.list-row{display:flex;align-items:center;gap:12px;padding:14px 4px;border-bottom:1px solid var(--line-soft)}
.list-row:last-child{border-bottom:0}
.list-row .grow{flex:1;min-width:0}
.list-row .grow b{display:block;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.list-row .grow small{color:var(--muted);font-size:12px}

/* ---------- Estados ---------- */
.empty{text-align:center;color:var(--muted);padding:48px 20px}
.empty svg{width:44px;height:44px;color:var(--muted-2);margin-bottom:12px}
.alert{border-radius:var(--r-sm);padding:12px 14px;font-size:13.5px;font-weight:600;margin-bottom:14px}
.alert-err{background:rgba(229,103,94,.1);border:1px solid rgba(229,103,94,.3);color:var(--danger)}
.alert-ok{background:rgba(95,185,139,.1);border:1px solid rgba(95,185,139,.3);color:var(--ok)}
.section-title{font-size:13px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:700;margin:22px 2px 10px}

/* ---------- Progress ---------- */
.progress{height:6px;border-radius:999px;background:var(--bg-2);overflow:hidden}
.progress i{display:block;height:100%;background:var(--grad-gold);width:0;transition:width .3s}

/* ---------- Toast ---------- */
.toast-host{position:fixed;left:0;right:0;bottom:calc(84px + var(--safe-bot));z-index:60;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none}
.toast{background:var(--surface-2);border:1px solid var(--line);color:var(--text);padding:12px 18px;border-radius:12px;
  font-size:13.5px;font-weight:600;box-shadow:var(--shadow);animation:toast-in .2s ease;max-width:88vw}
.toast.err{border-color:rgba(229,103,94,.4)}
@keyframes toast-in{from{opacity:0;transform:translateY(8px)}}

/* ---------- Install banner ---------- */
.install{position:fixed;left:14px;right:14px;bottom:calc(84px + var(--safe-bot));z-index:50;display:flex;align-items:center;gap:12px;
  background:var(--surface-2);border:1px solid var(--line);border-radius:16px;padding:12px 14px;box-shadow:var(--shadow)}
.install img{width:38px;height:38px;border-radius:10px}
.install .grow{flex:1}
.install b{font-size:14px}.install small{color:var(--muted);font-size:12px}

/* ---------- Modal ---------- */
.modal-back{position:fixed;inset:0;z-index:70;background:rgba(0,0,0,.6);backdrop-filter:blur(3px);display:flex;align-items:flex-end;justify-content:center}
.modal{width:100%;max-width:440px;background:var(--surface);border:1px solid var(--line);border-radius:20px 20px 0 0;padding:24px 20px calc(24px + var(--safe-bot));animation:sheet-up .22s ease}
@keyframes sheet-up{from{transform:translateY(100%)}}
@media(min-width:520px){.modal-back{align-items:center}.modal{border-radius:20px}}

.hr{height:1px;background:var(--line-soft);margin:18px 0;border:0}
.spin-inline{width:18px;height:18px;border-radius:50%;border:2px solid rgba(32,24,10,.35);border-top-color:#20180A;animation:spin .7s linear infinite}

/* ---- Ajustes de marca / segurança de layout ---- */
html,body{overflow-x:hidden}
.brand img{max-width:min(82%,300px);height:auto}
.brand img[src*="logo-linha"]{max-width:min(78%,260px)}
.app-root{max-width:560px;margin:0 auto}

/* ---- Apresentar imagem em tela cheia (para mostrar à cliente) ---- */
.present-back{position:fixed;inset:0;z-index:80;background:#000;display:flex;align-items:center;justify-content:center}
.present-stage{width:100%;height:100%}
.present-stage .ba{width:100%;height:100%;aspect-ratio:auto;border:0;border-radius:0}
.present-stage .ba img{object-fit:contain}
.present-close{position:fixed;top:calc(12px + var(--safe-top));right:14px;z-index:81;background:rgba(255,255,255,.12);
  border:0;color:#fff;width:42px;height:42px;border-radius:50%;display:flex;align-items:center;justify-content:center}
.present-hint{position:fixed;bottom:calc(16px + var(--safe-bot));left:0;right:0;text-align:center;color:rgba(255,255,255,.6);font-size:12px;z-index:81}
/* Botão de ampliar sobre a imagem */
.ba .expand{position:absolute;bottom:10px;right:10px;background:rgba(0,0,0,.55);border:0;color:#fff;width:38px;height:38px;
  border-radius:50%;display:flex;align-items:center;justify-content:center;z-index:3}
/* Linha com dois botões lado a lado */
.btn-row{display:flex;gap:10px}
.btn-row .btn{flex:1}
/* Card de resultado enxuto (imagem manda) */
.result-card{padding:12px}
.result-card .ba{aspect-ratio:3/4}

/* ---- Barra de ações fixa no rodapé (bottom:0) ---- */
.bottom-bar{position:fixed;left:0;right:0;bottom:0;z-index:40;max-width:560px;margin:0 auto;
  display:flex;gap:10px;padding:12px 16px calc(12px + var(--safe-bot));
  background:linear-gradient(0deg,var(--bg) 72%,transparent)}
.bottom-bar .btn{flex:1;margin:0}
.has-bottom-bar{padding-bottom:120px}

/* Corrige colunas de grid encolhendo (evita campo vazar, ex.: celular) */
.row-2>*{min-width:0}
.input-wrap{min-width:0}

/* ============ Fluxo de simulação (foto → cortes → resultado) ============ */
.flow-scroll{flex:1;display:flex;flex-direction:column;overflow-y:auto;padding:16px 18px calc(16px + var(--safe-bot))}
/* Etapa foto — a foto domina o espaço */
.photo-stage{flex:1;min-height:360px;margin-bottom:14px;border:1.5px dashed var(--line);border-radius:var(--r-md);
  background:var(--bg-2);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;
  color:var(--muted);overflow:hidden;position:relative}
.photo-stage img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.photo-stage .ph-ic{width:58px;height:58px;color:var(--gold)}
.photo-stage .ph-txt{font-size:14px;text-align:center;padding:0 30px;max-width:280px}
/* Grade de cortes com thumb */
.style-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.style-cell{border:1px solid var(--line-soft);border-radius:var(--r-sm);overflow:hidden;background:var(--surface);
  cursor:pointer;transition:.12s;position:relative}
.style-cell.active{border-color:var(--gold);box-shadow:0 0 0 2px rgba(201,162,75,.3)}
.style-cell .st-thumb{aspect-ratio:3/4;position:relative;background:var(--grad-gold);display:flex;align-items:center;justify-content:center}
.style-cell .st-thumb img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.style-cell .st-thumb .letter{font-family:Georgia,serif;font-size:26px;font-weight:700;color:#20180A;opacity:.85}
.style-cell .st-name{padding:7px 8px;font-size:11.5px;line-height:1.25;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.style-cell .st-check{position:absolute;top:8px;right:8px;width:24px;height:24px;border-radius:50%;background:var(--grad-gold);
  color:#20180A;display:none;align-items:center;justify-content:center;z-index:2;box-shadow:0 2px 6px rgba(0,0,0,.4)}
.style-cell.active .st-check{display:flex}
/* Ações discretas no resultado */
.result-actions{display:flex;justify-content:center;flex-wrap:wrap;gap:16px 18px;margin-top:14px}
.icon-btn{display:flex;flex-direction:column;align-items:center;gap:5px;background:none;border:0;color:var(--muted);font-size:11px;font-weight:600;cursor:pointer;text-decoration:none}
.icon-btn .circ{width:46px;height:46px;border-radius:50%;border:1px solid var(--line);display:flex;align-items:center;justify-content:center;color:var(--text)}
.icon-btn:active .circ{background:rgba(255,255,255,.05)}
.result-card .ba{aspect-ratio:auto;min-height:60vh}

/* ---- Topbar enxuta: logo-linha + créditos discretos + sair ---- */
.tb-logo{width:240px;height:auto;max-width:66%;display:block}
.tb-right{display:flex;align-items:center;gap:10px}
.pill.pill-sm{padding:5px 10px;font-size:12px;gap:5px}
.tb-exit{background:none;border:1px solid var(--line);color:var(--text);width:38px;height:38px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;cursor:pointer;flex:none}
.tb-exit:active{background:rgba(255,255,255,.05)}

/* ---- Loader estrelinha de IA (boot / geração) ---- */
.ai-loader{position:relative;width:78px;height:78px}
.ai-loader .spark{position:absolute;fill:var(--gold);filter:drop-shadow(0 0 6px rgba(201,162,75,.5))}
.ai-loader .spark-main{width:46px;height:46px;left:16px;top:16px;fill:var(--gold-bright);transform-origin:center;animation:spark-pulse 1.7s ease-in-out infinite}
.ai-loader .spark-a{width:22px;height:22px;left:2px;top:4px;animation:twinkle 1.5s ease-in-out infinite}
.ai-loader .spark-b{width:16px;height:16px;right:2px;bottom:6px;animation:twinkle 1.5s ease-in-out .75s infinite}
@keyframes spark-pulse{0%,100%{transform:scale(.85) rotate(0deg);opacity:.85}50%{transform:scale(1.06) rotate(18deg);opacity:1}}
@keyframes twinkle{0%,100%{transform:scale(.45);opacity:.25}50%{transform:scale(1);opacity:1}}

/* Rodapé: grupos nas laterais e FAB centralizado */
.tab-group{flex:1;display:flex;justify-content:space-around;align-items:center}
.tabbar .tab-cta{flex:none}

/* Estrela de favoritar sobre a thumb do estilo */
.style-cell .st-fav{position:absolute;top:6px;left:6px;width:28px;height:28px;border-radius:50%;background:rgba(0,0,0,.5);border:0;display:flex;align-items:center;justify-content:center;color:#fff;z-index:4;cursor:pointer;padding:0}
.style-cell .st-fav svg{fill:none}
.style-cell .st-fav.on{color:var(--gold-bright)}
.style-cell .st-fav.on svg{fill:var(--gold-bright)}
