/* Nexus — the Hub CRM (brief 1427).
   Token parity with the Hub reskin (assets/hub.css :root, 2026-10-26):
   the website's deep-indigo scheme — same values, self-contained so
   Nexus stays liftable into the future Unity app unchanged. */
:root {
  color-scheme: dark;
  --bg: #120C2E;
  --surface: #1E1748;
  --surface-raised: #251C52;
  --surface-soft: #2C2352;
  --text: #F3EDDA;
  --dim: #C9C2A8;
  --border: rgba(196,181,253,.30);
  --accent: #E8C15A;
  --accent-ink: #120C2E;
  --profit: #74AD8C;
  --loss: #D2899E;
  --amber: #E8C15A;
  --radius: 16px;
  --shadow: 0 18px 44px rgba(5,2,20,.45);
  --shadow-control: 0 8px 20px rgba(5,2,20,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.nexus-app {
  background: var(--bg);
  color: var(--text);
  font-family: "Jost", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.nx-visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nx-skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 60;
  background: var(--accent); color: var(--accent-ink);
  padding: .6rem 1rem; border-radius: 0 0 10px 10px;
  font-weight: 600; text-decoration: none;
}
.nx-skip:focus { top: 0; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
h1, h2, h3, .nx-wordmark {
  font-family: "Cinzel", "Jost", serif;
  font-weight: 600;
  letter-spacing: .02em;
  margin: 0;
}
.nx-eyebrow {
  text-transform: uppercase; letter-spacing: .18em;
  font-size: .72rem; color: var(--accent); margin: 0 0 .35rem;
  font-weight: 600;
}

/* ---- shell ---- */
.nx-shell { display: flex; min-height: 100vh; }
.nx-rail {
  width: 264px; flex: 0 0 264px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.4rem 1.1rem;
  display: flex; flex-direction: column; gap: 1.4rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.nx-wordmark { font-size: 1.9rem; color: var(--text); line-height: 1.1; }
.nx-tagline { color: var(--dim); margin: .2rem 0 0; font-size: .9rem; }
.nx-nav { display: flex; flex-direction: column; gap: .25rem; }
.nx-nav a {
  color: var(--text); text-decoration: none;
  padding: .55rem .7rem; border-radius: 10px;
  display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
}
.nx-nav a:hover { background: var(--surface-soft); }
.nx-nav a[aria-current="page"] { background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--border); color: var(--accent); }
.nx-nav-sub { color: var(--dim); font-size: .8rem; }
.nx-nav-group { margin-top: .6rem; }
.nx-nav-heading {
  color: var(--dim); text-transform: uppercase; letter-spacing: .14em;
  font-size: .7rem; margin: 0 .7rem .3rem; font-weight: 600;
}
.nx-nav-group a { font-size: .95rem; }
.nx-badge {
  background: var(--loss); color: #120C2E; font-weight: 700;
  border-radius: 999px; padding: 0 .5rem; font-size: .78rem; line-height: 1.5;
}
.nx-rail-foot { margin-top: auto; }
.nx-back { font-weight: 600; text-decoration: none; }
.nx-rail-note { color: var(--dim); font-size: .82rem; margin: .6rem 0 0; }
.nx-main-wrap { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.nx-topbar {
  display: flex; gap: 1rem; align-items: center;
  padding: 1rem 1.6rem; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 55%, var(--bg));
  position: sticky; top: 0; z-index: 30;
}
.nx-search { position: relative; flex: 1 1 420px; max-width: 560px; }
.nx-search input {
  width: 100%; padding: .62rem .9rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-soft);
  color: var(--text); font: inherit;
}
.nx-search input::placeholder { color: var(--dim); }
.nx-search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + .4rem);
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: .4rem;
  max-height: 60vh; overflow-y: auto; z-index: 40;
}
.nx-search-results a {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .5rem .6rem; border-radius: 8px; color: var(--text); text-decoration: none;
}
.nx-search-results a:hover, .nx-search-results a:focus-visible { background: var(--surface-soft); }
.nx-search-results .nx-sr-kind { color: var(--dim); font-size: .82rem; }
.nx-search-empty { padding: .6rem; color: var(--dim); }
.nx-main { padding: 1.6rem; max-width: 1440px; width: 100%; margin: 0 auto; }
.nx-loading { padding: 3rem 0; }

