/* =====================================================================
   Identidade do produto sobre o theme.css da casa (visual-moderno).

   O theme.css é o da barbearia (tokens, componentes, tabela→cartão no
   celular, tema escuro). Aqui só muda o que é deste produto: neutros frios
   (dinheiro pede calma, não o creme quente da barbearia), o verde da marca
   (Brand::cssRoot) e os componentes que só existem aqui (escolha de conta,
   estado vazio do painel, telas de entrada).
   ===================================================================== */
:root {
    --bg:            #f3f6f5;
    --bg-subtle:     #ebf0ee;
    --surface:       #ffffff;
    --surface-2:     #f8faf9;
    --surface-hover: #eef3f1;
    --border:        #dde5e1;
    --border-strong: #c9d4cf;
    --text:          #111a17;
    --text-muted:    #56635e;
    --text-faint:    #5f6b66;
    --neutral-bg:    #ebf0ee;
    --shadow-xs: 0 1px 2px rgb(16 32 26 / .05);
    --shadow-sm: 0 1px 2px rgb(16 32 26 / .06), 0 4px 12px -8px rgb(16 32 26 / .14);
    --shadow-md: 0 1px 2px rgb(16 32 26 / .06), 0 8px 24px -12px rgb(16 32 26 / .18);
    --shadow-lg: 0 2px 6px rgb(16 32 26 / .06), 0 24px 48px -16px rgb(16 32 26 / .26);
}
[data-bs-theme="dark"] {
    --bg:            #0c1110;
    --bg-subtle:     #0f1514;
    --surface:       #141b19;
    --surface-2:     #18201e;
    --surface-hover: #1d2624;
    --border:        #24302c;
    --border-strong: #32403b;
    --text:          #e8efec;
    --text-muted:    #9caba5;
    --text-faint:    #8d9b95;
    --neutral-bg:    #1d2624;
}

/* ---------- Telas de entrada (cadastro, entrar, escolher conta) ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.auth-side {
    display: none; position: relative; overflow: hidden;
    background: #0d1714; color: #e8efec; padding: 3rem;
    flex-direction: column; justify-content: space-between;
}
.auth-side::before {
    content: ''; position: absolute; inset: auto -25% -40% auto; width: 80%; aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--brand-rgb), .45), transparent 65%);
}
.auth-side > * { position: relative; z-index: 1; }
.auth-side .eyebrow { color: #7fd9b1; }
.auth-side h2 { color: #f2f7f5; font-size: clamp(2rem, 3vw, 2.7rem); line-height: 1.05; max-width: 15ch; margin: .75rem 0 1rem; }
.auth-side p { color: #a7b6b0; max-width: 42ch; }
.auth-chat { display: grid; gap: .5rem; max-width: 340px; margin: 1.5rem 0; }
.auth-chat .msg { padding: .55rem .8rem; border-radius: 14px; font-size: .9rem; line-height: 1.35; max-width: 85%; }
.auth-chat .me { justify-self: end; background: #1f6f52; color: #f0fbf6; border-bottom-right-radius: 4px; }
.auth-chat .bot { background: #1b2522; color: #dbe7e2; border-bottom-left-radius: 4px; }
.auth-chat .bot b { color: #8ff0c2; font-weight: 600; }
.auth-feature { display: flex; gap: .8rem; align-items: flex-start; padding: .8rem 0; border-top: 1px solid #22302b; max-width: 46ch; }
.auth-feature .ico { width: 20px; height: 20px; color: #7fd9b1; margin-top: .15rem; flex: none; }
.auth-feature span { color: #a7b6b0; font-size: .9rem; }
.auth-main { display: grid; place-items: center; padding: 1.25rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); }
.auth-card { width: 100%; max-width: 420px; animation: fadeUp .25s var(--ease-out) both; }
.auth-card.wide { max-width: 560px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.auth-logo { display: inline-flex; align-items: center; gap: .55rem; font: 700 1.05rem/1 var(--font-display); color: var(--text); text-decoration: none; }
.auth-logo .mark {
    width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
    background: var(--brand); color: var(--brand-ink); font: 800 1.05rem/1 var(--font-display);
}
.auth-card h1 { font-size: clamp(1.5rem, 5vw, 1.85rem); letter-spacing: -.02em; margin-bottom: .35rem; }
.auth-card .lead { color: var(--text-muted); font-size: .95rem; margin-bottom: 1.25rem; }
.auth-card .form-control, .auth-card .form-select { min-height: 48px; font-size: 1rem; }
.auth-card .btn-lg { min-height: 52px; }
.auth-foot { text-align: center; font-size: .9rem; color: var(--text-muted); margin-top: 1.25rem; }
.trust-line { display: flex; gap: .5rem; align-items: flex-start; font-size: .8rem; color: var(--text-muted); margin-top: 1rem; }
.trust-line .ico { width: 16px; height: 16px; color: var(--brand-text); flex: none; margin-top: .1rem; }
@media (min-width: 992px) {
    .auth-wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .auth-side { display: flex; }
}

/* Tipo da conta no cadastro: três cartões grandes, fáceis de tocar. */
.type-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.type-pick input { position: absolute; opacity: 0; pointer-events: none; }
.type-pick label {
    display: grid; gap: .2rem; justify-items: center; text-align: center; cursor: pointer;
    padding: .8rem .4rem; min-height: 84px; border: 1.5px solid var(--border); border-radius: var(--r-md);
    background: var(--surface); transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.type-pick label .emo { font-size: 1.4rem; line-height: 1; }
.type-pick label strong { font-size: .88rem; }
.type-pick label small { font-size: .72rem; color: var(--text-muted); line-height: 1.2; }
.type-pick input:checked + label { border-color: var(--brand); background: var(--brand-soft); }
.type-pick input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; }
.type-pick label:active { transform: scale(.98); }

