/* ── RESET & TOKENS ─────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green:        #4CAF50;
  --green-dark:   #388E3C;
  --green-light:  #E8F5E9;
  --green-line:   #A5D6A7;
  --white:        #FFFFFF;
  --off-white:    #F7FAF7;
  --text:         #1A2B1A;
  --text-muted:   #6B7C6B;
  --border:       #D4E8D4;
  --shadow-sm:    0 1px 3px rgba(76,175,80,.10);
  --shadow-md:    0 4px 16px rgba(76,175,80,.12);
  --shadow-lg:    0 12px 40px rgba(76,175,80,.15);
  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    22px;
  --radius-xl:    32px;
  --font-display: 'Fredoka One', cursive;
  --font-body:    'DM Sans', sans-serif;
}

body {
  font-family: var(--font-body);
  background: var(--off-white);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── DECORATIVE BG ──────────────────────────────────────────────────── */
.bg-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-lines::before {
  content: '';
  position: absolute;
  top: -100px; right: -120px;
  width: 500px; height: 500px;
  border-radius: 50%;
  border: 2px solid var(--green-line);
  opacity: .35;
}
.bg-lines::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -100px;
  width: 400px; height: 400px;
  border-radius: 50%;
  border: 2px solid var(--green-line);
  opacity: .25;
}
.bg-lines .line {
  position: absolute;
  background: linear-gradient(90deg, transparent, var(--green-line), transparent);
  height: 1px; opacity: .3;
}
.bg-lines .line:nth-child(1) { top: 18%; left: 0; right: 0; }
.bg-lines .line:nth-child(2) { top: 42%; left: 0; right: 0; opacity: .18; }
.bg-lines .line:nth-child(3) { top: 72%; left: 0; right: 0; opacity: .22; }
.bg-lines .dot {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  opacity: .2;
}
.bg-lines .dot:nth-child(4)  { top: 15%; right: 12%; }
.bg-lines .dot:nth-child(5)  { top: 55%; left: 8%; }
.bg-lines .dot:nth-child(6)  { bottom: 20%; right: 20%; }
.bg-lines .dot:nth-child(7)  { top: 30%; left: 25%; width: 4px; height: 4px; }

/* ══════════════════════════════════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════════════════════════════════ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem;
}

.login-wrap {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  animation: fadeUp .5s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.brand {
  text-align: center;
  margin-bottom: 2rem;
}
.brand-mascot {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--green-light);
  border: 3px solid var(--green-line);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.brand-mascot img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.brand-ia { color: var(--green); }

.brand-name {
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--green-dark);
  letter-spacing: .5px;
  line-height: 1;
  margin-bottom: .35rem;
}
.brand-sub {
  font-size: .82rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: .4px;
}
.brand-logo {
  width: 260px;
  max-width: 100%;
  margin: 0 auto 1rem;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(76,175,80,.15));
}

.brand-tag {
  display: inline-block;
  margin-top: .6rem;
  background: var(--green-light);
  color: var(--green-dark);
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .8rem;
  border-radius: 99px;
  border: 1px solid var(--green-line);
  letter-spacing: .3px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.75rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.login-card h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text);
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .4rem;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.field input {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .95rem;
  background: var(--off-white);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus {
  border-color: var(--green);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(76,175,80,.12);
}
.field input::placeholder { color: #bbb; }

.btn-login {
  width: 100%;
  padding: .85rem;
  margin-top: .5rem;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: .5px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 12px rgba(76,175,80,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(76,175,80,.38); }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity: .7; cursor: not-allowed; transform: none; }

.login-phrase {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .82rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}
.login-phrase strong { color: var(--green-dark); font-style: normal; }

/* Error & loader (shared) */
.error-message {
  color: #D32F2F;
  font-size: .82rem;
  min-height: 1.2rem;
  margin-bottom: .25rem;
}
.loader {
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top: 2px solid white;
  width: 1rem; height: 1rem;
  animation: spin 1s linear infinite;
}

