* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f3f4f6;
  color: #111827;
}

.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.login-card {
  background: white;
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-card h1 {
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
  text-align: center;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.login-card input,
.admin-form input,
.admin-form select,
input[type='date'] {
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
}

button {
  cursor: pointer;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  background: #2563eb;
  color: white;
  font-size: 0.875rem;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error {
  color: #dc2626;
  font-size: 0.875rem;
}

.dashboard,
.admin-page {
  padding: 1.5rem;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.header-logos {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-marca {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-actions a {
  color: #2563eb;
  text-decoration: none;
  font-size: 0.875rem;
}

.user-badge {
  font-size: 0.8rem;
  color: #4b5563;
}

.machine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
}

.machine-chart {
  background: white;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.machine-chart h3 {
  margin-top: 0;
}

.admin-form {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 420px;
  margin-bottom: 2rem;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.profiles-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 0.5rem;
  overflow: hidden;
}

.profiles-table th,
.profiles-table td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

/* Dashboard estilo Power BI */

.atualizado-em {
  font-size: 0.85rem;
  color: #4b5563;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.maquina-card {
  background: white;
  border-radius: 0.9rem;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-height: 340px;
  transition: transform 0.1s ease;
}

.maquina-card:hover {
  transform: translateY(-2px);
}

.card-topo {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  min-height: 2.6rem;
}

.card-topo h3 {
  margin: 0;
  font-size: 1.2rem;
}

.status-icone {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.status-icone-grande {
  font-size: 2rem;
  position: absolute;
  top: 0;
  right: 0;
}

.card-metrica {
  margin: 0.25rem 0;
  font-size: 0.95rem;
  color: #374151;
  min-height: 1.3rem;
}

.gauge-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.gauge-svg {
  width: 100%;
  max-width: 260px;
}

.gauge-valor {
  margin-top: -1.8rem;
  font-size: 1.8rem;
  font-weight: 600;
  color: #374151;
}

.gauge-valor-grande {
  font-size: 2.5rem;
  margin-top: -2.5rem;
}

.gauge-grande {
  max-width: 380px;
  margin: 0 auto;
}

.gauge-limites {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #6b7280;
  padding: 0 0.5rem;
}

.maquina-detalhe {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 2rem;
  align-items: start;
}

.maquina-resumo {
  background: white;
  border-radius: 0.9rem;
  padding: 1.5rem;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.resumo-linha {
  font-size: 0.9rem;
  color: #374151;
}

.hora-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 0.5rem;
  overflow: hidden;
  font-size: 0.85rem;
}

.hora-table th,
.hora-table td {
  padding: 0.45rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.pct-bom {
  color: #16a34a;
  font-weight: 600;
}

.pct-ruim {
  color: #dc2626;
  font-weight: 600;
}

.prog-filtros {
  display: flex;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.prog-filtros label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.prog-filtros input {
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
}

.prog-acordeao {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  margin-bottom: 1rem;
  overflow: hidden;
}

.prog-acordeao-cabecalho {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  cursor: pointer;
  list-style: none;
  font-size: 1rem;
}

.prog-acordeao-cabecalho::-webkit-details-marker {
  display: none;
}

.prog-acordeao-cabecalho::before {
  content: '▸';
  margin-right: 0.5rem;
  color: #6b7280;
  transition: transform 0.15s ease;
}

.prog-acordeao[open] .prog-acordeao-cabecalho::before {
  transform: rotate(90deg);
}

.prog-acordeao-maquina {
  font-weight: 600;
  font-size: 1.05rem;
}

.prog-acordeao-meta {
  color: #374151;
  font-size: 0.95rem;
}

.prog-acordeao-corpo {
  padding: 0 1.5rem 1.25rem;
}

@media (max-width: 800px) {
  .maquina-detalhe {
    grid-template-columns: 1fr;
  }
}
