/* SCOBA 7681 — design tokens taken from the school crest.
   Crimson #AB272A, gold #F3C205, motto Humilitas.
   Light is the default; every token is redefined for dark. */

:root {
  --brand: #AB272A;
  --brand-deep: #7E1B1E;
  --brand-soft: #F6E7E5;
  --gold: #F3C205;
  --gold-deep: #B98F00;
  --gold-soft: #FDF3D2;

  --bg: #FAF7F3;
  --bg-tint: #F3EDE6;
  --surface: #FFFFFF;
  --surface-2: #F7F3EE;
  --surface-3: #EFE8E0;
  --border: #E2D9CF;
  --border-strong: #CFC2B4;

  --text: #1E1A18;
  --text-soft: #554B45;
  --muted: #857A72;
  --on-brand: #FFF6EC;
  --on-gold: #3A2A00;

  --ok: #1F7A46;
  --ok-soft: #E4F3EA;
  --warn: #9A6206;
  --warn-soft: #FBF0DA;
  --bad: #A62828;
  --bad-soft: #F9E6E6;

  --ring: color-mix(in srgb, var(--brand) 45%, transparent);
  --shadow-sm: 0 1px 2px rgba(30, 20, 16, .06), 0 1px 3px rgba(30, 20, 16, .04);
  --shadow: 0 2px 4px rgba(30, 20, 16, .05), 0 8px 24px rgba(30, 20, 16, .07);
  --radius: 12px;
  --radius-sm: 8px;
  --serif: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --maxw: 1180px;
}

:root { color-scheme: light; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #E4626A;
  --brand-deep: #C2404A;
  --brand-soft: #3A1E20;
  --gold: #F6CC3A;
  --gold-deep: #C79E12;
  --gold-soft: #33290A;

  --bg: #15100F;
  --bg-tint: #1A1413;
  --surface: #1F1817;
  --surface-2: #261E1D;
  --surface-3: #2E2523;
  --border: #3A2E2C;
  --border-strong: #4E3E3B;

  --text: #F5EDE8;
  --text-soft: #D2C4BC;
  --muted: #A2928A;
  --on-brand: #FFFFFF;
  --on-gold: #241A00;

  --ok: #5CC98C;
  --ok-soft: #12301F;
  --warn: #E8B45C;
  --warn-soft: #33260F;
  --bad: #F08A8A;
  --bad-soft: #331A1A;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 2px 6px rgba(0, 0, 0, .45), 0 12px 32px rgba(0, 0, 0, .4);
}

/* ------------------------------------------------------------ elements */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); letter-spacing: -.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.06rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration-color: color-mix(in srgb, var(--brand) 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--gold); color: var(--on-gold); }

/* ------------------------------------------------------------- layout */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.page { padding: 28px 0 72px; }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }
.spacer { flex: 1 1 auto; }

