@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --bg: #F3F6F9;
  --surface: #FFFFFF;
  --ink: #0F1A2B;
  --ink-muted: #5B6B82;
  --ink-faint: #93A2B8;
  --accent: #0EA5A4;
  --accent-dark: #0A7473;
  --accent-soft: #E3F6F5;
  --danger: #D64550;
  --danger-soft: #FBE7E9;
  --border: #E2E8F0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 26, 43, 0.04), 0 8px 24px rgba(15, 26, 43, 0.06);

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: var(--accent-dark); }

button, input, select {
  font-family: inherit;
  font-size: inherit;
}

/* ---------- Marca / signature element: arcos de sinal ---------- */
.signal-mark {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
}
.signal-mark span {
  display: block;
  width: 6px;
  margin: 0 2px;
  border-radius: 3px;
  background: var(--accent);
}
.signal-mark span:nth-child(1) { height: 12px; opacity: 0.45; }
.signal-mark span:nth-child(2) { height: 20px; opacity: 0.7; }
.signal-mark span:nth-child(3) { height: 28px; opacity: 1; }
.signal-mark span:nth-child(4) { height: 36px; opacity: 1; background: var(--accent-dark); }

/* ---------- Tela de login ---------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-shell::before,
.login-shell::after {
  content: '';
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 50%;
  opacity: 0.08;
}
.login-shell::before { width: 620px; height: 620px; top: -220px; right: -220px; }
.login-shell::after { width: 420px; height: 420px; bottom: -180px; left: -140px; }

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}
.login-card header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.login-card h1 { font-size: 20px; }
.login-card .subtitulo {
  color: var(--ink-muted);
  font-size: 13px;
  margin-top: 2px;
}

.campo { margin-bottom: 16px; }
.campo label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ink-muted);
}
.campo input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease;
}
.campo input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.botao {
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent-dark);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}
.botao:hover { background: var(--accent); }
.botao:active { transform: translateY(1px); }
.botao:disabled { opacity: 0.6; cursor: default; }
.botao.secundario {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--border);
}
.botao.secundario:hover { background: var(--accent-soft); border-color: var(--accent); }

.mensagem-erro {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.mensagem-erro.visivel { display: block; }

/* ---------- Layout do dashboard ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--ink);
  color: #EAF0F6;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
}
.sidebar .marca {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.sidebar .marca strong { font-family: var(--font-display); font-size: 15px; }
.sidebar .marca .signal-mark span { background: #4FD1D0; }
.sidebar .marca .signal-mark span:nth-child(4) { background: #7FE3E2; }

.sidebar nav { flex: 1; }
.sidebar .usuario {
  font-size: 12px;
  color: #93A6BE;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}
.sidebar .usuario strong { display: block; color: #EAF0F6; font-size: 14px; margin-top: 2px; }

.seletor-estabelecimento { margin-bottom: 20px; }
.seletor-estabelecimento label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7C90AA;
}
.seletor-estabelecimento select {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #EAF0F6;
}

.sidebar .sair {
  color: #93A6BE;
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 8px 0;
}
.sidebar .sair:hover { color: #fff; }

.conteudo { padding: 28px 32px; max-width: 1200px; }
.conteudo header.topo {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.conteudo header.topo h1 { font-size: 24px; }
.conteudo header.topo p { color: var(--ink-muted); margin-top: 4px; font-size: 14px; }

/* ---------- Cards de KPI ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.kpi .rotulo {
  font-size: 12px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi .valor {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  margin-top: 6px;
  color: var(--ink);
}
.kpi .valor.acento { color: var(--accent-dark); }

/* ---------- Painéis de gráfico ---------- */
.paineis {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 860px) { .paineis { grid-template-columns: 1fr; } }

.painel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.painel h2 { font-size: 15px; margin-bottom: 4px; }
.painel .descricao { font-size: 12px; color: var(--ink-muted); margin-bottom: 14px; }

/* ---------- Tabela ---------- */
.tabela-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tabela-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.tabela-topo input[type="search"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 220px;
  background: var(--bg);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

.paginacao {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  font-size: 12px;
  color: var(--ink-muted);
}
.paginacao .botoes { display: flex; gap: 8px; }
.paginacao button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}
.paginacao button:disabled { opacity: 0.4; cursor: default; }

/* ---------- Upload (admin) ---------- */
.upload-caixa {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--surface);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.upload-caixa .info h2 { font-size: 15px; }
.upload-caixa .info p { font-size: 12px; color: var(--ink-muted); margin-top: 4px; }
.upload-status { font-size: 12px; margin-top: 8px; }
.upload-status.sucesso { color: var(--accent-dark); }
.upload-status.erro { color: var(--danger); }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.vazio {
  text-align: center;
  color: var(--ink-faint);
  padding: 32px 20px;
  font-size: 13px;
}
