    /* ============================================================
       FlexNeur — design tokens
       Source of truth visual: "Identidade Futurista da FLEXNEUR".
       Dark-first, teal accent, subtle surfaces, thin borders.
       ============================================================ */
    :root {
      /* —— Semantic color tokens (reference palette) —— */
      --color-bg: #0B1112;                 /* PRIMARY BACKGROUND */
      --color-surface: #1C2526;            /* PRIMARY SURFACE */
      --color-surface-raised: #212B2C;     /* raised cards / composer */
      --color-surface-hover: #26302F;
      --color-surface-translucent: rgba(255, 255, 255, 0.03); /* hairline surface on bg */
      --color-surface-user: #182232;       /* user message bubble */
      --color-surface-sidebar: #080D0E;    /* sidebar base (a step below bg) */
      --color-overlay: #1A2324;            /* popovers/dropdowns (L3) */

      --color-text: #E6F7F3;               /* PRIMARY TEXT */
      --color-text-secondary: #A7BAB5;
      --color-text-muted: #7E938E;
      --color-text-faint: #5C6E6A;

      --color-accent: #22D3EE;             /* PRIMARY */
      --color-accent-hover: #38BDF8;
      --color-accent-deep: #8B5CF6;        /* SECONDARY (brand gradient end) */
      --color-accent-soft: rgba(34, 211, 238, 0.10);
      --color-accent-softer: rgba(34, 211, 238, 0.05);
      --color-accent-line: rgba(34, 211, 238, 0.4);

      --color-success: #34D399;
      --color-danger: #F87171;
      --color-danger-soft: rgba(239, 68, 68, 0.12);
      --color-warning: #FBBF24;

      --color-border: rgba(230, 247, 243, 0.09);
      --color-border-strong: rgba(230, 247, 243, 0.17);
      --color-focus: var(--color-accent);
      --color-on-accent: #06231B;          /* text/icons over teal fills */

      /* —— Spacing scale (4·8·12·16·20·24·32·40·48) —— */
      --space-1: 4px;
      --space-2: 8px;
      --space-3: 12px;
      --space-4: 16px;
      --space-5: 20px;
      --space-6: 24px;
      --space-8: 32px;
      --space-10: 40px;
      --space-12: 48px;

      /* —— Border radius system —— */
      --radius-small: 8px;
      --radius-medium: 12px;
      --radius-large: 16px;
      --radius-pill: 999px;

      /* —— Elevation (subtle; L0 bg → L3 popover) —— */
      --elevation-1: 0 1px 2px rgba(0, 0, 0, 0.18);
      --elevation-2: 0 6px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.03);
      --elevation-3: 0 12px 32px rgba(0, 0, 0, 0.32);

      /* —— Brand gradient (logo/symbol/highlights only) —— */
      --gradient-brand: linear-gradient(135deg, #22D3EE 0%, #8B5CF6 100%);
      --gradient-brand-orb: radial-gradient(circle at 34% 30%, #67E8F9, #22D3EE 48%, #8B5CF6);
      --gradient-brand-glow: rgba(34, 211, 238, 0.16);

      /* —— Typography —— */
      --font-sans: "Inter", -apple-system, "Segoe UI", sans-serif;
      --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

      /* —— Layout —— */
      --sidebar-w: 300px;
      --sidebar-collapsed-w: 60px;
      /* Largura da coluna de conteúdo (cards e mensagens). */
      --max-w: 42rem;
      /* O composer é o ponto principal de interação: um pouco mais largo e alto. */
      --composer-w: 46rem;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }

    html, body {
      height: 100%;
      font-family: var(--font-sans);
      background: var(--color-bg);
      color: var(--color-text);
      -webkit-font-smoothing: antialiased;
    }

    button, input, textarea, select { -webkit-tap-highlight-color: transparent; }

    button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
      outline: 2px solid var(--color-focus);
      outline-offset: 2px;
    }

    .layout {
      display: flex;
      height: 100dvh;
      overflow: hidden;
    }

    /* —— Sidebar —— */
    .sidebar {
      width: var(--sidebar-w);
      flex-shrink: 0;
      background: var(--color-surface-sidebar);
      border-right: 1px solid var(--color-border);
      display: flex;
      flex-direction: column;
      transition: width 0.25s ease;
      position: relative;
    }

    .layout.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); }

    .sidebar-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-2);
      padding: var(--space-4) var(--space-4) var(--space-3);
      flex-shrink: 0;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      min-width: 0;
    }

    .brand-mark {
      display: grid;
      place-items: center;
      flex-shrink: 0;
    }

    .brand-mark img { display: block; }

    .brand-text {
      display: flex;
      flex-direction: column;
      gap: var(--space-1);
      min-width: 0;
    }

    .brand-name {
      font-size: 1.0625rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      line-height: 1.1;
      color: var(--color-text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .brand-status {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 0.6875rem;
      font-weight: 500;
      line-height: 1.2;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--color-text-muted);
    }

    .brand-status-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--color-accent);
      box-shadow: 0 0 8px var(--gradient-brand-glow);
    }

    .btn-sidebar-toggle {
      position: relative;
      width: 24px;
      height: 24px;
      display: grid;
      place-items: center;
      border: 1px solid var(--color-border-strong);
      border-radius: var(--radius-small);
      background: var(--color-surface-translucent);
      color: var(--color-text-secondary);
      cursor: pointer;
      flex-shrink: 0;
      transition: background 0.15s, color 0.15s, border-color 0.15s;
    }

    .btn-sidebar-toggle:hover {
      color: var(--color-text);
      border-color: var(--color-accent-line);
      background: var(--color-accent-soft);
    }

    .layout.sidebar-collapsed .btn-sidebar-toggle svg { transform: rotate(180deg); }

    .btn-sidebar-toggle::after {
      content: attr(data-tip);
      position: absolute;
      top: calc(100% + var(--space-2));
      left: 50%;
      transform: translateX(-50%);
      padding: var(--space-1) 10px;
      background: var(--color-overlay);
      border: 1px solid var(--color-border-strong);
      border-radius: var(--radius-small);
      font-size: 0.75rem;
      font-weight: 500;
      color: var(--color-text);
      white-space: nowrap;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.15s, visibility 0.15s;
      z-index: 200;
      pointer-events: none;
      box-shadow: var(--elevation-2);
    }

    .btn-sidebar-toggle:hover::after {
      opacity: 1;
      visibility: visible;
    }

    .sidebar-top {
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding: var(--space-1) var(--space-4) var(--space-4);
      border-bottom: 1px solid var(--color-border);
      flex-shrink: 0;
    }

    .sidebar-new-row {
      display: flex;
      gap: var(--space-2);
      align-items: stretch;
    }

    .btn-new {
      flex: 1;
      min-width: 0;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: var(--space-3);
      min-height: 32px;
      padding: 0 var(--space-4);
      border: 1px solid var(--color-accent-line);
      border-radius: var(--radius-medium);
      background: linear-gradient(180deg, rgba(34, 211, 238, 0.13), rgba(34, 211, 238, 0.06));
      color: var(--color-text);
      font-family: inherit;
      font-size: 0.9375rem;
      font-weight: 600;
      letter-spacing: -0.01em;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s;
    }

    .btn-new:hover {
      background: rgba(34, 211, 238, 0.16);
      border-color: rgba(34, 211, 238, 0.55);
    }

    .btn-new-icon { display: grid; place-items: center; flex-shrink: 0; color: var(--color-text); }
    .btn-new-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    .btn-temp {
      position: absolute;
      z-index: 4;
      top: var(--space-4);
      right: var(--space-5);
      width: 28px;
      height: 28px;
      padding: 0;
      display: grid;
      place-items: center;
      border: 1px solid var(--color-border-strong);
      border-radius: var(--radius-medium);
      background: var(--color-surface-translucent);
      color: var(--color-text-secondary);
      cursor: pointer;
      transition: color 0.15s, border-color 0.15s, background 0.15s;
    }

    .btn-temp:hover {
      color: var(--color-text);
      border-color: var(--color-accent-line);
      background: var(--color-accent-soft);
    }

    .btn-temp.active {
      color: var(--color-accent);
      border-color: var(--color-accent-line);
      background: var(--color-accent-soft);
    }

    .btn-temp svg { width: 14px; height: 14px; }

    .sidebar-item {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: var(--space-3);
      min-height: 34px;
      padding: 0 var(--space-4);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-medium);
      background: var(--color-surface-translucent);
      color: var(--color-text);
      font-family: inherit;
      font-size: 0.9375rem;
      font-weight: 600;
      letter-spacing: -0.01em;
      text-align: left;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s, color 0.15s;
    }

    .sidebar-item:hover {
      border-color: var(--color-accent-line);
      background: var(--color-accent-soft);
    }

    .sidebar-item-icon { display: grid; place-items: center; flex-shrink: 0; color: var(--color-accent); }
    .sidebar-item-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* The account panel switches between the guest and signed-in blocks with the
       `hidden` attribute. Without this, `.sidebar-item { display: flex }` would
       win over the user-agent `[hidden]` rule and "Sign in with Google" would stay
       visible after sign-in. */
    .auth-panel [hidden] { display: none !important; }

    .sidebar-search {
      position: relative;
      display: flex;
      align-items: center;
    }

    .sidebar-search-icon {
      position: absolute;
      left: var(--space-3);
      display: grid;
      place-items: center;
      color: var(--color-text-faint);
      pointer-events: none;
    }

    #search-input {
      width: 100%;
      min-height: 44px;
      padding: 0 var(--space-3) 0 var(--space-10);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-medium);
      background: var(--color-surface-translucent);
      color: var(--color-text);
      font-family: inherit;
      font-size: 0.875rem;
      outline: none;
      transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    }

    #search-input::placeholder { color: var(--color-text-faint); }

    #search-input:focus {
      border-color: var(--color-accent-line);
      background: var(--color-accent-softer);
      box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
    }

    .sidebar-label {
      font-size: 0.6875rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--color-text-muted);
      padding: var(--space-4) var(--space-4) var(--space-2);
    }

    .conv-list {
      flex: 1;
      overflow-y: auto;
      padding: 0 var(--space-3) var(--space-4);
    }

    .conv-list::-webkit-scrollbar { width: 4px; }
    .conv-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

    .conv-item {
      display: flex;
      align-items: center;
      gap: 10px;
      min-height: 44px;
      padding: var(--space-2);
      padding-left: var(--space-3);
      border: 1px solid transparent;
      border-radius: var(--radius-small);
      cursor: pointer;
      transition: background 0.12s, border-color 0.12s;
    }

    .conv-item:hover { background: var(--color-surface-hover); border-color: var(--color-border); }
    .conv-item.active { background: var(--color-accent-soft); border-color: rgba(34, 211, 238, 0.22); }

    .conv-body {
      flex: 1;
      min-width: 0;
    }

    .conv-title {
      font-size: 0.875rem;
      font-weight: 500;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      color: var(--color-text);
    }

    .conv-item.active .conv-title { color: var(--color-text); }

    .conv-preview {
      font-size: 0.72rem;
      /* #a3b5ad: contraste >= 4.5:1 sobre o fundo escuro da sidebar (WCAG AA). */
      color: #a3b5ad;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-top: 2px;
    }

    .sidebar-empty {
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
      padding: var(--space-12) var(--space-6) var(--space-4);
    }

    .sidebar-empty-icon { color: var(--color-text-faint); margin-bottom: var(--space-3); opacity: 0.9; }
    .sidebar-empty-title { font-size: 0.9rem; font-weight: 500; color: var(--color-text-secondary); }
    .sidebar-empty-text {
      margin-top: var(--space-1);
      max-width: 13rem;
      font-size: 0.8125rem;
      line-height: 1.45;
      color: var(--color-text-faint);
    }

    .sidebar-brand {
      display: flex;
      flex-direction: column;
      gap: 2px;
      padding: var(--space-4) var(--space-4) var(--space-5);
      border-top: 1px solid var(--color-border);
      flex-shrink: 0;
    }

    .sidebar-brand-name {
      font-size: 0.95rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      color: var(--color-text);
    }

    .sidebar-brand-tagline {
      font-size: 0.8rem;
      color: var(--color-text-faint);
    }

    /* —— Sidebar recolhida —— */
    .layout.sidebar-collapsed .sidebar-header {
      flex-direction: column-reverse;
      align-items: center;
      gap: var(--space-3);
      padding: var(--space-3) var(--space-2) var(--space-2);
    }

    .layout.sidebar-collapsed .brand-text,
    .layout.sidebar-collapsed .sidebar-label,
    .layout.sidebar-collapsed .conv-list,
    .layout.sidebar-collapsed .sidebar-brand,
    .layout.sidebar-collapsed .sidebar-search,
    .layout.sidebar-collapsed .btn-new-text,
    .layout.sidebar-collapsed .sidebar-item-text { display: none; }

    .layout.sidebar-collapsed .sidebar-top {
      align-items: center;
      padding: var(--space-2) var(--space-2) var(--space-3);
      border-bottom-color: transparent;
    }

    .layout.sidebar-collapsed .sidebar-new-row { flex-direction: column; gap: var(--space-2); }
    .layout.sidebar-collapsed .btn-new,
    .layout.sidebar-collapsed .btn-temp,
    .layout.sidebar-collapsed .sidebar-item {
      width: 32px;
      min-height: 32px;
      height: 32px;
      flex: 0 0 auto;
      padding: 0;
      justify-content: center;
      border-radius: 11px;
    }

    /* —— Main —— */
    .main {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      position: relative;
      background: radial-gradient(120% 55% at 50% -8%, rgba(34, 211, 238, 0.07), transparent 62%), var(--color-bg);
    }

    .chat {
      flex: 1;
      overflow-y: auto;
      scroll-behavior: smooth;
      display: flex;
      flex-direction: column;
    }

    .chat-inner {
      width: 100%;
      max-width: calc(var(--max-w) + var(--space-12));
      margin: 0 auto;
      padding: var(--space-6) var(--space-6) var(--space-5);
    }

    /* Sem conversa aberta, o bloco welcome + cards fica centralizado no espaço
       disponível, com um respiro maior em cima para ficar mais perto do
       composer (as margens automáticas somem quando o conteúdo é maior). */
    .chat-inner:has(#welcome) { margin: auto; padding: clamp(var(--space-8), 7vh, var(--space-12)) var(--space-6) var(--space-5); }

    .ai-presence {
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
      padding: var(--space-2) 0 0;
    }

    .ai-core {
      width: 60px;
      height: 60px;
      border-radius: 50%;
      background: var(--gradient-brand-orb);
      box-shadow: 0 0 44px var(--gradient-brand-glow), inset 0 0 0 1px rgba(34, 211, 238, 0.18);
      margin-bottom: var(--space-5);
      animation: pulse 3s ease-in-out infinite;
    }

    .ai-core.temporary {
      box-shadow: 0 0 48px var(--gradient-brand-glow), 0 0 0 3px var(--color-accent-soft);
    }

    @keyframes pulse {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.04); }
    }

    .ai-presence h1 {
      font-size: clamp(1.55rem, 3.1vw, 1.95rem);
      font-weight: 700;
      letter-spacing: -0.032em;
      line-height: 1.12;
      margin-bottom: var(--space-2);
    }

    .ai-name-accent { color: var(--color-accent); }

    .ai-presence p {
      color: var(--color-text-secondary);
      font-size: 0.9375rem;
      max-width: 26rem;
      line-height: 1.55;
    }

    .temporary-status {
      display: inline-flex;
      align-items: baseline;
      gap: var(--space-2);
      max-width: 100%;
      margin-top: var(--space-1);
      padding: var(--space-2) var(--space-3);
      border: 1px solid var(--color-accent-line);
      border-radius: var(--radius-medium);
      background: var(--color-accent-soft);
      color: var(--color-text-secondary);
      font-size: 0.8125rem;
      line-height: 1.35;
      text-align: left;
    }

    .temporary-status strong {
      color: var(--color-text);
      font-weight: 600;
      white-space: nowrap;
    }

    .prompts {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: var(--space-3);
      margin-top: var(--space-8);
      width: 100%;
    }

    /* Só os 3 cards já existentes: ícone no topo, texto na base da mesma grade. */
    .prompt {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--space-4);
      min-height: 90px;
      padding: var(--space-5);
      text-align: left;
      border: 1px solid var(--color-border);
      border-radius: var(--radius-large);
      background: var(--color-surface-translucent);
      color: var(--color-text-secondary);
      font-family: inherit;
      font-size: 0.90625rem;
      font-weight: 500;
      line-height: 1.45;
      letter-spacing: -0.005em;
      cursor: pointer;
      transition: transform 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
    }

    .prompt-icon { display: grid; place-items: center; flex-shrink: 0; color: var(--color-accent); }
    .prompt-icon svg { width: 24px; height: 24px; }
    .prompt-text { display: block; }

    .prompt:hover {
      transform: translateY(-2px);
      border-color: var(--color-accent-line);
      background: var(--color-accent-soft);
      color: var(--color-text);
    }

    .prompt:active { transform: translateY(0); }

    .exchange { padding: var(--space-4) 0; animation: appear 0.3s ease; }
    @keyframes appear {
      from { opacity: 0; transform: translateY(8px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .exchange.user { display: flex; justify-content: flex-end; }
    .exchange.user .user-block {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: var(--space-1);
      min-width: 0;
      max-width: 85%;
    }
    .exchange.user .content {
      background: var(--color-surface-user);
      border: 1px solid var(--color-border);
      padding: var(--space-3) var(--space-4);
      border-radius: var(--radius-large);
      max-width: 100%;
      font-size: 0.9375rem;
      line-height: 1.55;
      white-space: pre-wrap;
      word-break: break-word;
    }

    /* —— Ações das mensagens do usuário (Edit / Copy) ——
       Mesma linguagem dos demais controles discretos: texto pequeno, quase
       invisível até o hover, sem virar botão grande. */
    /* Linha discreta abaixo da mensagem: horário de envio + ações. */
    .msg-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: flex-end;
      gap: var(--space-2);
      min-height: 20px;
      min-width: 0;
    }
    .msg-time {
      font-size: 0.7rem;
      color: var(--color-text-faint);
      white-space: nowrap;
    }
    .msg-time[hidden] { display: none; }

    .msg-actions {
      display: flex;
      align-items: center;
      gap: var(--space-1);
      min-height: 20px;
      opacity: 0;
      transition: opacity 0.12s;
    }
    .exchange.user:hover .msg-actions,
    .exchange.user:focus-within .msg-actions { opacity: 1; }
    @media (hover: none) { .msg-actions { opacity: 1; } }
    .msg-actions[hidden] { display: none; }

    .msg-action {
      padding: 3px 8px;
      border: none;
      border-radius: var(--radius-small);
      background: transparent;
      color: var(--color-text-faint);
      font-family: inherit;
      font-size: 0.75rem;
      cursor: pointer;
      transition: color 0.12s, background 0.12s;
    }
    .msg-action:hover { color: var(--color-accent); background: var(--color-accent-soft); }
    .msg-action-icon,
    .assistant-copy-btn {
      display: inline-flex;
      width: 32px;
      height: 32px;
      min-width: 32px;
      padding: 0;
      border: none;
      border-radius: var(--radius-small);
      background: transparent;
      color: var(--color-text-faint);
      cursor: pointer;
      align-items: center;
      justify-content: center;
      transition: color 0.12s, background 0.12s;
    }
    .assistant-copy-btn:hover { color: var(--color-accent); background: var(--color-accent-soft); }
    .assistant-copy-btn[hidden] { display: none; }
    .msg-action-icon svg,
    .assistant-copy-btn svg {
      display: block;
      width: 18px;
      height: 18px;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
    .msg-action-icon.copied,
    .assistant-copy-btn.copied {
      color: var(--color-success, #30D195);
    }
    .assistant-actions {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-top: 6px;
    }
    .assistant-actions .speak-btn {
      margin-top: 0;
    }
    .msg-action-icon:focus-visible {
      outline: 2px solid var(--color-accent);
      outline-offset: 2px;
    }
    .msg-action-spinner { animation: msg-action-spin 0.8s linear infinite; }
    @keyframes msg-action-spin { to { transform: rotate(360deg); } }
    .msg-action[hidden] { display: none; }
    .msg-action.primary { color: var(--color-accent); font-weight: 600; }
    .msg-action:disabled { opacity: 0.5; cursor: default; }

    .msg-action-status { font-size: 0.72rem; color: var(--color-success); }
    .msg-action-status.error { color: var(--color-danger); }

    .msg-edit {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: var(--space-2);
    }
    .msg-edit-input {
      width: 100%;
      min-height: 64px;
      max-height: 240px;
      padding: var(--space-3) var(--space-4);
      border: 1px solid var(--color-accent-line);
      border-radius: var(--radius-large);
      background: var(--color-surface-user);
      color: var(--color-text);
      font-family: inherit;
      font-size: 0.9375rem;
      line-height: 1.55;
      resize: vertical;
      outline: none;
      overflow-y: auto;
    }
    .msg-edit-input:focus { box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08); }
    .msg-edit-actions { display: flex; gap: var(--space-2); }
    .msg-edit-error { font-size: 0.72rem; color: var(--color-danger); }
    .msg-edit-error[hidden] { display: none; }

    .exchange.assistant .row { display: flex; gap: var(--space-4); align-items: flex-start; }
    .exchange.assistant .ai-body { flex: 1; min-width: 0; }
    .ai-dot {
      width: 28px; height: 28px; border-radius: 50%;
      background: var(--gradient-brand-orb);
      box-shadow: 0 0 16px var(--gradient-brand-glow);
      flex-shrink: 0; margin-top: 2px;
    }
    .ai-dot.thinking { animation: pulse 1.2s ease-in-out infinite; }
    .exchange.assistant .content {
      flex: 1; font-size: 0.9375rem; line-height: 1.65;
      white-space: pre-wrap; word-break: break-word; min-width: 0;
    }
    .chat-generated-image,
    .chat-image {
      display: block; max-width: min(100%, 40rem); width: auto; height: auto;
      max-height: 70vh; object-fit: contain; border-radius: var(--radius-large);
      border: 1px solid var(--color-border); background: transparent;
    }
    .chat-image-container { margin: var(--space-2) 0; }
    .chat-image-load-error,
    .speak-status {
      display: block;
      margin-top: var(--space-2);
      color: var(--color-text-faint);
      font-size: 0.75rem;
      line-height: 1.45;
    }
    .thinking-label {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      font-size: 0.8125rem;
      color: var(--color-text-faint);
      margin-bottom: var(--space-1);
    }
    .thinking-dots {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      height: 10px;
    }
    .thinking-dots i {
      width: 4px;
      height: 4px;
      border-radius: 50%;
      background: var(--color-accent);
      opacity: .35;
      animation: flexneur-dot-wave 1.05s ease-in-out infinite;
    }
    .thinking-dots i:nth-child(2) { animation-delay: .14s; }
    .thinking-dots i:nth-child(3) { animation-delay: .28s; }
    @keyframes flexneur-dot-wave {
      0%, 60%, 100% { transform: translateY(0); opacity: .35; }
      30% { transform: translateY(-3px); opacity: 1; }
    }

    .chat-image-generation-state {
      display: grid;
      justify-items: start;
      gap: 9px;
      width: min(100%, 330px);
      margin: 5px 0 12px;
      color: var(--color-text-secondary);
      animation: chat-image-state-in .24s ease both;
    }
    .chat-image-generation-preview {
      position: relative;
      width: min(100%, 280px);
      aspect-ratio: 16 / 9;
      overflow: hidden;
      border: 1px solid var(--color-border-strong);
      border-radius: var(--radius-large);
      background: linear-gradient(135deg, rgba(34, 211, 238,.08), rgba(34, 211, 238,.025) 45%, rgba(255,255,255,.035));
    }
    .chat-image-generation-preview::before {
      content: "";
      position: absolute;
      inset: 0;
      transform: translateX(-100%);
      background: linear-gradient(105deg, transparent 28%, rgba(34, 211, 238,.13) 48%, transparent 68%);
      animation: chat-image-shimmer 1.8s ease-in-out infinite;
    }
    .chat-image-generation-preview::after {
      content: "✦";
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      color: rgba(34, 211, 238,.8);
      font-size: 1.7rem;
      text-shadow: 0 0 24px rgba(34, 211, 238,.45);
      animation: chat-image-sparkle 2s ease-in-out infinite;
    }
    .chat-image-generation-title {
      color: var(--color-text);
      font-size: .84rem;
      font-weight: 650;
    }
    .chat-image-generation-caption {
      color: var(--color-text-faint);
      font-size: .76rem;
      line-height: 1.45;
    }
    .chat-image-generation-dots { display: inline-flex; gap: 4px; margin-left: 4px; }
    .chat-image-generation-dots i {
      width: 4px;
      height: 4px;
      border-radius: 50%;
      background: var(--color-accent);
      animation: flexneur-dot-wave 1.05s ease-in-out infinite;
    }
    .chat-image-generation-dots i:nth-child(2) { animation-delay: .14s; }
    .chat-image-generation-dots i:nth-child(3) { animation-delay: .28s; }
    .chat-generated-image {
      animation: chat-image-reveal .38s cubic-bezier(.2,.75,.25,1) both;
    }
    @keyframes chat-image-shimmer { to { transform: translateX(100%); } }
    @keyframes chat-image-sparkle {
      0%, 100% { opacity: .55; transform: scale(.94); }
      50% { opacity: 1; transform: scale(1.08); }
    }
    @keyframes chat-image-state-in {
      from { opacity: 0; transform: translateY(5px); }
      to { opacity: 1; transform: translateY(0); }
    }
    @keyframes chat-image-reveal {
      from { opacity: 0; transform: translateY(8px) scale(.985); filter: blur(5px); }
      to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
    }
    @media (prefers-reduced-motion: reduce) {
      .thinking-dots i,
      .chat-image-generation-preview::before,
      .chat-image-generation-preview::after,
      .chat-image-generation-dots i,
      .chat-image-generation-state,
      .chat-generated-image { animation: none !important; }
    }
    .cursor {
      display: inline-block; width: 2px; height: 1.1em;
      background: var(--color-accent); animation: blink 0.7s step-end infinite;
    }
    @keyframes blink { 50% { opacity: 0; } }
    .exchange.error .content { color: var(--color-danger); font-size: 0.875rem; text-align: center; width: 100%; }

    /* Modelo efetivamente usado pelo AUTO: texto pequeno e discreto, sem virar botão. */
    .model-used {
      margin-top: var(--space-2);
      font-size: 0.75rem;
      line-height: 1.4;
      color: var(--color-text-faint);
    }

    .speak-btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin-top: var(--space-2);
      padding: 3px 8px;
      border: none;
      border-radius: var(--radius-small);
      background: transparent;
      color: var(--color-text-faint);
      font-family: inherit;
      font-size: 0.75rem;
      cursor: pointer;
      transition: color 0.15s, background 0.15s;
    }
    .speak-btn:hover { color: var(--color-accent); background: var(--color-accent-soft); }
    .speak-btn.playing { color: var(--color-accent); }
    .speak-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.exchange.assistant .speak-btn {
  margin-top: 0;
  min-height: 30px;
}

    /* —— Composer —— */
    .input-area {
      flex-shrink: 0;
      padding: var(--space-3) var(--space-6) var(--space-5);
      background: linear-gradient(transparent, rgba(0, 0, 0, 0.97) 38%);
    }

    /* Ponto principal de interação da tela. */
    .input-box {
      width: 100%;
      max-width: min(var(--composer-w), 100%);
      margin: 0 auto;
      display: flex;
      align-items: center;
      gap: var(--space-2);
      min-height: 68px;
      padding: var(--space-2) var(--space-3);
      border: 1px solid var(--color-border-strong);
      border-radius: var(--radius-pill);
      background: var(--color-surface-raised);
      box-shadow: var(--elevation-2);
      transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    }

    .input-box:hover { border-color: rgba(230, 247, 243, 0.26); }

    .input-box:focus-within {
      border-color: rgba(34, 211, 238, 0.5);
      background: var(--color-surface-hover);
      box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.07), var(--elevation-2);
    }

    #btn-attach {
      width: 32px; height: 32px;
      flex: 0 0 auto;
      display: grid; place-items: center;
      border: 1px solid var(--color-border-strong);
      border-radius: var(--radius-medium);
      background: var(--color-surface-translucent);
      color: var(--color-text-secondary);
      cursor: pointer;
      transition: color 0.15s, border-color 0.15s, background 0.15s;
    }
    #btn-attach:hover { color: var(--color-text); border-color: var(--color-accent-line); background: var(--color-accent-soft); }
    #btn-attach:disabled { opacity: 0.32; cursor: not-allowed; }
    #btn-attach:disabled:hover { color: var(--color-text-secondary); border-color: var(--color-border-strong); background: var(--color-surface-translucent); }

    /* O seletor de modelos do composer fica em chat.css. */

    #input {
      flex: 1 1 auto;
      min-width: 0;
      border: none;
      background: transparent;
      color: var(--color-text);
      caret-color: var(--color-accent);
      font-family: inherit;
      font-size: 0.97rem;
      line-height: 1.5;
      resize: none;
      height: 26px;
      max-height: 140px;
      min-height: 26px;
      overflow-y: hidden;
      overflow-x: hidden;
      padding: var(--space-1) var(--space-1);
    }
    #input::placeholder { color: var(--color-text-faint); }
    #input:focus { outline: none; }

    #btn-mic {
      width: 32px; height: 32px;
      flex: 0 0 auto;
      display: grid; place-items: center;
      border: none;
      border-radius: 50%;
      background: transparent;
      color: var(--color-text-secondary);
      cursor: pointer;
      transition: color 0.15s, background 0.15s;
    }
    #btn-mic:hover { color: var(--color-text); background: var(--color-surface-hover); }
    #btn-mic.listening {
      color: var(--color-danger);
      background: var(--color-danger-soft);
      animation: mic-pulse 1.2s ease-in-out infinite;
    }
    @keyframes mic-pulse {
      0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
      50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    }
    #btn-mic:disabled { opacity: 0.35; cursor: default; }

    #btn-send {
      width: 32px; height: 32px;
      flex: 0 0 auto;
      display: grid; place-items: center;
      border: none;
      border-radius: 50%;
      background: var(--color-surface-translucent);
      color: var(--color-text-faint);
      cursor: pointer;
      transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.12s;
    }
    /* Send destacado somente quando habilitado. */
    #btn-send.ready {
      background: var(--color-accent);
      color: var(--color-on-accent);
      box-shadow: 0 0 18px rgba(34, 211, 238, 0.28);
    }
    #btn-send.ready:hover { background: var(--color-accent-hover); }
    #btn-send.ready:active { transform: scale(0.96); }
    #btn-send.stop-mode {
      background: rgba(248, 113, 113, 0.14);
      color: var(--color-danger);
      box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.28);
    }
    #btn-send.stop-mode:hover { background: rgba(248, 113, 113, 0.24); }
    #btn-send.stop-mode:active { transform: scale(0.96); }
    .generation-stopped {
      margin-top: 8px;
      color: var(--color-text-faint);
      font-size: 0.75rem;
    }
    /* Continua realmente desabilitado quando não há texto nem anexo. */
    #btn-send:disabled { cursor: default; box-shadow: none; background: var(--color-surface-translucent); color: var(--color-text-faint); }

    .file-chip {
      width: 100%;
      max-width: min(var(--composer-w), 100%);
      margin: 0 auto var(--space-2);
      padding: 8px 12px;
      background: #1A1C1B;
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 12px;
      font-size: 0.75rem;
      color: var(--color-text-secondary);
      display: none;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }
    .file-chip.visible { display: flex; }
    #file-clear { display: none; }
    .file-chip-list {
      display: flex;
      flex-direction: column;
      gap: 4px;
      flex: 1 1 auto;
      min-width: 0;
      max-height: 150px;
      overflow-y: auto;
    }
    .file-chip-item {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      max-width: 100%;
    }
    .file-chip-name {
      font-weight: 600;
      font-size: 0.8125rem;
      color: #F4F4F5;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      flex: 0 1 auto;
      min-width: 0;
    }
    .file-chip-size {
      color: #9CA3AF;
      font-size: 0.75rem;
      flex-shrink: 0;
    }
    .file-chip-remove,
    .attachment-consumption-close {
      background: none;
      border: none;
      color: #9CA3AF;
      font-size: 0.9rem;
      line-height: 1;
      padding: 2px 6px;
      cursor: pointer;
      flex-shrink: 0;
      border-radius: 6px;
      min-width: 28px;
      min-height: 28px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .file-chip-remove:hover,
    .attachment-consumption-close:hover {
      color: #FFFFFF;
      background: rgba(255, 255, 255, 0.08);
    }
    .attachment-consumption-wrap {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin-left: auto;
      flex-shrink: 0;
      max-width: 100%;
    }
    .attachment-consumption {
      font-size: 0.75rem;
      color: #9CA3AF;
      line-height: 1.35;
    }
    html[data-theme="light"] .file-chip {
      background: #F4F7F6;
      border-color: rgba(15, 23, 42, 0.14);
      color: #0F172A;
    }
    html[data-theme="light"] .file-chip-name {
      color: #0F172A;
    }
    html[data-theme="light"] .file-chip-size,
    html[data-theme="light"] .attachment-consumption,
    html[data-theme="light"] .file-chip-remove,
    html[data-theme="light"] .attachment-consumption-close {
      color: #4A5E56;
    }
    html[data-theme="light"] .file-chip-remove:hover,
    html[data-theme="light"] .attachment-consumption-close:hover {
      color: #0F172A;
      background: rgba(15, 23, 42, 0.08);
    }
    @media (max-width: 640px) {
      .file-chip {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
      }
      .file-chip-list {
        width: 100%;
      }
      .attachment-consumption-wrap {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
      }
    }
    .file-dropzone {
      position: relative;
      width: 100%;
      max-width: min(var(--composer-w), 100%);
      margin: 0 auto var(--space-2);
      padding: 6px var(--space-3);
      border: 2px dashed var(--color-border);
      border-radius: var(--radius-small);
      transition: border-color 120ms ease, background 120ms ease;
      min-height: 44px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: var(--space-2);
    }
    .file-dropzone[hidden] {
      display: none;
    }
    .file-dropzone.drag-active {
      border-color: var(--color-accent, #35d7a7);
      background: rgba(53, 215, 167, 0.08);
    }
    .file-dropzone-text {
      font-size: 0.72rem;
      color: var(--color-text-faint);
    }
    .file-dropzone.drag-active .file-dropzone-text {
      color: var(--color-accent, #35d7a7);
    }

    .privacy-warning {
      max-width: min(var(--composer-w), 100%);
      margin: var(--space-3) auto 0;
      text-align: center;
      font-size: 0.72rem;
      line-height: 1.4;
      color: var(--color-text-faint);
    }
    .privacy-sep { margin: 0 10px; opacity: 0.55; }

    /* —— Responsivo —— */
    @media (max-width: 820px) {
      .prompts { grid-template-columns: 1fr; max-width: 24rem; }
      .prompt { min-height: 0; gap: var(--space-3); padding: var(--space-4) var(--space-5); }
    }

    @media (max-width: 640px) {
      :root { --sidebar-w: 260px; }
      .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        z-index: 50;
      }
      /* Mobile: a barra recolhida vira só o botão flutuante de abrir —
         sem a faixa de 60px por cima do conteúdo. A barra aberta segue
         como painel fixo de 260px, fechado pelo botão que já existe. */
      .layout.sidebar-collapsed .sidebar {
        width: auto;
        background: transparent;
        border-right: 0;
      }
      .layout.sidebar-collapsed .sidebar > :not(.sidebar-header) { display: none; }
      .layout.sidebar-collapsed .brand { display: none; }
      .chat-inner { padding: var(--space-4) var(--space-4) var(--space-4); }
      .chat-inner:has(#welcome) { margin: 0 auto auto; padding: var(--space-5) var(--space-4) var(--space-2); }
      .ai-presence h1 { font-size: clamp(1.4rem, 7vw, 1.7rem); }
      .btn-temp { top: var(--space-3); right: var(--space-3); width: 28px; height: 28px; }
      .temporary-status { flex-direction: column; align-items: flex-start; gap: 0; }
      .input-area { padding: 10px var(--space-2) var(--space-4); }
      .input-box { gap: 6px; padding: var(--space-2); min-height: 62px; }
      .exchange.assistant .row { gap: var(--space-3); }
      .ai-dot { width: 24px; height: 24px; }
    }

    @media (max-width: 420px) {
      #btn-attach, #btn-mic, #btn-send { width: 30px; height: 30px; }
      .input-box { gap: var(--space-1); padding: 6px var(--space-2); min-height: 58px; }
      #input { min-width: 2.5rem; font-size: 0.9375rem; }
    }
/* Nota discreta do seletor AUTO: só visível quando o modo selecionado é auto. */
.model-picker-note {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--color-text-faint);
}


/* Ações da resposta da IA: áudio e ramificação na mesma linha. */
.exchange.assistant .assistant-msg-meta {
  display: flex;
  justify-content: flex-start;
  margin-top: var(--space-1);
  padding-left: 0;
}
.exchange.assistant .assistant-msg-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--space-1);
  opacity: 1;
}

