/* Nexus Intelligence by Mobex — Product Design System
   Loaded alongside Tailwind+DaisyUI for progressive reskin.
   New pages use these tokens/classes. Old pages keep working via Tailwind. */

:root {
  --ni-bg: oklch(99% 0.002 240);
  --ni-surface: oklch(100% 0 0);
  --ni-surface-2: oklch(97% 0.004 245);
  --ni-fg: oklch(18% 0.012 250);
  --ni-muted: oklch(54% 0.012 250);
  --ni-border: oklch(91% 0.006 250);
  --ni-accent: oklch(58% 0.18 255);
  --ni-accent-2: oklch(61% 0.14 168);
  --ni-warn: oklch(68% 0.15 72);
  --ni-danger: oklch(62% 0.18 28);
  --ni-ok: oklch(59% 0.16 150);
  --ni-shadow: 0 18px 55px oklch(20% 0.03 250 / 0.08);
  --ni-radius: 8px;
  --ni-font-display: "Avenir Next", "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --ni-font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --ni-font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

[data-theme="dark"] {
  --ni-bg: oklch(17% 0.018 252);
  --ni-surface: oklch(21% 0.018 252);
  --ni-surface-2: oklch(25% 0.018 252);
  --ni-fg: oklch(95% 0.004 250);
  --ni-muted: oklch(70% 0.014 250);
  --ni-border: oklch(34% 0.018 252);
  --ni-accent: oklch(70% 0.16 252);
  --ni-accent-2: oklch(70% 0.13 165);
  --ni-shadow: 0 18px 55px oklch(5% 0.02 250 / 0.28);
}

/* ── Shell layout ── */
.ni-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  background:
    radial-gradient(circle at 16% -10%, color-mix(in oklch, var(--ni-accent) 16%, transparent), transparent 30rem),
    linear-gradient(180deg, var(--ni-bg), color-mix(in oklch, var(--ni-bg) 86%, var(--ni-accent-2) 14%));
  color: var(--ni-fg);
  font-family: var(--ni-font-body);
}

/* ── Sidebar ── */
.ni-side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--ni-border);
  background: color-mix(in oklch, var(--ni-surface) 68%, transparent);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* ── Brand lockup ── */
.ni-brand {
  display: inline-grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "nexus product"
    "byline product";
  align-items: center;
  column-gap: 10px;
  row-gap: 1px;
  margin-bottom: 22px;
  line-height: 1;
  text-decoration: none;
}

.ni-brand .ni-nexus {
  grid-area: nexus;
  font-family: var(--ni-font-display);
  font-size: 23px;
  font-weight: 250;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  color: var(--ni-fg);
}

