/* NEONMONKI / Evidence operating system
   Primitive palette → semantic roles → component composition. */
:root {
  color-scheme: dark;
  --nm-p-night: #050810;
  --nm-p-surface: #0c1220;
  --nm-p-raised: #111a2b;
  --nm-p-line: #1a2540;
  --nm-p-cyan: #22d3ee;
  --nm-p-green: #34d399;
  --nm-p-amber: #fbbf24;
  --nm-p-red: #f87171;
  --nm-p-muted: #a0a0a0;

  --nm-bg: var(--nm-p-night);
  --nm-surface: var(--nm-p-surface);
  --nm-raised: var(--nm-p-raised);
  --nm-line: var(--nm-p-line);
  --nm-text: #e7edf5;
  --nm-text-soft: #c5cfdd;
  --nm-muted: var(--nm-p-muted);
  --nm-info: var(--nm-p-cyan);
  --nm-success: var(--nm-p-green);
  --nm-warning: var(--nm-p-amber);
  --nm-danger: var(--nm-p-red);
  --nm-neutral: var(--nm-p-muted);

  --nm-font-read: "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --nm-font-mono: "IBM Plex Mono", "SFMono-Regular", "Cascadia Code", "Liberation Mono", Menlo, Consolas, "PingFang SC", "Microsoft YaHei", monospace;
  --nm-nav-width: 248px;
  --nm-inspector-width: 320px;
  --nm-topbar-height: 64px;
  --nm-scopebar-height: 52px;
  --nm-radius: 2px;
  --nm-ease: cubic-bezier(0.22, 1, 0.36, 1);

  font-family: var(--nm-font-read);
  font-size: 16px;
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  background: var(--nm-bg);
  color: var(--nm-text);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  max-width: 100%;
  min-height: 100%;
  background: var(--nm-bg);
  scrollbar-color: #34425c var(--nm-bg);
  scrollbar-width: thin;
}

body {
  min-width: 0;
  max-width: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow-x: clip;
  background: var(--nm-bg);
  color: var(--nm-text);
  font-family: var(--nm-font-read);
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.nm-navigation-open {
  overflow: hidden;
}

#app {
  min-width: 0;
  min-height: 100dvh;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  overflow-wrap: anywhere;
  font-weight: 600;
  line-height: 1.25;
}

h1 {
  max-width: 900px;
  font-size: clamp(1.75rem, 2.4vw, 2.5rem);
  letter-spacing: -0.035em;
}

h2 {
  font-size: 1.0625rem;
  letter-spacing: -0.012em;
}

h3 {
  font-size: 1rem;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
select,
summary,
input[type="checkbox"],
input[type="radio"],
input[type="file"] {
  touch-action: manipulation;
}

button,
select,
summary {
  cursor: pointer;
}

button {
  color: inherit;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

a {
  color: var(--nm-info);
}

svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: rgba(34, 211, 238, 0.25);
  color: var(--nm-text);
}

:focus-visible {
  outline: 2px solid var(--nm-info);
  outline-offset: 3px;
}

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

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

::-webkit-scrollbar-thumb {
  border: 2px solid var(--nm-bg);
  background: #34425c;
}

.nm-icon {
  flex: 0 0 auto;
}

.nm-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  margin: -1px !important;
  border: 0 !important;
  padding: 0 !important;
  white-space: nowrap !important;
}

.nm-skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 12px;
  padding: 10px 14px;
  border: 1px solid var(--nm-info);
  background: var(--nm-raised);
  color: var(--nm-text);
  font-family: var(--nm-font-mono);
  font-size: 0.75rem;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 160ms var(--nm-ease);
}

.nm-skip-link:focus {
  transform: translateY(0);
}

/* Application shell */
.nm-shell {
  min-width: 0;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--nm-nav-width) minmax(0, 1fr);
}

.nm-nav {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  width: var(--nm-nav-width);
  height: 100dvh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--nm-line);
  background: var(--nm-surface);
}

.nm-nav__brand {
  min-width: 0;
  min-height: 84px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--nm-line);
}

