/* Site dos usuários. Reaproveita os tokens e componentes de /painel/static/app.css
   (cores, botões, campos, modais), que o tema do cliente sobrescreve. */

html, body { height: 100%; }
.p-shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); height: 100vh; height: 100dvh; }

/* ---------- conversas ---------- */
.p-side { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.p-side-head { padding: 14px 12px 10px; }
.p-convs { flex: 1; overflow-y: auto; padding: 4px 8px 16px; display: flex; flex-direction: column; gap: 1px; }
.p-conv-group { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 12px 8px 4px; }
.p-conv { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.p-conv:hover, .p-conv.active { background: var(--surface-2); }
.p-conv.active { background: var(--accent-soft); }
.p-conv a { flex: 1; min-width: 0; padding: 8px 10px; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.p-conv.active a { color: var(--accent-strong); font-weight: 600; }
.p-conv .p-conv-del { opacity: 0; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.p-conv:hover .p-conv-del, .p-conv.active .p-conv-del, .p-conv-del:focus-visible { opacity: 1; }
.p-conv-del:hover { color: var(--danger); background: var(--danger-soft); }
.p-convs-empty { color: var(--muted); font-size: 13px; padding: 10px; }

/* ---------- área principal ---------- */
.p-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.p-top { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface); min-height: 58px; }
.p-top .brand { min-width: 0; }
.p-top-spacer { flex: 1; }
.p-only-mobile { display: none; }

.p-user { position: relative; }
.p-user-btn { display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: none; color: var(--text); font: inherit; padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer; max-width: 240px; }
.p-user-btn:hover, .p-user-btn[aria-expanded=true] { background: var(--surface-2); border-color: var(--border); }
.p-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.p-user-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 40; display: grid; }
.p-menu-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: grid; }
.p-menu-item { display: block; text-align: left; width: 100%; padding: 9px 10px; border-radius: 8px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; text-decoration: none; }
.p-menu-item:hover { background: var(--surface-2); }
#menu-admin { color: var(--accent-strong); font-weight: 600; }

/* ---------- conversa ---------- */
.p-thread { flex: 1; overflow-y: auto; padding: 24px 18px; display: flex; flex-direction: column; gap: 18px; }
.p-thread > * { width: 100%; max-width: 780px; margin-left: auto; margin-right: auto; }
.p-welcome { margin: auto; text-align: center; max-width: 520px; display: grid; gap: 10px; justify-items: center; }
.p-welcome h1 { font-size: 22px; }
.p-welcome .brand-logo { height: 52px; max-width: 280px; }
.p-q { display: flex; justify-content: flex-end; }
.p-q > div { background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: 16px 16px 4px 16px; max-width: 85%; white-space: pre-wrap; word-break: break-word; }
.p-a { display: grid; gap: 8px; }
.p-a-body { background: var(--surface); border: 1px solid var(--border); padding: 14px 16px; border-radius: 16px 16px 16px 4px; line-height: 1.6; word-break: break-word; }
.p-a-body p { margin: 0 0 10px; }
.p-a-body p:last-child, .p-a-body ul:last-child, .p-a-body ol:last-child { margin-bottom: 0; }
.p-a-body ul, .p-a-body ol { margin: 0 0 10px; padding-left: 22px; }
.p-a-body li { margin: 2px 0; }
.p-a-error { color: var(--danger); }
.p-sources summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 2px 4px; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.p-sources summary::-webkit-details-marker { display: none; }
.p-sources summary::before { content: "▸"; font-size: 11px; transition: transform .15s; }
.p-sources[open] summary::before { transform: rotate(90deg); }
.p-sources .sources { margin-top: 8px; }
.p-thinking { color: var(--muted); font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.p-dots::after { content: "…"; animation: pulse 1s infinite; }

/* ---------- campo de pergunta ---------- */
.p-composer { padding: 10px 18px 14px; background: var(--bg); border-top: 1px solid var(--border); }
.p-composer > * { max-width: 780px; margin-left: auto; margin-right: auto; }
.p-collection { width: auto; min-width: 200px; margin-bottom: 8px; display: block; }
.p-input { display: flex; gap: 8px; align-items: flex-end; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 6px 6px 6px 12px; }
.p-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.p-input textarea { border: 0; outline: 0; min-height: 40px; max-height: 180px; resize: none; padding: 9px 0; background: transparent; box-shadow: none; }
.p-input textarea:focus { outline: none; border: 0; }
.p-disclaimer { font-size: 11.5px; color: var(--muted); text-align: center; margin: 8px auto 0; }

/* ---------- telas de acesso ---------- */
.login-card .form-grid { gap: 12px; }
.p-forgot { font-size: 13px; }
.pw-rules { font-size: 12.5px; color: var(--muted); margin: -4px 0 0; }

/* ---------- celular ---------- */
.p-scrim { position: fixed; inset: 0; background: rgba(10, 14, 18, .4); z-index: 29; }
@media (max-width: 860px) {
  .p-shell { grid-template-columns: minmax(0, 1fr); }
  .p-side { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .p-side.open { transform: none; }
  .p-only-mobile { display: inline-flex; }
  .p-top { padding: 8px 12px; }
  .p-user-name { display: none; }
  .p-thread { padding: 16px 12px; }
  .p-composer { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
  .p-q > div { max-width: 92%; }
  .p-top .brand-logo { max-width: 150px; }
}
