:root {
  --bg: #f5ecdc;
  --bg-deep: #ead7bd;
  --paper: #fffdfa;
  --surface: rgba(255, 252, 247, 0.76);
  --surface-strong: rgba(255, 250, 242, 0.94);
  --ink: #1d2f36;
  --muted: #58656d;
  --line: rgba(29, 47, 54, 0.12);
  --accent: #d96b3a;
  --accent-deep: #ab4f27;
  --teal: #2d7f72;
  --teal-soft: rgba(45, 127, 114, 0.1);
  --honey: #e4b550;
  --sage: #537162;
  --shadow: 0 28px 80px rgba(36, 40, 39, 0.14);

  --present-color: #27ae60;
  --present-bg: rgba(39, 174, 96, 0.15);
  --absent-color: #c0392b;
  --absent-bg: rgba(192, 57, 43, 0.1);
  --late-color: #d35400;
  --late-bg: rgba(211, 84, 0, 0.12);
  --medical-color: #2980b9;
  --medical-bg: rgba(41, 128, 185, 0.12);

  font-family: "Manrope", "Avenir Next", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(228, 181, 80, 0.28), transparent 34%),
    linear-gradient(180deg, #f8f1e7 0%, #f3eadf 40%, #efe4d5 100%);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: transparent;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled, input:disabled {
  cursor: not-allowed;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 3vw, 2rem) 6rem; /* extra space at bottom for sticky footer */
}

.hero {
  margin-bottom: 1.5rem;
}

.module-bar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
  align-items: center;
}

.suite-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(29, 47, 54, 0.08);
  color: var(--teal);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.hero-copy, .register-panel, .sticky-stats-bar {
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: var(--shadow);
}

.hero-copy, .register-panel {
  background: var(--surface);
  backdrop-filter: blur(18px);
}

.hero-copy {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: 32px;
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--accent-deep);
}

.hero h1 {
  margin: 0.55rem 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.05;
}

.panel-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.mockup-banner {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.1rem;
  padding: 0.95rem 1rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(29, 47, 54, 0.08);
}

.mockup-banner strong {
  font-size: 0.95rem;
}

.mockup-banner span {
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

.mockup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* Control Row & Mode Toggles */
.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.view-selector, .date-navigator {
  display: flex;
  background: rgba(29, 47, 54, 0.05);
  padding: 0.25rem;
  border-radius: 12px;
}

.view-btn {
  background: transparent;
  border: none;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.2s;
}

.view-btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(29, 47, 54, 0.06);
}

.date-navigator {
  align-items: center;
}

.nav-arrow {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink);
  transition: background 0.2s;
}

.nav-arrow:hover {
  background: rgba(255,255,255,0.7);
}