.nm-nav__mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--nm-info);
  color: var(--nm-info);
  font-family: var(--nm-font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.nm-nav__brand > div {
  min-width: 0;
}

.nm-nav__brand strong,
.nm-nav__brand span:not(.nm-nav__mark) {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nm-nav__brand strong {
  color: var(--nm-text);
  font-family: var(--nm-font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

.nm-nav__brand > div > span {
  margin-top: 3px;
  color: var(--nm-muted);
  font-size: 0.6875rem;
  line-height: 1.35;
}

.nm-nav__close {
  display: none !important;
  margin-left: auto;
}

.nm-nav__role {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--nm-line);
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nm-nav__links {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 20px;
  overscroll-behavior: contain;
}

.nm-nav__group + .nm-nav__group {
  margin-top: 20px;
}

.nm-nav__group-label {
  margin: 0 8px 7px;
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.nm-nav__link {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 2px 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--nm-radius);
  background: transparent;
  color: var(--nm-text-soft);
  font-size: 0.875rem;
  text-align: left;
  transition: border-color 140ms ease-out, background-color 140ms ease-out, color 140ms ease-out;
}

.nm-nav__link::after {
  width: 4px;
  height: 4px;
  flex: 0 0 4px;
  margin-left: auto;
  background: currentColor;
  content: "";
  opacity: 0;
}

.nm-nav__link:hover {
  border-color: var(--nm-line);
  background: var(--nm-raised);
  color: var(--nm-text);
}

.nm-nav__link[aria-current="page"] {
  border-color: rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.075);
  color: var(--nm-info);
}

.nm-nav__link[aria-current="page"]::after {
  opacity: 1;
}

.nm-nav__link > span:not(.nm-nav__badge) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nm-nav__badge {
  min-width: 22px;
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid var(--nm-line);
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.625rem;
  line-height: 1.5;
  text-align: center;
}

.nm-nav__link[aria-current="page"] .nm-nav__badge {
  border-color: rgba(34, 211, 238, 0.35);
  color: var(--nm-info);
}

.nm-nav__link[aria-current="page"]::after {
  display: none;
}

.nm-nav__link:has(.nm-nav__badge)::after {
  display: none;
}

.nm-nav__foot {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--nm-line);
  background: var(--nm-bg);
}

.nm-nav__foot-mark {
  color: var(--nm-info);
}

.nm-nav__foot strong,
.nm-nav__foot span {
  display: block;
}

.nm-nav__foot strong {
  font-size: 0.8125rem;
}

.nm-nav__foot div > span {
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nm-nav-backdrop {
  display: none;
}

.nm-app {
  min-width: 0;
  grid-column: 2;
}

.nm-topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  min-width: 0;
  min-height: var(--nm-topbar-height);
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--nm-line);
  background: rgba(5, 8, 16, 0.96);
  backdrop-filter: blur(12px);
}

.nm-topbar__menu {
  display: none;
}

.nm-global-search {
  width: 100%;
  max-width: 620px;
  min-width: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 12px;
  border: 1px solid var(--nm-line);
  border-radius: var(--nm-radius);
  background: var(--nm-surface);
  color: var(--nm-muted);
  transition: border-color 140ms ease-out, background-color 140ms ease-out;
}

.nm-global-search:focus-within {
  border-color: var(--nm-info);
  background: var(--nm-raised);
}

.nm-global-search input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 7px 0;
  color: var(--nm-text);
  font-size: 0.875rem;
}

.nm-global-search input::placeholder,
.nm-field input::placeholder,
.nm-field textarea::placeholder {
  color: #8993a3;
  opacity: 1;
}

.nm-search-submit {
  width: 40px;
  min-height: 38px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid var(--nm-line);
  background: transparent;
  color: var(--nm-info);
  transition: background-color 140ms ease-out;
}

.nm-search-submit:hover {
  background: rgba(34, 211, 238, 0.08);
}

.nm-language,
.nm-account {
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 1px solid var(--nm-line);
  border-radius: var(--nm-radius);
  background: var(--nm-surface);
  transition: border-color 140ms ease-out, background-color 140ms ease-out;
}

.nm-language:hover,
.nm-account:hover {
  border-color: #38516c;
  background: var(--nm-raised);
}

