/* ============================================================================
   N3XUS desktop - flat surface pass, empty states and the Command Palette.

   Loaded after vivid.css and nexus.css. It replaces the heavy multi-stop
   gradient KPI cards with the same flat card language the mobile app uses, so a
   number reads the same on a phone and on a monitor:

     canvas        #0B1120
     card surface  #111827
     border        1px solid rgba(255,255,255,.08)
     highlight     a 1px inner line at the top of each card
     numbers       tabular-nums, so a live figure never shifts the layout

   The light theme keeps its own palette: nothing here overrides
   html[data-theme="light"].
   ============================================================================ */

html:not([data-theme="light"]) {
  --kd-canvas: #0B1120;
  --kd-surface: #111827;
  --kd-surface-2: #0F172A;
  --kd-line: rgba(255, 255, 255, 0.08);
  --kd-line-strong: rgba(255, 255, 255, 0.14);
  --kd-text: #E5E7EB;
  --kd-dim: #94A3B8;
  --kd-accent: #38BDF8;
}

/* ---------------------------------------------------------------- KPI cards */
html:not([data-theme="light"]) .kpi-card,
html:not([data-theme="light"]) .nexus-metrics article {
  background-image: none !important;
  background-color: var(--kd-surface) !important;
  border: 1px solid var(--kd-line) !important;
  border-radius: 16px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.35) !important;
  color: var(--kd-text);
}
html:not([data-theme="light"]) .kpi-card::after,
html:not([data-theme="light"]) .nexus-metrics article::after {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--kd-line-strong);
  color: var(--kd-dim);
  box-shadow: none;
}
/* The tone survives as a hairline and an icon tint, not as a gradient. */
html:not([data-theme="light"]) .kpi-card { position: relative; overflow: hidden; }
html:not([data-theme="light"]) .kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: var(--kd-accent);
  opacity: .85;
}
html:not([data-theme="light"]) .kpi-card.kpi-royal::before,
html:not([data-theme="light"]) .kpi-card.kpi-blue::before { background: #60A5FA; }
html:not([data-theme="light"]) .kpi-card.kpi-emerald::before,
html:not([data-theme="light"]) .kpi-card.kpi-green::before { background: #34D399; }
html:not([data-theme="light"]) .kpi-card.kpi-amber::before { background: #FBBF24; }
html:not([data-theme="light"]) .kpi-card.kpi-violet::before { background: #A78BFA; }
html:not([data-theme="light"]) .kpi-card.kpi-cyan::before { background: #22D3EE; }

html:not([data-theme="light"]) .kpi-card .kpi-icon,
html:not([data-theme="light"]) .nexus-metrics article .kpi-icon {
  background: rgba(56, 189, 248, 0.10);
  border: 1px solid rgba(56, 189, 248, 0.18);
  color: var(--kd-accent);
  box-shadow: none;
}
html:not([data-theme="light"]) .kpi-card .kpi-label,
html:not([data-theme="light"]) .nexus-metrics span { color: var(--kd-dim); }
html:not([data-theme="light"]) .kpi-card .kpi-value,
html:not([data-theme="light"]) .nexus-metrics b { color: #F8FAFC; }
html:not([data-theme="light"]) .kpi-card .kpi-delta,
html:not([data-theme="light"]) .nexus-metrics small { color: var(--kd-dim); }

/* Every figure in the workspace lines up. */
html:not([data-theme="light"]) .kpi-value,
html:not([data-theme="light"]) .kpi-delta,
html:not([data-theme="light"]) .mini-metric b,
html:not([data-theme="light"]) .summary-strip b,
html:not([data-theme="light"]) .chart-total,
html:not([data-theme="light"]) .dept-row small,
html:not([data-theme="light"]) .result-count,
html:not([data-theme="light"]) .num,
html:not([data-theme="light"]) td.num,
html:not([data-theme="light"]) .metric-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

html:not([data-theme="light"]) .mini-metric,
html:not([data-theme="light"]) .summary-strip > div {
  background: var(--kd-surface);
  border: 1px solid var(--kd-line);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
html:not([data-theme="light"]) .summary-strip { background: transparent; border: 0; }

html:not([data-theme="light"]) .bento,
html:not([data-theme="light"]) .bento-grid > .bento {
  background: var(--kd-surface);
  border: 1px solid var(--kd-line);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ------------------------------------------------------------ empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.012);
}
.empty-state .empty-icon,
.empty-state svg {
  width: 40px;
  height: 40px;
  color: rgba(148, 163, 184, 0.55);
  stroke-width: 1.5;
}
.empty-state h3 { margin: 0; font-size: 15px; color: var(--kd-text, inherit); }
.empty-state p { margin: 0; max-width: 46ch; font-size: 12.5px; color: var(--kd-dim, inherit); }
.empty-state .empty-action {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 11px;
  border: 0;
  background: var(--kd-accent, #2563EB);
  color: #05243A;
  font: 700 12.5px/1 inherit;
  cursor: pointer;
}
.empty-state .empty-action svg { width: 15px; height: 15px; color: inherit; }
html[data-theme="light"] .empty-state { border-color: rgba(15, 23, 42, 0.14); background: rgba(15, 23, 42, 0.02); }
html[data-theme="light"] .empty-state .empty-action { background: #2563EB; color: #fff; }

/* ====================================================== Command Palette */
.cmdk-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  background: rgba(5, 9, 15, 0.62);
  backdrop-filter: blur(6px);
}
.cmdk {
  width: 100%;
  max-width: 620px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #E5E7EB;
}
html[data-theme="light"] .cmdk { background: #fff; color: #0F172A; border-color: rgba(15, 23, 42, .12); }
.cmdk-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
html[data-theme="light"] .cmdk-input-row { border-color: rgba(15, 23, 42, .08); }
.cmdk-input-row svg { width: 18px; height: 18px; color: #94A3B8; flex: 0 0 18px; }
.cmdk input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: 500 15px/1.3 inherit;
  outline: none;
}
.cmdk-kbd {
  font: 600 10px/1 ui-monospace, monospace;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #94A3B8;
}
html[data-theme="light"] .cmdk-kbd { border-color: rgba(15, 23, 42, .16); }
.cmdk-results { overflow-y: auto; padding: 8px; }
.cmdk-group { padding: 8px 8px 4px; font: 700 10px/1 inherit; letter-spacing: 1.4px; color: #94A3B8; text-transform: uppercase; }
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: 500 13.5px/1.35 inherit;
  cursor: pointer;
}
.cmdk-item .cmdk-ico { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; border-radius: 8px; background: rgba(56, 189, 248, 0.10); color: #38BDF8; }
.cmdk-item .cmdk-ico svg { width: 15px; height: 15px; }
.cmdk-item .cmdk-main { flex: 1; min-width: 0; }
.cmdk-item .cmdk-main b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item .cmdk-main small { display: block; font-size: 11.5px; color: #94A3B8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item[aria-selected="true"], .cmdk-item:hover { background: rgba(56, 189, 248, 0.12); }
html[data-theme="light"] .cmdk-item[aria-selected="true"], html[data-theme="light"] .cmdk-item:hover { background: rgba(37, 99, 235, 0.08); }
.cmdk-item .cmdk-go { font-size: 11px; color: #94A3B8; }
.cmdk-empty { padding: 30px 16px; text-align: center; color: #94A3B8; font-size: 13px; }
.cmdk-foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 11px; color: #94A3B8; }
html[data-theme="light"] .cmdk-foot { border-color: rgba(15, 23, 42, .08); }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 5px; }

@media (max-width: 640px) {
  .cmdk-backdrop { padding-top: 8vh; }
  .cmdk { max-height: 78vh; }
}

/* ------------------------------------------------------- industry profile */
.industry-card .settings-title { align-items: flex-start; }
.industry-glyph {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: rgba(56, 189, 248, 0.10);
  border: 1px solid rgba(56, 189, 248, 0.18);
  color: #38BDF8;
}
.industry-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 10px; }
.industry-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid var(--kd-line, rgba(255, 255, 255, .08));
  background: var(--kd-surface-2, #0F172A);
  color: inherit;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease;
}
.industry-option:hover { border-color: var(--kd-line-strong, rgba(255, 255, 255, .14)); }
.industry-option.selected { border-color: #38BDF8; background: rgba(56, 189, 248, .08); }
.industry-option b { font-size: 13.5px; }
.industry-option small { font-size: 11.5px; color: var(--kd-dim, #94A3B8); line-height: 1.5; }
.industry-tick {
  position: absolute; top: 12px; right: 12px;
  font: 700 9.5px/1 inherit; letter-spacing: 1px; text-transform: uppercase;
  color: #05243A; background: #38BDF8; border-radius: 999px; padding: 3px 7px;
}
html[data-theme="light"] .industry-option { background: #F8FAFC; border-color: rgba(15, 23, 42, .12); }
html[data-theme="light"] .industry-option.selected { border-color: #2563EB; background: rgba(37, 99, 235, .06); }
html[data-theme="light"] .industry-tick { background: #2563EB; color: #fff; }
@media (max-width: 720px) { .industry-options { grid-template-columns: 1fr; } }
