:root {
  --nx-bg: #040b17;
  --nx-bg-2: #09152a;
  --nx-panel: rgba(8, 18, 34, 0.78);
  --nx-border: rgba(105, 205, 255, 0.22);
  --nx-border-strong: rgba(105, 205, 255, 0.42);
  --nx-text: #eef4ff;
  --nx-muted: #b4c5df;
  --nx-blue: #08a0ff;
  --nx-cyan: #57d7ff;
  --nx-green: #63ef76;
  --nx-danger: #ff5f67;
  --nx-radius: 28px;
  --nx-shadow: 0 24px 84px rgba(0,0,0,.34);
  font-family: "Plus Jakarta Sans", "Inter", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  color: var(--nx-text);
  background: linear-gradient(180deg, #050b18 0%, #071122 58%, #06101f 100%);
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.page-container { width: min(1480px, calc(100vw - 48px)); margin: 0 auto; }
.glass-card {
  background: linear-gradient(180deg, rgba(16, 31, 57, 0.72), rgba(7, 18, 35, 0.82));
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius);
  backdrop-filter: blur(18px);
  box-shadow: var(--nx-shadow), inset 0 1px 0 rgba(255,255,255,.05);
}
.nexus-shell-bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(circle at 14% 86%, rgba(10,132,255,.12), transparent 22%),
    radial-gradient(circle at 87% 8%, rgba(0,194,255,.08), transparent 18%),
    linear-gradient(180deg, #050b17 0%, #081427 60%, #071120 100%);
}
.nexus-shell-bg::before,
.nexus-shell-bg::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px); opacity: .22;
}
.nexus-shell-bg::before { width: 34vw; aspect-ratio:1; left:-10vw; bottom:-14vw; background:#0a84ff; }
.nexus-shell-bg::after { width: 24vw; aspect-ratio:1; right:-8vw; top:-10vw; background:#3fe8ff; }
.nexus-shell-bg .bg-grid {
  position:absolute; inset:-30%; opacity:.16;
  background-image:
    linear-gradient(rgba(85,190,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(85,190,255,.08) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(980px) rotateX(73deg) translateY(6%);
}
.nexus-shell-bg .bg-noise {
  position:absolute; inset:0; opacity:.05; mix-blend-mode:screen;
  background-image: radial-gradient(rgba(255,255,255,.44) .7px, transparent .8px);
  background-size: 4px 4px;
}

.topbar, .hub-topbar {
  display:flex; justify-content:space-between; align-items:flex-start; gap:18px;
  padding: 24px 0 14px;
}
.brand-title { font-size: 2rem; font-weight: 800; letter-spacing: .01em; }
.brand-subtitle { margin-top: 6px; color: var(--nx-muted); }
.topbar nav, .hub-topbar-actions {
  display:flex; gap:12px; flex-wrap:wrap; align-items:center; justify-content:flex-end;
}
.topbar nav a, .hub-top-link, .hub-current-user, .hub-logout-btn, .small-link {
  min-height: 48px; display:inline-flex; align-items:center; justify-content:center; padding:0 18px;
  border-radius: 999px; background: rgba(6,18,34,.42); border:1px solid rgba(105,205,255,.2);
  color: var(--nx-text); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.topbar nav a:hover, .hub-top-link:hover, .hub-logout-btn:hover, .small-link:hover {
  transform: translateY(-1px); border-color: rgba(105,205,255,.4); background: rgba(8,22,42,.68); box-shadow: 0 0 18px rgba(0,194,255,.12);
}
.hub-current-user strong { color: #d8f6ff; }
.small-link { min-height: 42px; padding: 0 14px; color: #83e8ff; }
.auth-page { min-height: 100vh; display:grid; place-items:center; padding: 32px 0; }
.auth-shell { width: min(92vw, 620px); }
.auth-card { padding: 34px 34px 28px; }
.auth-logo-lockup { display:grid; justify-items:center; gap: 14px; margin-bottom: 18px; }
.auth-logo-symbol { width: min(260px, 66%); height:auto; filter: drop-shadow(0 0 20px rgba(0,194,255,.18)); }
.nexus-wordmark { display:flex; align-items:center; justify-content:center; gap:.06em; font-weight: 800; letter-spacing: .34em; text-transform: uppercase; color:white; }
.nexus-wordmark--large { font-size: clamp(2.4rem, 4.3vw, 3.9rem); }
.nexus-wordmark--medium { font-size: clamp(2rem, 3.6vw, 3rem); }
.nexus-wordmark .nx-letter { color: rgba(255,255,255,.98); text-shadow: 0 1px 0 rgba(255,255,255,.08), 0 0 20px rgba(255,255,255,.04); }
.nexus-wordmark .nx-x {
  display:inline-block; background: linear-gradient(135deg, #1a8fff 0%, #58d7ff 45%, #61ef76 100%); -webkit-background-clip:text; background-clip:text; color:transparent;
  text-shadow: 0 0 18px rgba(0,194,255,.16);
}
.auth-subtitle { margin: 0 0 26px; text-align:center; color: #d1def4; font-size: 1.16rem; }
.auth-heading { margin: 0 0 10px; text-align:center; font-size: 2rem; }
.form, .nexus-form, .inline-form, .app-form, .auth-form, .access-list { display:grid; gap:14px; }
.form-grid { display:grid; gap:16px; }
.form-grid.two-cols { grid-template-columns: repeat(2, minmax(0,1fr)); }
label { font-weight: 700; color: var(--nx-text); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], select, textarea {
  width:100%; min-height: 56px; border-radius: 16px; border:1px solid rgba(206,220,242,.30); outline:none;
  padding: 0 16px; color: var(--nx-text); background: rgba(3,10,21,.6);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
textarea { min-height: 120px; padding: 14px 16px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--nx-cyan); background: rgba(4,13,27,.82); box-shadow: 0 0 0 4px rgba(0,194,255,.12), 0 0 24px rgba(0,194,255,.14);
}
button, .small-button {
  min-height:56px; border:0; border-radius:16px; padding:0 22px; font-weight: 800; cursor:pointer; color:#081222;
  background: linear-gradient(135deg, #42d3ff, #4d78f0); box-shadow: 0 16px 34px rgba(0,194,255,.2);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
button:hover, .small-button:hover { transform: translateY(-1px); box-shadow: 0 20px 38px rgba(0,194,255,.24); filter: brightness(1.03); }
.small-button { min-height:46px; padding:0 18px; }
.small-button.danger { color:white; background: linear-gradient(135deg, #ff7878, #e14656); box-shadow: 0 12px 24px rgba(255,95,103,.22); }
.secondary-link { display:inline-block; margin-top:6px; color: #55d8ff; }
.secondary-link:hover { color: #93ebff; }
.flash, .message, .alert { padding: 12px 14px; border-radius: 14px; margin: 0 0 18px; background: rgba(7,18,34,.74); border:1px solid rgba(105,205,255,.18); }
.message.success { border-color: rgba(99,239,118,.28); }
.message.info { border-color: rgba(105,205,255,.28); }
.muted { color: var(--nx-muted); }
.small { font-size: .94rem; }
.break-word { word-break: break-word; }
.qr-zone { display:flex; justify-content:center; padding:18px; border-radius:18px; background: rgba(5,14,27,.48); border:1px solid rgba(105,205,255,.14); }
.qr-zone img { max-width: min(280px,100%); border-radius: 14px; }
.secret { display:block; padding: 14px; margin: 14px 0 10px; border-radius: 14px; background: rgba(3,10,21,.5); border:1px solid rgba(105,205,255,.18); }
.setup-box { padding:22px; border-radius:20px; margin-bottom:22px; background: rgba(6,16,32,.5); border:1px solid rgba(105,205,255,.16); }
.admin-page { min-height:100vh; }
.admin-layout { padding-bottom:34px; }
.panel { padding: 26px; margin-bottom: 22px; background: linear-gradient(180deg, rgba(10,22,41,.68), rgba(7,17,32,.82)); border:1px solid var(--nx-border); border-radius: 26px; backdrop-filter: blur(18px); box-shadow: var(--nx-shadow); }
.panel h2 { margin: 0 0 18px; font-size: 1.55rem; }
.button-row { display:flex; flex-wrap:wrap; gap: 12px; align-items:center; }
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse: collapse; }
th, td { padding: 16px 14px; text-align:left; border-bottom:1px solid rgba(105,205,255,.10); vertical-align: top; }
th { color:#dff3ff; font-weight:800; }
tr:hover td { background: rgba(255,255,255,.015); }
.actions-cell { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.checkbox-line, .access-card { display:flex; gap:12px; align-items:flex-start; }
.checkbox-line input, .access-card input { margin-top:4px; }
.app-list { display:grid; gap:16px; }
.app-admin-card, .access-card { padding:20px; border-radius:20px; background: rgba(6,16,31,.48); border:1px solid rgba(105,205,255,.14); }
.access-list { gap:16px; }
.access-card span { display:grid; gap:6px; }
.access-card small { color: var(--nx-muted); }
.disabled-card { opacity:.65; }
.empty { padding:22px; border-radius:18px; background: rgba(7,18,34,.46); border:1px dashed rgba(105,205,255,.16); }
.inline-form { grid-template-columns: 1.6fr .8fr auto; align-items:end; }
.inline-form > * { width:100%; }
.hub-home { min-height:100vh; }
.hub-background { position: fixed; inset:0; z-index:-1; overflow:hidden; background: linear-gradient(180deg, #030913 0%, #061022 62%, #06101d 100%); }
.hub-background .mesh {
  position:absolute; inset:0; background:
   radial-gradient(circle at 12% 26%, rgba(91,221,255,.7) 0 2px, transparent 3px),
   radial-gradient(circle at 27% 18%, rgba(91,221,255,.58) 0 2px, transparent 3px),
   radial-gradient(circle at 38% 33%, rgba(91,221,255,.68) 0 2px, transparent 3px),
   radial-gradient(circle at 50% 14%, rgba(91,221,255,.8) 0 2px, transparent 3px),
   radial-gradient(circle at 63% 18%, rgba(99,239,118,.62) 0 2px, transparent 3px),
   radial-gradient(circle at 76% 31%, rgba(99,239,118,.62) 0 2px, transparent 3px),
   radial-gradient(circle at 87% 24%, rgba(99,239,118,.55) 0 2px, transparent 3px),
   linear-gradient(10deg, transparent 0 46%, rgba(91,221,255,.08) 46.2%, transparent 46.5%),
   linear-gradient(174deg, transparent 0 56%, rgba(91,221,255,.08) 56.2%, transparent 56.5%),
   linear-gradient(144deg, transparent 0 52%, rgba(99,239,118,.08) 52.2%, transparent 52.5%),
   linear-gradient(28deg, transparent 0 38%, rgba(91,221,255,.06) 38.1%, transparent 38.4%),
   linear-gradient(158deg, transparent 0 42%, rgba(99,239,118,.06) 42.1%, transparent 42.4%);
  opacity: .55;
}
.hub-background .center-glow {
  position:absolute; left:50%; top:44%; transform: translate(-50%, -50%); width:min(760px, 56vw); aspect-ratio:1/1; border-radius:50%;
  background: radial-gradient(circle, rgba(9,30,58,.08) 0%, rgba(9,30,58,.12) 40%, rgba(4,11,22,.0) 70%);
  box-shadow: 0 0 0 34px rgba(10,132,255,.05), 0 0 0 68px rgba(10,132,255,.04), 0 0 0 102px rgba(0,194,255,.03);
}
.hub-background .center-rings,
.hub-background .center-rings::before,
.hub-background .center-rings::after {
  content:""; position:absolute; left:50%; top:44%; transform: translate(-50%, -50%); border-radius:50%;
}
.hub-background .center-rings { width:min(570px, 42vw); aspect-ratio:1/1; border:1px solid rgba(105,205,255,.38); box-shadow: inset 0 0 24px rgba(105,205,255,.08), 0 0 20px rgba(105,205,255,.08); }
.hub-background .center-rings::before { width: calc(min(570px, 42vw) + 54px); aspect-ratio:1/1; border:1px dashed rgba(105,205,255,.28); }
.hub-background .center-rings::after { width: calc(min(570px, 42vw) - 52px); aspect-ratio:1/1; border:1px solid rgba(99,239,118,.22); }
.hub-background .arrow-bg { position:absolute; top:44%; width: 23vw; height: 4px; }
.hub-background .arrow-bg::before { content:""; position:absolute; inset:0; background: linear-gradient(90deg, rgba(10,132,255,.0), rgba(87,215,255,.86), rgba(87,215,255,.56)); border-radius:999px; box-shadow: 0 0 16px rgba(87,215,255,.22); }
.hub-background .arrow-bg::after { content:""; position:absolute; right:-2px; top:50%; width:16px; height:16px; border-top:3px solid rgba(87,215,255,.9); border-right:3px solid rgba(87,215,255,.9); transform: translateY(-50%) rotate(45deg); }
.hub-background .arrow-bg.right::before { background: linear-gradient(90deg, rgba(99,239,118,.56), rgba(99,239,118,.86), rgba(99,239,118,.0)); }
.hub-background .arrow-bg.right::after { border-color: rgba(99,239,118,.9); }
.hub-background .arrow-bg.left { left: 22%; transform: translateX(-100%); }
.hub-background .arrow-bg.right { right: 22%; }
.hub-background .wave { position:absolute; bottom:-1.2vw; width: 50vw; height: 18vw; background-repeat:no-repeat; background-size: contain; opacity: .88; }
.hub-background .wave.left { left:-2vw; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 260'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='0'%3E%3Cstop offset='0%25' stop-color='%230a84ff' stop-opacity='0.95'/%3E%3Cstop offset='100%25' stop-color='%2357d7ff' stop-opacity='0.18'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cg fill='none' stroke='url(%23g)' stroke-width='2'%3E%3Cpath d='M0 180 C120 110 180 235 300 170 S520 95 800 205'/%3E%3Cpath d='M0 192 C130 122 198 247 318 182 S532 107 800 217'/%3E%3Cpath d='M0 204 C140 135 208 258 328 193 S545 120 800 229'/%3E%3Cpath d='M0 216 C140 148 218 270 338 207 S556 133 800 241'/%3E%3C/g%3E%3C/svg%3E"); }
.hub-background .wave.right { right:-2vw; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 260'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='0'%3E%3Cstop offset='0%25' stop-color='%2363ef76' stop-opacity='0.18'/%3E%3Cstop offset='100%25' stop-color='%2363ef76' stop-opacity='0.95'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cg fill='none' stroke='url(%23g)' stroke-width='2'%3E%3Cpath d='M0 205 C250 98 468 180 588 115 S720 110 800 145'/%3E%3Cpath d='M0 217 C250 110 478 192 598 127 S728 122 800 157'/%3E%3Cpath d='M0 229 C258 122 488 204 610 139 S740 134 800 169'/%3E%3Cpath d='M0 241 C265 134 498 216 620 151 S752 146 800 181'/%3E%3C/g%3E%3C/svg%3E"); }
.hub-view { padding-bottom: 34px; }
.hub-map { position:relative; min-height: calc(100vh - 120px); overflow:hidden; }
.hub-lines { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:2; }
.hub-core { position:absolute; left:50%; top:44%; transform: translate(-50%, -50%); z-index:3; display:grid; justify-items:center; width:min(500px, 40vw); gap: 12px; }
.hub-core-symbol { width:min(230px, 18vw); max-width:230px; filter: drop-shadow(0 0 22px rgba(0,194,255,.18)); }
.hub-core-wordmark { position:relative; z-index:3; }
.hub-apps { position:absolute; inset:0; z-index:4; }
.hub-app-tile { position:absolute; width:min(300px, 24vw); min-width:250px; padding:22px 22px 20px; border-radius:28px; background: linear-gradient(180deg, rgba(7,18,35,.68), rgba(5,13,25,.86)); border:1px solid rgba(105,205,255,.18); backdrop-filter: blur(14px); box-shadow: 0 20px 44px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.03); display:grid; gap:12px; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.hub-app-tile:hover { transform: translate(-50%, -50%) scale(1.018); border-color: rgba(105,205,255,.42); box-shadow: 0 24px 52px rgba(0,0,0,.34), 0 0 24px rgba(0,194,255,.08); }
.hub-app-icon { width:74px; height:74px; border-radius:50%; position:relative; border:1px solid rgba(105,205,255,.42); box-shadow: inset 0 0 18px rgba(0,194,255,.08); background: radial-gradient(circle at 50% 38%, rgba(14,38,71,.9), rgba(5,14,28,.64)); }
.hub-app-icon::after { content:""; position:absolute; left:50%; top:50%; transform: translate(-50%, -50%); width:34px; height:34px; background-position:center; background-repeat:no-repeat; background-size:contain; opacity:.92; }
.hub-app-icon--governance::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%236dcfff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M32 8l20 8v14c0 11-8 20-20 26C20 50 12 41 12 30V16l20-8z'/%3E%3Cpath d='M32 24l8 8-8 8-8-8 8-8z'/%3E%3C/g%3E%3C/svg%3E"); }
.hub-app-icon--suivi::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%2363ef76' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 50V30M28 50V20M42 50V26M50 50V14'/%3E%3Cpath d='M10 50h44'/%3E%3C/g%3E%3C/svg%3E"); }
.hub-app-icon--default::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%236dcfff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 18h36v28H14z'/%3E%3Cpath d='M24 24h16M24 32h12'/%3E%3C/g%3E%3C/svg%3E"); }
.tile-title { font-size:1.05rem; font-weight:800; color: var(--nx-text); }
.tile-description { color: var(--nx-muted); line-height:1.45; min-height:2.8em; }
.tile-action { display:inline-flex; align-items:center; gap:10px; width:fit-content; min-height:46px; padding:0 18px; border-radius:14px; border:1px solid rgba(105,205,255,.24); color:#77ddff; font-weight:700; }
.hub-app-tile:hover .tile-action { border-color: rgba(105,205,255,.42); color:#a5ecff; }
.hub-empty { position:absolute; left:50%; top:58%; transform: translate(-50%, -50%); width:min(520px, 90vw); padding:28px; }
.hub-connector { fill:none; stroke:url(#line-gradient); stroke-width:2.6; stroke-linecap:round; opacity:.88; }
@media (max-width: 1200px) {
  .page-container { width: calc(100vw - 32px); }
  .hub-core { width:min(460px, 52vw); }
  .hub-app-tile { width:min(300px, 28vw); }
}
@media (max-width: 900px) {
  .topbar, .hub-topbar { flex-direction:column; }
  .topbar nav, .hub-topbar-actions { justify-content:flex-start; }
  .inline-form, .form-grid.two-cols { grid-template-columns: 1fr; }
  .hub-map { min-height: 1000px; }
  .hub-background .center-glow, .hub-background .center-rings, .hub-background .center-rings::before, .hub-background .center-rings::after { top: 24%; }
  .hub-background .arrow-bg { display:none; }
  .hub-core { top:24%; width:min(420px, 80vw); }
  .hub-core-symbol { width:min(180px, 42vw); }
  .hub-app-tile { width:min(88vw, 360px); }
}


/* ===== v7 background image integration ===== */
.auth-card {
  background: linear-gradient(180deg, rgba(16, 31, 57, 0.72), rgba(7, 18, 35, 0.82));
}
.auth-logo-lockup { margin-bottom: 10px; }
.auth-logo-brand {
  width: min(420px, 86%);
  height: auto;
  display: block;
  border-radius: 14px;
}
.auth-subtitle { margin-top: 2px; }

.hub-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    linear-gradient(rgba(2,7,16,.18), rgba(2,7,16,.18)),
    url("img/nexus-hub-background.png") center center / cover no-repeat;
}
.hub-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2,7,16,.18) 0%, rgba(2,7,16,.06) 35%, rgba(2,7,16,.18) 100%);
}
.hub-background .mesh,
.hub-background .center-glow,
.hub-background .center-rings,
.hub-background .arrow-bg,
.hub-background .wave { display:none !important; }

.hub-view {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.hub-map {
  position: relative;
  min-height: calc(100vh - 112px);
  overflow: hidden;
}
.hub-lines,
.hub-core { display:none !important; }
.hub-apps {
  position: absolute;
  inset: 0;
  z-index: 4;
}
.hub-app-tile {
  width: min(270px, 22vw);
  min-width: 250px;
  padding: 22px 22px 20px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(7, 18, 35, .68), rgba(5, 13, 25, .86));
  border: 1px solid rgba(105,205,255,.22);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 42px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.03);
}
.hub-app-tile:hover {
  transform: translate(-50%, -50%) scale(1.02);
  border-color: rgba(105,205,255,.42);
  box-shadow: 0 22px 48px rgba(0,0,0,.34), 0 0 24px rgba(0,194,255,.08);
}
.hub-app-icon { width: 88px; height: 88px; }
.hub-app-icon::after { width: 42px; height: 42px; }
.tile-title { font-size: 1.12rem; }
.tile-description { font-size: 1rem; min-height: 3.1em; }
.tile-action {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 13px;
  border: 1px solid rgba(105,205,255,.24);
  color: #77ddff;
}
.hub-empty {
  position: absolute;
  left: 50%;
  top: 78%;
  transform: translate(-50%, -50%);
  width: min(520px, 90vw);
  padding: 28px;
}
@media (max-width: 900px) {
  .auth-logo-brand { width: min(360px, 90%); }
  .hub-map { min-height: 980px; }
  .hub-app-tile { width: min(88vw, 340px); }
}