/* ---- generic pieces ---- */
.nx-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-raised); color: var(--text);
  padding: .55rem 1rem; box-shadow: var(--shadow-control);
}
.nx-btn:hover { background: var(--surface-soft); }
.nx-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.nx-btn-gold { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.nx-btn-gold:hover { background: #F0CD76; }
.nx-btn-quiet { background: transparent; box-shadow: none; }
.nx-btn-danger { background: transparent; color: var(--loss); border-color: var(--loss); box-shadow: none; }
.nx-btn-small { padding: .3rem .6rem; font-size: .88rem; }
.nx-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
  box-shadow: 0 12px 30px rgba(5,2,20,.25);
}
.nx-panel h2 { font-size: 1.15rem; margin-bottom: .4rem; }
.nx-panel h3 { font-size: 1rem; }
.nx-muted { color: var(--dim); }
.nx-empty {
  border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 1.2rem; color: var(--dim); background: transparent;
}
.nx-empty strong { color: var(--text); }
.nx-grid { display: grid; gap: 1rem; }
.nx-kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.nx-kpi .nx-kpi-value { font-family: "Cinzel", serif; font-size: 1.7rem; line-height: 1.15; }
.nx-kpi .nx-kpi-label { color: var(--dim); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; }
.nx-cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.nx-page-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.nx-page-head h1 { font-size: 1.8rem; }
.nx-page-head .nx-sub { color: var(--dim); margin: .25rem 0 0; }

/* ---- tables ---- */
.nx-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.nx-table { border-collapse: collapse; width: 100%; min-width: 640px; }
.nx-table th, .nx-table td { padding: .6rem .8rem; text-align: left; vertical-align: top; }
.nx-table thead th {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--dim); border-bottom: 1px solid var(--border); font-weight: 600;
}
.nx-table tbody tr { border-bottom: 1px solid color-mix(in srgb, var(--border) 45%, transparent); }
.nx-table tbody tr:hover { background: var(--surface-soft); }
.nx-table td a { font-weight: 600; text-decoration: none; }
.nx-table td a:hover { text-decoration: underline; }
.nx-sort-btn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; text-transform: inherit; letter-spacing: inherit; }
.nx-pill {
  display: inline-block; padding: .08rem .55rem; border-radius: 999px;
  border: 1px solid var(--border); font-size: .8rem; font-weight: 600;
  background: var(--surface-soft); color: var(--text); white-space: nowrap;
}
.nx-pill-gold { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.nx-pill-won { background: var(--profit); color: #0E2417; border-color: transparent; }
.nx-pill-lost { background: var(--loss); color: #2E0C18; border-color: transparent; }

/* ---- toolbar / views ---- */
.nx-toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.nx-view-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.nx-chip {
  font: inherit; font-size: .9rem; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 999px; padding: .32rem .8rem;
}
.nx-chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.nx-filter-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
.nx-field { display: flex; flex-direction: column; gap: .25rem; }
.nx-field label { font-size: .82rem; color: var(--dim); font-weight: 600; }
.nx-field input, .nx-field select, .nx-field textarea {
  font: inherit; color: var(--text); background: var(--surface-soft);
  border: 1px solid var(--border); border-radius: 8px; padding: .45rem .6rem;
}
.nx-field textarea { min-height: 5.5rem; resize: vertical; }

/* ---- board ---- */
.nx-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.nx-board-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; min-height: 200px; }
.nx-board-col h3 { font-size: .95rem; display: flex; justify-content: space-between; margin-bottom: .6rem; }
.nx-board-col .nx-col-count { color: var(--dim); font-family: "Jost", sans-serif; }
.nx-card {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: 12px; padding: .7rem .8rem; margin-bottom: .6rem;
}
.nx-card a { font-weight: 600; text-decoration: none; }
.nx-card .nx-card-meta { color: var(--dim); font-size: .85rem; margin-top: .2rem; }
.nx-card .nx-card-actions { display: flex; gap: .35rem; margin-top: .5rem; flex-wrap: wrap; }
.nx-card select { font: inherit; font-size: .85rem; background: var(--surface-soft); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: .2rem .3rem; max-width: 100%; }

/* ---- record page ---- */
.nx-record-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; align-items: start; }
.nx-record-head { margin-bottom: 1rem; }
.nx-record-head h1 { font-size: 2rem; }
.nx-highlight-row { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-top: .5rem; color: var(--dim); }
.nx-highlight-row strong { color: var(--text); font-weight: 600; }
.nx-attr-list { display: flex; flex-direction: column; gap: .9rem; }
.nx-attr label { font-size: .8rem; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; display: block; margin-bottom: .25rem; }
.nx-attr .nx-attr-value { min-height: 1.5rem; }
.nx-attr .nx-attr-edit { width: 100%; }
.nx-related-list { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }

/* ---- timeline ---- */
.nx-composer { margin-bottom: 1.2rem; }
.nx-composer-tabs { display: flex; gap: .4rem; margin-bottom: .6rem; flex-wrap: wrap; }
.nx-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.nx-timeline li {
  border-left: 2px solid var(--border); padding: 0 0 1.1rem 1.1rem; position: relative;
}
.nx-timeline li::before {
  content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent);
}
.nx-timeline .nx-tl-kind { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 700; }
.nx-timeline .nx-tl-title { font-weight: 600; }
.nx-timeline .nx-tl-meta { color: var(--dim); font-size: .85rem; }
.nx-timeline .nx-tl-body { margin-top: .3rem; white-space: pre-wrap; }

