/*
 * DirectPay look — the "Clear blue" palette shared with the Student and Employee apps.
 * One font (Public Sans), five sizes (12/14/16/18/24), inputs 16px so phones don't zoom.
 * Design: https://claude.ai/artifact/TRPeL3LgtkuvgAxvWr6ifF
 * A school colour later = change the four --dp-primary* variables only.
 */
:root {
  --dp-primary: #1F5BD8;
  --dp-primary-strong: #13306E;
  --dp-primary-ink: #1748B0;
  --dp-primary-tint: #E8EFFC;
  --dp-on-header-muted: #C9D6F5;

  --dp-canvas: #F3F4F7;
  --dp-surface: #FFFFFF;
  --dp-surface-2: #F8F9FB;
  --dp-ink: #14161C;
  --dp-muted: #4B5262;
  --dp-line: #EEF0F3;
  --dp-card-border: #E3E6EC;
  --dp-input-border: #C4C9D4;
  --dp-focus: #A9C1F2;

  --dp-ok: #0E6B3E;     --dp-ok-bg: #E5F4EC;
  --dp-warn: #8A4D00;   --dp-warn-bg: #FDF1DC;
  --dp-bad: #A3161C;    --dp-bad-bg: #FDECEC;

  --dp-fs-sm: 0.75rem;     /* 12 */
  --dp-fs-body: 0.875rem;  /* 14 */
  --dp-fs-lg: 1rem;        /* 16 */
  --dp-fs-title: 1.125rem; /* 18 */
  --dp-fs-amount: 1.5rem;  /* 24 */
  --dp-fs-input: 1rem;     /* 16: below this iOS zooms into the field */

  --dp-r-input: 10px;
  --dp-r-btn: 12px;
  --dp-r-card: 16px;
  --dp-max: 1040px;
}

/* ---------- base (replaces the Sneat/Bootstrap theme) ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
/* :where() keeps these element defaults at zero specificity so every .dp-* component rule wins. */
:where(.dp) img { max-width: 100%; }
:where(.dp) p { margin: 0 0 12px; }
:where(.dp) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.dp) table { border-collapse: collapse; }
html body.dp {
  margin: 0;
  background: var(--dp-canvas);
  color: var(--dp-ink);
  font-family: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: var(--dp-fs-body);
  line-height: 1.47;
  -webkit-text-size-adjust: 100%;
}
/* plain text links; links styled as components (dp-*) set their own colour */
/* :where() keeps this at (0,1,1): above a library's bare `a` rule, below every component rule (e.g. the
   header's white links — at higher specificity the hover colour equalled the header and the tabs vanished). */