/* ------------------------------------------------------------ masthead */
.masthead {
  background: linear-gradient(180deg, var(--brand-deep), var(--brand));
  color: var(--on-brand);
  border-bottom: 3px solid var(--gold);
}
.masthead a { color: inherit; text-decoration: none; }
.masthead-inner { display: flex; align-items: center; gap: 14px; padding: 12px 20px; max-width: var(--maxw); margin: 0 auto; }
.crest { width: 44px; height: 44px; border-radius: 50%; background: #fff; padding: 2px; flex: none; box-shadow: 0 0 0 2px var(--gold); }
.wordmark { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.wordmark b { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; letter-spacing: .01em; }
.wordmark span { font-size: .74rem; letter-spacing: .09em; text-transform: uppercase; opacity: .82; }
.motto { font-family: var(--serif); font-style: italic; color: var(--gold); font-size: .9rem; }

.nav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; box-shadow: var(--shadow-sm); }
.nav-inner { display: flex; align-items: center; gap: 4px; max-width: var(--maxw); margin: 0 auto; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.nav-inner::-webkit-scrollbar { display: none; }
.nav a {
  padding: 12px 12px; font-size: .88rem; font-weight: 500; color: var(--text-soft);
  text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.on { color: var(--brand); border-bottom-color: var(--brand); }
.nav .sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; flex: none; }
.nav .more { position: relative; flex: none; }
.nav .more > summary {
  list-style: none; cursor: pointer; padding: 12px 12px; font-size: .88rem;
  font-weight: 500; color: var(--text-soft); white-space: nowrap;
  border-bottom: 2px solid transparent; user-select: none;
}
.nav .more > summary::-webkit-details-marker { display: none; }
.nav .more > summary::after { content: " BE"; opacity: .6; }
.nav .more[open] > summary, .nav .more > summary:hover { color: var(--text); background: var(--surface-2); }
.more-menu {
  position: absolute; top: 100%; left: 0; min-width: 210px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px;
  display: flex; flex-direction: column;
}
.more-menu a { padding: 9px 12px; border-radius: 6px; border-bottom: 0; font-size: .88rem; }
.more-menu a:hover { background: var(--surface-2); color: var(--brand); }
.more-menu hr { margin: 6px 4px; }

/* -------------------------------------------------------------- pieces */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.eyebrow { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.soft { color: var(--text-soft); }
.small { font-size: .84rem; }
.tiny { font-size: .76rem; }
.serif { font-family: var(--serif); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-family: var(--serif); font-size: 1.75rem; line-height: 1.1; }
.stat span { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat.accent { border-left: 3px solid var(--brand); }

.hub { text-decoration: none; color: inherit; display: block; transition: .14s ease; }
.hub:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.hub b { display: block; font-family: var(--serif); font-size: 1.02rem; margin-bottom: 2px; }
.hub span { font-size: .8rem; color: var(--muted); }

.tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600;
  letter-spacing: .04em; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-soft); border: 1px solid var(--border);
}
.tag.brand { background: var(--brand-soft); color: var(--brand-deep); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.tag.gold { background: var(--gold-soft); color: var(--gold-deep); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
:root[data-theme="dark"] .tag.brand, :root[data-theme="dark"] .tag.gold { color: var(--text); }

/* ------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  font-size: .88rem; cursor: pointer; text-decoration: none; transition: .12s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: var(--on-brand); }
.btn-gold { background: var(--gold); border-color: var(--gold-deep); color: var(--on-gold); }
.btn-gold:hover { background: var(--gold-deep); color: var(--on-gold); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { padding: 6px 11px; font-size: .8rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --------------------------------------------------------------- forms */
label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
input[type="text"], input[type="tel"], input[type="email"], input[type="url"], input[type="password"],
input[type="date"], input[type="datetime-local"], input[type="number"], input[type="search"],
select, textarea {
  width: 100%; padding: 9px 12px; font: inherit; font-size: .92rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input[disabled], select[disabled], textarea[disabled] { background: var(--surface-3); color: var(--muted); }
textarea { resize: vertical; min-height: 90px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 16px; height: 16px; }
.field { margin-bottom: 15px; }
.field .help, .helptext { display: block; font-size: .78rem; color: var(--muted); margin-top: 4px; }
.field.check { display: flex; gap: 10px; align-items: flex-start; }
.field.check label { margin: 0; font-weight: 500; color: var(--text); }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--bad); font-size: .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 16px; }
fieldset { border: 0; padding: 0; margin: 0 0 26px; }
fieldset legend { font-family: var(--serif); font-size: 1.02rem; font-weight: 600; color: var(--text); padding: 0 0 4px; border-bottom: 2px solid var(--gold); margin-bottom: 14px; width: 100%; }

/* --------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th {
  background: var(--surface-2); font-size: .73rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
  position: sticky; top: 0; z-index: 1;
}
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
tbody tr:hover { background: var(--surface-3); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.voided td { color: var(--muted); text-decoration: line-through; }

/* ------------------------------------------------------------- avatars */
.avatar {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--brand-soft); color: var(--brand-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; font-size: .95rem;
  border: 1px solid var(--border);
}
.avatar.lg { width: 104px; height: 104px; font-size: 2rem; }
.avatar.xl { width: 140px; height: 140px; font-size: 2.6rem; }
.avatar.sm { width: 34px; height: 34px; font-size: .78rem; }
:root[data-theme="dark"] .avatar { background: var(--surface-3); color: var(--gold); }

/* ------------------------------------------------------- member cards */
.member-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: inherit; transition: .14s ease; position: relative;
}
.member-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.member-card .name { font-family: var(--serif); font-size: 1.02rem; font-weight: 600; line-height: 1.25; }
.member-card .meta { font-size: .82rem; color: var(--muted); }
.member-card .serial { position: absolute; top: 12px; right: 14px; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.member-card.officer { border-left: 3px solid var(--gold); }

.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.list-row:hover { background: var(--surface-2); }

/* ------------------------------------------------------------ messages */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 14px; font-size: .9rem; }
.flash.success { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.flash.error { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.flash.warning { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.flash.info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); color: var(--brand-deep); }
:root[data-theme="dark"] .flash.info { color: var(--text); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .mark { font-family: var(--serif); font-size: 2rem; color: var(--border-strong); display: block; margin-bottom: 6px; }

.meter { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--gold)); border-radius: 999px; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-soft); font-size: .8rem; text-decoration: none; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 9px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); font-size: .82rem; }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.pager { display: flex; gap: 8px; justify-content: center; margin-top: 22px; align-items: center; }

