:root{
  /* Cores da empresa */
  --primary: #ec0b2b;
  --ink: #1d2027;
  --ink-soft: #6b7280;
  --line: #e6e8ee;
  --bg-soft: #f6f7fb;
  --white: #ffffff;
  --grad-warm: linear-gradient(135deg, #ec0b2b 0%, #e23d1d 55%, #f26a21 100%);
  --grad-warm-shadow: rgba(233, 70, 26, .45);

  /* Mapeamento para o tema da página */
  --ink-2: #2d3340;
  --ink-3: #3a4150;
  --paper: var(--white);
  --paper-dim: var(--bg-soft);
  --gold: var(--primary);
  --gold-soft: rgba(236,11,43,0.16);
  --teal: var(--primary);
  --teal-soft: rgba(236,11,43,0.14);
  --slate: var(--ink-soft);
  --ink-text: var(--ink);
  --danger: var(--primary);
  --line-dark: rgba(29,32,39,0.12);
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background: var(--ink);
  color: var(--paper);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.mono{ font-family:'JetBrains Mono', monospace; }
.serif{ font-family:'Fraunces', serif; }

/* ---------- Layout shells ---------- */
#app{ position:relative; min-height:100vh; }
.view{ display:none; min-height:100vh; }
.view.active{ display:block; }

/* ---------- Public view ---------- */
#publicView.active{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:32px 20px 90px;
  text-align:center;
  position:relative;
  overflow:hidden;
}
.stage-glow{
  position:absolute;
  top:-20%;
  left:50%;
  transform:translateX(-50%);
  width:900px;
  height:900px;
  background:radial-gradient(circle at 50% 35%, rgba(236,11,43,0.28) 0%, rgba(242,106,33,0.12) 38%, transparent 65%);
  pointer-events:none;
}
.brand-logo{
  max-width:180px;
  max-height:64px;
  width:auto;
  height:auto;
  margin-bottom:22px;
  position:relative;
}
.eyebrow{
  font-family:'JetBrains Mono', monospace;
  letter-spacing:0.06em;
  font-size:12px;
  color:var(--gold);
  margin-bottom:18px;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.eyebrow .dot{ width:6px;height:6px;border-radius:50%;background:var(--grad-warm); flex-shrink:0; }
.headline{
  font-family:'Fraunces', serif;
  font-optical-sizing:auto;
  font-weight:600;
  font-size:clamp(30px,6vw,52px);
  line-height:1.08;
  margin:0 0 14px;
  max-width:640px;
}
.subhead{
  color:var(--slate);
  font-size:16px;
  line-height:1.6;
  max-width:440px;
  margin:0 0 34px;
}
.counter-pill{
  display:inline-flex;
  align-items:center;
  gap:10px;
  background:var(--ink-2);
  border:1px solid var(--line);
  padding:10px 20px;
  border-radius:100px;
  margin-bottom:40px;
}
.counter-pill .live-dot{
  width:7px; height:7px; border-radius:50%;
  background:var(--primary);
  box-shadow:0 0 0 rgba(236,11,43,0.5);
  animation: pulse 2s infinite;
  flex-shrink:0;
}
@keyframes pulse{
  0%{ box-shadow:0 0 0 0 rgba(236,11,43,0.5); }
  70%{ box-shadow:0 0 0 7px rgba(236,11,43,0); }
  100%{ box-shadow:0 0 0 0 rgba(236,11,43,0); }
}
.counter-pill .num{ font-family:'JetBrains Mono', monospace; color:var(--gold); font-size:15px; font-weight:600; line-height:1; position:relative; top:1px; }
.counter-pill .lbl{ font-size:13px; color:var(--slate); line-height:1; }

.btn{
  font-family:'Inter', sans-serif;
  font-weight:600;
  font-size:15px;
  border:none;
  cursor:pointer;
  border-radius:12px;
  padding:16px 30px;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:active{ transform: scale(0.97); }
.btn-gold{ background:var(--grad-warm); color:var(--white); }
.btn-gold:hover{ box-shadow:0 8px 24px var(--grad-warm-shadow); transform:translateY(-1px); }
.btn-ghost{ background:transparent; color:var(--paper); border:1px solid var(--line); }
.btn-ghost:hover{ background:var(--ink-2); }
.btn-outline-dark{ background:transparent; color:var(--ink-text); border:1px solid var(--line-dark); }

/* Ghost button sobre superfícies claras (ex.: dentro da modal) */
.modal-card .btn-ghost{
  color:var(--ink-soft);
  border-color:var(--line);
  background:var(--white);
}
.modal-card .btn-ghost:hover{
  background:var(--bg-soft);
  color:var(--ink);
  border-color:var(--ink-soft);
}

footer.org-link{
  position:fixed;
  bottom:calc(10px + env(safe-area-inset-bottom));
  right:16px;
  z-index:30;
}
footer.org-link button{
  background:none;
  border:none;
  color:var(--slate);
  font-size:12px;
  font-family:'JetBrains Mono', monospace;
  cursor:pointer;
  opacity:0.6;
  padding:8px;
}
footer.org-link button:hover{ opacity:1; color:var(--paper); }

/* ---------- Modal (ask question) ---------- */
.modal-backdrop{
  position:fixed; inset:0;
  background:rgba(10,12,17,0.72);
  backdrop-filter: blur(6px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:100;
  animation: fadeIn .35s ease;
}
@keyframes fadeIn{ from{opacity:0;} to{opacity:1;} }

#askModal,
.confirm-backdrop{ display:none; }

.confirm-card{
  position:relative;
  background:var(--ink-2);
  color:var(--paper);
  width:100%;
  max-width:360px;
  text-align:center;
  border-radius:20px;
  border:1px solid rgba(255,255,255,0.14);
  padding:32px 26px 26px;
  box-shadow:0 30px 80px rgba(0,0,0,0.5);
  animation: riseIn .3s cubic-bezier(.2,.9,.25,1);
}
.confirm-icon{
  width:52px; height:52px; border-radius:50%;
  background:var(--grad-warm);
  box-shadow:0 10px 24px var(--grad-warm-shadow);
  display:flex; align-items:center; justify-content:center;
  margin:0 auto 18px;
}
.confirm-icon svg{ width:24px; height:24px; color:var(--white); }
.confirm-title{ font-family:'Fraunces', serif; font-weight:600; font-size:20px; margin:0 0 8px; }
.confirm-message{ color:rgba(255,255,255,0.7); font-size:14px; line-height:1.55; margin:0 0 26px; }
.confirm-actions{ display:flex; gap:10px; }
.confirm-actions .btn{ flex:1; }

.modal-card{
  position:relative;
  background:var(--bg-soft);
  color:var(--ink-text);
  width:100%;
  max-width:440px;
  border-radius:20px;
  border:1px solid var(--line);
  padding:36px 30px 30px;
  box-shadow:0 30px 80px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.04) inset;
  animation: riseIn .4s cubic-bezier(.2,.9,.25,1);
  overflow:hidden;
}
.modal-card::before{
  content:"";
  position:absolute;
  top:0; left:0; right:0;
  height:4px;
  background:var(--grad-warm);
}
.modal-card::after{
  content:"";
  position:absolute;
  top:-140px; right:-140px;
  width:280px; height:280px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(236,11,43,0.06) 0%, transparent 70%);
  pointer-events:none;
}
@keyframes riseIn{ from{ opacity:0; transform:translateY(24px) scale(0.98);} to{opacity:1; transform:translateY(0) scale(1);} }
.modal-eyebrow{
  font-family:'JetBrains Mono', monospace;
  font-size:11px;
  letter-spacing:0.06em;
  color:var(--teal);
  margin-bottom:10px;
  display:flex;
  align-items:center;
  gap:8px;
}
.modal-eyebrow .dot{ width:6px;height:6px;border-radius:50%;background:var(--teal); }
.modal-title{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size:26px;
  line-height:1.2;
  margin:0 0 8px;
}
.modal-desc{
  font-size:14px;
  color:var(--ink-soft);
  line-height:1.55;
  margin:0 0 22px;
}
.field-label{
  display:block;
  font-size:13px;
  font-weight:600;
  color:var(--ink-text);
  margin:0 0 6px;
}
.text-field,
textarea#questionText{
  width:100%;
  border:1.5px solid rgba(32,36,46,0.14);
  border-radius:12px;
  padding:14px 16px;
  font-family:'Inter', sans-serif;
  font-size:16px;
  color:var(--ink-text);
  background:var(--white);
  outline:none;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.text-field{ margin-bottom:12px; }
textarea#questionText{ min-height:120px; resize:vertical; }
.text-field:focus,
textarea#questionText:focus{ border-color:var(--gold); box-shadow:0 0 0 3px var(--gold-soft); }
.char-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin:10px 0 22px;
  font-size:12px;
  color:var(--ink-soft);
  font-family:'JetBrains Mono', monospace;
}
.modal-actions{ display:flex; gap:12px; }
.modal-actions .btn{ flex:1; }
.modal-actions .btn-gold:disabled{
  background:var(--line);
  color:var(--ink-soft);
  cursor:not-allowed;
  box-shadow:none;
}

.success-state{ text-align:center; padding:10px 0 4px; }
.success-icon{
  width:60px;height:60px;border-radius:50%;
  background:var(--grad-warm);
  box-shadow:0 10px 24px var(--grad-warm-shadow);
  display:flex;align-items:center;justify-content:center;
  margin:0 auto 18px;
}
.success-icon svg{ width:26px;height:26px; }

/* ---------- Admin login ---------- */
#adminLoginView.active{
  display:flex; align-items:center; justify-content:center;
  min-height:100vh; padding:20px;
}
.login-card{
  background:var(--ink-2);
  border:1px solid var(--line);
  border-radius:18px;
  padding:36px 30px;
  width:100%; max-width:380px;
}
.login-card h2{ font-family:'Fraunces', serif; font-weight:600; font-size:22px; margin:0 0 6px; }
.login-card p{ color:var(--slate); font-size:13.5px; margin:0 0 22px; }
input#adminUser,
input#adminPass{
  width:100%;
  background:var(--ink);
  border:1px solid var(--line);
  color:var(--paper);
  padding:13px 16px;
  border-radius:10px;
  font-size:16px;
  margin-bottom:14px;
  outline:none;
}
input#adminUser:focus,
input#adminPass:focus{ border-color:var(--gold); }
.login-error{ color:#f2455f; font-size:13px; margin:-4px 0 14px; display:none; }

/* ---------- Admin dashboard ---------- */
#adminView.active{ display:flex; flex-direction:column; min-height:100vh; background:var(--ink); }

.admin-topbar{
  position:sticky; top:0; z-index:20;
  display:flex; justify-content:space-between; align-items:center;
  gap:16px; flex-wrap:wrap;
  padding:16px 24px;
  background:rgba(29,32,39,0.82);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  border-bottom:1px solid var(--line-dark);
}
.admin-brand{ display:flex; align-items:center; gap:14px; }
.admin-logo{ height:34px; width:auto; max-width:120px; }
.admin-eyebrow{
  font-family:'JetBrains Mono', monospace;
  font-size:11px; letter-spacing:0.08em; color:var(--gold);
  margin-bottom:2px;
}
.admin-brand-text h1{
  font-family:'Fraunces', serif; font-weight:600; font-size:22px; margin:0;
}
.admin-actions{ display:flex; align-items:center; gap:10px; }
.export-btn{
  display:inline-flex; align-items:center; gap:8px;
  background:var(--grad-warm); color:var(--white);
  font-family:'Inter', sans-serif; font-weight:600; font-size:13px;
  padding:0 16px; height:40px; border-radius:10px;
  text-decoration:none; cursor:pointer;
  transition: box-shadow .15s ease, transform .15s ease;
}
.export-btn:hover{ box-shadow:0 8px 20px var(--grad-warm-shadow); transform:translateY(-1px); }
.export-btn svg{ width:16px; height:16px; flex-shrink:0; }
@media (max-width:480px){
  .export-btn span{ display:none; }
  .export-btn{ width:40px; padding:0; justify-content:center; }
}
.icon-btn{
  background:var(--ink-2);
  border:1px solid var(--line);
  color:var(--paper);
  width:40px;height:40px;
  border-radius:10px;
  cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition: background .15s ease, border-color .15s ease;
}
.icon-btn:hover{ background:var(--ink-3); border-color:var(--gold); }
.icon-btn svg{ width:18px; height:18px; }

.admin-content{
  flex:1;
  width:100%;
  max-width:820px;
  margin:0 auto;
  padding:26px 20px 80px;
}

.stats-row{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:12px;
  margin-bottom:24px;
}
.stat-box{
  position:relative;
  overflow:hidden;
  background:var(--ink-2);
  border:1px solid var(--line);
  border-radius:14px;
  padding:16px 18px;
  transition: transform .15s ease, border-color .15s ease;
}
.stat-icon{
  width:30px; height:30px; border-radius:9px;
  display:flex; align-items:center; justify-content:center;
  color:var(--gold); background:var(--gold-soft);
  margin-bottom:12px;
}
.stat-icon svg{ width:15px; height:15px; }
.stat-box.pending .stat-icon{ color:#f2a33d; background:rgba(242,163,61,0.14); }
.stat-box.answered .stat-icon{ color:#3ecf8e; background:rgba(62,207,142,0.14); }
.stat-box .val{ font-family:'JetBrains Mono', monospace; font-size:24px; font-weight:600; color:var(--paper); line-height:1; }
.stat-box .lbl{ font-size:12px; color:var(--slate); margin-top:6px; }

.filter-row{ display:flex; gap:6px; margin-bottom:20px; background:var(--ink-2); border:1px solid var(--line); padding:5px; border-radius:100px; width:fit-content; }
.chip{
  background:transparent;
  color:var(--slate);
  font-size:13px;
  font-weight:500;
  padding:8px 16px;
  border-radius:100px;
  cursor:pointer;
  transition: background .15s ease, color .15s ease;
}
.chip.active{ background:var(--gold); color:var(--white); }

.top-dropzone{
  display:flex; align-items:center; justify-content:center; gap:8px;
  border:1.5px dashed rgba(255,255,255,0.22);
  border-radius:14px;
  padding:14px;
  margin-bottom:12px;
  color:var(--slate);
  font-size:12.5px;
  font-weight:500;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.top-dropzone svg{ color:var(--gold); flex-shrink:0; }
.top-dropzone.drag-over{
  border-color:var(--gold);
  border-style:solid;
  background:var(--gold-soft);
  color:var(--paper);
}

.q-list{ display:flex; flex-direction:column; gap:12px; }
.q-card{
  position:relative;
  background:var(--ink-2);
  border:1px solid rgba(255,255,255,0.14);
  border-radius:16px;
  padding:18px 20px 18px 46px;
  box-shadow:0 2px 10px rgba(0,0,0,0.28);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.q-card:hover{ border-color:rgba(255,255,255,0.28); }
.q-card.top{ border-color:rgba(236,11,43,0.55); box-shadow:0 2px 10px rgba(0,0,0,0.28), 0 0 0 1px rgba(236,11,43,0.2); }
.q-card.answered{ opacity:0.55; }
.q-card.dragging{ opacity:0.35; border-style:dashed; }
.top-badge{
  position:absolute; top:-9px; left:40px;
  font-family:'JetBrains Mono', monospace;
  font-weight:700;
  font-size:10px;
  letter-spacing:0.06em;
  text-transform:uppercase;
  color:var(--white);
  background:var(--grad-warm);
  padding:3px 10px;
  border-radius:100px;
  box-shadow:0 4px 10px var(--grad-warm-shadow);
}
.drag-handle{
  position:absolute; left:12px; top:20px;
  width:24px; height:24px;
  display:flex; align-items:center; justify-content:center;
  color:var(--slate); cursor:grab;
  border-radius:6px;
  transition: color .15s ease, background .15s ease;
}
.drag-handle:hover{ color:var(--paper); background:var(--ink-3); }
.drag-handle:active{ cursor:grabbing; }
.q-top{ display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.q-avatar{
  width:46px; height:46px; border-radius:50%;
  background:var(--grad-warm); color:var(--white);
  box-shadow:0 4px 12px var(--grad-warm-shadow);
  display:flex; align-items:center; justify-content:center;
  font-family:'Fraunces', serif; font-size:17px; font-weight:600;
  flex-shrink:0;
}
.q-identity{ flex:1; min-width:0; }
.q-author{ font-size:14px; font-weight:600; color:var(--paper); line-height:1.3; }
.q-target{
  margin-top:2px;
  font-size:12px; color:rgba(255,255,255,0.55);
}
.q-target strong{ color:rgba(255,255,255,0.85); font-weight:600; }
.priority-select{
  flex-shrink:0;
  appearance:none;
  -webkit-appearance:none;
  font-family:'Inter', sans-serif;
  font-weight:600;
  font-size:12px;
  color:var(--white);
  border:none;
  border-radius:100px;
  padding:7px 30px 7px 14px;
  cursor:pointer;
  background-color:var(--slate);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 10px center;
  background-size:12px;
}
.priority-select option{ color:var(--ink-text); background:var(--white); }
.priority-select.p-top{ background-color:#8b5cf6; }
.priority-select.p-altissima{ background-color:#ec0b2b; }
.priority-select.p-alta{ background-color:#f2a33d; }
.priority-select.p-media{ background-color:#4a7cf2; }
.priority-select.p-baixa{ background-color:#5b6270; }

.q-text{ font-size:15px; line-height:1.55; margin:0 0 14px; word-break:break-word; color:var(--paper); padding-left:50px; }

.q-footer{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; padding-left:50px; }
.q-meta{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.q-time{ font-family:'JetBrains Mono', monospace; font-size:11px; color:var(--slate); }
.answered-tag{
  font-family:'JetBrains Mono', monospace;
  font-size:10.5px; color:var(--teal);
  background:var(--teal-soft);
  padding:3px 9px; border-radius:100px;
}
.card-menu{ display:flex; gap:8px; }
.mini-btn{
  display:inline-flex; align-items:center; gap:5px;
  background:none; border:1px solid rgba(255,255,255,0.18); color:rgba(255,255,255,0.75);
  font-size:11.5px; padding:6px 10px; border-radius:8px; cursor:pointer;
  font-family:'Inter', sans-serif;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.mini-btn svg{ flex-shrink:0; }
.mini-btn:hover{ color:var(--paper); border-color:var(--paper); background:var(--ink-3); }

.empty-state{
  text-align:center; padding:70px 20px; color:var(--slate);
  background:var(--ink-2); border:1px dashed var(--line); border-radius:16px;
}
.empty-state .big{ font-family:'Fraunces', serif; font-size:20px; color:var(--paper); margin-bottom:8px; }

.loading-row{ text-align:center; padding:40px 0; color:var(--slate); font-family:'JetBrains Mono', monospace; font-size:13px; }

@media (max-width:480px){
  .admin-topbar{ padding:14px 16px; }
  .admin-logo{ height:28px; }
  .admin-brand-text h1{ font-size:18px; }
  .admin-content{ padding:20px 14px 70px; }
  .stats-row{ grid-template-columns:repeat(3,1fr); gap:8px; }
  .stat-box{ padding:12px; }
  .q-text, .q-footer{ padding-left:0; }
  .modal-card{ padding:28px 20px 22px; }
  .modal-actions{ flex-direction:column-reverse; gap:10px; }
  .modal-title{ font-size:23px; }
}
