/* ============================================
   BackupNFC-e — folha de estilo unica
   Alterar cores/tipografia aqui afeta todas as paginas
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #0D1117;
  --surface: #161B22;
  --border:  #30363D;
  --text:    #E6EDF3;
  --muted:   #7D8590;
  --accent:  #2D7DD2;
  --green:   #3FB950;
  --red:     #F85149;
  --orange:  #D29922;

  --fonte:   'Segoe UI', sans-serif;
  --raio:    8px;
  --raio-lg: 12px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--fonte);
  min-height: 100vh;
}

/* paginas de login e convite ficam centralizadas */
body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
}

button { font-family: inherit; cursor: pointer; }

/* ---------- Cabecalho ---------- */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header h1 { font-size: 18px; font-weight: 700; }
header h1 span { color: var(--accent); }
.user { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 16px; }
.user a { color: var(--accent); text-decoration: none; font-size: 13px; cursor: pointer; }

.container { max-width: 1000px; margin: 32px auto; padding: 0 24px; }
h2 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }

/* ---------- Cartao de login / convite ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--raio-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.logo { text-align: center; margin-bottom: 32px; }
.logo h1 { font-size: 22px; font-weight: 700; }
.logo h1 span { color: var(--accent); }
.logo p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.field { margin-bottom: 20px; }
.links { text-align: center; margin-top: 20px; font-size: 13px; color: var(--muted); }
.links a { color: var(--accent); text-decoration: none; }

.card button {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--raio);
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  transition: opacity .2s;
}
.card button:hover { opacity: .85; }

/* ---------- Formularios ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--raio);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
input:focus, select:focus { border-color: var(--accent); }
.modal-box input, .modal-box select, #painelLogin input { margin-bottom: 16px; }

/* ---------- Mensagens ---------- */
.msg { border-radius: var(--raio); padding: 10px 14px; font-size: 13px; margin-bottom: 16px; display: none; }
.msg.erro, .erro {
  background: rgba(248,81,73,.1);
  border: 1px solid rgba(248,81,73,.3);
  border-radius: var(--raio);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 16px;
  display: none;
}
.msg.ok {
  background: rgba(63,185,80,.1);
  border: 1px solid rgba(63,185,80,.3);
  color: var(--green);
}

/* ---------- Botoes ---------- */
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--raio);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  transition: opacity .2s;
}
.btn:hover { opacity: .85; }
.btn-sm {
  background: rgba(45,125,210,.15);
  color: var(--accent);
  border: 1px solid rgba(45,125,210,.3);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
}
.btn-red {
  background: rgba(248,81,73,.15);
  color: var(--red);
  border: 1px solid rgba(248,81,73,.3);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
}
.btn-cancel {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--raio);
  padding: 9px 18px;
  font-size: 13px;
}
.btn-download {
  background: rgba(45,125,210,.15);
  color: var(--accent);
  border: 1px solid rgba(45,125,210,.3);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  text-decoration: none;
}
.btn-download:hover { background: rgba(45,125,210,.3); }
.btn-download:disabled { opacity: .5; cursor: default; }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 28px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all .2s;
}
.tab.ativo { color: var(--accent); border-bottom-color: var(--accent); }
.painel { display: none; }
.painel.ativo { display: block; }
.topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

/* ---------- Tabelas ---------- */
table {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  border-collapse: collapse;
  overflow: hidden;
}
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.on { background: rgba(63,185,80,.15); color: var(--green); }
.badge.off { background: rgba(248,81,73,.15); color: var(--red); }

/* ---------- Dashboard do contador ---------- */
.clientes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 40px; }
.cliente-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: border-color .2s;
}
.cliente-card:hover, .cliente-card.ativo { border-color: var(--accent); }
.cliente-card .nome { font-weight: 600; font-size: 14px; }
.cliente-card .cnpj { font-size: 12px; color: var(--muted); margin-top: 4px; font-family: monospace; }

.backups { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.backup-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: grid;
  grid-template-columns: 1fr 140px 100px;
}
.backup-row {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 140px 100px;
  align-items: center;
  font-size: 13px;
}
.backup-row:last-child { border-bottom: none; }
.backup-row:hover { background: rgba(255,255,255,.02); }
.arquivo { font-family: monospace; font-size: 12px; }
.tamanho { color: var(--muted); }

/* ---------- Modais ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hide { display: none; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--raio-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
}
.modal-box h3 { font-size: 17px; margin-bottom: 24px; }
.modal-btns { display: flex; gap: 10px; margin-top: 8px; }

.token-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--raio);
  padding: 10px 14px;
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
  margin: 12px 0;
  color: var(--green);
}
.link-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--raio);
  padding: 10px 14px;
  font-size: 12px;
  word-break: break-all;
  margin: 12px 0;
  color: var(--accent);
}

.vazio { padding: 40px; text-align: center; color: var(--muted); font-size: 14px; }
