:root {
  --bg:       #070710;
  --s1:       #0d0d1a;
  --s2:       #131322;
  --s3:       #1c1c30;
  --border:   rgba(255,255,255,0.07);
  --border2:  rgba(255,255,255,0.12);
  --cyan:     #00f0ff;
  --purple:   #8b5cf6;
  --pink:     #f472b6;
  --green:    #00ff9d;
  --red:      #ff4466;
  --yellow:   #fbbf24;
  --text:     #e2e2f0;
  --text2:    #e2e2f0;
  --text3:    #e2e2f0;
  --glow-c:   rgba(0,240,255,0.15);
  --glow-p:   rgba(139,92,246,0.15);
}
body.light-mode {
  --bg:       #f0f2f8;
  --s1:       #ffffff;
  --s2:       #f5f6fc;
  --s3:       #eaedf5;
  --border:   rgba(0,0,0,0.08);
  --border2:  rgba(0,0,0,0.15);
  --cyan:     #0077cc;
  --purple:   #7c3aed;
  --pink:     #db2777;
  --green:    #059669;
  --red:      #dc2626;
  --yellow:   #d97706;
  --text:     #111130;
  --text2:    #555577;
  --text3:    #111130;
  --glow-c:   rgba(0,119,204,0.08);
  --glow-p:   rgba(124,58,237,0.08);
}
/* ── MODAL ADICIONAR PIX (admin) ────────────────────────────── */
#modalAdicionarPix {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s ease both;
}
#modalAdicionarPix.open { display: flex; }
#modalAdicionarPix .map-box {
  background: var(--s1);
  border: 1px solid var(--border2);
  border-radius: 18px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
#modalAdicionarPix .map-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
#modalAdicionarPix .map-field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text2);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
#modalAdicionarPix .map-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
#modalAdicionarPix .map-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}



