:root {
  --bg: #f7f2e8;
  --bg-strong: #fbf8f1;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-soft: #f5efe3;
  --surface-sidebar: rgba(111, 84, 24, 0.95);
  --line: rgba(123, 91, 23, 0.16);
  --line-strong: rgba(123, 91, 23, 0.35);
  --text: #2d210b;
  --muted: #6a5a38;
  --gold: #b9923f;
  --gold-deep: #8f6d23;
  --gold-soft: #e9d19b;
  --red: #c95d53;
  --green: #2f7d62;
  --shadow: 0 22px 55px rgba(98, 73, 21, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --max-width: 1520px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(201, 93, 83, 0.12), transparent 26%),
    radial-gradient(circle at top right, rgba(185, 146, 63, 0.16), transparent 28%),
    linear-gradient(180deg, var(--bg-strong) 0%, var(--bg) 100%);
  background-size: 100% 100%, 100% 100%, 100% 140%;
  animation: pageGlow 14s ease-in-out infinite alternate;
  color: var(--text);
  overflow-x: hidden;
}

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

button,
.panel,
.summary-card,
.list-card,
.enrollment-card,
.form-card,
.sidebar,
.topbar {
  transition:
    transform 180ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease,
    background-color 220ms ease,
    opacity 220ms ease;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold) 0%, #d4b46a 100%);
  color: #fffdf7;
  padding: 0.8rem 1.15rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(143, 109, 35, 0.2);
}

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

