/* Application shell and legacy UI adapters share the same semantic components. */
.nx body {
  margin: 0;
  background: var(--nx-bg);
  color: var(--nx-text);
  font-family: var(--nx-font);
}
.nx .nx-application {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
  overflow: hidden;
}
.nx .nx-app-header {
  position: relative !important;
  padding: 12px 16px !important;
  z-index: 20 !important;
  min-width: 0;
  background: var(--nx-surface) !important;
}
.nx .nx-app-header > div {
  max-width: 1160px !important;
  min-width: 0;
  flex-wrap: wrap;
}
.nx .nx-app-header > div:first-child > div:first-child {
  min-width: 130px;
}
.nx .nexus-header-actions {
  gap: 8px !important;
}
.nx .nexus-header-actions button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px !important;
}
.nx .nexus-header-actions select {
  font-size: 0.875rem !important;
  min-height: 44px;
  max-width: 160px !important;
}
.nx .nx-app-header > div:nth-child(2) {
  font-size: 0.875rem !important;
  padding: 8px 12px !important;
  margin-top: 8px !important;
}
.nx .nexus-content {
  max-width: 1160px !important;
  padding: 24px !important;
  min-width: 0;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  scroll-padding-block: 24px;
}
.nx .nx-app-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  position: relative;
  flex: none;
  min-width: 0;
  padding: 8px max(12px, var(--nexus-safe-right))
    max(12px, var(--nexus-safe-bottom)) max(12px, var(--nexus-safe-left));
  background: var(--nx-surface);
  border-top: 1px solid var(--nx-border);
  z-index: 20;
}
.nx .nx-app-nav button {
  min-height: 44px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--nx-text-muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.nx .nx-app-nav button[aria-current="page"] {
  color: var(--nx-primary);
  background: var(--nx-primary-soft);
  box-shadow: inset 0 -3px var(--nx-primary);
}
.nx .nexus-app {
  --nexus-page-bg: var(--nx-bg) !important;
  --nexus-surface: var(--nx-surface) !important;
  --nexus-muted: var(--nx-text-muted) !important;
  --nexus-touch-min: 44px !important;
}
.nx .nx-button {
  min-height: 44px !important;
  line-height: 1.4;
}
.nx .nx-control:not([type="checkbox"]):not([type="radio"]):not([type="color"]) {
  min-height: 44px;
  font: inherit;
  max-width: 100%;
  min-width: 0;
  border-color: var(--nx-control-border) !important;
  box-sizing: border-box;
}
.nx input[type="checkbox"],
.nx input[type="radio"] {
  width: 20px;
  height: 20px;
  flex: none;
  min-height: 20px;
  accent-color: var(--nx-primary);
}
.nx input[type="color"] {
  min-height: 44px;
}
.nx .task-card {
  border-radius: var(--nx-radius-card) !important;
  background: var(--nx-surface) !important;
}
.nx .task-card .task-card {
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1px solid var(--nx-border) !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}
.nx .nexus-content > * {
  min-width: 0;
  overflow-wrap: anywhere;
}
.nx [role="dialog"] {
  color: var(--nx-text);
}
.nx [role="dialog"] form,
.nx .nexus-modal-panel {
  max-width: calc(100vw - 24px) !important;
  max-height: calc(100dvh - 24px) !important;
  overflow: auto !important;
  overscroll-behavior: contain;
}
.nx .markdown-editor {
  background: var(--nx-surface) !important;
  border-color: var(--nx-control-border) !important;
}
.nx .markdown-editor-header,
.nx .markdown-shortcuts {
  background: var(--nx-surface-muted) !important;
  border-color: var(--nx-border) !important;
}
.nx .markdown-editor textarea,
.nx .markdown-preview {
  background: var(--nx-surface) !important;
  color: var(--nx-text) !important;
}
.nx .markdown-content {
  color: var(--nx-text) !important;
}
.nx .markdown-content code,
.nx .markdown-content pre {
  background: var(--nx-surface-muted) !important;
  color: var(--nx-text) !important;
  border-color: var(--nx-border) !important;
}
.nx .markdown-content blockquote {
  color: var(--nx-text-muted) !important;
  border-color: var(--nx-primary) !important;
}
.nx .nexus-idea-bubble {
  background: var(--nx-surface) !important;
  color: var(--nx-primary) !important;
  border: 1px solid var(--nx-primary) !important;
  box-shadow: var(--nx-shadow) !important;
}
.nx .nexus-idea-bubble > svg {
  pointer-events: none;
}
.nx [role="status"] {
  overflow-wrap: anywhere;
}
.nx button:focus-visible,
.nx input:focus-visible,
.nx select:focus-visible,
.nx textarea:focus-visible,
.nx a:focus-visible {
  outline: 3px solid var(--nx-focus) !important;
  outline-offset: 3px;
}
.nx .nx-theme-label {
  font-size: 0.875rem;
  white-space: nowrap;
}
.nx .nx-theme-label select {
  font-size: 0.875rem;
}
.nx .nx-health .nh-form {
  max-width: 780px;
  margin: auto;
}
.nx .nx-app-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: none !important;
}
.nx .nx-app-brand strong {
  display: block;
  color: var(--nx-primary);
  font-size: 1.125rem;
  letter-spacing: 0.02em;
}
.nx .nx-app-brand small {
  display: block;
  font-size: 0.875rem;
  color: var(--nx-text-muted);
}
.nx .nx-app-header .nexus-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0 !important;
  margin: 0 !important;
}
.nx .nx-account-menu {
  position: relative;
  margin-left: auto;
}
.nx .nx-account-menu summary,
.nx .nx-sync-menu summary {
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  border: 1px solid var(--nx-control-border);
  border-radius: 10px;
  font-size: 0.875rem;
}
.nx .nx-account-actions {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 40;
  display: grid;
  gap: 8px;
  min-width: 240px;
  max-width: calc(100vw - 24px);
  padding: 12px;
  background: var(--nx-surface);
  border: 1px solid var(--nx-border);
  border-radius: 14px;
  box-shadow: var(--nx-shadow);
}
.nx .nx-account-actions button {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
}
.nx .nx-sync-menu {
  font-size: 0.875rem;
  background: var(--nx-surface-muted);
  border-radius: 10px;
}
.nx .nx-sync-menu > div {
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.nx .nx-sync-menu summary {
  border-color: var(--nx-border);
  font-weight: 600;
}
.nx button[data-color-swatch] {
  border: 2px solid var(--nx-control-border) !important;
  padding: 0;
  min-width: 44px;
}
.nx button[data-color-swatch][aria-pressed="true"] {
  outline: 3px solid var(--nx-focus);
  outline-offset: 2px;
}
.nx .nexus-app.font-normal {
  --nexus-font-base: 1rem;
}
.nx .nexus-app.font-large {
  --nexus-font-base: 1.125rem;
}
.nx .nexus-app.font-xlarge {
  --nexus-font-base: 1.25rem;
}
.nx .nexus-app.contrast-high {
  --nx-text-muted: var(--nx-text);
  --nx-border: var(--nx-control-border);
  color: var(--nx-text) !important;
}
.nx .nx-app-header .nexus-header-actions > .nx-control {
  flex: 1 1 100px;
  width: auto;
  max-width: 150px !important;
  min-width: 0;
}
@media (min-width: 600px) {
  .nx .nx-app-nav {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}
@media (min-width: 960px) {
  .nx .nx-application {
    grid-template-columns: 180px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .nx .nx-app-header {
    grid-column: 1/-1;
    grid-row: 1;
  }
  .nx .nexus-content {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    height: 100%;
  }
  .nx .nx-app-nav {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    border-top: 0;
    border-right: 1px solid var(--nx-border);
    overflow-y: auto;
  }
  .nx .nx-app-nav button {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px;
    gap: 12px;
    min-height: 48px;
  }
}
@media (max-width: 599px) {
  .nx .nexus-content {
    padding: 16px 12px !important;
  }
  .nx .nx-app-header {
    padding: 8px 12px !important;
  }
  .nx .nx-app-header > div:nth-child(2) {
    flex-wrap: wrap;
  }
  .nx .nexus-header-actions {
    width: 100%;
  }
  .nx .nexus-header-actions > select {
    flex: 1;
  }
  .nx .nx-theme-label {
    flex: 1;
  }
  .nx .nx-app-nav button {
    font-size: 0.8125rem;
  }
  .nx .nexus-content [style*="min-width: 180px"] {
    min-width: 0 !important;
  }
}
@media (max-height: 500px) {
  .nx .nx-app-header > div:nth-child(2) {
    display: none !important;
  }
  .nx .nx-app-nav {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
  .nx .nx-app-nav button {
    font-size: 0.75rem;
    padding: 4px;
  }
  .nx .nexus-header-actions {
    width: auto;
  }
  .nx .nx-app-header {
    padding: 4px 12px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .nx * {
    animation: none !important;
    transition: none !important;
  }
}
.nx .task-card {
  flex-wrap: wrap !important;
}
.nx .nexus-content span[style*="white-space: nowrap"] {
  white-space: normal !important;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.nx .nx-button {
  flex-shrink: 0;
  overflow-wrap: normal;
}
.nx .nexus-content div[style*="display: flex"] {
  min-width: 0;
}
@media (max-width: 599px) {
  .nx .task-card > div:last-child {
    flex-wrap: wrap;
    max-width: 100%;
  }
  .nx .nexus-content div[style*="display: flex"][style*="align-items: center"] {
    flex-wrap: wrap;
  }
}
@media (max-width: 599px) {
  .nx
    .nexus-content
    div[style*="display: flex"]:not([style*="flex-direction: column"]) {
    flex-wrap: wrap;
  }
}
.nx .nx-health .nh-tile {
  overflow-wrap: anywhere;
  min-width: 0;
}

.nexus-task-controls { display: grid; gap: 8px; margin-block: 12px; }
.nexus-task-controls button, .nexus-task-controls select, .nexus-sync-review button,
.nexus-sync-review select {
  min-height: 44px;
  color: inherit;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 8px;
  padding: 4px 10px;
}
.nexus-task-controls button[aria-pressed="true"] { font-weight: bold; }
.nexus-task-review summary { cursor: pointer; padding-block: 10px; }
.nexus-task-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.nexus-task-list-heading > button { min-height: 44px; padding-inline: 10px; border: 1px solid currentColor; border-radius: 8px; background: transparent; color: inherit; }
.nexus-task-list-heading > button[aria-pressed="true"] { background: #9ac6ff; color: #10213b; }
.nx .task-card .nexus-task-check,
.nx .task-card .nexus-order-handle { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; color: inherit; border: 0; background: transparent; }
.nexus-task-check > span { display: grid; place-items: center; width: 22px; height: 22px; border: 2px solid currentColor; border-radius: 5px; }
.nexus-task-check[aria-pressed="true"] > span { background: #10b981; color: #10213b; border-color: #10b981; }
.nexus-manual-list { position: relative; display: grid; gap: 8px; padding-block: 24px; }
.nexus-manual-list [data-manual-row] > .task-card { transition: transform 210ms ease-out, opacity 150ms; }
.nexus-manual-up > .task-card { transform: translateY(-24px); }
.nexus-manual-down > .task-card { transform: translateY(24px); }
.nexus-manual-source > .task-card { opacity: .28 !important; }
.nexus-order-handle { touch-action: none; user-select: none; cursor: grab; font-size: 24px; }
.nexus-manual-drop { position: absolute; inset-inline: 4px; height: 46px; transform: translateY(-50%); display: grid; place-items: center; border: 2px dashed currentColor; border-radius: 10px; background: var(--nx-surface, Canvas); pointer-events: none; font-size: .8rem; font-weight: bold; }
.nx .nexus-manual-ghost { position: fixed; z-index: 50; pointer-events: none; box-shadow: 0 12px 28px #0009; transition: none; }
@media (prefers-reduced-motion: reduce) {
  .nexus-manual-list [data-manual-row] > .task-card { transition: none; }
}
.nexus-order-announcement { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.nexus-sync-review {
  width: min(680px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  color: inherit;
  background: var(--nx-surface, Canvas);
  border: 1px solid currentColor;
  border-radius: 12px;
  overflow: auto;
}
.nexus-sync-review::backdrop { background: #0008; }
.nexus-sync-review fieldset { min-inline-size: 0; margin-block: 8px; }
.nexus-sync-versions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.nexus-sync-review pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.nexus-sync-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 12px; }

