:root {
  --jr-bg: #080a0f;
  --jr-surface: rgba(15, 19, 26, 0.92);
  --jr-surface-strong: #11161d;
  --jr-surface-soft: #151b23;
  --jr-line: rgba(148, 169, 190, 0.16);
  --jr-line-strong: rgba(148, 169, 190, 0.26);
  --jr-text: #f4f7fa;
  --jr-muted: #8d9baa;
  --jr-red: #f25440;
  --jr-red-soft: rgba(242, 84, 64, 0.14);
  --jr-cyan: #54d4e8;
  --jr-green: #2ed6a1;
  --jr-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  --jr-radius: 14px;
}

html[data-theme="light"] {
  --jr-bg: #edf2f6;
  --jr-surface: rgba(255, 255, 255, 0.94);
  --jr-surface-strong: #ffffff;
  --jr-surface-soft: #f5f8fa;
  --jr-line: rgba(54, 71, 86, 0.13);
  --jr-line-strong: rgba(54, 71, 86, 0.22);
  --jr-text: #17212a;
  --jr-muted: #697987;
  --jr-red-soft: rgba(224, 72, 52, 0.1);
  --jr-shadow: 0 20px 60px rgba(42, 58, 72, 0.12);
}

html {
  color: var(--jr-text);
  background: var(--jr-bg);
}

body {
  position: relative;
  color: var(--jr-text);
  background:
    radial-gradient(circle at 82% 8%, rgba(84, 212, 232, 0.08), transparent 28rem),
    radial-gradient(circle at 14% 92%, rgba(242, 84, 64, 0.08), transparent 30rem),
    var(--jr-bg);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(117, 147, 174, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 147, 174, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 78%);
  pointer-events: none;
}

.sidebar,
.admin-sidebar,
.join-bar {
  border-color: var(--jr-line);
  background: rgba(9, 12, 17, 0.9);
  backdrop-filter: blur(18px);
}

.identity,
.admin-identity,
.join-brand {
  position: relative;
}

.identity::after,
.admin-identity::after {
  position: absolute;
  right: 8px;
  bottom: 12px;
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--jr-red));
  content: "";
  opacity: 0.7;
}

.identity img,
.admin-identity img,
.join-brand img,
.auth-heading > img,
.download-copy img {
  border: 1px solid rgba(242, 84, 64, 0.42);
  border-radius: 11px;
  box-shadow:
    0 0 0 4px rgba(242, 84, 64, 0.06),
    0 12px 32px rgba(0, 0, 0, 0.3);
}

.sidebar nav a,
.admin-sidebar nav a {
  position: relative;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #aeb8c2;
}

.sidebar nav a:hover,
.admin-sidebar nav a:hover {
  border-color: var(--jr-line);
  background: rgba(255, 255, 255, 0.035);
}

.sidebar nav a.active,
.admin-sidebar nav a.active {
  border-color: rgba(242, 84, 64, 0.38);
  background:
    linear-gradient(105deg, rgba(242, 84, 64, 0.92), rgba(211, 60, 72, 0.78));
  color: #fff;
  box-shadow: 0 10px 24px rgba(219, 57, 48, 0.2);
}

.sidebar-status,
.admin-sidebar-status {
  border-color: var(--jr-line);
}

.sidebar-status.online i,
.admin-sidebar-status.online i {
  background: var(--jr-green);
  box-shadow: 0 0 0 4px rgba(46, 214, 161, 0.1), 0 0 14px rgba(46, 214, 161, 0.56);
  animation: jr-online-pulse 2.8s ease-in-out infinite;
}

.topbar,
.admin-topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  border-color: var(--jr-line);
  background: rgba(8, 11, 15, 0.78);
  backdrop-filter: blur(20px) saturate(130%);
}

.topbar h1,
.admin-topbar h1 {
  letter-spacing: -0.035em;
}

