/* ==========================================================================
   Sai Kids — admin UI
   Deliberately calmer than the public site: this is a tool, not a brochure.
   ========================================================================== */

:root {
  --a-red:    #e63946;
  --a-red-dk: #b5121b;
  --a-gold:   #ffb703;
  --a-ink:    #1f2430;
  --a-ink-2:  #5b6377;
  --a-line:   #e5e8ef;
  --a-bg:     #f5f6fa;
  --a-panel:  #ffffff;
  --a-side:   #241f2b;
  --a-ok:     #15803d;
  --a-ok-bg:  #e8f6ed;
  --a-err:    #b91c1c;
  --a-err-bg: #fdecec;

  --a-r:   10px;
  --a-r-lg: 16px;
  --a-sd:  0 1px 3px rgba(31, 36, 48, .07);
  --a-sd-lg: 0 12px 34px rgba(31, 36, 48, .14);

  --a-side-w: 232px;
}

* , *::before, *::after { box-sizing: border-box; }

body.adm {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--a-ink);
  background: var(--a-bg);
  -webkit-font-smoothing: antialiased;
}

.adm h1, .adm h2, .adm h3 { font-family: 'Baloo 2', system-ui, sans-serif; margin: 0; line-height: 1.25; }
.adm a { color: var(--a-red); text-decoration: none; }
.adm a:hover { text-decoration: underline; }
.adm img { max-width: 100%; display: block; }
.adm code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .85em; background: #f1f2f7; padding: .1em .4em; border-radius: 5px;
}
.adm svg { width: 1em; height: 1em; fill: currentColor; }

:focus-visible { outline: 3px solid #7c3aed; outline-offset: 2px; border-radius: 4px; }

/* --------------------------------------------------------------- sidebar */

.adm-side {
  position: fixed; inset: 0 auto 0 0; width: var(--a-side-w);
  background: linear-gradient(200deg, #2f2740 0%, #241f2b 55%, #1d1926 100%);
  color: #cfc7d6;
  display: flex; flex-direction: column;
  padding: 1rem .75rem; z-index: 30;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, .06);
}

.adm-brand {
  display: flex; align-items: center; gap: .7rem;
  color: #fff; font-family: 'Baloo 2', sans-serif; font-weight: 700; line-height: 1.05;
  padding: .55rem .6rem; margin-bottom: 1rem;
  background: rgba(255, 255, 255, .05); border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .07);
}
.adm-brand:hover { text-decoration: none; color: #fff; background: rgba(255, 255, 255, .08); }
.adm-brand small { display: block; font-size: .62rem; font-weight: 700; color: var(--a-gold); letter-spacing: .1em; text-transform: uppercase; margin-top: .1rem; }
.adm-brand__mark {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--a-red), var(--a-gold));
  color: #fff; font-weight: 800; font-size: 1rem;
  box-shadow: 0 4px 12px rgba(230, 57, 70, .4);
}

.adm-nav { display: flex; flex-direction: column; gap: 3px; }
/* Scoped to .adm-side so it out-ranks the generic `.adm a` red-link colour —
   otherwise the nav text renders red on the dark sidebar and blends in. */
.adm-side .adm-nav__link {
  position: relative;
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .7rem; border-radius: 11px;
  color: #ece7f3; font-weight: 600; font-size: .9rem;
  transition: background .18s, color .18s, transform .1s;
}
.adm-side .adm-nav__link:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.adm-side .adm-nav__link:active { transform: scale(.98); }
.adm-nav__link.is-active {
  background: linear-gradient(135deg, var(--a-red), var(--a-red-dk));
  color: #fff; box-shadow: 0 6px 16px rgba(230, 57, 70, .35);
}
.adm-nav__link.is-active::before {
  content: ''; position: absolute; left: -.75rem; top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px; border-radius: 0 4px 4px 0; background: var(--a-gold);
}
.adm-nav__link svg {
  width: 28px; height: 28px; flex: none; padding: 6px; border-radius: 8px;
  background: rgba(255, 255, 255, .06); color: #fff; opacity: .95; box-sizing: border-box;
}
.adm-nav__link.is-active svg { background: rgba(255, 255, 255, .18); }

.adm-nav__section {
  display: block; padding: .9rem .7rem .35rem;
  font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em;
  color: var(--a-gold);
}
.adm-side__foot { margin-top: auto; padding-top: .8rem; border-top: 1px solid rgba(255, 255, 255, .08); }

/* ------------------------------------------------------------------ main */

.adm-main { margin-left: var(--a-side-w); min-height: 100vh; display: flex; flex-direction: column; }

.adm-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--a-line);
  padding: .8rem clamp(1rem, 3vw, 2rem);
}
.adm-top__title { font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 1.15rem; }
.adm-top__user { display: flex; align-items: center; gap: .7rem; }
.adm-top__user form { margin: 0; }
.adm-top__link { font-size: .85rem; color: var(--a-ink-2); }

