/* =========================================================================
   Nexus — Neon Blue on Black theme tokens
   Overrides Estate phosphor green. Auditor button keeps phosphor (Estate law).
   ========================================================================= */

:root {
  --nx-bg: #0a0a0a;
  --nx-surface: #111827;
  --nx-border: #1e3a5f;
  --nx-blue: #00aaff;
  --nx-blue-bright: #33ccff;
  --nx-blue-dim: #0d4d6b;
  --nx-glow: rgba(0, 170, 255, 0.4);
  --nx-glow-strong: rgba(0, 170, 255, 0.7);
  --nx-white: #e0e0e0;
  --nx-text-dim: #6688aa;
  --nx-danger: #ff4444;
  --nx-font-head: 'Orbitron', sans-serif;
  --nx-font-mono: 'Share Tech Mono', monospace;
  --nx-grid: rgba(0, 170, 255, 0.04);
  --nx-input-bg: #000000;
  --nx-topbar-h: 52px;

  /* Auditor face — phosphor green on black in EVERY house (Estate law).
     Hardcoded here so Nexus neon tokens never tint the ERROR REPORT button. */
  --nx-auditor-bg: #050505;
  --nx-auditor-phosphor: #00ff41;
  --nx-auditor-dim: #1a4a2a;
  --nx-auditor-hover: #7fff7f;
  --nx-auditor-glow: rgba(0, 255, 65, 0.45);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-radius: 0 !important;
}

html,
body {
  height: 100%;
  background: var(--nx-bg);
  color: var(--nx-blue);
  font-family: var(--nx-font-mono);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  overflow: hidden;
}

body {
  background-image:
    linear-gradient(var(--nx-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--nx-grid) 1px, transparent 1px);
  background-size: 32px 32px;
}

h1,
h2,
h3,
.nx-h1,
.nx-h3 {
  font-family: var(--nx-font-head);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0;
}

.nx-h1 {
  font-weight: 900;
  letter-spacing: 0.18em;
}

.nx-muted {
  color: var(--nx-text-dim);
}

.nx-small {
  font-size: 0.8rem;
}

a {
  color: var(--nx-blue);
}

a:hover {
  color: var(--nx-blue-bright);
}

::selection {
  background: var(--nx-blue-dim);
  color: var(--nx-bg);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--nx-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--nx-blue-dim);
}

body,
.nx-main,
.nx-viewarea {
  scrollbar-color: rgba(0, 170, 255, 0.3) rgba(0, 0, 0, 0.3);
  scrollbar-width: thin;
}

/* -------------------------------------------------------------------------
   CRT scanlines — subtle neon-blue tint
   ------------------------------------------------------------------------- */

.nx-scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 170, 255, 0.02) 0px,
    rgba(0, 170, 255, 0.02) 1px,
    transparent 1px,
    transparent 3px
  );
}

.nx-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.85);
}

/* -------------------------------------------------------------------------
   Corner brackets on cards — top-left + bottom-right, 8px, 1px neon blue
   ------------------------------------------------------------------------- */

.nx-card,
.nx-has-brackets {
  position: relative;
}

.nx-card::before,
.nx-card::after,
.nx-has-brackets::before,
.nx-has-brackets::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  pointer-events: none;
}

.nx-card::before,
.nx-has-brackets::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--nx-blue);
  border-left: 1px solid var(--nx-blue);
}

.nx-card::after,
.nx-has-brackets::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 1px solid var(--nx-blue);
  border-right: 1px solid var(--nx-blue);
}

/* -------------------------------------------------------------------------
   Inputs — black bg + neon blue text (Estate input law, Nexus palette)
   ------------------------------------------------------------------------- */

input,
textarea,
select {
  background: var(--nx-input-bg);
  color: var(--nx-blue);
  border: 1px solid var(--nx-border);
  font-family: var(--nx-font-mono);
  caret-color: var(--nx-blue);
  padding: 0.45rem 0.6rem;
}

input::placeholder,
textarea::placeholder {
  color: var(--nx-blue-dim);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--nx-blue);
  box-shadow: 0 0 10px var(--nx-glow);
}

input:disabled,
textarea:disabled,
select:disabled {
  background: var(--nx-input-bg);
  color: var(--nx-blue-dim);
  border-color: var(--nx-border);
  cursor: not-allowed;
}

/* -------------------------------------------------------------------------
   Buttons (Nexus chrome — neon blue). Auditor is a separate phosphor face.
   ------------------------------------------------------------------------- */

