/* master.css — Painel Master RRooster (master-panel.adsrrooster.com.br)
   Identidade: Roboto · fundo #07071C · accent #DB212A · dourado #F4B400 */

:root {
  --bg: #07071C;
  --bg2: #0D0D2B;
  --card: #12122E;
  --card2: #1A1A3E;
  --border: #26264A;
  --text: #F2F2F8;
  --muted: #9C9CB8;
  --accent: #DB212A;
  --gold: #F4B400;
  --green: #2EBD6B;
  --yellow: #F4B400;
  --red: #E5484D;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* .gate/.shell têm display próprio que venceria o atributo hidden — forçar */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: 'Roboto', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; }
button { font-family: inherit; }

/* ---------- Login gate ---------- */
.gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.gate__card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 40px; width: 100%; max-width: 420px; text-align: center;
}
.gate__card img { height: 40px; margin-bottom: 20px; }
.gate__card h1 { font-size: 20px; margin-bottom: 6px; }
.gate__card p { color: var(--muted); margin-bottom: 20px; font-size: 13px; }
.gate__card input {
  width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font-size: 14px; margin-bottom: 12px;
}
.gate__err { color: var(--red); font-size: 13px; margin-bottom: 10px; display: none; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar__brand { padding: 4px 8px 18px; }
.sidebar__brand img { height: 30px; display: block; }
.sidebar__brand small { color: var(--gold); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; }
.side-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); padding: 14px 8px 6px; }
.side-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--muted); cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font-size: 13.5px;
}
.side-item:hover { background: var(--card); color: var(--text); }
.side-item.is-active { background: var(--card2); color: var(--text); font-weight: 500; box-shadow: inset 3px 0 0 var(--accent); }
.side-item.is-soon { opacity: .45; cursor: default; }
.side-item .soon { margin-left: auto; font-size: 9px; letter-spacing: 1px; color: var(--gold); border: 1px solid var(--gold); border-radius: 99px; padding: 1px 7px; }

