/* Payment + admin pages. Builds on register.css tokens. */
:root {
  --green: #16734a; --green-bg: #e8f7ef;
  --amber: #8b5a00; --amber-bg: #fff3d8;
  --grey: #596579; --grey-bg: #edf0f4;
}

.inner-main { padding: 28px 0 64px; }

/* ---------- Page head ---------- */
.pagehead {
  color: #fff; border-bottom: 4px solid var(--gold);
  background: radial-gradient(ellipse 50% 120% at 90% 0, rgba(179, 18, 31, .5), transparent 60%),
              linear-gradient(160deg, var(--navy), var(--navy-2));
}
.pagehead .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 28px 0 32px; }
.pagehead .eyebrow { margin-bottom: 6px; }
.pagehead h1 { margin: 0 0 4px; font-family: var(--font-display); font-size: clamp(24px, 3.4vw, 34px); line-height: 1.3; }
.pagehead p { margin: 0; color: #d7dde8; }
.btn-ghost-light { white-space: nowrap; min-height: 42px; padding: 8px 18px; color: #fff; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .3); font-size: 14px; }
.btn-ghost-light:hover { background: rgba(255, 255, 255, .2); }

/* ---------- Shared bits ---------- */
.toast-area { display: grid; gap: 10px; margin-bottom: 18px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; font-style: normal; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.none { color: var(--grey); background: var(--grey-bg); }
.pill.pending, .pill.partial { color: var(--amber); background: var(--amber-bg); }
.pill.paid, .pill.done { color: var(--green); background: var(--green-bg); }

.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 14px; border-radius: 9px; }
.btn-soft { color: var(--navy); background: #edeff3; }
.btn-soft:hover { background: #e1e5ec; }
.btn-green { color: #fff; background: var(--green); }
.btn-green:hover { background: #0f5c3a; }
.btn-outline-red { color: var(--red-dark); background: #fff; border: 1.5px solid #e9c3c7; }
.btn-outline-red:hover { background: var(--danger-bg); }

.bar { height: 8px; overflow: hidden; border-radius: 99px; background: #ebe6db; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), #c8922a); }
.bar.full > i { background: linear-gradient(90deg, #2bb673, var(--green)); }

.avatar {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--navy); color: var(--gold); font-family: var(--font-display); font-weight: 600;
}
.empty { padding: 28px 18px; text-align: center; color: var(--muted); border: 1.5px dashed #d6cfc0; border-radius: 12px; background: #fcfbf8; }
.empty b { display: block; margin-bottom: 4px; color: var(--ink); }

/* ---------- Payment ---------- */
.pay-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
.pay-layout > * { min-width: 0; }
.panel-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.panel-title .badge { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--navy); color: var(--gold); font-size: 13px; }

.search-box { position: relative; margin-bottom: 12px; }
.search-box input { padding-left: 42px; }
.search-box::before { content: "🔍"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .6; pointer-events: none; }

.student-list { display: grid; gap: 8px; max-height: 560px; overflow-y: auto; margin: 0 -6px; padding: 2px 6px; }
.student {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s, background .15s;
}
.student:hover { border-color: #cdbf9f; }
.student.selected { border-color: var(--red); background: #fff8f8; box-shadow: 0 0 0 3px rgba(179, 18, 31, .08); }
.student .who { flex: 1; min-width: 0; line-height: 1.35; }
.student b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.student small { color: var(--muted); font-size: 12.5px; }
.student .bar { margin-top: 6px; height: 5px; }
.student .pill { padding: 3px 9px; font-size: 11.5px; }
.no-match { display: none; }

.who-card { display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 18px; border-radius: 14px; background: #faf7ef; border: 1px solid var(--line); }
.who-card .avatar { width: 52px; height: 52px; font-size: 20px; }
.who-card .info { flex: 1; min-width: 0; }
.who-card h3 { margin: 0; font-family: var(--font-display); font-size: 19px; }
.who-card p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.who-card .sum { display: flex; justify-content: space-between; margin-top: 6px; font-size: 13px; color: var(--muted); }
.who-card .sum b { color: var(--ink); }
.switch-link { display: none; margin-bottom: 12px; font-size: 14px; color: var(--red-dark); font-weight: 600; }

.bank {
  display: flex; align-items: center; gap: 16px; padding: 16px; margin-bottom: 22px;
  border-radius: 14px; color: #fff; background: linear-gradient(135deg, #0e6b3a, #0a4f2c);
}
.bank img { width: 64px; height: 64px; flex: none; object-fit: cover; border-radius: 12px; background: #fff; }
.bank .txt { flex: 1; min-width: 0; font-size: 13px; line-height: 1.5; }
.bank .lbl { color: #bfe8d0; }
.bank .acc { display: block; margin: 0 0 2px; font-family: var(--font-display); font-size: 26px; letter-spacing: .03em; font-weight: 600; }
.copy-btn { flex: none; padding: 8px 14px; border: 1px solid rgba(255, 255, 255, .45); border-radius: 9px; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; font-size: 13px; cursor: pointer; }
.copy-btn:hover { background: rgba(255, 255, 255, .25); }

.terms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 20px; padding: 0; border: 0; }
.term { position: relative; display: block; cursor: pointer; }
.term input { position: absolute; opacity: 0; inset: 0; min-height: 0; width: 100%; height: 100%; cursor: pointer; }
.term .body {
  display: block; height: 100%; padding: 14px 16px; border: 1.5px solid #ddd6c8; border-radius: 12px; background: #fcfbf8; transition: border-color .15s, background .15s, box-shadow .15s;
}
.term:hover .body { border-color: #c4bba8; }
.term input:checked + .body { border-color: var(--red); background: #fff8f8; box-shadow: 0 0 0 3px rgba(179, 18, 31, .1); }
.term input:focus-visible + .body { outline: 3px solid var(--gold); outline-offset: 2px; }
.term input:disabled { cursor: not-allowed; }
.term input:disabled + .body { opacity: .65; background: #f3f1ec; }
.term .t-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.term .t-top b { font-weight: 600; }
.term .t-amt { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--red-dark); }
.term small { display: block; color: var(--muted); font-size: 12px; }
.term.wide { grid-column: 1 / -1; }
.term .pill { padding: 2px 9px; font-size: 11.5px; }

.drop {
  position: relative; display: grid; place-items: center; gap: 4px; padding: 28px 16px; margin-bottom: 18px; text-align: center; cursor: pointer;
  border: 2px dashed #cdbf9f; border-radius: 14px; background: #fcfbf8; transition: background .15s, border-color .15s;
}
.drop:hover, .drop.over { background: var(--gold-soft); border-color: var(--gold); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.drop .ico { font-size: 30px; }
.drop b { font-weight: 600; }
.drop small { color: var(--muted); }
.drop img { max-height: 220px; max-width: 100%; border-radius: 10px; box-shadow: var(--shadow); }
.drop .fname { font-size: 13px; color: var(--ink); word-break: break-all; }
.drop .ferr { color: var(--red-dark); font-weight: 600; font-size: 13px; }
.how { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; color: var(--muted); counter-reset: s; }
.how li { counter-increment: s; display: flex; gap: 10px; align-items: baseline; }
.how li::before { content: counter(s); flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--gold-soft); color: var(--red-dark); font-size: 12px; font-weight: 700; }

/* ---------- Admin ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { padding: 18px 20px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin: 2px 0; font-family: var(--font-display); font-size: 28px; line-height: 1.25; }
.stat small { color: var(--muted); font-size: 12px; }
.stat.alert-stat { background: var(--amber-bg); border-color: #efd699; }
.stat.alert-stat strong { color: var(--amber); }
.stat .bar { margin-top: 8px; height: 6px; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; padding: 5px; background: #ebe6db; border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 8px; padding: 9px 18px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.tab .count { min-width: 22px; padding: 0 7px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; line-height: 20px; }
.tab .count.zero { background: #cfc8b8; }
[role="tabpanel"][hidden] { display: none; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .search-box { flex: 1 1 260px; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 7px 14px; border: 1.5px solid #ddd6c8; border-radius: 99px; background: #fff; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: #c4bba8; }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 12px 16px; text-align: left; color: var(--muted); font-size: 12.5px; font-weight: 600; background: #faf7ef; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid #f0ebe0; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffdf8; }
td .nm { display: flex; align-items: center; gap: 12px; min-width: 200px; }
td .nm b { display: block; font-weight: 600; line-height: 1.3; }
td .nm small { color: var(--muted); }
td.num { white-space: nowrap; }
.mini-prog { min-width: 130px; }
.mini-prog small { display: flex; justify-content: space-between; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.mini-prog .bar { height: 6px; }
.row-actions { text-align: right; white-space: nowrap; }
.tr-hide { display: none; }
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: #d9d3c5; }
.dots i.pending { background: #e6a817; }
.dots i.paid { background: #2bb673; }

.queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.slip-card { display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.slip-thumb { display: grid; place-items: center; height: 200px; background: #f1eee6 center / cover no-repeat; color: var(--muted); font-size: 14px; }
a.slip-thumb:hover { filter: brightness(.95); }
.slip-body { display: grid; gap: 10px; padding: 16px; flex: 1; }
.slip-body h3 { margin: 0; font-size: 16px; font-weight: 600; }
.slip-body .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--muted); font-size: 13px; }
.slip-body .meta strong { font-family: var(--font-display); font-size: 20px; color: var(--red-dark); }
.slip-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: auto; }
.slip-actions form { display: contents; }
.slip-actions .btn { width: 100%; }

.settings-form { max-width: 720px; }
.settings-form .grid { margin-bottom: 20px; }

/* Edit dialog */
dialog.modal { width: min(760px, calc(100% - 24px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 18px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(8, 20, 40, .45); }
dialog.modal::backdrop { background: rgba(8, 20, 40, .55); backdrop-filter: blur(2px); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; background: var(--navy); color: #fff; }
.modal-head h3 { margin: 0; font-family: var(--font-display); font-size: 18px; }
.modal-head p { margin: 0; color: #c9d3e3; font-size: 13px; }
.x { width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.x:hover { background: rgba(255, 255, 255, .25); }
.modal-body { display: grid; gap: 20px; padding: 22px; }
.modal-body section { padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.modal-body h4 { margin: 0 0 14px; font-family: var(--font-display); font-size: 15px; }
.modal-body .grid { gap: 14px 12px; }
.modal-body input, .modal-body select, .modal-body textarea { min-height: 44px; }
.modal-body textarea { min-height: 80px; }
.review { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.review:last-child { border-bottom: 0; padding-bottom: 0; }
.review .rt { flex: 1 1 140px; line-height: 1.35; }
.review .rt b { display: block; font-weight: 600; }
.review .rt small { color: var(--muted); }
.review form { margin: 0; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.danger-zone p { margin: 0; color: var(--muted); font-size: 13px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 16px; }

/* Login */
.login { width: min(440px, 100%); margin: 24px auto; padding: 32px; text-align: center; }
.login img { width: min(260px, 100%); margin-bottom: 14px; }
.login h2 { margin: 0 0 6px; font-family: var(--font-display); }
.login p { color: var(--muted); }
.login form { display: grid; gap: 14px; text-align: left; margin-top: 18px; }
.login .btn { width: 100%; }

@media (max-width: 980px) {
  .pay-layout { grid-template-columns: 1fr; }
  .pay-layout.has-selected .student-col { order: 2; }
  .pay-layout.has-selected .switch-link { display: inline-block; }
  .student-list { max-height: 420px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .pagehead .wrap { padding: 22px 0 26px; }
  .terms { grid-template-columns: 1fr; }
  .bank { flex-wrap: wrap; }
  .bank .acc { font-size: 22px; }
  .copy-btn { width: 100%; }
  .stat { padding: 14px 16px; }
  .stat strong { font-size: 22px; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; padding: 9px 10px; }
  .queue { grid-template-columns: 1fr; }
  .login { padding: 22px 16px; }
  .modal-body { padding: 14px; }
  .modal-body section { padding: 14px; }
  /* Roster table becomes stacked cards */
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { margin-bottom: 10px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
  td { padding: 4px 0; border: 0; }
  td.hide-sm { display: none; }
  .row-actions { text-align: left; padding-top: 10px; }
  .row-actions .btn { width: 100%; }
  .mini-prog { margin-top: 6px; }
}

/* ---------- Payment: single column + lookup ---------- */
.pay-single { max-width: 760px; margin: 0 auto; }
.lookup-note { margin: -4px 0 18px; color: var(--muted); font-size: 14px; }
.lookup-form { display: grid; gap: 16px; }
.lookup-form .btn { width: 100%; }
.lookup-foot { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 14px; }
.lookup-foot a { color: var(--red-dark); font-weight: 600; }