.nm-language {
  gap: 8px;
  padding: 8px 12px;
  color: var(--nm-info);
  font-family: var(--nm-font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.nm-account {
  min-width: 0;
  gap: 9px;
  padding: 5px 9px 5px 6px;
  text-align: left;
}

.nm-account__avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border: 1px solid #35435e;
  background: var(--nm-raised);
  color: var(--nm-info);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
}

.nm-account__copy {
  min-width: 0;
}

.nm-account__copy strong,
.nm-account__copy small {
  max-width: 132px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nm-account__copy strong {
  font-size: 0.75rem;
  font-weight: 600;
}

.nm-account__copy small {
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.625rem;
}

.nm-account > .nm-icon {
  color: var(--nm-muted);
}

.nm-scopebar {
  position: sticky;
  z-index: 35;
  top: var(--nm-topbar-height);
  min-width: 0;
  min-height: var(--nm-scopebar-height);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 24px;
  border-bottom: 1px solid var(--nm-line);
  background: rgba(12, 18, 32, 0.97);
  backdrop-filter: blur(12px);
}

.nm-scope {
  min-width: 0;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 18px;
  color: var(--nm-muted);
}

.nm-scope + .nm-scope {
  padding-left: 18px;
  border-left: 1px solid var(--nm-line);
}

.nm-scope__label {
  flex: 0 0 auto;
  font-family: var(--nm-font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nm-scope select {
  min-width: 0;
  max-width: 210px;
  min-height: 36px;
  border: 0;
  outline-offset: 2px;
  background: var(--nm-surface);
  padding: 5px 24px 5px 4px;
  color: var(--nm-text);
  font-size: 0.8125rem;
  font-weight: 600;
  text-overflow: ellipsis;
}

.nm-engine-status {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-left: 18px;
  color: var(--nm-text-soft);
  font-size: 0.75rem;
  white-space: nowrap;
}

.nm-engine-status > small {
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nm-app__body {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.nm-app__body.has-inspector {
  grid-template-columns: minmax(0, 1fr) var(--nm-inspector-width);
}

.nm-workspace {
  width: 100%;
  max-width: 1500px;
  min-width: 0;
  margin: 0 auto;
  padding: 30px 28px 56px;
}

.nm-workspace > div {
  min-width: 0;
}

.nm-inspector {
  position: sticky;
  top: calc(var(--nm-topbar-height) + var(--nm-scopebar-height));
  width: var(--nm-inspector-width);
  max-width: 100%;
  height: calc(100dvh - var(--nm-topbar-height) - var(--nm-scopebar-height));
  min-width: 0;
  overflow-y: auto;
  border-left: 1px solid var(--nm-line);
  background: var(--nm-surface);
  overscroll-behavior: contain;
}

.nm-inspector__header {
  position: sticky;
  z-index: 1;
  top: 0;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 8px 18px;
  border-bottom: 1px solid var(--nm-line);
  background: var(--nm-raised);
}

.nm-inspector__header h2 {
  font-family: var(--nm-font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nm-inspector__content {
  min-width: 0;
  padding: 18px;
}

/* Shared controls */
.nm-button {
  min-width: 0;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid #33445f;
  border-radius: var(--nm-radius);
  background: var(--nm-raised);
  color: var(--nm-text-soft);
  font-family: var(--nm-font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  transition: border-color 140ms ease-out, background-color 140ms ease-out, color 140ms ease-out, transform 100ms ease-out;
}

.nm-button:hover {
  border-color: #4b6584;
  background: #17243a;
  color: var(--nm-text);
}

.nm-button:active {
  transform: translateY(1px);
}

.nm-button--primary {
  border-color: var(--nm-info);
  background: var(--nm-info);
  color: #06171c;
}

.nm-button--primary:hover {
  border-color: #72e5f5;
  background: #72e5f5;
  color: #06171c;
}

.nm-button--ghost,
.nm-button--quiet {
  border-color: transparent;
  background: transparent;
  color: var(--nm-info);
}

.nm-button--ghost:hover,
.nm-button--quiet:hover {
  border-color: var(--nm-line);
  background: rgba(34, 211, 238, 0.07);
  color: #72e5f5;
}

.nm-button--danger {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.08);
  color: var(--nm-danger);
}

.nm-button--danger:hover {
  border-color: var(--nm-danger);
  background: rgba(248, 113, 113, 0.14);
  color: #fda4a4;
}

.nm-button--small {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 0.6875rem;
}

.nm-button--large {
  min-height: 46px;
  padding-inline: 18px;
}

.nm-icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--nm-radius);
  background: transparent;
  color: var(--nm-muted);
  transition: border-color 140ms ease-out, background-color 140ms ease-out, color 140ms ease-out;
}

.nm-icon-button:hover {
  border-color: var(--nm-line);
  background: var(--nm-raised);
  color: var(--nm-info);
}

.nm-icon-button--secondary {
  border-color: var(--nm-line);
  background: var(--nm-surface);
}

.nm-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--nm-info);
  font-family: var(--nm-font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.nm-link:hover {
  color: #72e5f5;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nm-badge,
.nm-status {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--nm-text-soft);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
}

.nm-badge {
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid #33445f;
  border-radius: var(--nm-radius);
  background: var(--nm-raised);
}

.nm-status__dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border: 1px solid currentColor;
  background: currentColor;
}

.nm-badge--info,
.nm-status--info {
  color: var(--nm-info);
}

.nm-badge--info {
  border-color: rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.07);
}

.nm-badge--success,
.nm-status--success {
  color: var(--nm-success);
}

.nm-badge--success {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.07);
}

.nm-badge--warning,
.nm-status--warning {
  color: var(--nm-warning);
}

.nm-badge--warning {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.07);
}

.nm-badge--danger,
.nm-status--danger {
  color: var(--nm-danger);
}

.nm-badge--danger {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.07);
}

/* Workspace headings and ruled surfaces */
.nm-page-header {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--nm-line);
}

.nm-page-header__copy {
  min-width: 0;
}

.nm-eyebrow {
  margin-bottom: 8px;
  color: var(--nm-info);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.nm-page-header__description {
  max-width: 72ch;
  margin-top: 10px;
  color: var(--nm-muted);
  font-size: 1rem;
  line-height: 1.65;
}

.nm-page-header__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 14px;
}

.nm-page-header__actions,
.nm-panel__actions {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.nm-page-header__actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.nm-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--nm-line);
  border-radius: var(--nm-radius);
  background: var(--nm-surface);
}

.nm-panel__header {
  min-width: 0;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--nm-line);
  background: var(--nm-raised);
}

.nm-panel__heading {
  min-width: 0;
}

.nm-panel__heading .nm-eyebrow {
  margin-bottom: 3px;
  font-size: 0.625rem;
}

.nm-panel__body {
  min-width: 0;
  padding: 18px;
  color: var(--nm-text-soft);
}

.nm-panel__footer {
  min-width: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--nm-line);
  background: var(--nm-bg);
}

.nm-panel--flush .nm-panel__body {
  padding: 0;
}

