/* Orcamentos Resolar - estilo limpo e legivel */
/* Identidade Resolar: laranja #f3922b (primaria), verde #7ed957 (secundaria),
   cinza #5a5358 (neutra), preto #191923 (texto). Titulos Montserrat / corpo Arimo. */

:root {
  --bg: #f7f7f8;
  --bg-card: #ffffff;
  --border: #e6e4e7;
  --text: #191923;          /* preto da marca */
  --text-muted: #5a5358;    /* cinza da marca */
  --primary: #f3922b;       /* laranja da marca */
  --primary-dark: #d97b18;  /* hover */
  --brand-green: #7ed957;   /* verde da marca — acentos/graficos */
  --success: #5fae3a;       /* verde escurecido, legivel em texto */
  --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;
  --fonte-titulo: "Montserrat", -apple-system, "Segoe UI", Roboto, sans-serif;
  --fonte-corpo: "Arimo", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--fonte-corpo);
  font-size: 14px;
}

h1, h2, h3 { font-family: var(--fonte-titulo); color: var(--text); }

.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-logo { width: 190px; max-width: 70%; height: auto; display: block; margin: 0 auto 18px; }
.login-card h1 { margin: 0 0 4px; font-size: 1.25rem; }
.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: center; }
.topbar-logo { height: 26px; width: auto; display: block; }
.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; }

/* ===== BOTÃO RELATÓRIO (cores Resolar) ===== */
.topbar-actions button.report-btn {
  background: #191923;
  color: #f3922b;
  border-color: #191923;
  font-weight: 600;
}
.topbar-actions button.report-btn:hover { background: #2b2b38; }

/* ===== MODAL RELATÓRIO ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(25, 25, 35, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}
.report-modal-card { border-top: 4px solid #f6e497; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  background: #0d141a;
  color: #f6e497;
}
.modal-header h2 { margin: 0; font-size: 1.05rem; }
.modal-close {
  background: transparent;
  border: none;
  color: #98999a;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: #f6e497; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.report-field { display: flex; flex-direction: column; gap: 6px; }
.report-field label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.report-field input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}
.report-week-nav { display: flex; gap: 8px; }
.report-week-nav button {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
}
.report-week-nav button:hover { background: #f8fafc; }
.report-range-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.report-weekend-opts {
  margin-top: 8px;
  padding: 10px 12px;
  background: #f7f9fc;
  border-left: 3px solid #f6e497;
  border-radius: 6px;
}
.report-weekend-opts .report-chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  margin-right: 14px;
}
.report-weekend-opts .report-chk input { width: 15px; height: 15px; cursor: pointer; }
.report-range {
  margin: 0;
  padding: 12px 14px;
  background: #fdf9e3;
  border: 1px solid #f6e497;
  border-radius: 8px;
  font-weight: 600;
  color: #0d141a;
  text-align: center;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}
.modal-footer button {
  padding: 9px 18px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
.modal-footer button.ghost { background: transparent; }
.modal-footer button.report-btn {
  background: #0d141a;
  color: #f6e497;
  border-color: #0d141a;
  font-weight: 600;
}
.modal-footer button.report-btn:hover { background: #1a242e; }
.modal-footer button:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== 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; }
}