/* ==========================================================================
   Persona Modal Styles — Nova pessoa modal redesign (appendix)
   ========================================================================== */

.persona-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  z-index: 9999;
  padding: 16px;
  box-sizing: border-box;
}

.persona-modal-dialog {
  background: #131A16;
  border: 1px solid #2A352E;
  border-radius: 16px;
  max-width: 780px;
  max-height: 90vh;
  width: min(780px, 94vw);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #F3F6F4;
  box-sizing: border-box;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.persona-modal-body {
  padding: 24px 28px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.persona-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.persona-modal-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #F3F6F4;
}

.persona-modal-subtitle {
  margin: 6px 0 0 0;
  font-size: 0.875rem;
  color: #8D9A92;
  line-height: 1.4;
}

.persona-modal-close-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.persona-modal-close-label {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8D9A92;
}

.persona-modal-close {
  border: 1px solid #2F3B34;
  font-size: 1rem;
  color: #B8C4BC;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #222B26;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
  padding: 0;
}

.persona-modal-close svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.persona-modal-close:hover {
  background: #2C3831;
  border-color: #22D3EE;
}

.persona-modal-preview-wrap {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  padding: 3px;
  border: 2px solid #22D3EE;
  background: #131A16;
  flex-shrink: 0;
  box-sizing: border-box;
}

.persona-modal-preview-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.persona-modal-input,
.persona-modal-textarea {
  width: 100%;
  border-radius: 8px;
  background: #18201C;
  border: 1px solid #2C3831;
  color: #F3F6F4;
  font-size: 14px;
  box-sizing: border-box;
}

.persona-modal-input {
  height: 42px;
  padding: 0 14px;
}

.persona-modal-textarea {
  height: 76px;
  padding: 10px 14px;
  resize: vertical;
}

.persona-modal-input:focus,
.persona-modal-textarea:focus {
  outline: none;
  border-color: #22D3EE;
}

.persona-modal-face-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 10px 0 20px;
}

