/* Mentor MM — tema editorial, claro + escuro (design do Base44) */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --tint: #f1f3f5;
  --tint-hover: #f6f7f8;
  --tint-active: #eef1f4;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e6e8ec;
  --line-soft: #f1f2f4;

  --btn-grad: linear-gradient(180deg, #1e293b, #0f172a);
  --btn-ink: #ffffff;
  --btn-shadow: 0 6px 18px -8px rgba(15,23,42,.5);
  --send-bg: #0f172a;
  --send-hover: #000000;
  --send-ink: #ffffff;
  --send-idle: rgba(15,23,42,.28);
  --bot-av: #0f172a;

  /* Chat sem laranja: os tokens de acento viram tinta neutra.
     A landing tem CSS próprio (landing.css) e mantém o dourado da marca. */
  --gold: #0f172a;
  --gold-2: #334155;
  --gold-soft: #f1f3f5;
  --gold-line: #e2e5ea;
  --green: #16a34a;
  --danger: #dc2626;
  --danger-line: #f3d0d0;
  --danger-soft: #fdf2f2;

  --login-glow: #eef0f3;
  --focus-ring: rgba(15,23,42,.10);

  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Mesma dupla da landing: o Mentor por dentro e por fora falam a mesma língua. */
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, "Roboto Mono", monospace;

  --shadow-card: 0 1px 2px rgba(15,23,42,.04), 0 12px 32px -16px rgba(15,23,42,.16);
  --shadow-soft: 0 1px 2px rgba(15,23,42,.05);
}

:root[data-theme="dark"] {
  --bg: #0b0b0d;
  --surface: #161619;
  --tint: #212127;
  --tint-hover: #1d1d22;
  --tint-active: #26262c;
  --ink: #f4f4f5;
  --ink-2: #c7cdd6;
  --muted: #8b93a1;
  --faint: #6b7280;
  --line: #2a2a31;
  --line-soft: #201f24;

  --btn-grad: linear-gradient(180deg, #f4f4f5, #d9d9de);
  --btn-ink: #0b0b0d;
  --btn-shadow: 0 6px 18px -8px rgba(0,0,0,.6);
  --send-bg: #f4f4f5;
  --send-hover: #ffffff;
  --send-ink: #0b0b0d;
  --send-idle: rgba(244,244,245,.24);
  --bot-av: #f4f4f5;

  --gold: #f4f4f5;
  --gold-2: #c7cdd6;
  --gold-soft: #212127;
  --gold-line: #34343d;
  --danger-line: #4a2222;
  --danger-soft: #2a1414;

  --login-glow: #16161a;
  --shadow-card: 0 1px 2px rgba(0,0,0,.4), 0 14px 34px -18px rgba(0,0,0,.7);
  --shadow-soft: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .2s, color .2s;
}
a { color: var(--gold); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--tint-active); color: var(--ink); }

/* seletor de tema */
.theme-toggle {
  width: 38px; height: 38px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  display: grid; place-items: center; transition: border-color .15s, color .15s;
}
.theme-toggle:hover { border-color: var(--gold-2); color: var(--gold); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }
[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.auth-toggle { position: fixed; top: 18px; right: 18px; z-index: 6; }
.logo-img { display: block; }
[data-theme="dark"] .logo-img { filter: invert(1); }

/* ---------- Login ---------- */
.auth-wrap {
  min-height: 100dvh; display: grid; place-items: center; padding: 28px;
  background: radial-gradient(900px 500px at 50% -10%, var(--login-glow) 0%, transparent 60%), var(--bg);
}
.auth-shell { width: 100%; max-width: 420px; }
.auth-head { text-align: center; margin-bottom: 26px; }
.auth-head .logo-img { width: 230px; max-width: 78%; height: auto; margin: 0 auto 18px; }
.auth-head h1 { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.auth-head .sub { color: var(--muted); font-size: 15px; margin-top: 6px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 30px 28px; box-shadow: var(--shadow-card); }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 7px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .ico { position: absolute; left: 13px; width: 17px; height: 17px; color: var(--faint); pointer-events: none; }
.field input {
  width: 100%; background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius); padding: 13px 14px 13px 40px; font-size: 15px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--faint); opacity: .8; }
