.page {
  margin: 0 auto;
  padding: 1.5rem;
  max-width: 1100px;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #1c1c1c;
  background: #f5f7fa;
}

.hidden {
  display: none !important;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.tab-button {
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #e0e7ff;
  color: #1e3a8a;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.tab-button:hover {
  background: #c7d2fe;
}

.tab-button.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

.tab-panels {
  margin-top: 1.2rem;
}

.tab-panel {
  margin-top: 0;
}

.tab-section {
  margin-top: 1.4rem;
}

.tab-section:first-of-type {
  margin-top: 0;
}

header h1 {
  margin-bottom: 0.5rem;
  font-size: 1.9rem;
}

header p {
  margin-top: 0;
  max-width: 760px;
  color: #46546a;
}

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.2rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}

.auth-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
}

.field label {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field input,
.field select {
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #fdfdff;
  transition: border-color 0.2s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.field small {
  margin-top: 0.3rem;
  color: #64748b;
}

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

.results h3 {
  margin-bottom: 0.4rem;
  color: #1f2937;
}

.result {
  font-size: 1.2rem;
  font-weight: 600;
  color: #0f172a;
}

.hint {
  margin-top: 1rem;
  color: #6b7280;
  font-size: 0.9rem;
}

.child-list {
  margin-bottom: 1.2rem;
}

.pill-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-list li {
  margin: 0;
}

.pill-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.pill-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: none;
  background: #e0e7ff;
  color: #1e3a8a;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.pill-button:hover {
  background: #c7d2fe;
}

.pill-button.active {
  background: #2563eb;
  color: #ffffff;
}

.pill-delete-button {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.pill-delete-button:hover {
  background: #fecaca;
  color: #7f1d1d;
}

.primary-button {
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.primary-button:hover {
  background: #1d4ed8;
}

.primary-button:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}

.secondary-button {
  padding: 0.65rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #cbd5f5;
  background: #ffffff;
  color: #1f2937;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.secondary-button:hover {
  background: #e0e7ff;
  border-color: #94a3b8;
}

.secondary-button:active {
  background: #c7d2fe;
  border-color: #64748b;
}

.data-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.import-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.import-form input[type="file"] {
  padding: 0.4rem 0;
}

.field.full {
  grid-column: 1 / -1;
}

.small-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.account-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.age-display {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.6rem 0.75rem;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #f8fafc;
  min-height: 54px;
}

.age-display span {
  font-weight: 600;
  color: #1f2937;
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

thead {
  background: #f1f5f9;
  color: #0f172a;
}

tbody tr:hover {
  background: #f8fafc;
}

.chart-card {
  position: relative;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  background: #f1f5f9;
  border-radius: 8px;
  overflow: hidden;
}

.chart-wrapper::before {
  content: "";
  display: block;
  padding-bottom: 75%;
  pointer-events: none;
}

.chart-wrapper canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.error-banner {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.success-banner {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

@media (max-width: 600px) {
  .page {
    padding: 1rem;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .primary-button {
    width: 100%;
  }
}
