/* ============================================================
   POP LED Gestão — design system escuro
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0b0d12;
  --bg2: #11141c;
  --card: #161a24;
  --card2: #1c2130;
  --line: #262c3d;
  --txt: #f2f3f7;
  --mut: #8b90a0;
  --red: #e4002b;
  --gold: #ffc24b;
  --green: #2ecc71;
  --blue: #3d8bfd;
  --radius: 14px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  padding-bottom: 60px;
}

#app { max-width: 1060px; margin: 0 auto; padding: 0 16px; }

/* ---------- topbar ---------- */
#topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .4px; }
.brand small { color: var(--mut); font-weight: 600; margin-left: 2px; }
.grid { display: grid; grid-template-columns: repeat(3, 7px); gap: 4px; }
.grid i { width: 7px; height: 7px; border-radius: 2px; background: var(--red); }
.grid i:nth-child(5) { background: #fff; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions select { max-width: 220px; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; cursor: pointer;
  font: inherit; font-weight: 700;
  padding: 10px 18px; color: var(--txt); background: var(--card2);
  transition: filter .15s, transform .05s;
  user-select: none; text-decoration: none;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--red); box-shadow: 0 6px 24px rgba(228,0,43,.3); }
.btn.ok { background: var(--green); color: #08130c; }
.btn.blue { background: var(--blue); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.danger { background: transparent; border: 1.5px solid #7a2030; color: #ff8296; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px 10px; font-size: 15px; }

/* ---------- formulários ---------- */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 12.5px; font-weight: 700; color: var(--mut); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .6px; }
input[type=text], input[type=email], input[type=password], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 11px;
  border: 1.5px solid var(--line); background: var(--bg2); color: var(--txt);
  font: inherit; outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
textarea { resize: vertical; min-height: 70px; }
input[type=color] {
  width: 42px; height: 42px; padding: 3px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--bg2); cursor: pointer;
}
.frow { display: flex; gap: 10px; }
.frow > * { flex: 1; min-width: 0; }
.err-msg { color: #ff8296; font-size: 13px; margin-top: 6px; }

/* toggle switch */
.switch {
  width: 46px; height: 26px; border-radius: 13px; background: var(--line);
  position: relative; cursor: pointer; flex-shrink: 0; transition: background .2s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: left .2s;
}
.switch.on { background: var(--green); }
.switch.on::after { left: 23px; }

/* ---------- cards / listas ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.card h3 { font-size: 16px; margin-bottom: 4px; }
.card .sub { color: var(--mut); font-size: 13.5px; }

.evt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.evt-card { display: flex; flex-direction: column; gap: 10px; }
.evt-card .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.evt-card h3 { font-size: 17px; }
.evt-card .meta { color: var(--mut); font-size: 13px; display: grid; gap: 3px; }
.evt-card .foot { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }

.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  background: var(--card2); color: var(--mut);
}
.chip.on { background: rgba(46,204,113,.15); color: var(--green); }
.chip.draft { background: rgba(255,194,75,.12); color: var(--gold); }
.chip.off { background: rgba(139,144,160,.12); }
.chip.code { background: rgba(61,139,253,.15); color: var(--blue); font-family: ui-monospace, monospace; }

/* ---------- abas do evento ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 8px 0 18px; -webkit-overflow-scrolling: touch; }
.tabs a {
  padding: 9px 16px; border-radius: 10px; color: var(--mut);
  text-decoration: none; font-weight: 700; font-size: 14px; white-space: nowrap;
}
.tabs a.active { background: var(--card2); color: var(--txt); }
.evt-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 2px; }
.evt-head h2 { font-size: 22px; }

/* ---------- editor de cenas ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.scene {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
}
.scene .s-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.scene .s-head .grip { color: var(--mut); font-size: 13px; font-weight: 800; }
.scene .s-head input[type=text] { flex: 1; }
.scene .s-type-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.scene .s-type-row label.f { margin-bottom: 0; }
.zone-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.zone-color { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.zone-color span { font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-foot { display: flex; gap: 6px; margin-top: 10px; }

/* ---------- simulador ---------- */
.sim-wrap { position: sticky; top: 72px; }
.sim-canvas {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--line);
  background: #05060a; display: block;
}
.sim-controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.sim-controls input[type=range] { flex: 1; accent-color: var(--red); }
.sim-time { font-family: ui-monospace, monospace; font-size: 13px; color: var(--mut); min-width: 74px; text-align: right; }
.sim-note { color: var(--mut); font-size: 12.5px; margin-top: 8px; }

.editor-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 860px) {
  .editor-grid { grid-template-columns: 1fr; }
  .sim-wrap { position: static; order: -1; }
}

