/* Shared look for the inner pages, matching the home page.
   Student pages (class, subject, chapter, exercises, premium) keep their own layout CSS
   (prefixes ch-, sp-, cp-, se-, pre-); this file only restyles their header band.
   Selectors start with "body" so they win over the pages' inline <style> blocks. */

/* ── Student page header: navy band, violet ring, white title (like the home hero) ── */
body .ch-hero, body .sp-hero, body .cp-hero, body .se-hero, body .pre-hero {
  background: var(--ek-navy); color: #fff;
}
body .ch-hero::before, body .sp-hero::before, body .cp-hero::before, body .se-hero::before, body .pre-hero::before {
  background: none; opacity: 1; width: 520px; height: 520px; right: -230px; top: -300px;
  border: 70px solid rgba(94, 23, 235, .38); border-radius: 50%;
}
body .ch-hero::after, body .sp-hero::after, body .cp-hero::after, body .se-hero::after, body .pre-hero::after {
  border-color: rgba(255, 255, 255, .06); background: none;
}
/* The navbar already shows the logo */
body .ch-brand, body .sp-brand, body .cp-brand, body .se-brand, body .pre-brand { display: none; }

body .ch-breadcrumb, body .sp-breadcrumb, body .cp-breadcrumb, body .se-breadcrumb, body .pre-breadcrumb { color: var(--ek-on-navy); }
body .ch-breadcrumb a, body .sp-breadcrumb a, body .cp-breadcrumb a, body .se-breadcrumb a, body .pre-breadcrumb a {
  background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: #fff; box-shadow: none;
}
body .ch-breadcrumb a:hover, body .sp-breadcrumb a:hover, body .cp-breadcrumb a:hover, body .se-breadcrumb a:hover, body .pre-breadcrumb a:hover {
  border-color: var(--ek-yellow); color: var(--ek-yellow);
}
body .ch-breadcrumb .current, body .sp-breadcrumb .current, body .cp-breadcrumb .current, body .se-breadcrumb .current, body .pre-breadcrumb .current { color: #fff; }

body .ch-eyebrow, body .sp-eyebrow, body .cp-eyebrow, body .se-eyebrow, body .pre-eyebrow { color: var(--ek-yellow); }
body .ch-title, body .sp-title, body .cp-title, body .se-title, body .pre-hero h1 {
  color: #fff; letter-spacing: -.015em;
}
body .ch-subtitle, body .sp-subtitle, body .cp-subtitle, body .se-subtitle { color: var(--ek-on-navy); }
/* Bold sentences in the subtitles were navy (invisible on the navy band) */
body .ch-subtitle strong, body .sp-subtitle strong, body .cp-subtitle strong, body .se-subtitle strong, body .pre-hero p strong { color: #fff; }
body .ch-meta__item, body .sp-meta__item, body .cp-meta__item, body .se-meta__item, body .pre-meta__item {
  background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: #fff;
}
body .ch-meta__item i, body .sp-meta__item i, body .cp-meta__item i, body .se-meta__item i, body .pre-meta__item i { color: var(--ek-yellow); }
body .ch-meta__item--sun, body .sp-meta__item--sun, body .cp-meta__item--sun, body .se-meta__item--sun {
  background: var(--ek-yellow); border-color: var(--ek-yellow); color: var(--ek-navy);
}
body .ch-meta__item--sun i, body .sp-meta__item--sun i, body .cp-meta__item--sun i, body .se-meta__item--sun i { color: var(--ek-navy); }
/* Secondary tool buttons on the navy band */
body .ch-hero .ch-tool:not(.ch-tool--lab):not(.ch-tool--primary) {
  background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); color: #fff;
}
body .ch-hero .ch-tool:not(.ch-tool--lab):not(.ch-tool--primary):hover { border-color: var(--ek-yellow); color: var(--ek-yellow); }

/* Section headings in the student pages use the display font with the home letter-spacing */
.ch-page h2, .subject-page h2, .chapter-page h2, .se-page h2, .pre-page h2 { letter-spacing: -.012em; }

/* ── Auth, account and staff pages: navy band behind the card (like the home figures card) ── */
.ek-page {
  position: relative; overflow: hidden;
  background: linear-gradient(var(--ek-navy) 0 230px, var(--ek-violet-50) 230px);
  padding-top: 56px;
}
.ek-page::before {
  content: ''; position: absolute; width: 420px; height: 420px; left: -210px; top: -250px; border-radius: 50%;
  border: 60px solid rgba(94, 23, 235, .38); pointer-events: none;
}
.ek-page::after {
  content: ''; position: absolute; width: 150px; height: 150px; right: -40px; top: 40px; border-radius: 50%;
  background: var(--ek-yellow); pointer-events: none;
}
.ek-page > * { position: relative; z-index: 1; }
.ek-card { border-radius: 24px; padding: 36px 34px; border-color: var(--ek-line); box-shadow: 0 24px 60px rgba(50, 44, 77, .14); }
.ek-card h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.015em; margin-bottom: 8px; }
.ek-card h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
.ek-sub { font-size: 1rem; line-height: 1.6; }
.ek-field label { font-size: .9rem; font-weight: 600; color: var(--ek-navy); }
.ek-field input, .ek-field select, .ek-field textarea {
  border: 1.5px solid var(--ek-line); border-radius: 12px; padding: 12px 14px; color: var(--ek-navy);
  transition: border-color .15s, box-shadow .15s;
}
.ek-field input:focus, .ek-field select:focus, .ek-field textarea:focus {
  outline: none; border-color: var(--ek-violet); box-shadow: 0 0 0 4px rgba(94, 23, 235, .12);
}
.ek-btn { padding: 12px 22px; font-size: .97rem; transition: transform .15s, background-color .15s, color .15s, border-color .15s, box-shadow .15s; }
.ek-btn:hover { transform: translateY(-1px); }
.ek-btn--primary { box-shadow: 0 10px 24px rgba(94, 23, 235, .25); }
.ek-btn--ghost { border-width: 1.5px; color: var(--ek-navy); }
.ek-btn--ghost:hover { border-color: var(--ek-violet); color: var(--ek-violet); }
.ek-btn--sm { padding: 7px 14px; }
.ek-links a:hover { color: var(--ek-violet-dark); text-decoration: underline; }
.ek-table th { font-size: .74rem; letter-spacing: .06em; }
.ek-table tbody tr { transition: background-color .15s; }
.ek-table tbody tr:hover { background: var(--ek-violet-50); }