.date-display {
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.date-picker-input {
  border: none;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  color: inherit;
}

/* Panel Layout */
.register-panel {
  border-radius: 32px;
  padding: clamp(1.2rem, 3vw, 2rem);
  background: var(--surface);
}

/* Tab/Views Container */
.register-view {
  margin-top: 1rem;
}

.register-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.register-table th {
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.register-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px dashed var(--line);
  vertical-align: middle;
}

.register-table tr:last-child td {
  border-bottom: none;
}

.child-name-cell {
  font-weight: 700;
  font-size: 1rem;
}

/* Status selection controls in row */
.status-options {
  display: flex;
  gap: 0.4rem;
}

.status-btn {
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.2s;
  min-width: 80px;
  text-align: center;
}

.status-btn.s-present.is-active { background-color: var(--present-color); color: #fff; border-color: var(--present-color); }
.status-btn.s-absent.is-active { background-color: var(--absent-color); color: #fff; border-color: var(--absent-color); }
.status-btn.s-late.is-active { background-color: var(--late-color); color: #fff; border-color: var(--late-color); }
.status-btn.s-medical.is-active { background-color: var(--medical-color); color: #fff; border-color: var(--medical-color); }

.status-btn:not(.is-active):hover {
  background: rgba(29, 47, 54, 0.04);
}

/* Status indicator badge */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  text-align: center;
  min-width: 75px;
}

.status-badge.p-present { color: var(--present-color); background: var(--present-bg); }
.status-badge.p-absent { color: var(--absent-color); background: var(--absent-bg); }
.status-badge.p-late { color: var(--late-color); background: var(--late-bg); }
.status-badge.p-medical { color: var(--medical-color); background: var(--medical-bg); }
.status-badge.p-empty { color: var(--muted); background: rgba(29,47,54,0.06); }

/* Weekly Heatmap layout */
.week-col-header {
  text-align: center !important;
  width: 12%;
}

.week-cell {
  text-align: center;
  padding: 0.6rem 0.4rem !important;
}

.cell-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 0 auto;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  border: 1px solid var(--line);
  background: #fff;
  transition: all 0.2s;
}

.cell-dot.is-present { background: var(--present-color); color: #fff; border-color: var(--present-color); }
.cell-dot.is-absent { background: var(--absent-color); color: #fff; border-color: var(--absent-color); }
.cell-dot.is-late { background: var(--late-color); color: #fff; border-color: var(--late-color); }
.cell-dot.is-medical { background: var(--medical-color); color: #fff; border-color: var(--medical-color); }
.cell-dot.is-empty { color: var(--muted); background: rgba(29,47,54,0.04); }

/* Roster Editor styles */
.roster-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.8rem;
}

.roster-header-row h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
}

.add-child-form {
  display: flex;
  gap: 0.5rem;
}

.text-input {
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  outline: none;
  font-size: 0.9rem;
  min-width: 200px;
}

.text-input:focus {
  border-color: var(--accent);
  background: #fff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  border: none;
  transition: all 0.2s;
}

.button-primary {
  background: var(--accent);
  color: #fff;
}

.button-primary:hover {
  background: var(--accent-deep);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  color: var(--teal);
}

.button-ghost:hover {
  background: #fff;
}

.button-danger {
  background: rgba(192, 57, 43, 0.1);
  color: #c0392b;
  border: 1px solid rgba(192, 57, 43, 0.2);
}

.button-danger:hover {
  background: #c0392b;
  color: #fff;
}

.button-soft {
  background: rgba(45, 127, 114, 0.12);
  color: var(--teal);
}

.button-soft:hover {
  background: rgba(45, 127, 114, 0.2);
}

.roster-list {
  display: grid;
  gap: 0.6rem;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.roster-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.9rem;
  background: rgba(255,255,255,0.45);
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* Roster Drawer overlay drawer styles */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  width: min(420px, 100%);
  background: #fffdfa;
  height: 100%;
  box-shadow: -10px 0 40px rgba(0,0,0,0.1);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-backdrop.is-open .drawer {
  transform: translateX(0);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  margin-top: 1rem;
}

/* Sticky Stats Footer */
.sticky-stats-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface-strong);
  backdrop-filter: blur(20px);
  padding: 0.8rem 1.5rem;
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--line);
  z-index: 900;
}

.stats-container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.stats-group {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.stat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.stat-dot.s-present { background-color: var(--present-color); }
.stat-dot.s-absent { background-color: var(--absent-color); }
.stat-dot.s-late { background-color: var(--late-color); }
.stat-dot.s-medical { background-color: var(--medical-color); }

.stat-label {
  color: var(--muted);
}

.stat-value {
  font-weight: 800;
}

.overall-rate {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
}

/* Theme overrides */
html[data-theme="dark"] .cell-dot,
html[data-theme="dark"] .status-btn,
html[data-theme="dark"] .roster-item,
html[data-theme="dark"] .text-input {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(240, 230, 213, 0.12) !important;
  color: #f0e6d5 !important;
}

html[data-theme="dark"] .drawer {
  background: #1c1a16 !important;
  color: #f0e6d5 !important;
}

html[data-theme="dark"] .status-btn:not(.is-active):hover {
  background: rgba(255,255,255,0.08) !important;
}

/* Print Styles */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .app-shell {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  .hero, .control-row, .drawer-backdrop, .sticky-stats-bar, #theme-toggle {
    display: none !important;
  }

  .register-panel {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
  }

  .register-table th {
    border-bottom: 2px solid #000 !important;
    color: #000 !important;
  }

  .register-table td {
    border-bottom: 1px solid #ccc !important;
  }

  .cell-dot {
    border: 1px solid #000 !important;
  }

  .cell-dot.is-present { background: #e2f4e9 !important; color: #27ae60 !important; }
  .cell-dot.is-absent { background: #fceceb !important; color: #c0392b !important; }
  .cell-dot.is-late { background: #fdf3eb !important; color: #d35400 !important; }
  .cell-dot.is-medical { background: #ebf5fb !important; color: #2980b9 !important; }

  @page {
    size: letter portrait;
    margin: 0.5in;
  }
}

/* Mobile Responsiveness */
@media (max-width: 760px) {
  .control-row {
    flex-direction: column;
    align-items: stretch;
  }

  .view-selector, .date-navigator {
    justify-content: center;
  }

  .sticky-stats-bar {
    padding: 0.6rem 1rem 1.2rem;
  }

  .stats-container {
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
  }

  .stat-item {
    font-size: 0.8rem;
  }
}
