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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f6fa;
  color: #2d3436;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

/* Auth Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: #fff;
  border-radius: 8px;
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.modal h2 {
  margin-bottom: 0.5rem;
}

.modal p {
  color: #636e72;
  margin-bottom: 1.5rem;
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal input {
  padding: 0.75rem;
  border: 1px solid #dfe6e9;
  border-radius: 6px;
  font-size: 1rem;
}

.modal input:focus {
  outline: none;
  border-color: #0984e3;
  box-shadow: 0 0 0 3px rgba(9, 132, 227, 0.15);
}

.modal button {
  padding: 0.75rem;
  background: #0984e3;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.modal button:hover {
  background: #0770c2;
}

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

/* Header */
header {
  background: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dfe6e9;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

#logout-btn {
  padding: 0.4rem 1rem;
  background: none;
  border: 1px solid #b2bec3;
  border-radius: 6px;
  color: #636e72;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}

#logout-btn:hover {
  border-color: #d63031;
  color: #d63031;
}

/* Controls */
.controls {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: #fff;
  border-bottom: 1px solid #dfe6e9;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 180px;
}

.control-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #636e72;
  letter-spacing: 0.5px;
}

.control-group select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #dfe6e9;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fff;
  cursor: pointer;
}

.control-group select:focus {
  outline: none;
  border-color: #0984e3;
  box-shadow: 0 0 0 3px rgba(9, 132, 227, 0.15);
}

/* Chart */
.chart-container {
  padding: 1.5rem 2rem;
  background: #fff;
  margin: 1.5rem 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Table */
.table-container {
  padding: 1.5rem 2rem;
  background: #fff;
  margin: 0 2rem 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.table-container h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: #636e72;
}

#table-wrapper {
  overflow-x: auto;
}

#data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

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

#data-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #636e72;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
}

#data-table tbody tr:nth-child(even) {
  background: #fafbfc;
}

#data-table tbody tr:hover {
  background: #f0f7ff;
}

/* Loading */
#loading {
  text-align: center;
  padding: 3rem;
  color: #636e72;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #dfe6e9;
  border-top-color: #0984e3;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#no-data {
  text-align: center;
  padding: 3rem 2rem;
  color: #636e72;
}

/* Responsive */
@media (max-width: 768px) {
  header {
    padding: 1rem;
  }

  header h1 {
    font-size: 1rem;
  }

  .controls {
    padding: 1rem;
    flex-direction: column;
  }

  .control-group {
    min-width: 100%;
  }

  .chart-container,
  .table-container {
    margin: 1rem;
    padding: 1rem;
  }
}