.cliente-card {
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cliente-card:hover {
  border-color: rgba(0,240,255,0.2);
  box-shadow: 0 4px 32px rgba(0,240,255,0.05);
}
.cliente-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
  background: var(--s2);
}
.cliente-avatar {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: conic-gradient(from 180deg, var(--purple), var(--cyan), var(--pink), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.cliente-body {
  display: none;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
}
.cliente-body.open { display: flex; }
.cli-tabs {
  display: flex;
  gap: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  background: var(--s1);
}
.cli-tabs::-webkit-scrollbar { height: 0; }
.cli-tab {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.3px;
  margin-bottom: -1px;
}
.cli-tab:hover { color: var(--text); }
.cli-tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.cli-pane { display: none; padding: 18px 20px; }
.cli-pane.active { display: block; }
.cli-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.cli-info-item {
  background: var(--s3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
.cli-info-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text2);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.cli-info-value {
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}
.inst-mini-card {
  background: var(--s3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.pix-row {
  background: var(--s3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
}
.pix-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.pix-status.paid { background: rgba(0,255,157,0.1); color: var(--green); border: 1px solid rgba(0,255,157,0.25); }
.pix-status.pending { background: rgba(251,191,36,0.1); color: var(--yellow); border: 1px solid rgba(251,191,36,0.25); }
.pix-status.expired { background: rgba(255,68,102,0.08); color: var(--red); border: 1px solid rgba(255,68,102,0.2); }
.cli-arq-inst-section { margin-bottom: 18px; }
.cli-arq-inst-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cli-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.nav-manual-pix {
  background: var(--s3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Botão de admin para registrar pagamento PIX manual */
.btn-pix-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,255,157,0.08);
  border: 1px solid rgba(0,255,157,0.25);
  border-radius: 8px;
  padding: 6px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-pix-add:hover { background: rgba(0,255,157,0.16); }

body.light-mode { background: var(--bg); color: var(--text); }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}
.glow-blob { position: fixed; border-radius: 50%; filter: blur(120px); pointer-events: none; z-index: 0; }
.glow-blob-1 { width: 600px; height: 600px; background: var(--glow-c); top: -200px; right: -100px; }
.glow-blob-2 { width: 500px; height: 500px; background: var(--glow-p); bottom: -150px; left: -100px; }
.wrap { position: relative; z-index: 1; max-width: 1500px; margin: 0 auto; padding: 28px 32px; }
header { display: flex; align-items: center; gap: 20px; margin-bottom: 36px; padding-bottom: 28px; border-bottom: 1px solid var(--border); animation: fadeDown 0.6s ease both; }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
.logo { width: 44px; height: 44px; background: conic-gradient(from 180deg, var(--cyan), var(--purple), var(--pink), var(--cyan)); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 700; color: #000; flex-shrink: 0; animation: rotateBorder 8s linear infinite; }
@keyframes rotateBorder { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }
.header-text h1 { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; background: linear-gradient(5deg, #fff , var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.header-text p { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text2); margin-top: 3px; letter-spacing: 0.5px; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.status-pill { display: flex; align-items: center; gap: 7px; background: rgba(0,255,157,0.08); border: 1px solid rgba(0,255,157,0.2); border-radius: 20px; padding: 5px 12px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--green); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 2s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--green); } 50% { opacity: 0.5; box-shadow: 0 0 4px var(--green); } }
.time-display { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text3); }
.grid { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.panel { background: var(--s1); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; animation: fadeUp 0.5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.panel:nth-child(2) { animation-delay: 0.1s; }
.panel:nth-child(3) { animation-delay: 0.2s; }
.panel-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.panel-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text2); }
.badge { margin-left: auto; background: var(--s3); border: 1px solid var(--border2); border-radius: 20px; padding: 2px 9px; font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--cyan); }
.instance-item { padding: 12px 18px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; align-items: center; gap: 10px; transition: background 0.15s; position: relative; }
.instance-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--cyan); transform: scaleY(0); transition: transform 0.2s; border-radius: 0 2px 2px 0; }
.instance-item:hover { background: rgba(255,255,255,0.03); }
.instance-item.active { background: rgba(0,240,255,0.04); }
.instance-item.active::before { transform: scaleY(1); }
.inst-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.inst-dot.open { background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 2s infinite; }
.inst-dot.close { background: var(--red); }
.inst-dot.connecting { background: var(--yellow); animation: blink 0.8s infinite; }
.inst-name { font-size: 13px; font-weight: 600; }
.inst-status { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text3); }
.input { flex: 1; background: var(--s3); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; color: var(--text); font-size: 12px; font-family: 'JetBrains Mono', monospace; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,240,255,0.08); }
.input::placeholder { color: var(--text3); }
.btn { background: var(--cyan); color: #000; border: none; border-radius: 10px; padding: 8px 16px; font-size: 12px; font-weight: 700; font-family: 'JetBrains Mono', monospace; cursor: pointer; transition: opacity 0.15s, transform 0.1s; white-space: nowrap; }
.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.97); }
.btn.ghost { background: var(--s3); color: var(--text); border: 1px solid var(--border2); }
.tabs { display: flex; gap: 0; padding: 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs::-webkit-scrollbar { height: 0; }
.tab { padding: 14px 18px; font-size: 12px; font-weight: 600; color: var(--text3); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; margin-bottom: -1px; letter-spacing: 0.3px; white-space: nowrap; }
.tab:hover { color: var(--text2); }
.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.tab-content { display: none; }
.nav-select {
  background: var(--s3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 160px;
}
.nav-select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,240,255,0.08); }
.nav-select option { background: var(--s2); color: var(--text); }
.inst-select-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.inst-select-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text2);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}
.tab-content.active { display: block; }
.conv-layout { display: grid; grid-template-columns: 260px 1fr; height: 440px; min-height: 0; overflow: hidden; }
.chat-area { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.conv-sidebar { border-right: 1px solid var(--border); overflow-y: auto; padding: 10px; }
.conv-sidebar::-webkit-scrollbar { width: 3px; }
.conv-sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.search-wrap { padding: 10px 18px 0; }
.search-input { width: 100%; background: var(--s3); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px 7px 32px; color: var(--text); font-size: 12px; font-family: 'JetBrains Mono', monospace; outline: none; transition: border-color 0.15s; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2344445a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 10px center; }
.search-input:focus { border-color: var(--cyan); }
.search-input::placeholder { color: var(--text3); }
.conv-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 10px; margin-bottom: 2px; transition: background 0.12s; }
.conv-item:hover { background: var(--s3); }
.conv-item.active { background: rgba(0,240,255,0.06); }
.conv-avatar { width: 36px; height: 36px; border-radius: 50%; background: conic-gradient(from 90deg, var(--purple), var(--cyan)); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; font-family: 'JetBrains Mono', monospace; }
.conv-info { flex: 1; min-width: 0; }
.conv-phone { font-size: 12px; font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.conv-last { font-size: 11px; color: var(--text3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 10px; color: var(--text3); font-family: 'JetBrains Mono', monospace; flex-shrink: 0; }
.chat-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; display: none; }
.chat-phone-label { font-size: 14px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.chat-app-label { font-size: 10px; color: var(--text3); margin-top: 2px; font-family: 'JetBrains Mono', monospace; letter-spacing: 1px; }
.chat-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.chat-info-row { padding: 6px 18px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 0; }
.interesse-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600;
  letter-spacing: 0.3px; white-space: nowrap;
  animation: msgIn 0.2s ease both;
}
.interesse-tag .tag-num {
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; flex-shrink: 0;
}
.icon-btn { width: 30px; height: 30px; background: var(--s3); border: 1px solid var(--border); border-radius: 8px; color: var(--text2); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 13px; transition: all 0.15s; }
.icon-btn:hover { border-color: var(--cyan); color: var(--cyan); }

/* ── Alerta de atendimento humano ── */
.tab-atendimento-alert {
  position: relative;
}
.tab-atendimento-alert::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 6px;
  border: 1px solid var(--pink);
  animation: alertPulse 1.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes alertPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(244,114,182,0.5); }
  50%       { opacity: 0.6; box-shadow: 0 0 0 5px rgba(244,114,182,0); }
}
.atendimento-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--pink); border-radius: 8px;
  font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700;
  color: #000; margin-left: 5px; vertical-align: middle;
}
.conv-item-alert {
  position: relative;
}
.conv-item-alert::before {
  content: '👤';
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 13px; animation: alertPulse 1.4s ease-in-out infinite;
}
.chat-messages { flex: 1; overflow-y: scroll; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.msg { max-width: 72%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.6; animation: msgIn 0.2s ease both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.msg.user { background: rgba(0,200,100,0.10); border: 1px solid rgba(0,200,100,0.25); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user .msg-sender { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: rgba(0,180,90,0.85); font-weight: 700; letter-spacing: 0.5px; margin-bottom: 4px; }
.msg.assistant { background: linear-gradient(135deg, rgba(0,240,255,0.08), rgba(139,92,246,0.08)); border: 1px solid rgba(0,240,255,0.15); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-time { font-size: 10px; color: var(--text3); font-family: 'JetBrains Mono', monospace; margin-top: 5px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text3); font-size: 13px; gap: 10px; padding: 40px; text-align: center; }
.empty-icon { font-size: 32px; opacity: 0.4; }
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--s1); border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px; animation: fadeUp 0.5s ease both; position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--cyan), var(--purple)); transform: scaleX(0); transform-origin: left; transition: transform 0.4s ease; }
.stat-card:hover::after { transform: scaleX(1); }
.stat-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; background: linear-gradient(0deg, #fff, var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text3); margin-top: 5px; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; padding: 16px; }
.file-card { background: var(--s2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; animation: fadeUp 0.4s ease both; }
.file-card:hover { border-color: rgba(0,240,255,0.3); transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,240,255,0.08); }
.file-preview { height: 110px; background: var(--s3); display: flex; align-items: center; justify-content: center; font-size: 32px; position: relative; overflow: hidden; }
.file-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-info { padding: 10px 12px; }
.file-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 10px; color: var(--text3); font-family: 'JetBrains Mono', monospace; margin-top: 3px; }
.file-status { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 4px; font-size: 9px; font-family: 'JetBrains Mono', monospace; margin-top: 5px; }
.file-status::before { content: '●'; font-size: 7px; }
.file-status.pronto { background: rgba(0,255,157,0.08); color: var(--green); }
.file-status.pronto::before { color: var(--green); }
.file-status.baixando { background: rgba(251,191,36,0.08); color: var(--yellow); }
.file-status.baixando::before { color: var(--yellow); animation: blink 0.8s infinite; }
.file-status.erro { background: rgba(255,68,102,0.08); color: var(--red); }
.file-status.erro::before { color: var(--red); }
.filter-bar { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-btn { background: var(--s3); border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px; font-size: 11px; font-family: 'JetBrains Mono', monospace; color: var(--text3); cursor: pointer; transition: all 0.15s; }
.filter-btn:hover { border-color: var(--border2); color: var(--text2); }
.filter-btn.active { background: rgba(0,240,255,0.08); border-color: rgba(0,240,255,0.3); color: var(--cyan); }
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.88); z-index: 100; align-items: center; justify-content: center; backdrop-filter: blur(8px); animation: fadeIn 0.2s ease; }
.modal.open { display: flex; }
body.light-mode .modal { background: rgba(80,80,120,0.45); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-inner { background: var(--s1); border: 1px solid var(--border2); border-radius: 20px; width: 92vw; max-width: 1000px; height: 82vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 40px 120px rgba(0,0,0,0.8); animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1); }
body.light-mode .modal-inner { background: var(--s2); box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
@keyframes modalIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-title { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text); }
.modal-close { margin-left: auto; background: var(--s3); border: 1px solid var(--border); color: var(--text2); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.modal-close:hover { border-color: var(--red); color: var(--red); }
#stl-container { flex: 1; min-height: 0; position: relative; }
#stl-canvas { width: 100%; height: 100%; display: block; }
.stl-controls { padding: 12px 22px; border-top: 1px solid var(--border); display: flex; gap: 16px; align-items: center; font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text3); }
.stl-controls span { display: flex; align-items: center; gap: 5px; }
.toggle-wrap { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--text3); }
.toggle { width: 32px; height: 18px; background: var(--s3); border: 1px solid var(--border2); border-radius: 9px; position: relative; cursor: pointer; transition: background 0.2s; }
.toggle.on { background: rgba(0,240,255,0.2); border-color: rgba(0,240,255,0.4); }
.toggle-knob { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; background: var(--text3); border-radius: 50%; transition: transform 0.2s, background 0.2s; }
.toggle.on .toggle-knob { transform: translateX(14px); background: var(--cyan); }
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .conv-layout { grid-template-columns: 1fr; height: auto; }
}
.input-auto {
  transition: height 0.3s ease;
  resize: none;
  overflow: hidden;
}