.dp a:where(:not([class*="dp-"])) { color: var(--dp-primary-ink); }
.dp a:where(:not([class*="dp-"])):hover { color: var(--dp-primary-strong); }
:where(.dp) :where(h1, h2, h3) { color: var(--dp-ink); margin: 0; }
.dp :focus-visible { outline: 3px solid var(--dp-focus); outline-offset: 2px; }
.dp-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dp-muted { color: var(--dp-muted); }
.dp-sm { font-size: var(--dp-fs-sm); line-height: 20px; }
.dp-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dp svg.dp-ic { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar ----------
   Phone:  [logo] ........ [student chip] [sign-out icon]
           [ Fees | Books & uniform | Receipts ]
   Laptop: [logo  School] [Fees  Books & uniform  Receipts] ...... [student chip] [Sign out]
   Every piece can shrink (min-width: 0 + ellipsis) so the bar never makes the page wider than the screen. */
.dp-top { background: var(--dp-primary-strong); color: #FFFFFF; }
.dp-top__in { max-width: var(--dp-max); margin: 0 auto; padding: 0 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.dp .dp-top a { color: #FFFFFF; text-decoration: none; }
.dp .dp-top a:hover { color: #FFFFFF; }
.dp-top__brand { display: flex; align-items: center; gap: 10px; min-height: 56px; flex: 1 1 auto; min-width: 0; }
.dp-top__brand img { height: 30px; width: auto; max-width: 120px; object-fit: contain; background: #FFFFFF; border-radius: 6px; padding: 2px 4px; flex-shrink: 0; }
.dp-top__school { display: none; font-size: var(--dp-fs-body); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dp-student { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: min(60%, calc(100% - 172px)); min-height: 40px; padding: 4px 10px 4px 4px; border-radius: 20px; background: rgba(255, 255, 255, 0.10); }
.dp .dp-student:hover { background: rgba(255, 255, 255, 0.18); }
.dp-student__avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--dp-primary-tint); color: var(--dp-primary-ink); display: flex; align-items: center; justify-content: center; font-size: var(--dp-fs-sm); font-weight: 700; flex-shrink: 0; }
.dp-student__name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: var(--dp-fs-body); }
.dp-student__switch { display: flex; align-items: center; padding-left: 8px; border-left: 1px solid rgba(255, 255, 255, 0.25); color: var(--dp-on-header-muted); flex-shrink: 0; }
.dp-student__switch svg.dp-ic { width: 16px; height: 16px; }
.dp .dp-student:hover .dp-student__switch { color: #FFFFFF; }

.dp-top__out { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; font-size: var(--dp-fs-body); flex-shrink: 0; }
.dp-top__out-text { display: none; }

.dp-tabs { order: 9; flex: 1 1 100%; display: flex; min-width: 0; margin: 0 -12px; padding: 0 4px; border-top: 1px solid rgba(255, 255, 255, 0.10); }
.dp .dp-tabs a { flex: 1 1 auto; min-width: 0; white-space: nowrap; min-height: 44px; display: flex; align-items: center; justify-content: center; padding: 0 6px; color: var(--dp-on-header-muted); font-size: var(--dp-fs-body); font-weight: 500; border-bottom: 3px solid transparent; }
.dp .dp-tabs a[aria-current="page"] { color: #FFFFFF; font-weight: 600; border-bottom-color: #FFFFFF; }
.dp .dp-tabs a:hover { color: #FFFFFF; border-bottom-color: rgba(255, 255, 255, 0.5); }
.dp .dp-tabs a[aria-current="page"]:hover { border-bottom-color: #FFFFFF; }

@media (min-width: 720px) {
  .dp-top__in { padding: 0 24px; flex-wrap: nowrap; gap: 0 20px; min-height: 60px; }
  .dp-top__brand { flex: 0 1 auto; min-height: 60px; }
  .dp-top__school { display: block; max-width: 200px; }
  .dp-tabs { order: 0; flex: 1 1 auto; margin: 0; padding: 0; border-top: 0; gap: 4px; }
  .dp .dp-tabs a { flex: 0 0 auto; min-height: 60px; padding: 0 12px; }
  .dp-student { max-width: 220px; }
  .dp-top__out { padding: 0 4px; }
  .dp-top__out-icon { display: none; }
  .dp-top__out-text { display: inline; white-space: nowrap; }
}

/* ---------- page ---------- */
.dp-main { max-width: var(--dp-max); margin: 0 auto; padding: 16px 16px 40px; box-sizing: border-box; }
/* ONE page shape for every screen: a centred 720px column. Title row, then cards. */
.dp-narrow, .dp-page { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.dp-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.dp-pagehead__txt { min-width: 0; }
.dp-pagetitle { font-size: var(--dp-fs-title); line-height: 24px; font-weight: 700; }
.dp-pagesub { margin: 2px 0 0; font-size: var(--dp-fs-body); line-height: 20px; color: var(--dp-muted); }
.dp-pagehead__year .dp-select--sm { min-width: 120px; }
.dp-stack { display: flex; flex-direction: column; gap: 16px; }
.dp-split { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-start; }
.dp-split__side { flex: 1 1 300px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dp-split__main { flex: 999 1 520px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 720px) { .dp-main { padding: 32px 24px 48px; } }

.dp-title { font-size: var(--dp-fs-amount); line-height: 32px; font-weight: 700; }
.dp-h2 { font-size: var(--dp-fs-lg); line-height: 22px; font-weight: 600; }
.dp-lead { font-size: var(--dp-fs-body); line-height: 20px; color: var(--dp-muted); margin: 0; }
.dp-note { font-size: var(--dp-fs-sm); line-height: 20px; color: var(--dp-muted); margin: 0; text-align: center; }

.dp-card { background: var(--dp-surface); border: 1px solid var(--dp-card-border); border-radius: var(--dp-r-card); }
.dp-card--pad { padding: 16px; }
.dp-card__head { padding: 14px 16px 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dp-card__head > span { white-space: nowrap; flex-shrink: 0; }
.dp-card__body { padding: 16px; border-top: 1px solid var(--dp-line); display: flex; flex-direction: column; gap: 16px; }
.dp-card__headsub { display: block; margin-top: 2px; font-size: var(--dp-fs-sm); font-weight: 400; color: var(--dp-muted); }
.dp-card__foot { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--dp-surface-2); border-top: 1px solid var(--dp-card-border); border-radius: 0 0 var(--dp-r-card) var(--dp-r-card); font-weight: 600; }

.dp-total__label { font-size: var(--dp-fs-body); color: var(--dp-muted); }
.dp-total__amount { font-size: var(--dp-fs-amount); line-height: 32px; font-weight: 700; display: block; }

/* list rows */
.dp-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--dp-line); min-height: 56px; box-sizing: border-box; }
.dp-row__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dp-row__name { font-size: var(--dp-fs-body); font-weight: 500; line-height: 20px; }
.dp-row__sub { font-size: var(--dp-fs-sm); line-height: 18px; color: var(--dp-muted); }
.dp-row__amt { font-size: var(--dp-fs-lg); font-weight: 700; }
.dp-row__end { display: flex; align-items: center; gap: 12px; }
.dp .dp-rowlink { color: var(--dp-ink); text-decoration: none; }
.dp .dp-rowlink:hover { background: var(--dp-surface-2); color: var(--dp-ink); }

/* chips */
.dp-chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 14px; font-size: var(--dp-fs-sm); font-weight: 600; white-space: nowrap; }
.dp-chip svg.dp-ic { width: 16px; height: 16px; stroke-width: 2.5; }
.dp-chip--ok { background: var(--dp-ok-bg); color: var(--dp-ok); }
.dp-chip--warn { background: var(--dp-warn-bg); color: var(--dp-warn); }

/* buttons */
.dp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 0; border-radius: var(--dp-r-btn); background: var(--dp-primary); color: #FFFFFF; font: inherit; font-size: var(--dp-fs-lg); font-weight: 600; text-decoration: none; cursor: pointer; box-sizing: border-box; }
.dp a.dp-btn, .dp a.dp-btn:hover { color: #FFFFFF; }
.dp-btn:hover { background: var(--dp-primary-ink); }
.dp-btn--block { display: flex; width: 100%; }
.dp-btn--sm { min-height: 40px; padding: 0 16px; font-size: var(--dp-fs-body); border-radius: var(--dp-r-input); }
.dp-btn--ghost { background: transparent; color: var(--dp-primary-ink); min-height: 44px; font-size: var(--dp-fs-body); font-weight: 500; }
.dp a.dp-btn--ghost, .dp a.dp-btn--ghost:hover, .dp-btn--ghost:hover { background: transparent; color: var(--dp-primary-strong); }
.dp-btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* forms */
.dp-field { display: flex; flex-direction: column; gap: 6px; }
.dp-label { font-size: var(--dp-fs-body); font-weight: 600; color: var(--dp-ink); margin: 0; }
.dp-input, .dp-select, .dp-textarea {
  min-height: 44px; box-sizing: border-box; width: 100%;
  border: 1px solid var(--dp-input-border); border-radius: var(--dp-r-input);
  padding: 0 14px; background: var(--dp-surface); color: var(--dp-ink);
  font: inherit; font-size: var(--dp-fs-input);
}
.dp-textarea { padding: 12px 14px; line-height: 24px; resize: vertical; }
.dp-select { padding-right: 36px; }
.dp-select--sm { min-height: 40px; width: auto; font-size: var(--dp-fs-input); }
.dp-input:focus, .dp-select:focus, .dp-textarea:focus { outline: 3px solid var(--dp-focus); outline-offset: 0; border-color: var(--dp-primary); }
.dp-input[aria-invalid="true"] { border: 2px solid var(--dp-bad); }
.dp-help { font-size: var(--dp-fs-sm); color: var(--dp-muted); }
.dp-err { display: flex; gap: 6px; align-items: center; font-size: var(--dp-fs-sm); font-weight: 500; color: var(--dp-bad); }
.dp-err svg.dp-ic { width: 16px; height: 16px; }
.dp-err:empty { display: none; }
.dp-pass { position: relative; display: flex; }
.dp-pass .dp-input { padding-right: 56px; }
.dp-pass__toggle { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--dp-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.dp-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* radio-card options (pay sheet) */
.dp-opt { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border: 1px solid var(--dp-input-border); border-radius: var(--dp-r-btn); background: var(--dp-surface); font-size: var(--dp-fs-body); cursor: pointer; margin: 0; }
.dp-opt input { width: 20px; height: 20px; accent-color: var(--dp-primary); margin: 0; flex-shrink: 0; }
.dp-opt:has(input:checked) { border: 2px solid var(--dp-primary); background: var(--dp-primary-tint); }
.dp-opt__txt { flex: 1; }

/* alerts */
.dp-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: var(--dp-fs-body); line-height: 22px; }
.dp-alert svg.dp-ic { margin-top: 1px; }
.dp-alert--bad { background: var(--dp-bad-bg); color: var(--dp-bad); }
.dp-alert--ok { background: var(--dp-ok-bg); color: var(--dp-ok); }
.dp-alert--warn { background: var(--dp-warn-bg); color: var(--dp-warn); }
.dp-alert ul { margin: 0; padding-left: 18px; }
.dp-alert .validation-summary-valid { display: none; }

/* status badge (result pages) */
.dp-result { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 24px 0 8px; }
.dp-result__icon { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.dp-result__icon svg.dp-ic { width: 32px; height: 32px; stroke-width: 2.5; }
.dp-result--ok .dp-result__icon { background: var(--dp-ok-bg); color: var(--dp-ok); }
.dp-result--wait .dp-result__icon { background: var(--dp-warn-bg); color: var(--dp-warn); }
.dp-result--bad .dp-result__icon { background: var(--dp-bad-bg); color: var(--dp-bad); }

/* definition list */
.dp-dl { margin: 0; display: grid; grid-template-columns: 104px 1fr; gap: 8px 12px; font-size: var(--dp-fs-body); line-height: 20px; }
.dp-dl dt { color: var(--dp-muted); font-weight: 400; }
.dp-dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* sign-in pages */
.dp-auth { min-height: 100vh; box-sizing: border-box; padding: 32px 16px 24px; display: flex; flex-direction: column; }
.dp-auth__in { width: 100%; max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; flex: 1; }
.dp-auth__brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 28px; text-align: center; }
.dp-auth__brand img { max-height: 52px; max-width: 220px; width: auto; height: auto; object-fit: contain; }
.dp-auth__school { font-size: var(--dp-fs-title); line-height: 24px; font-weight: 700; }
.dp-auth form { display: flex; flex-direction: column; gap: 20px; }
.dp-auth__foot { margin-top: auto; padding-top: 24px; }
.dp-back { color: var(--dp-primary-ink); display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 500; text-decoration: none; align-self: flex-start; }
/* the institution autocomplete (Syncfusion) on sign-in pages */
.dp .e-input-group.e-control-wrapper { min-height: 44px; border-radius: var(--dp-r-input) !important; border: 1px solid var(--dp-input-border) !important; padding: 0 8px; font-size: var(--dp-fs-input); }
.dp .e-input-group.e-control-wrapper::before, .dp .e-input-group.e-control-wrapper::after { display: none; }

/* pay sheet: native <dialog> — a bottom sheet on phones, a centred card on wider screens */
.dp-sheet { border: 0; padding: 8px 16px 24px; border-radius: 20px; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; background: var(--dp-surface); color: var(--dp-ink); box-shadow: 0 16px 48px rgba(20, 22, 28, 0.25); }
.dp-sheet::backdrop { background: rgba(20, 22, 28, 0.55); }
.dp-sheet__body { display: flex; flex-direction: column; gap: 20px; }
.dp-sheet__grip { width: 40px; height: 4px; border-radius: 2px; background: var(--dp-input-border); margin: 0 auto 12px; }
.dp-sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dp-sheet__close { width: 44px; height: 44px; border: 0; background: transparent; color: var(--dp-muted); display: flex; align-items: center; justify-content: center; margin: -6px -10px 0 0; cursor: pointer; flex-shrink: 0; }
.dp-sheet fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dp-sheet legend { font-size: var(--dp-fs-body); font-weight: 600; margin-bottom: 10px; padding: 0; }
@media (max-width: 575.98px) {
  .dp-sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .dp-sheet[open] { animation: dp-sheet-up .22s ease-out; }
}
@media (min-width: 576px) { .dp-sheet { padding: 24px; } .dp-sheet__grip { display: none; } }
@keyframes dp-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.dp-hidden { display: none !important; }

/* hand-off to the gateway */
.dp-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--dp-primary-tint); border-top-color: var(--dp-primary); animation: dp-spin 0.9s linear infinite; flex-shrink: 0; }
@keyframes dp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dp-spinner { animation-duration: 3s; } .dp-sheet[open] { animation: none; } }

/* plain content pages (privacy policy, error) */
.dp-prose { max-width: 760px; margin: 0 auto; font-size: var(--dp-fs-body); line-height: 24px; }
.dp-prose h1, .dp-prose h2 { font-size: var(--dp-fs-title); line-height: 28px; font-weight: 700; margin: 24px 0 8px; }
.dp-prose h3, .dp-prose h4 { font-size: var(--dp-fs-lg); font-weight: 600; margin: 20px 0 6px; }

/* invoice / voucher pages: printable layout, readable on a phone */
.dp .tm_invoice, .dp .tm_invoice table, .dp .tm_invoice p { font-size: var(--dp-fs-sm) !important; }
.dp .tm_invoice .tm_table_responsive { overflow-x: auto; }
.dp .tm_invoice .tm_logo img { max-height: 56px; width: auto; }

/* invoice pages: page wrapper (they use _BlankLayout, no top bar) */
.dp-invoice { max-width: 820px; margin: 0 auto; padding: 16px 16px 40px; }
.dp-invoice .dp-card { overflow: hidden; }

/* "All fees paid" tick on the Fees total card */
.dp-result__icon.dp-total__check { width: 32px; height: 32px; }
.dp-total__check svg.dp-ic { width: 18px; height: 18px; }

/* print (receipt detail "Print or save as PDF"): just the receipt, no header or buttons */
.dp-printonly { display: none; }
@media print {
  .dp-top, .dp-noprint { display: none !important; }
  .dp-printonly { display: flex; }
  .dp-letterhead { align-items: center; gap: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--dp-ink); }
  .dp-letterhead img { max-height: 56px; max-width: 160px; }
  .dp-letterhead > div:nth-child(2) { flex: 1; }
  .dp-letterhead__org { font-size: var(--dp-fs-title); font-weight: 700; }
  .dp-letterhead__line { font-size: var(--dp-fs-sm); color: var(--dp-muted); }
  .dp-letterhead__kind { font-size: var(--dp-fs-body); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
  html body.dp { background: #FFFFFF; }
  .dp-main { padding: 0; max-width: none; }
  .dp-card { border-color: #C4C9D4; break-inside: avoid; }
}

/* Laptop: typing boxes and pickers at body size, so they don't dwarf their labels */
@media (min-width: 720px) {
  :root { --dp-fs-input: var(--dp-fs-body); }
  .dp-input, .dp-select, .dp-textarea { min-height: 40px; }
  .dp-textarea { padding: 10px 12px; line-height: 20px; }
}