.adm-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--a-red), var(--a-gold));
  color: #fff; font-weight: 700; font-size: .85rem;
}

.adm-body { padding: clamp(1rem, 3vw, 2rem); flex: 1; max-width: 1240px; width: 100%; }

.adm-hello { color: var(--a-ink-2); margin: 0 0 1.2rem; }

/* Colourful greeting banner. */
.adm-greet {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--a-red-dk), var(--a-red) 55%, var(--a-gold));
  color: #fff; border-radius: var(--a-r-lg); padding: 1.3rem 1.5rem; margin-bottom: 1.3rem;
  box-shadow: var(--a-sd);
}
.adm-greet h1 { font-size: 1.35rem; color: #fff; }
.adm-greet p { margin: .2rem 0 0; opacity: .9; font-size: .9rem; }
.adm-greet__cta { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.5); color: #fff; }
.adm-greet__cta:hover { background: #fff; color: var(--a-red); border-color: #fff; }
.adm-lead { margin: 0; color: var(--a-ink-2); }
.adm-note { margin: .2rem 0 0; font-size: .82rem; color: var(--a-ink-2); }

/* ----------------------------------------------------------------- panel */

.adm-panel {
  background: var(--a-panel); border: 1px solid var(--a-line);
  border-radius: var(--a-r-lg); box-shadow: var(--a-sd);
  padding: 1.2rem; margin-bottom: 1.2rem;
}
.adm-panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1rem;
}
.adm-panel__head h2 { font-size: 1.05rem; }
.adm-panel__head--bare { background: none; border: 0; padding: 0; margin-bottom: 1.2rem; }

.adm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.adm-grid--wide { grid-template-columns: 1.7fr 1fr; }
.adm-side-col { display: flex; flex-direction: column; }

.adm-empty {
  color: var(--a-ink-2); background: #fafbfe;
  border: 1.5px dashed var(--a-line); border-radius: var(--a-r);
  padding: 1.6rem; text-align: center; margin: 0;
}

/* ----------------------------------------------------------------- cards */

.adm-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .9rem; margin-bottom: 1.4rem;
}
.adm-card {
  --card-accent: var(--a-red);
  position: relative; overflow: hidden;
  background: var(--a-panel); border: 1px solid var(--a-line);
  border-radius: var(--a-r-lg); box-shadow: var(--a-sd);
  padding: 1.1rem 1.1rem 1.1rem 1.3rem; display: grid; gap: .1rem; color: var(--a-ink);
  transition: transform .15s, box-shadow .15s;
}
/* Coloured spine + a soft corner wash, so the card row reads as a bright set. */
.adm-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--card-accent);
}
.adm-card::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px;
  border-radius: 50%; background: var(--card-accent); opacity: .09;
}
.adm-card:hover { transform: translateY(-3px); box-shadow: var(--a-sd-lg); text-decoration: none; color: var(--a-ink); }
.adm-card__num { font-family: 'Baloo 2', sans-serif; font-size: 1.9rem; font-weight: 700; color: var(--card-accent); line-height: 1; }
.adm-card__label { font-weight: 700; }
.adm-card__note { font-size: .78rem; color: var(--a-ink-2); }

