/* ═══════════════════════════════════════════════════════════════
   Peacox Child Care — Biweekly Performance Snapshot
   Design tokens
   ═══════════════════════════════════════════════════════════════ */
:root {
  --c-navy:   #1B2559;
  --c-navy2:  #2B3A7E;
  --c-blue:   #2456D6;
  --c-blue2:  #4278EA;
  --c-green:  #188743;
  --c-green2: #2BA55E;
  --c-purple: #5B2E91;
  --c-purple2:#7A46BE;
  --c-orange: #E8710A;
  --c-orange2:#F5921F;
  --c-teal:   #0E8FB5;
  --c-gold:   #F2B70A;
  --c-red:    #D64545;

  --ink:   #1D2540;
  --muted: #5D6785;
  --line:  #E6EAF4;
  --bg:    #F3F5FB;
  --card:  #FFFFFF;

  --shadow: 0 12px 32px rgba(27, 37, 89, 0.10);
  --r: 18px;

  --font-body: 'Nunito', system-ui, 'Segoe UI', sans-serif;
  --font-disp: 'Oswald', 'Arial Narrow', system-ui, sans-serif;
}

@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Soft ambient color wash behind the page */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(560px 340px at 8% -4%,  rgba(36, 86, 214, 0.09), transparent 68%),
    radial-gradient(560px 340px at 96% 4%,  rgba(24, 135, 67, 0.09), transparent 68%),
    radial-gradient(700px 420px at 52% 112%, rgba(91, 46, 145, 0.07), transparent 70%);
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 20px 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  min-width: 0;
}

svg { display: block; }
button svg { width: 16px; height: 16px; }

/* ═══════════════ Top bar ═══════════════ */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  padding: 18px 24px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo-img { height: 58px; width: auto; mix-blend-mode: multiply; }
.brand-name {
  font-family: 'Poppins', var(--font-body);
  font-weight: 300;
  font-size: 23px;
  letter-spacing: 6px;
  color: #45494E;
  line-height: 1.1;
  white-space: nowrap;
}
.brand-name .tm { font-size: 9px; letter-spacing: 1px; color: #8A8F98; margin-left: 1px; }
.brand-sub {
  font-family: 'Poppins', var(--font-body);
  font-weight: 300;
  font-size: 9.5px;
  letter-spacing: 5.5px;
  color: #9AA0A8;
  margin-top: 3px;
}

.masthead { text-align: center; min-width: 0; }
.masthead h1 {
  margin: 0;
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: clamp(24px, 3.2vw, 38px);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--c-navy);
}
.tagline {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--c-purple);
}
.tagline .star { color: var(--c-gold); font-size: 13px; }
.period { margin-top: 5px; font-size: 13px; font-weight: 700; color: var(--muted); }

.controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  background: #EEF1F8;
  color: var(--muted);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #A6AFC6; flex: none; }
