/* ============================================================
   IBRATIN – CHATBOT – CSS COMPLETO v4
   ============================================================ */

:root {
  --hero-l:    #0B2E3C;
  --hero-m:    #0D5560;
  --hero-r:    #12847A;

  --orange:       #F24A14;
  --orange-h:     #D93E0E;
  --orange-light: #FFF0EB;

  --teal:      #0D7A70;
  --teal-l:    #13A99A;
  --teal-dark: #095E56;

  --green-bg:   #D4F5DC; --green-txt:  #1A7A3C;
  --blue-bg:    #DCEFFE; --blue-txt:   #1A4F8A;
  --orange-bg:  #FFE9DE; --orange-txt: #B03A10;
  --purple-bg:  #EDE5FF; --purple-txt: #5B35A0;
  --red-bg:     #FFE0DF; --red-txt:    #BF1212;
  --gray-bg:    #E8ECF0; --gray-txt:   #485664;

  --white:  #FFFFFF;
  --bg:     #F3F6F9;
  --bg2:    #EDF0F4;
  --border: #DEE3EA;
  --text:   #18232E;
  --muted:  #6A7A8A;
  --light:  #9BAAB7;

  --r-pill: 999px;
  --r-card: 14px;
  --r-sm:   10px;
  --shadow: 0 2px 14px rgba(0,0,0,.09);
  --shadow-card: 0 1px 6px rgba(0,0,0,.07);
  --shadow-hover: 0 8px 28px rgba(0,0,0,.13);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════════════
   PAGES
══════════════════════════════════════════════════════ */
.page { display: none; min-height: 100vh; }
.page.active { display: block; }

/* ══════════════════════════════════════════════════════
   HERO HEADER
══════════════════════════════════════════════════════ */
.hero-header {
  background: linear-gradient(110deg, var(--hero-l) 0%, var(--hero-m) 45%, var(--hero-r) 100%);
  padding: 40px 48px 44px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
}

.hero-inner { flex: 1; max-width: 660px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-pill);
  padding: 7px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: rgba(255,255,255,.9);
  margin-bottom: 20px;
}

.hero-title {
  font-size: 38px;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 14px;
  letter-spacing: -.5px;
}

.hero-title-accent { color: #FF7A2E; }

.hero-sub {
  font-size: 15px;
  color: rgba(255,255,255,.62);
  line-height: 1.65;
  max-width: 560px;
  margin-bottom: 30px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.hero-actions.row1 { margin-bottom: 10px; }

/* Botão primário */
.hbtn-primary {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 26px;
  background: var(--orange);
  border: none;
  border-radius: var(--r-pill);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background .18s, transform .12s, box-shadow .18s;
  box-shadow: 0 4px 18px rgba(242,74,20,.45);
  white-space: nowrap;
}
.hbtn-primary:hover { background: var(--orange-h); transform: translateY(-1px); box-shadow: 0 6px 22px rgba(242,74,20,.55); }
.hbtn-primary:active { transform: translateY(0); }

/* Botão ghost */
.hbtn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  background: rgba(255,255,255,.08);
  border: 1.5px solid rgba(255,255,255,.22);
  border-radius: var(--r-pill);
  color: rgba(255,255,255,.88);
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.hbtn-ghost:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.4); color: #fff; }
.hbtn-ghost.sm { padding: 9px 16px; font-size: 13px; }

/* ── ESTATÍSTICAS DO HERO ── */
.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: center;
  flex-shrink: 0;
}

.hstat {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  padding: 14px 20px;
  text-align: center;
  min-width: 100px;
  backdrop-filter: blur(4px);
  transition: background .2s;
}
.hstat:hover { background: rgba(255,255,255,.15); }
.hstat-n { display: block; font-size: 24px; font-weight: 800; color: #fff; line-height: 1; }
.hstat-l { display: block; font-size: 10.5px; color: rgba(255,255,255,.6); font-weight: 500; margin-top: 4px; letter-spacing: .5px; }

/* ══════════════════════════════════════════════════════
   FILTROS
══════════════════════════════════════════════════════ */
.filter-section {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  position: sticky;
  top: 0;
  z-index: 50;
}

.filter-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 48px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 8px;
  gap: 0;
}

.filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-right: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all .16s;
  white-space: nowrap;
  box-shadow: var(--shadow-card);
}
.chip:hover { border-color: var(--teal); color: var(--teal); }
.chip.active { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 700; box-shadow: 0 3px 12px rgba(242,74,20,.3); }
.chip.active:hover { background: var(--orange-h); border-color: var(--orange-h); }

.sim-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  padding-left: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   GRID DE SIMULAÇÕES
══════════════════════════════════════════════════════ */
.flows-area {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 40px 60px;
}

.flows-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

/* ── CARD ── */
.sim-card {
  background: var(--white);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow .2s, transform .18s;
  display: flex;
  flex-direction: column;
}
.sim-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }

/* Barra de cor no topo do card */
.sim-card-topbar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
}
.sim-card-topbar.green  { background: var(--green-bg);  color: var(--green-txt); }
.sim-card-topbar.blue   { background: var(--blue-bg);   color: var(--blue-txt); }
.sim-card-topbar.orange { background: var(--orange-bg); color: var(--orange-txt); }
.sim-card-topbar.purple { background: var(--purple-bg); color: var(--purple-txt); }
.sim-card-topbar.red    { background: var(--red-bg);    color: var(--red-txt); }
.sim-card-topbar.gray   { background: var(--gray-bg);   color: var(--gray-txt); }

/* ── PREVIEW WHATSAPP ── */
.sim-card-chat { flex: 1; }

.wpp-bg {
  background: #EAE0D5;
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,.04) 1px, transparent 0);
  background-size: 18px 18px;
  padding: 12px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 190px;
  max-height: 220px;
  overflow: hidden;
}

.wpp-ts-row { display: flex; justify-content: center; margin: 2px 0; }
.wpp-ts {
  font-size: 10px;
  color: rgba(0,0,0,.4);
  background: rgba(255,255,255,.6);
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 500;
}

.wpp-bubble {
  max-width: 88%;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.wpp-bubble.bot {
  background: #FFFFFF;
  color: #111B21;
  align-self: flex-start;
  border-top-left-radius: 3px;
}
.wpp-bubble.user {
  background: #DCF8C6;
  color: #111B21;
  align-self: flex-end;
  border-top-right-radius: 3px;
  margin-left: auto;
}

/* Opções dentro da bolha */
.wpp-opts { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.wpp-option {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #111B21;
  padding: 2px 0;
}
.wpp-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  background: #0D7A70;
  color: #fff;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  flex-shrink: 0;
}
.wpp-link { color: #0D7A70; font-weight: 600; font-size: 12px; text-decoration: underline; }

/* ── RODAPÉ DO CARD ── */
.sim-card-footer {
  border-top: 1px solid var(--border);
  padding: 11px 14px;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sim-card-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sim-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sim-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

.btn-ver {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--white);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all .16s;
  white-space: nowrap;
}
.btn-ver:hover { border-color: var(--teal); color: var(--teal); background: rgba(13,122,112,.04); }

.btn-jpg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--orange);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background .16s, transform .12s, box-shadow .16s;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(242,74,20,.25);
  position: relative;
}
.btn-jpg:hover {
  background: var(--orange-h);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(242,74,20,.38);
}
.btn-jpg:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(242,74,20,.2); }
/* Tooltip do botão JPG */
.btn-jpg::after {
  content: "Baixar conversa completa";
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: #18232E;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.btn-jpg:hover::after { opacity: 1; }

/* Badges de categoria */
.sim-badge {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .6px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  flex-shrink: 0;
}
.sim-badge.green  { background: var(--green-bg);  color: var(--green-txt); }
.sim-badge.blue   { background: var(--blue-bg);   color: var(--blue-txt); }
.sim-badge.orange { background: var(--orange-bg); color: var(--orange-txt); }
.sim-badge.purple { background: var(--purple-bg); color: var(--purple-txt); }
.sim-badge.red    { background: var(--red-bg);    color: var(--red-txt); }
.sim-badge.gray   { background: var(--gray-bg);   color: var(--gray-txt); }

/* ══════════════════════════════════════════════════════
   CHAT PAGE
══════════════════════════════════════════════════════ */
#page-chat {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* TOPBAR */
.chat-topbar {
  background: linear-gradient(110deg, var(--hero-l) 0%, var(--hero-m) 50%, var(--hero-r) 100%);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,.22);
  flex-shrink: 0;
  z-index: 10;
}