/* Wide pages (admin lists, access, account) are full pages, not dialogs: no floating card over the band. */
.ek-page:has(> .ek-card--wide), .ek-page:has(> .ek-card--xl) { background: var(--ek-violet-50); padding-top: 32px; }
.ek-page:has(> .ek-card--wide)::before, .ek-page:has(> .ek-card--wide)::after,
.ek-page:has(> .ek-card--xl)::before, .ek-page:has(> .ek-card--xl)::after { display: none; }
.ek-card--wide, .ek-card--xl { border-radius: 20px; box-shadow: 0 1px 3px rgba(50, 44, 77, .06); }

@media (max-width: 520px) {
  .ek-page { background: linear-gradient(var(--ek-navy) 0 170px, var(--ek-violet-50) 170px); padding-top: 32px; }
  .ek-page::after { width: 90px; height: 90px; top: 20px; right: -30px; }
  .ek-card { padding: 26px 20px; border-radius: 20px; }
  .ek-page:has(> .ek-card--wide), .ek-page:has(> .ek-card--xl) { background: var(--ek-violet-50); padding-top: 20px; }
}

/* ── Maths Lab page: same header treatment (the view itself is not edited) ── */
body .ml-hero::before {
  background: none; opacity: 1; width: 520px; height: 520px; right: -230px; top: -300px;
  border: 70px solid rgba(94, 23, 235, .38); border-radius: 50%;
}
body .ml-brand { display: none; }
/* Notices use the brand "error" style: navy text, yellow edge (no red) */
body .ml-warn { background: var(--ek-yellow-50); border: 1px solid var(--ek-yellow-200); border-left: 4px solid var(--ek-yellow); color: var(--ek-navy); }
body .ml-warn i { color: var(--ek-navy); }
body .ml-warn strong { color: var(--ek-navy); }

/* ── Image picker (views/partials/imageField.ejs) ── */
.ek-img { margin-bottom: 18px; }
.ek-img__label { display: block; font-weight: 600; font-size: .9rem; color: var(--ek-navy); margin-bottom: 8px; }
.ek-img__label small { color: var(--ek-muted); font-weight: 500; }
.ek-img__drop { position: relative; aspect-ratio: var(--ek-img-ratio, 16 / 9); max-height: 260px; width: 100%; border: 2px dashed var(--ek-violet-100);
  border-radius: 16px; background: var(--ek-violet-50); display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer;
  transition: border-color .15s, background-color .15s; }