.topbar p,
.admin-topbar p,
.eyebrow,
.activity-heading p,
.announcement-heading p,
.hub-section-heading p,
.panel-heading p {
  color: var(--jr-cyan);
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.icon-button,
.account-link,
.account-button,
.admin-link,
.portal-link,
.primary-button,
.secondary-button {
  border-radius: 10px;
}

.icon-button,
.account-link,
.account-button,
.portal-link {
  border-color: var(--jr-line-strong);
  background: rgba(17, 22, 29, 0.78);
}

.icon-button:hover,
.account-link:hover,
.account-button:hover,
.portal-link:hover {
  border-color: rgba(84, 212, 232, 0.42);
  background: rgba(84, 212, 232, 0.07);
  color: #e9fbff;
}

.admin-link {
  border-color: rgba(242, 84, 64, 0.4);
  background: var(--jr-red-soft);
}

.content,
.admin-content,
.join-main {
  position: relative;
}

.summary-band,
.server-band,
.module-status-band,
.workspace-grid,
.metrics {
  gap: 1px;
  border: 1px solid var(--jr-line);
  border-radius: var(--jr-radius);
  background: var(--jr-line);
  box-shadow: var(--jr-shadow);
}

.summary-band > div,
.server-band > div,
.module-status-band > div,
.workspace-grid > *,
.metrics > div {
  position: relative;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 65%),
    var(--jr-surface-strong);
}

.summary-band > div::before,
.server-band > div::before,
.metrics > div::before {
  position: absolute;
  top: 0;
  left: 22px;
  width: 28px;
  height: 2px;
  background: linear-gradient(90deg, var(--jr-red), var(--jr-cyan));
  content: "";
  opacity: 0.75;
}

.summary-band strong,
.server-band strong,
.metrics strong {
  letter-spacing: -0.025em;
}

.activity-center,
.announcement-center,
.hub-section,
.module-table,
.account-directory,
.track-list,
.plugin-list,
.chat-shell,
.private-chat-shell,
.sticker-center,
.admin-panel,
.service-form,
.token-disclosure,
.setup-panel,
.token-section,
.file-transfer-section,
.devices-section,
.profile-dialog {
  border-color: var(--jr-line);
  border-radius: var(--jr-radius);
  background: var(--jr-surface);
  box-shadow: var(--jr-shadow);
}

.activity-center,
.announcement-center,
.hub-section,
.admin-panel,
.setup-panel,
.token-section,
.file-transfer-section,
.devices-section {
  overflow: hidden;
}

.activity-heading,
.announcement-heading,
.hub-section-heading,
.panel-heading,
.chat-heading,
.sticker-heading,
.private-contacts-heading {
  border-color: var(--jr-line);
  background:
    linear-gradient(90deg, rgba(242, 84, 64, 0.055), transparent 38%),
    var(--jr-surface-strong);
}

.announcement-form,
.announcement-list,
.account-list,
.module-row,
.track-list,
.plugin-list,
.service-list,
.member-list,
.audit-list {
  border-color: var(--jr-line);
  background: var(--jr-surface-strong);
}

.activity-row,
.announcement-row,
.account-row,
.module-row,
.track-row,
.plugin-row,
.service-row,
.member-row,
.audit-row,
.device-row,
.transfer-row {
  border-color: var(--jr-line);
}

.activity-row:hover,
.announcement-row:hover,
.account-row:hover,
.module-row:hover,
.track-row:hover,
.plugin-row:hover,
.service-row:hover,
.member-row:hover {
  background: rgba(84, 212, 232, 0.035);
}

.empty-state {
  position: relative;
  overflow: hidden;
}

.empty-state::before {
  width: 52px;
  height: 52px;
  justify-self: center;
  border: 1px solid rgba(242, 84, 64, 0.24);
  border-radius: 50%;
  background:
    linear-gradient(rgba(8, 10, 15, 0.48), rgba(8, 10, 15, 0.48)),
    url("/assets/louise-empty-state.jpg") center / cover;
  box-shadow: 0 0 24px rgba(242, 84, 64, 0.12);
  content: "";
  filter: grayscale(0.45);
  opacity: 0.72;
}

.empty-state strong {
  color: var(--jr-text);
}

input,
select,
textarea,
.text-input,
.password-field,
.recipient-field select,
.file-drop {
  border-radius: 10px;
}

