:root {
  --ink: #16324a;
  --muted: #637384;
  --line: #d6e2ec;
  --paper: #ffffff;
  --shell: #eff7fb;
  --sky: #d8edf8;
  --sky-strong: #2f7fb1;
  --mint: #e0f1e8;
  --mint-strong: #2f7d58;
  --tomato: #cf4f3d;
  --yellow: #f7c85a;
  --blue: #3f93c8;
  --blue-dark: #1d5f8e;
  --shadow: 0 18px 45px rgba(29, 95, 142, 0.13);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(63, 147, 200, 0.28), transparent 30rem),
    radial-gradient(circle at top right, rgba(247, 200, 90, 0.22), transparent 26rem),
    linear-gradient(135deg, #f9fbfd 0%, var(--shell) 48%, #e9f4f7 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar,
.section-heading,
.panel-title,
.child-header,
.student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  min-height: 164px;
  padding: 16px 0 26px;
}

.eyebrow,
.label {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  color: var(--blue-dark);
  font-size: clamp(2rem, 6vw, 4.35rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

h3 {
  font-size: 1.08rem;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-title img {
  width: clamp(72px, 11vw, 112px);
  height: clamp(72px, 11vw, 112px);
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
  padding: 0;
  box-shadow: none;
}

.hero-card {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 380px;
  gap: 0;
  border: 1px solid rgba(47, 127, 177, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(216, 237, 248, 0.84) 100%);
  box-shadow: var(--shadow);
  padding: 18px 18px 18px 26px;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 14px auto 14px 14px;
  width: 5px;
  border-radius: 999px;
  background: var(--blue);
}

.hero-card strong,
.hero-card span {
  display: block;
}

.hero-card strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.hero-card span {
  color: var(--muted);
  margin-top: 4px;
}

.pack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.pack-tags span {
  margin: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--blue-dark);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1;
  padding: 7px 9px;
}

.summary-strip,
.grid,
.metrics {
  display: grid;
  gap: 16px;
}

.summary-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.summary-strip article,
.metrics article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.summary-strip article:first-child {
  border-color: rgba(47, 127, 177, 0.36);
  background: linear-gradient(135deg, #ffffff 0%, #eef8fd 100%);
}

.summary-strip article,
.metrics article {
  padding: 18px;
}

.summary-strip strong,
.metrics strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.35rem;
}

.summary-strip span:last-child,
.helper,
.child-header p,
.panel-title span,
.student-meta,
.history-note {
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.portal-switcher {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab.active {
  background: var(--blue-dark);
  color: #fff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  margin: 22px 0 16px;
}

.landing {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
  align-items: stretch;
  margin-top: 14px;
}

.landing-copy,
.landing-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  padding: 26px;
}

.landing-copy h2 {
  max-width: 760px;
  color: var(--blue-dark);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.landing-copy p {
  max-width: 680px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 1.05rem;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-weight: 900;
  padding: 0 18px;
}

.primary-link {
  background: var(--blue-dark);
  color: #fff;
}

.secondary-link {
  border: 1px solid var(--ink);
  background: #fff;
  color: var(--ink);
}

.landing-panel {
  display: grid;
  gap: 12px;
}

.public-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.landing-stat {
  border-left: 5px solid var(--blue);
  border-radius: 7px;
  background: #eef8fd;
  padding: 14px;
}

.landing-stat strong,
.landing-stat span {
  display: block;
}

.landing-stat strong {
  color: var(--blue-dark);
  font-size: 1.4rem;
}

.landing-stat span {
  color: var(--muted);
  margin-top: 4px;
}

.parent-login {
  display: grid;
  min-height: 44vh;
  place-items: center;
}

.login-card {
  display: grid;
  width: min(520px, 100%);
  gap: 20px;
  border: 1px solid rgba(47, 127, 177, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-card h2 {
  margin-bottom: 8px;
}

.auth-toggle {
  display: flex;
  gap: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.panel {
  margin-bottom: 16px;
  padding: 20px;
}

.token-balance {
  display: grid;
  width: 100px;
  height: 100px;
  place-items: center;
  border-radius: 8px;
  background: var(--sky);
  color: var(--blue-dark);
}

.token-balance span {
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
}

.token-balance small {
  color: var(--ink);
  font-weight: 800;
}

.notice {
  display: grid;
  gap: 4px;
  margin: 18px 0;
  padding: 14px;
  border-left: 5px solid var(--blue);
  border-radius: 6px;
  background: #eaf6fc;
}

.low-token-notice {
  display: none;
  border-left-color: var(--tomato);
  background: #fff0ed;
}

.low-token-notice.active {
  display: grid;
}

.form-row,
.form-stack {
  display: grid;
  gap: 10px;
}

.form-stack label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.form-stack .check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.35;
}

.check-label input {
  width: auto;
  margin-top: 3px;
}

.check-label a,
.site-footer a {
  color: var(--blue-dark);
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(63, 147, 200, 0.16);
  outline: none;
}

textarea {
  resize: vertical;
}

.primary-button,
.secondary-button,
.danger-button,
.bundle-button {
  min-height: 44px;
  border-radius: 7px;
  border: 1px solid var(--ink);
  font-weight: 900;
}

.primary-button {
  width: 100%;
  margin-top: 12px;
  background: var(--blue-dark);
  color: #fff;
}

.primary-button.compact {
  width: auto;
  min-width: 150px;
  margin-top: 0;
  padding: 0 18px;
}

.primary-button.no-margin {
  margin-top: 0;
}

.secondary-button {
  padding: 0 16px;
  background: #fff;
  color: var(--ink);
}

.secondary-button.full-width {
  width: 100%;
}

.danger-button.full-width {
  width: 100%;
}

.danger-button {
  padding: 0 16px;
  border-color: var(--tomato);
  background: #fff;
  color: var(--tomato);
}

.inline-danger-button {
  min-height: 32px;
  border: 1px solid var(--tomato);
  border-radius: 7px;
  background: #fff;
  color: var(--tomato);
  font-size: 0.78rem;
  font-weight: 900;
  padding: 0 10px;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 850;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue-dark);
}

.compact-stack {
  gap: 12px;
}

.child-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
  padding: 0 12px;
}

.chip-button.active {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  color: #fff;
}

.bundle-list,
.student-list,
.cart-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.bundle-button,
.student-row {
  padding: 14px;
  background: #fff;
}

.bundle-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.bundle-button:hover,
.student-row:hover {
  border-color: rgba(47, 127, 177, 0.45);
  background: #f5fbff;
}

.bundle-button strong {
  display: block;
}

.cart-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.cart-row strong,
.cart-row span {
  display: block;
}

.cart-row span {
  color: var(--muted);
  margin-top: 3px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--tomato);
  font-weight: 900;
}

.quantity-controls {
  display: inline-grid;
  grid-template-columns: 36px minmax(24px, auto) 36px;
  align-items: center;
  gap: 6px;
}

.quantity-controls .icon-button {
  color: var(--blue-dark);
}

.quantity-value {
  min-width: 24px;
  text-align: center;
}

.cart-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf1ee;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.status-chip.good {
  background: var(--sky);
  color: var(--blue-dark);
}

.status-chip.warn {
  background: #fff3cf;
  color: #8a6100;
}

.status-chip.stop {
  background: #f8ded9;
  color: var(--tomato);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.date-pill {
  min-width: 170px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  text-align: center;
  font-weight: 900;
}

.student-row {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.student-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-button {
  min-height: 38px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  padding: 0 12px;
}

.check-button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: #edf1ee;
  color: var(--muted);
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.admin-dashboard {
  border-color: rgba(47, 127, 177, 0.32);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0%, rgba(234, 246, 252, 0.9) 100%);
}

.admin-notice {
  margin: 14px 0;
  border: 1px solid #f1d188;
  border-left: 5px solid var(--yellow);
  border-radius: 8px;
  background: #fff7de;
  color: #735000;
  font-weight: 850;
  padding: 12px 14px;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.production-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.production-toolbar label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.dashboard-columns article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.dashboard-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.dashboard-heading strong {
  color: var(--blue-dark);
  font-size: 2rem;
  line-height: 1;
}

.dashboard-heading span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mini-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mini-list-row strong,
.mini-list-row small {
  display: block;
}

.mini-list-row small {
  color: var(--muted);
  margin-top: 2px;
}

.mini-list-row b {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--sky);
  color: var(--blue-dark);
  font-size: 0.82rem;
}

.class-manager-list {
  margin-top: 14px;
}

.class-manager-list .mini-list-row b {
  width: auto;
  padding: 0 9px;
}

.data-manager-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.data-block {
  min-width: 0;
}

.compact-title h3 {
  font-size: 0.98rem;
}

.data-manager-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.data-record {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.data-record.archived {
  background: #f8fafb;
}

.data-record-header,
.data-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.data-record-header strong,
.data-record-header small {
  display: block;
}

.data-record-header small {
  color: var(--muted);
  margin-top: 2px;
}

.data-edit-grid {
  display: grid;
  gap: 10px;
}

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

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

.data-edit-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.data-actions {
  justify-content: flex-end;
}

.adjustment-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(110px, 0.6fr) minmax(180px, 1.4fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
}

.adjustment-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.notification-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.notification-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.notification-item strong,
.notification-item span {
  display: block;
}

.notification-item span {
  color: var(--muted);
  margin-top: 4px;
}

.public-page {
  max-width: 920px;
  margin: 0 auto;
}

.policy-panel {
  padding: clamp(22px, 4vw, 34px);
}

.policy-panel h2 {
  color: var(--blue-dark);
  margin-bottom: 8px;
}

.policy-copy {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.policy-copy h3 {
  color: var(--ink);
  margin-bottom: 5px;
}

.policy-copy p {
  color: var(--muted);
  line-height: 1.6;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.contact-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.contact-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer strong,
.site-footer span {
  display: block;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

@media (max-width: 780px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .summary-strip,
  .grid.two-columns,
  .landing,
  .public-grid,
  .metrics,
  .production-toolbar,
  .dashboard-columns,
  .data-manager-grid,
  .parent-grid,
  .child-grid,
  .adjustment-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .brand-title,
  .section-heading,
  .child-header,
  .student-row,
  .notification-item,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer nav {
    justify-content: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .tabs {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .brand-title img {
    width: 78px;
    height: 78px;
  }

  .hero-card {
    width: 100%;
    max-width: none;
  }

  .student-actions {
    width: 100%;
    justify-content: space-between;
  }

  .data-record-header,
  .data-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .data-actions .secondary-button,
  .data-actions .danger-button {
    width: 100%;
  }

  .cart-row {
    grid-template-columns: 1fr;
  }

  .cart-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .cart-actions .primary-button,
  .cart-actions .secondary-button {
    width: 100%;
  }
}