.ek-img__drop:hover, .ek-img__drop:focus-visible, .ek-img.is-over .ek-img__drop { border-color: var(--ek-violet); background: #fff; outline: none; }
.ek-img.has-image .ek-img__drop { border-style: solid; border-color: var(--ek-line); background: var(--ek-navy-50, #f3f2f4); }
.ek-img__preview { width: 100%; height: 100%; object-fit: cover; display: block; }
.ek-img__empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 16px; color: var(--ek-muted); font-size: .88rem; }
.ek-img__empty strong { color: var(--ek-navy); font-size: 1rem; }
.ek-img__empty u { color: var(--ek-violet); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.ek-img__icon { width: 52px; height: 52px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem;
  background: var(--ek-violet); color: #fff; margin-bottom: 4px; }
.ek-img__busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(255, 255, 255, .88);
  color: var(--ek-navy); font-weight: 700; }
.ek-img__spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--ek-violet-100); border-top-color: var(--ek-violet); animation: ek-spin .8s linear infinite; }
@keyframes ek-spin { to { transform: rotate(360deg); } }
.ek-img__bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ek-img__btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--ek-line); background: #fff;
  color: var(--ek-navy); font-weight: 600; font-size: .86rem; cursor: pointer; transition: border-color .15s, color .15s; }
.ek-img__btn:hover { border-color: var(--ek-violet); color: var(--ek-violet); }
.ek-img__btn--quiet { border-color: transparent; color: var(--ek-muted); }
.ek-img__link { display: flex; gap: 8px; margin-top: 10px; }
.ek-img__link input { flex: 1; border: 1.5px solid var(--ek-line); border-radius: 12px; padding: 9px 12px; font-size: .95rem; color: var(--ek-navy); }
.ek-img__link input:focus { outline: none; border-color: var(--ek-violet); box-shadow: 0 0 0 4px rgba(94, 23, 235, .12); }
.ek-img__hint { margin: 8px 0 0; font-size: .8rem; color: var(--ek-muted); }
.ek-img__error { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; font-size: .86rem; font-weight: 600; color: var(--ek-navy);
  background: var(--ek-yellow-100); border-left: 4px solid var(--ek-yellow); }

/* ── Admin building blocks (chapters, students, requests…) ── */
.adm { background: var(--ek-violet-50); min-height: calc(100vh - 72px); padding-bottom: 64px; color: var(--ek-navy); }
#main:has(> .adm), #main:has(.adm) { margin-top: 0 !important; padding-top: 0 !important; }
.adm-wrap { max-width: 1200px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.adm-wrap--narrow { max-width: 860px; }
.adm-head { position: relative; overflow: hidden; background: var(--ek-navy); color: #fff; padding: 28px 0 92px; }
.adm-head::before { content: ''; position: absolute; width: 480px; height: 480px; right: -220px; top: -280px; border-radius: 50%; border: 64px solid rgba(94, 23, 235, .38); }
.adm-head .adm-wrap { position: relative; }
.adm-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .88rem; color: var(--ek-on-navy); margin-bottom: 22px; }
.adm-crumb a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; color: #fff; text-decoration: none; font-weight: 600;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); transition: border-color .15s, color .15s; }
.adm-crumb a:hover { border-color: var(--ek-yellow); color: var(--ek-yellow); }
.adm-crumb .sep { opacity: .5; }
.adm-head__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; }
.adm-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ek-yellow); }
.adm-kicker::before { content: ''; width: 20px; height: 3px; border-radius: 3px; background: var(--ek-yellow); }
.adm-head h1 { font-family: var(--ek-font-display); font-size: clamp(1.8rem, 3.4vw, 2.5rem); font-weight: 800; letter-spacing: -.015em; margin: 10px 0 0; color: #fff; }
.adm-head p { color: var(--ek-on-navy); margin: 6px 0 0; max-width: 600px; }
.adm-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.adm-stats li { padding: 7px 13px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); font-size: .86rem; font-weight: 600; }
.adm-stats strong { color: var(--ek-yellow); margin-right: 4px; }
.adm-cta { display: inline-flex; align-items: center; gap: 8px; padding: 13px 22px; border-radius: 999px; background: var(--ek-yellow); color: var(--ek-navy); border: 0;
  font-weight: 700; text-decoration: none; cursor: pointer; box-shadow: 0 12px 28px rgba(255, 194, 58, .3); transition: transform .15s, background-color .15s; }
