/* ============================================================
   aminAi Studio — confort mobile
   Chargée après app.css, grok.css, studio-grok.css et i18n.css.
   Objectif : agrandir légèrement l'ensemble et aérer les actions.
   ============================================================ */

@media (max-width: 960px) {
  :root {
    --tab-h: 64px;
    --top-h: 58px;
  }

  /* ---------- barre haute ---------- */
  .top,
  #workspace-top.top {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    height: calc(var(--top-h) + var(--safe-t));
    padding: var(--safe-t) 10px 0;
    gap: 6px;
  }
  .top h1 { font-size: 17px; }
  #side-toggle,
  .top-new {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  #side-toggle svg,
  .top-new svg { width: 22px; height: 22px; }

  /* ---------- barre d'onglets ---------- */
  .tabbar {
    height: calc(var(--tab-h) + var(--safe-b));
    padding: 5px 8px var(--safe-b);
  }
  .tabbar button {
    gap: 3px;
    padding: 5px 2px;
    border-radius: 14px;
    font-size: 11px;
  }
  .tabbar button svg { width: 24px; height: 24px; }
  .tabbar button span { font-size: 11px; }

  /* ---------- menu latéral ---------- */
  .side {
    width: min(340px, 91vw);
    padding: 12px 12px calc(10px + var(--safe-b));
  }
  .side .side-nav > button,
  .side .side-nav > a.side-link,
  #rail-admin2 button {
    padding: 11px 13px;
    gap: 11px;
    border-radius: 14px;
    font-size: 15.5px;
  }
  .side .side-nav > button svg,
  .side .side-nav > a.side-link svg {
    width: 20px;
    height: 20px;
  }
  .side-search { height: 42px; }
  .side-search input { font-size: 15px; }
  .side .side-label,
  .side .side-section-head { font-size: 12.5px; }
  .side-foot .user-chip { min-height: 52px; }
  .user-pop {
    padding: 10px;
    gap: 5px;
    border-radius: 18px;
  }
  .user-pop button {
    height: 44px;
    border-radius: 12px;
    font-size: 14.5px;
  }
  .user-pop .lang-row button {
    height: 32px;
    font-size: 11.5px;
  }
  .user-pop .theme-row button {
    height: 38px;
    font-size: 13px;
  }
  .user-pop #logout-btn { margin-top: 5px; }
  .legal { font-size: 11.5px; }

  /* ---------- chat ---------- */
  #chat-view.home {
    gap: 16px;
    padding: 16px 0 18px;
  }
  #chat-view .chat-hero h2 {
    font-size: clamp(30px, 8.4vw, 37px);
    line-height: 1.05;
    padding: 0 16px;
  }
  #chat-view .messages {
    padding: 14px 14px 10px;
    gap: 24px;
  }
  #chat-view .msg .md {
    font-size: 16.5px;
    line-height: 1.68;
  }
  #chat-view .msg.user {
    max-width: 90%;
    padding: 11px 17px;
    border-radius: 24px;
  }
  #chat-view .chat-disclaimer {
    font-size: 11.5px;
    padding: 0 14px 6px;
  }
  .chat-suggest {
    width: calc(100% - 20px);
    gap: 8px;
  }
  .chat-suggest button {
    padding: 10px 15px;
    font-size: 14px;
  }

  #chat-view.home #composer.dock,
  #chat-view:not(.home) #composer.dock,
  #chat-view #composer.dock {
    width: calc(100% - 12px);
    max-width: calc(100% - 12px);
    margin: 0 auto 10px;
    padding: 12px 10px 10px;
    border-radius: 26px;
  }
  #composer textarea,
  #composer.dock textarea {
    max-height: 140px;
    padding: 8px 10px;
    font-size: 16.5px;
    line-height: 1.45;
  }
  #composer .chat-bar {
    gap: 4px;
    padding: 0 2px;
  }
  #composer .chat-bar .icon-btn,
  #composer .chat-bar .plus-btn,
  #composer #stop-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  #composer #send-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 50%;
  }
  #composer .chat-bar .icon-btn svg,
  #composer .chat-bar .plus-btn svg {
    width: 21px;
    height: 21px;
  }
  #composer #send-btn svg { width: 20px; height: 20px; }
  #composer .chat-mode {
    height: 40px;
    padding: 0 11px;
    border-radius: 12px;
    font-size: 13.5px;
  }
  #composer .mode-wrap { margin-left: 0; }
  #composer #send-btn,
  #composer #stop-btn {
    margin-left: auto;
    position: sticky;
    right: 0;
    z-index: 2;
  }

  /* ---------- voix ---------- */
  #voice-view .voice-stage {
    padding: calc(10px + var(--safe-t)) 8px calc(12px + var(--safe-b));
  }
  #voice-view .voice-top { min-height: 48px; }
  #voice-view .voice-top .back-btn {
    width: 44px;
    height: 44px;
  }
  #voice-view .voice-top .back-btn svg { width: 22px; height: 22px; }
  #voice-view .voice-title { font-size: 12px; }
  #voice-view .voice-hero { gap: 12px; }
  #voice-view .orb { --orb-size: clamp(198px, 52vmin, 288px); }
  #voice-view #voice-status {
    max-width: min(38ch, 92vw);
    font-size: 13.5px;
    line-height: 1.4;
  }
  #voice-view .voice-activation button {
    height: 48px;
    padding: 0 26px;
    font-size: 14.5px;
  }
  #voice-view #voice-type.voice-composer {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 2px;
    padding: 10px 10px 8px;
    border-radius: 26px;
  }
  #voice-view #voice-type.voice-composer textarea {
    max-height: 108px;
    padding: 8px 10px 6px;
    font-size: 16.5px;
  }
  #voice-view #voice-type.voice-composer .voice-type-bar {
    min-height: 40px;
    gap: 4px;
  }
  #voice-view #voice-type.voice-composer .plus-btn,
  #voice-view #voice-type.voice-composer .voice-round,
  #voice-view #voice-type .voice-settings-toggle {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }
  #voice-view #voice-type.voice-composer .voice-round svg,
  #voice-view #voice-type .voice-settings-toggle svg {
    width: 21px;
    height: 21px;
  }
  #voice-view #voice-type #mic-mute-btn,
  #voice-view #voice-type.voice-composer #mic-mute-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
  }
  #voice-view #voice-type #mic-mute-btn svg {
    width: 21px;
    height: 21px;
  }
  #voice-view #voice-type.voice-composer #voice-send {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }
  #voice-view #voice-type.voice-composer #voice-send svg {
    width: 20px;
    height: 20px;
  }
  #voice-view .voice-settings-menu {
    width: min(380px, calc(100vw - 24px));
    padding: 15px;
  }
  #voice-view .voice-settings-menu button { min-height: 42px; font-size: 14px; }
  #voice-view .voice-settings-menu label { font-size: 13.5px; }

  /* ---------- abonnement ---------- */
  #plans-view .plans-wrap { width: calc(100% - 20px); }
  #plans-view .plans-hero {
    margin-top: 30px;
    gap: 12px;
  }
  #plans-view .plans-hero h2 { font-size: clamp(38px, 10.4vw, 48px); }
  #plans-view .plans-lede { font-size: 15px; }
  #plans-view .plans-kicker { font-size: 11px; }
  #plans-view .plans-head { min-height: 46px; }
  #plans-view #plans-back {
    width: 44px;
    height: 44px;
  }
  #plans-view #plans-back svg { width: 22px; height: 22px; }
  #plans-view .plans-brand { font-size: 16px; }
  #plans-view .plans-head-spacer { width: 44px; height: 44px; }
  #plans-view .plan-grid {
    gap: 14px;
    margin-top: 28px;
  }
  #plans-view .plan-card {
    padding: 24px 22px 22px;
    border-radius: 24px;
  }
  #plans-view .plan-card h3 { font-size: 21px; }
  #plans-view .plan-card .blurb {
    min-height: 0;
    font-size: 14px;
  }
  #plans-view .plan-card .price { font-size: 44px; }
  #plans-view .plan-card .plan-credits { font-size: 13px; }
  #plans-view .plan-card .choose {
    min-height: 48px;
    margin-bottom: 24px;
    font-size: 14.5px;
  }
  #plans-view .plan-card li { font-size: 13.5px; }
  #plans-view .plans-trust {
    gap: 12px 18px;
    font-size: 12px;
  }
  #plans-view .plans-fine { font-size: 11.5px; }

  /* ---------- connexion / inscription ---------- */
  #login-view.gate,
  #age-view.gate { padding: 20px 12px; }
  #login-view .gate-card,
  #age-view .gate-card {
    width: 100%;
    max-width: 400px;
  }
  #login-view .mark,
  #age-view .mark { font-size: 38px; }
  .gate-tabs button {
    height: 44px;
    font-size: 14px;
  }
  .gate-form .lede { font-size: 14px; }
  .gate-form input {
    height: 48px;
    font-size: 16px;
  }
  .gate-form button[type="submit"] {
    height: 50px;
    font-size: 15.5px;
  }
  .gate-lang button {
    width: 34px;
    height: 30px;
    font-size: 10.5px;
  }

  /* ---------- installation PWA ---------- */
  .pwa-install {
    width: calc(100% - 16px);
    padding: 12px;
    gap: 11px;
  }
  .pwa-install img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }
  .pwa-install-copy strong { font-size: 14px; }
  .pwa-install-copy span { font-size: 12px; }
  .pwa-install-go {
    height: 38px;
    padding: 0 15px;
    font-size: 13px;
  }
  .pwa-install-close {
    width: 34px;
    height: 34px;
    font-size: 22px;
  }

  /* ---------- formulaire de groupe ---------- */
  dialog .inline button,
  dialog button[type="submit"] {
    min-height: 44px;
    font-size: 14px;
  }
}

