:root {
  color-scheme: light;
  --page: #f7f7f8;
  --surface: #ffffff;
  --surface-soft: #f1f2f4;
  --ink: #171923;
  --muted: #646a78;
  --line: #171923;
  --purple: #171923;
  --cyan: #08a8c4;
  --cyan-hover: #078ca5;
  --pink: #f02c55;
  --grid: rgba(23, 25, 35, .055);
  --offset: #171923;
  --field: #f8f9fc;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111114;
  --surface: #19191d;
  --surface-soft: #242429;
  --ink: #f4f2f8;
  --muted: #aaa7b3;
  --line: #eeedf2;
  --purple: #ffffff;
  --cyan: #079bb8;
  --cyan-hover: #0cb4d1;
  --pink: #e8194c;
  --grid: rgba(255, 255, 255, .045);
  --offset: #ffffff;
  --field: #242429;
}

html { background: var(--page); scroll-behavior: smooth; }
body {
  color: var(--ink) !important;
  background-color: var(--page) !important;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px) !important;
  background-size: 32px 32px !important;
  transition: background-color .24s ease, color .24s ease;
}
body, button, input, select, textarea { font-family: 'Poppins', Inter, system-ui, sans-serif !important; }
::selection { color: #fff; background: var(--purple); }
:focus-visible { outline: 3px solid var(--purple) !important; outline-offset: 2px; }

.fixed-navbar {
  background: var(--surface) !important;
  border-bottom: 3px solid var(--line) !important;
  box-shadow: 0 4px 0 var(--offset);
  transition: background-color .24s ease, border-color .24s ease;
}
.fixed-navbar > div { min-height: 64px; gap: 12px; }
.navbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }
.navbar-login {
  display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px; border: 2px solid var(--line); background: var(--cyan); color: #fff !important;
  box-shadow: 3px 3px 0 var(--offset); font-size: 12px; font-weight: 700; text-decoration: none;
  transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.navbar-login:hover { background: var(--cyan-hover); transform: translateY(-1px); }
.sidebar-logout { color: #c62828 !important; }
.sidebar-logout:hover { background: var(--surface-soft) !important; }
.sidebar-toggle {
  display: inline-flex; width: 42px; height: 42px; flex: 0 0 auto; align-items: center; justify-content: center;
  margin: 0; padding: 0; border: 2px solid var(--line) !important; background: var(--purple) !important;
  color: var(--surface) !important; box-shadow: 3px 3px 0 var(--offset); cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.sidebar-toggle:hover { transform: translateY(-1px); }
.sidebar-toggle:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--offset); }
.admin-stats-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.admin-stats-grid > div { min-width: 0; }
.admin-stats-grid > div > div:first-child { min-height: 52px; display: flex; align-items: center; }
.admin-stats-grid > div > div:nth-child(2) { min-height: 64px; }
.admin-balance-toggle {
  display: inline-flex; width: 34px; height: 34px; flex: 0 0 auto; align-items: center; justify-content: center;
  margin: 0; padding: 0; border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: 2px 2px 0 var(--offset); cursor: pointer;
}
.admin-balance-toggle:hover { background: var(--surface-soft); }
.profile-modal-panel {
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}
.profile-modal-header {
  position: sticky;
  top: -1px;
  z-index: 2;
  background: var(--surface);
}
@supports (height: 100dvh) {
  .profile-modal-panel { max-height: calc(100dvh - 24px); }
}
@media (min-width: 430px) {
  .admin-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .admin-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.hamburger-lines { display: flex; width: 20px; flex-direction: column; gap: 5px; }
.hamburger-lines span { display: block; width: 20px; height: 2px; background: currentColor; transition: transform .2s ease, opacity .2s ease; }
.hamburger-checkbox:checked ~ nav .hamburger-lines span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-checkbox:checked ~ nav .hamburger-lines span:nth-child(2) { opacity: 0; }
.hamburger-checkbox:checked ~ nav .hamburger-lines span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-menu {
  background: var(--surface) !important;
  border-right: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--offset);
}
.mobile-menu a { color: var(--ink) !important; border-radius: 2px !important; }
.mobile-menu a:hover { background: var(--surface-soft) !important; color: var(--purple) !important; }
.fixed-navbar label, .fixed-navbar .peer-checked\:block { color: var(--ink) !important; }
.fixed-navbar .bg-white { background: var(--surface) !important; }
.site-footer {
  background: var(--surface) !important;
  border-top: 3px solid var(--line) !important;
  color: var(--ink) !important;
  transition: background-color .24s ease, color .24s ease;
}
.site-footer__links h2, .site-footer__copyright, .rich-content h1,
.rich-content h2, .rich-content h3 { color: var(--ink) !important; }
.site-footer__links a, .site-footer__muted, .site-footer__intro p { color: var(--muted) !important; }
.site-footer__copyright { border-color: var(--line) !important; }

/* Shared Tailwind surface and text tokens, so every existing EJS page follows the theme. */
[class~="bg-white"], [class~="bg-[#f9f9f9]"], [class~="bg-[#f8fafc]"],
[class~="bg-gray-50"], [class~="bg-gray-100"], [class~="bg-[#eef0f7]"] {
  background-color: var(--surface) !important;
  transition: background-color .24s ease, color .24s ease, border-color .24s ease;
}
[class~="bg-[#f9f9f9]"], [class~="bg-gray-50"], [class~="bg-gray-100"],
[class~="bg-[#eef0f7]"] { background-color: var(--surface-soft) !important; }
[class~="text-gray-800"], [class~="text-gray-700"], [class~="text-gray-600"],
[class~="text-slate-800"], [class~="text-slate-700"] { color: var(--ink) !important; }
[class~="text-gray-500"], [class~="text-gray-400"], [class~="text-slate-500"],
[class~="text-slate-400"] { color: var(--muted) !important; }
[class~="text-blue-500"], [class~="text-blue-600"], [class~="text-pink-600"] { color: var(--purple) !important; }
[class~="bg-blue-500"], [class~="bg-blue-600"] { background-color: var(--cyan) !important; }
[class~="hover:bg-blue-600"]:hover, [class~="hover:bg-blue-700"]:hover { background-color: var(--cyan-hover) !important; }
[class~="border-[#dddddd]"], [class~="border-gray-200"], [class~="border-gray-300"],
[class~="border-gray-100"] { border-color: var(--line) !important; }
[class~="rounded-[2px]"] { border-radius: 2px !important; }

/* Offset borders echo the supplied neo-brutalist reference without changing layout. */
[class~="bg-white"][class*="border-"], [class~="bg-[#f9f9f9]"][class*="border-"],
.glass-card, .policy-editor {
  border-width: 2px !important;
  border-color: var(--line) !important;
  box-shadow: 4px 4px 0 var(--offset) !important;
}
button, input, select, textarea {
  border-radius: 2px !important;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  color: var(--ink) !important;
  background-color: var(--field) !important;
  border-color: var(--line) !important;
}
input::placeholder, textarea::placeholder { color: var(--muted) !important; opacity: .8; }
button[class*="bg-"], a[class*="bg-blue-"] {
  border: 2px solid var(--line) !important;
  box-shadow: 3px 3px 0 var(--offset);
}
button[class*="bg-"]:active, a[class*="bg-blue-"]:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--offset); }
table { border-color: var(--line) !important; }
th { color: var(--ink) !important; }
td, th { border-color: color-mix(in srgb, var(--line) 22%, transparent) !important; }
pre, code { background-color: var(--surface-soft); color: var(--ink); }
.rich-content { color: var(--ink) !important; }

.theme-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  width: 44px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--line) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  box-shadow: 3px 3px 0 var(--offset);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--purple) !important; transform: translateY(-1px); }
.theme-toggle i { font-size: 16px; }
.standalone-theme-toggle { position: fixed; z-index: 300; top: 12px; right: 12px; }

@media (max-width: 640px) {
  .fixed-navbar > div { padding-inline: 12px; }
  main { max-width: 100% !important; }
  .theme-toggle { width: 40px; height: 40px; }
  .navbar-actions { gap: 6px; }
  .navbar-login { min-height: 40px; padding-inline: 11px; }
  .sidebar-toggle { width: 40px; height: 40px; }
}
@media (max-width: 380px) {
  .fixed-navbar > div { gap: 8px; padding-inline: 8px; }
  .fixed-navbar > div > a img { width: 108px !important; }
  .navbar-actions { gap: 5px; }
  .theme-toggle, .sidebar-toggle { width: 36px; height: 36px; }
  .navbar-login { min-height: 36px; padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
