:root,
html.theme-light {
  color-scheme: light;
  --ucfr-page: #f5f7fb;
  --ucfr-surface: #ffffff;
  --ucfr-surface-alt: #edf2f7;
  --ucfr-text: #172033;
  --ucfr-muted: #647084;
  --ucfr-border: #dce4ed;
  --ucfr-header: rgba(255, 255, 255, .98);
  --ucfr-input: #ffffff;
  --ucfr-shadow: 0 16px 38px rgba(7, 27, 49, .10);
}

html.theme-dark {
  color-scheme: dark;
  --ucfr-page: #08131f;
  --ucfr-surface: #102235;
  --ucfr-surface-alt: #152b40;
  --ucfr-text: #f2f6fb;
  --ucfr-muted: #b8c5d4;
  --ucfr-border: #294158;
  --ucfr-header: rgba(8, 19, 31, .98);
  --ucfr-input: #0c1c2c;
  --ucfr-shadow: 0 18px 46px rgba(0, 0, 0, .30);
}

body,
.portal-body {
  background: var(--ucfr-page);
  color: var(--ucfr-text);
}

.topbar {
  background: var(--ucfr-header) !important;
  border-color: var(--ucfr-border) !important;
  box-shadow: 0 6px 22px rgba(7, 27, 49, .08);
}

.brand,
.topbar nav a,
.topbar .ghost,
.topbar .lang,
.topbar .menu {
  color: var(--ucfr-text) !important;
}

.brand img {
  display: block !important;
  width: 92px !important;
  height: 108px !important;
  padding: 5px !important;
  object-fit: contain !important;
  opacity: 1 !important;
  visibility: visible !important;
  background: #ffffff !important;
  border: 1px solid rgba(8, 47, 109, .12) !important;
  border-radius: 16px !important;
  filter: drop-shadow(0 5px 10px rgba(5, 25, 48, .16));
}

.theme-toggle-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--ucfr-border);
  border-radius: 50%;
  background: var(--ucfr-surface);
  color: var(--ucfr-text);
  box-shadow: 0 5px 14px rgba(7, 27, 49, .08);
  cursor: pointer;
}

.theme-toggle-btn:hover {
  transform: translateY(-1px);
}

.theme-toggle-icon {
  font-size: 20px;
  line-height: 1;
}

html.theme-dark .section,
html.theme-dark .membership,
html.theme-dark .education-hub,
html.theme-dark .documents-section,
html.theme-dark .governance,
html.theme-dark .detail-section,
html.theme-dark .protection-detail,
html.theme-dark .dashboard-main {
  background: var(--ucfr-page) !important;
  color: var(--ucfr-text) !important;
}

html.theme-dark .detail-section.detail-alt,
html.theme-dark .governance,
html.theme-dark .education-hub,
html.theme-dark .protection-detail {
  background: var(--ucfr-surface-alt) !important;
}

html.theme-dark .card,
html.theme-dark .test-mode-card,
html.theme-dark .membership-card,
html.theme-dark .news article,
html.theme-dark .quiz-preview,
html.theme-dark .detail-grid div,
html.theme-dark .detail-section ul,
html.theme-dark .membership-rules article,
html.theme-dark .dashboard-panel,
html.theme-dark .verify-card,
html.theme-dark .document-card,
html.theme-dark .seminar-card,
html.theme-dark .fee-card,
html.theme-dark .legal-request-card,
html.theme-dark .notification-item,
html.theme-dark .incident-history-item,
html.theme-dark .admin-member-card,
html.theme-dark .admin-question,
html.theme-dark .admin-create,
html.theme-dark .admin-stats article,
html.theme-dark .modal-box {
  background: var(--ucfr-surface) !important;
  color: var(--ucfr-text) !important;
  border-color: var(--ucfr-border) !important;
  box-shadow: var(--ucfr-shadow);
}

html.theme-dark .section-head h2,
html.theme-dark .card h3,
html.theme-dark .test-mode-card h3,
html.theme-dark .membership h2,
html.theme-dark .news h3,
html.theme-dark .detail-intro h2,
html.theme-dark .detail-section h2,
html.theme-dark .dashboard-panel h2,
html.theme-dark .dashboard-panel h3,
html.theme-dark .documents-section h2,
html.theme-dark .member-card h3 {
  color: var(--ucfr-text) !important;
}

html.theme-dark .section-head p,
html.theme-dark .card p,
html.theme-dark .test-mode-card p,
html.theme-dark .membership-card > div > p,
html.theme-dark .news article p,
html.theme-dark .detail-intro p,
html.theme-dark .detail-section p,
html.theme-dark .documents-section p,
html.theme-dark .dashboard-panel p,
html.theme-dark .muted {
  color: var(--ucfr-muted) !important;
}

html.theme-dark input,
html.theme-dark select,
html.theme-dark textarea,
html.theme-dark .answers button,
html.theme-dark .test-answers button {
  background: var(--ucfr-input) !important;
  color: var(--ucfr-text) !important;
  border-color: var(--ucfr-border) !important;
}

html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder {
  color: #91a3b6 !important;
  opacity: 1;
}

html.theme-dark nav.open,
html.theme-dark .topbar nav {
  background: #102235 !important;
}

html.theme-light nav.open,
html.theme-light .topbar nav {
  background: #ffffff !important;
}

.hero,
.incident,
.member-card,
footer {
  color: #ffffff;
}

@media (max-width: 720px) {
  .brand img {
    width: 58px !important;
    height: 72px !important;
    border-radius: 12px !important;
  }

  .theme-toggle-btn {
    width: 38px;
    height: 38px;
  }
}