/* Dashboard RSK - estilo limpo e legivel */

:root {
  --bg: #f4f6fa;
  --bg-card: #ffffff;
  --border: #e3e7ee;
  --text: #1e2a3a;
  --text-muted: #6b7888;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.04);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 0.875rem; }

/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card h1 { margin: 0 0 4px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.login-card input {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}
.login-card button {
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
}
.login-card button:hover { background: var(--primary-dark); }
.error { color: var(--danger); margin-top: 12px; }

/* ===== TOPBAR ===== */
.topbar {
  background: var(--bg-card);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.1rem; margin: 0; }
.brand { display: flex; gap: 14px; align-items: baseline; }
.topbar-actions { display: flex; gap: 8px; }
.topbar-actions button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}
.topbar-actions button:hover { background: #f8fafc; }
.topbar-actions button.ghost { background: transparent; }

/* ===== FILTROS ===== */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.filter-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-group label { font-size: 0.875rem; color: var(--text-muted); }
.filter-group input, .filter-group select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  font-size: 0.875rem;
}
.period-buttons { display: flex; gap: 4px; }
.period-buttons button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}
.period-buttons button.active { background: var(--primary); color: white; border-color: var(--primary); }
.product-checks {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
}
.product-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  cursor: default;
  user-select: none;
}

/* ===== KPIs ===== */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 20px 24px;
}
.kpi {
  background: var(--bg-card);
  padding: 14px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-value { font-size: 1.8rem; font-weight: 600; }
.kpi-value-sm { font-size: 1rem; font-weight: 500; }
.kpi-sub { font-size: 0.85rem; color: var(--text-muted); }

/* ===== CHARTS ===== */
.charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 0 24px 16px;
}
.chart-card {
  background: var(--bg-card);
  padding: 18px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 320px;
}
.chart-card.full { grid-column: 1 / -1; }
.chart-card h2 { font-size: 1rem; margin: 0 0 12px; color: var(--text-muted); }
.chart-card canvas { max-height: 380px; }
.small { font-size: 0.78rem; margin-top: 8px; }

/* Badges de média semanal agora são desenhadas direto no canvas (ver app.js) */

/* ===== SEM TAG SECTION ===== */
.no-tag-section {
  background: var(--bg-card);
  margin: 0 24px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.no-tag-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.no-tag-header h2 { font-size: 1rem; margin: 0; color: var(--text-muted); }
.no-tag-header h2 #no-tag-count {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 600;
}
.no-tag-section .table-wrapper { max-height: 320px; overflow: auto; }
.no-tag-section table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.no-tag-section thead { background: #f8fafc; position: sticky; top: 0; }
.no-tag-section th, .no-tag-section td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.no-tag-section th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.no-tag-section .table-footer { margin-top: 8px; color: var(--text-muted); font-size: 0.8rem; }

/* ===== TAGS / BADGES ===== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-right: 4px;
  background: #e0e7ff;
  color: #3730a3;
}
.tag.grande { background: #d1fae5; color: #065f46; }
.tag.pequeno { background: #fef3c7; color: #92400e; }
.tag.renego { background: #fce7f3; color: #9d174d; }

/* ===== RESPONSIVO ===== */
@media (max-width: 800px) {
  .topbar { padding: 12px 16px; }
  .filters { padding: 12px 16px; }
  .kpis { padding: 12px 16px; }
  .charts { padding: 0 16px 16px; }
  .no-tag-section { margin: 0 16px 16px; }
}