/* ---------- Escolher a conta ---------- */
.account-list { display: grid; gap: .6rem; }
.account-item {
    display: flex; align-items: center; gap: .85rem; width: 100%; text-align: left;
    padding: .9rem 1rem; min-height: 68px; border: 1px solid var(--border); border-radius: var(--r-lg);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs);
    transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.account-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.account-item:active { transform: scale(.99); }
.account-item.current { border-color: var(--brand); }
.account-item .acc-ico {
    width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center;
    background: var(--brand-soft); font-size: 1.3rem;
}
.account-item .acc-name { font-weight: 600; display: block; }
.account-item .acc-meta { font-size: .8rem; color: var(--text-muted); }
.account-item .chev { margin-left: auto; color: var(--text-faint); width: 18px; height: 18px; }

/* ---------- Painel: primeiro gasto ---------- */
.hello { margin-bottom: 1rem; }
.hello h1 { font-size: clamp(1.45rem, 4.5vw, 1.9rem); letter-spacing: -.02em; margin: 0; }
.hello p { color: var(--text-muted); margin: .2rem 0 0; }
.first-steps {
    position: relative; overflow: hidden; border-radius: var(--r-xl);
    border: 1px solid var(--border); background:
        radial-gradient(120% 90% at 100% 0%, rgba(var(--brand-rgb), .14), transparent 55%),
        var(--surface);
    padding: 1.25rem; box-shadow: var(--shadow-sm);
}
.first-steps h2 { font-size: clamp(1.25rem, 4vw, 1.55rem); letter-spacing: -.02em; margin-bottom: .4rem; }
.first-steps > p { color: var(--text-muted); max-width: 52ch; }
.phone-demo {
    margin: 1rem auto 0; max-width: 330px; border-radius: 22px; padding: .9rem .8rem 1rem;
    background: var(--surface-2); border: 1px solid var(--border);
}
.phone-demo .bar { display: flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 600; margin-bottom: .7rem; }
.phone-demo .bar .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font: 800 .75rem/1 var(--font-display); }
.phone-demo .bar small { display: block; font-weight: 400; color: var(--text-muted); font-size: .7rem; }
.bubble { padding: .55rem .75rem; border-radius: 14px; font-size: .88rem; line-height: 1.35; max-width: 88%; margin-bottom: .45rem; opacity: 0; animation: bubbleIn .35s var(--ease-out) forwards; }
.bubble.me { margin-left: auto; background: #d9fbe8; color: #0b2b1d; border-bottom-right-radius: 4px; }
.bubble.bot { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.bot b { color: var(--brand-text); }
.bubble .hint { display: block; font-size: .75rem; color: var(--text-muted); font-style: italic; margin-top: .2rem; }
.bubble:nth-child(2) { animation-delay: .15s; } .bubble:nth-child(3) { animation-delay: .7s; } .bubble:nth-child(4) { animation-delay: 1.2s; }
[data-bs-theme="dark"] .bubble.me { background: #1f5c43; color: #effcf5; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.examples { display: flex; flex-wrap: wrap; gap: .4rem; margin: .9rem 0 0; padding: 0; list-style: none; }
.examples li { font-size: .8rem; padding: .3rem .65rem; border-radius: 999px; background: var(--bg-subtle); border: 1px solid var(--border); color: var(--text-muted); }
.steps-list { display: grid; gap: .5rem; margin: 1rem 0 0; padding: 0; list-style: none; counter-reset: s; }
.steps-list li { display: flex; gap: .7rem; align-items: flex-start; font-size: .9rem; }
.steps-list li::before {
    counter-increment: s; content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center; font: 700 .75rem/1 var(--font-sans); background: var(--brand-soft); color: var(--brand-text);
}
.steps-list li.done::before { content: '✓'; background: var(--ok-bg); color: var(--ok); }
.steps-list li span { color: var(--text-muted); display: block; font-size: .82rem; }
.cta-whats { margin-top: 1.1rem; }
.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-top: 1rem; }
.mini-stat { border: 1px dashed var(--border-strong); border-radius: var(--r-lg); padding: .8rem .9rem; background: var(--surface); }
.mini-stat .lbl { font-size: .75rem; color: var(--text-muted); }
.mini-stat .val { font: 600 1.15rem/1.2 var(--font-mono); color: var(--text-faint); }
@media (min-width: 768px) {
    .first-steps { padding: 2rem; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 2rem; align-items: center; }
    .phone-demo { margin: 0; }
    .mini-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .bubble { animation: none; opacity: 1; } }

/* Aviso discreto no topo do painel (confirmar e-mail, cobrança). */
.notice-bar {
    display: flex; gap: .75rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--r-lg);
    border: 1px solid var(--border); background: var(--surface); margin-bottom: 1rem; font-size: .88rem;
}
.notice-bar .ico { width: 20px; height: 20px; flex: none; margin-top: .05rem; }
.notice-bar.info { background: var(--info-bg); border-color: transparent; }
.notice-bar.info .ico { color: var(--info); }
.notice-bar.warning { background: var(--warn-bg); border-color: transparent; }
.notice-bar.warning .ico { color: var(--warn); }
.notice-bar.secondary { background: var(--neutral-bg); border-color: transparent; }
.notice-bar.danger { background: var(--bad-bg); border-color: transparent; }
.notice-bar .grow { flex: 1; min-width: 0; }
.notice-bar strong { display: block; }
.notice-bar form { margin: 0; }

/* Lista de membros (vira cartão no celular sem tabela). */
.member { display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; border-top: 1px solid var(--border); }
.member:first-child { border-top: 0; }
.member .who { min-width: 0; flex: 1; }
.member .who strong { display: block; }
.member .who span { display: block; font-size: .8rem; color: var(--text-muted); overflow-wrap: anywhere; }
.member.off { opacity: .6; }

/* Integrações do /admin */
.integ-row { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--border); font-size: .9rem; }
.integ-row:first-child { border-top: 0; }
.integ-row .k { color: var(--text-muted); }
.integ-row .v { text-align: right; overflow-wrap: anywhere; }
.badge-provisorio { background: var(--warn-bg); color: var(--warn); border-radius: 999px; font-size: .7rem; padding: .15rem .5rem; font-weight: 600; }
.steps-list li > div { min-width: 0; }
.steps-list li strong { display: block; font-weight: 600; }