@media (max-width: 480px) {
  .login-body { padding: 1.25rem; }
  /* Evita zoom automático do iOS Safari ao focar em inputs (precisa de 16px+) */
  .field input { font-size: 16px; }
}
.hidden { display: none !important; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════════════
   CHAT
   ══════════════════════════════════════════════════════════════════════ */
.chat-body {
  height: 100vh;
  height: 100dvh; /* corrige teclado mobile cobrindo o input (iOS/Android) */
  display: flex;
  justify-content: center;
  overflow: hidden;
}

/* Layout Geral */
.chat-layout {
  display: flex;
  width: 100%;
  max-width: 1200px; /* Largura total com a barra lateral */
  height: 100%;
  position: relative;
  z-index: 1;
}

/* Sidebar de Sessões */
.chat-sidebar {
  width: 260px;
  background: var(--white);
  border-right: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 2px 0 10px rgba(0,0,0,0.02);
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1.5px solid var(--border);
}

.btn-new-chat {
  width: 100%;
  padding: 0.8rem;
  background: var(--white);
  border: 1.5px solid var(--green);
  border-radius: var(--radius-sm);
  color: var(--green-dark);
  font-family: var(--font-body);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-new-chat:hover {
  background: var(--green-light);
}

.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem;
  margin-bottom: 0.3rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  border: 1.5px solid transparent;
  transition: all 0.2s;
}

.session-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 0.5rem;
}

.session-delete {
  color: #ff4d4f;
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.session-item:hover .session-delete {
  opacity: 1;
}
.session-delete:hover {
  background: rgba(255, 77, 79, 0.1);
}

.session-item:hover {
  background: var(--off-white);
  border-color: var(--border);
  color: var(--text);
}

.session-item.active {
  background: var(--green-light);
  border-color: var(--green-line);
  color: var(--green-dark);
}

@media (max-width: 768px) {
  .chat-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100%;
    z-index: 200;
    transition: left 0.3s ease;
    box-shadow: var(--shadow-lg);
  }
  .chat-sidebar.open {
    left: 0;
  }
  .sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }
}

.sidebar-overlay {
  display: none;
}
@media (max-width: 768px) {
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(26,43,26,.5);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
}

.btn-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s, border-color .2s;
}
.btn-sidebar-toggle:hover { background: var(--green-light); border-color: var(--green-line); }
@media (max-width: 768px) {
  .btn-sidebar-toggle { display: flex; }
}

.page-chat {
  width: 100%;
  max-width: 860px;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* Header */
.chat-header {
  background: var(--white);
  border-bottom: 1.5px solid var(--border);
  padding: .85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.header-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--green-light);
  border: 2px solid var(--green-line);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.header-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text);
  line-height: 1;
}
.header-status {
  font-size: .72rem;
  color: var(--green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .3rem;
  margin-top: .15rem;
}
.header-status::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.header-right { display: flex; align-items: center; gap: 1rem; }
.header-greeting { font-size: .82rem; color: var(--text-muted); font-weight: 500; }
.btn-logout {
  padding: .4rem .9rem;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}
.btn-logout:hover { border-color: var(--green); color: var(--green-dark); background: var(--green-light); }

/* Tagline strip — ticker animado */
.tagline-strip {
  background: var(--green-light);
  border-bottom: 1px solid var(--green-line);
  padding: .4rem 0;
  font-size: .76rem;
  color: var(--green-dark);
  font-weight: 500;
  letter-spacing: .3px;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
}
.tagline-track {
  display: inline-block;
  white-space: nowrap;
  animation: ticker 22s linear infinite;
}
.tagline-track span { padding: 0 .6rem; }
.tagline-track .sep { opacity: .5; padding: 0 .2rem; }
@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--green-line); border-radius: 99px; }

/* Intro card */
.intro-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem 0 0 1.5rem;
  animation: msgIn .4s ease both;
  overflow: visible;
}
.intro-inner {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
}
.intro-text {
  flex: 1;
  padding-bottom: 1.5rem;
}
.intro-walder {
  flex-shrink: 0;
  width: 180px;
  align-self: flex-end;
}
.intro-walder img {
  width: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(76,175,80,.2));
}
.mascot-big {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--green-light);
  border: 2px solid var(--green-line);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .75rem;
  overflow: hidden;
}
.mascot-big img { width: 100%; height: 100%; object-fit: cover; }
.intro-card h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--green-dark);
  margin-bottom: .4rem;
  font-weight: 400;
}
.intro-card p {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: .75rem;
}

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  background: var(--green-light);
  color: var(--green-dark);
  font-size: .76rem;
  font-weight: 600;
  padding: .3rem .75rem;
  border-radius: 99px;
  border: 1px solid var(--green-line);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.chip:hover { background: var(--green); color: white; border-color: var(--green); }

