:root {
  --navy: #0047AB;
  --steel: #4682B4;
  --paper: #f4f7fb;
  --panel: #ffffff;
  --ink: #122033;
  --ink-soft: #3d5268;
  --line: rgba(0, 71, 171, 0.12);
  --crimson: #DC143C;
  --ok: #1f6b4a;
  --danger: #9b1630;
  --shadow: 0 14px 40px rgba(0, 71, 171, 0.08);
  --radius: 14px;
  --font-display: "Libre Baskerville", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(70, 130, 180, 0.16), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(220, 20, 60, 0.05), transparent 50%),
    linear-gradient(180deg, #eef4fa 0%, var(--paper) 40%, #e8eef6 100%);
  min-height: 100vh;
  line-height: 1.55;
}
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--steel); }
img { max-width: 100%; display: block; }
.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(0, 71, 171, 0.94);
  border-bottom: 3px solid var(--crimson);
}
.header-inner { display: flex; flex-direction: column; gap: .35rem; padding: .55rem 0 .45rem; }
.header-top { display: flex; align-items: center; gap: .75rem; min-height: 48px; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff !important; min-width: 0; }
.brand-logo { width: 44px; height: 44px; border-radius: 0; object-fit: contain; background: transparent; }
.brand-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.15;
  white-space: nowrap;
}
.brand-text span { display: block; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: #d7e6f5; }
.header-search { flex: 1 1 160px; max-width: 280px; }
.header-search input {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: .45rem .85rem;
  background: rgba(255,255,255,.14);
  color: #fff;
}
.header-search input::placeholder { color: rgba(255,255,255,.72); }
.header-account { display: flex; align-items: center; gap: .45rem; margin-left: auto; }
.header-account-btn { padding: .2rem .7rem; font-size: .78rem; }
.header-account .btn-ghost { border-color: rgba(255,255,255,.35); color: #fff !important; }
.header-account .btn-primary { background: #fff; color: var(--navy) !important; }
.header-icon-link, .header-avatar-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff !important;
  width: 36px;
  height: 36px;
}
.header-msg-icon { width: 22px; height: 22px; }
.header-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.4); }
.header-user-menu { position: relative; }
.header-user-menu summary { list-style: none; cursor: pointer; }
.header-user-menu summary::-webkit-details-marker { display: none; }
.header-user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  min-width: 180px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: .4rem 0;
  border: 1px solid var(--line);
}
.header-user-dropdown a { display: block; padding: .45rem .9rem; color: var(--ink); }
.header-user-dropdown a:hover { background: #f0f5fb; }
.header-user-sep { height: 1px; background: var(--line); margin: .3rem 0; }
.nav-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--crimson);
  color: #fff;
  border-radius: 999px;
  font-size: .62rem;
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.header-user-dropdown .nav-badge { position: static; margin-left: .25rem; }
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: 8px;
  padding: .25rem .5rem;
  font-size: 1.1rem;
}
.site-nav { display: flex; flex-wrap: wrap; gap: .15rem .85rem; padding: .15rem 0 .2rem; }
.site-nav a { color: rgba(255,255,255,.9) !important; font-weight: 600; font-size: .92rem; }
.site-nav a:hover { color: #fff !important; }

.site-main { padding: 1.5rem 0 3rem; }
.site-footer {
  background: var(--navy);
  color: #d7e6f5;
  padding: 2rem 0 1.4rem;
}
.site-footer a { color: #fff; }
.site-footer .muted,
.site-footer p {
  color: #d7e6f5;
}
.footer-inner { display: grid; gap: 1.1rem; }
@media (min-width: 860px) {
  .footer-inner { grid-template-columns: 1.2fr 1.4fr 1fr; align-items: start; }
  .footer-copy { grid-column: 1 / -1; }
}
.footer-label { margin: 0 0 .35rem; font-weight: 700; color: #fff; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.footer-copy { opacity: .75; font-size: .9rem; color: #d7e6f5; }
.seo-topics {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .7rem;
  margin: 0 0 1.15rem;
}
.seo-topics a {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .28rem .75rem;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy);
  font-weight: 600;
  font-size: .88rem;
}
.seo-topics a:hover { border-color: var(--navy); color: var(--steel); }
.site-footer .seo-topics { margin: 0; }
.site-footer .seo-topics a {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.22);
  color: #fff;
}
.seo-prose { margin-bottom: 1.4rem; }
.seo-prose h2 { font-family: var(--font-display); color: var(--navy); font-size: 1.35rem; }
.seo-major-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .25rem .8rem;
  margin: 0 0 1rem;
  padding-left: 1.1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: .5rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
}
.btn-primary { background: var(--navy); color: #fff !important; }
.btn-primary:hover { background: #00398a; color: #fff !important; }
.btn-ghost { background: transparent; border-color: var(--steel); color: var(--navy) !important; }
.btn-crimson { background: var(--crimson); color: #fff !important; }
.btn-sm { padding: .28rem .7rem; font-size: .86rem; }
.btn-block { width: 100%; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  margin: 0 0 .35rem;
  color: var(--navy);
}
.section-lead { margin: 0 0 1rem; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.badge {
  display: inline-block;
  background: rgba(220, 20, 60, 0.1);
  color: var(--crimson);
  border-radius: 999px;
  padding: .08rem .5rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.badge-blue { background: rgba(0, 71, 171, 0.1); color: var(--navy); }

.flash { border-radius: 10px; padding: .75rem 1rem; margin-bottom: 1rem; }
.flash-error { background: #fde8ec; color: var(--danger); }
.flash-success { background: #e7f6ee; color: var(--ok); }
.flash-info { background: #e8f1fb; color: var(--navy); }

.form-row { margin-bottom: .9rem; }
.form-row label { display: block; font-weight: 600; margin-bottom: .3rem; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55rem .7rem;
  font: inherit;
  background: #fff;
}
.form-row textarea { min-height: 110px; resize: vertical; }
input[type="file"] {
  font: inherit;
  color: var(--ink-soft);
  max-width: 100%;
}
input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--steel);
  border-radius: 999px;
  padding: .45rem 1rem;
  margin-right: .65rem;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover {
  background: #eef4fb;
  border-color: var(--navy);
}
.form-help { font-size: .85rem; color: var(--ink-soft); margin-top: .25rem; }
.form-actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.auth-wrap { width: min(460px, 100%); margin: 1rem auto; }
.captcha-image {
  display: block;
  width: min(100%, 340px);
  height: auto;
  border-radius: 10px;
  margin: 0 0 .55rem;
  background: #eef3f8;
}
.captcha-refresh {
  display: inline-flex;
  align-items: center;
  margin: 0 0 .55rem;
  padding: .28rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: .86rem;
  cursor: pointer;
}
.captcha-refresh:hover { border-color: var(--navy); }
.captcha-row input {
  letter-spacing: .22em;
  font-variant-numeric: tabular-nums;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr .9fr;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.75rem;
}
.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.15;
  color: var(--navy);
  margin: 0 0 .6rem;
}
.hero-copy p { font-size: 1.12rem; color: var(--ink-soft); }
.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }
.hero-card { background: var(--navy); color: #fff; border-radius: 18px; padding: 1.4rem; }
.hero-card h2 { font-family: var(--font-display); margin: 0 0 .5rem; }
.hero-card a { color: #fff; text-decoration: underline; }

.stat-grid, .card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}
.stat { text-align: center; }
.stat strong { display: block; font-size: 1.8rem; color: var(--navy); font-family: var(--font-display); }
.feature-card h2, .feature-card h3 { margin: 0 0 .4rem; color: var(--navy); font-family: var(--font-display); font-size: 1.25rem; }
.feature-card p { margin: 0; color: var(--ink-soft); }

.list-toolbar { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { border: 1px solid var(--line); border-radius: 10px; padding: .45rem .65rem; font: inherit; background: #fff; }

.school-card, .member-card, .aid-card, .resource-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  color: inherit !important;
}
.school-card { display: flex; flex-direction: column; }
.school-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f8fc;
  border: 1px solid #e4eef7;
  border-radius: 12px;
  flex-shrink: 0;
}
.school-logo-wrap-sm { width: 36px; height: 36px; }
.school-logo-wrap-md { height: 92px; margin-bottom: .8rem; }
.school-logo-wrap-lg { width: 120px; height: 120px; }
.school-logo { max-width: 78%; max-height: 78%; object-fit: contain; }
.school-logo-sm { max-width: 28px; max-height: 28px; }
.school-logo-lg { max-width: 96px; max-height: 96px; }
.school-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64%;
  height: 64%;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .04em;
}
.school-logo-fallback[hidden] { display: none !important; }
.school-logo-wrap-sm .school-logo-fallback { width: 100%; height: 100%; border-radius: 8px; font-size: .72rem; }
.school-logo-wrap-md .school-logo-fallback { font-size: 1.2rem; }
.school-logo-wrap-lg .school-logo-fallback { font-size: 1.6rem; width: 72%; height: 72%; }
.school-profile { display: flex; gap: 1.2rem; align-items: flex-start; }
.school-profile .section-title { margin-top: 0; }
.search-school { display: flex; align-items: center; gap: .65rem; }
.search-school .school-logo-wrap { margin: 0; }
.admin-logo-preview { max-width: 88px; max-height: 88px; object-fit: contain; display: block; margin-bottom: .6rem; }
.admin-logo-card { display: flex; flex-direction: column; gap: .55rem; }
.admin-logo-card h3 { margin: 0; font-size: 1.05rem; }
.table-logo { width: 36px; height: 36px; object-fit: contain; vertical-align: middle; }
.school-card:hover, .member-card:hover, .aid-card:hover, .resource-card:hover {
  border-color: var(--steel);
}
.school-card h3, .member-card h3, .aid-card h3, .resource-card h3 {
  margin: 0 0 .25rem;
  font-family: var(--font-display);
  color: var(--navy);
}
.member-card { display: flex; gap: .8rem; align-items: center; }
.avatar, .avatar-sm, .avatar-xs { border-radius: 50%; object-fit: cover; background: #d7e6f5; }
.avatar { width: 96px; height: 96px; }
.avatar-sm { width: 44px; height: 44px; }
.avatar-xs { width: 28px; height: 28px; }

@media (max-width: 640px) {
  .school-profile { flex-direction: column; }
  .school-logo-wrap-lg { width: 96px; height: 96px; }
}
.layout-feed { display: grid; grid-template-columns: 240px 1fr; gap: 1.2rem; }
.layout-feed.is-profile { grid-template-columns: 280px 1fr; }
.side-card ul { margin: .4rem 0 0; padding-left: 1.1rem; }

.composer-form { display: flex; flex-direction: column; gap: .55rem; }
.composer-form label {
  display: block;
  font-weight: 600;
  color: var(--navy);
}
.composer textarea,
.composer-tools input[type="url"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .7rem .85rem;
  font: inherit;
  color: var(--ink);
  background: #f8fbfe;
  outline: none;
}
.composer textarea {
  min-height: 110px;
  resize: vertical;
}
.composer textarea:focus,
.composer-tools input[type="url"]:focus {
  border-color: var(--steel);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(70, 130, 180, 0.18);
}
.composer textarea::placeholder,
.composer-tools input[type="url"]::placeholder {
  color: #7a8ea3;
}
.composer-tools {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}
.composer-tools input[type="url"] { flex: 1 1 220px; width: auto; }
.composer-tools input[type="file"] {
  flex: 1 1 180px;
  font: inherit;
  color: var(--ink-soft);
}

.post-card { border-top: 1px solid var(--line); padding: 1rem 0; }
.post-card:first-child { border-top: 0; }
.post-head { display: flex; gap: .7rem; align-items: flex-start; margin-bottom: .55rem; }
.post-name { font-weight: 700; color: var(--ink); }
.post-body { margin: .2rem 0 .6rem; }
.post-image { border-radius: 12px; margin: .4rem 0; }
.video-wrap { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; margin: .5rem 0; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.post-actions { display: flex; gap: 1rem; align-items: center; margin: .4rem 0; }
.action-btn {
  background: none;
  border: 0;
  color: var(--navy);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.action-btn.is-liked { color: var(--crimson); }
.comment { display: flex; gap: .5rem; margin: .55rem 0; }
.comment-form { display: flex; gap: .45rem; margin-top: .5rem; }
.comment-form input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: .4rem .75rem; font: inherit; }

.profile-hero {
  background: linear-gradient(135deg, var(--navy), var(--steel));
  border-radius: 18px;
  padding: 1.4rem;
  color: #fff;
  margin-bottom: 1.2rem;
  position: relative;
  overflow: hidden;
}
.profile-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--cover, none);
  opacity: .28;
  background-size: cover;
  background-position: center;
}
.profile-hero-inner { position: relative; display: flex; gap: 1rem; align-items: center; }
.profile-hero h1 { margin: 0 0 .25rem; font-family: var(--font-display); }
.profile-meta { opacity: .92; }
.profile-actions { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .7rem; }
.profile-hero .btn-ghost { border-color: rgba(255,255,255,.5); color: #fff !important; }
.profile-hero .btn-primary { background: #fff; color: var(--navy) !important; }

.thread-list a { display: block; padding: .75rem 0; border-top: 1px solid var(--line); color: inherit; }
.thread-list a:first-child { border-top: 0; }
.thread-list a.unread { background: #f4f8fd; margin: 0 -1rem; padding-left: 1rem; padding-right: 1rem; }
.message-thread { display: flex; flex-direction: column; gap: .65rem; }
.message-bubble {
  max-width: 78%;
  background: #eef4fb;
  border-radius: 14px;
  padding: .7rem .85rem;
}
.message-bubble.mine { align-self: flex-end; background: var(--navy); color: #fff; }
.message-bubble.mine a { color: #fff; }
.msg-meta { font-size: .78rem; opacity: .75; margin-bottom: .2rem; }

.admin-nav { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--navy); font-size: .86rem; }
.visit-stats th:nth-child(n+2),
.visit-stats td:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.visit-stats td:nth-child(n+2) { font-weight: 700; }
.admin-top-hit {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: .45rem 0;
  border-bottom: 1px solid var(--line);
  color: inherit !important;
}
.admin-top-hit:last-child { border-bottom: 0; }

.pagination { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: 1rem; }
.pagination a, .pagination span {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 .5rem;
}
.pagination .current { background: var(--navy); color: #fff; border-color: var(--navy); }

.empty { color: var(--ink-soft); padding: 1rem 0; }
.inline-image-preview { max-width: 280px; border-radius: 8px; }

@media (max-width: 860px) {
  .hero, .layout-feed, .layout-feed.is-profile { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .site-nav { display: none; }
  .site-nav.is-open { display: flex; flex-direction: column; }
  .header-search { display: none; }
  .brand-text { font-size: 1rem; }
}
