/* Noah University - public site, admin console and student portal */
:root {
  --ink: #12203a;
  --ink-soft: #40506e;
  --muted: #6b7896;
  --line: #dfe4ef;
  --bg: #f6f8fc;
  --card: #ffffff;
  --brand: #123a63;
  --brand-2: #1b5e8f;
  --gold: #c9a227;
  --ok: #16794a;
  --warn: #9a6100;
  --bad: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(18, 32, 58, .06), 0 8px 24px rgba(18, 32, 58, .07);
  --sans: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); }
h2 { font-size: clamp(1.4rem, 2.2vw, 1.95rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }

.wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(760px, 100% - 2.5rem); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.stack > * + * { margin-top: .75rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }

/* ---------- public header ---------- */
.topbar {
  background: var(--brand);
  color: #dce8f5;
  font-size: .82rem;
}
.topbar .wrap { display: flex; gap: 1.25rem; justify-content: space-between; padding: .45rem 0; flex-wrap: wrap; }
.topbar a { color: #fff; }

.masthead { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.masthead .wrap { display: flex; align-items: center; gap: 1rem; padding: .7rem 0; }

.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }
.crest {
  width: 44px; height: 44px; border-radius: 9px; flex: none;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 1.05rem; letter-spacing: .02em;
  border: 2px solid var(--gold);
}
.brand-name { font-weight: 700; font-size: 1.12rem; line-height: 1.15; }
.brand-motto { font-size: .72rem; color: var(--muted); }

.site-nav { margin-left: auto; display: flex; gap: .25rem; align-items: center; flex-wrap: wrap; }
.site-nav a { padding: .45rem .6rem; border-radius: 6px; color: var(--ink); font-size: .92rem; }
.site-nav a:hover { background: var(--bg); text-decoration: none; }
.site-nav a[aria-current="page"] { background: #eaf1f8; color: var(--brand); font-weight: 600; }

.nav-toggle { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.05rem; border-radius: 8px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font: inherit; font-size: .94rem; font-weight: 600;
  cursor: pointer; text-decoration: none; line-height: 1.3;
}
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--brand); border-color: var(--line); }
.btn.ghost:hover { background: #f0f4f9; }
.btn.gold { background: var(--gold); color: #2b2200; }
.btn.gold:hover { background: #b8911f; }
.btn.danger { background: var(--bad); }
.btn.sm { padding: .35rem .65rem; font-size: .84rem; }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(120deg, #0e2f52 0%, #17466f 55%, #1d6490 100%);
  color: #fff; padding: 3.5rem 0 3rem;
}
.hero h1 { color: #fff; max-width: 18ch; }
.hero p.lede { font-size: 1.06rem; color: #d9e6f4; max-width: 60ch; }
.hero .eyebrow {
  text-transform: uppercase; letter-spacing: .14em; font-size: .74rem;
  color: #ffd97a; font-weight: 700; margin-bottom: .6rem;
}
.hero-stats { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 2rem; }
.hero-stats b { display: block; font-size: 1.75rem; }
.hero-stats span { font-size: .82rem; color: #cfe0ef; }

.section { padding: 3rem 0; }
.section.tight { padding: 2rem 0; }
.section-head { max-width: 62ch; margin-bottom: 1.5rem; }
.section-head p { color: var(--muted); margin-bottom: 0; }
.alt { background: #eef2f8; }

/* ---------- cards and grids ---------- */
.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem; box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card h3 { margin-bottom: .35rem; }
.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; border-color: #b9cbe0; }

.stat { text-align: center; }
.stat b { display: block; font-size: 1.9rem; color: var(--brand); }
.stat span { font-size: .82rem; color: var(--muted); }

.tag {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  background: #eaf1f8; color: var(--brand); font-size: .74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.tag.gold { background: #fdf3d8; color: #7a5c05; }
.tag.ok { background: #e2f4ea; color: var(--ok); }
.tag.bad { background: #fbe6e4; color: var(--bad); }
.tag.warn { background: #fdf0dd; color: var(--warn); }
.tag.grey { background: #eef0f4; color: var(--ink-soft); }

/* ---------- forms ---------- */
.field { margin-bottom: .9rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .25rem; color: var(--ink-soft); }
input, select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: .94rem; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #b9d3ec; border-color: var(--brand-2); }
textarea { min-height: 110px; resize: vertical; }
.hint { font-size: .78rem; color: var(--muted); margin-top: .2rem; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
legend { font-size: .84rem; font-weight: 700; padding: 0 .35rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .89rem; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f3f6fb; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfe; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- notices ---------- */
.notice { padding: .7rem .85rem; border-radius: 8px; font-size: .89rem; border: 1px solid; margin-bottom: 1rem; }
.notice.ok { background: #e6f5ec; border-color: #b7e0c8; color: #10583a; }
.notice.bad { background: #fdeceb; border-color: #f3c4c0; color: #8d1e17; }
.notice.info { background: #eaf1f8; border-color: #c6d9ec; color: #1b4a72; }

.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: #fff; }

/* ---------- footer ---------- */
.footer { background: #0e2a48; color: #c6d7e8; margin-top: 3rem; padding: 2.5rem 0 1.5rem; font-size: .88rem; }
.footer h4 { color: #fff; font-size: .95rem; }
.footer a { color: #cfe0ef; }
.footer-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .14); margin-top: 1.75rem; padding-top: 1rem; font-size: .8rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- console (admin + portal) ---------- */
.console { background: #eef1f6; min-height: 100vh; }
.console-head { background: var(--brand); color: #fff; }
.console-head .wrap { display: flex; align-items: center; gap: 1rem; padding: .7rem 0; }
.console-head a { color: #dfeaf6; font-size: .92rem; padding: .35rem .55rem; border-radius: 6px; }
.console-head a:hover, .console-head a[aria-current="page"] { background: rgba(255, 255, 255, .13); color: #fff; text-decoration: none; }
.console-nav { display: flex; gap: .15rem; margin-left: auto; flex-wrap: wrap; align-items: center; }

.shell { display: grid; grid-template-columns: 230px 1fr; gap: 1.25rem; padding: 1.25rem 0 3rem; align-items: start; }
.sidebar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; position: sticky; top: 1rem; }
.sidebar a { display: block; padding: .45rem .6rem; border-radius: 6px; color: var(--ink); font-size: .9rem; }
.sidebar a:hover { background: var(--bg); text-decoration: none; }
.sidebar a[aria-current="page"] { background: #eaf1f8; color: var(--brand); font-weight: 600; }
.sidebar .group { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: .7rem .6rem .25rem; font-weight: 700; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1.1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.panel-head h2, .panel-head h3 { margin: 0; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
  background: linear-gradient(130deg, #0e2f52, #17466f 60%, #1d6490); }
.auth-card { width: min(430px, 100%); background: #fff; border-radius: 14px; padding: 1.6rem; box-shadow: 0 18px 50px rgba(6, 20, 36, .35); }

.modal-back { position: fixed; inset: 0; background: rgba(10, 20, 34, .5); display: grid; place-items: center; padding: 1rem; z-index: 60; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: #fff; border-radius: 12px; padding: 1.25rem; box-shadow: 0 20px 60px rgba(6, 20, 36, .4); }
.modal h3 { margin-top: 0; }

.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 80; display: grid; gap: .5rem; max-width: 340px; }
.toast div { background: #12203a; color: #fff; padding: .65rem .9rem; border-radius: 8px; font-size: .88rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.toast div.bad { background: var(--bad); }
.toast div.ok { background: var(--ok); }

.pager { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; margin-top: .75rem; font-size: .86rem; }

.receipt { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; max-width: 620px; margin-inline: auto; }
.receipt-head { text-align: center; border-bottom: 2px solid var(--ink); padding-bottom: 1rem; margin-bottom: 1rem; }
.receipt-total { font-size: 1.4rem; font-weight: 700; }

.breadcrumb { font-size: .84rem; color: var(--muted); margin-bottom: .75rem; }
.breadcrumb a { color: var(--ink-soft); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .site-nav { display: none; width: 100%; margin-left: 0; }
  .site-nav.open { display: flex; flex-direction: column; align-items: stretch; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .masthead .wrap { flex-wrap: wrap; }
}

@media print {
  .topbar, .masthead, .footer, .no-print, .sidebar, .console-head, .btn { display: none !important; }
  body, .console { background: #fff; }
  .receipt { border: 0; padding: 0; }
}