input:focus,
select:focus,
textarea:focus,
.text-input:focus,
.password-field:focus-within {
  border-color: rgba(84, 212, 232, 0.7);
  box-shadow: 0 0 0 3px rgba(84, 212, 232, 0.12);
  outline: 0;
}

.primary-button,
.submit-button,
.download-button,
.announcement-publish {
  border-radius: 10px;
  background: linear-gradient(110deg, #f25440, #dc3f52);
  box-shadow: 0 10px 26px rgba(220, 63, 82, 0.18);
}

.primary-button:hover,
.submit-button:hover,
.download-button:hover,
.announcement-publish:hover {
  background: linear-gradient(110deg, #ff6650, #e94a5d);
  transform: translateY(-1px);
}

.mobile-nav-more {
  display: contents;
}

.mobile-more-button {
  display: none;
}

/* Login: the only page with a stronger character moment. */
.auth-layout {
  grid-template-columns: minmax(300px, 0.92fr) minmax(420px, 520px);
  gap: clamp(34px, 6vw, 90px);
  width: min(1180px, 100%);
  margin: auto;
  place-items: center stretch;
  isolation: isolate;
}

.auth-layout::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 22% 38%, rgba(242, 84, 64, 0.14), transparent 24rem),
    radial-gradient(circle at 78% 64%, rgba(84, 212, 232, 0.08), transparent 25rem);
  content: "";
}

.auth-brand-hero {
  position: relative;
  max-width: 500px;
  overflow: hidden;
  border: 1px solid var(--jr-line);
  border-radius: 28px;
  background: var(--jr-surface);
  box-shadow: var(--jr-shadow);
  clip-path: polygon(0 0, 92% 0, 100% 8%, 100% 100%, 8% 100%, 0 92%);
}

.auth-brand-hero::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 55%, rgba(8, 11, 15, 0.18)),
    linear-gradient(0deg, rgba(8, 11, 15, 0.2), transparent 42%);
  content: "";
  pointer-events: none;
}

.auth-hero-art {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1600 / 854;
  object-fit: cover;
}

.auth-panel {
  border-color: var(--jr-line);
  border-radius: 22px;
  background: var(--jr-surface);
  box-shadow: var(--jr-shadow);
  backdrop-filter: blur(20px);
}

.auth-tabs {
  border-color: var(--jr-line);
  border-radius: 11px;
  background: var(--jr-surface-soft);
}

.auth-tab {
  border-radius: 8px;
}

.auth-tab.active {
  background: var(--jr-surface-strong);
  color: var(--jr-text);
}

html[data-theme="light"] body {
  color: var(--jr-text);
  background:
    radial-gradient(circle at 82% 8%, rgba(59, 177, 196, 0.11), transparent 28rem),
    radial-gradient(circle at 14% 92%, rgba(224, 72, 52, 0.08), transparent 30rem),
    var(--jr-bg);
}

html[data-theme="light"] .sidebar,
html[data-theme="light"] .admin-sidebar,
html[data-theme="light"] .join-bar,
html[data-theme="light"] .topbar,
html[data-theme="light"] .admin-topbar {
  border-color: var(--jr-line);
  background: rgba(250, 252, 253, 0.9);
}

html[data-theme="light"] .summary-band > div,
html[data-theme="light"] .server-band > div,
html[data-theme="light"] .module-status-band > div,
html[data-theme="light"] .workspace-grid > *,
html[data-theme="light"] .metrics > div,
html[data-theme="light"] .activity-center,
html[data-theme="light"] .hub-section,
html[data-theme="light"] .admin-panel,
html[data-theme="light"] .auth-panel,
html[data-theme="light"] .setup-panel,
html[data-theme="light"] .token-section,
html[data-theme="light"] .file-transfer-section,
html[data-theme="light"] .devices-section {
  border-color: var(--jr-line);
  background: var(--jr-surface-strong);
}

html[data-theme="light"] .empty-state::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)),
    url("/assets/louise-empty-state.jpg") center / cover;
}

@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: minmax(270px, 0.8fr) minmax(390px, 1fr);
    gap: 24px;
  }

  .auth-brand-hero {
    padding: 28px;
  }
}

