* { box-sizing: border-box; margin: 0; padding: 0; }
:root { --bg:#0a0a0b; --card:#141416; --line:#26262b; --muted:#8a8a92; --txt:#ececf0; --green:#1fc26b; --red:#ef4444; --blue:#9cc7ff; }
body { background: var(--bg); color: var(--txt); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; min-height: 100vh; }
.hidden { display: none !important; }

/* cards centrais (login / mfa) */
.card { max-width: 380px; margin: 8vh auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px; }
.card h1 { font-size: 22px; margin-bottom: 6px; }
.adm { color: var(--txt); font-weight: 800; }
.sub { color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 18px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 12px; line-height: 1.5; }
code { color: var(--txt); font-family: ui-monospace, Menlo, monospace; word-break: break-all; }

.field { width: 100%; padding: 12px 14px; background: #0e0e10; border: 1px solid var(--line); border-radius: 10px; color: var(--txt); font-size: 15px; outline: none; }
.field:focus { border-color: #4a4a52; }
.field.code { text-align: center; letter-spacing: 8px; font-size: 22px; font-family: ui-monospace, Menlo, monospace; }
.field.sm-field { width: auto; padding: 8px 10px; font-size: 13px; }
.field.grow { flex: 1; min-width: 160px; }
select.field { cursor: pointer; }

/* barra de ferramentas dos painéis (filtros / busca / ações) */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.month-nav { display: flex; align-items: center; gap: 4px; }
.hint.chk { display: flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; white-space: nowrap; }
.hint.chk-line { display: flex; gap: 8px; align-items: center; margin: 0 0 8px; cursor: pointer; }
.summary { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.summary b { color: var(--txt); }
.count { color: var(--muted); font-size: 13px; font-weight: 500; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: #1c1c20; color: var(--txt); font-size: 15px; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: #3a3a42; }
.btn.primary { background: #fff; color: #0a0a0b; border: none; }
.btn.primary:hover { opacity: .9; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--red); border: none; color: #fff; }
.btn.sm { width: auto; margin: 0; padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }

.msg { margin-top: 10px; font-size: 13px; min-height: 18px; }
.msg.ok { color: var(--green); } .msg.err { color: var(--red); }
.qr { display: flex; justify-content: center; margin: 8px 0; }
.qr svg, .qr img { width: 196px; height: 196px; background: #fff; border-radius: 10px; padding: 8px; }

/* turnstile */
#login-turnstile { display: flex; justify-content: center; margin-top: 14px; min-height: 1px; }

/* app */
#app { max-width: 1120px; margin: 0 auto; padding: 18px 18px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 10; padding-top: 4px; }
.brand { display: inline-flex; align-items: center; line-height: 0; flex-shrink: 0; }
.brand img { height: 24px; width: auto; display: block; }
.topright { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.who { color: var(--muted); font-size: 13px; }

/* abas de navegação */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 8px 14px; border: none; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--txt); background: #1c1c20; }
.tab.active { background: #1c1c20; color: var(--txt); border: 1px solid var(--line); }

.view { margin-top: 20px; }
.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.view-head h2 { font-size: 18px; }

/* KPIs da visão geral */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.kpi .k { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.kpi .v { font-size: 22px; font-weight: 700; }
.kpi .s { display: block; color: var(--muted); font-size: 11.5px; margin-top: 4px; }

/* gráfico de barras (faturamento por mês) */
.chart { display: flex; align-items: flex-end; gap: 12px; height: 200px; padding: 8px 4px 0; }
.chart .empty { width: 100%; text-align: center; color: var(--muted); align-self: center; }
.cbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.cbar .cval { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; white-space: nowrap; }
.cbar.now .cval { color: var(--txt); font-weight: 700; }
.cbar .cfill { width: 100%; max-width: 72px; background: #2c2c33; border-radius: 8px 8px 3px 3px; min-height: 3px; transition: height .3s ease; }
.cbar.now .cfill { background: #fff; }
.cbar .clabel { font-size: 11.5px; color: var(--muted); margin-top: 7px; text-transform: capitalize; white-space: nowrap; }
.cbar .ccount { font-size: 10.5px; color: #5c5c64; margin-top: 1px; white-space: nowrap; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 17px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid #1c1c20; vertical-align: middle; }
.tbl tbody tr:hover td { background: #17171a; }
.tbl td.email { font-weight: 600; }
.tbl .empty { text-align: center; color: var(--muted); padding: 28px; }
.badge { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge.on { background: rgba(31,194,107,.15); color: var(--green); }
.badge.off { background: #232329; color: var(--muted); }
.badge.blue { background: #1e3a5f; color: var(--blue); }
.badge.warn { background: rgba(239,68,68,.12); color: #ff8585; }
.acts { display: flex; gap: 6px; white-space: nowrap; justify-content: flex-end; }
.mini { padding: 5px 9px; font-size: 12px; border: 1px solid var(--line); border-radius: 7px; background: #1c1c20; color: var(--txt); cursor: pointer; }
.mini:hover { border-color: #3a3a42; }
.mini.danger { color: #ff8585; border-color: #50232a; }

/* formulários dos modais */
.modal-title { font-size: 18px; margin-bottom: 16px; }
.flabel { display: block; color: var(--muted); font-size: 12px; margin: 0 0 5px; }
.modal-box .field { margin-bottom: 12px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { padding: 6px 12px; font-size: 13px; border: 1px solid var(--line); border-radius: 999px; background: #1c1c20; color: var(--txt); cursor: pointer; }
.chip:hover { border-color: #3a3a42; }
.chip.active { background: #fff; color: #0a0a0b; border-color: #fff; }

/* modal + toast */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }
.modal-box p { line-height: 1.5; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { margin: 0; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 12px 20px; border-radius: 10px; font-size: 14px; z-index: 60; max-width: 90vw; }
.toast.ok { background: var(--green); color: #04130a; } .toast.err { background: var(--red); color: #fff; }

@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; }
  .brand img { height: 20px; }
  .chart { height: 160px; gap: 6px; }
  .cbar .ccount { display: none; }
  .fgrid { grid-template-columns: 1fr; gap: 0; }
}

/* ===== ajustes Balaclava ===== */
.brand-txt { font-size: 15px; font-weight: 800; color: var(--txt); letter-spacing: -0.02em; white-space: nowrap; }
.brand-txt .adm { color: var(--muted); font-weight: 600; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
