:root {
  --navy-900: #141d47;
  --navy-800: #1c2a63;
  --gold-500: #e8b14a;
  --cream-50: #fffaf3;
  --ink: #1a1f2e;
  --muted: #666b7d;
  --border: #e4e1da;
  --danger: #d64545;
  --success: #1f9d55;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f4f2ec;
  color: var(--ink);
}

a { color: var(--navy-800); }

/* ---- Auth pages (login) ---- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(60% 60% at 80% 10%, rgba(232,177,74,0.15), transparent 60%), var(--navy-900);
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--cream-50);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 25px 60px -20px rgba(0,0,0,0.5);
  text-align: center;
}
.auth-card img { height: 56px; margin: 0 auto 12px; }
.auth-card h1 { font-size: 1.3rem; margin: 0 0 4px; color: var(--navy-900); }
.auth-card p.sub { color: var(--muted); font-size: 0.88rem; margin: 0 0 24px; }
.auth-field { text-align: left; margin-bottom: 16px; }
.auth-field label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; }
.auth-field input {
  width: 100%; padding: 12px 14px; border-radius: 8px;
  border: 1.5px solid var(--border); font-size: 0.95rem; font-family: inherit;
}
.auth-field input:focus { outline: none; border-color: var(--gold-500); }
.auth-submit {
  width: 100%; padding: 13px; border: none; border-radius: 8px;
  background: linear-gradient(135deg, #f0c469, var(--gold-500));
  color: var(--navy-900); font-weight: 700; cursor: pointer; font-size: 0.95rem;
  margin-top: 6px;
}
.auth-error {
  background: rgba(214,69,69,0.1); color: var(--danger);
  padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 16px;
}
.auth-back { display: block; margin-top: 18px; font-size: 0.82rem; color: var(--muted); }

/* ---- Dashboard shell ---- */
.admin-topbar {
  background: var(--navy-900); color: white;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
}
.admin-topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.admin-topbar .brand img { height: 32px; }
.admin-topbar .who { display: flex; align-items: center; gap: 16px; font-size: 0.88rem; }
.admin-topbar a.logout {
  color: var(--gold-500); font-weight: 600; text-decoration: none;
}

.admin-wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: var(--radius); padding: 18px 20px; border: 1px solid var(--border); }
.stat-card .num { font-size: 1.7rem; font-weight: 700; color: var(--navy-900); }
.stat-card .label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-toolbar h1 { font-size: 1.3rem; margin: 0; color: var(--navy-900); }
.search-box { display: flex; gap: 8px; }
.search-box input {
  padding: 10px 14px; border-radius: 8px; border: 1.5px solid var(--border); min-width: 220px; font-family: inherit;
}
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 8px; border: none; cursor: pointer;
  font-weight: 600; font-size: 0.88rem; text-decoration: none;
}
.btn-gold { background: var(--gold-500); color: var(--navy-900); }
.btn-navy { background: var(--navy-900); color: white; }
.btn-outline { background: white; border: 1.5px solid var(--border); color: var(--ink); }
.btn-danger { background: rgba(214,69,69,0.1); color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.table-wrap { background: white; border-radius: var(--radius); border: 1px solid var(--border); overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 12px 16px; font-size: 0.87rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #faf8f3; color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fbf9f4; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.badge-mobile { background: #e7f2ff; color: #1b6fb8; }
.badge-desktop { background: #eef0f8; color: #4a4f74; }
.badge-tablet { background: #f2ecff; color: #7b4fb8; }

.pagination { display: flex; gap: 6px; justify-content: flex-end; margin-top: 16px; }
.pagination a, .pagination span {
  padding: 7px 12px; border-radius: 6px; font-size: 0.82rem; border: 1px solid var(--border); text-decoration: none; color: var(--ink);
}
.pagination .active { background: var(--navy-900); color: white; border-color: var(--navy-900); }

.flash { padding: 12px 16px; border-radius: 8px; font-size: 0.87rem; margin-bottom: 18px; }
.flash-success { background: rgba(31,157,85,0.1); color: var(--success); }
.flash-error { background: rgba(214,69,69,0.1); color: var(--danger); }

.form-card { background: white; border-radius: var(--radius); border: 1px solid var(--border); padding: 24px; max-width: 520px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; }
.form-row input { width: 100%; padding: 10px 14px; border-radius: 8px; border: 1.5px solid var(--border); font-family: inherit; font-size: 0.92rem; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ---- Registrations, fees & invoices ---- */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-tabs a {
  padding: 7px 16px; border-radius: 999px; font-size: 0.82rem; text-decoration: none;
  color: var(--muted); border: 1px solid var(--border); background: white;
}
.filter-tabs a.active { background: var(--navy-900); color: white; border-color: var(--navy-900); }

.badge-joined,  .badge-paid    { background: rgba(31,157,85,0.12); color: var(--success); }
.badge-enquiry, .badge-partial { background: #fff3d6; color: #a9781a; }
.badge-due                     { background: rgba(214,69,69,0.1); color: var(--danger); }

.actions-cell { display: flex; gap: 6px; align-items: center; white-space: nowrap; }

/* Two-column form layout used by the registration & invoice forms. */
.form-card--wide { max-width: 720px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.req { color: var(--danger); }
.hint { font-weight: 400; color: var(--muted); font-size: 0.78rem; }
.muted-note { color: var(--muted); font-size: 0.8rem; margin-top: 12px; }

/* Selects & textareas share the input look (only inputs were styled before). */
.form-row select, .form-row textarea {
  width: 100%; padding: 10px 14px; border-radius: 8px;
  border: 1.5px solid var(--border); font-family: inherit; font-size: 0.92rem; background: white;
}
.form-row textarea { resize: vertical; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--gold-500);
}

/* Fee summary tiles + progress bar (student.php) */
.fee-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 16px; margin-bottom: 24px; }
.fee-summary .stat-card .num.pending { color: var(--danger); }
.fee-summary .stat-card .num.done { color: var(--success); }
.progress { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; margin: 10px 0 2px; }
.progress > span { display: block; height: 100%; background: var(--success); }

.two-col { display: grid; grid-template-columns: 1.35fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.panel { background: white; border-radius: var(--radius); border: 1px solid var(--border); padding: 22px; }
.panel h2 { font-size: 1.02rem; margin: 0 0 16px; color: var(--navy-900); }

/* Invoice line-item editor (invoices.php) */
.line-items { width: 100%; border-collapse: collapse; min-width: 0; margin-bottom: 10px; }
.line-items th, .line-items td { padding: 6px 8px 6px 0; border: none; white-space: normal; }
.line-items input { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1.5px solid var(--border); font-family: inherit; font-size: 0.9rem; }
.line-items .amt { width: 140px; }
.line-items .rm { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 4px 8px; }
.totals-box { max-width: 320px; margin-left: auto; }
.totals-box .row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 0.9rem; }
.totals-box .row.grand { border-top: 1.5px solid var(--border); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 1rem; }
.mono { font-variant-numeric: tabular-nums; }