/* ---- tasks ---- */
.nx-task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.nx-task {
  display: flex; gap: .7rem; align-items: start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: .65rem .8rem;
}
.nx-task input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin-top: .2rem; accent-color: var(--accent); }
.nx-task .nx-task-title { font-weight: 600; }
.nx-task .nx-task-meta { color: var(--dim); font-size: .86rem; }
.nx-task-done .nx-task-title { text-decoration: line-through; color: var(--dim); }
.nx-overdue { color: var(--loss); font-weight: 700; }

/* ---- reports ---- */
.nx-funnel-row { display: grid; grid-template-columns: 150px 1fr 120px; gap: .8rem; align-items: center; margin-bottom: .5rem; }
.nx-funnel-bar { background: var(--surface-soft); border-radius: 8px; height: 1.5rem; overflow: hidden; }
.nx-funnel-bar span { display: block; height: 100%; background: var(--accent); }
.nx-funnel-row .nx-funnel-val { color: var(--dim); font-size: .9rem; }

/* ---- modal / toast ---- */
.nx-modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,2,20,.7);
  display: flex; align-items: start; justify-content: center;
  padding: 4vh 1rem; z-index: 80; overflow-y: auto;
}
.nx-modal-backdrop[hidden] { display: none; }
.nx-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem; max-width: 640px; width: 100%;
  box-shadow: var(--shadow);
}
.nx-modal h2 { font-size: 1.3rem; margin-bottom: 1rem; }
.nx-form-grid { display: grid; gap: .9rem; }
.nx-form-actions { display: flex; gap: .6rem; margin-top: 1.1rem; flex-wrap: wrap; }
.nx-toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; display: flex; flex-direction: column; gap: .5rem; }
.nx-toast {
  background: var(--surface-raised); border: 1px solid var(--accent);
  color: var(--text); border-radius: 12px; padding: .7rem 1rem;
  box-shadow: var(--shadow); max-width: 360px;
}
.nx-toast-error { border-color: var(--loss); }
.nx-session-panel { max-width: 560px; margin: 3rem auto; text-align: left; }

/* ---- dashboards: switch, controls, charts, finance (brief 1584) ---- */
.nx-switch {
  display: inline-flex; gap: .25rem; padding: .3rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; margin: 0 0 1rem;
}
.nx-switch-opt {
  padding: .45rem 1.2rem; border-radius: 999px;
  color: var(--text); text-decoration: none; font-weight: 600;
}
.nx-switch-opt:hover { background: var(--surface-soft); }
.nx-switch-opt.is-active { background: var(--accent); color: var(--accent-ink); }
.nx-dash-controls {
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: end;
  margin-bottom: 1rem;
}
.nx-controls-note { flex: 1 1 260px; margin: 0; font-size: .9rem; }
.nx-chart { margin: 0 0 1.2rem; }
.nx-chart-title { font-weight: 600; font-size: 1rem; margin-bottom: .5rem; font-family: "Cinzel", serif; letter-spacing: .02em; }
.nx-chart-svg { width: 100%; height: auto; display: block; }
.nx-chart-svg text { font-family: "Jost", sans-serif; font-size: 12px; }
.nx-chart-label { fill: var(--text); }
.nx-chart-value { fill: var(--text); font-weight: 600; }
.nx-chart-axis { fill: var(--dim); }
.nx-chart-grid { stroke: rgba(196,181,253,.25); stroke-width: 1; }
.nx-chart-data { margin-top: .4rem; }
.nx-chart-data summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; padding: .3rem 0; }
.nx-chart-source { color: var(--dim); font-size: .85rem; margin: .5rem 0 0; }
.nx-donut-wrap { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.nx-donut { width: 180px; flex: 0 0 180px; }
.nx-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.nx-legend-dot {
  display: inline-block; width: .7rem; height: .7rem; border-radius: 3px;
  margin-right: .4rem; vertical-align: baseline;
}
.nx-banner {
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: .9rem 1.1rem;
}
.nx-banner-error { border-color: var(--loss); }
.nx-pill-state { text-transform: capitalize; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .nx-shell { flex-direction: column; }
  .nx-rail { width: 100%; flex: none; height: auto; position: static; }
  .nx-nav { flex-direction: row; flex-wrap: wrap; }
  .nx-record-layout { grid-template-columns: 1fr; }
  .nx-main { padding: 1rem; }
  .nx-topbar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