/* Rotate accent colours across the dashboard card row. */
.adm-cards .adm-card:nth-child(1) { --card-accent: #e63946; }
.adm-cards .adm-card:nth-child(2) { --card-accent: #2a9d8f; }
.adm-cards .adm-card:nth-child(3) { --card-accent: #f4a259; }
.adm-cards .adm-card:nth-child(4) { --card-accent: #457b9d; }
.adm-cards .adm-card:nth-child(5) { --card-accent: #9b5de5; }
.adm-cards .adm-card:nth-child(6) { --card-accent: #db2777; }
.adm-card--flat::before { width: 4px; }

.adm-quick { display: flex; flex-wrap: wrap; gap: .6rem; }

/* --------------------------------------------------------------- buttons */

.adm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 700; font-size: .88rem;
  padding: .52rem 1rem; border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.adm-btn:hover { text-decoration: none; }
.adm-btn:active { transform: translateY(1px); }
.adm-btn--primary { background: var(--a-red); color: #fff; }
.adm-btn--primary:hover { background: var(--a-red-dk); color: #fff; }
.adm-btn--ghost { background: #fff; border-color: var(--a-line); color: var(--a-ink); }
.adm-btn--ghost:hover { border-color: var(--a-ink-2); color: var(--a-ink); }
.adm-btn--danger { background: #fff; border-color: #f3c9c9; color: var(--a-err); }
.adm-btn--danger:hover { background: var(--a-err); border-color: var(--a-err); color: #fff; }
.adm-btn--sm { font-size: .8rem; padding: .34rem .75rem; }
.adm-btn--block { width: 100%; }

.adm-linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--a-red); font: inherit; font-size: .88rem; text-decoration: underline;
}

.adm-icon {
  width: 30px; height: 30px; flex: none;
  border: 1.5px solid var(--a-line); background: #fff; border-radius: 8px;
  cursor: pointer; font-size: .9rem; line-height: 1; color: var(--a-ink);
  display: grid; place-items: center;
}
.adm-icon:hover:not(:disabled) { border-color: var(--a-ink-2); }
.adm-icon:disabled { opacity: .35; cursor: not-allowed; }
.adm-icon--danger:hover { background: var(--a-err); border-color: var(--a-err); color: #fff; }

.adm-actions { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.adm-actions--end { justify-content: flex-end; }
.adm-actions form { margin: 0; }

/* ---------------------------------------------------------------- fields */

.adm-field { margin-bottom: 1rem; }
.adm-field label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .3rem; }
.adm-field input[type="text"],
.adm-field input[type="email"],
.adm-field input[type="password"],
.adm-field input[type="datetime-local"],
.adm-field select,
.adm-field textarea {
  width: 100%; font: inherit; font-size: .93rem;
  padding: .55rem .7rem;
  border: 1.5px solid var(--a-line); border-radius: var(--a-r);
  background: #fff; color: var(--a-ink);
  transition: border-color .15s;
}
.adm-field input:focus, .adm-field select:focus, .adm-field textarea:focus {
  outline: none; border-color: var(--a-red);
}
.adm-field input[readonly] { background: #f5f6fa; color: var(--a-ink-2); }
.adm-field textarea { resize: vertical; }
.adm-field small { display: block; margin-top: .3rem; font-size: .78rem; color: var(--a-ink-2); }
.adm-field--check label { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .92rem; }
.adm-field--check input { width: 17px; height: 17px; accent-color: var(--a-red); }

.adm-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84rem; line-height: 1.6; }

.adm-colorrow { display: flex; gap: .5rem; align-items: center; }
.adm-colorrow input[type="color"] {
  width: 52px; height: 40px; padding: 2px; border: 1.5px solid var(--a-line);
  border-radius: var(--a-r); background: #fff; cursor: pointer;
}
.adm-colorrow input[type="text"] { flex: 1; }

.adm-preview {
  border: 1.5px solid var(--a-line); border-radius: var(--a-r);
  padding: .5rem; margin-bottom: .5rem; background: #fafbfe;
}
.adm-preview img { max-height: 130px; width: auto; border-radius: 6px; margin: 0 auto .3rem; }
.adm-preview--sm img { max-height: 60px; }
.adm-preview small { display: block; text-align: center; font-size: .75rem; color: var(--a-ink-2); }

.adm-formbar {
  position: sticky; bottom: 0;
  display: flex; justify-content: flex-end; gap: .6rem;
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(8px);
  border-top: 1px solid var(--a-line);
  padding: .8rem 0; margin-top: .4rem;
}

.adm-inline {
  display: flex; flex-wrap: wrap; gap: .7rem; align-items: end;
}
.adm-inline label { display: grid; gap: .25rem; font-size: .78rem; font-weight: 700; flex: 1 1 160px; }
.adm-inline input, .adm-inline select {
  font: inherit; font-size: .88rem; padding: .45rem .6rem;
  border: 1.5px solid var(--a-line); border-radius: var(--a-r); background: #fff;
}
.adm-inline input:focus, .adm-inline select:focus { outline: none; border-color: var(--a-red); }

/* Two/three inputs side by side within a panel. */
.adm-field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; }

.adm-filterbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.adm-filterbar input[type="text"], .adm-filterbar select {
  font: inherit; font-size: .9rem; padding: .5rem .7rem;
  border: 1.5px solid var(--a-line); border-radius: var(--a-r); background: #fff;
}
.adm-filterbar input[type="text"] { flex: 1 1 200px; }
.adm-inline-label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .85rem; }
.adm-inline-label select, .adm-inline-label input {
  font: inherit; font-size: .9rem; padding: .45rem .6rem; font-weight: 400;
  border: 1.5px solid var(--a-line); border-radius: var(--a-r); background: #fff;
}

.adm-back { display: inline-block; font-weight: 700; font-size: .86rem; margin-bottom: 1rem; }
.adm-due { color: var(--a-err); }

/* Login / credentials callout after creating a parent. */
.adm-loginbox { border: 2px solid var(--a-gold); background: #fffdf3; }
.adm-loginbox h2 { font-size: 1.05rem; margin-bottom: .3rem; }
.adm-creds { display: grid; gap: .5rem; margin: 1rem 0 .5rem; }
.adm-creds > div { display: flex; gap: 1rem; flex-wrap: wrap; }
.adm-creds dt { font-size: .78rem; color: var(--a-ink-2); min-width: 130px; font-weight: 700; }
.adm-creds dd { margin: 0; }
.adm-creds code { font-size: .95rem; }

.adm-linklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.adm-linklist--plain li { padding: .4rem 0; border-bottom: 1px solid var(--a-line); font-size: .9rem; }

/* Compact forms used in cards. */
.adm-form--tight .adm-field { margin-bottom: .8rem; }
.adm-form--inline-card { display: flex; flex-wrap: wrap; gap: .7rem; align-items: end; }
.adm-form--inline-card .adm-field { margin: 0; flex: 1 1 120px; }
.adm-form--inline-card .adm-field--grow { flex: 2 1 200px; }
.adm-form--inline-card .adm-field label { font-size: .78rem; }
.adm-form--inline-card input, .adm-form--inline-card select {
  font: inherit; font-size: .9rem; padding: .5rem .6rem;
  border: 1.5px solid var(--a-line); border-radius: var(--a-r); background: #fff; width: 100%;
}
.adm-paybar { border-top: 1px solid var(--a-line); margin-top: 1rem; padding-top: 1rem; }

/* ---------------------------------------------------------- attendance */

.att-hint { margin: 0 0 1rem; font-size: .92rem; color: var(--a-ink-2); }

.att-list {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}

.att-card {
  margin: 0; min-width: 0;
  border: 2px solid var(--a-line); border-left-width: 6px; border-left-color: var(--a-ok);
  border-radius: 14px; background: #fff;
  padding: .9rem 1rem 1rem;
  display: grid; gap: .8rem;
}
.att-card:has(input[value="absent"]:checked) { border-left-color: var(--a-err); background: #fffafa; }
.att-card:has(input[value="late"]:checked)   { border-left-color: #d97706; background: #fffcf5; }

.att-card__head {
  float: left; width: 100%; padding: 0; /* float lets the legend sit inside the card like a normal row */
  display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap;
}
.att-card__roll {
  flex: none; font-size: .75rem; font-weight: 800; letter-spacing: .03em;
  background: var(--a-bg); color: var(--a-ink-2); border-radius: 999px; padding: .1rem .55rem;
}
.att-card .att-card__name { font-size: 1.12rem; font-weight: 800; color: var(--a-ink); line-height: 1.3; }
a.att-card__name:hover { color: var(--a-red); }

/* Present / Absent / Late as big tap targets instead of a tiny dropdown. */
.att-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; clear: both; }
.att-seg__opt { position: relative; cursor: pointer; }
.att-seg__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.att-seg__opt span {
  display: block; text-align: center; font-weight: 800; font-size: .98rem;
  padding: .7rem .3rem; border-radius: 10px;
  border: 2px solid var(--a-line); background: #fff; color: var(--a-ink-2);
  transition: background .15s, border-color .15s, color .15s;
}
.att-seg__opt input:focus-visible + span { outline: 3px solid rgba(230, 57, 70, .35); outline-offset: 2px; }
.att-seg__opt--present input:checked + span { background: var(--a-ok); border-color: var(--a-ok); color: #fff; }
.att-seg__opt--absent  input:checked + span { background: var(--a-err); border-color: var(--a-err); color: #fff; }
.att-seg__opt--late    input:checked + span { background: #d97706; border-color: #d97706; color: #fff; }

.att-times { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
/* No arrival/departure for a child who didn't come. */
.att-card:has(input[value="absent"]:checked) .att-times { display: none; }

.att-times label, .att-note {
  display: grid; gap: .3rem;
  font-size: .82rem; font-weight: 800; color: var(--a-ink-2);
}
.att-note small { font-weight: 600; }
.att-times input, .att-note textarea {
  font: inherit; font-size: 1rem; font-weight: 400; color: var(--a-ink);
  width: 100%; min-width: 0; padding: .6rem .7rem;
  border: 1.5px solid var(--a-line); border-radius: 10px; background: #fff;
}
.att-times input { min-height: 2.9rem; }
.att-note textarea { min-height: 7.5rem; font-size: 1.05rem; resize: vertical; line-height: 1.5; }
.att-times input:focus, .att-note textarea:focus { outline: none; border-color: var(--a-red); box-shadow: 0 0 0 3px rgba(230, 57, 70, .12); }

/* Sticky save bar with live counts. */
.att-bar { align-items: center; justify-content: space-between; flex-wrap: wrap; }
.att-bar__count { margin: 0; font-weight: 700; font-size: .92rem; }
.att-bar__count b { font-weight: 800; }
.att-c-present { color: var(--a-ok); }
.att-c-absent  { color: var(--a-err); }
.att-c-late    { color: #b45309; }

/* Review sheet shown before saving. */
.att-review {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  border: 0; border-radius: 18px; padding: 1.3rem 1.2rem 0;
  box-shadow: var(--a-sd-lg); overflow: auto;
}
.att-review::backdrop { background: rgba(20, 16, 28, .55); }
.att-review h2 { margin: 0; font-size: 1.3rem; }
.att-review__date { margin: .15rem 0 1rem; color: var(--a-ink-2); font-size: .9rem; }
.att-review__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.att-review__stats div { border-radius: 12px; padding: .6rem; text-align: center; font-weight: 700; font-size: .85rem; }
.att-review__stats strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.att-review__stats .is-present { background: var(--a-ok-bg); color: var(--a-ok); }
.att-review__stats .is-absent  { background: var(--a-err-bg); color: var(--a-err); }
.att-review__stats .is-late    { background: #fef3c7; color: #b45309; }
.att-review h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--a-ink-2); margin: 1rem 0 .4rem; }
.att-review ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.att-review li { background: var(--a-bg); border-radius: 10px; padding: .55rem .75rem; font-size: .92rem; }
.att-review li b { display: block; }
.att-review li span { color: var(--a-ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.att-review__none { color: var(--a-ink-2); font-size: .9rem; margin: 0; }
.att-review__bar {
  position: sticky; bottom: 0; background: #fff;
  display: flex; gap: .6rem; justify-content: flex-end;
  padding: 1rem 0 1.2rem; margin-top: 1rem; border-top: 1px solid var(--a-line);
}

@media (max-width: 680px) {
  .att-list { grid-template-columns: 1fr; }
  .att-card { padding: .85rem .85rem 1rem; }
  .adm-formbar.att-bar { flex-direction: column; align-items: stretch; gap: .45rem; }
  .att-bar .adm-btn { width: 100%; }
  .att-bar__count { width: 100%; text-align: center; }
  .att-review__bar { flex-direction: column-reverse; }
  .att-review__bar .adm-btn { width: 100%; }
}

.adm-table--marks input { font: inherit; padding: .4rem .5rem; border: 1.5px solid var(--a-line); border-radius: 8px; width: 100%; }
.adm-marknum { max-width: 90px; }
.adm-subject[readonly] { background: #f5f6fa; border-color: transparent; font-weight: 700; }

.adm-quote { background: var(--a-bg); border-radius: var(--a-r); padding: .8rem 1rem; margin: 0 0 1rem; font-size: .92rem; }
.adm-replybar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.adm-pill--sugg { background: #e8f1fb; color: #2563eb; }
.adm-pill--comp { background: var(--a-err-bg); color: var(--a-err); }
.adm-status { font-size: .72rem; font-weight: 800; padding: .18rem .6rem; border-radius: 999px; white-space: nowrap; }
.adm-status--open { background: #fff4e0; color: #b45309; }
.adm-status--in_review { background: #e8f1fb; color: #2563eb; }
.adm-status--resolved { background: var(--a-ok-bg); color: var(--a-ok); }

.adm-feestatus { font-size: .7rem; font-weight: 800; padding: .12rem .5rem; border-radius: 999px; }
.adm-feestatus--paid { background: var(--a-ok-bg); color: var(--a-ok); }
.adm-feestatus--partial { background: #fff4e0; color: #b45309; }
.adm-feestatus--unpaid { background: var(--a-err-bg); color: var(--a-err); }
.adm-feestatus--waived { background: #eef0f6; color: var(--a-ink-2); }

/* ---------------------------------------------------------- analytics */

.adm-card--flat { border-top: 3px solid var(--a-red); }

.an-bars { display: grid; gap: .7rem; }
.an-bar { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: .7rem; }
.an-bar__label { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-bar__track { background: #eef0f6; border-radius: 999px; height: 14px; overflow: hidden; }
.an-bar__fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--a-red), var(--a-gold)); min-width: 2px; transition: width .5s ease; }
.an-bar__fill--good { background: linear-gradient(90deg, #2a9d8f, #4ade80); }
.an-bar__fill--ok   { background: linear-gradient(90deg, #f4a259, #ffb703); }
.an-bar__fill--low  { background: linear-gradient(90deg, #c02636, #f15bb5); }
.an-bar__val { font-weight: 800; font-size: .85rem; text-align: right; }

.an-donutwrap { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.an-donut__big { font: 800 1.3rem 'Baloo 2', sans-serif; fill: var(--a-ink); }
.an-donut__sub { font: 600 .5rem 'Nunito', sans-serif; fill: var(--a-ink-2); text-transform: uppercase; letter-spacing: .05em; }
.an-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; font-size: .88rem; }
.an-legend--inline { grid-auto-flow: column; grid-template-columns: none; justify-content: start; gap: 1rem; margin-top: .6rem; flex-wrap: wrap; }
.an-legend strong { margin-left: .3rem; }
.an-legend__total { border-top: 1px solid var(--a-line); padding-top: .5rem; margin-top: .2rem; }
.an-dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; background: var(--c); margin-right: .3rem; vertical-align: -1px; }

.an-subhead { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--a-ink-2); margin: 1.1rem 0 .6rem; }
.an-subhead:first-of-type { margin-top: .2rem; }
.an-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.an-chip { font-size: .85rem; padding: .35rem .8rem; border-radius: 999px; font-weight: 600; }
.an-chip strong { font-family: 'Baloo 2'; font-size: 1rem; margin-right: .1rem; }
.an-chip--open { background: #fff4e0; color: #b45309; }
.an-chip--in_review { background: #e8f1fb; color: #2563eb; }
.an-chip--resolved { background: var(--a-ok-bg); color: var(--a-ok); }

.an-genderbar { display: flex; height: 22px; border-radius: 999px; overflow: hidden; background: #eef0f6; }
.an-genderbar__seg { height: 100%; }

.an-columns { display: flex; align-items: flex-end; gap: .8rem; height: 160px; padding-top: 1rem; }
.an-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .4rem; }
.an-col__bar { width: 60%; max-width: 46px; background: linear-gradient(180deg, var(--a-red), var(--a-gold)); border-radius: 8px 8px 0 0; position: relative; display: flex; justify-content: center; min-height: 6px; }
.an-col__val { position: absolute; top: -1.2rem; font-weight: 800; font-size: .82rem; }
.an-col__label { font-size: .78rem; color: var(--a-ink-2); font-weight: 600; }

.adm-msgsent { display: grid; gap: .8rem; }
.adm-msgitem { border: 1px solid var(--a-line); border-radius: var(--a-r); padding: .9rem; }
.adm-msgitem__head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.adm-msgitem__head h3 { font-size: 1rem; }
.adm-msgitem p { margin: .3rem 0 0; font-size: .9rem; }

/* ---------------------------------------------------------------- tables */

.adm-tablewrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.adm-table th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--a-ink-2); padding: .5rem .6rem; border-bottom: 1.5px solid var(--a-line);
  white-space: nowrap;
}
.adm-table td { padding: .7rem .6rem; border-bottom: 1px solid var(--a-line); vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-table tr.is-unread td { background: #fffdf3; }
.adm-table tr.is-off td { opacity: .5; }
.adm-right { text-align: right; }
.adm-cell-icon { display: flex; align-items: center; gap: .5rem; }
.adm-table small { color: var(--a-ink-2); }

.adm-table--menu tr.is-child td:first-child { padding-left: 1.8rem; }
.adm-tree { color: var(--a-ink-2); margin-right: .3rem; }
.adm-ext { max-width: 220px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.adm-editrow td { background: #fafbfe; }

.adm-swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--sw); flex: none; }

.adm-pill {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: .18rem .6rem; border-radius: 999px;
  background: #eef0f6; color: var(--a-ink-2); white-space: nowrap;
}
.adm-pill--on { background: var(--a-ok-bg); color: var(--a-ok); }

/* ------------------------------------------------------------------ tabs */

.adm-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.adm-tab {
  padding: .45rem 1rem; border-radius: 999px;
  border: 1.5px solid var(--a-line); background: #fff;
  font-weight: 700; font-size: .85rem; color: var(--a-ink-2);
}
.adm-tab:hover { border-color: var(--a-ink-2); color: var(--a-ink); text-decoration: none; }
.adm-tab.is-active { background: var(--a-red); border-color: var(--a-red); color: #fff; }

/* ---------------------------------------------------------------- slides */

.adm-slidelist { display: grid; gap: .9rem; }
.adm-slidecard {
  display: grid; grid-template-columns: 150px 1fr auto; gap: 1rem; align-items: center;
  background: var(--a-panel); border: 1px solid var(--a-line);
  border-radius: var(--a-r-lg); box-shadow: var(--a-sd); padding: .9rem;
}
.adm-slidecard.is-off { opacity: .55; }
.adm-slidecard__img {
  aspect-ratio: 16 / 10; border-radius: var(--a-r); overflow: hidden;
  background: #f1f2f7; display: grid; place-items: center;
}
.adm-slidecard__img img { width: 100%; height: 100%; object-fit: cover; }
.adm-noimg { font-size: .75rem; color: var(--a-ink-2); }
.adm-slidecard__body h3 { font-size: 1rem; }
.adm-slidecard__body h3 em { color: var(--a-red); font-style: normal; }
.adm-slidecard__body p { margin: .2rem 0 0; font-size: .85rem; color: var(--a-ink-2); }
.adm-slidecard__actions { display: grid; gap: .5rem; justify-items: end; }
.adm-meta { font-size: .78rem; color: var(--a-ink-2); }

/* --------------------------------------------------------------- gallery */

.adm-drop {
  display: grid; place-items: center; gap: .3rem; text-align: center;
  border: 2px dashed var(--a-line); border-radius: var(--a-r-lg);
  padding: 1.8rem 1rem; cursor: pointer; background: #fafbfe;
  transition: border-color .15s, background .15s;
}
.adm-drop:hover, .adm-drop.is-over { border-color: var(--a-red); background: #fff6f6; }
.adm-drop svg { width: 26px; height: 26px; color: var(--a-red); }
.adm-drop small { font-size: .76rem; color: var(--a-ink-2); }
.adm-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }

.adm-upload { display: grid; gap: .8rem; justify-items: start; }
.adm-upload .adm-drop { width: 100%; }
.adm-filelist { margin: 0; font-size: .82rem; color: var(--a-ink-2); }

.adm-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .7rem; }
.adm-thumb {
  margin: 0; border: 1px solid var(--a-line); border-radius: var(--a-r);
  overflow: hidden; background: #fff;
}
.adm-thumb.is-off { opacity: .45; }
.adm-thumb img, .adm-thumb video { aspect-ratio: 1; object-fit: cover; width: 100%; display: block; background: #1f2430; }
.adm-thumb { position: relative; }
.adm-thumb__badge {
  position: absolute; top: .4rem; left: .4rem; pointer-events: none;
  background: rgba(31, 36, 48, .8); color: #fff; font-size: .7rem; font-weight: 800;
  padding: .1rem .45rem; border-radius: 999px;
}
.adm-upload.is-busy .adm-drop { opacity: .5; pointer-events: none; }
.adm-upload__warn { color: var(--a-err); font-weight: 700; font-size: .85rem; }
.adm-thumb figcaption { padding: .35rem; border-top: 1px solid var(--a-line); }
.adm-thumb__row { display: flex; gap: .25rem; justify-content: center; }
.adm-thumb__row form { margin: 0; }
.adm-thumb__row .adm-icon { width: 26px; height: 26px; font-size: .75rem; }

/* ------------------------------------------------------------- enquiries */

.adm-enqlist { display: grid; gap: .9rem; }
.adm-enq { border: 1px solid var(--a-line); border-radius: var(--a-r-lg); padding: 1rem; background: #fff; }
.adm-enq.is-unread { border-left: 4px solid var(--a-gold); background: #fffdf5; }
.adm-enq__head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.adm-enq__head h3 { font-size: 1rem; display: flex; align-items: center; gap: .4rem; }
.adm-enq__subject { margin: 0 0 .3rem; }
.adm-enq__msg { margin: 0 0 .7rem; color: var(--a-ink-2); font-size: .92rem; }
.adm-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--a-gold); display: inline-block; }

/* ----------------------------------------------------------------- flash */

.adm-flash {
  border-radius: var(--a-r); padding: .7rem 1rem; margin-bottom: 1rem; font-size: .9rem;
  border: 1.5px solid transparent;
}
.adm-flash ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.adm-flash--ok  { background: var(--a-ok-bg);  border-color: #bfe3cd; color: var(--a-ok); }
.adm-flash--err { background: var(--a-err-bg); border-color: #f3c9c9; color: var(--a-err); }

/* ------------------------------------------------------------------ gate */

/* body.adm sets a background, so this needs equal specificity to win. */
body.adm--bare { background: linear-gradient(135deg, #2b1f26, #4a2230 55%, #7a3a1f); min-height: 100vh; }
.adm-gate { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.adm-gate__card {
  width: min(100%, 400px); background: #fff;
  border-radius: 20px; box-shadow: var(--a-sd-lg); padding: 1.8rem;
}
.adm-gate__brand { text-align: center; margin-bottom: 1.2rem; }
.adm-gate__brand .adm-brand__mark { margin: 0 auto .7rem; width: 44px; height: 44px; font-size: 1rem; }
.adm-gate__brand h1 { font-size: 1.35rem; }
.adm-gate__brand p { margin: .2rem 0 0; font-size: .87rem; color: var(--a-ink-2); }
.adm-gate__note { text-align: center; margin: 1rem 0 0; font-size: .82rem; }

/* --------------------------------------------------------------- burger */

.adm-burger {
  display: none; position: fixed; top: .65rem; left: .7rem; z-index: 40;
  width: 40px; height: 40px; border-radius: 9px;
  border: 1.5px solid var(--a-line); background: #fff; cursor: pointer;
  place-items: center;
}
.adm-burger svg { width: 20px; height: 20px; }

.adm-backdrop { position: fixed; inset: 0; background: rgba(20, 12, 18, .5); z-index: 25; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1000px) {
  .adm-grid, .adm-grid--wide { grid-template-columns: 1fr; }
  .adm-slidecard { grid-template-columns: 110px 1fr; }
  .adm-slidecard__actions { grid-column: 1 / -1; justify-items: start; }
}

@media (max-width: 820px) {
  .adm-side {
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .adm-side.is-open { transform: none; }
  .adm-main { margin-left: 0; }
  .adm-burger { display: grid; }
  .adm-top { padding-left: 3.6rem; }
  .adm-top__link { display: none; }
}

@media (max-width: 560px) {
  .adm-slidecard { grid-template-columns: 1fr; }
  .adm-top__title { font-size: 1rem; }
  .adm-formbar { flex-direction: column-reverse; }
  .adm-formbar .adm-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

/* ============================================================ teacher panel

   The teacher panel reuses this whole stylesheet; `.adm--teacher` just swaps the
   red accent for teal so staff always know which panel they're in. */

.adm--teacher .adm-brand__mark { background: linear-gradient(135deg, #2a9d8f, #21867a); }
.adm--teacher .adm-greet {
  background: linear-gradient(120deg, #1d6f64, #2a9d8f 55%, #57c4b5);
}
.adm--teacher .adm-gate__brand .adm-brand__mark { background: linear-gradient(135deg, #2a9d8f, #21867a); }

/* Class cards on the teacher dashboard. */
.adm-cardgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem; margin-bottom: 1.4rem;
}
.adm-card--teacher { gap: .6rem; padding: 1.2rem 1.2rem 1.2rem 1.4rem; }
.adm-card__head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.adm-card__head h2 { font-size: 1.1rem; margin: 0; }
.adm-card__meta { font-size: .82rem; color: var(--a-ink-2); margin: 0; }
.adm-card__foot { margin-top: .4rem; }

/* State accents drive the spine colour + matching status pill. */
.adm-card--done    { --card-accent: #15803d; }
.adm-card--partial { --card-accent: #d97706; }
.adm-card--todo    { --card-accent: #e63946; }
.adm-card--empty   { --card-accent: #94a3b8; }

.adm-pill--ok    { background: var(--a-ok-bg);  color: var(--a-ok); }
.adm-pill--warn  { background: #fff4e2;         color: #b45309; }
.adm-pill--err   { background: var(--a-err-bg); color: var(--a-err); }
.adm-pill--muted { background: #eef0f6;         color: var(--a-ink-2); }

.adm-panel--center { text-align: center; }

/* Links styled as buttons must keep their button text colour: the generic
   `.adm a` link colour (red) otherwise out-specifies `.adm-btn--*` and turns a
   primary <a> button red-on-red. */
.adm a.adm-btn--primary,
.adm a.adm-btn--primary:hover { color: #fff; }
.adm a.adm-btn--ghost  { color: var(--a-ink); }
.adm a.adm-btn--danger { color: var(--a-err); }
.adm a.adm-btn--danger:hover { color: #fff; }

/* Current-image preview on the Home Page editor. */
.adm-imgfield { display: flex; align-items: flex-start; gap: .8rem; margin-bottom: .6rem; }
.adm-imgfield img { max-width: 160px; max-height: 110px; border-radius: 10px; border: 1px solid var(--a-line, #eee); object-fit: cover; }
.adm-imgfield__remove { font-size: .85rem; display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }

/* Inline rename form on the Subjects/Classes/Exams screens. */
.adm-inline-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.adm-inline-form input[type="text"] { min-width: 180px; }
.adm-inline-label--check { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; white-space: nowrap; }
.adm-inline-label--check input { width: auto; }

/* Super-admin role badge + "never" muted text on the Admin Users screen. */
.adm-pill--super { background: linear-gradient(135deg, #9b5de5, #7c3aed); color: #fff; }
.adm-muted { color: var(--a-ink-2, #8a8391); }

/* A student name in the roster that links to their attendance history. */
.adm a.adm-roster-name { color: var(--a-ink); }
.adm a.adm-roster-name:hover { color: var(--a-red); text-decoration: underline; }

/* Class-assignment checklist on the admin teacher form. */
.adm-checklist { display: grid; gap: .1rem; margin: .3rem 0 .6rem; }
.adm-check {
  display: flex; align-items: center; gap: .6rem; cursor: pointer;
  padding: .5rem .6rem; border-radius: var(--a-r); font-weight: 600;
}
.adm-check:hover { background: var(--a-bg); }
.adm-check input { width: 17px; height: 17px; accent-color: #2a9d8f; }

/* Gallery uploader: per-file compress/upload progress. */
.adm-drop__auto { color: var(--a-ok); font-weight: 700; }
.up-status { margin: .2rem 0 1rem; }
.up-status ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.up-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .8rem; align-items: center;
  background: var(--a-bg); border-radius: 10px; padding: .55rem .75rem; font-size: .88rem;
}
.up-row__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-row__state { color: var(--a-ink-2); font-size: .82rem; text-align: right; }
.up-row__bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--a-line); overflow: hidden; }
.up-row__bar i { display: block; height: 100%; width: 0; background: var(--a-red); border-radius: inherit; transition: width .25s ease; }
.up-row.is-ok .up-row__bar i { background: var(--a-ok); }
.up-row.is-ok .up-row__state { color: var(--a-ok); font-weight: 700; }
.up-row.is-err { background: var(--a-err-bg); }
.up-row.is-err .up-row__state { color: var(--a-err); font-weight: 700; text-align: left; grid-column: 1 / -1; }
.up-row.is-err .up-row__bar i { background: var(--a-err); }
@media (max-width: 560px) {
  .up-row { grid-template-columns: 1fr; }
  .up-row__state { text-align: left; }
}