.chip.live  { background: #E7F6EC; color: #14672F; }
.chip.live .dot { background: #22A24F; animation: pulse 2s ease infinite; }
.chip.demo  { background: #FFF3D1; color: #8A6100; }
.chip.demo .dot { background: var(--c-gold); }
.chip.error { background: #FDECEC; color: #A33A3A; }
.chip.error .dot { background: var(--c-red); }
.chip.loading .dot { background: #A6AFC6; animation: pulse 1s ease infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 162, 79, 0.45); }
  55%      { box-shadow: 0 0 0 6px rgba(34, 162, 79, 0); }
}

/* Segmented location switcher */
.seg {
  display: inline-flex;
  background: #EEF1F8;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}
.seg button {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font: 800 12px var(--font-body);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.seg button:hover { color: var(--ink); }
.seg button.active {
  background: var(--c-navy);
  color: #fff;
  box-shadow: 0 2px 6px rgba(27, 37, 89, 0.25);
}

.picker-wrap { display: flex; align-items: center; gap: 8px; }
.picker-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.picker {
  font: 700 13px var(--font-body);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  max-width: 240px;
  cursor: pointer;
}

.btnrow { display: flex; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--c-navy);
  color: #fff;
  border-radius: 11px;
  padding: 8px 14px;
  font: 800 13px var(--font-body);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  box-shadow: 0 2px 6px rgba(27, 37, 89, 0.18);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(27, 37, 89, 0.24); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(27, 37, 89, 0.08); }
.btn.busy svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.updated { font-size: 11px; font-weight: 700; color: var(--muted); }

/* ═══════════════ Notice bars ═══════════════ */
.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
}
.notice svg { width: 17px; height: 17px; flex: none; }
.notice.archive { background: #FFF6DE; border: 1px solid #F1DFA8; color: #7A5B00; }
.notice.error   { background: #FDECEC; border: 1px solid #F1C8C8; color: #96302E; }
.notice .link-btn {
  margin-left: auto;
  border: none;
  background: none;
  font: 800 13px var(--font-body);
  color: var(--c-blue);
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
}
.hidden { display: none !important; }

/* ═══════════════ Layout grids ═══════════════ */
main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.grid { display: grid; gap: 20px; min-width: 0; }
.main-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.duo-grid  { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }

/* ═══════════════ Panels & section banners ═══════════════ */
.panel { padding: 14px 14px 20px; display: flex; flex-direction: column; }

.pbanner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 18px 9px 9px;
  border-radius: 999px;
  color: #fff;
  margin-bottom: 16px;
}
.pbanner h2 {
  margin: 0;
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  line-height: 1.1;
}
.pbanner .pmeta {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  background: rgba(255, 255, 255, 0.18);
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.picon {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.38);
  display: grid;
  place-items: center;
}
.picon svg { width: 22px; height: 22px; }

.pbanner.blue   { background: linear-gradient(100deg, #1D46BC, var(--c-blue2)); }
.pbanner.green  { background: linear-gradient(100deg, #107036, var(--c-green2)); }
.pbanner.purple { background: linear-gradient(100deg, #4A2377, var(--c-purple2)); }
.pbanner.navy   { background: linear-gradient(100deg, var(--c-navy), var(--c-navy2)); }
.pbanner.gold   { background: linear-gradient(100deg, #DA9E04, #F2C339); }

.panel-body { padding: 0 10px; display: flex; flex-direction: column; gap: 14px; flex: 1; min-width: 0; }

.empty-note {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  padding: 26px 10px;
  border: 2px dashed var(--line);
  border-radius: 14px;
}

/* ═══════════════ Attendance panel ═══════════════ */
.att-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: center;
}

.att-table { width: 100%; border-collapse: collapse; }
.att-table td {
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.att-table tr:last-child td { border-bottom: none; }
.wk-cell { display: flex; align-items: center; gap: 10px; }
.wk-ic {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: color-mix(in srgb, var(--wc) 13%, white);
  color: var(--wc);
  display: grid;
  place-items: center;
}
.wk-ic svg { width: 17px; height: 17px; }
.wk-label { font-weight: 800; font-size: 13.5px; }
.wk-val { text-align: right; white-space: nowrap; }
.wk-val .big {
  display: block;
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.1;
  color: var(--wc);
}
.wk-val .sub { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }

.chart-box { position: relative; height: 250px; min-width: 0; }
.chart-box.tall { height: 280px; }
.chart-title {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}

/* Trend callout */
.callout {
  display: flex;
  align-items: center;
  gap: 13px;
  background: #EDF3FF;
  border: 1px solid #D5E2FB;
  border-radius: 14px;
  padding: 12px 16px;
}
.callout .cicon {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  background: var(--c-blue);
  color: #fff;
  display: grid;
  place-items: center;
}
.callout .cicon svg { width: 20px; height: 20px; }
.callout .ct b {
  display: block;
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--c-blue);
}
.callout .ct span { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.callout.up   .cicon { background: var(--c-green); }
.callout.up   .ct b  { color: var(--c-green); }
.callout.up   { background: #EBF7EF; border-color: #CBE8D5; }
.callout.down .cicon { background: var(--c-red); }
.callout.down .ct b  { color: var(--c-red); }
.callout.down { background: #FDF0F0; border-color: #F2D4D4; }
.callout.green { background: #EBF7EF; border-color: #CBE8D5; }
.callout.green .cicon { background: var(--c-green); }
.callout.green .ct b { color: var(--c-green); }

/* ═══════════════ Finance panel ═══════════════ */
.fin-total {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(100deg, #107036, var(--c-green2));
  color: #fff;
  border-radius: 14px;
  padding: 13px 18px;
}
.fin-total .fin-big {
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: 30px;
  line-height: 1;
}
.fin-total .fin-cap {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  opacity: 0.9;
}
.fin-total svg { width: 30px; height: 30px; margin-left: auto; opacity: 0.85; }

.fin-list { display: flex; flex-direction: column; }
.fin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px dashed var(--line);
}
.fin-row:last-child { border-bottom: none; }
.fin-ic {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--c-green) 13%, white);
  color: var(--c-green);
  display: grid;
  place-items: center;
}
.fin-ic svg { width: 19px; height: 19px; }
.fin-name { font-weight: 800; font-size: 14px; line-height: 1.2; }
.fin-name .fin-ch { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.fin-amt {
  margin-left: auto;
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: 20px;
  color: var(--ink);
  white-space: nowrap;
}

/* ═══════════════ Quality & compliance panel ═══════════════ */
.qc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}
.qc-card {
  text-align: center;
  padding: 16px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #FDFDFF, #F7F9FE);
}
.ring-wrap { position: relative; width: 112px; margin: 0 auto 10px; }
.ring {
  width: 112px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #E8ECF6 0);
  -webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 13px), #000 calc(100% - 12.5px));
          mask: radial-gradient(farthest-side, #0000 calc(100% - 13px), #000 calc(100% - 12.5px));
  transition: --p 1.1s ease-out;
}
.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: 23px;
  color: var(--ink);
}
.qc-card h3 {
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  line-height: 1.35;
  color: var(--ink);
}
.qc-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.qc-card li::before { content: '•'; color: var(--c); font-size: 13px; margin-right: 5px; }
.qc-card li { text-align: center; }

/* ═══════════════ Takeaway & improvements ═══════════════ */
.gold-card { background: linear-gradient(180deg, #FFFAEB, #FFF4D4); border-color: #F1DFA8; }
.tk-body { display: flex; gap: 16px; align-items: flex-start; padding: 2px 10px 0; }
.tk-star {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 50%;
  background: var(--c-gold);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(218, 158, 4, 0.35);
}
.tk-star svg { width: 26px; height: 26px; }
.tk-text h3 {
  margin: 0 0 6px;
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #8A6100;
}
.tk-text p { margin: 0; font-weight: 700; font-size: 14.5px; line-height: 1.65; color: #4C3A05; }

.imp-list { display: flex; flex-direction: column; padding: 0 6px; }
.imp-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 4px;
  border-bottom: 1px dashed var(--line);
  font-weight: 800;
  font-size: 14px;
}
.imp-row:last-child { border-bottom: none; }
.imp-ic {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--c-navy) 10%, white);
  color: var(--c-navy);
  display: grid;
  place-items: center;
}
.imp-ic svg { width: 19px; height: 19px; }

/* ═══════════════ Trends section ═══════════════ */
.tchips { display: flex; flex-wrap: wrap; gap: 12px; }
.tchip {
  display: flex;
  align-items: center;
  gap: 11px;
  background: #F2F5FC;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 16px;
  min-width: 0;
}
.tchip .tv {
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: 21px;
  line-height: 1;
  white-space: nowrap;
}
.tchip .tl { font-size: 11.5px; font-weight: 800; color: var(--muted); line-height: 1.3; }
.tchip svg { width: 20px; height: 20px; flex: none; }
.tchip.good { background: #EBF7EF; border-color: #CBE8D5; }
.tchip.good .tv, .tchip.good svg { color: #14672F; }
.tchip.bad  { background: #FDF0F0; border-color: #F2D4D4; }
.tchip.bad .tv, .tchip.bad svg { color: #A33A3A; }
.tchip.neutral .tv, .tchip.neutral svg { color: var(--c-navy); }

.tr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tr-cell {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 14px 10px;
  background: linear-gradient(180deg, #FDFDFF, #F8FAFE);
  min-width: 0;
}
.tr-wide { grid-column: 1 / -1; }

.mini-table-wrap { overflow-x: auto; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
.mini-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  white-space: nowrap;
}
.mini-table td.num { font-family: var(--font-disp); font-weight: 500; font-size: 14.5px; }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table .tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #EDF3FF;
  color: var(--c-blue);
  text-transform: uppercase;
}

/* ═══════════════ Footer & loader ═══════════════ */
.foot {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 0 12px;
}
.foot a { color: var(--c-blue); }

.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: opacity 0.4s ease;
}
.loader-logo { width: 180px; height: auto; mix-blend-mode: multiply; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.loader p { font-weight: 800; color: var(--muted); letter-spacing: 0.5px; }
.loader.off { opacity: 0; pointer-events: none; }

/* ═══════════════ Responsive ═══════════════ */
@media (max-width: 1080px) {
  .main-grid, .duo-grid, .tr-grid { grid-template-columns: 1fr; }
  .tr-wide { grid-column: auto; }
  .topbar { grid-template-columns: 1fr; text-align: center; }
  .brand { justify-content: center; }
  .controls { align-items: center; }
}
@media (max-width: 620px) {
  .page { padding: 12px 10px 22px; }
  .att-grid { grid-template-columns: 1fr; }
  .panel-body { padding: 0 4px; }
  .pbanner h2 { font-size: 16px; }
  .pbanner .pmeta { display: none; }
  .masthead h1 { font-size: 24px; }
  .chart-box, .chart-box.tall { height: 220px; }
}

/* ═══════════════ Print (turns the live page into the PDF report) ═══════════════ */
@media print {
  body { background: #fff; font-size: 12px; }
  body::before { display: none; }
  .page { max-width: none; padding: 0; gap: 12px; }
  .card { box-shadow: none; border: 1px solid #D8DDEA; break-inside: avoid; }
  .controls, .btnrow, .notice.error, .loader { display: none !important; }
  .topbar { grid-template-columns: auto 1fr; }
  #trendsPanel { break-before: page; }
  .chart-box, .chart-box.tall { height: 220px; }
}
