:root {
  --bg: #0a0a0f;
  --panel: #12121a;
  --panel-2: #181822;
  --border: #23232f;
  --text: #ececf1;
  --muted: #8b8b9a;
  --brand: #7b5cff;
  --brand-2: #ff4fd8;
  --ok: #22c55e;
  --live: #ff2e4d;
  --warn: #f59e0b;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; font-size: 14px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; background: rgba(10,10,15,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; text-decoration: none; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: conic-gradient(from 210deg, #00d2ff, var(--brand), var(--brand-2), #00d2ff); display: grid; place-items: center; }
.logo-mark::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.topbar .spacer { flex: 1; }
.media-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.bad { background: var(--live); }
.dot.live { background: var(--live); box-shadow: 0 0 10px var(--live); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }

.container { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.3px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.back { color: var(--muted); text-decoration: none; font-size: 13px; display: inline-block; margin-bottom: 8px; }
.back:hover { color: var(--text); }

/* ---------- Componentes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: .15s;
}
.btn:hover { border-color: #34344a; background: #1e1e2a; }
.btn.primary { background: linear-gradient(90deg, var(--brand), var(--brand-2)); border: 0; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #ff6b81; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 32px; padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 20px; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi { padding: 18px 20px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.kpi .value { font-size: 28px; font-weight: 800; margin-top: 6px; letter-spacing: -.5px; }
.kpi .value.live { color: var(--live); }

.grid-experts { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.expert-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: .15s; }
.expert-card:hover { border-color: #33334a; }
.expert-card.is-live { border-color: rgba(255,46,77,.45); box-shadow: 0 0 0 1px rgba(255,46,77,.15), 0 10px 40px -20px rgba(255,46,77,.5); }
.ec-head { display: flex; align-items: center; gap: 12px; }
.av { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: #222; flex: none; }
.av-ring { padding: 2px; border-radius: 50%; background: var(--border); }
.is-live .av-ring { background: conic-gradient(from 210deg, #00d2ff, var(--brand), var(--brand-2), #00d2ff); }
.av-ring .av { border: 2px solid var(--panel); display: block; }
.ec-name { font-weight: 700; font-size: 15px; }
.ec-slug { color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-all; }
.ec-stats { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.ec-stats b { color: var(--text); }
.ec-actions { display: flex; gap: 8px; }
.ec-actions .btn { flex: 1; }
.ec-actions .btn.icon { flex: none; width: 38px; }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: var(--panel-2); color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.tag.live { background: rgba(255,46,77,.14); color: #ff5c75; }
.tag.off { opacity: .8; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h3 { color: var(--text); margin: 0 0 6px; }

/* ---------- Editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 9px 13px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; background: none; border: 0; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel-2); color: var(--text); }
.tab-body { padding: 22px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.input, textarea.input, select.input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: #0d0d13; outline: 0; transition: .15s;
}
textarea.input { height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(123,92,255,.18); }
.input-group { display: flex; align-items: stretch; }
.input-group .prefix { display: flex; align-items: center; padding: 0 10px 0 12px; border: 1px solid var(--border); border-right: 0; border-radius: 10px 0 0 10px; background: var(--panel-2); color: var(--muted); font-size: 13px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.input-group .input { border-radius: 0 10px 10px 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .t { font-weight: 600; }
.switch-row .d { color: var(--muted); font-size: 12px; margin-top: 3px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #2a2a38; border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }

.avatar-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.avatar-edit .av { width: 72px; height: 72px; }

.cta-preview { margin-top: 6px; padding: 18px; border-radius: 12px; background: linear-gradient(160deg, #1b1830, #0c0c12); }
.cta-preview .btn-cta { display: flex; align-items: center; gap: 12px; min-height: 56px; border-radius: 16px; color: #fff; text-align: left; padding: 9px 14px 9px 16px; max-width: 380px; }
.release { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border-radius: 12px; border: 1px dashed #34344a; margin-bottom: 20px; }
.release.on { border-style: solid; border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.06); }

.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.steps { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.8; }
.steps b { color: var(--text); }
.obs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.obs-table td { padding: 8px 0; border-bottom: 1px solid var(--border); }
.obs-table td:first-child { color: var(--muted); width: 45%; }
.alert { padding: 12px 14px; border-radius: 10px; background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.3); color: #fbbf24; font-size: 13px; line-height: 1.5; margin-bottom: 16px; }

.save-bar { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }

/* ---------- Monitor ---------- */
.side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; }
.phone { position: relative; width: 100%; aspect-ratio: 9 / 16; max-height: 560px; border-radius: 22px; overflow: hidden; border: 6px solid #1c1c26; background: #000; margin: 0 auto; }
.phone iframe { width: 100%; height: 100%; border: 0; display: block; }
.monitor-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.mod-comments { list-style: none; margin: 0; padding: 8px; height: 260px; overflow-y: auto; }
.mod-comments li { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 8px; font-size: 13px; }
.mod-comments li:hover { background: var(--panel-2); }
.mod-comments li .c-body { flex: 1; min-width: 0; word-wrap: break-word; }
.mod-comments li b { margin-right: 6px; }
.mod-comments li.host b { color: #b6a4ff; }
.mod-comments li .del { opacity: 0; background: none; border: 0; color: #ff6b81; cursor: pointer; padding: 2px 6px; }
.mod-comments li:hover .del { opacity: 1; }
.mod-send { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12px; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(60% 50% at 50% 0%, rgba(123,92,255,.18), transparent); }
.login { width: 100%; max-width: 380px; padding: 30px; }
.login h1 { font-size: 22px; margin: 18px 0 4px; }
.login p { color: var(--muted); margin: 0 0 22px; }
.err { color: #ff6b81; font-size: 13px; margin-bottom: 12px; }

/* ---------- Modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { width: 100%; max-width: 440px; padding: 24px; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #1e1e2a; border: 1px solid var(--border); padding: 12px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: tin .2s; }
.toast.ok { border-color: rgba(34,197,94,.4); }
.toast.bad { border-color: rgba(255,46,77,.5); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1000px) {
  .editor { grid-template-columns: 1fr; }
  .side { position: static; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .container { padding: 20px 14px 60px; }
  .topbar { padding: 12px 14px; }
  .row, .row-3 { grid-template-columns: 1fr; }
  .media-pill span.txt { display: none; }
}

/* Tipo de popup + upload de imagens */
.ptypes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field .ptype, .ptype { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; margin: 0; text-transform: none; letter-spacing: 0; padding: 12px 14px; border: 1px solid var(--line, #2a2a33); border-radius: 12px; cursor: pointer; }
.ptype input { display: none; }
.ptype b { font-size: 14px; color: var(--text); }
.ptype span { font-size: 12px; font-weight: 400; color: var(--muted); }
.ptype.on { border-color: #a855f7; background: rgba(168, 85, 247, .08); }
.pimg { display: flex; gap: 14px; align-items: flex-start; }
.pimg .btn { margin: 0 6px 6px 0; }
.pimg-prev { flex: none; width: 96px; height: 120px; border-radius: 10px; border: 1px dashed var(--line, #2a2a33); display: grid; place-items: center; overflow: hidden; background: #0e0e12; font-size: 11px; color: var(--muted); }
.pimg-prev.logo { height: 56px; width: 140px; }
.pimg-prev img { width: 100%; height: 100%; object-fit: contain; }

/* Vídeos / Loop / Gravação */
.vgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .vgrid { grid-template-columns: 1fr; } }
.vcard { border: 1px solid var(--line, #2a2a33); border-radius: 14px; padding: 16px; background: rgba(255,255,255,.015); }
.vcard h3 { margin: 0 0 10px; font-size: 15px; color: var(--text); }
.vstatus { font-size: 13px; color: var(--muted); }
.vstatus.on { color: #4ade80; font-weight: 600; }
.vstatus.warn { color: #fbbf24; font-weight: 600; }
.vstatus.rec { color: #f87171; font-weight: 700; }
.vlib-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 0 12px; }
.vlib-head h3 { margin: 0; color: var(--text); }
.vlist { display: flex; flex-direction: column; gap: 8px; }
.vrow { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line, #2a2a33); border-radius: 12px; }
.vthumb { position: relative; flex: none; width: 54px; height: 84px; border-radius: 8px; background: #0e0e12; overflow: hidden; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vthumb span { position: absolute; right: 3px; bottom: 3px; font-size: 10px; background: rgba(0,0,0,.75); color: #fff; padding: 1px 4px; border-radius: 4px; }
.vinfo { flex: 1; min-width: 0; }
.vtitle { width: 100%; background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--text); font-weight: 600; font-size: 14px; padding: 3px 6px; margin-left: -6px; }
.vtitle:hover, .vtitle:focus { border-color: var(--line, #2a2a33); outline: 0; background: #0e0e12; }
.vmeta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.vact { display: flex; gap: 6px; flex: none; }
.vact .btn { text-decoration: none; min-width: 36px; text-align: center; }
.vb { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.vb.ok { background: rgba(74,222,128,.12); color: #4ade80; }
.vb.proc, .vb.up { background: rgba(96,165,250,.12); color: #60a5fa; }
.vb.rec { background: rgba(248,113,113,.14); color: #f87171; }
.vb.err { background: rgba(248,113,113,.14); color: #f87171; cursor: help; }
.vbar { height: 5px; border-radius: 99px; background: #23232b; overflow: hidden; margin-top: 7px; }
.vbar i { display: block; height: 100%; background: linear-gradient(90deg, #a855f7, #ec4899); transition: width .4s; }
.vup { border: 1px dashed var(--line, #2a2a33); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.vup-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.vup-top b { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Filtro de período + métricas */
.period-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.period-head h2 { margin: 0; font-size: 18px; }
.period-head h2 span { color: var(--muted); font-weight: 500; font-size: 15px; }
.period { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--panel-2); color: var(--text); border-color: #3a3a4f; }
.period-custom { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.period-custom .input { height: 32px; width: 140px; padding: 0 8px; color-scheme: dark; }
.kpi-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.ec-period { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 2px 0 12px; padding: 8px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ec-period div { display: flex; flex-direction: column; align-items: center; }
.ec-period b { font-size: 16px; }
.ec-period span { font-size: 11px; color: var(--muted); }
.chart { position: relative; padding: 16px 18px 12px; margin-bottom: 8px; }
.chart-title { font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.chart-plot { display: flex; height: 170px; }
.chart-y { position: relative; width: 34px; flex: none; }
.chart-y span { position: absolute; right: 8px; transform: translateY(50%); font-size: 11px; color: var(--muted); }
.chart-area { position: relative; flex: 1; border-bottom: 1px solid #3a3a4f; }
.chart-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed #26263a; }
.chart-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.chart-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; }
.chart-bar { width: 100%; max-width: 26px; min-height: 0; background: #a855f7; border-radius: 4px 4px 0 0; transition: filter .15s; }
.chart-col.hover .chart-bar { filter: brightness(1.25); }
.chart-col.hover { background: rgba(255,255,255,.03); }
.chart-x { display: flex; gap: 2px; margin-left: 34px; margin-top: 6px; }
.chart-x span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; }
.chart-tip { position: absolute; top: 40px; width: 140px; padding: 8px 10px; border-radius: 10px; background: #1c1c28; border: 1px solid #34344a; font-size: 12px; color: var(--muted); pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.chart-tip b { color: var(--text); }
.kpis.kpis-4 { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.kpis.kpis-4 .kpi { padding: 14px 14px; }
.kpis.kpis-4 .kpi .label { font-size: 11px; }

/* Acessos (logins de expert) */
.me-pill { font-size: 13px; color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-list { display: flex; flex-direction: column; gap: 8px; }
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.acc-row.off { opacity: .6; }
.acc-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acc-info span { font-size: 12px; color: var(--muted); }
.acc-act { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.acc-creds { margin-top: 14px; padding: 14px; border-color: #3b2d5c; }
.acc-creds pre { background: #0e0e12; border-radius: 10px; padding: 10px 12px; margin: 8px 0 10px; white-space: pre-wrap; font-size: 13px; }