/* -------------------------------------------------------------- footer */
.foot { border-top: 1px solid var(--border); background: var(--surface); margin-top: 40px; padding: 22px 0; color: var(--muted); font-size: .82rem; }

/* ------------------------------------------------------- theme toggle */
.theme-btn { background: transparent; border: 1px solid rgba(255,255,255,.32); color: inherit; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.theme-btn:hover { background: rgba(255,255,255,.14); }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }

/* --------------------------------------------------------------- hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px; align-items: center; min-height: 58vh; }
.hero-card { max-width: 420px; width: 100%; justify-self: end; }

/* --------------------------------------------------------- filter bar */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters .grow { flex: 1 1 240px; min-width: 0; }
.filters .narrow { width: auto; min-width: 148px; flex: 0 1 auto; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  .wrap { padding: 0 14px; }
  .page { padding: 18px 0 56px; }

  .masthead-inner { padding: 10px 14px; gap: 10px; }
  .crest { width: 38px; height: 38px; }
  .wordmark b { font-size: .98rem; }
  .wordmark span { font-size: .58rem; letter-spacing: .07em; }
  .motto { display: none; }

  .nav-inner { padding: 0 8px; }
  .nav a { padding: 11px 9px; font-size: .84rem; }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.15rem; }

  .split { grid-template-columns: 1fr; gap: 16px; }
  .hero { grid-template-columns: 1fr; gap: 24px; min-height: 0; }
  .hero-card { justify-self: stretch; max-width: none; }
  .grid { gap: 12px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .card-pad, .card-head { padding: 14px; }
  .card-foot { padding: 11px 14px; }
  .panel { padding: 13px; }

  .stat { padding: 13px; }
  .stat b { font-size: 1.35rem; }
  .stat span { font-size: .7rem; }

  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { margin-top: 9px; }
  .kv dd { margin: 1px 0 0; }

  .row-between { align-items: flex-start; gap: 10px; }
  .btn { padding: 10px 15px; }
  .btn-sm { padding: 8px 12px; }

  /* 16px keeps iOS from zooming the page when a field is focused */
  input[type="text"], input[type="tel"], input[type="email"], input[type="url"],
  input[type="password"], input[type="date"], input[type="datetime-local"],
  input[type="number"], input[type="search"], select, textarea { font-size: 16px; }

  .filters { gap: 8px; }
  .filters .grow, .filters .narrow, .filters .btn { flex: 1 1 100%; width: 100%; }

  .form-grid { grid-template-columns: 1fr; }
  fieldset { margin-bottom: 20px; }

  .avatar.lg { width: 78px; height: 78px; font-size: 1.5rem; }
  .avatar.xl { width: 96px; height: 96px; font-size: 1.9rem; }

  .steps, .offer .grid { grid-template-columns: 1fr; }
  .chips { gap: 6px; }
  .chip { padding: 6px 11px; }

  .table-wrap { -webkit-overflow-scrolling: touch; }
  th, td { padding: 9px 10px; }
  thead th { position: static; }

  .member-card { padding: 14px; }
  .member-card .serial { top: 10px; right: 12px; }
}

@media (max-width: 420px) {
  .grid.cols-4 { grid-template-columns: 1fr; }
  .wordmark span { display: none; }
  .nav a { padding: 11px 8px; font-size: .8rem; }
}

/* ------------------------------------------------------- print sheet */
@media print {
  .nav, .foot, .no-print, .theme-btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .masthead { background: #fff !important; color: #000 !important; border-bottom: 2px solid #AB272A; }
  .card, .panel { border-color: #999; box-shadow: none; }
  thead th { background: #f0f0f0 !important; color: #000; }
  a { color: #000; text-decoration: none; }
  @page { size: A4; margin: 14mm; }
}