/* ---------- setores ---------- */
.zone-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
}
.zone-row input[type=text], .zone-row input[type=number] { padding: 8px 10px; }
.zone-row .z-label { flex: 1; min-width: 130px; }
.zone-row .z-coord { width: 110px; }
.zone-row .z-slug { font-family: ui-monospace, monospace; font-size: 12.5px; color: var(--mut); min-width: 80px; }
.zone-row .z-ord { display: flex; gap: 4px; }

/* ---------- divulgar ---------- */
.qr-master { text-align: center; }
.qr-master img { max-width: 300px; width: 100%; border-radius: 12px; background: #fff; padding: 8px; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.qr-grid figure { text-align: center; }
.qr-grid img { width: 100%; max-width: 150px; border-radius: 10px; background: #fff; padding: 5px; }
.qr-grid figcaption { font-size: 12.5px; color: var(--mut); margin-top: 5px; word-break: break-all; }
.link-box {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg2); border: 1.5px dashed var(--line); border-radius: 12px;
  padding: 8px 8px 8px 14px;
}
.link-box code { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- ao vivo ---------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat .v { font-size: 26px; font-weight: 800; }
.stat .k { color: var(--mut); font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; }
.zbar { margin-bottom: 10px; }
.zbar .z-head { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 4px; }
.zbar .z-head span:last-child { color: var(--mut); }
.zbar .track { height: 10px; background: var(--bg2); border-radius: 5px; overflow: hidden; }
.zbar .fill { height: 100%; background: linear-gradient(90deg, var(--red), #ff6b81); border-radius: 5px; }
.ctl-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }

/* ---------- login / onboarding ---------- */
.auth-wrap { max-width: 420px; margin: 8vh auto 0; }
.auth-wrap .brand { font-size: 20px; margin-bottom: 22px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { color: var(--mut); margin-bottom: 20px; font-size: 14px; }
.auth-alt { margin-top: 16px; color: var(--mut); font-size: 14px; text-align: center; }
.auth-alt a { color: var(--blue); }
.demo-hint { margin-top: 14px; font-size: 12.5px; color: var(--mut); text-align: center; }
.demo-hint code { color: var(--gold); }

.wizard { max-width: 560px; margin: 4vh auto 0; }
.wizard h1 { font-size: 24px; margin-bottom: 6px; }
.wizard .sub { color: var(--mut); margin-bottom: 20px; }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(3,4,8,.72);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto;
  padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal h3 { font-size: 18px; margin-bottom: 4px; }
.modal .m-sub { color: var(--mut); font-size: 13.5px; margin-bottom: 16px; }
.modal .m-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ---------- toasts ---------- */
#toasts {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 200; width: min(92vw, 420px);
}
.toast {
  background: var(--card2); border: 1px solid var(--line); border-left: 4px solid var(--blue);
  border-radius: 12px; padding: 12px 16px; font-size: 14px;
  animation: toast-in .25s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.empty { text-align: center; color: var(--mut); padding: 48px 16px; }
.empty .big { font-size: 44px; margin-bottom: 10px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.spin {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--red);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.center-pad { text-align: center; padding: 80px 16px; }

/* ---------- assistente de evento (wizard) ---------- */
.wizard.wz { max-width: 680px; }
.wiz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.wiz-head h1 { font-size: 20px; }
.wiz-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.wiz-steps .st { display: inline-flex; align-items: center; gap: 6px; color: var(--mut); font-size: 12.5px; }
.wiz-steps .st b {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg2); border: 1px solid var(--line); font-size: 12px;
}
.wiz-steps .st.done b { background: rgba(46,204,113,.16); border-color: var(--green); color: var(--green); }
.wiz-steps .st.cur { color: var(--txt); font-weight: 600; }
.wiz-steps .st.cur b { background: var(--red); border-color: var(--red); color: #fff; }
.wiz-steps .sep { color: var(--line); }
.wiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip-btn {
  background: var(--bg2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 20px; padding: 7px 14px; cursor: pointer; font-size: 13.5px;
}
.chip-btn:hover, .chip-btn.sel { border-color: var(--red); background: rgba(228,0,43,.10); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.choice {
  text-align: left; background: var(--bg2); border: 2px solid var(--line);
  border-radius: 14px; padding: 16px; cursor: pointer; color: var(--txt);
  display: flex; flex-direction: column; gap: 6px; position: relative;
}
.choice .ic { font-size: 30px; }
.choice small { color: var(--mut); line-height: 1.45; }
.choice.sel { border-color: var(--red); background: rgba(228,0,43,.08); }
.choice .sugg {
  position: absolute; top: 8px; right: 8px; font-size: 10.5px;
  background: rgba(61,139,253,.15); color: var(--blue); border-radius: 8px; padding: 3px 8px;
}
.venue-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.venue-card {
  text-align: left; background: var(--bg2); border: 2px solid var(--line);
  border-radius: 14px; padding: 12px; cursor: pointer; color: var(--txt);
  display: flex; flex-direction: column; gap: 6px;
}
.venue-card.sel { border-color: var(--red); background: rgba(228,0,43,.08); }
.venue-card .v-ic { font-size: 22px; }
.venue-card small { color: var(--mut); line-height: 1.4; }
.venue-card .v-mini { pointer-events: none; }
.venue-card .v-mini svg { width: 100%; height: auto; border-radius: 8px; background: #0d1017; display: block; }
.wiz-svg .wz { cursor: default; }
.wiz-svg .wz-on rect { fill: rgba(228,0,43,.28); stroke: var(--red); stroke-width: 2; }
.wiz-svg .wz-off rect { fill: rgba(138,145,158,.06); stroke: #3d4350; stroke-width: 1.4; stroke-dasharray: 5 4; }
.wiz-svg .wz text { pointer-events: none; fill: #d5d9e2; font-size: 11px; font-weight: 600; }
.wiz-svg .wz.wz-off text { fill: #6b7280; }
.wiz-map svg { width: 100%; height: auto; border-radius: 12px; background: #0d1017; border: 1px solid var(--line); display: block; }
.wiz-map .wz { cursor: pointer; }
.wiz-zone-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.wz-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
}
.wz-row b {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(228,0,43,.18); color: var(--red); font-size: 12px;
}
.wz-row b.off { background: var(--bg); color: var(--mut); }
.wz-row input {
  flex: 1; min-width: 140px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; color: var(--txt); padding: 7px 10px; font-size: 14px;
}
.wiz-summary {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-top: 14px; font-size: 13.5px; line-height: 1.8; color: var(--mut);
}
.wiz-summary b { color: var(--txt); }
#wizCanvas { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); background: #0b0e13; display: block; }
@media (max-width: 620px) {
  .choice-grid, .venue-grid { grid-template-columns: 1fr; }
}

/* ---- UX: chips de rascunho, banner iniciar, badge de propagação ---- */
.chip.amber { background: #3a2c12; color: #f5c469; }
.start-banner { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.prop-badge { position: fixed; right: 16px; bottom: 16px; z-index: 80; background: #1c2333; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 13px; color: var(--mut); box-shadow: 0 6px 24px rgba(0,0,0,.4); }

/* ---- modo ensaio ---- */
#ensaioOverlay { position: fixed; inset: 0; z-index: 90; background: #05070c; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding-bottom: 70px; }
#ensaioCanvas { max-width: 96vw; max-height: 78vh; border-radius: 8px; background: #0b0e13; }
.ensaio-bar { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 14px; align-items: center; justify-content: center; padding: 14px; background: rgba(5, 7, 12, .8); z-index: 2; }

/* ---- editor: drag & drop + undo/redo ---- */
.scene .grip { cursor: grab; }
.scene.dragging { opacity: .45; }
.scene.drag-over { outline: 2px dashed #3b82f6; outline-offset: 3px; }

/* ---- relatórios ---- */
.rep-chart { width: 100%; height: auto; background: #0b0e13; border-radius: 10px; border: 1px solid var(--line); }

/* ---- editor: cena imagem ---- */
.img-thumb {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 10px; padding: 10px 12px;
  background: var(--bg2); border: 1px dashed var(--line); border-radius: 12px;
}
.img-thumb img { width: 84px; height: 56px; object-fit: cover; border-radius: 8px; background: #000; }
.img-thumb small { color: var(--mut); font-size: 12px; word-break: break-all; }
.img-thumb.empty { color: var(--mut); font-size: 13px; border-style: dashed; }