.nx-btn {
  background: transparent;
  border: 1px solid var(--nx-border);
  color: var(--nx-blue);
  font-family: var(--nx-font-head);
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0.45rem 0.9rem;
  min-height: 36px;
  cursor: pointer;
  text-transform: uppercase;
}

.nx-btn:hover {
  color: var(--nx-blue-bright);
  border-color: var(--nx-blue-bright);
}

.nx-btn:focus {
  outline: none;
  box-shadow: 0 0 10px var(--nx-glow);
}

.nx-btn.is-active,
.nx-btn:active {
  box-shadow: 0 0 10px var(--nx-glow);
}

.nx-btn-danger {
  border-color: #6b1a1a;
  color: var(--nx-danger);
}

.nx-btn-danger:hover {
  border-color: var(--nx-danger);
  color: #ff8888;
}

/* =========================================================================
   The Auditor — phosphor-green-on-black face (Estate law).
   Same treatment in every house. Do not restyle with --nx-blue.
   ========================================================================= */

.nx-auditor-btn {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10000;
  background: var(--nx-auditor-bg);
  border: 1px solid var(--nx-auditor-dim);
  color: var(--nx-auditor-dim);
  padding: 0.45rem 0.9rem;
  min-height: 36px;
  cursor: pointer;
  font-family: var(--nx-font-head);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
  box-shadow: none;
  text-shadow: none;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.nx-auditor-btn:hover {
  color: var(--nx-auditor-hover);
  border-color: var(--nx-auditor-hover);
  opacity: 1;
}

.nx-auditor-btn.is-active {
  color: var(--nx-auditor-phosphor);
  border-color: var(--nx-auditor-phosphor);
  opacity: 1;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.8);
  box-shadow: 0 0 12px var(--nx-auditor-glow), inset 0 0 8px rgba(0, 255, 65, 0.2);
  animation: nx-auditor-glow 1.6s ease-in-out infinite alternate;
}

@keyframes nx-auditor-glow {
  from {
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.3), inset 0 0 6px rgba(0, 255, 65, 0.15);
  }
  to {
    box-shadow: 0 0 16px rgba(0, 255, 65, 0.6), inset 0 0 10px rgba(0, 255, 65, 0.28);
  }
}

.nx-auditor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.nx-auditor-modal {
  background: #0c0c0c;
  border: 1px solid var(--nx-auditor-phosphor);
  box-shadow: 0 0 24px rgba(0, 255, 65, 0.35);
  width: min(620px, 96vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.nx-auditor-modal::before,
.nx-auditor-modal::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  pointer-events: none;
}

.nx-auditor-modal::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--nx-auditor-phosphor);
  border-left: 1px solid var(--nx-auditor-phosphor);
}

.nx-auditor-modal::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 1px solid var(--nx-auditor-phosphor);
  border-right: 1px solid var(--nx-auditor-phosphor);
}

.nx-auditor-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--nx-auditor-dim);
  color: var(--nx-auditor-phosphor);
  font-family: var(--nx-font-head);
}

.nx-auditor-modal-x {
  background: transparent;
  border: 1px solid var(--nx-auditor-dim);
  color: var(--nx-auditor-dim);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 0.5rem;
  min-height: 36px;
  cursor: pointer;
}

.nx-auditor-modal-x:hover {
  color: var(--nx-auditor-hover);
  border-color: var(--nx-auditor-hover);
}

.nx-auditor-modal-body {
  padding: 0.9rem;
  overflow: auto;
}

.nx-auditor-summary {
  margin: 0 0 0.9rem;
  padding: 0.7rem;
  background: #000;
  border: 1px solid var(--nx-auditor-dim);
  color: var(--nx-auditor-phosphor);
  font-family: var(--nx-font-mono);
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 50vh;
  overflow: auto;
}

.nx-auditor-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.nx-auditor-actions .nx-auditor-action {
  background: transparent;
  border: 1px solid var(--nx-auditor-dim);
  color: var(--nx-auditor-phosphor);
  font-family: var(--nx-font-head);
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0.4rem 0.9rem;
  min-height: 36px;
  cursor: pointer;
  text-transform: uppercase;
}

.nx-auditor-actions .nx-auditor-action:hover {
  color: var(--nx-auditor-hover);
  border-color: var(--nx-auditor-hover);
}

.nx-auditor-actions .nx-auditor-action.is-danger {
  border-color: #6b1a1a;
  color: #ff5f5f;
}

.nx-auditor-actions .nx-auditor-action.is-danger:hover {
  border-color: #ff5f5f;
  color: #ff8a8a;
}