.topbar-back, .topbar-hist {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: rgba(255,255,255,.1);
  border: 1.5px solid rgba(255,255,255,.2);
  border-radius: var(--r-pill);
  color: rgba(255,255,255,.9);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background .18s;
  white-space: nowrap;
}
.topbar-back:hover, .topbar-hist:hover { background: rgba(255,255,255,.2); color: #fff; }

.topbar-center { display: flex; align-items: center; gap: 10px; }
.topbar-avatar {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff;
  border: 1.5px solid rgba(255,255,255,.22);
}
.topbar-name { font-size: 14px; font-weight: 700; color: #fff; }
.topbar-status { font-size: 11px; color: rgba(255,255,255,.65); display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.status-dot { width: 7px; height: 7px; background: #4ade80; border-radius: 50%; animation: pulse-dot 2s infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

.topbar-atend {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--r-pill);
  color: rgba(255,255,255,.85);
  font-size: 12.5px;
  font-weight: 600;
  cursor: default;
}
.topbar-atend #atend-count { font-weight: 800; }

/* CHAT WRAP */
.chat-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 20px 24px;
  min-height: 0;
  overflow: hidden;
}

.chat-panel {
  width: 100%;
  max-width: 700px;
  background: var(--white);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* LOGIN OVERLAY */
.login-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11,46,60,.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: var(--r-card);
}

.login-box {
  background: var(--white);
  border-radius: 18px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
  animation: slideUp .25s ease;
}

.lb-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--teal-l), var(--teal-dark));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff;
  margin: 0 auto 18px;
  box-shadow: 0 8px 24px rgba(13,122,112,.4);
}

.login-box h2 { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.login-box p { font-size: 13px; color: var(--muted); margin-bottom: 24px; line-height: 1.5; }

.lb-input-wrap {
  position: relative;
  margin-bottom: 14px;
}
.lb-input-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--light);
  font-size: 14px;
}
.login-box input {
  width: 100%;
  padding: 13px 16px 13px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.login-box input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,122,112,.12); background: #fff; }

.login-box button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--teal-l), var(--teal-dark));
  border: none;
  border-radius: var(--r-sm);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(13,122,112,.4);
  margin-bottom: 14px;
}
.login-box button:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(13,122,112,.5); }
.login-box button:active { transform: translateY(0); }

.lb-hint {
  font-size: 11.5px;
  color: var(--light);
  line-height: 1.5;
}

/* MENSAGENS */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.msg-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: fadeUp .22s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-row.bot  { align-self: flex-start; max-width: 88%; }
.msg-row.user { align-self: flex-end;   flex-direction: row-reverse; max-width: 76%; }

.tyi-avatar, .msg-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--teal-l), var(--teal-dark));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff;
  flex-shrink: 0;
}

.bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
}
.bubble.bot {
  background: var(--white);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.bubble.user {
  background: var(--teal);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble strong { font-weight: 700; }
.bubble em { color: var(--muted); font-style: normal; font-size: 12.5px; }
.bubble a { color: var(--teal); text-decoration: underline; }
.bubble.user a { color: rgba(255,255,255,.9); }

/* DATE STAMP */
.date-stamp {
  align-self: center;
  font-size: 11px;
  color: var(--light);
  background: var(--bg2);
  border-radius: 20px;
  padding: 4px 14px;
  margin: 4px 0 10px;
  font-weight: 500;
}

/* SUCCESS CARD */
.success-card {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1.5px solid #86efac;
  border-radius: 12px;
  padding: 13px 15px;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.7;
}
.sc-title {
  font-weight: 700;
  color: #15803d;
  font-size: 13px;
  margin-bottom: 10px;
}
.sc-body {
  background: rgba(255,255,255,.75);
  border-radius: 9px;
  padding: 10px 12px;
}
.sc-body span { display: block; margin-bottom: 3px; color: var(--text); font-size: 12.5px; }
.sc-body span:last-child { margin-bottom: 0; }
.sc-divider { border: none; border-top: 1px solid rgba(0,0,0,.08); margin: 8px 0; }
.sc-protocol-row { font-size: 12px; color: var(--muted); line-height: 1.8; }
.sc-prot-code { font-weight: 700; color: var(--teal); font-size: 12.5px; }

.priority-high { background: linear-gradient(135deg, #fff5f5, #fee2e2); border-color: #fca5a5; }
.priority-high .sc-title { color: #dc2626; }
.priority-high .sc-prot-code { color: #dc2626; }

/* TYPING */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  flex-shrink: 0;
}
.dots { display: flex; gap: 4px; }
.dots span {
  width: 6px; height: 6px;
  background: var(--light);
  border-radius: 50%;
  animation: bounce 1.3s infinite ease-in-out;
}
.dots span:nth-child(2) { animation-delay: .18s; }
.dots span:nth-child(3) { animation-delay: .36s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* INPUT AREA */
.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 12px 16px 14px;
  flex-shrink: 0;
  background: var(--white);
}
.input-row { display: flex; gap: 8px; align-items: center; }

#chat-input {
  flex: 1;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#chat-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,122,112,.10); background: #fff; }
#chat-input:disabled { opacity: .5; cursor: not-allowed; }

#btn-send {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--teal-l), var(--teal-dark));
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(13,122,112,.35);
  transition: transform .15s, box-shadow .15s;
  flex-shrink: 0;
}
#btn-send:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(13,122,112,.45); }
#btn-send:active { transform: scale(.95); }

.quick-buttons { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }

.qbtn {
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--white);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  box-shadow: var(--shadow-card);
}
.qbtn:hover { border-color: var(--teal); color: var(--teal); background: rgba(13,122,112,.04); transform: translateY(-1px); }
.qbtn:active { transform: translateY(0); }
.qbtn.danger { border-color: #fca5a5; color: #dc2626; }
.qbtn.danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }

/* ══════════════════════════════════════════════════════
   ARQUITETURA
══════════════════════════════════════════════════════ */
.subpage-header {
  background: linear-gradient(110deg, var(--hero-l), var(--hero-m), var(--hero-r));
  padding: 20px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.subpage-header h2 { color: #fff; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }

.arq-content {
  max-width: 1000px;
  margin: 32px auto;
  padding: 0 32px 60px;
}

/* Diagrama */
.arq-diagram {
  background: var(--white);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  padding: 32px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
}

.arq-root-node {
  background: linear-gradient(135deg, var(--teal-l), var(--teal-dark));
  border-radius: 16px;
  padding: 18px 32px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(13,122,112,.3);
}
.arq-root-icon { font-size: 28px; color: #fff; margin-bottom: 6px; }
.arq-root-label { font-size: 17px; font-weight: 800; color: #fff; }
.arq-root-sub { font-size: 11.5px; color: rgba(255,255,255,.7); margin-top: 3px; }

.arq-connector-v {
  width: 2px;
  height: 28px;
  background: var(--border);
  margin: 0 auto;
}

.arq-branches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
  margin-top: 4px;
}

.arq-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.arq-connector-h {
  width: 2px;
  height: 20px;
  background: var(--border);
}

.arq-dept-node {
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  width: 100%;
  cursor: default;
}
.arq-dept-icon { font-size: 20px; margin-bottom: 4px; }
.arq-dept-label { font-size: 12.5px; font-weight: 700; }
.arq-dept-node.blue   { background: var(--blue-bg);   color: var(--blue-txt); }
.arq-dept-node.orange { background: var(--orange-bg); color: var(--orange-txt); }
.arq-dept-node.purple { background: var(--purple-bg); color: var(--purple-txt); }
.arq-dept-node.red    { background: var(--red-bg);    color: var(--red-txt); }

.arq-subnodes { display: flex; flex-direction: column; gap: 5px; width: 100%; }
.arq-sub {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.arq-sub:hover { background: var(--teal); color: #fff; border-color: var(--teal); transform: translateX(2px); }
.arq-sub-num {
  width: 18px; height: 18px;
  background: var(--border);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.arq-sub:hover .arq-sub-num { background: rgba(255,255,255,.25); color: #fff; }

.arq-fallback-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  width: 100%;
  justify-content: center;
}
.arq-fallback-node {
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-txt);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all .15s;
}
.arq-fallback-node:hover { background: var(--teal); color: #fff; border-color: var(--teal); transform: translateY(-2px); }

/* Legenda */
.arq-legend {
  background: var(--white);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  padding: 24px 28px;
  box-shadow: var(--shadow-card);
}
.arq-legend h3 {
  font-size: 14px; font-weight: 700; color: var(--teal);
  margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.arq-legend-grid {
  display: grid; grid-template-columns: repeat(2,1fr); gap: 12px;
  margin-bottom: 16px;
}
.arq-legend-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px; background: var(--bg); border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.alg-icon { font-size: 22px; flex-shrink: 0; line-height: 1; }
.arq-legend-item strong { display: block; font-size: 12.5px; color: var(--text); margin-bottom: 2px; }
.arq-legend-item div { font-size: 12px; color: var(--muted); line-height: 1.5; }
.arq-hint {
  font-size: 12px; color: var(--muted);
  background: var(--bg2); border-radius: 8px; padding: 10px 14px;
  display: flex; align-items: center; gap: 8px;
}

/* ══════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 16px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--white);
  border-radius: var(--r-card);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.22);
  animation: slideUp .22s ease;
}
@keyframes slideUp {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 14.5px; font-weight: 700; color: var(--teal); display: flex; align-items: center; gap: 8px; }
.modal-header-actions { display: flex; align-items: center; gap: 8px; }

.modal-close {
  width: 30px; height: 30px;
  border: none; background: var(--bg2); border-radius: 8px;
  cursor: pointer; color: var(--muted); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background .18s;
}
.modal-close:hover { background: var(--border); }

.modal-body { overflow-y: auto; padding: 16px 20px; flex: 1; }
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.modal-loading, .modal-empty {
  text-align: center; padding: 36px;
  color: var(--muted); font-size: 13.5px;
}
.modal-empty i { font-size: 30px; display: block; margin-bottom: 12px; opacity: .3; }

/* Protocol items */
.protocol-item {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  margin-bottom: 8px;
  background: var(--bg);
  transition: box-shadow .18s;
}
.protocol-item:hover { box-shadow: var(--shadow); border-color: #CBD2DA; }
.pi-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.pi-code { font-weight: 700; color: var(--teal); font-size: 13.5px; }
.pi-badge { font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.pi-badge.normal { background: var(--blue-bg); color: var(--blue-txt); }
.pi-badge.alta   { background: var(--red-bg);  color: var(--red-txt); }
.pi-type  { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.pi-dept  { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.pi-date  { font-size: 11px; color: var(--light); }

/* Modal WhatsApp – conversa completa */
.modal-wpp { max-width: 500px; }

.modal-wpp .modal-body {
  padding: 0;
  background: #EAE0D5;
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,.04) 1px, transparent 0);
  background-size: 18px 18px;
  max-height: 65vh;
  overflow-y: auto;
}
.modal-wpp .modal-body::-webkit-scrollbar { width: 5px; }
.modal-wpp .modal-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 10px; }

/* Cabeçalho estilo WhatsApp dentro do modal */
.modal-wpp-header {
  background: linear-gradient(110deg, #0B2E3C, #0D5560, #12847A);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.modal-wpp-avatar {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.18);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
  border: 2px solid rgba(255,255,255,.25);
  flex-shrink: 0;
}
.modal-wpp-name  { font-size: 13.5px; font-weight: 700; color: #fff; }
.modal-wpp-status { font-size: 11px; color: rgba(255,255,255,.65); margin-top: 1px; }

.modal-wpp-chat {
  padding: 16px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Badge do fluxo */
.modal-wpp-fluxo-badge {
  align-self: center;
  background: rgba(0,0,0,.12);
  color: rgba(0,0,0,.55);
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 10px;
  letter-spacing: .4px;
}

.modal-wpp-msg-time {
  font-size: 10.5px;
  color: rgba(0,0,0,.42);
  background: rgba(255,255,255,.65);
  padding: 2px 10px;
  border-radius: 8px;
  align-self: center;
  margin: 5px 0 3px;
  font-weight: 500;
}
.modal-wpp-msg {
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0,0,0,.13);
  margin-bottom: 1px;
}
.modal-wpp-msg.bot  {
  background: #FFFFFF;
  color: #111B21;
  align-self: flex-start;
  border-top-left-radius: 3px;
}
.modal-wpp-msg.user {
  background: #DCF8C6;
  color: #111B21;
  align-self: flex-end;
  border-top-right-radius: 3px;
  margin-left: auto;
}

/* Footer info no modal */
.modal-wpp-info {
  background: rgba(0,0,0,.06);
  padding: 8px 14px;
  text-align: center;
  font-size: 10.5px;
  color: rgba(0,0,0,.38);
  font-weight: 500;
  letter-spacing: .3px;
  flex-shrink: 0;
}

/* Botão de download */
.btn-jpg-modal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--orange), var(--orange-h));
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: opacity .16s, transform .12s, box-shadow .16s;
  box-shadow: 0 3px 14px rgba(242,74,20,.35);
  white-space: nowrap;
}
.btn-jpg-modal:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 5px 18px rgba(242,74,20,.45); }
.btn-jpg-modal:active { transform: translateY(0); }

/* ══════════════════════════════════════════════════════
   EXPORT OVERLAY
══════════════════════════════════════════════════════ */
.export-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
}
.export-box {
  background: var(--white);
  border-radius: 16px;
  padding: 36px 44px;
  text-align: center;
  min-width: 320px;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.export-spinner { font-size: 32px; color: var(--teal); margin-bottom: 14px; }
.export-msg { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 16px; }
.export-progress {
  height: 6px; background: var(--bg2); border-radius: 10px; overflow: hidden;
}
.export-bar {
  height: 100%; background: linear-gradient(90deg, var(--teal-l), var(--orange));
  border-radius: 10px; width: 0%;
  transition: width .3s ease;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #1E2D3A;
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--r-pill);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 8px 28px rgba(0,0,0,.28);
  z-index: 400;
  animation: slideInToast .25s ease;
  max-width: 340px;
}
@keyframes slideInToast {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .hero-stats { display: none; }
  .hero-header { padding: 30px 24px 36px; }
  .hero-title { font-size: 30px; }
  .filter-inner { padding: 12px 20px; }
  .flows-area { padding: 18px 16px 40px; }
  .flows-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
  .arq-branches { grid-template-columns: repeat(2, 1fr); }
  .arq-legend-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hero-header { flex-direction: column; padding: 24px 16px 28px; }
  .hero-title  { font-size: 24px; }
  .hero-sub    { font-size: 13.5px; }
  .hbtn-primary, .hbtn-ghost { padding: 10px 16px; font-size: 13px; }
  .flows-grid  { grid-template-columns: 1fr; }
  .arq-branches { grid-template-columns: 1fr; }
  .chat-topbar { padding: 0 12px; }
  .topbar-atend { display: none; }
  .topbar-hist  { font-size: 12px; padding: 7px 12px; }
  .chat-wrap   { padding: 8px; }
  .arq-fallback-row { flex-direction: column; }
}
