/* =========================
   RESPONSIVO
========================= */
@media (max-width: 1024px) {
  .message-form {
    left: 290px;
    padding: 18px;
  }

  .messages-area {
    padding: 32px 18px 150px;
  }

  .chat-message,
  .message-input-box,
  .chat-warning {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  html,
  body,
  body.app-page {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  body.is-authenticated .top-header {
    display: flex !important;
  }

  .mobile-menu-btn {
    width: 42px;
    height: 42px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
  }

  .mobile-menu-btn .lucide {
    width: 20px;
    height: 20px;
    margin: 0;
    stroke: currentColor;
  }

  .mobile-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 9997;
    display: block;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body.sidebar-open .mobile-sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9998;
    width: min(82vw, 300px);
    height: 100dvh;
    min-height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .top-header {
    flex-shrink: 0;
    padding: 0 14px;
    gap: 12px;
  }

  .chat-area {
    min-height: 100dvh;
  }

  .page-title {
    flex: 1;
  }

  .top-actions {
    gap: 8px;
  }

  .login-link,
  .register-btn {
    padding: 9px 10px;
    font-size: 13px;
  }

  .messages-area {
    flex: 1;
    min-height: 0;
    padding: 22px 14px 132px;
  }

  body.chat-empty-state .messages-area {
    padding-top: 96px;
    padding-bottom: 96px;
  }

  body.chat-empty-state .welcome-box {
    margin-top: 20px;
  }

  body.chat-empty-state .welcome-box h2 {
    font-size: 2rem;
  }

  body.chat-empty-state .welcome-box p {
    max-width: 90%;
  }

  body.chat-empty-state .message-form {
    bottom: 155px;
  }

  .message-form {
    left: 0;
    padding: 14px;
  }

  .message-input-box {
    height: 56px;
    padding-left: 14px;
  }

  .message-input-box button {
    width: 44px;
    height: 44px;
  }

  .message-bubble {
    max-width: 88%;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .auth-modal .auth-wrapper {
    padding: 10px;
  }

  .auth-modal .auth-container {
    width: min(100%, 380px);
    max-width: min(100%, 380px);
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px 14px;
    border-radius: 16px;
  }

  .auth-container h2 {
    margin-bottom: 8px;
    font-size: 1.7rem;
  }

  .auth-subtitle {
    display: none;
  }

  form label {
    margin-bottom: 3px;
    font-size: 12px;
  }

  .input-box {
    height: 38px;
    margin-bottom: 8px;
    padding: 0 8px;
    min-width: 0;
  }

  .input-box input {
    min-width: 0;
    font-size: 12px;
  }

  .toggle-password .lucide,
  .input-box .lucide {
    width: 16px;
    height: 16px;
  }

  .lucide {
    width: 18px;
    height: 18px;
    margin-right: 8px;
  }

  .terms-text {
    margin-top: 8px;
    font-size: 10px;
    line-height: 1.25;
  }

  .actions-row {
    margin-top: 4px;
    gap: 8px;
    align-items: stretch;
  }

  .login-btn,
  .google-btn {
    height: 40px;
  }

  .login-btn {
    min-width: 0;
    font-size: 14px;
  }

  .google-btn {
    width: 44px;
    flex-shrink: 0;
  }

  .google-btn img {
    width: 18px;
    height: 18px;
  }

  .cf-turnstile {
    width: 100%;
    display: flex;
    justify-content: center;
    transform: scale(0.82);
    transform-origin: center center;
    margin: 8px 0;
  }

  .auth-link {
    margin-top: 10px;
    font-size: 11px;
  }

  .settings-modal {
    align-items: center;
    justify-content: center;
    padding: 16px;
  }

  .settings-box {
    max-width: 100%;
    max-height: calc(100vh - 32px);
    margin: 0 auto;
    overflow-y: auto;
    padding: 18px 14px;
    border-radius: 16px;
  }

  .settings-box h2 {
    margin-bottom: 12px;
    font-size: 1.55rem;
  }

  .settings-section {
    margin-bottom: 16px;
  }

  .settings-section h3 {
    margin-bottom: 10px;
    font-size: 1rem;
  }

  .setting-btn,
  .close-settings-btn {
    min-height: 44px;
  }

  .settings-muted {
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.4;
  }

  #settingsAccountGuest {
    padding: 14px;
  }

  .logout-modal {
    align-items: center;
    justify-content: center;
    padding: 16px;
  }

  .logout-box {
    max-width: 100%;
    max-height: calc(100vh - 32px);
    margin: 0 auto;
    overflow-y: auto;
    padding: 24px 18px;
    border-radius: 16px;
  }

  .logout-box h2 {
    font-size: 1.8rem;
    line-height: 1.2;
  }

  .logout-box p {
    margin-bottom: 22px;
    font-size: 14px;
    line-height: 1.55;
  }

  .confirm-logout-btn,
  .cancel-logout-btn {
    height: 50px;
  }
}

@media (max-width: 480px) {
  .brand strong,
  .brand span {
    font-size: 1.5rem;
  }

  .top-header {
    height: 58px;
    padding: 0 12px;
  }

  .top-actions {
    display: none;
  }

  body:not(.is-authenticated) .top-actions {
    display: flex;
  }

  .login-link,
  .register-btn {
    padding: 8px 8px;
    font-size: 12px;
  }

  .welcome-box h2 {
    font-size: 1.5rem;
  }

  body.chat-empty-state .welcome-box h2 {
    font-size: 1.7rem;
  }

  .welcome-box p,
  body.chat-empty-state .welcome-box p {
    max-width: 94%;
    font-size: 14px;
  }

  .messages-area {
    padding: 18px 10px 126px;
  }

  .message-form {
    padding: 10px;
  }

  .message-input-box {
    height: 54px;
    border-radius: 16px;
  }

  .message-bubble {
    max-width: 92%;
    padding: 10px 12px;
  }

  .chat-warning {
    font-size: 12px;
  }

  .auth-modal .auth-wrapper {
    padding: 8px;
  }

  .auth-modal .auth-container {
    width: min(100%, 340px);
    max-width: min(100%, 340px);
    max-height: calc(100dvh - 16px);
    padding: 14px 12px;
    border-radius: 8px;
  }

  .auth-container h2 {
    margin-bottom: 6px;
    font-size: 1.45rem;
  }

  .auth-subtitle {
    display: none;
  }

  .input-box {
    height: 36px;
    margin-bottom: 6px;
    padding: 0 7px;
  }

  .input-box input {
    font-size: 11px;
  }

  .toggle-password .lucide,
  .input-box .lucide {
    width: 15px;
    height: 15px;
    margin-right: 6px;
  }

  .terms-text {
    margin-top: 8px;
    font-size: 9px;
    line-height: 1.3;
  }

  .actions-row {
    gap: 8px;
  }

  .login-btn,
  .google-btn {
    height: 38px;
  }

  .login-btn {
    font-size: 13px;
  }

  .google-btn {
    width: 40px;
  }

  .cf-turnstile {
    transform: scale(0.74);
    margin: 8px 0;
  }

  .auth-link {
    margin-top: 12px;
    font-size: 11px;
  }

  .settings-modal {
    padding: 12px;
  }

  .settings-box {
    max-height: calc(100vh - 24px);
    padding: 14px 12px;
    border-radius: 14px;
  }

  .settings-box h2 {
    font-size: 1.35rem;
  }

  .settings-section h3 {
    font-size: 0.95rem;
  }

  .settings-user {
    gap: 10px;
  }

  .settings-user-info strong {
    font-size: 14px;
  }

  .settings-user-info span,
  .settings-muted {
    font-size: 11px;
  }

  #settingsAccountGuest {
    padding: 12px;
  }

  .logout-modal {
    padding: 12px;
  }

  .logout-box {
    max-height: calc(100vh - 24px);
    padding: 18px 14px;
    border-radius: 14px;
  }

  .logout-box h2 {
    font-size: 1.55rem;
  }

  .logout-box p {
    margin-bottom: 18px;
    font-size: 13px;
  }
}