/* =====================================================================
   Conversa (/chat): o mesmo assistente do WhatsApp dentro do sistema.
   A tela inteira é o mensageiro: altura da janela, lista que rola sozinha e
   campo fixo embaixo. No celular, a altura vem da área VISÍVEL
   (visualViewport → --chat-vvh, com 100dvh de reserva): o teclado nunca
   cobre o campo.
   ===================================================================== */
:root { --chat-me: color-mix(in srgb, var(--brand) 13%, var(--surface)); --chat-bg: var(--bg-subtle); }
[data-bs-theme="dark"] { --chat-me: color-mix(in srgb, var(--brand) 32%, var(--surface)); --chat-bg: var(--bg); }

body.chat-page .app-footer { display: none; }
body.chat-page .app-main { height: 100vh; height: 100dvh; min-height: 0; }
body.chat-page .app-content { flex: 1; min-height: 0; display: flex; padding-bottom: 1.25rem; }
body.chat-page .container-app { display: flex; flex-direction: column; flex: 1; min-height: 0; max-width: 880px; }

.chat {
    position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.chat-head { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.chat-avatar {
    width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
    background: var(--brand); color: var(--brand-ink); font: 800 1.05rem/1 var(--font-display);
    box-shadow: 0 0 0 3px var(--brand-soft);
}
.chat-title { font: 700 1rem/1.2 var(--font-display); margin: 0; letter-spacing: -.01em; }
.chat-sub { display: block; font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .btn .ico { width: 16px; height: 16px; vertical-align: -3px; }

.chat-scroll {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: auto;
    padding: 1rem 1rem .75rem; background:
        radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 0) 0 0 / 22px 22px,
        var(--chat-bg);
}
.chat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.msg { display: flex; }
.msg.me { justify-content: flex-end; }
.msg + .msg.me, .msg.me + .msg.bot, .msg.bot + .msg.me { margin-top: .35rem; }
.msg .bubble {
    max-width: min(84%, 560px); padding: .5rem .7rem .3rem; border-radius: 16px;
    font-size: .95rem; line-height: 1.45; overflow-wrap: anywhere; box-shadow: var(--shadow-xs);
}
.msg.me .bubble { background: var(--chat-me); color: var(--text); border-bottom-right-radius: 5px; }
.msg.bot .bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.msg .bubble strong { font-weight: 650; }
.msg.bot .bubble strong { color: var(--brand-text); }
.msg .bubble em { color: var(--text-muted); font-size: .9em; }
.msg .meta { display: flex; justify-content: flex-end; align-items: center; gap: .4rem; margin-top: .15rem; font-size: .68rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.msg .via {
    display: inline-flex; align-items: center; gap: .25rem; padding: 0 .4rem; border-radius: 999px;
    background: color-mix(in srgb, #25D366 16%, transparent); color: var(--text-muted); font-weight: 500;
}
.msg .via::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #25D366; }
.msg.me .state::before { content: '✓'; color: var(--brand-text); }
.msg.me.sending .state::before { content: '•••'; letter-spacing: -1px; color: var(--text-faint); }
.msg.me.failed .bubble { box-shadow: 0 0 0 1.5px var(--bad); cursor: pointer; }
.msg.me.failed .state::before { content: 'Não enviou · toque para reenviar'; color: var(--bad); font-weight: 600; }
.msg.enter { animation: msgIn .22s var(--ease-out) both; }
.msg.me.enter { transform-origin: right bottom; }
.msg.bot.enter { transform-origin: left bottom; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px) scale(.97); } }

.chat-day { align-self: center; margin: .6rem 0 .3rem; list-style: none; }
.chat-day span {
    display: inline-block; padding: .15rem .65rem; border-radius: 999px; font-size: .72rem; font-weight: 600;
    color: var(--text-muted); background: var(--surface); border: 1px solid var(--border);
}
.chat-day:first-child { margin-top: 0; }

.msg.typing { margin-top: .4rem; }
.msg.typing .bubble { padding: .65rem .8rem; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); animation: dot 1.1s infinite ease-in-out both; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 70%, 100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

.quick { display: flex; flex-wrap: wrap; gap: .4rem; margin: .35rem 0 0; list-style: none; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: .45rem; margin: .7rem 0 1rem; }
.chip-btn {
    min-height: 36px; padding: .35rem .85rem; border-radius: 999px; font-size: .85rem; font-weight: 500;
    border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--border)); background: var(--surface); color: var(--brand-text);
    transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.chip-btn:hover { background: var(--brand-soft); }
.chip-btn:active { transform: scale(.97); }
.chat-intro .msg { margin-bottom: .2rem; }

.chat-new {
    position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 3;
    border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px;
    padding: .35rem .85rem; font-size: .8rem; font-weight: 600; box-shadow: var(--shadow-md);
}

.chat-composer { display: flex; align-items: flex-end; gap: .5rem; padding: .6rem .7rem; border-top: 1px solid var(--border); background: var(--surface); }
.chat-composer textarea {
    flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 132px; padding: .6rem 1rem;
    border: 1px solid var(--border); border-radius: 22px; background: var(--bg-subtle); color: var(--text);
    font: 400 1rem/1.4 var(--font-sans); /* 16px: o iPhone não dá zoom ao focar */
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.chat-composer textarea::placeholder { color: var(--text-faint); }
.chat-composer textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .18); background: var(--surface); }
.chat-send {
    width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center;
    background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-brand);
    transition: transform var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
.chat-send .ico { width: 20px; height: 20px; stroke-width: 2; }
.chat-send:active { transform: scale(.92); }
.chat-send:disabled { opacity: .45; box-shadow: none; }
.chat-send:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

@media (max-width: 767.98px) {
    /* No celular o chat é a tela: sem moldura, encostado na barra inferior. */
    body.chat-page .app-main { height: calc(var(--chat-vvh, 100dvh) - var(--tabbar-h) - env(safe-area-inset-bottom)); }
    body.chat-page .app-content { padding: 0; }
    body.chat-page .container-app > .notice-bar { margin: .5rem .6rem; }
    .chat { border: 0; border-radius: 0; box-shadow: none; }
    .chat-scroll { padding: .8rem .7rem .6rem; }
    .msg .bubble { max-width: 86%; }
    /* Teclado aberto: a barra inferior sai e o chat ocupa só a área visível. */
    body.chat-page.chat-keyboard { padding-bottom: 0; }
    body.chat-page.chat-keyboard .mobile-nav { display: none; }
    body.chat-page.chat-keyboard .app-main { height: var(--chat-vvh, 100dvh); }
    .chat-composer { padding-bottom: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
    .msg.enter, .dots i { animation: none; }
}