.ni-brand .ni-product-line {
  grid-area: product;
  align-self: center;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding-left: 10px;
  border-left: 1px solid color-mix(in oklch, var(--ni-accent) 62%, var(--ni-border));
  color: var(--ni-fg);
  font-family: var(--ni-font-display);
  font-size: 12px;
  font-weight: 680;
  letter-spacing: 0.105em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ni-brand .ni-byline {
  grid-area: byline;
  display: inline-flex;
  align-items: baseline;
  justify-self: end;
  gap: 3px;
  margin-top: -2px;
  padding-right: 2px;
  opacity: 0.62;
}

.ni-brand .ni-by {
  color: var(--ni-muted);
  font-family: var(--ni-font-body);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.ni-brand .ni-mobex {
  font-family: var(--ni-font-display);
  color: var(--ni-muted);
  font-size: 9px;
  font-weight: 420;
  letter-spacing: 0.035em;
}

/* ── Nav ── */
.ni-nav {
  display: grid;
  gap: 4px;
  flex: 1;
}

.ni-nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ni-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.1s, color 0.1s;
}

.ni-nav a:hover,
.ni-nav a.active {
  background: var(--ni-surface-2);
  color: var(--ni-fg);
}

.ni-nav .ni-count {
  font-family: var(--ni-font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

.ni-nav .ni-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.ni-nav a:hover .ni-icon,
.ni-nav a.active .ni-icon {
  opacity: 1;
}

.ni-nav-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Sidebar footer (user, theme) ── */
.ni-side-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--ni-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ni-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.ni-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ni-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.ni-user-info {
  flex: 1;
  min-width: 0;
}

.ni-user-info .ni-email {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ni-user-info .ni-role {
  color: var(--ni-muted);
  font-size: 11px;
}

.ni-side-actions {
  display: flex;
  gap: 6px;
}

.ni-side-actions a,
.ni-side-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--ni-border);
  background: transparent;
  color: var(--ni-muted);
  cursor: pointer;
  transition: background 0.1s;
}

.ni-side-actions a:hover,
.ni-side-actions button:hover {
  background: var(--ni-surface-2);
  color: var(--ni-fg);
}

/* ── Main area ── */
.ni-main {
  min-width: 0;
  padding: 28px;
}

/* ── KPI strip ── */
.ni-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.ni-kpi {
  border: 1px solid var(--ni-border);
  border-radius: var(--ni-radius);
  background: color-mix(in oklch, var(--ni-surface) 92%, transparent);
  box-shadow: var(--ni-shadow);
  padding: 18px;
  display: grid;
  gap: 4px;
}

.ni-kpi strong {
  font-family: var(--ni-font-mono);
  font-size: 28px;
  font-weight: 740;
  letter-spacing: -0.02em;
  color: var(--ni-fg);
}

.ni-kpi span {
  color: var(--ni-muted);
  font-size: 13px;
}

/* ── Status pills ── */
.ni-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ni-surface-2);
  color: var(--ni-muted);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.ni-pill.ok { background: color-mix(in oklch, var(--ni-ok) 8%, var(--ni-surface)); color: var(--ni-ok); }
.ni-pill.warn { background: color-mix(in oklch, var(--ni-warn) 8%, var(--ni-surface)); color: var(--ni-warn); }
.ni-pill.danger { background: color-mix(in oklch, var(--ni-danger) 7%, var(--ni-surface)); color: var(--ni-danger); }
.ni-pill.accent { background: color-mix(in oklch, var(--ni-accent) 8%, var(--ni-surface)); color: var(--ni-accent); }

[data-theme="dark"] .ni-pill.ok { background: color-mix(in oklch, var(--ni-ok) 14%, var(--ni-surface)); }
[data-theme="dark"] .ni-pill.warn { background: color-mix(in oklch, var(--ni-warn) 15%, var(--ni-surface)); }
[data-theme="dark"] .ni-pill.danger { background: color-mix(in oklch, var(--ni-danger) 13%, var(--ni-surface)); }
[data-theme="dark"] .ni-pill.accent { background: color-mix(in oklch, var(--ni-accent) 13%, var(--ni-surface)); }

/* ── Topbar/eyebrow ── */
.ni-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.ni-eyebrow {
  color: var(--ni-muted);
  font-family: var(--ni-font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.ni-page-title {
  font-family: var(--ni-font-display);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 680;
  letter-spacing: 0;
  line-height: 1.1;
  color: var(--ni-fg);
  margin: 0;
}

.ni-lead {
  max-width: 680px;
  margin-top: 8px;
  color: var(--ni-muted);
  font-size: 15px;
}

/* ── Panels ── */
.ni-panel {
  border: 1px solid var(--ni-border);
  border-radius: var(--ni-radius);
  background: color-mix(in oklch, var(--ni-surface) 92%, transparent);
  box-shadow: var(--ni-shadow);
}

.ni-panel.pad { padding: 18px; }

/* ── Mobile responsive ── */
@media (max-width: 980px) {
  .ni-shell { grid-template-columns: 1fr; }
  .ni-side {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--ni-border);
  }
  .ni-nav { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .ni-main { padding: 22px 16px; }
  .ni-kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .ni-side-footer { display: none; }
}

@media (max-width: 560px) {
  .ni-kpi-strip { grid-template-columns: 1fr; }
  .ni-brand .ni-nexus { font-size: 20px; }
  .ni-brand .ni-product-line { font-size: 10px; }
}

/* ── Utility: hide mobile hamburger when shell is visible ── */
.ni-mobile-bar { display: none; }
@media (max-width: 980px) {
  .ni-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--ni-border);
    background: var(--ni-surface);
  }
}
