:root {
  color-scheme: dark;
  --bg: #101513;
  --panel: #171e1b;
  --panel-raised: #202a25;
  --line: rgba(222, 237, 225, .11);
  --text: #eff5ee;
  --muted: #9ba9a0;
  --accent: #b9e561;
  --accent-ink: #1a2710;
  --safe-bottom: max(20px, env(safe-area-inset-bottom));
  --safe-top: max(20px, env(safe-area-inset-top));
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { display: flex; min-height: 100dvh; }
.sidebar { width: 220px; padding: var(--safe-top) 16px var(--safe-bottom); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 42px; background: #131916; }
.brand { color: var(--text); text-decoration: none; font-size: 24px; font-weight: 800; letter-spacing: -.09em; padding: 0 10px; }
.brand span { color: var(--accent); }
.sidebar nav { display: grid; gap: 6px; }
.nav-item, .profile-link { color: var(--muted); text-decoration: none; border-radius: 12px; padding: 11px 12px; display: flex; gap: 12px; align-items: center; font-size: 14px; }
.nav-item span, .profile-link span { width: 18px; text-align: center; color: var(--accent); font-size: 16px; }
.nav-item.active, .nav-item:hover, .profile-link:hover { color: var(--text); background: rgba(185, 229, 97, .09); }
.profile-link { margin-top: auto; }

.conversation { width: min(100%, 880px); min-height: 100dvh; margin: 0 auto; padding: var(--safe-top) 32px var(--safe-bottom); display: flex; flex-direction: column; }
.conversation-header { display: flex; justify-content: space-between; align-items: center; min-height: 34px; }
.eyebrow { color: var(--accent); font-size: 11px; letter-spacing: .15em; font-weight: 800; margin: 0; }
.reset { color: var(--muted); border: 0; background: transparent; padding: 8px; font-size: 13px; }
.reset:hover { color: var(--text); }
.empty-state { max-width: 640px; margin: auto 0; padding: 56px 0 36px; }
.status-dot { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.status-dot span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(185, 229, 97, .1); }
h1 { font-size: clamp(36px, 5.2vw, 58px); line-height: 1.02; letter-spacing: -.055em; margin: 22px 0; max-width: 700px; }
.empty-state > p:last-child { max-width: 530px; color: var(--muted); font-size: 16px; line-height: 1.6; }
.messages { display: grid; gap: 18px; width: 100%; margin: auto 0 20px; }
.message { max-width: 680px; padding: 16px 18px; border-radius: 16px; line-height: 1.5; white-space: pre-line; }
.message.assistant { background: var(--panel); border: 1px solid var(--line); border-top-left-radius: 4px; }
.message.user { margin-left: auto; background: #2a3927; color: #f5fff1; border-top-right-radius: 4px; }
.message small { display: block; color: var(--accent); margin-bottom: 5px; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.proposal { border: 1px solid rgba(185, 229, 97, .4); background: linear-gradient(130deg, #1c2919, #17211b); }
.proposal strong { color: var(--accent); }
.quick-replies { display: flex; flex-wrap: wrap; gap: 8px; min-height: 38px; margin-bottom: 10px; }
.quick-replies:empty { display: none; }
.quick-replies button { color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px; font-size: 13px; }
.quick-replies button:hover { border-color: var(--accent); color: var(--accent); }
.composer { margin-top: auto; display: flex; align-items: flex-end; gap: 10px; border: 1px solid var(--line); background: var(--panel); padding: 8px 8px 8px 16px; border-radius: 18px; }
.composer:focus-within { border-color: rgba(185, 229, 97, .65); box-shadow: 0 0 0 3px rgba(185, 229, 97, .09); }
textarea { resize: none; min-height: 28px; max-height: 140px; flex: 1; border: 0; outline: 0; color: var(--text); background: transparent; line-height: 1.5; padding: 6px 0; }
textarea::placeholder { color: #728078; }
.composer button { width: 36px; height: 36px; flex: 0 0 36px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-size: 21px; font-weight: 800; }
.composer button:hover { filter: brightness(1.08); }
.privacy-note { color: #748077; font-size: 11px; text-align: center; margin: 12px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* Na primeira mensagem, o campo faz parte do convite — não fica perdido no rodapé. */
.conversation.intake-start { position: relative; }
.conversation.intake-start .messages,
.conversation.intake-start .quick-replies { display: none; }
.conversation.intake-start .empty-state { align-self: center; text-align: center; }
.conversation.intake-start .status-dot { justify-content: center; }
.conversation.intake-start .empty-state > p:last-child { margin-inline: auto; }
.conversation.intake-start .composer { position: absolute; top: calc(50% + 132px); left: 50%; width: min(680px, calc(100% - 64px)); transform: translateX(-50%); margin: 0; }
.conversation.intake-start .privacy-note { position: absolute; top: calc(50% + 194px); left: 50%; width: min(680px, calc(100% - 64px)); transform: translateX(-50%); }

@media (max-width: 700px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; width: auto; height: calc(64px + env(safe-area-inset-bottom)); padding: 8px 12px var(--safe-bottom); border-right: 0; border-top: 1px solid var(--line); background: rgba(19, 25, 22, .94); backdrop-filter: blur(18px); flex-direction: row; align-items: center; }
  .brand { display: none; }
  .sidebar nav { display: flex; width: 100%; justify-content: space-around; gap: 2px; }
  .nav-item { flex-direction: column; gap: 2px; padding: 5px 10px; font-size: 10px; }
  .nav-item span { font-size: 15px; }
  .profile-link { display: none; }
  .conversation { padding: var(--safe-top) 20px calc(92px + env(safe-area-inset-bottom)); }
  .conversation.intake-start .composer { width: calc(100% - 40px); top: calc(50% + 122px); }
  .conversation.intake-start .privacy-note { width: calc(100% - 40px); top: calc(50% + 184px); }
  .empty-state { padding-top: 32px; }
  h1 { font-size: clamp(34px, 10vw, 46px); }
  .message { font-size: 15px; }
}