.persona-modal-face-btn {
  position: relative;
  min-height: 128px;
  border-radius: 12px;
  border: 1px solid #2A352E;
  cursor: pointer;
  background: #161E1A;
  color: #B8C4BC;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 10px;
  font-size: 13px;
  font-weight: 500;
}

.persona-modal-face-btn:hover {
  border-color: #3D5247;
}

.persona-modal-face-btn.selected {
  background: #172F24;
  border: 2px solid #22D3EE;
  color: #F3F6F4;
}

.persona-modal-face-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #22D3EE;
  color: #0C1A13;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.persona-modal-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.persona-modal-row-label {
  width: 165px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: #E4EAE6;
  padding-top: 7px;
  line-height: 1.35;
}

.persona-modal-row-content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.persona-modal-color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #0B1A13;
  padding: 0;
  transition: transform 0.15s ease;
}

.persona-modal-color-btn.selected {
  box-shadow: 0 0 0 2px #131A16, 0 0 0 4px #22D3EE;
}

.persona-modal-pill {
  min-height: 32px;
  padding: 0 14px;
  border-radius: 9999px;
  border: 1px solid #2E3A33;
  background: #18201C;
  color: #C8D3CC;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.persona-modal-pill.selected {
  background: #22D3EE;
  border-color: #22D3EE;
  color: #0A1912;
  font-weight: 600;
}

