:root {
  --bg: #f6efe4;
  --ink: #1f2b2f;
  --muted: #607178;
  --line: rgba(32, 51, 52, 0.12);
  --card: rgba(255, 252, 247, 0.88);
  --teal: #2f6f6d;
  --teal-strong: #214f4e;
  --coral: #dd785e;
  --gold: #d5a94d;
  --shadow: 0 20px 60px rgba(49, 64, 63, 0.12);
  font-family: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(221, 120, 94, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(47, 111, 109, 0.16), transparent 28%),
    linear-gradient(180deg, #f8f2e8 0%, #f3ebdf 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.35) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 92%);
}

.page-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.hero,
.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 28px;
  backdrop-filter: blur(18px);
  background: var(--card);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  padding: 22px 24px;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -36% auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(213, 169, 77, 0.28) 0%, rgba(213, 169, 77, 0) 74%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.83rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 600;
}

h1 {
  max-width: 12ch;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1;
}

.hero-copy,
.section-copy,
.toolbar-hint,
.student-meta,
label,
input,
select,
textarea,
button {
  font-size: 0.98rem;
}

.hero-copy,
.section-copy,
.toolbar-hint,
.student-meta,
.empty-state,
.history-row p {
  color: var(--muted);
}

.tab-bar {
  display: grid;
  gap: 10px;
  align-content: start;
}

.tab-button,
.solid-button,
.ghost-button,
.text-button,
.status-chip {
  border: 1px solid var(--line);
  border-radius: 16px;
  font: inherit;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}

.tab-button {
  padding: 11px 14px;
  text-align: left;
  background: rgba(255, 255, 255, 0.64);
  font-weight: 700;
}

.tab-button.active {
  border-color: rgba(47, 111, 109, 0.2);
  background: rgba(47, 111, 109, 0.14);
  color: var(--teal-strong);
}

button:hover {
  transform: translateY(-1px);
}

.page-sections {
  margin-top: 14px;
}

.page-section {
  display: none;
}

.page-section.active {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 18px;
}

.date-toolbar,
.month-toolbar,
.toolbar-actions,
.section-heading,
.student-card-header,
.student-meta,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.date-center {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.month-toolbar {
  margin-top: 8px;
}

.month-field {
  min-width: 180px;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.9);
}

textarea {
  resize: vertical;
}

.solid-button,
.ghost-button {
  padding: 10px 14px;
  font-weight: 700;
}

.solid-button {
  border-color: var(--teal-strong);
  background: var(--teal-strong);
  color: white;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--teal-strong);
  padding: 0;
  font-weight: 700;
}

.attendance-stats,
.report-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hero-stat-grid {
  display: grid;
  gap: 10px;
}

.hero-stat {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(47, 111, 109, 0.08);
}

.stat-button {
  text-align: left;
}

.hero-stat strong {
  display: block;
  font-size: 1.1rem;
}

.student-list,
.history-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.student-card {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 248, 239, 0.88));
}

.student-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.1fr) auto auto minmax(140px, 0.9fr);
  align-items: center;
  gap: 10px;
}

.student-main {
  display: grid;
  gap: 2px;
}

.student-name {
  font-size: 1rem;
}

.meal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(47, 111, 109, 0.1);
}

.meal-toggle input,
.toggle-row input {
  width: auto;
  accent-color: var(--teal);
}

.attendance-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0;
}

.status-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.status-chip.active[data-status="present"] {
  border-color: rgba(47, 111, 109, 0.2);
  background: rgba(47, 111, 109, 0.14);
  color: var(--teal-strong);
}

.status-chip.active[data-status="late"] {
  border-color: rgba(213, 169, 77, 0.2);
  background: rgba(213, 169, 77, 0.18);
}

.status-chip.active[data-status="absent"] {
  border-color: rgba(221, 120, 94, 0.2);
  background: rgba(221, 120, 94, 0.16);
  color: #873e29;
}

.status-chip.active[data-status="unknown"] {
  border-color: rgba(96, 113, 120, 0.16);
  background: rgba(96, 113, 120, 0.12);
}

.report-toolbar,
.stack-form,
.reports-grid,
.billing-grid {
  display: grid;
  gap: 14px;
}

.name-row {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.4fr) 110px minmax(0, 1.4fr);
}

.reports-grid {
  grid-template-columns: 1fr;
  align-items: start;
}

.report-toolbar {
  grid-template-columns: repeat(3, minmax(0, 240px));
  align-items: end;
  margin-top: 18px;
}

.student-report-toolbar {
  grid-template-columns: minmax(180px, 1.3fr) repeat(2, minmax(0, 190px)) auto;
}

.billing-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.billing-grid .billing-wide {
  grid-column: 1 / -1;
}

.billing-grid .billing-half {
  grid-column: span 1;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
}

.history-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.history-row p {
  margin: 4px 0 0;
}

.history-values {
  display: grid;
  gap: 6px;
  justify-items: end;
  color: var(--muted);
  font-size: 0.92rem;
}

.ledger-action {
  font-size: 0.88rem;
}

.report-summary {
  margin-top: 12px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

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

.report-table th,
.report-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.page-section[data-page="attendance"] .student-list {
  grid-template-columns: 1fr;
}

.page-section[data-page="attendance"] .student-meta,
.page-section[data-page="attendance"] .student-attendance {
  font-size: 0.86rem;
}

.page-section[data-page="attendance"] .toolbar-actions {
  margin-top: 8px;
}

.page-section[data-page="attendance"] .toolbar-hint {
  color: var(--teal-strong);
  font-weight: 700;
}

.report-table th {
  font-family: "Fraunces", serif;
  font-weight: 600;
}

.detail-modal {
  border: 0;
  padding: 0;
  background: transparent;
}

.detail-modal::backdrop {
  background: rgba(24, 34, 35, 0.42);
  backdrop-filter: blur(6px);
}

.detail-modal-card {
  width: min(760px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.detail-modal-summary {
  margin: 14px 0 0;
  color: var(--teal-strong);
  font-weight: 700;
}

.detail-copy-label {
  margin-top: 14px;
}

.detail-modal-body {
  min-height: 220px;
  margin-top: 8px;
  white-space: pre-wrap;
  font-family: "Manrope", sans-serif;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .hero,
  .reports-grid,
  .billing-grid,
  .name-row,
  .report-toolbar,
  .attendance-stats,
  .report-stats {
    grid-template-columns: 1fr;
  }

  .date-toolbar,
  .month-toolbar,
  .toolbar-actions,
  .student-card-header,
  .student-row,
  .student-meta,
  .toggle-row,
  .history-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-shell {
    width: min(100% - 18px, 1320px);
    padding-top: 14px;
  }

  .student-row {
    display: flex;
  }
}