/* Messages */
.msg {
  display: flex;
  align-items: flex-end;
  gap: .7rem;
  animation: msgIn .3s ease both;
  max-width: 82%;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.bot  { align-self: flex-start; }

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--green-light);
  border: 2px solid var(--green-line);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  margin-bottom: 2px;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.bubble {
  padding: .85rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: .93rem;
  line-height: 1.65;
  word-break: break-word;
}
.msg.bot .bubble {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}
.msg.user .bubble {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(76,175,80,.25);
}

/* Markdown inside bubble */
.bubble p { margin-bottom: .6rem; }
.bubble p:last-child { margin-bottom: 0; }
.bubble strong { font-weight: 700; color: var(--green-dark); }
.msg.user .bubble strong { color: rgba(255,255,255,.9); }
.bubble em { color: var(--text-muted); font-style: italic; }
.bubble code {
  background: var(--green-light);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .84em;
  font-family: monospace;
}
.bubble ol, .bubble ul { padding-left: 1.2rem; margin: .4rem 0; }
.bubble li { margin-bottom: .3rem; }

.suggestion-text {
  font-size: .82rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: .25rem;
}

/* Visual image from backend */
.visual-render {
  margin-top: 1rem;
  max-width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* Typing indicator */
.typing-wrap {
  display: flex;
  gap: .7rem;
  align-self: flex-start;
  animation: msgIn .3s ease both;
}
.typing-bubble {
  padding: .75rem 1.1rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: .3rem;
  align-items: center;
}
.typing-bubble span {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: bounce 1.3s infinite ease-in-out both;
}
.typing-bubble span:nth-child(1) { animation-delay: -.26s; }
.typing-bubble span:nth-child(2) { animation-delay: -.13s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(.4); opacity: .5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.chat-input-area {
  padding: 1rem 1.5rem 1.25rem;
  background: var(--white);
  border-top: 1.5px solid var(--border);
  flex-shrink: 0;
}
.input-row {
  display: flex;
  gap: .6rem;
  align-items: flex-end;
  background: var(--off-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: .45rem .45rem .45rem 1.1rem;
  transition: border-color .2s, box-shadow .2s;
}
.input-row:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(76,175,80,.10);
  background: var(--white);
}
.input-row textarea {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: .93rem;
  color: var(--text);
  resize: none;
  outline: none;
  max-height: 110px;
  padding: .4rem 0;
  line-height: 1.5;
}
.input-row textarea::placeholder { color: #b0c4b0; }
.btn-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(76,175,80,.3);
}
.btn-send:hover { transform: scale(1.08); box-shadow: 0 4px 14px rgba(76,175,80,.4); }
.btn-send:disabled { background: #ccc; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-send svg { width: 18px; height: 18px; stroke: white; fill: none; }
.input-footer {
  text-align: center;
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: .6rem;
  opacity: .7;
}

/* Responsive */
@media (max-width: 600px) {
  .intro-walder { display: none; }
  .intro-inner { flex-direction: column; }
  .chat-header { padding: .75rem 1rem; }
  .chat-messages { padding: 1rem; }
  .chat-input-area { padding: .75rem 1rem 1rem; }
  .tagline-strip { display: none; }
  /* Evita zoom automático do iOS Safari ao focar em inputs (precisa de 16px+) */
  .input-row textarea,
  .field input,
  .modal-input,
  .modal-field select {
    font-size: 16px;
  }
  /* Tap targets mínimos de 44px (acessibilidade mobile) */
  .chip {
    padding: .65rem 1rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .ctx-pill {
    padding: .6rem .9rem;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }
  .btn-logout {
    padding: .6rem 1rem;
    min-height: 40px;
  }
}
/* ══════════════════════════════════════════════════════════════════════════
   SIMULADO — Botão no header + Modal
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Botão Simulado no header ─────────────────────────────────────────── */
.btn-simulado {
  display: none; /* visível via JS */
  align-items: center;
  gap: 6px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.btn-simulado:hover { background: var(--green-dark); transform: translateY(-1px); }

.simulado-badge {
  background: #fff;
  color: var(--green-dark);
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

/* ── Overlay ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,43,26,.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* ── Caixa do modal ───────────────────────────────────────────────────── */
.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.modal-box-wide {
  max-width: 620px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.modal-close:hover { background: var(--green-light); }

/* ── Seções internas ──────────────────────────────────────────────────── */
.modal-section {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
}
.modal-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.modal-label-row .modal-label {
  margin-bottom: 0;
}
.questao-bulk-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.questao-bulk-actions button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--green-dark);
  border-radius: 999px;
  padding: 4px 9px;
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
}
.questao-bulk-actions button:hover {
  background: var(--green-light);
  border-color: var(--green-line);
}
.questao-search {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.questao-search input {
  flex: 1;
}
.questao-search button {
  border: 1px solid var(--green-line);
  background: var(--green);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.questao-search button:hover {
  background: var(--green-dark);
}

/* ── Lista de questões ────────────────────────────────────────────────── */
.questoes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}
.empty-list {
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .85rem;
  text-align: center;
  background: var(--off-white);
}
.questao-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--off-white);
  border: 1px solid var(--border);
  transition: background .15s;
}
.questao-item:hover { background: var(--green-light); }
.questao-item-found {
  background: var(--green-light);
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(46,125,50,.16);
}
.questao-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  cursor: pointer;
}
.questao-item input[type="checkbox"] {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.questao-delete {
  border: none;
  background: transparent;
  color: #D32F2F;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  opacity: .72;
  transition: background .15s, opacity .15s;
}
.questao-delete:hover {
  background: rgba(211,47,47,.1);
  opacity: 1;
}
.q-num {
  font-weight: 700;
  font-size: .72rem;
  color: var(--green-dark);
}
.q-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  font-weight: 800;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  white-space: nowrap;
}
.q-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.q-sub {
  font-size: .85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Campos da prova ──────────────────────────────────────────────────── */
.modal-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-input {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .88rem;
  color: var(--text);
  background: var(--off-white);
  transition: border-color .2s;
  outline: none;
}
.modal-input:focus { border-color: var(--green); background: #fff; }
.modal-input::placeholder { color: var(--text-muted); }

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.modal-field span {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.gerar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.modal-input[type="text"],
.modal-field select {
  min-height: 40px;
}

/* ── Botões de download ───────────────────────────────────────────────── */
.modal-actions {
  display: flex;
  gap: 10px;
  padding: 16px 22px;
}
.btn-modal-dl {
  flex: 1;
  padding: 11px 0;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
}
.btn-modal-dl:hover   { opacity: .88; transform: translateY(-1px); }
.btn-modal-dl:disabled{ opacity: .5; cursor: not-allowed; transform: none; }
.btn-modal-dl.prova    { background: var(--green);      color: #fff; }
.btn-modal-dl.gabarito { background: var(--green-dark); color: #fff; }

/* ── Status ───────────────────────────────────────────────────────────── */
.modal-status {
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
  padding: 0 22px 16px;
  min-height: 20px;
}

/* ── Barra de contexto externo (abaixo do input) ─────────────────────── */
.contexto-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .2rem .1rem;
  flex-wrap: wrap;
}
.contexto-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: .02em;
}
.contexto-pills {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}
.btn-gerar-controles {
  margin-left: auto;
  padding: .32rem .85rem;
  border-radius: 99px;
  border: 1.5px solid var(--green);
  background: var(--green);
  color: #fff;
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .15s;
  white-space: nowrap;
}
.btn-gerar-controles:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
}
.ctx-pill {
  padding: .22rem .7rem;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: transparent;
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.ctx-pill:hover {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-light);
}
.ctx-pill.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

@media (max-width: 600px) {
  .gerar-grid {
    grid-template-columns: 1fr;
  }
  .btn-gerar-controles {
    width: 100%;
    min-height: 40px;
    margin-left: 0;
  }
}