@media (max-width: 780px) {
  body.mobile-nav-open::after {
    position: fixed;
    z-index: 70;
    inset: 0 0 70px;
    background: rgba(2, 5, 8, 0.62);
    content: "";
    backdrop-filter: blur(4px);
  }

  .app-shell,
  .admin-shell {
    display: block;
  }

  .app-shell > main,
  .admin-shell > main {
    padding-bottom: 84px;
  }

  .sidebar,
  .admin-sidebar {
    position: fixed;
    z-index: 80;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: 70px;
    padding: 7px max(8px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border: 0;
    border-top: 1px solid var(--jr-line-strong);
    background: rgba(8, 11, 16, 0.94);
    box-shadow: 0 -16px 42px rgba(0, 0, 0, 0.28);
  }

  .identity,
  .admin-identity,
  .sidebar-status,
  .admin-sidebar-status {
    display: none;
  }

  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }

  .sidebar nav > a,
  .mobile-more-button,
  .admin-sidebar nav a {
    min-width: 0;
    min-height: 54px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #8f9aa5;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
  }

  .sidebar nav > a svg,
  .mobile-more-button svg {
    display: block;
    width: 19px;
    height: 19px;
  }

  .sidebar nav > a.active,
  .mobile-more-button.active,
  .mobile-more-button[aria-expanded="true"],
  .admin-sidebar nav a.active {
    background: var(--jr-red-soft);
    color: #ff7464;
    box-shadow: none;
  }

  .mobile-more-button {
    display: flex;
    align-items: center;
    border: 0;
    cursor: pointer;
  }

  .mobile-more-button svg {
    fill: currentColor;
    stroke: none;
  }

  .mobile-nav-more {
    position: fixed;
    z-index: 82;
    right: 12px;
    bottom: 82px;
    left: 12px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--jr-line-strong);
    border-radius: 18px;
    background: rgba(12, 16, 22, 0.97);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px) scale(0.98);
    transition: opacity 160ms ease, transform 160ms ease;
  }

  .mobile-nav-more.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .mobile-nav-more a {
    min-height: 64px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    border: 1px solid var(--jr-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    font-size: 10px;
  }

  .mobile-nav-more a svg {
    display: block;
  }

  .admin-sidebar {
    height: 68px;
  }

  .admin-sidebar nav {
    height: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .admin-sidebar nav a {
    min-height: 50px;
  }

  .topbar,
  .admin-topbar {
    min-height: 72px;
  }

  .content,
  .admin-content {
    margin-bottom: 28px;
  }

  .auth-layout {
    grid-template-columns: 1fr;
    width: min(560px, 100%);
  }

  .auth-brand-hero {
    min-height: 210px;
  }

}

@media (max-width: 520px) {
  .topbar {
    height: auto;
    min-height: 72px;
    padding: 12px 14px;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-actions .admin-link {
    display: none;
  }

  .account-link {
    max-width: 92px;
    min-height: 38px;
    padding-inline: 10px;
  }

  .content,
  .admin-content {
    width: min(100% - 20px, 1040px);
  }

  .summary-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-band > div {
    min-height: 92px;
    padding: 14px 16px;
  }

  .summary-band > div:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .auth-layout {
    display: block;
    padding: 66px 12px 18px;
  }

  .auth-brand-hero {
    min-height: 138px;
    margin-bottom: 12px;
    border-radius: 18px;
  }

  .auth-hero-art {
    height: 138px;
    object-position: left center;
  }

  .auth-panel {
    padding: 24px 20px;
    border-radius: 18px;
  }

  .auth-heading > img {
    width: 50px;
    height: 50px;
  }

  .mobile-nav-more {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-status.online i,
  .admin-sidebar-status.online i {
    animation: none;
  }

  .primary-button:hover,
  .submit-button:hover,
  .download-button:hover,
  .announcement-publish:hover,
  .mobile-nav-more {
    transform: none;
  }
}

@keyframes jr-online-pulse {
  0%,
  100% {
    opacity: 0.8;
    transform: scale(0.96);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}