.main { flex: 1; padding: 24px 28px 60px; max-width: 1280px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.topbar h1 { font-size: 19px; font-weight: 600; margin-right: auto; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--card); color: var(--muted); border: 0; padding: 7px 13px; cursor: pointer; font-size: 12.5px; }
.seg button.is-on { background: var(--card2); color: var(--text); font-weight: 500; }
.chk { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.btn {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: 13px;
}
.btn:hover { border-color: var(--muted); }
.btn--accent { background: var(--accent); border-color: var(--accent); font-weight: 500; }
.btn--ghost { background: none; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Cards / KPIs ---------- */
.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.alert {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; cursor: pointer; border: 1px solid;
}
.alert--red { background: rgba(229,72,77,.08); border-color: rgba(229,72,77,.45); }
.alert--yellow { background: rgba(244,180,0,.07); border-color: rgba(244,180,0,.4); }
.alert--ok { background: rgba(46,189,107,.07); border-color: rgba(46,189,107,.35); cursor: default; }
.alert .go { margin-left: auto; color: var(--muted); font-size: 12px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.kpi--star { border-color: var(--gold); background: linear-gradient(160deg, rgba(244,180,0,.06), var(--card) 55%); }
.kpi__label { font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.kpi__value { font-size: 27px; font-weight: 700; margin-top: 6px; }
.kpi__sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.delta-up { color: var(--green); } .delta-down { color: var(--red); }
.badge { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 99px; font-weight: 500; }
.badge--green { background: rgba(46,189,107,.15); color: var(--green); }
.badge--yellow { background: rgba(244,180,0,.14); color: var(--gold); }
.badge--red { background: rgba(229,72,77,.15); color: var(--red); }
.badge--muted { background: var(--card2); color: var(--muted); }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.panel h3 small { color: var(--muted); font-weight: 400; margin-left: 8px; }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 56px; }
.spark i { flex: 1; background: var(--card2); border-radius: 2px 2px 0 0; min-height: 2px; }
.spark i.hot { background: var(--gold); }

/* ---------- Funil ---------- */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.fstage { display: grid; grid-template-columns: 170px 1fr 90px; align-items: center; gap: 12px; }
.fstage__name { font-size: 13px; color: var(--muted); text-align: right; }
.fstage__bar { height: 26px; background: var(--bg2); border-radius: 6px; overflow: hidden; }
.fstage__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ff5d64); border-radius: 6px; }
.fstage__bar i.pending { background: var(--card2); }
.fstage__val { font-size: 13px; }
.fstage__val .pct { color: var(--muted); font-size: 11.5px; margin-left: 5px; }

/* ---------- Tabelas ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }
tr.is-click { cursor: pointer; } tr.is-click:hover td { background: var(--card2); }
td.hot { color: var(--red); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }

/* ---------- Drill / drawer ---------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw); z-index: 41;
  background: var(--bg2); border-left: 1px solid var(--border); padding: 24px; overflow-y: auto;
}
.drawer h2 { font-size: 17px; margin-bottom: 4px; }
.drawer .close { position: absolute; top: 16px; right: 16px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 64px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 12.5px; }
.hbar__track { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.hbar__track i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11.5px; padding: 4px 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--border); color: var(--muted); }
.chip--done { border-color: var(--green); color: var(--green); }
.chip--error { border-color: var(--red); color: var(--red); }
.tl { list-style: none; }
.tl li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.tl .ev { font-weight: 500; min-width: 150px; }
.tl .when { margin-left: auto; color: var(--muted); white-space: nowrap; font-size: 11.5px; }

/* ---------- Prompts ---------- */
.prompt-row { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.prompt-row:last-child { border-bottom: 0; }
.prompt-row .k { font-weight: 500; font-size: 13px; min-width: 230px; }
.prompt-row .meta { color: var(--muted); font-size: 12px; }
.prompt-row .actions { margin-left: auto; display: flex; gap: 8px; }
.editor textarea {
  width: 100%; min-height: 320px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 14px; font-family: 'Roboto Mono', monospace; font-size: 12.5px; line-height: 1.55; resize: vertical;
}
.editor .ro { background: var(--bg2); border: 1px dashed var(--border); border-radius: 8px; padding: 12px; font-size: 12px; color: var(--muted); white-space: pre-wrap; margin-top: 10px; max-height: 180px; overflow-y: auto; }

/* Legenda interpretativa — "como ler este quadro" (regra: toda métrica explicada) */
.legend { margin: 0 0 14px; border: 1px dashed var(--border); border-radius: 10px; background: var(--bg2); }
.legend summary { cursor: pointer; padding: 10px 14px; font-size: 12.5px; color: var(--gold); list-style: none; }
.legend summary::-webkit-details-marker { display: none; }
.legend[open] summary { border-bottom: 1px dashed var(--border); }
.legend__body { padding: 12px 16px; font-size: 12.5px; line-height: 1.65; color: var(--muted); }
.legend__body b, .legend__body strong { color: var(--text); }
.legend__body ul { margin: 6px 0 6px 18px; }
.legend__body li { margin-bottom: 7px; }
th[title] { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }

.empty { text-align: center; color: var(--muted); padding: 36px 16px; font-size: 13.5px; }
.muted { color: var(--muted); }
.loading { text-align: center; padding: 50px; color: var(--muted); }
.spin { display:inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: sp 1s linear infinite; vertical-align: -4px; margin-right: 8px; }
@keyframes sp { to { transform: rotate(360deg); } }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--card2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 20px; font-size: 13px;
}
.toast--err { border-color: var(--red); }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side-label { display: none; }
  .main { padding: 16px; }
  .fstage { grid-template-columns: 110px 1fr 80px; }
  .prompt-row { flex-wrap: wrap; } .prompt-row .k { min-width: 100%; }
}