.button-secondary {
  background: #fff;
  color: var(--gold-deep);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.button-danger {
  background: linear-gradient(135deg, #cb6156 0%, #b84d43 100%);
}

.hidden {
  display: none !important;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 0.8rem 0.95rem;
  color: var(--text);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.96rem;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.app-shell {
  width: min(calc(100% - 1.5rem), var(--max-width));
  margin: 0 auto;
  padding: 0.75rem 0 1.5rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 300px minmax(0, 1fr);
  position: relative;
}

.app-shell--parent {
  grid-template-columns: 280px minmax(0, 1fr);
}

.chooser-shell,
.auth-shell {
  width: min(calc(100% - 1.5rem), 1200px);
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 1rem;
  padding: 1.5rem 0;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.chooser-card,
.auth-card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  animation: riseIn 760ms ease-out both;
}

.chooser-card--brand {
  display: grid;
  gap: 0.9rem;
}

.chooser-card--link {
  text-decoration: none;
  color: inherit;
  display: grid;
  gap: 0.8rem;
}

.chooser-card--link:hover {
  transform: translateY(-4px);
}

.chooser-link,
.auth-backlink {
  color: var(--gold-deep);
  font-weight: 700;
}

.chooser-copy,
.auth-copy {
  color: var(--muted);
  line-height: 1.6;
}

.brand-stack--chooser {
  max-width: 520px;
}

.brand-stack--auth {
  max-width: 420px;
  margin-bottom: 0.5rem;
}

.auth-card {
  width: min(100%, 560px);
  justify-self: center;
  display: grid;
  gap: 1rem;
}

.auth-form {
  display: grid;
  gap: 0.9rem;
}

.auth-error {
  min-height: 1.25rem;
  color: #a03f37;
  font-weight: 700;
}

.auth-note,
.topbar__identity {
  border-radius: 14px;
  padding: 0.85rem 1rem;
  background: rgba(185, 146, 63, 0.12);
  display: grid;
  gap: 0.22rem;
}

.auth-note span,
.topbar__identity span {
  color: var(--muted);
  font-size: 0.94rem;
}

.app-shell::before,
.app-shell::after {
  content: '';
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.22;
  z-index: -1;
}

.app-shell::before {
  top: -7rem;
  right: -8rem;
  background: rgba(185, 146, 63, 0.55);
  animation: floatOrb 16s ease-in-out infinite;
}

.app-shell::after {
  bottom: 2rem;
  left: -10rem;
  background: rgba(201, 93, 83, 0.24);
  animation: floatOrb 19s ease-in-out infinite reverse;
}

.sidebar,
.topbar,
.panel,
.summary-card,
.list-card,
.enrollment-card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
}

.sidebar {
  min-height: calc(100vh - 1.5rem);
  position: sticky;
  top: 0.75rem;
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  background: linear-gradient(180deg, rgba(115, 84, 22, 0.97), rgba(93, 68, 18, 0.94));
  color: #fffdf8;
  display: grid;
  gap: 1.35rem;
  animation: riseIn 700ms ease-out both;
}

.brand-stack {
  display: grid;
  gap: 0.85rem;
}

.brand-stack__main,
.brand-stack__sub {
  width: 100%;
  object-fit: contain;
}

.brand-stack__main {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  padding: 0.6rem;
  max-height: 86px;
  animation: logoFloat 7.5s ease-in-out infinite;
}

.brand-stack__sub {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  padding: 0.65rem;
  max-height: 62px;
  animation: logoFloat 8.5s ease-in-out infinite reverse;
}

.sidebar__section {
  display: grid;
  gap: 0.8rem;
}

.sidebar__section--footer {
  margin-top: auto;
}

.sidebar__label,
.eyebrow,
.panel__eyebrow {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 800;
}

.sidebar__label {
  color: rgba(255, 244, 224, 0.72);
}

.eyebrow,
.panel__eyebrow {
  color: var(--gold-deep);
  margin-bottom: 0.45rem;
}

.nav-list {
  display: grid;
  gap: 0.5rem;
}

.nav-button {
  text-align: left;
  justify-content: flex-start;
  border-radius: 16px;
  padding: 0.95rem 1rem;
  background: transparent;
  box-shadow: none;
  color: rgba(255, 247, 233, 0.86);
  border: 1px solid transparent;
}

.nav-button:hover {
  transform: translateX(2px);
  border-color: rgba(255, 244, 224, 0.16);
}

.nav-button.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-note {
  border-radius: 16px;
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 0.25rem;
}

.sidebar-note strong {
  font-size: 0.96rem;
}

.sidebar-note span {
  color: rgba(255, 245, 231, 0.72);
  line-height: 1.45;
  font-size: 0.92rem;
}

.workspace {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.topbar {
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  animation: riseIn 850ms ease-out both;
}

.topbar h1 {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.06;
}

.topbar__description {
  margin-top: 0.75rem;
  color: var(--muted);
  max-width: 72ch;
  line-height: 1.55;
}

.topbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

.topbar__identity {
  min-width: 180px;
}

.screen-stack,
.summary-grid,
.dashboard-grid,
.forms-grid,
.two-column-grid,
.enrollment-list,
.list-grid,
.stack-list,
.inline-form,
.history-grid,
.parent-toolbar,
.card-toolbar,
.metrics-grid,
.inline-form__grid {
  display: grid;
  gap: 1rem;
}

.screen {
  display: none;
}

.screen.is-active {
  display: grid;
  animation: fadeView 260ms ease-out;
}

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

.summary-card {
  border-radius: var(--radius-lg);
  padding: 1rem;
  animation: riseIn 900ms ease-out both;
}

.summary-card:hover,
.list-card:hover,
.enrollment-card:hover,
.panel:hover {
  transform: translateY(-3px);
  box-shadow: 0 26px 60px rgba(98, 73, 21, 0.16);
}

.summary-card__label,
.list-card__meta,
.metric__label,
.muted {
  color: var(--muted);
}

.summary-card__value {
  margin-top: 0.3rem;
  font-size: 1.95rem;
  font-weight: 800;
}

.summary-card__hint {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

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

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

.forms-grid--single {
  grid-template-columns: 1fr;
}

.panel,
.form-card,
.list-card,
.enrollment-card {
  border-radius: var(--radius-lg);
  padding: 1.15rem;
}

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel__header--tight {
  margin-bottom: 0.4rem;
}

.form-card {
  animation: riseIn 920ms ease-out both;
}

.list-card {
  animation: riseIn 940ms ease-out both;
}

.list-card__meta {
  font-size: 0.92rem;
  line-height: 1.5;
}

.list-card__row,
.history-card__meta,
.parent-toolbar,
.card-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.inline-form {
  border-top: 1px dashed var(--line-strong);
  padding-top: 1rem;
}

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

.enrollment-card {
  animation: riseIn 980ms ease-out both;
}

.card-title h3 {
  font-size: 1.2rem;
}

.card-title p {
  margin-top: 0.35rem;
  color: var(--muted);
}

.metric {
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  padding: 0.9rem;
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.5) 45%, transparent 100%);
  transform: translateX(-130%);
  animation: shimmer 7s ease-in-out infinite;
}

.metric__value {
  margin-top: 0.25rem;
  font-size: 1.28rem;
  font-weight: 800;
}

.history-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.95rem;
  display: grid;
  gap: 0.55rem;
  animation: riseIn 990ms ease-out both;
}

.history-card p,
.list-card p {
  color: var(--muted);
  line-height: 1.5;
}

.history-section {
  display: grid;
  gap: 0.75rem;
}

.empty-state {
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  padding: 1rem;
  color: var(--muted);
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.42rem 0.82rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.badge--ok {
  background: rgba(47, 125, 98, 0.12);
  color: var(--green);
}

.badge--warn {
  background: rgba(185, 146, 63, 0.18);
  color: var(--gold-deep);
}

.badge--danger {
  background: rgba(201, 93, 83, 0.16);
  color: #a03f37;
}

.badge--soft {
  background: rgba(185, 146, 63, 0.12);
  color: var(--gold-deep);
}

.badge--neutral {
  background: rgba(106, 90, 56, 0.12);
  color: var(--muted);
}

.stack-list {
  gap: 1.15rem;
}

.parent-family-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.parent-family-card__students {
  display: grid;
  gap: 0.8rem;
}

.parent-student-card {
  border-radius: var(--radius-md);
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.9rem;
  display: grid;
  gap: 0.85rem;
}

@keyframes pageGlow {
  0% {
    background-position: 0% 0%, 100% 0%, 50% 0%;
  }
  100% {
    background-position: 4% 2%, 96% 4%, 50% 100%;
  }
}

@keyframes floatOrb {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(1.5rem, -1.5rem, 0) scale(1.05);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeView {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes shimmer {
  0%,
  82%,
  100% {
    transform: translateX(-130%);
  }
  90% {
    transform: translateX(130%);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .portal-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }
}

@media (max-width: 840px) {
  .dashboard-grid,
  .two-column-grid,
  .forms-grid--double,
  .topbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar__actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(calc(100% - 1rem), var(--max-width));
  }

  .topbar,
  .panel,
  .summary-card,
  .list-card,
  .enrollment-card,
  .sidebar {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