/* Très petits téléphones : on garde les actions essentielles,
   et les actions secondaires restent accessibles depuis le menu
   et les vues dédiées. */
@media (max-width: 380px) {
  #composer #chat-plus,
  #composer #agent-toggle {
    display: none;
  }
  #composer .chat-bar { gap: 5px; }
}

/* Téléphone en paysage : on protège la hauteur du composer. */
@media (max-height: 620px) and (orientation: landscape) {
  #voice-view .orb { --orb-size: clamp(136px, 42vmin, 188px); }
  #voice-view .voice-hero { gap: 6px; }
  #voice-view #voice-type.voice-composer textarea { max-height: 54px; }
  #chat-view.home .chat-hero h2 { font-size: 30px; }
}

/* Connecteurs : lisibilité et boutons tactiles. */
@media (max-width: 960px) {
  .cx-row {
    padding: 14px;
    border-radius: 16px;
  }
  .cx-row strong { font-size: 15.5px; }
  .cx-row small { font-size: 12.5px; }
  .cx-row .mod-switch {
    min-height: 40px;
    padding: 0 12px;
    font-size: 13px;
  }
  .cx-search input {
    height: 42px;
    font-size: 15px;
  }
  .mod-filters button {
    min-height: 38px;
    font-size: 13.5px;
  }
  .link-sheet {
    padding: 14px;
    gap: 10px;
  }
  .link-sheet input {
    min-height: 44px;
    font-size: 16px;
  }
  .link-sheet .mod-actions button {
    min-height: 42px;
    font-size: 14px;
  }
  .link-sheet .mod-uri { font-size: 11.5px; }
}
