/* ===========================================================================
   Hotspot PIX — Painel
   Identidade: "centro de operações de rede" (NOC).
   Display: Space Grotesk · Texto: IBM Plex Sans · Dados: IBM Plex Mono
   =========================================================================== */

:root {
  --bg:       #EAEEF2;
  --surface:  #FFFFFF;
  --surface-2:#F6F8FA;
  --ink:      #0C1822;
  --muted:    #5E6F7C;
  --line:     #DCE3E9;
  --accent:   #1B5CFF;
  --accent-d: #1247CC;
  --online:   #12A150;
  --warn:     #E08700;
  --danger:   #E5484D;
  --radius:   10px;
  --shadow:   0 1px 2px rgba(12,24,36,.05), 0 8px 24px rgba(12,24,36,.05);
  --sidebar:  248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }

/* --- Login ---------------------------------------------------------------- */
#login {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background:
    radial-gradient(1200px 600px at 20% -10%, #1b3a6b22, transparent),
    var(--ink);
}
.login-card {
  width: min(360px, 90vw);
  background: var(--surface);
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login-card h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px; margin: 0 0 4px;
  letter-spacing: -.02em;
}
.login-card p { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.login-card .signal { margin-bottom: 18px; }

/* --- Shell ---------------------------------------------------------------- */
.app { display: none; min-height: 100%; }
.app.show { display: grid; grid-template-columns: var(--sidebar) 1fr; }

.sidebar {
  background: var(--ink);
  color: #C7D2DC;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 8px 22px;
}
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #4d82ff);
  display: grid; place-items: center; flex: none;
}
.brand .name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600; font-size: 16px; color: #fff; letter-spacing: -.01em;
}
.brand .name small { display: block; font-size: 11px; color: #8597a6; font-weight: 400; font-family: "IBM Plex Mono", monospace; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav button {
  all: unset;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 8px;
  color: #9fb0bd; cursor: pointer; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav button:hover { background: #16242f; color: #e7eef3; }
.nav button.active { background: var(--accent); color: #fff; }
.nav button svg { width: 18px; height: 18px; flex: none; }

.sidebar .foot { margin-top: auto; padding: 12px 8px 2px; }
.mk-status {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: #9fb0bd;
  border-top: 1px solid #1c2c38; padding-top: 14px;
}
.mk-status .label small { display:block; color:#6f818f; font-family:"IBM Plex Mono",monospace; }

/* --- Main ----------------------------------------------------------------- */
.main { min-width: 0; }
.topbar {
  height: 64px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 10;
}
.topbar h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px; margin: 0; letter-spacing: -.02em;
}
.topbar .right { display: flex; align-items: center; gap: 16px; }
.btn-logout { all: unset; cursor: pointer; color: var(--muted); font-size: 13px; }
.btn-logout:hover { color: var(--ink); }

.content { padding: 26px 28px 60px; max-width: 1180px; }

/* --- KPI cards ------------------------------------------------------------ */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.kpi .k-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.kpi .k-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 27px; font-weight: 600; margin-top: 7px; letter-spacing: -.02em;
}
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi.accent { border-top: 3px solid var(--accent); }
.kpi.online { border-top: 3px solid var(--online); }
.kpi.warn   { border-top: 3px solid var(--warn); }

/* --- Panels & tables ------------------------------------------------------ */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 22px; overflow: hidden;
}
.panel > header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.panel > header h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px; margin: 0; letter-spacing: -.01em;
}
.panel > header .live { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600; padding: 11px 18px; background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
td { padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }

/* --- Badges --------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
}
.badge::before { content:""; width:6px; height:6px; border-radius:50%; background: currentColor; }
.badge.pago      { color: var(--online);  background: #12a1501a; }
.badge.pendente  { color: var(--warn);    background: #e087001a; }
.badge.expirado  { color: var(--muted);   background: #5e6f7c1a; }
.badge.cancelado { color: var(--danger);  background: #e5484d1a; }
.badge.inativo   { color: var(--muted);   background: #5e6f7c1a; }
.badge.ativo     { color: var(--online);  background: #12a1501a; }

/* --- Signal (signature element) ------------------------------------------- */
.signal { display: inline-flex; align-items: flex-end; gap: 3px; height: 16px; }
.signal i {
  width: 4px; border-radius: 2px; background: var(--online);
  animation: pulse 1.2s ease-in-out infinite;
}
.signal i:nth-child(1){ height: 5px;  animation-delay: 0s; }
.signal i:nth-child(2){ height: 9px;  animation-delay: .15s; }
.signal i:nth-child(3){ height: 13px; animation-delay: .3s; }
.signal i:nth-child(4){ height: 16px; animation-delay: .45s; }
.signal.off i { background: var(--muted); animation: none; opacity: .5; }
@keyframes pulse { 0%,100%{ opacity:.35; } 50%{ opacity:1; } }
@media (prefers-reduced-motion: reduce) { .signal i { animation: none; opacity: 1; } }

/* --- Buttons & forms ------------------------------------------------------ */
.btn {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 500;
  padding: 9px 15px; border-radius: 8px; transition: background .15s;
}
.btn:hover { background: var(--accent-d); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid #e5484d40; }
.btn.danger:hover { background: #e5484d12; }

label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 5px; font-weight: 500; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* --- Dashboards ----------------------------------------------------------- */
.dash-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;
}
.panel-body { padding: 18px; }

/* Gráfico de barras (faturamento por dia) */
.chart-bars {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px;
  align-items: end; height: 180px; padding-top: 6px;
}
.cb-col {
  display: flex; flex-direction: column; align-items: center; height: 100%;
}
.cb-val {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink);
  margin-bottom: 5px; height: 14px; white-space: nowrap;
}
.cb-bar-area { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.cb-bar {
  width: 70%; max-width: 40px; background: var(--accent);
  border-radius: 4px 4px 0 0; min-height: 3px; transition: height .3s;
}
.cb-bar.zero { background: var(--line); }
.cb-day { font-size: 12px; color: var(--muted); margin-top: 8px; text-transform: capitalize; }

.bars-h { display: flex; flex-direction: column; gap: 12px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
@media (max-width: 700px) { .grid-form { grid-template-columns: 1fr; } }
.bar-row { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 10px; }
.bar-label { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--surface-2); border-radius: 5px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 5px; min-width: 3px; transition: width .3s; }
.bar-val { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 920px) {
  .dash-grid { grid-template-columns: 1fr; }
}
.hint { font-size: 11px; color: var(--muted); margin-top: 4px; font-family: "IBM Plex Mono", monospace; }

/* --- Modal ---------------------------------------------------------------- */
.modal-bg { position: fixed; inset: 0; background: rgba(12,24,36,.5); display: none; place-items: center; z-index: 40; }
.modal-bg.show { display: grid; }
.modal {
  width: min(480px, 92vw); background: var(--surface);
  border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.3); overflow: hidden;
}
.modal header { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal header h3 { font-family: "Space Grotesk", sans-serif; margin: 0; font-size: 17px; }
.modal .body { padding: 4px 22px 22px; max-height: 70vh; overflow: auto; }
.modal footer { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* --- Toast ---------------------------------------------------------------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; transition: all .25s; z-index: 60; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 880px) {
  .app.show { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { padding: 8px; }
  .nav { flex-direction: row; flex-wrap: wrap; margin: 0; }
  .sidebar .foot { margin: 0 0 0 auto; }
  .mk-status { border: none; padding: 0; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 18px; }
  table { font-size: 12px; }
}
