/* RETAIN-PH — shared tokens & components (colours come from each school's theme; defaults are ASCOT green & gold) */
:root {
  --brand: #2e8a57;
  --brand-600: #23744a;
  --brand-700: #0c4224;
  --brand-50: #eef7f1;
  --brand-100: #cfe9d9;
  --accent: #ffdd21;
  --gold: #ffdd21;
  --gold-soft: #feee8c;
  --gold-ink: #5c4a00;
  --deep: #074422;
  --deep-2: #052e17;
  --brand-light: #3cb371;
  --gold-600: #f2cf00;
  --on-deep: #a9cdb6;
  --brand-rgb: 46, 138, 87;
  --deep-rgb: 7, 68, 34;
  --gold-rgb: 255, 221, 33;
  --orange: #f58c0b;
  --navy: #070553;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #f1f5f9;
  --bg: #f4f7f4;
  --card: #ffffff;
  --green: #15803d; --green-bg: #dcfce7;
  --amber: #b45309; --amber-bg: #fff1d6;
  --red: #b91c1c;   --red-bg: #fee2e2;
  --blue: #070553;  --blue-bg: #e3e3f6;
  --gray: #475569;  --gray-bg: #e2e8f0;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .16);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: 0 0 1em; }
img, svg { vertical-align: middle; }
.ic { flex: none; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* utilities */
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.xs { font-size: .76rem; }
.strong { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.green { color: var(--green); } .red { color: var(--red); } .amber { color: var(--amber); }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.top { align-items: flex-start; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--brand); color: #fff; font: 600 14px/1.2 var(--font); cursor: pointer;
  text-decoration: none !important; transition: background .15s, box-shadow .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--brand-700); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--brand-100); outline-offset: 1px; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn-outline { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn-outline:hover { background: var(--line-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-danger { background: #dc2626; } .btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; } .btn-success:hover { background: #15803d; }
.btn-amber { background: #f59e0b; color: #1f1300; } .btn-amber:hover { background: #d97706; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 20px; font-size: 16px; border-radius: 12px; }
.btn-block { display: flex; width: 100%; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line); background: #fbfcfd; border-radius: 0 0 var(--radius) var(--radius); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-gray { background: var(--gray-bg); color: var(--gray); }
.pill { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; }

/* forms */
.field { margin-bottom: 14px; }
.field > label, .label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 5px; }
input:not([type]), input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=tel], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: var(--radius-sm); background: #fff; color: var(--ink);
  font: 15px/1.4 var(--font); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 3px rgba(var(--brand-rgb),  .2); }
input[readonly] { background: var(--line-2); }
textarea { min-height: 84px; resize: vertical; }
.input-group { display: flex; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid #cbd5e1; border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--line-2); color: var(--muted); font-weight: 600; }
.input-group input { flex: 1; min-width: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.form-error { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--red-bg); color: var(--red); font-size: 14px; margin-bottom: 14px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 18px 0 10px; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfcfd; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcff; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: #fbfcfd; }
.table .num, .table th.num { text-align: right; }
.table tr.is-overdue td { background: #fff7f7; }
.table tr.is-paid td { color: var(--muted); }
.table a.rowlink { color: inherit; font-weight: 600; }

/* flash + toast */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.flash-ok { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.flash-error { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.flash-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.flash .grow { padding-top: 1px; }
.flash-close { margin-left: auto; background: none; border: 0; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.toasts { position: fixed; z-index: 1000; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--deep); color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .25s ease-out; cursor: pointer; }
.toast .ic { color: var(--gold); margin-top: 1px; }
.toast small { display: block; color: #cbd5e1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* modal (confirm) */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 1100; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; width: min(440px, 100%); box-shadow: var(--shadow-lg); padding: 22px; }
.modal h3 { margin-bottom: 6px; }
.modal .row { margin-top: 18px; }
@keyframes fade { from { opacity: 0; } }

/* misc components */
.progress { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-light)); border-radius: 999px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .ic { color: #cbd5e1; margin-bottom: 8px; }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); font-weight: 700; font-size: 13px; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--brand-100); border: 3px solid var(--brand-600); }
.timeline .dot.red { background: var(--red-bg); border-color: #ef4444; }
.timeline .dot.gray { background: var(--line-2); border-color: #94a3b8; }
.timeline .dot.green { background: var(--green-bg); border-color: #22c55e; }
.timeline .t-title { font-weight: 600; font-size: 14px; }
.timeline .t-meta { font-size: 12px; color: var(--muted); }
.demo-banner { background: var(--deep); color: #e6f2ea; font-size: 12.5px; text-align: center; padding: 7px 12px; }
.demo-banner b { color: #fde68a; }
.demo-banner a { color: var(--gold-soft); }
.kbd { display: inline-block; padding: 1px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; font: 600 12px ui-monospace, monospace; background: #fff; color: var(--ink-2); }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-700); font-size: 14px; }
.callout.amber { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.callout.red { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }

@media print {
  .no-print, .sidebar, .topbar, .demo-banner, .toasts, .bottom-nav { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
.badge-gold { background: var(--gold-soft); color: var(--gold-ink); }
.btn-gold { background: var(--gold); color: var(--deep); }
.btn-gold:hover { background: var(--gold-600); }
