/* --------------------------------------------------------------
   Nucleus platform design tokens (enterprise navy system)
   Source of truth for hex values: Server.UI/Themes/Theme.cs (PlatformNavy*)
   Prefixed --nx-* to avoid colliding with MudBlazor / tenant vars.
   Stages 1–6: foundation through Home hierarchy.
   Stage 7: corporate visual foundation — restrained shell + landings.
   Brief brand-* names map to --nx-brand-navy-* (no second prefix).
--------------------------------------------------------------- */

:root {
  /* Brand navy scale (brief: brand-navy-*) */
  --nx-brand-navy-950: #102A43;
  --nx-brand-navy-900: #163654;
  --nx-brand-navy-800: #1C4266;
  --nx-brand-navy-700: #23527B;
  --nx-brand-navy-600: #315F86;
  --nx-brand-navy-500: #4B7393;
  --nx-brand-navy-400: #7399B8;
  --nx-brand-navy-300: #9CBBD1;
  --nx-brand-navy-200: #C8D8E4;
  --nx-brand-navy-100: #E5EDF4;
  --nx-brand-navy-50: #F2F6F9;

  /* Neutral application surfaces */
  --nx-surface-page: #F7F8FA;
  --nx-surface-card: #FFFFFF;
  --nx-surface-subtle: #F4F6F8;
  --nx-surface-hover: #F2F5F7;
  --nx-surface-selected: #EAF0F5;

  /* Typography */
  --nx-text-heading: #223142;
  --nx-text-primary: #3B4A5A;
  --nx-text-secondary: #657485;
  --nx-text-muted: #7D8996;
  --nx-text-disabled: #A2ACB6;
  --nx-text-link: #28577F;

  /* Borders */
  --nx-border-default: #D8E0E7;
  --nx-border-subtle: #E3E8ED;
  --nx-border-strong: #C8D2DC;
  --nx-border-hover: #AEBFCD;
  --nx-border-focus: #315F86;

  /* Panel hierarchy (landing working panels vs side utility) */
  --nx-panel-border-primary: var(--nx-border-strong);
  --nx-panel-shadow-primary: var(--nx-shadow-panel);
  --nx-panel-border-secondary: var(--nx-border-subtle);
  --nx-panel-shadow-secondary: var(--nx-shadow-subtle);

  /* Icon tiles */
  --nx-icon-tile-bg: #E5EDF4;
  --nx-icon-tile-fg: #315F86;

  /* Semantic (status only — not decorative chrome) */
  --nx-semantic-info: #315F86;
  --nx-semantic-info-bg: #E5EDF4;
  --nx-semantic-success: #33765A;
  --nx-semantic-success-bg: #E8F3ED;
  --nx-semantic-warning: #A86B14;
  --nx-semantic-warning-bg: #FFF2D9;
  --nx-semantic-danger: #B84444;
  --nx-semantic-danger-bg: #FBEAEA;

  /* Shape */
  --nx-radius-panel: 6px;
  --nx-radius-card: 6px;
  --nx-radius-control: 5px;
  --nx-radius-icon: 5px;
  --nx-radius-pill: 999px;
  --nx-radius-small: 5px;
  --nx-radius-medium: 6px;
  --nx-radius-large: 8px;

  /* Elevation (restrained — no large soft shadows) */
  --nx-shadow-subtle: 0 1px 2px rgba(16, 42, 67, 0.035);
  --nx-shadow-panel: 0 2px 5px rgba(16, 42, 67, 0.045);
  --nx-shadow-hover: 0 3px 8px rgba(16, 42, 67, 0.065);
  --nx-shadow-card: var(--nx-shadow-subtle);
  --nx-shadow-card-hover: var(--nx-shadow-hover);

  /* Spacing scale */
  --nx-space-1: 4px;
  --nx-space-2: 8px;
  --nx-space-3: 12px;
  --nx-space-4: 16px;
  --nx-space-5: 20px;
  --nx-space-6: 24px;
  --nx-space-8: 32px;

  /* Module icon tone variants (coordinated navy family) */
  --nx-icon-primary-bg: var(--nx-icon-tile-bg);
  --nx-icon-primary-fg: var(--nx-icon-tile-fg);
  --nx-icon-secondary-bg: #EEF2F5;
  --nx-icon-secondary-fg: #4B7393;
  --nx-icon-slate-bg: #EEF2F5;
  --nx-icon-slate-fg: #4B5F70;
  --nx-icon-teal-navy-bg: #E8F0F1;
  --nx-icon-teal-navy-fg: #366572;
}