.persona-modal-pill:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.persona-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  background: #131A16;
  border-top: 1px solid #26312B;
  flex-shrink: 0;
}

.persona-modal-footnote {
  color: #8D9A92;
  font-size: 0.85rem;
  margin: 0;
  text-align: left;
}

.persona-modal-cancel {
  min-height: 38px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 500;
  background: #1C2520;
  color: #E4EAE6;
  border: 1px solid #303D35;
  border-radius: 8px;
  cursor: pointer;
}

.persona-modal-save {
  min-height: 38px;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 600;
  background: #22D3EE;
  color: #0A1912;
  border: 1px solid #22D3EE;
  border-radius: 8px;
  cursor: pointer;
}

.persona-modal-save:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Persona cards on welcome screen */
.persona-cards {
  max-width: 100%;
  overflow: hidden;
}

#persona-cards-list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 14px;
  margin-top: 12px;
  padding: 4px 16px;
  max-width: 100%;
  box-sizing: border-box;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

#persona-cards-list::-webkit-scrollbar {
  display: none;
}

.persona-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 auto;
  width: 158px;
  min-height: 152px;
  padding: 16px 12px;
  scroll-snap-align: start;
  border: 1px solid #22272B;
  border-radius: 14px;
  background: #121518;
  color: #E5E7EB;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.persona-card.active {
  background: #11221C;
  border: 1.5px solid #22D3EE;
  box-shadow: 0 0 22px rgba(62, 230, 168, 0.14);
  color: #FFFFFF;
}

