/* ==========================================================================
   Sai Kids — parent portal
   Warmer than the admin (it's for families), calmer than the marketing site.
   ========================================================================== */

:root {
  --p-red:    #e63946;
  --p-red-dk: #b5121b;
  --p-gold:   #ffb703;
  --p-teal:   #2a9d8f;
  --p-ink:    #241f2b;
  --p-ink-2:  #6b6472;
  --p-line:   #ece7ef;
  --p-bg:     #f6f2f4;
  --p-panel:  #ffffff;
  --p-side:   #3a2733;
  --p-ok:     #15803d;
  --p-ok-bg:  #e8f6ed;
  --p-danger: #c02636;
  --p-danger-bg: #fdecec;
  --p-r:  12px;
  --p-r-lg: 18px;
  --p-sd: 0 2px 10px rgba(36, 31, 43, .06);
  --p-sd-lg: 0 16px 40px rgba(36, 31, 43, .14);
  --p-side-w: 236px;
}

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

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

.pt h1, .pt h2, .pt h3 { font-family: 'Baloo 2', system-ui, sans-serif; margin: 0; line-height: 1.2; }
.pt a { color: var(--p-red); text-decoration: none; }
.pt a:hover { text-decoration: underline; }
.pt img { max-width: 100%; display: block; }
.pt svg { width: 1em; height: 1em; fill: currentColor; }
.pt-muted { color: var(--p-ink-2); }
.pt-ok { color: var(--p-ok); }
.pt-danger { color: var(--p-danger); }
.pt-right { text-align: right; }
.pt-note { font-size: .82rem; }

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

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

.pt-side {
  position: fixed; inset: 0 auto 0 0; width: var(--p-side-w);
  background: linear-gradient(200deg, #4a2b3a 0%, #33212c 55%, #2a1b24 100%);
  color: #cdbfc7;
  display: flex; flex-direction: column; padding: 1rem .75rem; z-index: 30;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, .06);
}

/* Brand card at the top. */
.pt-brand {
  display: flex; align-items: center; gap: .7rem; color: #fff;
  font-family: 'Baloo 2'; 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);
}
.pt-brand:hover { text-decoration: none; color: #fff; background: rgba(255, 255, 255, .08); }
.pt-brand small { display: block; font-size: .62rem; font-weight: 700; color: var(--p-gold); letter-spacing: .1em; text-transform: uppercase; margin-top: .1rem; }
.pt-brand__mark {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--p-red), var(--p-gold));
  color: #fff; font-weight: 800; font-size: 1rem;
  box-shadow: 0 4px 12px rgba(230, 57, 70, .4);
}

.pt-nav { display: flex; flex-direction: column; gap: 3px; }
.pt-nav__link {
  position: relative;
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .7rem; border-radius: 11px;
  color: #cdbfc7; font-weight: 600; font-size: .92rem;
  transition: background .18s, color .18s, transform .1s; width: 100%;
}
.pt-nav__link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.pt-nav__link:active { transform: scale(.98); }

/* Active: gradient pill + a rounded indicator bar on the left. */
.pt-nav__link.is-active {
  background: linear-gradient(135deg, var(--p-red), var(--p-red-dk));
  color: #fff; box-shadow: 0 6px 16px rgba(230, 57, 70, .35);
}
.pt-nav__link.is-active::before {
  content: ''; position: absolute; left: -.75rem; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--p-gold);
}
/* Icon chip. */
.pt-nav__link svg {
  width: 30px; height: 30px; flex: none; padding: 6px; border-radius: 9px;
  background: rgba(255, 255, 255, .06); color: #fff; opacity: .95;
  box-sizing: border-box;
}
.pt-nav__link.is-active svg { background: rgba(255, 255, 255, .18); }
.pt-nav__link--btn { background: none; border: 0; cursor: pointer; font: inherit; text-align: left; }

.pt-badge {
  margin-left: auto; background: var(--p-gold); color: #40260a;
  font-size: .72rem; font-weight: 800; border-radius: 999px; padding: .05rem .45rem;
}
.pt-side__foot { margin-top: auto; padding-top: .8rem; margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 3px; }
.pt-side__foot form { margin: 0; }

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

.pt-main { margin-left: var(--p-side-w); min-height: 100vh; }

.pt-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(--p-line); padding: .8rem clamp(1rem, 3vw, 2rem);
}
.pt-top__title { font-family: 'Baloo 2'; font-weight: 700; font-size: 1.15rem; }
.pt-top__user { display: flex; align-items: center; gap: .55rem; }
.pt-avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--p-red), var(--p-gold)); color: #fff; font-weight: 800;
}
.pt-top__name { font-weight: 700; font-size: .9rem; }

.pt-body { padding: clamp(1rem, 3vw, 2rem); max-width: 1120px; }
.pt-hello { font-family: 'Baloo 2'; font-size: 1.3rem; font-weight: 700; margin: 0 0 1.2rem; }

/* Colourful welcome banner. */
.pt-greet {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: linear-gradient(120deg, var(--p-red), var(--p-gold));
  color: #fff; border-radius: var(--p-r-lg); padding: 1.3rem 1.5rem; margin-bottom: 1.3rem;
  box-shadow: var(--p-sd); overflow: hidden; position: relative;
}
.pt-greet__text h1 { font-size: 1.35rem; color: #fff; }
.pt-greet__text p { margin: .2rem 0 0; opacity: .92; font-size: .92rem; }
.pt-greet__emoji { font-size: 2.6rem; line-height: 1; filter: drop-shadow(0 3px 6px rgba(0,0,0,.2)); }

/* Brighten each child card with a coloured top band + a photo-less accent. */
.pt-childcard { border-top: 4px solid var(--p-red); }
.pt-childgrid > .pt-childcard:nth-child(3n+1) { border-top-color: #e63946; }
.pt-childgrid > .pt-childcard:nth-child(3n+2) { border-top-color: #2a9d8f; }
.pt-childgrid > .pt-childcard:nth-child(3n+3) { border-top-color: #9b5de5; }

/* --------------------------------------------------------------- panels */

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

.pt-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.pt-cols--form { grid-template-columns: 1fr 1.1fr; }

.pt-empty { background: #fff; border: 2px dashed var(--p-line); border-radius: var(--p-r-lg); padding: 2rem; text-align: center; color: var(--p-ink-2); }

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

/* ------------------------------------------------------ KPI strip */

.pt-kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.3rem;
}
.pt-kpi {
  --kpi: var(--p-red);
  position: relative; overflow: hidden;
  background: #fff; border: 1px solid var(--p-line); border-radius: var(--p-r-lg);
  box-shadow: var(--p-sd); padding: 1.1rem 1.2rem;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  column-gap: .9rem; align-items: center;
}
.pt-kpi__icon {
  grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--kpi) 14%, #fff); color: var(--kpi);
}
.pt-kpi__icon svg { width: 22px; height: 22px; }
.pt-kpi__value { font-family: 'Baloo 2'; font-weight: 800; font-size: 1.5rem; line-height: 1; color: var(--kpi); align-self: end; }
.pt-kpi__label { font-size: .78rem; color: var(--p-ink-2); font-weight: 600; align-self: start; }
.pt-kpi--red    { --kpi: #e63946; }
.pt-kpi--teal   { --kpi: #2a9d8f; }
.pt-kpi--gold   { --kpi: #e08a00; }
.pt-kpi--purple { --kpi: #7c3aed; }

/* ------------------------------------------------ dashboard masonry

   CSS columns balance the tiles across two columns regardless of how many
   children there are, with no stretched single card and no awkward gaps. */

.pt-dash { columns: 2; column-gap: 1.2rem; }
.pt-tile { break-inside: avoid; margin: 0 0 1.2rem; display: block; }
.pt-tile--children {
  background: var(--p-panel); border: 1px solid var(--p-line);
  border-radius: var(--p-r-lg); box-shadow: var(--p-sd); padding: 1.2rem;
}
.pt .pt-tile__title { font-size: 1.08rem; margin: 0 0 1.15rem; }

.pt-childgrid { display: grid; gap: 1.1rem; }
.pt-childcard { background: var(--p-bg); border: 1px solid var(--p-line); border-radius: var(--p-r-lg); padding: 1.2rem; }
.pt-childcard__head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.pt-childcard__avatar, .pt-childhead__avatar {
  width: 52px; height: 52px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-family: 'Baloo 2'; font-weight: 800; font-size: 1.4rem;
  background: linear-gradient(135deg, #ffd9a8, #ffb1b8); color: var(--p-red-dk);
}
.pt-childcard__head h3 { font-size: 1.1rem; }
.pt-childcard__head p { margin: 0; font-size: .84rem; color: var(--p-ink-2); }

.pt-childcard__stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .8rem; }
.pt-childcard__stats > div, .pt-statcard { text-align: center; background: var(--p-bg); border-radius: var(--p-r); padding: .7rem; }
/* Two-tone stat tiles inside each child card. */
.pt-childcard__stats > div:nth-child(1) { background: #fff1f2; }
.pt-childcard__stats > div:nth-child(1) .pt-stat__num { color: #e63946; }
.pt-childcard__stats > div:nth-child(2) { background: #e9f7f3; }
.pt-childcard__stats > div:nth-child(2) .pt-stat__num { color: #2a9d8f; }
.pt-stat__num { display: block; font-family: 'Baloo 2'; font-weight: 800; font-size: 1.5rem; line-height: 1; color: var(--p-red); }
.pt-stat__label { display: block; font-size: .74rem; color: var(--p-ink-2); margin-top: .2rem; }

.pt-today { font-size: .86rem; background: var(--p-ok-bg); border-radius: var(--p-r); padding: .5rem .7rem; margin: 0 0 .8rem; }

.pt-childcard__links { display: flex; flex-wrap: wrap; gap: .4rem; }
.pt-childcard__links a {
  font-size: .82rem; font-weight: 700; padding: .35rem .7rem;
  background: var(--p-bg); border-radius: 999px; color: var(--p-ink);
}
.pt-childcard__links a:hover { background: var(--p-red); color: #fff; text-decoration: none; }

/* -------------------------------------------------------------- tags */

.pt-tag { display: inline-block; font-size: .72rem; font-weight: 800; padding: .12rem .55rem; border-radius: 999px; }
.pt-tag--present { background: var(--p-ok-bg); color: var(--p-ok); }
.pt-tag--late    { background: #fff4e0; color: #b45309; }
.pt-tag--absent  { background: var(--p-danger-bg); color: var(--p-danger); }
.pt-tag--holiday { background: #eef0f6; color: var(--p-ink-2); }
.pt-tag--complaint  { background: var(--p-danger-bg); color: var(--p-danger); }
.pt-tag--suggestion { background: #e8f1fb; color: #2563eb; }

/* ---------------------------------------------------------- fee summary */

.pt-feebar { height: 10px; border-radius: 999px; background: var(--p-line); overflow: hidden; margin-bottom: .9rem; }
.pt-feebar__fill { height: 100%; background: linear-gradient(90deg, var(--p-teal), #4ade80); }
.pt-feegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; text-align: center; }

/* ------------------------------------------------------------- lists */

.pt-msglist, .pt-noticelist { list-style: none; padding: 0; margin: 0; }
.pt-msglist li { padding: .7rem 0; border-bottom: 1px solid var(--p-line); position: relative; padding-left: .9rem; }
.pt-msglist li:last-child { border-bottom: 0; }
.pt-msglist li.is-unread::before { content: ''; position: absolute; left: 0; top: 1.05rem; width: 7px; height: 7px; border-radius: 50%; background: var(--p-gold); }
.pt-msglist strong { display: inline; font-size: .93rem; }
.pt-msglist small { color: var(--p-ink-2); font-size: .76rem; margin-left: .4rem; }
.pt-msglist p { margin: .2rem 0 0; font-size: .85rem; color: var(--p-ink-2); }

.pt-noticelist li { border-bottom: 1px solid var(--p-line); }
.pt-noticelist li:last-child { border-bottom: 0; }
.pt-noticelist a { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; color: var(--p-ink); }
.pt-noticelist a:hover strong { color: var(--p-red); }
.pt-noticelist strong { font-size: .92rem; font-weight: 700; }
.pt-noticelist small { color: var(--p-ink-2); font-size: .78rem; white-space: nowrap; }

/* ------------------------------------------------------- child detail */

.pt-back { display: inline-block; font-weight: 700; font-size: .86rem; margin-bottom: 1rem; }
.pt-childhead { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }
.pt-childhead h1 { font-size: 1.5rem; }
.pt-childhead p { margin: .2rem 0 0; color: var(--p-ink-2); }

.pt-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.3rem; border-bottom: 2px solid var(--p-line); }
.pt-tab {
  padding: .55rem 1rem; font-weight: 700; font-size: .9rem; color: var(--p-ink-2);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.pt-tab:hover { color: var(--p-ink); text-decoration: none; }
.pt-tab.is-active { color: var(--p-red); border-bottom-color: var(--p-red); }

.pt-detaillist { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0; margin: 0; }
.pt-detaillist > div { padding: .7rem 0; border-bottom: 1px solid var(--p-line); }
.pt-detaillist dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--p-ink-2); }
.pt-detaillist dd { margin: .2rem 0 0; font-weight: 600; }

.pt-statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.pt-statcard { background: #fff; border: 1px solid var(--p-line); box-shadow: var(--p-sd); }

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

.pt-tablewrap { overflow-x: auto; }
.pt-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.pt-table th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--p-ink-2); padding: .5rem .6rem; border-bottom: 2px solid var(--p-line); white-space: nowrap;
}
.pt-table td { padding: .6rem .6rem; border-bottom: 1px solid var(--p-line); }
.pt-table tfoot td { border-top: 2px solid var(--p-line); border-bottom: 0; background: var(--p-bg); }

.pt-resultpill { font-family: 'Baloo 2'; font-weight: 800; padding: .2rem .8rem; border-radius: 999px; font-size: .95rem; }
.pt-resultpill--pass { background: var(--p-ok-bg); color: var(--p-ok); }
.pt-resultpill--fail { background: var(--p-danger-bg); color: var(--p-danger); }
.pt-grade { display: inline-block; font-weight: 800; background: var(--p-bg); border-radius: 6px; padding: .05rem .5rem; font-size: .82rem; }

.pt-feestatus { font-size: .72rem; font-weight: 800; padding: .12rem .55rem; border-radius: 999px; }
.pt-feestatus--paid    { background: var(--p-ok-bg); color: var(--p-ok); }
.pt-feestatus--partial { background: #fff4e0; color: #b45309; }
.pt-feestatus--unpaid  { background: var(--p-danger-bg); color: var(--p-danger); }
.pt-feestatus--waived  { background: #eef0f6; color: var(--p-ink-2); }

/* ------------------------------------------------------- complaints */

.pt-threadlist, .pt-notiflist { display: grid; gap: .9rem; }
.pt-thread, .pt-notif { border: 1px solid var(--p-line); border-radius: var(--p-r); padding: 1rem; background: #fff; }
.pt-thread__top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.pt-thread h3 { font-size: 1rem; margin-bottom: .3rem; }
.pt-thread p { margin: 0 0 .5rem; font-size: .9rem; }
.pt-status { font-size: .72rem; font-weight: 800; padding: .12rem .55rem; border-radius: 999px; }
.pt-status--open { background: #fff4e0; color: #b45309; }
.pt-status--in_review { background: #e8f1fb; color: #2563eb; }
.pt-status--resolved { background: var(--p-ok-bg); color: var(--p-ok); }
.pt-reply { background: var(--p-bg); border-radius: var(--p-r); padding: .7rem .9rem; margin-top: .5rem; }
.pt-reply strong { color: var(--p-red); font-size: .85rem; }
.pt-reply p { margin: .3rem 0; font-size: .9rem; }

.pt-notif.is-unread { border-left: 4px solid var(--p-gold); }
.pt-notif__head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pt-notif__head h3 { font-size: 1rem; }
.pt-notif p { margin: .4rem 0 0; font-size: .9rem; color: var(--p-ink-2); }

/* --------------------------------------------------------------- forms */

.pt-field { margin-bottom: 1rem; }
.pt-field label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .3rem; }
.pt-field input[type="text"], .pt-field input[type="password"], .pt-field input[type="email"],
.pt-field select, .pt-field textarea {
  width: 100%; font: inherit; font-size: .93rem; padding: .6rem .75rem;
  border: 1.5px solid var(--p-line); border-radius: var(--p-r); background: #fff; color: var(--p-ink);
}
.pt-field input:focus, .pt-field select:focus, .pt-field textarea:focus { outline: none; border-color: var(--p-red); }
.pt-field textarea { resize: vertical; }
.pt-field small { display: block; margin-top: .3rem; font-size: .78rem; color: var(--p-ink-2); }
.pt-radios { display: flex; gap: 1.2rem; }
.pt-radios label { display: flex; align-items: center; gap: .4rem; font-weight: 600; }
.pt-radios input { accent-color: var(--p-red); }

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

.pt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 800; font-size: .9rem; padding: .6rem 1.2rem;
  border-radius: 999px; border: 1.5px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.pt-btn:hover { text-decoration: none; }
.pt-btn:active { transform: translateY(1px); }
.pt-btn--primary { background: var(--p-red); color: #fff; }
.pt-btn--primary:hover { background: var(--p-red-dk); color: #fff; }
.pt-btn--ghost { background: #fff; border-color: var(--p-line); color: var(--p-ink); }
.pt-btn--ghost:hover { border-color: var(--p-ink-2); color: var(--p-ink); }
.pt-btn--sm { font-size: .8rem; padding: .35rem .8rem; }
.pt-btn--block { width: 100%; }
.pt-linkbtn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--p-red); font: inherit; font-size: .85rem; text-decoration: underline; }

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

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

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

.pt--bare { background: linear-gradient(140deg, #3a2733, #7a2230 55%, #d67d1f); min-height: 100vh; }
.pt-gate { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.pt-gate__card { width: min(100%, 410px); background: #fff; border-radius: 22px; box-shadow: var(--p-sd-lg); padding: 1.9rem; }
.pt-gate__brand { text-align: center; margin-bottom: 1.3rem; }
.pt-gate__brand .pt-brand__mark { margin: 0 auto .7rem; width: 46px; height: 46px; }
.pt-gate__brand h1 { font-size: 1.4rem; }
.pt-gate__brand p { margin: .2rem 0 0; font-size: .88rem; color: var(--p-ink-2); }
.pt-gate__note { text-align: center; margin: 1.1rem 0 0; font-size: .82rem; color: var(--p-ink-2); }

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

.pt-burger {
  display: none; position: fixed; top: .65rem; left: .7rem; z-index: 40;
  width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--p-line);
  background: #fff; cursor: pointer; place-items: center;
}
.pt-burger svg { width: 20px; height: 20px; }
.pt-backdrop { position: fixed; inset: 0; background: rgba(20, 12, 18, .5); z-index: 25; }

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

@media (max-width: 980px) {
  .pt-cols, .pt-cols--form { grid-template-columns: 1fr; }
  .pt-dash { columns: 1; }
}
@media (max-width: 640px) {
  .pt-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .pt-side { transform: translateX(-100%); transition: transform .25s ease; }
  .pt-side.is-open { transform: none; }
  .pt-main { margin-left: 0; }
  .pt-burger { display: grid; }
  .pt-top { padding-left: 3.6rem; }
  .pt-top__name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; }
}