/* ---------------------------------------------------------------------------
   Landing primitives only — do not wrap all operational content in cards.
   --------------------------------------------------------------------------- */

/* Hub / landing interactive tiles */
.nx-hub-card {
  background: var(--nx-surface-card);
  border: 1px solid var(--nx-border-default);
  border-radius: var(--nx-radius-card);
  box-shadow: var(--nx-shadow-subtle);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.nx-hub-card.nx-hub-card--interactive {
  cursor: pointer;
}

.nx-hub-card.nx-hub-card--interactive:hover {
  border-color: var(--nx-border-hover);
  box-shadow: var(--nx-shadow-hover);
  /* No translateY — restrained corporate chrome */
}

.nx-hub-card.nx-hub-card--interactive:focus-visible {
  outline: 2px solid var(--nx-border-focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .nx-hub-card {
    transition: none;
  }
}

/* Working / utility panels (landings) */
.nx-panel {
  background: var(--nx-surface-card);
  border: 1px solid var(--nx-border-default);
  border-radius: var(--nx-radius-panel);
  box-shadow: var(--nx-shadow-subtle);
  box-sizing: border-box;
}

.nx-panel--primary {
  border-color: var(--nx-panel-border-primary);
  box-shadow: var(--nx-panel-shadow-primary);
}

.nx-panel--secondary {
  border-color: var(--nx-panel-border-secondary);
  box-shadow: var(--nx-panel-shadow-secondary);
}

/* Full-width list rows — not nested cards */
.nx-list-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  border: none;
  border-radius: var(--nx-radius-control);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color 120ms ease;
}

.nx-list-row:hover {
  background: var(--nx-surface-hover);
}

.nx-list-row:focus-visible {
  outline: 2px solid var(--nx-border-focus);
  outline-offset: 1px;
}

.nx-list-row--selected,
.nx-list-row.is-selected {
  background: var(--nx-surface-selected);
}

/* Module / list row icon tiles */
.nx-module-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--nx-radius-icon);
  background: var(--nx-brand-navy-100);
  color: var(--nx-brand-navy-600);
  flex-shrink: 0;
}

.nx-module-icon--sm {
  width: 2rem;
  height: 2rem;
}

.nx-module-icon--primary {
  background: var(--nx-icon-primary-bg);
  color: var(--nx-icon-primary-fg);
}

.nx-module-icon--secondary {
  background: var(--nx-icon-secondary-bg);
  color: var(--nx-icon-secondary-fg);
}

.nx-module-icon--slate {
  background: var(--nx-icon-slate-bg);
  color: var(--nx-icon-slate-fg);
}

.nx-module-icon--teal-navy {
  background: var(--nx-icon-teal-navy-bg);
  color: var(--nx-icon-teal-navy-fg);
}

.nx-module-icon--warning {
  background: var(--nx-semantic-warning-bg);
  color: var(--nx-semantic-warning);
}

.nx-module-icon--danger {
  background: var(--nx-semantic-danger-bg);
  color: var(--nx-semantic-danger);
}

/* ---------------------------------------------------------------------------
   Lists / grids — shared enterprise chrome (Stage 3)
   --------------------------------------------------------------------------- */

.module-datagrid .mud-table-head .mud-table-cell,
.modern-data-grid-wrapper .mud-table-head .mud-table-cell {
  background: var(--nx-surface-subtle, var(--mud-palette-background-grey)) !important;
  color: var(--nx-text-secondary, var(--mud-palette-text-secondary));
  font-weight: 600;
  border-bottom-color: var(--nx-border-default, var(--mud-palette-table-lines)) !important;
}

.module-datagrid .mud-table-row:hover .mud-table-cell,
.modern-data-grid-wrapper .mud-table-row:hover .mud-table-cell {
  background: var(--nx-surface-hover, var(--mud-palette-table-hover)) !important;
}

/* ---------------------------------------------------------------------------
   Entity / detail chrome (Stage 4) — token only, no layout redesign
   --------------------------------------------------------------------------- */

.entity-view-header-with-border {
  border-bottom: 1px solid var(--nx-border-subtle, var(--mud-palette-lines-default));
}

.entity-view-sidebar,
.module-aside-panel,
.nucleus-detail-side-panel {
  background: var(--nx-surface-card, var(--mud-palette-surface));
}

.nucleus-definition-section,
.entity-v2-detail-section,
.property-v2-section {
  border-color: var(--nx-border-subtle, var(--mud-palette-lines-default));
}
