:root {
  --accent: #0284c7; /* Azul Principal */
  --border: #cbd5e1;
  --header-h: 60px; /* Reduzido levemente para economizar espaço */
  --ask-bg: #eaf2ff;
  --ask-border: #d6e6ff;
  --tag-bg: #f1f5f9;
  --tag-hover: #e2e8f0;
  --tag-text: #475569;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; overflow-x: hidden; position: relative; scroll-behavior: smooth; }
body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; color: #0f172a; background: #f8fafc; line-height: 1.5; -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: none; } 
img { max-width: 100%; height: auto; }

/* =========================================
   1. SIDEBAR (NOVAS CONVERSAS E HISTÓRICO)
   ========================================= */
.sidebar { position: fixed; top: 0; left: 0; height: 100%; width: 260px; background: #f8fafc; border-right: 1px solid #e2e8f0; z-index: 5000; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform 0.3s ease; }
.sidebar.open { transform: translateX(0); }
.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 4500; display: none; opacity: 0; transition: opacity 0.3s; }
.sidebar-overlay.visible { display: block; opacity: 1; }
.sidebar-top { padding: 16px; border-bottom: 1px solid #e2e8f0; display: flex; gap: 12px; align-items: center; }
#btn-new-chat-sidebar { flex: 1; width: auto; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; font-weight: 600; color: #334155; cursor: pointer; transition: 0.2s; height: 42px; }
#btn-new-chat-sidebar:hover { border-color: #94a3b8; background: #f1f5f9; color: var(--accent); }
.btn-close-sidebar { width: 42px; height: 42px; background: transparent; border: none; color: #94a3b8; font-size: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding: 0; line-height: 1; }
.btn-close-sidebar:hover { color: #ef4444; }
.sidebar-section { flex: 1; overflow-y: auto; padding: 0; display: flex; flex-direction: column; }
.sidebar-title { padding: 18px 16px 8px; font-size: 0.75rem; font-weight: 700; color: #94a3b8; letter-spacing: 0.05em; text-transform: uppercase; }
.history-list { list-style: none; padding: 0; margin: 0; padding-bottom: 20px; }
.history-item { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid #f1f5f9; transition: background 0.2s; display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; }
.history-item:hover { background: #e2e8f0; }
.history-item.active { background: #fff; border-left: 4px solid var(--accent); }
.history-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.history-title { font-size: 0.9rem; font-weight: 600; color: #334155; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; width: 100%; }
.history-meta { font-size: 0.75rem; color: #94a3b8; }
.history-opts { position: relative; flex-shrink: 0; }
.opts-btn { background: transparent; border: none; color: #94a3b8; cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: 4px; transition: color 0.2s, background 0.2s; display: flex; align-items: center; justify-content: center; }
.opts-btn:hover { color: #0f172a; background: #e2e8f0; }
.opts-menu { display: none; position: absolute; right: 0; top: 100%; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 50; min-width: 120px; overflow: hidden; }
.opts-menu.show { display: block; }
.opts-item { padding: 8px 12px; font-size: 0.85rem; cursor: pointer; color: #334155; transition: background 0.2s; display: flex; align-items: center; gap: 6px; width: 100%; border: none; background: none; text-align: left; }
.opts-item:hover { background: #f8fafc; color: var(--accent); }
.opts-item.delete { color: #ef4444; }
.opts-item.delete:hover { background: #fef2f2; color: #dc2626; }

/* =========================================
   2. CABEÇALHO (BOTÕES INVISÍVEIS E ALINHADOS)
   ========================================= */
.header { position: fixed; top: 0; left: 0; width: 100%; z-index: 4000; background: rgba(255, 255, 255, 0.98); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(15, 23, 42, 0.08); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02); display: flex; justify-content: space-between; align-items: center; height: var(--header-h); }
.header-left { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 100%; }
.header-right { display: flex; align-items: center; gap: 12px; padding-right: 16px; height: 100%; }
.sidebar-toggle { background: none; border: none; cursor: pointer; padding: 4px; color: #64748b; font-size: 1.5rem; transition: color 0.2s; display: flex; align-items: center; }
.sidebar-toggle:hover { color: var(--accent); }
.brand { display: flex; align-items: center; gap: 10px; color: #0f172a; font-weight: 800; }
.brand-logo { height: 32px; width: auto; object-fit: contain; }
.brand-title { font-size: 1.2rem; letter-spacing: -0.02em; white-space: nowrap; }
.brand-prefix { color: #0f172a; font-weight: 900; }
.brand-sep { color: #cbd5e1; margin: 0 4px; }

.nav { display: none; gap: 16px; font-size: 0.95rem; }
.nav a { color: #64748b; font-weight: 600; transition: color 0.2s; }
.nav a:hover { color: var(--accent); }
@media (min-width: 800px) { .nav { display: flex; } }

/* Novo Botão + do Cabeçalho (Transparente) */
.header-action-btn {
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  color: #64748b;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
  padding: 0;
  border-radius: 8px;
}
.header-action-btn:hover { background: #f1f5f9; color: var(--accent); }
.header-action-btn svg { width: 22px; height: 22px; }

/* Botão de Idioma (Transparente e sem borda) */
.lang-dropdown { position: relative; }
.lang-toggle-btn { 
  background: transparent; 
  border: none; 
  border-radius: 8px; 
  padding: 4px; 
  cursor: pointer; 
  display: flex; align-items: center; justify-content: center; 
  transition: all 0.2s; height: 36px; 
}
.lang-toggle-btn:hover { background: #f1f5f9; }
.lang-flag-img { width: 24px; height: 18px; border-radius: 3px; object-fit: cover; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }

.lang-menu { position: absolute; top: calc(100% + 8px); right: 0; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); min-width: 150px; display: none; flex-direction: column; z-index: 9999; overflow: hidden; }
.lang-menu.show { display: flex; }
.lang-menu-item { padding: 10px 14px; background: none; border: none; cursor: pointer; color: #334155; font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 10px; text-align: left; }
.lang-menu-item:hover { background: #f8fafc; color: var(--accent); }
.lang-menu-item img { width: 20px; height: 15px; border-radius: 2px; }

@media (min-width: 1024px) {
  .sidebar { transform: translateX(0); top: 0; z-index: 100; padding-top: var(--header-h); }
  .btn-close-sidebar { display: none !important; }
  .header-left { padding-left: 276px !important; }
  .main-content, .footer { padding-left: 260px; width: 100%; }
  .sidebar-toggle { display: none !important; }
}

/* =========================================
   3. HERO & ORDEM (COMPACTADO PARA CABER)
   ========================================= */
.main-content { padding-top: calc(var(--header-h) + 16px); min-height: 100vh; padding-bottom: 40px; }
.hero { padding: 0 16px; }

.hero-inner { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; width: 100%; }

.hero-header-block { order: 1; text-align: center; margin-bottom: 20px; width: 100%; }
.mode-grid         { order: 2; width: 100%; margin-bottom: 20px; }
.tags-container    { order: 3; width: 100%; margin-bottom: 20px; }
.search-form       { order: 4; width: 100%; max-width: 800px; margin-bottom: 16px; z-index: 10; }
.radar-section     { order: 5; width: 100%; max-width: 800px; margin: 2px auto 14px; } 
.privacy-notice    { order: 6; text-align: center; width: 100%; color: #64748b; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; gap: 6px; }

.hero-title { font-size: 2.2rem; font-weight: 800; color: #0f172a; margin: 0 0 4px 0; letter-spacing: -0.02em; }
.hero-subtitle { font-size: 1.1rem; color: #64748b; margin: 0; }

/* =========================================
   4. CAMPO DE BUSCA
   ========================================= */
.search-form { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.search-form .input-wrapper { width: 100%; position: relative; display: flex; align-items: center; }

.file-preview-area { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px; background: #f1f5f9; border-radius: 16px; width: 100%; margin-bottom: 0px; border: 1px solid #e2e8f0; }
.file-preview-area.hidden { display: none !important; }
.file-tag { background: #fff; border: 1px solid var(--border); padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; color: var(--tag-text); display: flex; align-items: center; gap: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }

.search-input {
  width: 100%; 
  min-height: 64px; 
  padding: 16px 80px 16px 44px; 
  border: 1px solid var(--ask-border); 
  border-radius: 24px;
  font-size: 1.15rem; 
  line-height: 1.4; 
  resize: none;
  font-family: inherit; 
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06); 
  transition: all 0.2s ease;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 8px 24px rgba(2, 132, 199, 0.15); outline: none; }

.input-action-btn { position: absolute; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: #64748b; cursor: pointer; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 10; transition: background 0.2s, color 0.2s; }
.input-action-btn:hover { background: #f1f5f9; color: var(--accent); }
.input-action-btn.left { left: 4px; }

.right-actions { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 4px; z-index: 10; }
.right-actions .input-action-btn { position: static; transform: none; width: 36px; height: 36px;} 

.btn-clear { position: static; transform: none; background: transparent; border: none; color: #94a3b8; font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; transition: color 0.2s; }
.btn-clear:hover { color: #ef4444; }

.input-action-btn.recording { color: #ef4444; animation: pulse-red 1.5s infinite; }
@keyframes pulse-red { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

.search-button { width: 100%; max-width: 280px; height: 50px; border: none; border-radius: 20px; background: var(--accent); color: #fff; font-size: 1.1rem; font-weight: 800; cursor: pointer; box-shadow: 0 8px 20px rgba(2, 132, 199, 0.25); transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.search-button:hover { filter: brightness(1.05); transform: translateY(-2px); box-shadow: 0 12px 24px rgba(2, 132, 199, 0.3); }
.search-button:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* =========================================
   5. MÓDULOS (4 COLUNAS)
   ========================================= */
.mode-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mode-card { border: 1px solid #e2e8f0; background: #fff; border-radius: 16px; padding: 14px 10px; cursor: pointer; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04); transition: all 0.2s ease; display: flex; flex-direction: column; align-items: center; text-align: center; }
.mode-card:hover { transform: translateY(-2px); border-color: #cbd5e1; box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08); }
.mode-card.active { border-color: var(--accent); border-width: 2px; box-shadow: 0 10px 20px rgba(2, 132, 199, 0.15); background-color: #eff6ff; padding: 13px 9px; }
.mode-content { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mode-icon { font-size: 2rem; }
.mode-title { font-weight: 800; font-size: 1rem; color: #1e293b; }
.mode-card.active .mode-title { color: var(--accent); }
.mode-sub { color: #64748b; font-weight: 600; font-size: 0.8rem; }
.mode-card input { display: none; }

/* =========================================
   6. TAGS HORIZONTAIS
   ========================================= */
.tags-container { overflow-x: auto; overflow-y: hidden; scroll-behavior: smooth; mask-image: linear-gradient(to right, transparent, black 2%, black 98%, transparent); -webkit-mask-image: linear-gradient(to right, transparent, black 2%, black 98%, transparent); padding-bottom: 5px;}
.tags-container::-webkit-scrollbar { display: none; }
.tags-track { display: flex; gap: 10px; width: max-content; padding: 4px 16px; }
.smart-tag { border: 1px solid var(--border); background: var(--tag-bg); color: var(--tag-text); font-weight: 700; border-radius: 20px; padding: 8px 16px; cursor: pointer; white-space: nowrap; transition: all 0.2s; font-size: 0.9rem; }
.smart-tag:hover { background: var(--tag-hover); border-color: #94a3b8; transform: translateY(-1px); color: #0f172a; }
.smart-tag.tag-urgent { border-color: #fecaca; background: #fff1f2; color: #991b1b; }

/* =========================================
   6.1 RADAR DE PLANTÃO (OPÇÃO 2 — CARROSSEL)
   ========================================= */
.radar-section { width: 100%; }
.radar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 6px 8px; }
.radar-title { display: flex; align-items: center; gap: 10px; font-weight: 900; color: #0f172a; letter-spacing: -0.01em; }
.radar-emoji { font-size: 1.1rem; }
.radar-title-text { font-size: 1.05rem; }
.radar-pill{
  font-size: 0.78rem;
  font-weight: 900;
  color: #991b1b;
  background: #fff1f2;
  border: 1px solid #fecaca;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.radar-nav { display: flex; align-items: center; gap: 8px; }
.radar-nav-btn{
  width: 36px; height: 36px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.radar-nav-btn:hover{ transform: translateY(-1px); border-color: #cbd5e1; background: #f8fafc; }

.radar-carousel{
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}
.radar-track{
  display: flex;
  transition: transform 280ms ease;
  will-change: transform;
}
.radar-card{
  flex: 0 0 100%;
  padding: 10px 10px 8px;
}
.radar-card-inner{
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 116px;
}
.radar-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.radar-badge{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 900;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid;
}
.radar-badge .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.radar-badge.critical { color: #991b1b; background: #fff1f2; border-color: #fecaca; }
.radar-badge.critical .dot { background: #ef4444; }
.radar-badge.relevant { color: #9a3412; background: #fffbeb; border-color: #fed7aa; }
.radar-badge.relevant .dot { background: #fb923c; }
.radar-badge.pearl { color: #0f766e; background: #ecfeff; border-color: #99f6e4; }
.radar-badge.pearl .dot { background: #14b8a6; }

.radar-date { font-size: 0.78rem; font-weight: 800; color: #64748b; }
.radar-text { color: #0f172a; font-weight: 800; font-size: 0.98rem; line-height: 1.3; }
.radar-sub { color: #475569; font-weight: 600; font-size: 0.9rem; line-height: 1.3; }

.radar-cta-row { display: flex; align-items: center; justify-content: flex-end; margin-top: 4px; }
.radar-cta{
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #0369a1;
  font-weight: 900;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.radar-cta:hover { transform: translateY(-1px); filter: brightness(1.02); }
.radar-cta small { font-weight: 900; opacity: 0.8; }

.radar-dots { display: flex; justify-content: center; gap: 8px; padding: 8px 0 0; }
.radar-dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cbd5e1;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.radar-dot.active { background: var(--accent); transform: scale(1.25); }

@media (max-width: 520px) {
  .radar-title-text { font-size: 1rem; }
  .radar-card-inner { min-height: 112px; }
}

/* =========================================
   7. CHAT & THREAD
   ========================================= */
.thread { max-width: 900px; margin: 20px auto 0; display: flex; flex-direction: column; gap: 20px; padding: 0 16px; }
.turn { background: #fff; border: 1px solid #e2e8f0; border-radius: 20px; padding: 24px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05); scroll-margin-top: 84px; }
.turn.loading { opacity: 0.8; }
.turn-label { font-size: 0.75rem; letter-spacing: 0.08em; font-weight: 800; color: #94a3b8; margin-bottom: 10px; text-transform: uppercase; }
.turn-question { font-size: 1.15rem; font-weight: 700; color: #0f172a; margin-bottom: 20px; }
.turn-answer { color: #334155; font-size: 1.05rem; line-height: 1.6; }
.loading-state { color: #64748b; font-weight: 700; padding: 10px 0; display: flex; align-items: center; gap: 10px; }
.turn-answer h1, .turn-answer h2, .turn-answer h3 { margin: 20px 0 10px; color: #0f172a; }
.turn-answer ul, .turn-answer ol { margin: 10px 0 16px 24px; }
.turn-answer li { margin-bottom: 8px; }
.turn-answer a { color: var(--accent); font-weight: 600; }
.turn-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #f1f5f9; flex-wrap: wrap; }
.action-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid transparent; background: #f8fafc; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #64748b; transition: all 0.2s; }
.action-btn:hover { background: #e2e8f0; color: #0f172a; transform: translateY(-1px); }
.action-btn.active { color: var(--accent); background: #e0f2fe; }
.action-btn.success { color: #16a34a; background: #dcfce7; }
.action-sep { width: 1px; height: 24px; background: #e2e8f0; margin: 0 4px; }

/* =========================================
   7.1 FOLLOW-UP (DESCOLADO E IDÊNTICO AO INICIAL)
   ========================================= */
.followup { 
  position: relative; 
  width: 100%; 
  background: transparent; 
  padding: 30px 16px 60px; 
  z-index: 10; 
  border-top: none;
}
.followup.hidden { display: none !important; }
.followup .container { width: 100%; max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }

/* =========================================
   8. MODAL E OUTROS
   ========================================= */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); z-index: 9000; display: grid; place-items: center; padding: 20px; backdrop-filter: blur(2px); }
.modal-box { background: #fff; width: 100%; max-width: 440px; border-radius: 20px; padding: 24px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.modal-title { font-size: 1.3rem; font-weight: 800; margin: 0 0 12px; color: #0f172a; }
.ger-title-compact { font-size: 1.02rem; font-weight: 700; text-align: center; line-height: 1.15; width: 100%; margin: 0 0 10px; white-space: nowrap; }
.modal-content { color: #475569; font-size: 1.05rem; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }
.modal-btn { padding: 12px 20px; border-radius: 12px; font-weight: 700; border: none; cursor: pointer; font-size: 1rem; transition: background 0.2s; }
.modal-btn.primary { background: var(--accent); color: #fff; }
.modal-btn.primary:hover { background: #0369a1; }
.modal-btn.secondary { background: #f1f5f9; color: #475569; }
.modal-btn.secondary:hover { background: #e2e8f0; color: #0f172a; }
.modal-btn.danger { background: #ef4444; color: #fff; }
.modal-textarea { width: 100%; min-height: 100px; padding: 12px; border-radius: 12px; border: 1px solid #cbd5e1; outline: none; font-size: 1rem; font-family: inherit; resize: vertical; margin-top: 10px; }
.footer { padding: 24px 16px; background: #fff; text-align: center; color: #94a3b8; font-size: 0.85rem; border-top: 1px solid #e2e8f0; }

.hidden { display: none !important; }


/* =========================================
   10. SEÇÕES DE INFORMAÇÃO (SOBRE, PRIVACIDADE, ETC)
   ========================================= */
#info-sections {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  width: 100%;
}
.content-section {
  padding: 60px 16px;
  border-bottom: 1px solid #f1f5f9;
  scroll-margin-top: calc(var(--header-h) + 10px); 
}
.content-section .container {
  max-width: 900px;
  margin: 0 auto;
  display: block;
}
.content-section h2 {
  margin: 0 0 20px 0;
  color: #0f172a;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.text-content {
  color: #334155;
  font-size: 1.1rem;
  line-height: 1.7;
}
.text-content p {
  margin-bottom: 16px;
}
.text-content strong {
  color: #0f172a;
  font-weight: 700;
}


/* =========================================
   9. RESPONSIVO (COMPACTAÇÃO EXTREMA MOBILE)
   ========================================= */
@media (max-width: 900px) {
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  :root { --header-h: 56px; }
  
  .main-content { padding-top: calc(var(--header-h) + 12px); padding-bottom: 20px; }
  .hero-header-block { margin-bottom: 12px; }
  .search-form { margin-bottom: 12px; gap: 10px; }
  .tags-container { margin-bottom: 12px; }
  .mode-grid { margin-bottom: 10px; gap: 8px; }
  
  .brand-title { font-size: 1.1rem; }
  .brand-prefix, .brand-sep { display: none; }
  .hero-title { font-size: 1.25rem; margin-bottom: 2px;} 
  .hero-subtitle { font-size: 0.9rem; }
  
  .search-input { min-height: 54px; padding: 12px 76px 12px 42px; font-size: 1rem; border-radius: 20px;}
  .input-action-btn.left { left: 4px; width: 34px; height: 34px; }
  
  .right-actions { right: 4px; gap: 2px; }
  .right-actions .input-action-btn { width: 34px; height: 34px; }
  .btn-clear { font-size: 1.4rem; width: 28px; height: 28px; padding: 0; }
  
  .search-button { max-width: 100%; height: 46px; font-size: 1.05rem; border-radius: 16px;}
  
  .mode-card { padding: 9px 8px; min-height: 70px; border-radius: 12px;}
  .mode-icon { font-size: 1.6rem; }
  .mode-title { font-size: 0.85rem; }
  .mode-sub { font-size: 0.7rem; }
  
  .smart-tag { padding: 8px 12px; font-size: 0.85rem; }
  .privacy-notice { font-size: 0.75rem; margin-top: 0;}

  .content-section { padding: 40px 16px; }
  .content-section h2 { font-size: 1.5rem; }
  .text-content { font-size: 1rem; }

  /* Ajuste perfeito dos botões do cabeçalho no celular */
  .header-action-btn { width: 32px; height: 32px; margin-right: 2px; }
  .header-action-btn svg { width: 20px; height: 20px; }
  .lang-toggle-btn { height: 32px; padding: 2px; }
  .lang-flag-img { width: 22px; height: 16px; }
}


/* =========================================
   FERRAMENTA: AVALIAÇÃO GERIÁTRICA (MODAL)
   ========================================= */
.ger-container { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; }
.ger-fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 15px; margin-bottom: 15px; background-color: #fff; }
.ger-legend { font-weight: bold; color: var(--accent); padding: 0 10px; font-size: 16px; }
.ger-sub-label { font-size: 13px; color: #475569; margin: 10px 0 6px 0; font-weight: 700; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px; }
.ger-sub-label:first-of-type { margin-top: 0; }
.ger-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ger-option { display: block; cursor: pointer; height: 100%; }
.ger-option input[type="radio"] { display: none; }
.ger-btn-content { background-color: #f8fafc; color: #475569; padding: 10px 8px; border: 2px solid transparent; border-radius: 6px; text-align: center; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: all 0.2s ease; font-weight: 500; line-height: 1.2; }
.ger-option input[type="radio"]:checked + .ger-btn-content { background-color: var(--accent); color: #fff; border-color: #026bb5; box-shadow: 0 2px 5px rgba(0,0,0,0.1); transform: translateY(-1px); }
.ger-scale-desc { font-size: 11px; opacity: 0.85; margin-top: 4px; font-weight: normal; display: block; }
.ger-textarea { width: 100%; height: 180px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-family: monospace; font-size: 13px; resize: vertical; background-color: #f8fafc; box-sizing: border-box; margin-top: 15px; }
.ger-actions { display: flex; gap: 10px; justify-content: center; margin-top: 15px; }
.ger-btn { padding: 12px 20px; font-size: 14px; font-weight: bold; border: none; border-radius: 8px; cursor: pointer; transition: 0.2s; color: #fff; }
.ger-btn-gen { background-color: var(--accent); }
.ger-btn-gen:hover { background-color: #026bb5; }
.ger-btn-copy { background-color: #10b981; display: none; }
.ger-btn-copy:hover { background-color: #059669; }

/* =========================================
   AJUSTES DE LARGURA E SCROLL DO MODAL GERIÁTRICO
   ========================================= */
.ger-modal-wide {
    max-width: 750px !important;
    width: 95% !important;
    position: relative !important;
}

.ger-modal-scroll {
    max-height: 75vh !important; /* 75% da altura da tela */
    overflow-y: auto !important;
    padding-right: 8px; /* Espaço para o scroll */
}

/* Estilizando a barra de rolagem para ficar elegante */
.ger-modal-scroll::-webkit-scrollbar {
    width: 6px;
}
.ger-modal-scroll::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}
.ger-modal-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Botão X de Fechar */
.ger-close-x {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 1000;
}
.ger-close-x:hover {
    color: #ef4444;
}



/* =========================================
   11. SIDEBAR FERRAMENTAS CLÍNICAS
   ========================================= */
.sidebar-top {
  justify-content: flex-end;
  border-bottom: none;
  padding: 12px 12px 0;
}
.sidebar-tools {
  flex: 0 0 auto;
  overflow: visible;
  padding: 12px 16px 10px !important;
  gap: 10px;
}
.sidebar-history-panel {
  flex: 1 1 auto;
  overflow-y: auto;
}
.sidebar-primary-btn {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
  text-align: left;
}
.sidebar-primary-btn:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
  color: var(--accent);
}
#btn-new-chat-sidebar,
#btn-tool-geriatric,
#btn-routine-anamnese {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  height: auto;
  padding: 10px 14px;
}
.sidebar-btn-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  flex: 0 0 20px;
}
.sidebar-primary-btn:hover .sidebar-btn-icon {
  color: var(--accent);
}
.sidebar-spacer {
  height: 44px;
}
.active-routine-label {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #bae6fd;
  background: #eff6ff;
  color: #075985;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 600;
}
.active-routine-clear {
  border: none;
  background: transparent;
  color: #0284c7;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  padding: 0 2px;
}
.active-routine-clear:hover {
  color: #0c4a6e;
}

.ger-grid > * {
  min-width: 0;
}
.ger-input-text-date {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* =========================================
   12. MODAL DEDICADO DE ANAMNESE
   ========================================= */
.anamnese-modal-box {
  max-width: 760px;
  width: min(760px, 96vw);
  padding: 0;
  overflow: hidden;
}
.anamnese-modal-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 18px 54px 14px;
  border-bottom: 1px solid #e2e8f0;
}
.anamnese-modal-header .modal-title {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: 1.12rem;
}
.anamnese-modal-subtitle {
  display: none;
}
.anamnese-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.anamnese-modal-close:hover {
  background: #f8fafc;
  color: #334155;
}
.anamnese-modal-body {
  padding: 18px 22px;
}
.anamnese-type-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.ana-type-pill {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  border-radius: 999px;
  padding: 11px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}
.ana-type-pill:hover {
  border-color: #7dd3fc;
  color: #0284c7;
}
.ana-type-pill.active {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}
.anamnese-text-block {
  margin-bottom: 16px;
}
.anamnese-textarea {
  width: 100%;
  min-height: 168px;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 0.98rem;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  font-family: inherit;
}
.anamnese-textarea:focus {
  border-color: #7dd3fc;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.08);
}
.anamnese-tools-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.ana-tool-btn {
  border: 1px solid #dbe6f0;
  background: #fff;
  border-radius: 16px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #475569;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: 0.2s;
}
.ana-tool-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}
.ana-tool-btn.recording {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}
.anamnese-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2px;
}
.anamnese-attachments-list.hidden {
  display: none !important;
}
.ana-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  color: #0369a1;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}
.ana-file-chip-name {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ana-file-chip-remove {
  border: none;
  background: transparent;
  color: #ef4444;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.anamnese-modal-actions {
  padding: 0 22px 22px;
}
@media (min-width: 1024px) {
  .sidebar-top {
    display: none;
  }
}
@media (max-width: 600px) {
  #btn-tool-geriatric .btn-text {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .anamnese-modal-box {
    width: 100%;
    max-width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .anamnese-modal-header,
  .anamnese-modal-body,
  .anamnese-modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }
  .anamnese-modal-header {
    padding-top: 16px;
    padding-bottom: 12px;
  }
  .anamnese-modal-body {
    padding-top: 14px;
  }
  .anamnese-type-pills {
    grid-template-columns: 1fr 1fr;
  }
  .anamnese-tools-row {
    grid-template-columns: 1fr 1fr;
  }
  .ana-tool-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
  }
  .ana-file-chip-name {
    max-width: 150px;
  }
}
