/* THE Q NEXUS · THE Q SECTOR edition · shared styles for /nexus/overview, /nexus/globe, /nexus/cross-sector.
   Design source: the canvas "THE Q NEXUS · THE Q SECTOR app" (artboards Main, Overview, Thread).
   Two themes: day (white page, graphite bar) and night (graphite). Q orange #E7772B marks NEXUS itself. */

.nx {
  --page: #FFFFFF; --bar: #15171C; --stage: #FAF8F5; --panel: #FAF8F5; --line: #E4E0D8;
  --text: #15171C; --muted: #555C68; --ink: #AC5114; --chip-bg: #FFFFFF; --chip-line: #C9C3B6;
  --on-bg: #15171C; --on-fg: #F5F2EC; --track: #EEEBE5; --wire: #15171C; --row-on: #F1ECE3; --link: #15171C;
  --ocean0: #FFFFFF; --ocean1: #EEEAE2; --land: #D5CEC0; --border: #FAF8F5; --grat: #E4DFD5; --rim: #15171C;
  --shade: #15171C; --shade-a: .05; --ring: #FFFFFF; --label: #15171C; --label-bg: rgba(255, 255, 255, .86);
  --s1: #9E2B25; --s2: #1F4E8C; --s3: #4E5963; --s4: #5E666F; --s5: #7E6020;   /* sector text */
  --d1: #9E2B25; --d2: #1F4E8C; --d3: #4E5963; --d4: #69717B; --d5: #8A6A1F;   /* sector marks */
  --f1: #9E2B25; --f2: #1F4E8C; --f3: #4E5963; --f4: #69717B; --f5: #8A6A1F;   /* sector fills, white text */
  --cell: 21, 23, 28;
  font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 16px; line-height: 1.55;
  background: var(--page); color: var(--text); min-height: 100vh;
  transition: background-color .5s ease, color .5s ease;
}
html[data-theme="night"] .nx {
  --page: #15171C; --bar: #0E1014; --stage: #181A20; --panel: #1C1F26; --line: #2E333D;
  --text: #F5F2EC; --muted: #B3B8C2; --ink: #E7772B; --chip-bg: #1C1F26; --chip-line: #3A3F4A;
  --on-bg: #F5F2EC; --on-fg: #15171C; --track: #2A2E36; --wire: #0E1014; --row-on: #262A33; --link: #C9CDD4;
  --ocean0: #262B35; --ocean1: #15171C; --land: #3B414C; --border: #1C1F25; --grat: #252932; --rim: #4A505C;
  --shade: #000000; --shade-a: .17; --ring: #15171C; --label: #F5F2EC; --label-bg: rgba(21, 23, 28, .8);
  --s1: #E86A61; --s2: #5A8FDB; --s3: #9AA6B2; --s4: #B8C0C9; --s5: #D2A847;
  --d1: #E86A61; --d2: #5A8FDB; --d3: #9AA6B2; --d4: #B8C0C9; --d5: #D2A847;
  --cell: 245, 242, 236;
}
body { margin: 0; }
.nx *, .nx *::before, .nx *::after { box-sizing: border-box; }
.nx a { color: var(--ink); }
.nx a:hover { color: #E7772B; }
.nx button:focus-visible, .nx a:focus-visible, .nx input:focus-visible { outline: 2px solid #E7772B; outline-offset: 2px; }
.nx-wrap { max-width: 1360px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }
.nx-mono { font-family: 'IBM Plex Mono', monospace; }
.nx-serif { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; }
.nx-eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .1em; color: var(--ink); }
.nx-label { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .1em; color: var(--muted); }
.nx-h1 { margin: 8px 0 0; font-family: 'Cormorant Garamond', Georgia, serif; font-size: clamp(38px, 5.4vw, 56px); font-weight: 600; line-height: 1.02; }
.nx-h2 { margin: 0; font-size: 13px; letter-spacing: .1em; font-weight: 600; }
.nx-card { border: 1px solid var(--line); background: var(--panel); transition: background-color .5s ease; }
.nx-muted { color: var(--muted); }

/* header */
.nx-head { background: var(--bar); color: #F5F2EC; border-bottom: 3px solid #E7772B; transition: background-color .5s ease; }
.nx-head .nx-wrap { padding-top: 12px; padding-bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.nx-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #F5F2EC !important; }
.nx-q { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: #E7772B; color: #14161B; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 24px; font-weight: 600; }
.nx-brand-name { display: flex; flex-direction: column; line-height: 1.1; }
.nx-brand-name b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 22px; font-weight: 600; letter-spacing: .14em; }
.nx-brand-name span { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .08em; color: #B3B8C2; }
.nx-nav { display: flex; flex-wrap: wrap; gap: 0 22px; font-size: 14px; }
.nx-nav a, .nx-nav span { color: #F5F2EC; text-decoration: none; padding: 11px 0; }
.nx-nav span { cursor: default; }
.nx-nav a[aria-current="page"] { color: #E7772B; font-weight: 600; padding-bottom: 9px; border-bottom: 2px solid #E7772B; }
.nx-tools { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.nx-live { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .06em; color: #B3B8C2; display: inline-flex; align-items: center; gap: 8px; }
.nx-dot { width: 7px; height: 7px; border-radius: 50%; background: #E7772B; display: inline-block; }
.nx-theme { display: inline-flex; border: 1px solid #3A3F4A; }
.nx-theme button { min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: #F5F2EC; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.nx-theme button[aria-pressed="true"] { background: #E7772B; color: #14161B; }
.nx-theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nx-tag { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .08em; border: 1px solid #E7772B; color: #E7772B; padding: 4px 8px; }

/* hero and figures */
.nx-hero { padding-top: 34px; display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: flex-end; }
.nx-hero > div:first-child { flex: 999 1 560px; min-width: 0; }
.nx-kpis { display: flex; flex-wrap: wrap; border-left: 1px solid var(--line); }
.nx-kpi { padding: 0 22px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.nx-kpi:last-child { border-right: 0; }
.nx-kpi b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 38px; font-weight: 600; line-height: 1; }
.nx-kpi span, .nx-kpi a { font-size: 13px; color: var(--muted); }

/* buttons and chips */
.nx-btn { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--chip-line); background: var(--chip-bg); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; transition: background-color .2s ease, color .2s ease; }
.nx-btn[aria-pressed="true"] { background: var(--on-bg); color: var(--on-fg); border-color: var(--on-bg); }
.nx-btn .nx-num { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 18px; font-weight: 600; }
.nx-btn[aria-pressed="true"] .nx-num { color: inherit !important; }
.nx-btn svg { width: 15px; height: 15px; }
.nx-sec { font-family: 'IBM Plex Mono', monospace; font-size: 11px; padding: 2px 7px; color: #FFFFFF; white-space: nowrap; }
.nx-sev { font-family: 'IBM Plex Mono', monospace; font-size: 11px; padding: 1px 6px; border: 1px solid var(--chip-line); color: var(--muted); }
.nx-sev.s4 { background: #E7772B; border-color: #E7772B; color: #14161B; }

/* footer */
.nx-foot { margin-top: 48px; background: var(--bar); color: #B3B8C2; font-size: 13px; transition: background-color .5s ease; }
.nx-foot .nx-wrap { padding-top: 26px; padding-bottom: 26px; display: flex; flex-wrap: wrap; gap: 8px 32px; }
.nx-foot a { color: #F5F2EC; }

/* motion */
@keyframes nxPulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(2.4); opacity: 0; } }
.nx-pulse { position: absolute; inset: 0; border-radius: 50%; animation: nxPulse 2.4s ease-out infinite; pointer-events: none; }
@keyframes nxBlink { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
.nx-blink { animation: nxBlink 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .nx-pulse, .nx-blink { animation: none; } }

@media (max-width: 640px) {
  .nx-wrap { padding-left: 16px; padding-right: 16px; }
  .nx-kpi { padding: 0 14px; }
  .nx-kpi b { font-size: 30px; }
  .nx-hide-sm { display: none !important; }
}

/* ---------- Globe ---------- */
.nx-filter { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 0; }
.nx-filter-group { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 14px; }
.nx-filter-group .nx-label { padding-top: 14px; min-width: 64px; }
.nx-filter-rows { display: flex; flex-direction: column; gap: 8px; }
.nx-filter-row { display: flex; flex-wrap: nowrap; gap: 8px; }
.nx-filter-win { margin-left: auto; }
.nx-main { padding-top: 24px; display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.nx-stage { flex: 999 1 620px; min-width: 0; border: 1px solid var(--line); background: var(--stage); padding: 16px 18px 18px; transition: background-color .5s ease; }
.nx-stage-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.nx-stage-bar .nx-btn svg { fill: currentColor; }
.nx-stage-bar .nx-btn .ico-line { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.nx-globe { position: relative; width: 100%; max-width: 740px; margin: 10px auto 0; aspect-ratio: 1 / 1; }
.nx-globe svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; overflow: visible; }
.nx-globe svg.dragging { cursor: grabbing; }
.g-grat { fill: none; stroke: var(--grat); stroke-width: .7; }
.g-land { fill: var(--land); stroke: none; }
.g-borders { fill: none; stroke: var(--border); stroke-width: .6; }
.g-night { fill: var(--shade); fill-opacity: var(--shade-a); stroke: none; }
.g-rim { fill: none; stroke: var(--rim); stroke-width: 1.2; }
.g-arc { fill: none; stroke-width: 1.3; stroke-opacity: .5; }
.g-trail { fill: none; stroke-width: 2.6; stroke-linecap: round; }
.g-sun { fill: none; stroke: #E7772B; stroke-width: 1.4; }
.g-sun-dot { fill: #E7772B; stroke: none; }
.nx-marker { position: absolute; min-width: 44px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0; margin: 0; border: 0; background: none; cursor: pointer; color: var(--label); }
.nx-marker .disc { position: relative; display: block; }
.nx-marker .fill { position: absolute; inset: 0; border-radius: 50%; }
.nx-marker .code { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 500; letter-spacing: .04em; line-height: 16px; padding: 0 4px; background: var(--label-bg); }
.nx-head-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; pointer-events: none; }
.nx-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.nx-legend { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: center; font-size: 13px; color: var(--muted); }
.nx-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.nx-aside { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.nx-bar-row { display: grid; grid-template-columns: 118px minmax(0, 1fr) 30px; align-items: center; gap: 10px; font-size: 14px; transition: opacity .3s ease; }
.nx-track { display: block; height: 10px; background: var(--track); }
.nx-track > span { display: block; height: 10px; transition: width .5s ease; }
.nx-ev { display: flex; flex-direction: column; gap: 4px; padding: 12px 22px 14px; border-top: 1px solid var(--line); text-decoration: none; color: var(--text) !important; }
.nx-wire { position: relative; background: var(--wire); color: #F5F2EC; border-top: 3px solid #E7772B; padding: 18px 22px 20px; display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: center; transition: background-color .5s ease; }
.nx-wire-prog { position: absolute; left: 0; bottom: 0; height: 3px; background: #E7772B; }
@media (max-width: 640px) {
  .nx-filter-win { margin-left: 0; }
  .nx-filter-row .nx-name { display: none; }
  .nx-filter-row .nx-btn { padding: 0 14px; }
  .nx-stage { padding: 12px; }
  .nx-bar-row { grid-template-columns: 104px minmax(0, 1fr) 26px; }
}

/* ---------- Overview ---------- */
.nx-sectors { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.nx-scard { border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; transition: opacity .3s ease, background-color .5s ease; }
.nx-scard.dim { opacity: .55; }
.nx-scard-num { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; color: #FFFFFF; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 20px; font-weight: 600; }
.nx-scard-foot { display: flex; border-top: 1px solid var(--line); margin-top: auto; }
.nx-scard-foot button, .nx-scard-foot a { flex: 1; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
.nx-scard-foot button { border-right: 1px solid var(--line); }
.nx-scard-foot button[aria-pressed="true"] { background: var(--on-bg); color: var(--on-fg); }
.nx-ind { font-family: 'IBM Plex Mono', monospace; font-size: 11px; padding: 2px 7px; border: 1px solid var(--chip-line); color: var(--text); }
.nx-feed-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) 20px; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text) !important; }
.nx-matrix { margin-top: 14px; display: grid; grid-template-columns: 52px repeat(5, minmax(0, 1fr)); gap: 4px; align-items: center; }
.nx-matrix button { height: 44px; border: 0; font-family: 'IBM Plex Mono', monospace; font-size: 14px; font-weight: 500; cursor: pointer; }
.nx-matrix button[aria-pressed="true"] { box-shadow: inset 0 0 0 3px #E7772B; }
.nx-matrix .diag { height: 44px; display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--track); }
.nx-list-item { display: block; padding: 12px 20px; border-top: 1px solid var(--line); text-decoration: none; color: var(--text) !important; }

/* ---------- Cross-sector · thread replay ---------- */
.nx-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.nx-tabs a, .nx-tabs span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--chip-line); color: var(--text) !important; text-decoration: none; font-size: 14px; }
.nx-tabs span { background: var(--on-bg); color: var(--on-fg) !important; border-color: var(--on-bg); }
.nx-controls { border: 1px solid var(--line); background: var(--panel); padding: 12px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.nx-play { min-height: 44px; padding: 0 18px; display: inline-flex; align-items: center; gap: 10px; border: 0; background: var(--on-bg); color: var(--on-fg); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.nx-play svg { width: 14px; height: 14px; fill: currentColor; }
.nx-range { flex: 1 1 280px; min-width: 160px; accent-color: #E7772B; height: 44px; }
.nx-chart { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 0 12px; }
.nx-lanes, .nx-plot { position: relative; height: 380px; }
.nx-lane-label { position: absolute; left: 0; transform: translateY(-50%); display: flex; align-items: center; gap: 10px; font-size: 14px; }
.nx-lane-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }
.nx-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.nx-link-done { fill: none; stroke: var(--link); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.nx-link-grow { fill: none; stroke: #E7772B; stroke-width: 2.2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.nx-tip { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #E7772B; box-shadow: 0 0 10px #E7772B; pointer-events: none; }
.nx-node { position: absolute; }
.nx-node .fill { position: absolute; inset: 0; border-radius: 50%; }
.nx-ticks { position: relative; height: 26px; margin-top: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--muted); }
.nx-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.nx-log button { width: 100%; display: grid; grid-template-columns: 64px 132px minmax(0, 1fr) 90px; gap: 12px; align-items: center; min-height: 46px; padding: 6px 18px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; transition: opacity .3s ease, background-color .3s ease; }
.nx-log button.off { opacity: .38; }
.nx-log button.cur { background: var(--row-on); }
@media (max-width: 640px) {
  .nx-chart { grid-template-columns: 84px minmax(0, 1fr); }
  .nx-lane-label { font-size: 12px; gap: 6px; }
  .nx-lanes, .nx-plot { height: 300px; }
  .nx-log button { grid-template-columns: 52px minmax(0, 1fr); }
  .nx-log button .nx-sec, .nx-log button .from { display: none; }
  .nx-feed-row { grid-template-columns: 52px minmax(0, 1fr); }
  .nx-feed-row > span:last-child { display: none; }
}