.persona-card.persona-card-new {
  background: #121518;
  border: 1px dashed #2E343A;
  color: #8A949E;
}

.persona-card-edit {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(18, 21, 24, 0.85);
  color: #9CA3AF;
  cursor: pointer;
  padding: 0;
}

.persona-card-edit:hover {
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.28);
}

#btn-send[data-tip] {
  position: relative;
}

@media (hover: hover) and (pointer: fine) {
  #btn-send[data-tip]:hover::after,
  #btn-send[data-tip]:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    padding: 5px 10px;
    border-radius: 8px;
    background: #181C20;
    color: #F3F4F6;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    z-index: 50;
  }
}

/* Fullscreen Voice Mode */
#voice-fullscreen[hidden] {
  display: none !important;
}

#voice-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: #0B0E11;
  color: #F3F4F6;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.voice-fs-top {
  position: relative;
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #9CA3AF;
}

.voice-fs-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-fs-timer {
  font-variant-numeric: tabular-nums;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #E5E7EB;
}

.voice-fs-settings-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: rgba(255, 255, 255, 0.06);
  color: #E5E7EB;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.voice-fs-settings-btn:hover,
.voice-fs-settings-btn[aria-expanded="true"] {
  background: rgba(34, 211, 238, 0.16);
  border-color: #22D3EE;
  color: #FFFFFF;
}