.field input:focus { border-color: var(--gold-2); box-shadow: 0 0 0 3px var(--focus-ring); }
.btn {
  width: 100%; background: var(--btn-grad); color: var(--btn-ink); border: 0; border-radius: var(--radius);
  padding: 14px; font-size: 15px; font-weight: 600; letter-spacing: .01em; margin-top: 8px;
  transition: transform .12s, box-shadow .15s, opacity .15s; box-shadow: var(--btn-shadow);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.switch { text-align: center; margin-top: 20px; color: var(--muted); font-size: 14px; }
.switch a { font-weight: 600; }
.err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 16px; }

/* ---------- Chat shell ---------- */
.app { display: grid; grid-template-columns: 292px 1fr; height: 100dvh; background: var(--bg); }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 20px 18px 14px; }
.side-head .logo-img { width: 100%; height: auto; }
/* Selo de versão: mono, discreto, alinhado à direita do logo. */
.side-head .ver { display: block; text-align: right; margin-top: 5px; font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em; color: var(--faint); }

/* Micro-rótulo editorial: caixa alta, tracking largo. Estrutura sem peso visual. */
.micro { font-size: 9.5px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; color: var(--faint); }

/* Código mono só onde codifica algo de verdade: as 15 ferramentas. Nunca como enfeite. */
.ri-code {
  flex-shrink: 0; width: 34px; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .06em; color: var(--gold); text-align: left; padding-top: 1px;
}

/* ---------- Rail: Meu Negócio + Ferramentas ---------- */
.rail { padding: 2px 10px 8px; display: flex; flex-direction: column; }
.rail-item {
  width: 100%; display: flex; align-items: center; gap: 2px; text-align: left; cursor: pointer;
  background: transparent; border: 0; border-radius: 10px; padding: 10px 10px; transition: background .14s;
}
.rail-item:hover { background: var(--tint-hover); }
.ri-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ri-t { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.ri-s { font-size: 11.5px; color: var(--muted); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 15px; height: 15px; color: var(--faint); transition: transform .18s var(--ease, ease); }
#toolsBtn[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* Dropdown do Arsenal: hairline dourada correndo pela coluna dos códigos. */
.tools { padding: 2px 0 6px 10px; margin-left: 16px; border-left: 1px solid var(--gold-line); }
.tgroup { padding: 6px 0 2px; }
.tg-label { padding: 4px 10px 5px; }
.tool {
  width: 100%; display: flex; align-items: center; gap: 2px; text-align: left; cursor: pointer;
  background: transparent; border: 0; border-radius: 8px; padding: 7px 10px; transition: background .12s;
}
.tool:hover { background: var(--tint-hover); }
.tool:hover .ri-code { opacity: 1; }
.tool .ri-code { width: 32px; opacity: .72; transition: opacity .12s; }
.t-name { font-size: 12.5px; font-weight: 500; color: var(--ink-2); line-height: 1.2; }

/* ---------- Conversas empilhadas ---------- */
.convs-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 6px; }
.plus {
  width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer; transition: background .12s, color .12s;
}
.plus:hover { background: var(--tint-hover); color: var(--ink); }
.plus svg { width: 15px; height: 15px; }