.adm-cta:hover { transform: translateY(-2px); background: #fff; color: var(--ek-navy); }
.adm-body { position: relative; margin-top: -60px; }
.adm-panel { background: #fff; border: 1px solid var(--ek-line); border-radius: 22px; padding: 24px; box-shadow: 0 20px 50px rgba(50, 44, 77, .06); }
.adm-panel + .adm-panel { margin-top: 18px; }
.adm-panel h2 { font-family: var(--ek-font-display); font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; margin: 0 0 4px; }
.adm-panel > p.adm-sub { color: var(--ek-muted); font-size: .9rem; margin: 0 0 18px; }
/* New student from an enrollment request: what to do with the requested offer */
.adm-offer { border: 1px solid var(--ek-violet-100); background: var(--ek-violet-50); border-radius: 14px; padding: 14px 16px; margin: 0 0 20px; display: grid; gap: 8px; }
.adm-offer legend { float: left; width: 100%; font-size: .95rem; color: var(--ek-navy); margin: 0 0 4px; }
.adm-offer label { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--ek-navy); cursor: pointer; }
.adm-offer input[type="radio"] { margin-top: 3px; accent-color: var(--ek-violet); }
.adm-offer p { margin: 0; font-size: .9rem; color: var(--ek-muted); }
.adm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: 999px; font-weight: 600; font-size: .88rem;
  text-decoration: none; border: 1.5px solid var(--ek-line); color: var(--ek-navy); background: #fff; cursor: pointer; transition: border-color .15s, color .15s, background-color .15s; }
.adm-btn:hover { border-color: var(--ek-violet); color: var(--ek-violet); }
.adm-btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.adm-btn--primary { background: var(--ek-violet); border-color: var(--ek-violet); color: #fff; }
.adm-btn--primary:hover { background: var(--ek-violet-dark); border-color: var(--ek-violet-dark); color: #fff; }
.adm-btn--icon { width: 38px; height: 38px; padding: 0; }
.adm-btn--quiet { border-color: transparent; color: var(--ek-muted); }
.adm-btn--quiet:hover { border-color: var(--ek-line); color: var(--ek-navy); }
.adm-btn--lg { padding: 13px 22px; font-size: .97rem; }
.adm-pill { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.adm-pill--free { background: var(--ek-violet-50); color: var(--ek-violet); }
.adm-pill--premium { background: var(--ek-yellow); color: var(--ek-navy); }
.adm-pill--muted { background: var(--ek-navy-50); color: var(--ek-muted); }
.adm-pill--warn { background: var(--ek-yellow-100); color: var(--ek-navy); }
.adm-field { margin-bottom: 18px; }
.adm-field > label, .adm-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.adm-field > label b, .adm-label b { color: var(--ek-violet); }
.adm-field input:not([type=checkbox]):not([type=radio]), .adm-field select, .adm-field textarea {
  width: 100%; border: 1.5px solid var(--ek-line); border-radius: 12px; padding: 11px 13px; font-size: 1rem; color: var(--ek-navy); background: #fff; font-family: inherit; }
.adm-field input:focus, .adm-field select:focus, .adm-field textarea:focus { outline: none; border-color: var(--ek-violet); box-shadow: 0 0 0 4px rgba(94, 23, 235, .12); }
.adm-hint { font-size: .8rem; color: var(--ek-muted); margin-top: 6px; }
.adm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.adm-check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .92rem; cursor: pointer; }
.adm-check input { width: 18px; height: 18px; accent-color: var(--ek-violet); }
.adm-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.adm-empty { text-align: center; padding: 48px 20px; }
.adm-empty > i { font-size: 2.4rem; color: var(--ek-violet); }
.adm-empty strong { display: block; font-family: var(--ek-font-display); font-size: 1.2rem; margin: 10px 0 4px; }
.adm-empty p { color: var(--ek-muted); margin: 0 0 18px; }
@media (max-width: 600px) {
  .adm-row { grid-template-columns: 1fr; }
  .adm-cta { width: 100%; justify-content: center; }
  .adm-panel { padding: 18px 16px; }
}

/* Native dialog (admin forms) */
.adm-dialog { border: 0; padding: 0; border-radius: 24px; width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 32px); color: var(--ek-navy);
  box-shadow: 0 40px 100px rgba(50, 44, 77, .35); }
.adm-dialog::backdrop { background: rgba(50, 44, 77, .6); }
.adm-dialog__head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px;
  background: #fff; border-bottom: 1px solid var(--ek-line); }
.adm-dialog__head h2 { font-family: var(--ek-font-display); font-size: 1.25rem; font-weight: 800; margin: 0; }
.adm-dialog__head p { margin: 4px 0 0; color: var(--ek-muted); font-size: .9rem; }
.adm-dialog__body { padding: 20px 24px; }
.adm-dialog__foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; background: #fff; border-top: 1px solid var(--ek-line); }