.nm-panel .nm-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.nm-pattern,
.nm-pattern > section {
  min-width: 0;
}

.nm-pattern {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.nm-pattern > section {
  display: grid;
  align-content: start;
  gap: 16px;
}

.nm-pattern__metrics,
.nm-pattern__summary,
.nm-pattern__comparison,
.nm-pattern__toolbar,
.nm-pattern__activity,
.nm-pattern__records,
.nm-pattern__terms,
.nm-pattern__requirements {
  grid-column: 1 / -1;
}

.nm-pattern__focus,
.nm-pattern__queue,
.nm-pattern__connections,
.nm-pattern__primary,
.nm-pattern__lines,
.nm-pattern__evidence,
.nm-pattern__capabilities {
  grid-column: span 8;
}

.nm-pattern__review,
.nm-pattern__decision,
.nm-pattern__secondary,
.nm-pattern__inspector,
.nm-pattern__identity {
  grid-column: span 4;
}

.nm-pattern__activity {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Operational readouts */
.nm-metrics {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  border: 1px solid var(--nm-line);
  background: var(--nm-surface);
}

.nm-metric {
  min-width: 0;
  min-height: 118px;
  padding: 16px;
  border-right: 1px solid var(--nm-line);
}

.nm-metric:last-child {
  border-right: 0;
}

.nm-metric__label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.nm-metric__value {
  display: block;
  margin-top: 12px;
  color: var(--nm-text);
  font-family: var(--nm-font-mono);
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.045em;
}

.nm-metric__detail {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
  color: var(--nm-muted);
  font-size: 0.75rem;
}

.nm-metric__delta {
  color: var(--nm-info);
  font-family: var(--nm-font-mono);
}

.nm-metric[data-tone="success"] .nm-metric__delta {
  color: var(--nm-success);
}

.nm-metric[data-tone="warning"] .nm-metric__delta {
  color: var(--nm-warning);
}

.nm-metric[data-tone="danger"] .nm-metric__delta {
  color: var(--nm-danger);
}

.nm-definition-list {
  min-width: 0;
  display: grid;
  gap: 0 20px;
}

.nm-definition-list--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nm-definition-list--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nm-definition-list--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nm-definition-list__item {
  min-width: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--nm-line);
}

.nm-definition-list dt {
  margin-bottom: 4px;
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nm-definition-list dd {
  min-width: 0;
  color: var(--nm-text);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.nm-table-scroll {
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  overscroll-behavior-inline: contain;
}

.nm-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--nm-text-soft);
  font-size: 0.8125rem;
  line-height: 1.5;
  text-align: left;
}

.nm-table caption {
  padding: 0 0 12px;
  color: var(--nm-text);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
}

.nm-table th {
  padding: 10px 12px;
  border-bottom: 1px solid #30415e;
  background: var(--nm-raised);
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.nm-table td {
  min-width: 0;
  padding: 12px;
  border-bottom: 1px solid var(--nm-line);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.nm-table tbody tr:last-child td {
  border-bottom: 0;
}

.nm-table tbody tr {
  transition: background-color 140ms ease-out;
}

.nm-table tbody tr:hover,
.nm-table tbody tr.is-selected {
  background: rgba(34, 211, 238, 0.045);
}

.nm-align-right {
  text-align: right;
}

.nm-align-center {
  text-align: center;
}

.nm-row {
  min-width: 0;
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--nm-line);
  transition: background-color 140ms ease-out;
}

.nm-row:last-child {
  border-bottom: 0;
}

.nm-row:hover {
  background: rgba(34, 211, 238, 0.035);
}

.nm-row__leading,
.nm-row__trailing {
  flex: 0 0 auto;
}

.nm-row__leading {
  color: var(--nm-info);
}

.nm-row__trailing {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.nm-row__content {
  min-width: 0;
  flex: 1;
}

.nm-row__title {
  color: var(--nm-text);
  font-size: 0.9375rem;
  font-weight: 600;
}

.nm-row__title--action {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.nm-row__title--action .nm-icon {
  color: var(--nm-info);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 140ms ease-out, transform 140ms ease-out;
}

.nm-row__title--action:hover {
  color: var(--nm-info);
}

.nm-row__title--action:hover .nm-icon,
.nm-row__title--action:focus-visible .nm-icon {
  opacity: 1;
  transform: translateX(0);
}

.nm-row__description {
  max-width: 74ch;
  margin-top: 4px;
  color: var(--nm-muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.nm-row__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
}

.nm-table__action {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--nm-text);
  font-weight: 600;
  text-align: left;
}

.nm-table__action .nm-icon {
  color: var(--nm-info);
}

.nm-table__action:hover {
  color: var(--nm-info);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.nm-empty {
  min-width: 0;
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 32px 20px;
  color: var(--nm-muted);
}

.nm-empty > .nm-icon {
  color: #6f829e;
}

.nm-empty h3 {
  color: var(--nm-text);
}

.nm-empty p {
  max-width: 62ch;
  font-size: 1rem;
}

.nm-empty__action {
  margin-top: 6px;
}

/* Forms */
.nm-form {
  min-width: 0;
}

.nm-form__description {
  max-width: 70ch;
  margin-bottom: 18px;
  color: var(--nm-muted);
  font-size: 1rem;
}

.nm-form__grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.nm-form__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--nm-line);
}

.nm-form__error {
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.07);
  color: var(--nm-danger);
  font-size: 1rem;
}

.nm-field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
}

.nm-field--full {
  grid-column: 1 / -1;
}

.nm-field > label,
.nm-field--checkbox label {
  color: var(--nm-text-soft);
  font-family: var(--nm-font-mono);
  font-size: 0.75rem;
  font-weight: 600;
}

.nm-field input:not([type="checkbox"]):not([type="radio"]),
.nm-field select,
.nm-field textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid #33445f;
  border-radius: var(--nm-radius);
  background: var(--nm-bg);
  padding: 9px 11px;
  color: var(--nm-text);
  font-size: 1rem;
  line-height: 1.45;
  transition: border-color 140ms ease-out, background-color 140ms ease-out;
}