/* ── Botão ícone de download nos modais de render ── */
.modal-dl-btn {
  width: 32px; height: 32px;
  background: var(--s3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.modal-dl-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 0 3px var(--glow-c);
}
/* Render modals (STL/GLB/DXF): único botão de download empurrado p/ direita */
#stlDownloadBtn, #glbDownloadBtn, #dxfDownloadBtn {
  margin-left: auto;
  margin-right: 10px;
}

/* ── Botões flutuantes nos thumbs dos arquivos ── */
.fcard-btn {
  position: absolute;
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.fcard-btn:hover { opacity: 1 !important; }

/* Dark mode */
.fcard-dl {
  top: 6px; left: 6px;
  background: rgba(7,7,16,0.72);
  border: 1px solid rgba(0,240,255,0.45);
  color: #00f0ff;
}
.fcard-dl:hover { border-color: #00f0ff; box-shadow: 0 0 8px rgba(0,240,255,0.35); }

.fcard-del {
  top: 6px; right: 6px;
  background: rgba(7,7,16,0.72);
  border: 1px solid rgba(255,68,102,0.45);
  color: #ff4466;
}
.fcard-del:hover { border-color: #ff4466; box-shadow: 0 0 8px rgba(255,68,102,0.35); }

/* Light mode overrides */
body.light-mode .fcard-dl {
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(0,119,204,0.5);
  color: #0077cc;
}
body.light-mode .fcard-dl:hover { border-color: #0077cc; box-shadow: 0 0 8px rgba(0,119,204,0.25); }

body.light-mode .fcard-del {
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(220,38,38,0.5);
  color: #dc2626;
}
body.light-mode .fcard-del:hover { border-color: #dc2626; box-shadow: 0 0 8px rgba(220,38,38,0.25); }

/* SVG nos botões herda cor do pai */
.fcard-btn svg, .modal-dl-btn svg { display: block; flex-shrink: 0; }

/* Preview modal de imagem/PDF */
#previewModal .modal-inner { max-width: 92vw; max-height: 90vh; height: auto; }
#previewModal img { max-width: 100%; max-height: 75vh; object-fit: contain; border-radius: 8px; display: block; margin: 0 auto; }
#previewModal iframe { width: 100%; height: 72vh; border: none; border-radius: 8px; background: var(--s2); }

/* ── MENU HAMBÚRGUER ── */
#menuWrapper { position: relative; }
#btnMenu { width:36px; height:36px; background:var(--s3); border:1px solid var(--border2); border-radius:10px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px; cursor:pointer; padding:0; transition:border-color .2s,box-shadow .2s; }
#btnMenu:hover { border-color:var(--cyan); box-shadow:0 0 10px rgba(0,240,255,0.12); }
#btnMenu span { display:block; width:16px; height:1.5px; background:var(--text); border-radius:2px; transition:all .25s; }
#btnMenu.aberto span:nth-child(1) { transform:translateY(6.5px) rotate(45deg); }
#btnMenu.aberto span:nth-child(2) { opacity:0; transform:scaleX(0); }
#btnMenu.aberto span:nth-child(3) { transform:translateY(-6.5px) rotate(-45deg); }
#menuDropdown { display:none; position:fixed; background:var(--s1); border:1px solid var(--border2); border-radius:14px; min-width:200px; z-index:10000; overflow:hidden; box-shadow:0 12px 40px rgba(0,0,0,0.5); animation:fadeDown .18s ease both; }
#menuDropdown.aberto { display:block; }
.menu-header { font-family:'JetBrains Mono',monospace; font-size:10px; letter-spacing:2px; text-transform:uppercase; color:var(--cyan); padding:12px 16px 8px; border-bottom:1px solid var(--border); }
.menu-item { display:flex; align-items:center; gap:10px; padding:11px 16px; font-size:13px; font-weight:600; color:var(--text); text-decoration:none; cursor:pointer; transition:background .15s,color .15s; font-family:'Syne',sans-serif; }
.menu-item:hover { background:rgba(0,240,255,0.06); color:var(--cyan); }
.menu-divider { height:1px; background:var(--border); margin:4px 0; }

/* ── DRAWER LATERAL ── */
#drawerOverlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.55); z-index:600; backdrop-filter:blur(2px); }
#drawerOverlay.aberto { display:block; }
#drawer { position:fixed; top:0; right:-440px; bottom:0; width:420px; max-width:96vw; background:var(--s1); border-left:1px solid var(--border2); z-index:700; display:flex; flex-direction:column; transition:right .3s cubic-bezier(.4,0,.2,1); box-shadow:-8px 0 40px rgba(0,0,0,0.5); }
#drawer.aberto { right:0; }
#drawerHeader { display:flex; align-items:center; justify-content:space-between; padding:18px 20px; border-bottom:1px solid var(--border); flex-shrink:0; }
#drawerTitulo { font-family:'Syne',sans-serif; font-size:15px; font-weight:700; background:linear-gradient(5deg,#fff ,var(--cyan)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
#drawerFechar { width:30px; height:30px; background:var(--s3); border:1px solid var(--border); border-radius:8px; color:var(--text2); cursor:pointer; font-size:14px; display:flex; align-items:center; justify-content:center; transition:all .15s; }
#drawerFechar:hover { border-color:var(--red); color:var(--red); }
#drawerConteudo { flex:1; overflow-y:auto; padding:20px; font-family:'Syne',sans-serif; font-size:14px; color:var(--text); line-height:1.7; }
#drawerConteudo::-webkit-scrollbar { width:3px; }
#drawerConteudo::-webkit-scrollbar-thumb { background:var(--border2); border-radius:2px; }
#drawerConteudo h2 { font-size:16px; font-weight:700; color:var(--cyan); margin-bottom:12px; }
#drawerConteudo h3 { font-size:11px; font-weight:700; color:var(--text2); margin:16px 0 6px; text-transform:uppercase; letter-spacing:1px; font-family:'JetBrains Mono',monospace; }
#drawerConteudo p { color:var(--text2); margin-bottom:10px; font-size:13px; }
#drawerConteudo a { color:var(--cyan); text-decoration:none; }
#drawerConteudo a:hover { text-decoration:underline; }

/* ── PIX / PREMIUM ── */
#pixArea { text-align:center; margin-bottom:20px; }
#qrPlaceholder { width:180px; height:180px; border-radius:12px; border:2px dashed var(--cyan); padding:8px; background:rgba(0,240,255,0.03); display:flex; align-items:center; justify-content:center; margin:0 auto; }
#imgQrCode { display:none; width:180px; height:180px; border-radius:12px; border:3px solid var(--green); padding:8px; background:#fff; }
#pixStatusText { color:var(--cyan); font-size:.85rem; margin-top:10px; font-weight:600; font-family:'JetBrains Mono',monospace; }
#pixCopiaColaArea { display:none; margin-top:12px; }
#inputCopiaCola { width:100%; background:var(--s3); border:1px solid var(--border2); border-radius:8px; padding:8px 10px; color:var(--text); font-size:11px; font-family:'JetBrains Mono',monospace; }
#btnCopiarPix { margin-top:6px; width:100%; background:var(--s3); border:1px solid var(--border2); border-radius:8px; padding:8px; color:var(--cyan); font-size:12px; font-family:'JetBrains Mono',monospace; font-weight:700; cursor:pointer; transition:all .15s; }
#btnCopiarPix:hover { background:rgba(0,240,255,0.08); border-color:var(--cyan); }
#infoAcessoPix { background:linear-gradient(135deg,var(--s2),var(--s3)); border:1px solid var(--cyan); border-radius:12px; padding:20px; text-align:center; margin-top:16px; }
#btnGerarPixReal { width:100%; padding:14px; border:none; border-radius:8px; font-size:1rem; font-weight:800; font-family:'JetBrains Mono',monospace; cursor:not-allowed; background:var(--s3); color:var(--text2); transition:all .2s; }
#btnGerarPixReal:not(:disabled) { background:var(--green); color:#000; cursor:pointer; box-shadow:0 4px 20px rgba(0,255,157,0.3); }
.drawer-spinner { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:50px 20px; gap:12px; color:var(--text2); font-family:'JetBrains Mono',monospace; font-size:12px; }
.drawer-spinner::before { content:''; width:28px; height:28px; border:2px solid var(--border2); border-top-color:var(--cyan); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }