/* ===== "KIDS DAY 26" brick theme (IC design). Lean logo and Cairo type stay. ===== */
@font-face { font-family: 'Cairo'; font-weight: 300; font-display: swap; src: url('/static/fonts/cairo-300.woff2') format('woff2'); }
@font-face { font-family: 'Cairo'; font-weight: 400; font-display: swap; src: url('/static/fonts/cairo-400.woff2') format('woff2'); }
@font-face { font-family: 'Cairo'; font-weight: 600; font-display: swap; src: url('/static/fonts/cairo-600.woff2') format('woff2'); }
@font-face { font-family: 'Cairo'; font-weight: 700; font-display: swap; src: url('/static/fonts/cairo-700.woff2') format('woff2'); }
@font-face { font-family: 'Cairo'; font-weight: 900; font-display: swap; src: url('/static/fonts/cairo-900.woff2') format('woff2'); }

:root {
  --royal: #0008C3;
  --navy: #00023B;
  --mint: #11D691;
  --mint-d: #0BB27A;
  --purple: #A905C7;
  --purple-d: #7E049A;
  --blue: #2C50ED;
  --cyan: #29E7FF;
  --ink: #131D65;

  /* names used across the admin styles */
  --off: #FFFFFF;
  --green: var(--mint);
  --teal: var(--blue);
  --gray: #4B5080;
  --gray-l: #B9BCDD;
  --line-soft: rgba(19, 29, 101, 0.2);

  --radius: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --stud-h: 7px;
  --stud-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 7'%3E%3Cpath d='M7 7V2.5A2.5 2.5 0 0 1 9.5 0h9A2.5 2.5 0 0 1 21 2.5V7z'/%3E%3C/svg%3E");

  /* page background: deep navy */
  --bg: #00023B;
  --fg: #FFFFFF;
  --band: transparent;
  --focus: var(--cyan);
  --panel-edge: #1430E9;
  --panel-stud: #FFFFFF;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  font-family: 'Cairo', Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.7;
  color: var(--navy);
  background-color: var(--bg);
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.panel :focus-visible { outline-color: var(--blue); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}


/* ===== studs: the little bumps on top of every brick ===== */
.hero__date, .btn, .kid, .cd__tile, .panel, .stat { position: relative; }
.hero__date::before, .btn::before, .kid::before, .cd__tile::before, .panel::before, .stat::before {
  content: ''; position: absolute; bottom: 100%; left: 10px; right: 10px; height: var(--stud-h);
  background: var(--stud-c, var(--mint-d));
  -webkit-mask: var(--stud-mask) center bottom / 28px 100% space no-repeat;
  mask: var(--stud-mask) center bottom / 28px 100% space no-repeat;
  pointer-events: none;
}

/* ===== bricks (SVG) ===== */
.brick { display: block; flex: none; }
.brick svg { width: 100%; height: 100%; overflow: visible; }

.bg-deco { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.pile { position: absolute; --pcell: 20px; }
.pile svg { width: 100%; height: auto; }
.pile--tl { top: 0; left: 0; width: calc(var(--pcell) * 8); }
.pile--br { bottom: 0; right: 0; width: calc(var(--pcell) * 7); --pcell: 16px; }
@media (min-width: 900px) { .pile { --pcell: 30px; } .pile--br { --pcell: 26px; } }

/* ===== hero ===== */
.hero {
  position: relative; z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  padding: 26px 22px 100px;
  text-align: center;
  color: var(--fg);
}
.hero__top { display: flex; align-items: flex-start; justify-content: flex-start; gap: 16px; position: relative; z-index: 2; }
.logo { width: 52px; height: auto; }

.hero__title { position: relative; z-index: 2; margin: 0 0 12px; font-weight: 900; font-size: clamp(46px, 11vw, 96px); line-height: 1.45; }
.hero__title-img {
  display: block; width: min(300px, 76vw); aspect-ratio: 550 / 350; margin: 6px auto 0;
  background: url('/static/theme/title-navy.png') center / contain no-repeat;
  animation: rise .7s var(--ease) both;
}
.hero--compact .hero__title-img { width: min(210px, 60vw); }
@media (min-width: 700px) { .hero__title-img { width: 420px; margin-top: -56px; } .hero--compact .hero__title-img { width: 280px; } }

.hero__sub {
  position: relative; z-index: 2;
  margin: 0 auto; max-width: 560px;
  font-weight: 700; font-size: clamp(17px, 3.4vw, 21px); line-height: 1.7;
  animation: rise .7s var(--ease) both .1s;
}
.hero__meta { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 12px; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 16px 4px 12px;
  border: 3px solid var(--ink); border-radius: 10px;
  background: #fff; color: var(--navy);
  font-weight: 700; font-size: 15px;
  text-decoration: none;
  animation: rise .6s var(--ease) both .2s;
}
.chip__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mint); }
.hero__date {
  --stud-c: var(--mint-d);
  display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px;
  margin: 8px 0 0; padding: 6px 18px; border-radius: 8px;
  background: var(--mint); color: var(--navy);
  box-shadow: 0 4px 0 var(--mint-d);
  font-weight: 900; font-size: clamp(16px, 3.2vw, 20px);
  animation: rise .7s var(--ease) both .2s;
}
.hero__date-l { font-weight: 700; }
.hero__time { padding: 0 12px; border-radius: 6px; background: var(--navy); color: var(--mint); }

.countdown {
  position: relative; z-index: 2;
  max-width: 640px; margin: 22px auto 0; padding: 16px 12px 20px;
  border-radius: 14px; background: var(--band); color: #fff;
  animation: rise .7s var(--ease) both .3s;
}
.cd__title { margin: 0; font-weight: 700; font-size: 16px; }
.cd__tiles { position: relative; display: inline-flex; direction: ltr; gap: 10px; margin-top: 82px; }
.cd__tile {
  display: grid; justify-items: center; align-content: center;
  flex: none; width: clamp(62px, 19vw, 92px); height: 84px; border-radius: 8px;
  color: var(--navy);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .3);
}
.cd__tile::before { left: 8px; right: 8px; }
.cd__tile--green { background: var(--mint); --stud-c: var(--mint-d); }
.cd__tile--yellow { background: #fff; color: var(--royal); --stud-c: #C9CCEF; }
.cd__tile--teal { background: var(--purple); color: #fff; --stud-c: var(--purple-d); }
.cd__tile--off { background: var(--cyan); --stud-c: #12BBD3; }
.cd__num { font-weight: 900; font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cd__num.is-pop { animation: cdpop .45s var(--ease); }
.cd__lbl { font-weight: 700; font-size: 13px; }
.cd__today {
  display: inline-block; margin: 0; padding: 10px 22px; border-radius: 10px;
  background: var(--mint); color: var(--navy);
  font-weight: 900; font-size: clamp(20px, 4vw, 28px);
  box-shadow: 0 5px 0 var(--mint-d);
  animation: wiggle 2.4s ease-in-out infinite;
}

/* ===== mascots walking and hopping on top of the countdown bricks ===== */
.play { position: absolute; left: 0; right: 0; bottom: calc(100% + var(--stud-h)); height: 0; pointer-events: none; z-index: 3; }
.actor { --w: 42px; position: absolute; bottom: -1px; left: 96%; width: var(--w); margin-left: calc(var(--w) / -2); animation: pkcross 6s linear both; }
.actor--girl { --w: 42px; }
.actor--boy { --w: 41px; }
.actor--robot { --w: 50px; }
.actor__hop { display: block; animation: pkhop 6s linear both; }
.actor__img { width: 100%; height: auto; transform-origin: 50% 100%; animation: pkwalk .42s ease-in-out infinite alternate; }
.actor--p2, .actor--p2 .actor__hop { animation-delay: .9s; }
.actor--p3, .actor--p3 .actor__hop { animation-delay: 1.8s; }
.actor--p2 .actor__img { animation-delay: -.2s; }
.actor--still { left: 88%; animation: none; }
.actor--still .actor__hop, .actor--still .actor__img { animation: none; }
@media (min-width: 600px) {
  .actor--girl { --w: 56px; }
  .actor--boy { --w: 55px; }
  .actor--robot { --w: 66px; }
  .cd__tiles { margin-top: 112px; }
}

@keyframes pkcross {
  0% { left: 96%; opacity: 0; }
  5% { opacity: 1; }
  95% { opacity: 1; }
  100% { left: 4%; opacity: 0; }
}
/* hops over the three gaps between the bricks */
@keyframes pkhop {
  0%, 16%, 44%, 72% { transform: translateY(0); animation-timing-function: ease-out; }
  22%, 50%, 78% { transform: translateY(-16px); animation-timing-function: ease-in; }
  28%, 56%, 84%, 100% { transform: translateY(0); }
}
@keyframes pkwalk { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }

@keyframes cdpop { 0% { transform: scale(1); } 40% { transform: scale(1.3) translateY(-4px); } 100% { transform: scale(1); } }
@media (min-width: 600px) { .cd__tiles { gap: 14px; } .cd__tile { height: 96px; } .cd__num { font-size: 38px; } }

.hero__deco { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.loose { display: none; position: absolute; animation: float 7s ease-in-out infinite; }
.loose svg { transform: rotate(-14deg); }
.loose--1 { width: 38px; top: 150px; left: 4%; }
.loose--2 { width: 30px; top: 330px; right: 5%; animation-delay: -3s; }
.loose--2 svg { transform: rotate(12deg); }
@media (min-width: 900px) {
  .loose { display: block; }
  .loose--1 { width: 64px; top: 190px; left: 15%; }
  .loose--2 { width: 52px; top: 260px; right: 16%; }
}

/* ===== panel: a big white brick the mascots stand on ===== */
.panel {
  --stud-c: var(--panel-stud);
  --stud-h: 9px;
  z-index: 1;
  max-width: 760px;
  margin: 0 18px;
  padding: 28px 20px 30px;
  border: 3px solid var(--panel-edge); border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 0 var(--panel-edge);
  min-height: 260px;
}
@media (min-width: 820px) { .panel { margin: 0 auto; padding: 40px 44px 44px; } }
.panel::before { left: 16px; right: 16px; }
.panel--wide { max-width: 1100px; }

.stand { position: absolute; left: 0; right: 0; bottom: calc(100% + 9px); height: 0; pointer-events: none; }
.stand img { position: absolute; bottom: 0; height: auto; }
.stand__girl { right: 14px; width: 54px; }
.stand__boy { left: 14px; width: 52px; }
.stand__robot { left: 50%; width: 66px; margin-left: -33px; }
@media (min-width: 820px) {
  .stand__girl { right: 40px; width: 92px; }
  .stand__boy { left: 40px; width: 88px; }
  .stand__robot { width: 104px; margin-left: -52px; }
  .hero { padding-bottom: 168px; }
}
@media (min-width: 820px) { .hero--compact { padding-bottom: 150px; } }

.view { animation: rise .5s var(--ease) both; }
.view:focus { outline: none; }
.h2 { margin: 0 0 4px; font-weight: 900; font-size: clamp(26px, 5vw, 34px); line-height: 1.35; color: var(--royal); }
.lead { margin: 0 0 22px; font-weight: 600; font-size: 18px; color: var(--gray); }
.muted { color: var(--gray); font-weight: 300; font-size: 14px; }

/* ===== steps ===== */
.steps { display: flex; list-style: none; margin: 0 0 28px; padding: 0; }
.steps li { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; font-size: 14px; color: var(--gray); }
.steps li:last-child { flex: none; }
.steps__n {
  flex: none; width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 900; font-size: 15px;
  border: 3px solid var(--gray-l); background: #fff; color: var(--gray);
  transition: all .3s var(--ease);
}
.steps__n svg { width: 18px; height: 18px; }
.steps__t { white-space: nowrap; }
.steps__line { flex: 1; height: 4px; min-width: 14px; border-radius: 4px; background: var(--gray-l); opacity: .5; position: relative; overflow: hidden; margin-inline: 4px; }
.steps__line::after { content: ''; position: absolute; inset: 0; background: var(--mint); transform: scaleX(0); transform-origin: right; transition: transform .45s var(--ease); }
.steps li.is-done .steps__n { background: var(--mint); border-color: var(--mint); color: var(--navy); }
.steps li.is-done .steps__line { opacity: 1; }
.steps li.is-done .steps__line::after { transform: scaleX(1); }
.steps li.is-now .steps__n { background: var(--royal); border-color: var(--royal); color: #fff; transform: scale(1.12); }
.steps li.is-now .steps__t { color: var(--navy); font-weight: 900; }
@media (max-width: 520px) { .steps__t { display: none; } .steps li.is-now .steps__t { display: inline; } }

/* ===== children: a stack of coloured bricks ===== */
.kids { display: grid; gap: 24px 14px; margin: 18px 0 24px; padding: 0; list-style: none; }
@media (min-width: 640px) { .kids { grid-template-columns: 1fr 1fr; } }
.kids li:nth-child(4n+1) .kid { --c: var(--royal); --on: #fff; --stud-c: var(--royal); }
.kids li:nth-child(4n+2) .kid { --c: var(--purple); --on: #fff; --stud-c: var(--purple); }
.kids li:nth-child(4n+3) .kid { --c: var(--mint); --on: var(--navy); --stud-c: var(--mint); }
.kids li:nth-child(4n+4) .kid { --c: var(--blue); --on: #fff; --stud-c: var(--blue); }

.kid {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 3px solid var(--c); border-radius: 8px;
  background: #fff; color: var(--navy);
  cursor: pointer; user-select: none;
  transition: transform .25s var(--ease), background-color .2s, color .2s;
}
.kid:hover { transform: translateY(-2px); }
.kid.is-on { background: var(--c); color: var(--on); box-shadow: 0 5px 0 rgba(0, 0, 0, .25); }
.kid:has(:focus-visible) { outline: 3px solid var(--blue); outline-offset: 4px; }
.kid__input { position: absolute; opacity: 0; pointer-events: none; }
.kid__avatar { width: 56px; height: 56px; padding: 5px; border-radius: 8px; background: #fff; transition: transform .4s var(--ease); }
.kid.is-on .kid__avatar { animation: pop .5s var(--ease); }
.kid__name { display: block; font-weight: 900; font-size: 19px; line-height: 1.4; overflow-wrap: anywhere; }
.kid__meta { display: block; font-weight: 600; font-size: 14px; color: var(--gray); }
.kid.is-on .kid__meta { color: inherit; opacity: .9; }
.kid__check {
  width: 32px; height: 32px; border-radius: 8px;
  border: 3px solid var(--gray-l); background: #fff;
  display: grid; place-items: center;
  transition: all .25s var(--ease);
}
.kid__check svg { width: 18px; height: 18px; transform: scale(0); transition: transform .3s var(--ease); }
.kid.is-on .kid__check { border-color: #fff; }
.kid.is-on .kid__check svg { transform: scale(1); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; padding: 6px 4px; cursor: pointer; font-weight: 700; font-size: 15px; color: var(--royal); text-decoration: underline; text-underline-offset: 4px; }
.count-pill { font-weight: 700; font-size: 14px; background: var(--navy); color: #fff; padding: 2px 14px; border-radius: 6px; }

/* ===== buttons: bricks with studs ===== */
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 16px; }
.btn {
  --stud-c: var(--mint-d);
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; margin-top: var(--stud-h); padding: 10px 30px;
  border: 0; border-radius: 8px;
  font-weight: 900; font-size: 18px; text-decoration: none;
  background: var(--mint); color: var(--navy);
  box-shadow: 0 5px 0 var(--mint-d);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), opacity .2s;
}
.btn::before { left: 14px; right: 14px; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--mint-d); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--mint-d); }
.btn[disabled] { cursor: not-allowed; background: #CDD0E8; color: #6A6F98; --stud-c: #B3B7D8; box-shadow: 0 5px 0 #A3A8CC; opacity: 1; transform: none; }
.btn--ghost { background: transparent; box-shadow: none; border: 3px solid var(--royal); color: var(--royal); font-weight: 700; padding: 7px 24px; }
.btn--ghost::before { display: none; }
.btn--ghost:hover { background: rgba(0, 8, 195, .07); box-shadow: none; }
.btn--alt { background: var(--purple); color: #fff; --stud-c: var(--purple-d); box-shadow: 0 5px 0 var(--purple-d); }
.btn--alt:hover { box-shadow: 0 7px 0 var(--purple-d); }
.btn.is-busy { pointer-events: none; opacity: .85; }
.btn svg { width: 22px; height: 22px; }
.btn__arrow { transform: scaleX(-1); } /* arrows point to the reading direction in RTL */

/* ===== letters (message step) ===== */
.letters { display: grid; gap: 18px; margin-bottom: 22px; }
.letter {
  position: relative;
  padding: 18px 18px 14px;
  border: 2px solid var(--line-soft);
  border-radius: 12px;
  animation: rise .5s var(--ease) both;
}
.letter__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.letter__head .brick { width: 46px; height: 46px; }
.letter__to { font-weight: 600; font-size: 14px; color: var(--gray); line-height: 1.3; }
.letter__name { font-weight: 900; font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.field {
  width: 100%; min-height: 128px; resize: vertical;
  padding: 14px 16px;
  border: 3px solid var(--royal); border-radius: 10px;
  background: #fff;
  font-size: 17px; line-height: 1.8;
  transition: border-color .2s, box-shadow .2s;
}
.field::placeholder { color: var(--gray); opacity: .7; font-weight: 300; }
.field:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(44, 80, 237, .22); }
.field.is-bad { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(169, 5, 199, .25); }
.letter__foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; min-height: 28px; }
.counter { font-weight: 700; font-size: 13px; padding: 1px 12px; border-radius: 6px; background: rgba(0, 8, 195, .08); transition: background .2s; }
.counter.is-warn { background: var(--cyan); }
.counter.is-max { background: var(--navy); color: #fff; }
.hint { font-size: 14px; font-weight: 600; color: var(--gray); }

/* ===== recap ===== */
.recap { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 14px; }
.recap__item { display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 14px 16px; border: 2px solid var(--line-soft); border-radius: 12px; animation: rise .5s var(--ease) both; }
.recap__item .brick { width: 52px; height: 52px; }
.recap__name { font-weight: 900; font-size: 19px; line-height: 1.4; overflow-wrap: anywhere; }
.recap__meta { display: block; font-weight: 600; font-size: 14px; line-height: 1.4; color: var(--gray); margin-bottom: 4px; }
.counter { direction: ltr; unicode-bidi: isolate; }
.quote {
  margin: 6px 0 0; padding: 4px 14px;
  border-inline-start: 5px solid var(--mint);
  border-radius: 3px;
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-weight: 400; font-size: 16px; line-height: 1.8;
}
.warnbox {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 0 0 22px; padding: 14px 16px;
  border-radius: 8px; background: var(--navy); color: #fff;
  font-weight: 600; font-size: 15px; line-height: 1.7;
}
.warnbox .brick { width: 44px; height: 22px; margin-top: 5px; }
.errorbox { margin: 0 0 18px; padding: 12px 16px; border-radius: 8px; background: var(--cyan); color: var(--navy); font-weight: 700; font-size: 15px; }

/* ===== success / states ===== */
.center { text-align: center; }
.burst { width: 132px; height: 132px; margin: 0 auto 10px; position: relative; animation: pop .8s var(--ease) both; }
.burst > .brick { width: 100%; height: 100%; }
.burst .tick { position: absolute; inset: 27%; display: grid; place-items: center; border-radius: 50%; background: #fff; border: 3px solid var(--navy); }
.burst .tick svg { width: 62%; height: 62%; }
.burst .tick path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .6s ease-out .5s forwards; }
.success-title { margin: 6px 0 4px; font-weight: 900; font-size: clamp(30px, 7vw, 44px); line-height: 1.3; color: var(--royal); }
.success-sub { margin: 0 0 26px; font-weight: 600; font-size: 19px; color: var(--gray); }
.recap--center { text-align: start; }
.state-shape { width: 120px; height: 120px; margin: 0 auto 8px; animation: float 6s ease-in-out infinite; }
.who { margin: 18px 0 0; font-size: 14px; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

.loading { display: flex; gap: 14px; justify-content: center; align-items: center; min-height: 200px; }
.loading .brick { width: 40px; height: 40px; animation: bounce 1s ease-in-out infinite; }
.loading .brick:nth-child(2) { animation-delay: .15s; }
.loading .brick:nth-child(3) { animation-delay: .3s; }

/* ===== footer ===== */
.foot { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 36px 22px 40px; text-align: center; color: var(--fg); font-weight: 400; font-size: 14px; display: grid; gap: 4px; }
.foot a { font-weight: 700; text-underline-offset: 4px; }
.foot--wide { max-width: 1100px; }

/* ===== admin & dev pages: same look as the parents' page, with a text title ===== */
.admin .hero__top { align-items: center; }
.admin .hero__top .chip { animation: none; }
.hero__title--text {
  margin: 18px 0 8px; font-size: clamp(40px, 11vw, 72px); line-height: 1.35; color: #fff;
  text-shadow: 0 5px 0 var(--blue);
  animation: rise .7s var(--ease) both;
}
.hero__title--text .hl { color: var(--mint); text-shadow: 0 5px 0 var(--mint-d); }
.admin .hero__sub { color: var(--cyan); font-size: 17px; }
.admin .hero { padding-bottom: 110px; }
@media (min-width: 820px) { .admin .hero { padding-bottom: 150px; } }
@media (max-width: 819px) { .admin .pile--tl { width: 96px; } .admin .pile--br { width: 84px; } }

/* ===== admin ===== */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; margin: 8px 0 22px; }
@media (min-width: 820px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { --stud-c: var(--royal); padding: 16px 18px; border-radius: 8px; background: var(--royal); color: var(--off); box-shadow: 0 5px 0 rgba(0, 2, 59, .3); }
.stat:nth-child(2) { background: var(--purple); --stud-c: var(--purple); }
.stat:nth-child(3) { background: var(--green); color: var(--navy); --stud-c: var(--green); }
.stat:nth-child(4) { background: var(--cyan); color: var(--navy); --stud-c: var(--cyan); }
.stat__n { font-weight: 900; font-size: 42px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__l { font-weight: 600; font-size: 14px; }
.progress { height: 14px; border-radius: 14px; background: rgba(0, 2, 59, .12); overflow: hidden; margin: 0 0 6px; }
.progress__bar { height: 100%; width: 0; border-radius: 14px; background: var(--green); transition: width 1s var(--ease); }
.card { padding: 20px; border: 2px solid var(--line-soft); border-radius: 12px; margin-bottom: 22px; }
@media (max-width: 520px) { .card { padding: 16px 14px; } }
.card h3 { margin: 0 0 4px; font-weight: 900; font-size: 22px; color: var(--royal); }
.drop {
  display: grid; place-items: center; gap: 6px; text-align: center;
  padding: 26px 16px; margin-top: 12px;
  border: 3px dashed var(--gray-l); border-radius: 12px;
  cursor: pointer; transition: all .2s;
  font-weight: 600;
}
.drop:hover, .drop.is-over { border-color: var(--green); background: rgba(17, 214, 145, .1); }
.drop__icon { width: 46px; height: 46px; }
.preview { margin-top: 16px; padding: 16px; border-radius: 10px; background: rgba(0, 8, 195, .08); }
.preview__nums { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 6px 0 12px; font-weight: 600; }
.preview__nums b { font-weight: 900; font-size: 22px; margin-inline-end: 4px; }
.warnlist { margin: 8px 0 14px; padding-inline-start: 20px; max-height: 180px; overflow: auto; font-size: 14px; color: var(--gray); font-weight: 600; }
.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 14px; }
@media (min-width: 700px) { .form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form > .switch, .form > .actions, .form > #settingsMsg, .form > .fld--wide { grid-column: 1 / -1; } }
.fld { display: grid; gap: 6px; align-content: start; min-width: 0; }
.fld--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .fld--pair.fld--wide { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
.fld__l { font-weight: 700; font-size: 15px; }
.input { width: 100%; min-width: 0; min-height: 48px; padding: 6px 14px; border: 2px solid var(--line-soft); border-radius: 10px; background: var(--off); font-size: 17px; }
/* iOS Safari draws its own date/time boxes wider than the field and centres the value */
.input[type="date"], .input[type="time"], .input[type="datetime-local"] {
  -webkit-appearance: none; appearance: none;
  display: block; max-width: 100%; line-height: 32px; text-align: right;
}
.input::-webkit-date-and-time-value { text-align: right; margin: 0; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 8, 195, .15); }
.input::placeholder { color: var(--gray); opacity: .7; font-weight: 300; }
.switch { display: flex; align-items: center; gap: 12px; font-weight: 600; cursor: pointer; }
.switch input { width: 24px; height: 24px; accent-color: var(--green); flex: none; cursor: pointer; }
.okbox { padding: 12px 16px; border-radius: 8px; background: var(--green); font-weight: 700; font-size: 15px; }
.search { width: 100%; max-width: 340px; min-height: 44px; padding: 6px 16px; border: 2px solid var(--line-soft); border-radius: 10px; background: var(--off); }
.search:focus { outline: none; border-color: var(--blue); }
.tablewrap { overflow-x: auto; border-radius: 10px; border: 2px solid var(--line-soft); margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th { position: sticky; top: 0; background: var(--royal); color: var(--off); font-weight: 700; text-align: start; padding: 10px 14px; white-space: nowrap; }
td { padding: 10px 14px; vertical-align: top; border-top: 1px solid var(--line-soft); }
td.msg { min-width: 260px; max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { padding: 26px; text-align: center; font-weight: 600; color: var(--gray); }
.rowtools { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
tr.grp td { border-top: 2px solid rgba(0, 2, 59, .3); }

/* ===== admin: list editor ===== */
[hidden] { display: none !important; }
a.stat { display: block; text-decoration: none; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
a.stat:hover, a.stat:focus-visible { transform: translateY(-3px); box-shadow: 0 6px 0 rgba(0, 2, 59, .25); }
a.stat:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.stat__go { margin-top: 4px; font-size: 13px; font-weight: 700; opacity: .8; }
.toolbar__end { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.mini {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 4px 14px; border-radius: 6px;
  border: 2px solid var(--navy); background: transparent; color: var(--navy);
  font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.mini:hover { background: rgba(0, 2, 59, .08); }
.mini:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.mini--ok { background: var(--green); border-color: var(--green); }
.mini--ok:hover { background: #0BB27A; }
.mini--danger:hover { background: var(--navy); color: var(--off); }
.mini.is-busy { pointer-events: none; opacity: .6; }
.btn--danger { background: var(--navy); color: #fff; --stud-c: var(--ink); box-shadow: 0 5px 0 var(--ink); }
.btn--danger:hover { box-shadow: 0 7px 0 var(--ink); }

.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 10px; background: rgba(0, 2, 59, .08); }
.seg button { min-height: 36px; padding: 4px 16px; border: 0; border-radius: 7px; background: transparent; color: var(--navy); font-weight: 700; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--royal); color: var(--off); }
.seg button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.fams { display: grid; gap: 14px; }
.fam { padding: 14px 16px; border-radius: 10px; border: 2px solid var(--line-soft); border-inline-start: 6px solid var(--gray-l); }
.fam--reg { border-inline-start-color: var(--green); }
.fam__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.fam__id { flex: none; padding: 2px 12px; border-radius: 6px; background: var(--royal); color: var(--off); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.fam__who { display: grid; flex: 1 1 180px; min-width: 0; }
.fam__name { font-weight: 900; font-size: 17px; }
.fam__mail { font-size: 14px; color: var(--gray); overflow-wrap: anywhere; }
.fam__tools, .krow__tools { display: flex; gap: 8px; margin-inline-start: auto; }
.fam__kids { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.fam__add { margin-top: 6px; }

.krow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; border-radius: 8px; background: rgba(0, 2, 59, .05); }
.krow__name { font-weight: 700; }
.krow__meta { font-size: 14px; color: var(--gray); }
.krow--empty { color: var(--gray); font-weight: 600; font-size: 14px; }
.krow.is-edit { background: rgba(0, 8, 195, .1); }

.editrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.editrow .input { min-height: 40px; font-size: 16px; padding: 4px 12px; flex: 1 1 160px; width: auto; }
.editrow select.input { flex: 0 1 130px; }
.editrow .input--age { flex: 0 1 100px; }
.editrow--emp { flex: 1 1 100%; }
.editrow__btns { display: flex; gap: 8px; }
select.input { appearance: auto; cursor: pointer; }

.pill { display: inline-block; padding: 2px 12px; border-radius: 6px; background: rgba(0, 2, 59, .1); font-weight: 700; font-size: 13px; white-space: nowrap; }
.pill--ok { background: var(--green); }
.pill--warn { background: var(--cyan); }

.empform { display: grid; gap: 12px; margin: 12px 0 6px; padding: 16px; border-radius: 10px; background: rgba(0, 8, 195, .08); }
@media (min-width: 760px) { .empform { grid-template-columns: 1fr 1.4fr 1.6fr; } .empform__btns { grid-column: 1 / -1; } }
.empform__btns { display: flex; flex-wrap: wrap; gap: 12px; }
.addrow { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0; }
.addrow .input { flex: 1 1 200px; width: auto; }
.adminlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.auditlist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; max-height: 560px; overflow-y: auto; overscroll-behavior: contain; }
.arow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 0 12px; padding: 8px 12px; border-radius: 8px; background: rgba(0, 2, 59, .05); border-inline-start: 4px solid var(--line-soft); line-height: 1.6; }
.arow--admin { border-inline-start-color: var(--blue); }
.arow--danger { border-inline-start-color: var(--cyan); }
.arow__who { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.arow__at { font-size: 13px; color: var(--gray); white-space: nowrap; }
.arow__mail { grid-column: 1 / -1; font-size: 13px; color: var(--gray); overflow-wrap: anywhere; text-align: start; }
.arow__what { grid-column: 1 / -1; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.arow__what bdi { color: var(--gray); }
@media (max-width: 520px) { .arow__at { grid-column: 1 / -1; grid-row: 4; } }

.toast {
  position: fixed; inset-inline: 16px; bottom: 20px; z-index: 50;
  max-width: 480px; margin-inline: auto; padding: 12px 18px; border-radius: 10px;
  background: var(--navy); color: var(--off); font-weight: 700; text-align: center;
  box-shadow: 0 10px 30px rgba(0, 2, 59, .3); animation: rise .3s var(--ease);
}
.toast--bad { background: var(--cyan); color: var(--navy); }

.modal { width: min(460px, calc(100vw - 32px)); padding: 22px; border: 0; border-radius: 14px; background: var(--off); color: var(--navy); box-shadow: 0 20px 60px rgba(0, 2, 59, .35); }
.modal::backdrop { background: rgba(0, 2, 59, .55); }
.modal__t { margin: 0 0 6px; font-weight: 900; font-size: 22px; }
.modal__b { margin: 0 0 14px; line-height: 1.7; }
.modal .fld { margin-bottom: 8px; }

@media (max-width: 560px) {
  .fam__tools, .krow__tools { margin-inline-start: 0; }
  .seg { width: 100%; } .seg button { flex: 1; padding-inline: 8px; }
  .search { max-width: none; }
}

/* ===== dev login ===== */
.devbadge { display: inline-block; margin-bottom: 10px; padding: 2px 14px; border-radius: 6px; background: var(--cyan); font-weight: 900; font-size: 13px; }
.userlist { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; max-height: 50vh; overflow: auto; }
.userlist button { width: 100%; text-align: start; padding: 12px 16px; border-radius: 10px; border: 2px solid var(--line-soft); background: var(--off); cursor: pointer; font-weight: 600; }
.userlist button:hover { border-color: var(--green); }
.userlist small { display: block; color: var(--gray); font-weight: 300; }

/* ===== motion ===== */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-14px) rotate(6deg); } }
@keyframes wiggle { 0%, 88%, 100% { transform: rotate(0); } 92% { transform: rotate(-4deg); } 96% { transform: rotate(3deg); } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .burst .tick path { stroke-dashoffset: 0; }
}