.nm-field input:hover,
.nm-field select:hover,
.nm-field textarea:hover {
  border-color: #4b6584;
}

.nm-field input:focus,
.nm-field select:focus,
.nm-field textarea:focus {
  border-color: var(--nm-info);
  background: #080f1c;
}

.nm-field textarea {
  min-height: 112px;
  resize: vertical;
}

.nm-field input[type="file"] {
  padding: 6px;
}

.nm-field input::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  border: 1px solid #405875;
  background: var(--nm-raised);
  padding: 4px 9px;
  color: var(--nm-info);
  font-family: var(--nm-font-mono);
  font-size: 0.75rem;
}

.nm-field__hint,
.nm-field__error {
  font-size: 0.8125rem;
  line-height: 1.5;
}

.nm-field__hint {
  color: var(--nm-muted);
}

.nm-field__error {
  color: var(--nm-danger);
}

.nm-field--invalid input,
.nm-field--invalid select,
.nm-field--invalid textarea {
  border-color: var(--nm-danger);
}

.nm-field--checkbox label {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.nm-field--checkbox input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
  accent-color: var(--nm-info);
}

/* Tabs, chronology, and progress */
.nm-tabs {
  min-width: 0;
}

.nm-tabs__list {
  max-width: 100%;
  min-width: 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--nm-line);
  overscroll-behavior-inline: contain;
}

.nm-tab {
  min-height: 44px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  padding: 10px 14px;
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  transition: border-color 140ms ease-out, color 140ms ease-out, background-color 140ms ease-out;
}

.nm-tab:hover {
  background: rgba(34, 211, 238, 0.04);
  color: var(--nm-text);
}

.nm-tab[aria-selected="true"] {
  border-bottom-color: var(--nm-info);
  color: var(--nm-info);
}

.nm-tab__badge {
  min-width: 20px;
  padding: 0 5px;
  border: 1px solid var(--nm-line);
  font-size: 0.625rem;
  line-height: 1.6;
  text-align: center;
}

.nm-tabs__panel {
  min-width: 0;
  padding-top: 18px;
}

.nm-timeline {
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nm-timeline__item {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 22px;
}

.nm-timeline__item::before {
  position: absolute;
  top: 12px;
  bottom: -2px;
  left: 4px;
  width: 1px;
  background: var(--nm-line);
  content: "";
}

.nm-timeline__item:last-child {
  padding-bottom: 0;
}

.nm-timeline__item:last-child::before {
  display: none;
}

.nm-timeline__marker {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border: 2px solid var(--nm-surface);
  outline: 1px solid var(--nm-info);
  background: var(--nm-info);
}

.nm-timeline__item[data-tone="success"] .nm-timeline__marker {
  outline-color: var(--nm-success);
  background: var(--nm-success);
}

.nm-timeline__item[data-tone="warning"] .nm-timeline__marker {
  outline-color: var(--nm-warning);
  background: var(--nm-warning);
}

.nm-timeline__item[data-tone="danger"] .nm-timeline__marker {
  outline-color: var(--nm-danger);
  background: var(--nm-danger);
}

.nm-timeline__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.nm-timeline__heading h3 {
  color: var(--nm-text);
  font-size: 0.875rem;
}

.nm-timeline__heading time {
  flex: 0 0 auto;
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
}

.nm-timeline__content > p {
  margin-top: 5px;
  color: var(--nm-muted);
  font-size: 0.875rem;
}

.nm-timeline__meta {
  margin-top: 8px;
}

.nm-stepper {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.nm-stepper__step {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px 12px 0;
  color: var(--nm-muted);
}

.nm-stepper__step::after {
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--nm-line);
  content: "";
}

.nm-stepper__index {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: grid;
  place-items: center;
  border: 1px solid #34445e;
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.625rem;
}

.nm-stepper__label,
.nm-stepper__description {
  display: block;
}

.nm-stepper__label {
  color: var(--nm-text-soft);
  font-size: 0.8125rem;
  font-weight: 600;
}

.nm-stepper__description {
  margin-top: 3px;
  font-size: 0.75rem;
}

.nm-stepper__step[data-state="current"]::after {
  background: var(--nm-info);
}

.nm-stepper__step[data-state="current"] .nm-stepper__index {
  border-color: var(--nm-info);
  color: var(--nm-info);
}

.nm-stepper__step[data-state="current"] .nm-stepper__label {
  color: var(--nm-info);
}

.nm-stepper__step[data-state="complete"] .nm-stepper__index {
  border-color: var(--nm-success);
  color: var(--nm-success);
}

.nm-progress {
  min-width: 0;
}

.nm-progress + .nm-progress {
  margin-top: 16px;
}

.nm-progress__labels,
.nm-bar-chart__labels {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--nm-text-soft);
  font-size: 0.8125rem;
}

