/* Mobile — painel minimalista estilo app de chat IA */

@media (max-width: 899px) {
  :root {
    --bottom-nav-h: 56px;
    --mobile-chat-bar-h: 48px;
  }

  body {
    background: #f8f9fc;
    background-image: none;
  }

  .main {
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
  }

  .shell.assistant-active .main,
  .shell.assistant-active {
    padding-bottom: 0;
    height: 100dvh;
    max-height: 100dvh;
  }

  /* Header compacto — escondido no chat */
  .mobile-header {
    min-height: calc(44px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 0.5rem 0;
    background: rgba(248, 249, 252, 0.96);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  }

  .shell.assistant-active .mobile-header,
  .main.assistant-mode .mobile-header,
  .main.studio-mode .mobile-header {
    display: none !important;
  }

  .mobile-header-title {
    font-size: 0.875rem;
    font-weight: 650;
  }

  .content {
    padding: 0.65rem 0.85rem 0.85rem;
  }

  /* Bottom nav — 3 itens, IA no centro */
  .bottom-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 0;
    padding: 0.35rem 0.75rem calc(0.35rem + var(--safe-bottom));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(15, 23, 42, 0.07);
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.06);
  }

  .bottom-nav-btn {
    min-height: auto;
    padding: 0.35rem 0.5rem 0.2rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--muted);
    gap: 0.2rem;
  }

  .bottom-nav-btn span {
    letter-spacing: 0.01em;
  }

  .bottom-nav-btn [data-lucide] {
    width: 20px;
    height: 20px;
  }

  .bottom-nav-btn.active {
    color: var(--primary);
  }

  .bottom-nav-btn.active::before {
    display: none;
  }

  .bottom-nav-btn--center {
    position: relative;
    top: -10px;
    justify-self: center;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    padding: 0;
    background: var(--gradient-brand);
    color: #fff !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.38);
    border: 3px solid #fff;
  }

  .bottom-nav-btn--center span {
    display: none;
  }

  .bottom-nav-btn--center [data-lucide] {
    width: 22px;
    height: 22px;
    opacity: 1;
  }

  .bottom-nav-btn--center.active {
    transform: scale(1.04);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45);
  }

  /* Dashboard mobile — limpo */
  .dash-hero {
    display: none;
  }

  .mobile-dash {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
  }

  .mobile-dash-greet {
    padding: 0.15rem 0.1rem 0;
  }

  .mobile-dash-greet h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 750;
    letter-spacing: -0.03em;
  }

  .mobile-dash-greet p {
    margin: 0.2rem 0 0;
    font-size: 0.8125rem;
    color: var(--muted);
  }

  .mobile-dash-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  .mobile-stat {
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
  }

  .mobile-stat-label {
    font-size: 0.68rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
  }

  .mobile-stat-value {
    margin-top: 0.25rem;
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.02em;
  }

  .mobile-dash-chat-cta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #0f0f18 0%, #1e1b3a 100%);
    color: #fff;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 12px 32px rgba(15, 15, 24, 0.2);
  }

  .mobile-dash-chat-cta-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
  }

  .mobile-dash-chat-cta strong {
    display: block;
    font-size: 0.9375rem;
    font-weight: 700;
  }

  .mobile-dash-chat-cta span {
    display: block;
    font-size: 0.75rem;
    opacity: 0.72;
    margin-top: 0.12rem;
  }

  .mobile-dash-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .mobile-dash-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.75rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    color: var(--text);
  }

  .mobile-dash-link [data-lucide] {
    width: 18px;
    height: 18px;
    color: var(--primary);
  }

  .mobile-dash-link strong {
    font-size: 0.8125rem;
    font-weight: 650;
  }

  .mobile-dash-link small {
    font-size: 0.72rem;
    color: var(--muted);
  }

  .kpi-grid,
  .quick-actions--compact {
    display: none !important;
  }

  .mobile-only.card {
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: none;
  }

  .card-head h3 {
    font-size: 0.875rem;
  }

  /* Mais — grid simples */
  .menu-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .menu-tile {
    padding: 0.85rem 0.75rem;
    border-radius: 14px;
    min-height: 88px;
  }

  .menu-tile strong {
    font-size: 0.8125rem;
  }

  /* Chat mobile — tela cheia minimal */
  .mobile-chat-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    min-height: calc(var(--mobile-chat-bar-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 0.5rem 0;
    background: rgba(248, 249, 252, 0.96);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  }

  .mobile-chat-bar-title {
    flex: 1;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 650;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-chat-bar-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
  }

  .mobile-chat-bar-btn [data-lucide] {
    width: 20px;
    height: 20px;
  }

  .content.assistant-fullpage {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .content.assistant-fullpage > .mobile-chat-bar {
    flex-shrink: 0;
  }

  .content.assistant-fullpage > .assistant-page {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    background: #f8f9fc;
  }

  .assistant-main {
    min-height: 0;
  }

  .studio-canvas-bar {
    padding: 0.45rem 0.65rem;
  }

  .studio-canvas-sub {
    display: none;
  }

  .studio-canvas-title {
    font-size: 0.8125rem;
  }

  .studio-pill-btn span {
    display: none;
  }

  .studio-canvas-actions .studio-icon-btn {
    width: 36px;
    height: 36px;
  }

  .assistant-main {
    min-height: 0;
  }

  .assistant-messages {
    padding: 0.65rem 0.75rem 0.5rem;
  }

  .assistant-welcome {
    padding: 1.25rem 0.25rem 0.75rem;
  }

  .assistant-welcome h2 {
    font-size: 1.125rem;
  }

  .assistant-welcome > p {
    font-size: 0.8125rem;
  }

  .assistant-welcome-orb {
    width: 120px;
    height: 120px;
  }

  .assistant-composer-wrap {
    padding: 0 0.65rem calc(0.65rem + var(--safe-bottom));
    background: linear-gradient(to top, #f8f9fc 70%, transparent);
  }

  .assistant-composer-inner {
    border-radius: 20px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    overflow: hidden;
  }

  .assistant-mobile-toolbar {
    display: flex;
    gap: 0.35rem;
    padding: 0.45rem 0.55rem 0;
    border-bottom: none;
  }

  .assistant-toolbar-btn {
    font-size: 0.72rem !important;
    padding: 0.35rem 0.55rem !important;
    border-radius: 999px !important;
    background: var(--surface-2) !important;
  }

  .assistant-composer {
    border: none;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
  }

  .assistant-composer textarea {
    font-size: 1rem;
    min-height: 44px;
    max-height: 120px;
    padding: 0.65rem 0.75rem 0.35rem;
  }

  .assistant-hint {
    display: none;
  }

  .assistant-quick {
    padding: 0 0.55rem 0.35rem;
    gap: 0.35rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .assistant-quick::-webkit-scrollbar {
    display: none;
  }

  .assistant-quick-chip {
    flex-shrink: 0;
    font-size: 0.72rem;
    padding: 0.4rem 0.65rem;
    white-space: nowrap;
  }

  .assistant-send {
    width: 40px;
    height: 40px;
  }

  .assistant-mic,
  .assistant-lock {
    width: 36px;
    height: 36px;
  }

  .assistant-bubble-user {
    max-width: 88%;
    font-size: 0.9375rem;
    border-radius: 18px 18px 4px 18px;
  }

  .assistant-bubble-assistant {
    font-size: 0.9375rem;
    line-height: 1.55;
  }

  .assistant-turn-assistant .assistant-avatar {
    width: 28px;
    height: 28px;
  }

  /* Estúdio mobile — chat embaixo, mais limpo */
  .studio-chat {
    border-radius: 20px 20px 0 0 !important;
    height: min(48vh, 480px) !important;
    max-height: min(48vh, 480px) !important;
  }

  .assistant-page--design[data-chat-expanded="1"] .studio-chat {
    height: min(62vh, 580px) !important;
    max-height: min(62vh, 580px) !important;
  }

  .fab {
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 0.65rem);
  }

  .shell.assistant-active .fab {
    bottom: calc(var(--safe-bottom) + 0.85rem);
  }

  .list-card {
    padding: 0.75rem;
    border-radius: 14px;
  }

  .page-actions .btn {
    width: 100%;
  }

  .auth-wrap {
    padding: 1rem;
  }

  .auth-card {
    border-radius: 18px;
    padding: 1.15rem;
  }
}

@media (min-width: 900px) {
  .mobile-dash,
  .mobile-chat-bar {
    display: none !important;
  }
}