.voice-settings-panel {
  position: absolute;
  top: 54px;
  right: 0;
  width: min(320px, calc(100vw - 32px));
  background: #0b0b0b;
  border: 1.5px solid #22D3EE;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  z-index: 9600;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.voice-settings-panel[hidden] {
  display: none !important;
}

.voice-settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-settings-label {
  font-size: 13px;
  font-weight: 600;
  color: #9CA3AF;
}

.voice-settings-toggle {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #F3F4F6;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.voice-settings-toggle.active {
  border-color: #22D3EE;
  background: rgba(34, 211, 238, 0.14);
}

.voice-settings-voices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.voice-settings-voice-btn {
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #E5E7EB;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.voice-settings-voice-btn.active {
  border-color: #22D3EE;
  background: rgba(34, 211, 238, 0.2);
  color: #FFFFFF;
  font-weight: 700;
}

#voice-fs-transcript.is-hidden {
  display: none !important;
}

.voice-fs-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin: 16px 0;
}

.voice-fs-avatar-wrap {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  padding: 6px;
  border: 3px solid var(--voice-accent, #22D3EE);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.voice-fs-avatar-wrap.responding {
  animation: voicePulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 28px rgba(62, 230, 168, 0.35);
}

@keyframes voicePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.voice-fs-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.voice-fs-status {
  font-size: 24px;
  font-weight: 600;
  text-align: center;
}

.voice-fs-transcript {
  width: 100%;
  max-width: 680px;
  min-height: 84px;
  max-height: 180px;
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
  line-height: 1.45;
  color: #D1D5DB;
  box-sizing: border-box;
}

.voice-fs-transcript-empty {
  color: #9CA3AF;
  text-align: center;
  margin: 12px 0;
}

.voice-fs-actions {
  width: 100%;
  max-width: 440px;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.voice-fs-btn {
  flex: 1;
  min-height: 56px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #161B20;
  color: #F3F4F6;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.voice-fs-btn.muted {
  background: #232830;
  border-color: #F59E0B;
  color: #FCD34D;
}

.voice-fs-btn-end {
  background: #DC2626;
  border-color: #EF4444;
  color: #FFFFFF;
}

#persona-chip {
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: 9999px;
  min-height: 36px;
}

@media (max-width: 640px) {
  .persona-modal-body {
    padding: 18px 16px 16px;
  }
  .persona-modal-face-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .persona-modal-row {
    flex-direction: column;
    gap: 8px;
  }
  .persona-modal-row-label {
    width: auto;
    padding-top: 0;
  }
  .persona-modal-footer {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px;
  }
  .main .input-area .input-box {
    flex-wrap: wrap !important;
    row-gap: 8px !important;
    column-gap: 6px !important;
    padding: 10px 12px !important;
    border-radius: 22px !important;
  }
  .main .input-area .input-box #input {
    order: -1 !important;
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  #persona-chip {
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