.convs { flex: 1; overflow-y: auto; padding: 0 10px 12px; min-height: 0; }
.conv { position: relative; display: flex; align-items: center; padding: 8px 11px; border-radius: 8px; cursor: pointer; transition: background .12s; }
.conv:hover { background: var(--tint-hover); }
.conv.active { background: var(--tint-active); }
.conv .ci { display: none; }
.conv .ct { min-width: 0; flex: 1; padding-right: 22px; }
.conv .ct h4 { font-size: 13px; font-weight: 500; color: var(--ink-2); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.active .ct h4 { color: var(--ink); font-weight: 600; }
.conv .del { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 7px; border: 0; background: transparent; color: var(--faint); display: grid; place-items: center; opacity: 0; transition: opacity .12s, background .12s, color .12s; }
.conv:hover .del { opacity: 1; }
.conv .del:hover { background: var(--danger-soft); color: var(--danger); }
.conv .del svg { width: 14px; height: 14px; }

/* ---------- Rodapé ---------- */
.side .foot { padding: 10px 12px 12px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 7px; }
.foot .row { display: flex; gap: 7px; }
.foot .row .leave { flex: 1; }
.ghost-btn.wide { width: 100%; }
.wa { display: flex; align-items: center; justify-content: center; gap: 8px; background: transparent; color: var(--green); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px; font-size: 12.5px; font-weight: 500; transition: background .15s, border-color .15s; }
.wa:hover { background: var(--tint-hover); border-color: var(--green); }
.wa svg { width: 15px; height: 15px; }
.leave { display: flex; align-items: center; justify-content: center; gap: 7px; background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px; font-size: 12.5px; font-weight: 500; transition: background .15s, color .15s, border-color .15s; }
.leave:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.leave svg { width: 14px; height: 14px; }
.foot .theme-toggle { width: 40px; height: 37px; }
.foot .who { font-size: 11px; color: var(--faint); text-align: center; padding-top: 2px; }

/* ---------- Chat main ---------- */
.main { display: flex; flex-direction: column; height: 100dvh; min-width: 0; }
.msgs { flex: 1; overflow-y: auto; padding: 30px 0; }
.msgs .inner { max-width: 760px; margin: 0 auto; padding: 0 28px; }
.msg { display: flex; gap: 14px; margin-bottom: 26px; }
.msg.user { flex-direction: row-reverse; }
.msg .av { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-top: 2px; overflow: hidden; }
/* O Mentor tem a cara do Marcio: foto em círculo, não ícone de robô. */
.msg.bot .av { background: transparent; border-radius: 50%; overflow: hidden; padding: 0; }
.msg.bot .av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg.bot .av svg { width: 19px; height: 19px; }
.msg.user .av { background: var(--tint-active); color: var(--ink-2); }
.msg.user .av svg { width: 18px; height: 18px; }
.msg .body { min-width: 0; flex: 1; font-size: 15.5px; line-height: 1.7; color: var(--ink); padding-top: 4px; }
.msg.user .body { text-align: right; }
.msg.user .body .utext { display: inline-block; color: var(--ink); font-weight: 500; }
.msg .body h1 { font-family: var(--font-display); font-size: 21px; font-weight: 700; margin: 18px 0 10px; }
.msg .body h2 { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin: 16px 0 9px; }
.msg .body h3 { font-size: 15.5px; font-weight: 700; margin: 14px 0 7px; }
.msg .body p { margin: 10px 0; }
.msg .body ul, .msg .body ol { margin: 10px 0 10px 22px; }
.msg .body li { margin: 5px 0; }
.msg .body strong { color: var(--ink); font-weight: 700; }
.msg .body a { color: var(--gold); font-weight: 600; text-decoration: underline; }
.msg .body blockquote { border-left: 3px solid var(--gold-2); padding-left: 14px; margin: 12px 0; color: var(--ink-2); font-style: italic; }
.msg .body code { background: var(--tint); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.msg .body pre { background: var(--tint); padding: 12px; border-radius: 10px; overflow-x: auto; margin: 12px 0; }
.msg .body hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.typing { color: var(--muted); font-style: italic; }

.suggests { margin-top: 20px; display: flex; flex-direction: column; gap: 9px; }
.suggests .stitle { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.suggests .chip { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; background: var(--tint); border: 1px solid transparent; border-radius: var(--radius); padding: 11px 14px; font-size: 14px; color: var(--ink-2); font-weight: 400; line-height: 1.45; transition: background .14s, border-color .14s, color .14s; }
.suggests .chip:hover { background: var(--tint-active); border-color: var(--line); color: var(--ink); }
.suggests .chip:active { transform: scale(.995); }
.suggests .chip::before { content: "→"; color: var(--ink); font-weight: 600; flex-shrink: 0; }

/* Welcome: uma frase só, centrada verticalmente. O convite é a interface. */
.msgs:has(#welcome) { display: grid; place-items: center; }
.msgs:has(#welcome) .inner { width: 100%; }
.welcome { max-width: 680px; margin: 0 auto; text-align: center; padding: 24px; }
.welcome h2 {
  /* Peso leve: em tamanho grande, Fraunces 300 fica elegante; 600 fica pesado. */
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(27px, 3.5vw, 42px); line-height: 1.24; letter-spacing: -.015em;
  color: var(--ink); text-wrap: balance;
  animation: w-in .7s cubic-bezier(.16,1,.3,1) both;
}
.welcome .w-oi { color: var(--gold-2); font-style: italic; font-weight: 400; }
@keyframes w-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .welcome h2 { animation: none; } }

.composer { padding: 12px 0 22px; background: linear-gradient(0deg, var(--bg) 60%, transparent); }
.composer .inner { max-width: 760px; margin: 0 auto; padding: 0 28px; }
.chatbox {
  display: flex; flex-direction: column; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 10px 12px 8px; box-shadow: var(--shadow-card);
  transition: border-color .15s, box-shadow .15s;
}
.chatbox:focus-within { border-color: var(--gold-2); box-shadow: 0 0 0 3px var(--focus-ring), var(--shadow-card); }
.chatbox textarea {
  width: 100%; border: 0; outline: none; resize: none; background: transparent;
  color: var(--ink); font-family: inherit; font-size: 15px; line-height: 1.55;
  padding: 6px 4px; max-height: 170px; overflow-y: auto;
}
.chatbox textarea::placeholder { color: var(--faint); }
/* O botão nasce apagado e "acorda" quando tem o que enviar. */
.chatbox .send { flex-shrink: 0; width: 34px; height: 34px; border-radius: var(--radius-pill); background: var(--send-bg); color: var(--send-ink); border: 0; display: grid; place-items: center; transition: background .15s, transform .18s cubic-bezier(.16,1,.3,1), opacity .15s; }
.chatbox .send:hover { background: var(--send-hover); }
.chatbox .send:active { transform: scale(.93); }
.chatbox .send .i-stop { display: none; }
.chatbox .send.idle { background: var(--send-idle); transform: scale(.86); opacity: .55; }
.chatbox .send.loading .i-up { display: none; }
.chatbox .send.loading .i-stop { display: block; }
.composer .hint { text-align: center; font-size: 11.5px; color: var(--faint); margin-top: 9px; }

/* ---------- Admin ---------- */
.admin-wrap { max-width: 1040px; margin: 0 auto; padding: 34px 26px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: flex-start; }
.admin-head { margin-bottom: 6px; }
.admin-head .logo-img { height: 42px; width: auto; }
.admin-wrap h1 { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin-top: 12px; }
.admin-wrap .sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
table.users { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-soft); }
table.users th { text-align: left; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--tint-hover); }
table.users td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
table.users tr:last-child td { border-bottom: 0; }
.badge { font-size: 11.5px; padding: 3px 10px; border-radius: var(--radius-pill); font-weight: 600; }
.badge.on { background: #dcfce7; color: #15803d; }
.badge.off { background: #fee2e2; color: #b91c1c; }
[data-theme="dark"] .badge.on { background: #123023; color: #4ade80; }
[data-theme="dark"] .badge.off { background: #3a1a1a; color: #f87171; }
.act { background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); border-radius: 8px; padding: 6px 11px; font-size: 12.5px; margin-right: 6px; transition: border-color .15s; }
.act:hover { border-color: var(--gold-2); }
.act.danger { color: var(--danger); }
.act.danger:hover { border-color: var(--danger); background: var(--danger-soft); }

/* Admin: gerar link de acesso manual */
.manual-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; margin-bottom: 26px; box-shadow: var(--shadow-soft); }
.manual-box h2 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.manual-box .mb-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; line-height: 1.5; }
.manual-box .mrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.manual-box input, .manual-box select { background: var(--bg); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: var(--font); outline: none; }
.manual-box input:focus, .manual-box select:focus { border-color: var(--gold-2); }
.manual-box #mEmail { flex: 1; min-width: 200px; }
.manual-box #mName { width: 160px; }
.mbtn { background: var(--gold-2); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; transition: filter .15s; }
.mbtn:hover { filter: brightness(1.06); }
.mbtn.ghost { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.mres { display: none; gap: 10px; margin-top: 14px; }
.mres #mLink { flex: 1; background: var(--tint); border: 1px solid var(--line); color: var(--ink-2); border-radius: 10px; padding: 10px 12px; font-size: 13px; font-family: ui-monospace, monospace; }
.mb-err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 14px; }

.convs::-webkit-scrollbar, .msgs::-webkit-scrollbar { width: 10px; }
.convs::-webkit-scrollbar-thumb, .msgs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 3px solid var(--surface); }
.msgs::-webkit-scrollbar-thumb { border-color: var(--bg); }

/* Barrinha de créditos (rodapé da sidebar) */
.side .foot .credits { width: 100%; text-align: left; background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; transition: background .15s; }
.side .foot .credits:hover { background: var(--tint-hover); }
.cr-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.cr-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.cr-num { font-size: 13px; font-weight: 700; color: var(--ink); }
.cr-bar { height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
.cr-fill { height: 100%; border-radius: 999px; background: var(--btn-grad); width: 0; transition: width .4s ease; }
.cr-plan { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--faint); margin-top: 7px; }
.cr-buy { color: var(--gold-2); font-weight: 700; }
.credits.low .cr-fill { background: linear-gradient(180deg, #ef4444, #b91c1c); }
.credits.unlimited .cr-bar, .credits.unlimited .cr-buy { display: none; }

.ghost-btn { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s; }
.ghost-btn:hover { background: var(--tint-hover); }
.foot .row .ghost-btn { flex: 1; }

/* Modais (planos, perfil, upsell) */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 60; }
.overlay[hidden] { display: none; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; padding: 26px 26px 28px; position: relative; box-shadow: 0 24px 60px -20px rgba(0,0,0,.55); }
.sheet-x { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: none; background: var(--tint); color: var(--muted); border-radius: 50%; font-size: 19px; line-height: 1; cursor: pointer; }
.sheet-x:hover { background: var(--tint-active); color: var(--ink); }
.sheet h3 { font-family: var(--font-display); font-size: 23px; color: var(--ink); margin: 0 0 5px; }
.sheet-sub { font-size: 13px; color: var(--muted); margin: 0 0 18px; line-height: 1.5; }
.sheet .warn { background: var(--gold-soft); border: 1px solid var(--gold-line); color: var(--gold); border-radius: var(--radius); padding: 11px 13px; font-size: 13px; font-weight: 500; margin-bottom: 16px; }

.plans { display: flex; flex-direction: column; gap: 10px; }
.plan { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; transition: border-color .15s, background .15s; text-decoration: none; }
.plan:hover { border-color: var(--gold-2); background: var(--gold-soft); }
.plan.cur { border-color: var(--gold-2); background: var(--gold-soft); }
.plan.soon { opacity: .5; pointer-events: none; }
.plan-l h4 { margin: 0; font-size: 15px; color: var(--ink); font-weight: 700; }
.plan-l p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.plan-r { text-align: right; white-space: nowrap; }
.plan-price { font-size: 18px; font-weight: 800; color: var(--ink); }
.plan-price span { font-size: 12px; color: var(--muted); font-weight: 500; }
.plan-cta { display: block; margin-top: 2px; font-size: 11px; font-weight: 700; color: var(--gold-2); text-transform: uppercase; letter-spacing: .03em; }
.plan.cur .plan-cta { color: var(--green); }
.pack { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.pack h4 { margin: 0 0 10px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.sheet form { display: flex; flex-direction: column; gap: 13px; }
.sheet form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.sheet form input, .sheet form select, .sheet form textarea { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; font-family: var(--font); outline: none; }
.sheet form input:focus, .sheet form select:focus, .sheet form textarea:focus { border-color: var(--gold-2); }
.sheet form textarea { resize: vertical; min-height: 56px; }
.sheet .primary { background: var(--btn-grad); color: var(--btn-ink); border: none; border-radius: var(--radius); padding: 13px; font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: var(--btn-shadow); margin-top: 4px; }
.sheet .primary:hover { filter: brightness(1.05); }
.sheet .skip { background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 8px; }
.sheet .skip:hover { color: var(--ink-2); }
.pform-ok { color: var(--green); font-size: 13px; text-align: center; min-height: 16px; }

/* Barra superior (só mobile: a sidebar some abaixo de 820px) */
.mtop { display: none; }
.mtop-cr { background: var(--tint); border: 1px solid var(--line); color: var(--ink); border-radius: var(--radius-pill); padding: 6px 14px; font-size: 13px; font-weight: 700; cursor: pointer; }
.mtop-actions { display: flex; gap: 8px; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }

  /* A sidebar não some mais: vira gaveta. Sem ela, o celular perdia as 28
     ferramentas, o Meu Negócio e o Arsenal. */
  .side {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(310px, 86vw);
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.16,1,.3,1);
    box-shadow: 12px 0 40px -20px rgba(0,0,0,.6);
  }
  body.menu-aberto .side { transform: none; }
  .side-bd { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }

  .msgs .inner, .composer .inner { padding: 0 16px; }
  .mtop {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 10px; border-bottom: 1px solid var(--line-soft); background: var(--surface);
  }
  .mtop-ic {
    width: 38px; height: 38px; display: grid; place-items: center; flex-shrink: 0;
    background: transparent; border: 0; border-radius: 9px; color: var(--ink-2);
  }
  .mtop-ic:active { background: var(--tint-active); }
  .mtop-ic svg { width: 20px; height: 20px; }
  .sheet { padding: 22px 18px 24px; max-height: 88dvh; overflow-y: auto; }

  /* Alvo de toque: abaixo de 44px o dedo erra. */
  .rail-item { padding: 13px 10px; }
  .tool { padding: 11px 10px; }
  .conv { padding: 11px 11px; }
  .conv .del { opacity: 1; }
  .cb-ic, .plus { width: 40px; height: 40px; }
  .msgs { padding: 20px 0; }
}

/* Em tela grande a gaveta não existe: nem o fundo, nem o hambúrguer. */
@media (min-width: 821px) {
  .side-bd, .mtop { display: none !important; }
}

/* ---------- Arsenal: página ativa, diagnóstico e swipe file ---------- */
.pgbar { display: flex; align-items: center; gap: 10px; padding: 9px 28px; border-bottom: 1px solid var(--line-soft); background: var(--surface); }
.pgbar .micro { flex-shrink: 0; }
.pg-url { flex: 1; min-width: 0; font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pgbar.set .pg-url { color: var(--ink-2); font-family: var(--font-mono); font-size: 11.5px; }
.pg-edit { flex-shrink: 0; background: transparent; border: 0; color: var(--gold-2); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.pg-edit:hover { text-decoration: underline; }

/* O diagnóstico ocupa a largura da leitura, não a do chat: é documento, não recado. */
.diag { max-width: 760px; margin: 0 auto 34px; padding: 22px 24px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.diag-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); margin-bottom: 16px; }
.diag-head h3 { flex: 1; font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.diag-head .ri-code { width: auto; font-size: 11px; }
.d-score { font-family: var(--font-mono); font-size: 15px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); }
.d-score.bom { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.d-score.meio { color: var(--gold-2); background: var(--gold-soft); }
.d-score.ruim { color: var(--danger); background: var(--danger-soft); }
.d-cache { font-size: 10.5px; color: var(--faint); }
.diag-wait { color: var(--muted); font-size: 13.5px; padding: 10px 0; }
.dots i { display: inline-block; width: 4px; height: 4px; margin-left: 3px; border-radius: 50%; background: var(--muted); animation: bl 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes bl { 0%,80%,100% { opacity: .2 } 40% { opacity: 1 } }

.d-atual { background: var(--tint); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.d-atual p { font-size: 14px; color: var(--ink); line-height: 1.5; margin-top: 5px; }
.d-bloco { margin-bottom: 15px; }
.d-bloco p { font-size: 14px; color: var(--ink-2); line-height: 1.62; margin-top: 5px; }
.d-cap { font-size: 12.5px; color: var(--gold-2); border-left: 2px solid var(--gold-line); padding: 4px 0 4px 11px; margin: 16px 0; line-height: 1.5; }
.d-sec { padding: 20px 0 10px; }

.v-item { border-top: 1px solid var(--line-soft); padding: 14px 0 4px; }
.v-top { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.v-n { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.v-ang { flex: 1; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.v-save { background: transparent; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--muted); font-size: 10.5px; font-weight: 600; padding: 3px 10px; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.v-save:hover { background: var(--tint-hover); color: var(--ink); }
.v-save.ok { color: var(--green); border-color: var(--green); }
.v-save:disabled { cursor: default; }
.v-texto { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.45; }
.v-sub { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-top: 5px; }
.v-just { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin-top: 8px; }

.sheet.wide { max-width: 720px; }
.ars-list { max-height: 60vh; overflow-y: auto; margin-top: 6px; }
.ars-item { border-top: 1px solid var(--line-soft); padding: 13px 0; }
.ars-item .ri-code { width: auto; }
.ars-del { background: transparent; border: 0; color: var(--faint); font-size: 11px; cursor: pointer; }
.ars-del:hover { color: var(--danger); }
.ars-src { display: block; font-size: 11px; color: var(--faint); margin-top: 6px; font-family: var(--font-mono); }
.ars-vazio { color: var(--muted); font-size: 13.5px; padding: 18px 0; }

/* ---------- Modal da página ativa ---------- */
.sheet.narrow { max-width: 460px; }
.sheet.narrow .micro { display: block; margin-bottom: 10px; }
/* O https:// é fixo à esquerda: tira a dúvida de "com ou sem?" antes dela nascer. */
.pg-field { display: flex; align-items: center; background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s; margin-top: 6px; }
.pg-field:focus-within { border-color: var(--gold-2); box-shadow: 0 0 0 3px var(--focus-ring); }
.pg-proto { flex-shrink: 0; padding: 0 2px 0 13px; font-family: var(--font-mono); font-size: 12.5px; color: var(--faint); }
.pg-field input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--ink); font-family: var(--font-mono); font-size: 13.5px; padding: 13px 14px 13px 2px; }
.pg-field input::placeholder { color: var(--faint); opacity: .7; }
.pg-err { min-height: 17px; font-size: 12px; color: var(--danger); padding-top: 7px; }
.sheet label .lbl-hint { display: block; margin-top: 5px; font-size: 11px; color: var(--faint); font-weight: 400; }

/* ---------- Anexo de imagem ---------- */

.anexos { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 4px 10px; }
.anx { position: relative; width: 62px; height: 62px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--tint); }
.anx img { width: 100%; height: 100%; object-fit: cover; display: block; }
.anx-x { position: absolute; top: 3px; right: 3px; width: 19px; height: 19px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(0,0,0,.68); color: #fff; font-size: 14px; line-height: 1; }
.anx-x:hover { background: var(--danger); }
/* O preço da pergunta aparece ANTES de enviar, não vira surpresa no saldo. */
.anx-dica { color: var(--gold-2); font-weight: 600; }

.msg-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; justify-content: flex-end; }
.msg-img { max-width: 190px; max-height: 190px; border-radius: 10px; border: 1px solid var(--line); display: block; }

/* Arrastar arquivo pra qualquer canto da janela */
body.dropping::after { content: 'Solta o print aqui'; position: fixed; inset: 14px; z-index: 40; display: grid; place-items: center; border: 2px dashed var(--gold-2); border-radius: 18px; background: color-mix(in srgb, var(--bg) 82%, transparent); color: var(--gold-2); font-size: 15px; font-weight: 700; letter-spacing: .02em; pointer-events: none; }

/* ---------- Meu Negócio: formulário em 3 blocos ---------- */
.sheet .fgrupo { padding: 16px 0 4px; border-top: 1px solid var(--line-soft); }
.sheet .fgrupo:first-of-type { border-top: 0; padding-top: 4px; }
.fg-titulo { margin-bottom: 12px; }
/* O campo da URL herda o tratamento do modal: https:// fixo, sem dúvida de formato. */
.sheet .pg-field { margin-top: 6px; }
.sheet .pg-field input { font-size: 13px; padding: 11px 12px 11px 2px; }
.sheet textarea { min-height: 0; resize: vertical; }

/* CTA de compra: contorno, não preenchimento. O peso vem do "+", não da cor chapada. */
.buy {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: transparent; color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; font-size: 13px; font-weight: 500;
  transition: border-color .15s, color .15s, background .15s;
}
.buy:hover { border-color: var(--gold-line); color: var(--ink); background: var(--tint-hover); }
.buy-mais { font-style: normal; font-size: 15px; font-weight: 400; line-height: 1; color: var(--gold-2); }

/* Tabela de custo dentro do modal de planos: o número antes do nome, pra escanear rápido. */
.custo { list-style: none; display: flex; flex-direction: column; gap: 1px; margin: 14px 0 20px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 10px 0; }
.custo li { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 4px 0; }
.custo b { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--gold-2); min-width: 14px; text-align: right; }
.custo span { color: var(--ink-2); }

/* ---------- Composer: ações numa fileira própria, embaixo do texto ---------- */
.chatbox .anexos { padding: 2px 2px 8px; }
.cb-acoes { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; }
.cb-esq { display: flex; align-items: center; gap: 2px; min-width: 0; }
.cb-ic {
  width: 32px; height: 32px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 8px; color: var(--faint);
  transition: background .12s, color .12s;
}
.cb-ic:hover { background: var(--tint-hover); color: var(--ink-2); }
.cb-ic svg { width: 17px; height: 17px; }
/* Gravando: o próprio botão vira o indicador, sem abrir modal por cima do texto. */
.cb-ic.gravando { color: var(--danger); background: var(--danger-soft); animation: pulsa 1.4s ease-in-out infinite; }
@keyframes pulsa { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.cb-dica { font-size: 11.5px; color: var(--gold-2); font-weight: 600; padding-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .cb-ic.gravando { animation: none; } }

/* Pensando: os 3 pontos herdam a cor do texto, então acompanham o tema sozinhos. */
.pensando { display: block; color: var(--muted); margin: 2px 0 4px; }

/* Custo em créditos ao lado da ferramenta: o preço aparece antes do clique. */
.tool .t-cr { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.tool:hover .t-cr { color: var(--ink-2); }
/* Render genérico das peças de Criação */
.c-sec { margin-top: 18px; }
.c-item { border-left: 1px solid var(--line); padding: 8px 0 8px 14px; margin-bottom: 10px; }
.c-par { margin-bottom: 6px; }
.c-k { display: block; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 3px; }
.c-txt { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); white-space: pre-wrap; }
.c-passo { margin-top: 20px; padding: 14px 16px; background: var(--tint); border-radius: var(--radius); }
.c-passo p { font-size: 14.5px; color: var(--ink); line-height: 1.55; margin-top: 4px; }
.ars-partes { font-size: 11px; color: var(--faint); margin-top: 6px; text-transform: capitalize; }
.ars-pe { display: flex; align-items: center; gap: 12px; margin-top: 9px; }
.ars-copy { background: transparent; border: 0; padding: 0; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ars-copy:hover { color: var(--ink); }