.nm-progress__labels strong,
.nm-bar-chart__labels strong {
  color: var(--nm-text);
  font-family: var(--nm-font-mono);
  font-weight: 500;
}

.nm-progress__track,
.nm-bar-chart__track {
  height: 5px;
  overflow: hidden;
  background: var(--nm-line);
}

.nm-progress__track > span,
.nm-bar-chart__track > span {
  height: 100%;
  display: block;
  transform-origin: left;
  background: var(--nm-info);
}

.nm-progress__track > span {
  width: var(--nm-progress);
}

.nm-progress--success .nm-progress__track > span {
  background: var(--nm-success);
}

.nm-progress--warning .nm-progress__track > span {
  background: var(--nm-warning);
}

.nm-progress--danger .nm-progress__track > span {
  background: var(--nm-danger);
}

.nm-bar-chart {
  min-width: 0;
}

.nm-bar-chart figcaption {
  margin-bottom: 16px;
  color: var(--nm-text);
  font-size: 0.875rem;
  font-weight: 600;
}

.nm-bar-chart ul {
  display: grid;
  gap: 15px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nm-bar-chart__track > span {
  width: var(--nm-bar);
  background: var(--nm-bar-tone);
}

/* Evidence, review, and four-stage comparison */
.nm-evidence {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--nm-line);
}

.nm-evidence:first-child {
  padding-top: 0;
}

.nm-evidence:last-child {
  border-bottom: 0;
}

.nm-evidence__rail {
  color: var(--nm-info);
}

.nm-evidence__content {
  min-width: 0;
}

.nm-evidence__header {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.nm-evidence__source {
  margin-bottom: 4px;
  color: var(--nm-info);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.nm-evidence__header h3 {
  color: var(--nm-text);
}

.nm-evidence blockquote {
  max-width: 72ch;
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 1px solid var(--nm-info);
  background: rgba(34, 211, 238, 0.035);
  color: var(--nm-text-soft);
  font-size: 1rem;
  line-height: 1.6;
}

.nm-evidence__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  color: var(--nm-muted);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
}

.nm-evidence__actions {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.nm-review-state {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.045);
}

.nm-review-state--success {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.045);
}

.nm-review-state--danger {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.045);
}

.nm-review-state--info {
  border-color: rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.045);
}

.nm-review-state__icon {
  color: var(--nm-warning);
}

.nm-review-state--success .nm-review-state__icon {
  color: var(--nm-success);
}

.nm-review-state--danger .nm-review-state__icon {
  color: var(--nm-danger);
}

.nm-review-state--info .nm-review-state__icon {
  color: var(--nm-info);
}

.nm-review-state__copy {
  min-width: 0;
}

.nm-review-state__title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.nm-review-state__copy > p {
  max-width: 72ch;
  margin-top: 5px;
  color: var(--nm-text-soft);
  font-size: 0.875rem;
}

.nm-review-state__reviewer {
  margin-top: 8px;
  color: var(--nm-muted);
  font-size: 0.75rem;
}

.nm-review-state__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nm-comparison {
  min-width: 0;
}

.nm-comparison__title {
  margin-bottom: 14px;
}

.nm-comparison__grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(150px, 1.15fr) repeat(var(--nm-stages), minmax(0, 1fr));
  border-top: 1px solid var(--nm-line);
  border-left: 1px solid var(--nm-line);
}

.nm-comparison__corner,
.nm-comparison__stage,
.nm-comparison__label,
.nm-comparison__value {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--nm-line);
  border-bottom: 1px solid var(--nm-line);
  overflow-wrap: anywhere;
}

.nm-comparison__corner,
.nm-comparison__stage {
  background: var(--nm-raised);
}

.nm-comparison__stage > span {
  display: block;
  color: var(--nm-info);
  font-family: var(--nm-font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nm-comparison__stage > small,
.nm-comparison__label > small {
  display: block;
  margin-top: 4px;
  color: var(--nm-muted);
  font-size: 0.6875rem;
  font-weight: 400;
}

.nm-comparison__label {
  background: var(--nm-surface);
}

.nm-comparison__label > strong {
  color: var(--nm-text-soft);
  font-size: 0.75rem;
  font-weight: 600;
}

.nm-comparison__value {
  position: relative;
  background: var(--nm-bg);
  color: var(--nm-text);
  font-family: var(--nm-font-mono);
  font-size: 0.75rem;
  line-height: 1.55;
}

.nm-comparison__value[data-changed="true"] {
  background: rgba(34, 211, 238, 0.055);
  color: #b7f4fc;
}

.nm-comparison__value[data-changed="true"]::after {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 4px;
  height: 4px;
  background: var(--nm-info);
  content: "";
}

/* Modal and toast */
.nm-dialog {
  width: min(640px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: min(88dvh, 920px);
  min-width: 0;
  overflow: hidden;
  border: 1px solid #405875;
  border-radius: var(--nm-radius);
  background: var(--nm-surface);
  padding: 0;
  color: var(--nm-text);
  box-shadow: 0 24px 80px rgba(2, 5, 12, 0.6);
}

.nm-dialog--small {
  width: min(440px, calc(100vw - 32px));
}

.nm-dialog--large {
  width: min(920px, calc(100vw - 32px));
}

.nm-dialog[open] {
  display: flex;
  flex-direction: column;
}

.nm-dialog::backdrop {
  background: rgba(2, 5, 12, 0.84);
  backdrop-filter: blur(3px);
}

.nm-dialog__header {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 16px 16px 20px;
  border-bottom: 1px solid var(--nm-line);
  background: var(--nm-raised);
}

.nm-dialog__header h2 {
  font-size: 1.125rem;
}

.nm-dialog__header p {
  max-width: 64ch;
  margin-top: 5px;
  color: var(--nm-muted);
  font-size: 0.875rem;
}

.nm-dialog__body {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  overscroll-behavior: contain;
}

.nm-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--nm-line);
  background: var(--nm-bg);
}

.nm-notice {
  position: fixed;
  z-index: 80;
  right: 18px;
  bottom: 18px;
  width: min(460px, calc(100vw - 36px));
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: start;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(52, 211, 153, 0.5);
  background: #0c211f;
  color: var(--nm-success);
  box-shadow: 0 16px 48px rgba(2, 5, 12, 0.5);
}

.nm-notice--info {
  border-color: rgba(34, 211, 238, 0.5);
  background: #0b1d28;
  color: var(--nm-info);
}

.nm-notice--warning {
  border-color: rgba(251, 191, 36, 0.5);
  background: #211b0d;
  color: var(--nm-warning);
}

.nm-notice--danger {
  border-color: rgba(248, 113, 113, 0.5);
  background: #251215;
  color: var(--nm-danger);
}

.nm-notice__copy {
  min-width: 0;
  color: var(--nm-text);
}

.nm-notice__copy strong {
  font-size: 0.875rem;
}

.nm-notice__copy p {
  margin-top: 3px;
  color: var(--nm-text-soft);
  font-size: 0.8125rem;
}

.nm-notice__action {
  align-self: center;
}

/* Medium workspaces */
@media (max-width: 1280px) {
  .nm-app__body.has-inspector {
    grid-template-columns: minmax(0, 1fr);
  }

  .nm-inspector {
    position: static;
    width: 100%;
    height: auto;
    max-height: none;
    border-top: 1px solid var(--nm-line);
    border-left: 0;
  }

  .nm-inspector__content {
    padding: 22px 28px;
  }

  .nm-account__copy {
    display: none;
  }

  .nm-pattern__focus,
  .nm-pattern__queue,
  .nm-pattern__connections,
  .nm-pattern__primary,
  .nm-pattern__lines,
  .nm-pattern__evidence,
  .nm-pattern__capabilities,
  .nm-pattern__review,
  .nm-pattern__decision,
  .nm-pattern__secondary,
  .nm-pattern__inspector,
  .nm-pattern__identity {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  :root {
    --nm-nav-width: 220px;
  }

  .nm-topbar,
  .nm-scopebar {
    padding-inline: 18px;
  }

  .nm-topbar {
    gap: 10px;
  }

  .nm-scope__label {
    display: none;
  }

  .nm-engine-status > small {
    display: none;
  }

  .nm-workspace {
    padding-inline: 22px;
  }

  .nm-page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .nm-page-header__actions {
    justify-content: flex-start;
  }
}

/* Navigation drawer */
@media (max-width: 960px) {
  :root {
    --nm-nav-width: 288px;
  }

  .nm-shell {
    display: block;
  }

  .nm-app {
    width: 100%;
  }

  .nm-nav {
    width: min(var(--nm-nav-width), calc(100vw - 40px));
    transform: translateX(-100%);
    transition: transform 180ms var(--nm-ease);
  }

  .is-navigation-open .nm-nav {
    transform: translateX(0);
  }

  .nm-nav__close {
    display: inline-grid !important;
  }

  .nm-nav-backdrop {
    position: fixed;
    z-index: 45;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(2, 5, 12, 0.78);
  }

  .nm-topbar {
    grid-template-columns: 42px minmax(0, 1fr) auto auto;
  }

  .nm-topbar__menu {
    display: block;
  }

  .nm-global-search {
    max-width: none;
  }

  .nm-definition-list--3,
  .nm-definition-list--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  :root {
    --nm-topbar-height: 56px;
    --nm-scopebar-height: 100px;
  }

  .nm-topbar {
    min-height: 56px;
    grid-template-columns: 44px minmax(0, 1fr) auto auto;
    gap: 6px;
    padding: 6px 12px;
  }

  .nm-global-search {
    min-height: 44px;
    padding-left: 9px;
  }

  .nm-global-search input {
    min-height: 42px;
    font-size: 1rem;
  }

  .nm-search-submit {
    display: none;
  }

  .nm-language {
    min-height: 44px;
    padding: 8px 9px;
  }

  .nm-language > .nm-icon {
    display: none;
  }

  .nm-account {
    width: 44px;
    height: 44px;
    justify-content: center;
    padding: 0;
  }

  .nm-account > .nm-icon {
    display: none;
  }

  .nm-scopebar {
    min-height: 100px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 12px;
  }

  .nm-scope {
    min-height: 52px;
    gap: 6px;
    padding-right: 8px;
  }

  .nm-scope + .nm-scope {
    padding-left: 10px;
  }

  .nm-scope select {
    width: 100%;
    max-width: none;
    min-height: 44px;
    font-size: 0.75rem;
  }

  .nm-engine-status {
    min-height: 44px;
    grid-column: 1 / -1;
    margin-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--nm-line);
  }

  .nm-workspace {
    padding: 22px 12px 40px;
  }

  .nm-inspector__content {
    padding: 18px 12px;
  }

  .nm-page-header {
    margin-bottom: 18px;
    padding-bottom: 18px;
  }

  .nm-page-header__actions,
  .nm-page-header__actions .nm-button {
    width: 100%;
  }

  .nm-panel__header {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 12px;
  }

  .nm-panel__body {
    padding: 14px;
  }

  .nm-panel__actions {
    width: 100%;
  }

  .nm-pattern {
    gap: 12px;
  }

  .nm-pattern > section {
    gap: 12px;
  }

  .nm-pattern__activity {
    grid-template-columns: minmax(0, 1fr);
  }

  .nm-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nm-metric {
    min-height: 108px;
    padding: 13px;
    border-bottom: 1px solid var(--nm-line);
  }

  .nm-metric:nth-child(2n) {
    border-right: 0;
  }

  .nm-metric:last-child,
  .nm-metric:nth-last-child(2):nth-child(odd) {
    border-bottom: 0;
  }

  .nm-metric:nth-child(odd):last-child {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .nm-form__grid,
  .nm-definition-list--2,
  .nm-definition-list--3,
  .nm-definition-list--4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .nm-form__actions .nm-button {
    flex: 1 1 auto;
  }

  .nm-row {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 12px;
  }

  .nm-row__trailing {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
    padding-left: 0;
  }

  .nm-row__leading + .nm-row__content + .nm-row__trailing {
    padding-left: 34px;
  }

  .nm-evidence {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .nm-evidence__actions {
    grid-column: 2;
  }

  .nm-evidence__header {
    flex-direction: column;
  }

  .nm-review-state {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .nm-review-state__actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .nm-comparison__grid {
    grid-template-columns: minmax(0, 1fr);
    border-left: 0;
  }

  .nm-comparison__corner,
  .nm-comparison__stage {
    display: none;
  }

  .nm-comparison__label {
    border-left: 1px solid var(--nm-line);
    background: var(--nm-raised);
  }

  .nm-comparison__value {
    display: grid;
    grid-template-columns: minmax(96px, 0.65fr) minmax(0, 1fr);
    gap: 12px;
    border-left: 1px solid var(--nm-line);
  }

  .nm-comparison__value::before {
    color: var(--nm-muted);
    content: attr(data-stage);
    font-family: var(--nm-font-read);
    font-size: 0.75rem;
    font-weight: 600;
  }

  .nm-timeline__heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .nm-stepper {
    grid-template-columns: minmax(0, 1fr);
  }

  .nm-stepper__step {
    padding-right: 0;
  }

  .nm-dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  .nm-dialog__body {
    padding: 14px;
  }

  .nm-notice {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
  }
}

@media (max-width: 420px) {
  .nm-topbar {
    padding-inline: 8px;
  }

  .nm-language {
    padding-inline: 7px;
    font-size: 0.6875rem;
  }

  .nm-scope > .nm-icon {
    display: none;
  }

  .nm-engine-status > span:not(.nm-status) {
    display: none;
  }

  .nm-hide-mobile {
    display: none;
  }

  .nm-table th,
  .nm-table td {
    padding: 10px 8px;
  }

  .nm-notice {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .nm-notice__action {
    grid-column: 2;
    justify-self: start;
  }
}

/* Dense visuals, generous touch targets */
@media (pointer: coarse), (max-width: 720px) {
  .nm-button,
  .nm-icon-button,
  .nm-language,
  .nm-account,
  .nm-nav__link,
  .nm-tab,
  .nm-link,
  .nm-row__title--action,
  .nm-table__action,
  .nm-field--checkbox label,
  .nm-search-submit {
    min-height: 44px;
  }

  .nm-icon-button {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .nm-field input:not([type="checkbox"]):not([type="radio"]),
  .nm-field select,
  .nm-field input::file-selector-button {
    min-height: 44px;
  }

  .nm-field--checkbox input {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
