/*
 * NeuroWerk 3.2.5 – page-by-page terminal UI audit layer.
 * Loaded after every terminal and module stylesheet. Visual and interaction
 * structure only; business data, permissions and workflows remain untouched.
 */

:root {
  --nw-audit-page-gap: clamp(16px, 1.6vw, 24px);
  --nw-audit-card-padding: clamp(16px, 1.5vw, 24px);
  --nw-audit-control-gap: 10px;
  --nw-audit-label-gap: 7px;
  --nw-audit-readable: 76ch;
  --nw-audit-table-min: 760px;
  --nw-audit-danger: #dc3158;
  --nw-audit-info: #2e82c4;
  --nw-audit-success: #158a5b;
  --nw-audit-warning: #a96508;
  --nw-audit-neutral-soft: color-mix(in srgb, var(--nw-terminal-surface-alt) 88%, var(--nw-terminal-bg));
}

html[data-nw-theme="dark"] {
  --nw-audit-danger: #ff6a89;
  --nw-audit-info: #70b9ed;
  --nw-audit-success: #4cdaa0;
  --nw-audit-warning: #ffd078;
  --nw-audit-neutral-soft: #101f30;
}

/* ---------- Global geometry and readable content ---------- */
.nw-terminal-body,
.nw-terminal-body *,
.nw-terminal-body *::before,
.nw-terminal-body *::after {
  box-sizing: border-box;
}

.nw-terminal-body :where(
  .nw-terminal-main,
  .nw-terminal-card,
  .nw-terminal-grid,
  .nw-terminal-split,
  .nw-terminal-directory,
  .nw-terminal-directory-detail,
  .nw-terminal-order-layout,
  .nw-terminal-order-main,
  .nw-terminal-order-side,
  .nw-terminal-finance-editor,
  .nw-terminal-finance-editor-main,
  .nw-terminal-finance-editor-side,
  .nw-terminal-record-list,
  .nw-terminal-work-records,
  .nw-terminal-conversation,
  .nw-terminal-table-wrap,
  .nw-terminal-form,
  .nw-terminal-form-grid,
  .nw-terminal-form-section,
  .nw-terminal-actions,
  .nw-terminal-card-head,
  .nw-terminal-record-head,
  .nw-terminal-view-head,
  .nw-terminal-subnav,
  .nw-terminal-control-nav,
  .nw-terminal-schedule,
  .nw-terminal-shop-control,
  .nw-terminal-commerce-dashboard,
  .nw-terminal-system,
  .nw-terminal-communication,
  .nw-terminal-work,
  .nw-terminal-finance
) {
  min-width: 0;
}

.nw-terminal-main {
  gap: var(--nw-audit-page-gap) !important;
  overflow-x: clip;
}

.nw-terminal-main > :where(section, article, div, nav) {
  max-width: 100%;
}

.nw-terminal-main :where(p, li, dd, td, th, label, small, .description, .nw-terminal-muted) {
  overflow-wrap: anywhere;
}

.nw-terminal-main :where(.nw-terminal-card p, .nw-terminal-view-head p, .nw-terminal-callout p, .nw-terminal-empty p) {
  max-width: var(--nw-audit-readable);
}

.nw-terminal-main :where(img, svg, video, canvas) {
  max-width: 100%;
}

/* ---------- Page heads and primary actions ---------- */
.nw-terminal-view-head {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px 28px;
  min-height: 124px;
  padding: clamp(20px, 2vw, 30px) !important;
  overflow: hidden;
}

.nw-terminal-view-head > :first-child {
  min-width: 0;
}

.nw-terminal-view-head :where(h1, h2) {
  margin-block: 4px 7px;
  max-width: 22ch;
  font-size: clamp(28px, 2.4vw, 42px);
  line-height: 1.06;
}

.nw-terminal-view-head > :where(a, button, form, .nw-terminal-actions) {
  justify-self: end;
  align-self: center;
  max-width: 100%;
}

.nw-terminal-view-head .nw-terminal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--nw-audit-control-gap);
}

/* ---------- Cards, sections and headings ---------- */
.nw-terminal-card,
.nw-terminal-record-card,
.nw-terminal-callout,
.nw-terminal-empty,
.nw-terminal-empty-small,
.nw-terminal-module-card,
.nw-terminal-task,
.nw-terminal-day-card,
.nw-terminal-agenda-day,
.nw-terminal-month-day,
.nw-terminal-availability-day {
  min-width: 0;
}

.nw-terminal-card {
  padding: var(--nw-audit-card-padding);
}

.nw-terminal-card > :first-child,
.nw-terminal-form-section > :first-child,
.nw-terminal-record-card > :first-child {
  margin-top: 0;
}

.nw-terminal-card > :last-child,
.nw-terminal-form-section > :last-child,
.nw-terminal-record-card > :last-child {
  margin-bottom: 0;
}

.nw-terminal-card-head,
.nw-terminal-record-head,
.nw-terminal-schedule-toolbar {
  margin-bottom: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--nw-terminal-line);
}

.nw-terminal-card-head :where(h2, h3),
.nw-terminal-record-head :where(h2, h3) {
  margin: 2px 0 5px;
  line-height: 1.16;
}

.nw-terminal-card-head p,
.nw-terminal-record-head p {
  margin: 0;
}

.nw-terminal-kicker {
  margin: 0 0 4px !important;
  color: var(--nw-terminal-red-bright) !important;
  font-size: 10px !important;
  font-weight: 850 !important;
  letter-spacing: .105em !important;
  line-height: 1.35;
  text-transform: uppercase;
}

.nw-terminal-form-section {
  margin-block: 18px;
  padding: 18px;
  border: 1px solid var(--nw-terminal-line);
  border-radius: var(--nw-terminal-radius);
  background: color-mix(in srgb, var(--nw-terminal-surface-alt) 76%, transparent);
}

.nw-terminal-form-section > :where(h2, h3, h4, legend) {
  margin: 0 0 12px;
  color: var(--nw-terminal-ink);
}

/* ---------- Form audit ---------- */
.nw-terminal-form {
  display: grid;
  gap: 18px;
}

.nw-terminal-form-grid,
.nw-terminal-filter-grid,
.nw-terminal-check-grid,
.nw-terminal-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 18px !important;
  align-items: start;
}

.nw-terminal-form-grid > .is-wide,
.nw-terminal-filter-grid > .is-wide,
.nw-terminal-form-grid > :where(fieldset, .nw-terminal-form-section, .nw-terminal-form-actions, .nw-terminal-permissions) {
  grid-column: 1 / -1;
}

.nw-terminal-form :where(label:not(.nw-terminal-check), .nw-terminal-filter label, .nw-terminal-directory-search label) {
  display: grid;
  align-content: start;
  gap: var(--nw-audit-label-gap);
  min-width: 0;
  color: var(--nw-terminal-ink);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.3;
}

.nw-terminal-form label > small,
.nw-terminal-form label > .description {
  font-size: 11px;
  font-weight: 520;
  line-height: 1.45;
}

.nw-terminal-main :where(
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="color"]),
  select,
  textarea
) {
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 5px;
  line-height: 1.35;
}

.nw-terminal-main textarea {
  min-height: 112px;
  resize: vertical;
}

.nw-terminal-main select {
  padding-right: 36px;
}

.nw-terminal-check,
.nw-terminal-toolbar-check,
.nw-account-check,
.nw-portal-checkbox {
  display: flex !important;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 5px 0;
  color: var(--nw-terminal-ink) !important;
  font-size: 12px;
  font-weight: 620;
  line-height: 1.42;
}

.nw-terminal-main :where(input[type="checkbox"], input[type="radio"]) {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--nw-terminal-red-bright);
}

.nw-terminal-permissions,
.nw-terminal-check-grid {
  padding: 16px;
  border: 1px solid var(--nw-terminal-line);
  border-radius: 6px;
  background: var(--nw-audit-neutral-soft);
}

.nw-terminal-permissions legend {
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.nw-terminal-form-actions,
.nw-terminal-actions,
.nw-terminal-action-row,
.nw-terminal-row-actions,
.nw-terminal-row-buttons,
.nw-terminal-stack-actions,
.nw-terminal-user-tools,
.nw-office-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--nw-audit-control-gap);
}

.nw-terminal-form-actions {
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--nw-terminal-line);
}

.nw-terminal-body :where(
  .nw-terminal-primary,
  .nw-terminal-secondary,
  .nw-terminal-danger,
  .nw-terminal-icon-button,
  .nw-terminal-full-button,
  .nw-terminal-page-help-toggle,
  .button,
  button,
  input[type="submit"]
) {
  min-height: 44px;
  max-width: 100%;
  padding: 9px 14px;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
}

.nw-terminal-icon-button {
  min-width: 44px;
  padding-inline: 10px;
}

/* ---------- Navigation, filters and toolbars ---------- */
.nw-terminal-subnav,
.nw-terminal-control-nav,
.nw-terminal-communication-nav,
.nw-terminal-system-nav,
.nw-terminal-work-nav {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.nw-terminal-subnav > a,
.nw-terminal-control-nav > a,
.nw-terminal-communication-nav > a,
.nw-terminal-system-nav > a,
.nw-terminal-work-nav > a {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 10px 14px;
}

.nw-terminal-toolbar,
.nw-terminal-filter,
.nw-terminal-schedule-toolbar {
  padding: 14px;
  border: 1px solid var(--nw-terminal-line);
  border-radius: var(--nw-terminal-radius);
  background: var(--nw-terminal-surface-alt);
}

.nw-terminal-filter,
.nw-terminal-toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.nw-terminal-filter > :where(label, input, select),
.nw-terminal-toolbar > :where(label, input, select) {
  flex: 1 1 190px;
  min-width: 0;
}

.nw-terminal-filter > :where(button, a),
.nw-terminal-toolbar > :where(button, a) {
  flex: 0 0 auto;
}

/* ---------- Directory/list-detail views ---------- */
.nw-terminal-directory {
  align-items: start;
}

.nw-terminal-directory-list,
.nw-terminal-directory-detail {
  min-width: 0;
}

.nw-terminal-directory-search {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.nw-terminal-directory-items > a {
  overflow: hidden;
}

.nw-terminal-directory-items > a > span {
  min-width: 0;
}

.nw-terminal-directory-items > a :where(strong, small) {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nw-terminal-directory-items > a em {
  align-self: center;
  white-space: nowrap;
}

.nw-terminal-record-list,
.nw-terminal-work-records,
.nw-terminal-communication-list,
.nw-terminal-compact-list,
.nw-terminal-system-list,
.nw-terminal-health-list,
.nw-terminal-note-list {
  display: grid;
  gap: 10px;
}

.nw-terminal-record-list > article,
.nw-terminal-work-records > article,
.nw-terminal-system-list > article,
.nw-terminal-health-list > article,
.nw-terminal-note-list > article,
.nw-terminal-record-list > a,
.nw-terminal-work-records > a,
.nw-terminal-communication-list > a {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--nw-terminal-line);
  border-radius: 6px;
  background: var(--nw-terminal-surface-alt);
}

/* ---------- Tables: readable desktop, card-like mobile ---------- */
.nw-terminal-table-wrap,
.nw-table-wrap,
.nb-admin-table-wrap,
.nwmf-table-wrap {
  width: 100%;
  max-width: 100%;
  border-radius: 6px;
}

.nw-terminal-main table[data-terminal-responsive-table] {
  min-width: min(100%, var(--nw-audit-table-min));
}

.nw-terminal-main table :where(th, td) {
  padding: 12px 13px !important;
  line-height: 1.4;
}

.nw-terminal-main table :where(td) {
  color: var(--nw-terminal-ink) !important;
}

.nw-terminal-main table :where(td small, td .description) {
  display: block;
  margin-top: 3px;
}

.nw-terminal-main table :where(.nw-terminal-actions, .nw-terminal-row-actions, .nw-inline-form) {
  justify-content: flex-end;
}

/* ---------- Empty states, notices, statuses ---------- */
.nw-terminal-empty,
.nw-terminal-empty-small,
.nw-account-empty {
  display: grid;
  place-items: start;
  gap: 7px;
  min-height: 112px;
  padding: 22px;
  border-style: dashed;
  background: color-mix(in srgb, var(--nw-terminal-surface-alt) 78%, transparent);
}

.nw-terminal-empty-small {
  min-height: 76px;
  padding: 16px;
}

.nw-terminal-empty::before,
.nw-terminal-empty-small::before,
.nw-account-empty::before {
  content: "–";
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--nw-terminal-line);
  border-radius: 50%;
  background: var(--nw-terminal-surface-strong);
  color: var(--nw-terminal-muted);
  font-weight: 800;
}

.nw-terminal-notice,
.nw-terminal-callout,
.nw-terminal-warning,
.nw-terminal-success,
.nw-terminal-boundary,
.nw-terminal-foundation-note,
.nw-terminal-note {
  position: relative;
  padding: 15px 17px 15px 19px;
  border: 1px solid var(--nw-terminal-line);
  border-left-width: 4px;
  border-radius: 6px;
  background: var(--nw-terminal-surface-alt);
  color: var(--nw-terminal-ink);
}

.nw-terminal-notice.is-success,
.nw-terminal-success {
  border-left-color: var(--nw-audit-success);
  background: color-mix(in srgb, var(--nw-terminal-success-soft) 82%, var(--nw-terminal-surface));
}

.nw-terminal-notice.is-warning,
.nw-terminal-warning,
.nw-terminal-boundary {
  border-left-color: var(--nw-audit-warning);
  background: color-mix(in srgb, var(--nw-terminal-warning-soft) 82%, var(--nw-terminal-surface));
}

.nw-terminal-notice.is-error,
.nw-terminal-danger-zone {
  border-left-color: var(--nw-audit-danger);
  background: color-mix(in srgb, var(--nw-terminal-danger-soft) 82%, var(--nw-terminal-surface));
}

.nw-terminal-status,
.nw-terminal-pill,
.nw-account-status,
.nw-office-status,
.nw-portal-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
  max-width: 100%;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 820;
  line-height: 1.2;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: normal;
}

/* ---------- Details, timelines, attachments and code ---------- */
.nw-terminal-main details,
.nw-terminal-details {
  border: 1px solid var(--nw-terminal-line);
  border-radius: 6px;
  background: var(--nw-terminal-surface-alt);
  overflow: clip;
}

.nw-terminal-main details > summary,
.nw-terminal-details > summary {
  min-height: 46px;
  padding: 13px 15px;
  color: var(--nw-terminal-ink);
  cursor: pointer;
  font-weight: 740;
}

.nw-terminal-main details[open] > summary {
  border-bottom: 1px solid var(--nw-terminal-line);
  background: var(--nw-terminal-surface-strong);
}

.nw-terminal-main details > :not(summary) {
  margin-inline: 15px;
}

.nw-terminal-timeline,
.nw-terminal-agenda,
.nw-terminal-conversation {
  min-width: 0;
}

.nw-terminal-conversation-message,
.nw-message {
  max-width: min(88%, 860px);
  border-color: var(--nw-terminal-line) !important;
  background: var(--nw-terminal-surface-alt) !important;
  color: var(--nw-terminal-ink) !important;
}

.nw-terminal-attachments,
.nw-terminal-gallery-list,
.nw-terminal-location-list,
.nw-terminal-link-fields {
  display: grid;
  gap: 10px;
}

.nw-terminal-main :where(code, pre) {
  max-width: 100%;
  border: 1px solid var(--nw-terminal-line);
  border-radius: 5px;
  background: var(--nw-terminal-surface-strong);
  color: var(--nw-terminal-ink);
}

.nw-terminal-main code {
  padding: 2px 5px;
  overflow-wrap: anywhere;
}

.nw-terminal-main pre {
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
}

/* ---------- Legacy module surface audit ---------- */
.nw-terminal-main :where(
  .nw-office,
  .nw-portal,
  .nw-customer-account,
  .nw-admin,
  .nb-booking-admin,
  .nbsd-admin,
  .nwmf-admin,
  .nwc-admin,
  .npic-admin
) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 !important;
  color: var(--nw-terminal-ink) !important;
}

.nw-terminal-main :where(
  .nw-office-grid,
  .nw-portal-grid,
  .nw-account-grid,
  .nw-admin .nw-grid,
  .nw-admin .nw-form-grid,
  .nwmf-layout,
  .nwc-layout,
  .nwmf-fields,
  .nwc-fields
) {
  min-width: 0;
}

html[data-nw-theme="dark"] .nw-terminal-main :where(
  .nw-inbox-item,
  .nw-health-item,
  .nw-search-results > a,
  .nw-subcard,
  .nw-status-panel,
  .nw-message,
  .nw-answer,
  .nw-wizard-progress,
  .nw-choice-card,
  .nw-switch-list,
  .nw-setting-switch,
  .nwmf-metrics > div,
  .nwmf-feedbar,
  .nwmf-card,
  .nwc-standalone-header,
  .nwc-status-row > div,
  .nwc-card,
  .npic-product-context,
  .nbsd-thread .nbsd-msg
) {
  border-color: var(--nw-terminal-line) !important;
  background: var(--nw-terminal-surface-alt) !important;
  color: var(--nw-terminal-ink) !important;
  box-shadow: var(--nw-terminal-shadow-soft) !important;
}

html[data-nw-theme="dark"] .nw-terminal-main :where(
  .nw-inbox-item,
  .nw-health-item,
  .nw-search-results > a,
  .nw-subcard,
  .nw-status-panel,
  .nw-message,
  .nw-answer,
  .nw-wizard-progress,
  .nw-choice-card,
  .nw-switch-list,
  .nw-setting-switch,
  .nwmf-card,
  .nwc-card,
  .npic-product-context,
  .nbsd-thread .nbsd-msg
) :where(h1,h2,h3,h4,h5,h6,strong,b,label,dt,dd,span) {
  color: var(--nw-terminal-ink) !important;
}

html[data-nw-theme="dark"] .nw-terminal-main :where(
  .nw-inbox-item,
  .nw-health-item,
  .nw-search-results > a,
  .nw-subcard,
  .nw-status-panel,
  .nw-message,
  .nw-answer,
  .nw-wizard-progress,
  .nw-choice-card,
  .nw-switch-list,
  .nw-setting-switch,
  .nwmf-card,
  .nwc-card,
  .npic-product-context,
  .nbsd-thread .nbsd-msg
) :where(p,small,.description,.muted,em) {
  color: var(--nw-terminal-muted) !important;
}

/* Never recolor deliberate paper/public previews. */
.nw-terminal-main :where(
  .nw-document-preview,
  .nw-invoice-paper,
  .nw-email-preview > div,
  .nw-pos-receipt,
  .nw-storefront-design-preview,
  .nw-storefront-checkout-preview
) {
  isolation: isolate;
}

/* ---------- Responsive audit ---------- */
@media (max-width: 1180px) {
  .nw-terminal-view-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .nw-terminal-form-grid,
  .nw-terminal-filter-grid,
  .nw-terminal-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nw-terminal-order-layout,
  .nw-terminal-finance-editor,
  .nw-terminal-grid-main,
  .nw-terminal-split,
  .nwmf-layout,
  .nwc-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .nw-terminal-order-side,
  .nw-terminal-finance-editor-side,
  .nw-terminal-sticky {
    position: static !important;
    top: auto !important;
  }
}

@media (max-width: 980px) {
  .nw-terminal-layout {
    display: block !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
  }

  .nw-terminal-main {
    width: 100%;
    max-width: none;
    min-height: calc(100vh - var(--nw-terminal-topbar-height));
  }

  .nw-terminal-sidebar {
    width: min(320px, 88vw) !important;
  }
}

@media (max-width: 820px) {
  .nw-terminal-view-head {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .nw-terminal-view-head > :where(a, button, form, .nw-terminal-actions) {
    width: 100%;
    justify-self: stretch;
  }

  .nw-terminal-view-head .nw-terminal-actions > *,
  .nw-terminal-view-head > :where(a, button) {
    width: 100%;
  }

  .nw-terminal-form-grid,
  .nw-terminal-filter-grid,
  .nw-terminal-check-grid,
  .nw-terminal-grid-2,
  .nwmf-fields,
  .nwc-fields {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .nw-terminal-permissions {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .nw-terminal-filter,
  .nw-terminal-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .nw-terminal-filter > *,
  .nw-terminal-toolbar > * {
    width: 100%;
  }

  .nw-terminal-form-actions,
  .nw-terminal-actions,
  .nw-terminal-action-row,
  .nw-terminal-row-actions,
  .nw-terminal-row-buttons {
    align-items: stretch;
  }

  .nw-terminal-form-actions > *,
  .nw-terminal-actions > *,
  .nw-terminal-action-row > *,
  .nw-terminal-row-actions > *,
  .nw-terminal-row-buttons > * {
    flex: 1 1 180px;
  }

  .nw-terminal-conversation-message,
  .nw-message {
    max-width: 100%;
  }
}

@media (max-width: 820px) {
  .nw-terminal-main .nw-terminal-table-wrap:has(table[data-terminal-responsive-table]),
  .nw-terminal-main .nw-table-wrap:has(table[data-terminal-responsive-table]) {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .nw-terminal-main table[data-terminal-responsive-table] {
    display: block;
    min-width: 0;
    border: 0 !important;
  }

  .nw-terminal-main table[data-terminal-responsive-table] thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
  }

  .nw-terminal-main table[data-terminal-responsive-table] :where(tbody, tr, td) {
    display: block;
    width: 100%;
  }

  .nw-terminal-main table[data-terminal-responsive-table] tbody {
    display: grid;
    gap: 12px;
  }

  .nw-terminal-main table[data-terminal-responsive-table] tr {
    padding: 8px 14px;
    border: 1px solid var(--nw-terminal-line) !important;
    border-radius: 7px;
    background: var(--nw-terminal-surface-alt) !important;
    box-shadow: var(--nw-terminal-shadow-soft);
  }

  .nw-terminal-main table[data-terminal-responsive-table] td {
    display: grid;
    grid-template-columns: minmax(110px, .72fr) minmax(0, 1.28fr);
    gap: 10px;
    padding: 9px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid var(--nw-terminal-line-soft) !important;
    text-align: right;
  }

  .nw-terminal-main table[data-terminal-responsive-table] td:last-child {
    border-bottom: 0 !important;
  }

  .nw-terminal-main table[data-terminal-responsive-table] td::before {
    content: attr(data-label);
    color: var(--nw-terminal-muted);
    font-size: 10px;
    font-weight: 820;
    letter-spacing: .045em;
    line-height: 1.35;
    text-align: left;
    text-transform: uppercase;
  }

  .nw-terminal-main table[data-terminal-responsive-table] td[data-label=""]::before {
    display: none;
  }

  .nw-terminal-main table[data-terminal-responsive-table] td:has(.nw-terminal-actions),
  .nw-terminal-main table[data-terminal-responsive-table] td:has(.nw-terminal-row-actions),
  .nw-terminal-main table[data-terminal-responsive-table] td:has(form) {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .nw-terminal-main table[data-terminal-responsive-table] td :where(.nw-terminal-actions, .nw-terminal-row-actions, form) {
    justify-content: stretch;
  }
}

@media (max-width: 560px) {
  .nw-terminal-card,
  .nw-terminal-form-section {
    padding: 14px;
  }

  .nw-terminal-view-head {
    padding: 18px !important;
  }

  .nw-terminal-view-head :where(h1, h2) {
    font-size: clamp(25px, 8vw, 32px);
  }

  .nw-terminal-main :where(
    .nw-terminal-primary,
    .nw-terminal-secondary,
    .nw-terminal-danger,
    .button,
    button,
    input[type="submit"]
  ),
  .nw-terminal-auth-panel :where(button, input[type="submit"]) {
    width: 100%;
  }

  .nw-terminal-directory-items > a {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .nw-terminal-directory-items > a em {
    grid-column: 2;
    justify-self: start;
  }

  .nw-terminal-main table[data-terminal-responsive-table] td {
    grid-template-columns: minmax(88px, .62fr) minmax(0, 1.38fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .nw-terminal-body :where(.nw-terminal-card, .nw-terminal-record-card, .nw-terminal-view-head) {
    transition: none !important;
  }
}

/* Mobile table action cells must never inherit a vertical flex-basis as height. */
@media (max-width: 820px) {
  .nw-terminal-main table[data-terminal-responsive-table] td :where(
    .nw-terminal-actions,
    .nw-terminal-row-actions,
    .nw-terminal-form-actions,
    .nw-inline-form
  ) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    height: auto !important;
  }

  .nw-terminal-main table[data-terminal-responsive-table] td :where(
    .nw-terminal-actions,
    .nw-terminal-row-actions,
    .nw-terminal-form-actions,
    .nw-inline-form
  ) > * {
    flex: none !important;
    width: 100%;
    min-height: 44px;
  }
}

/* Compact but fully usable terminal header on phones. */
@media (max-width: 640px) {
  .nw-terminal-topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center !important;
    gap: 8px;
    min-height: 64px;
    height: auto !important;
    padding: 9px 10px !important;
  }

  .nw-terminal-topbar-start,
  .nw-terminal-topbar-actions {
    min-width: 0;
  }

  .nw-terminal-topbar-start {
    display: flex;
    align-items: center;
    gap: 7px;
  }

  .nw-terminal-topbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 5px;
  }

  .nw-terminal-menu-toggle,
  .nw-terminal-page-help-toggle,
  .nw-terminal-theme-toggle {
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0 !important;
  }

  .nw-terminal-menu-toggle {
    font-size: 0;
  }

  .nw-terminal-menu-toggle > span {
    font-size: 18px;
  }

  .nw-terminal-page-help-toggle > span:last-child,
  .nw-terminal-theme-label {
    display: none !important;
  }

  .nw-terminal-brand {
    min-width: 0;
    gap: 7px;
  }

  .nw-terminal-brand img {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
  }

  .nw-terminal-brand > span {
    min-width: 0;
  }

  .nw-terminal-brand strong,
  .nw-terminal-brand small {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nw-terminal-brand strong {
    font-size: 13px;
  }

  .nw-terminal-brand small {
    font-size: 9px;
  }

  .nw-terminal-user {
    gap: 0 !important;
  }

  .nw-terminal-user > span {
    display: none !important;
  }

  .nw-terminal-user > a {
    min-height: 42px;
    padding: 0 10px;
    font-size: 11px;
  }
}

@media (max-width: 430px) {
  .nw-terminal-brand small {
    display: none;
  }

  .nw-terminal-user > a {
    width: 42px;
    min-width: 42px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .nw-terminal-user > a::before {
    content: "↪";
    font-size: 18px;
    line-height: 1;
  }
}

/* Corrections found by the compact-laptop and tablet visual pass. */
.nw-terminal-filter label,
.nw-terminal-toolbar label,
.nw-terminal-directory-search label {
  display: grid;
  align-content: start;
  gap: var(--nw-audit-label-gap);
  min-width: 0;
  color: var(--nw-terminal-ink);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.3;
}

@media (max-width: 980px) {
  .nw-terminal-card-head > div:first-child,
  .nw-terminal-record-head > div:first-child,
  .nw-terminal-schedule-toolbar > div:first-child {
    flex: 0 1 auto !important;
  }

  .nw-terminal-topbar {
    min-height: 68px;
    height: auto !important;
  }

  .nw-terminal-topbar-start,
  .nw-terminal-topbar-actions {
    min-width: 0;
  }

  .nw-terminal-topbar-actions {
    flex-wrap: nowrap !important;
    gap: 7px;
  }

  .nw-terminal-page-help-toggle,
  .nw-terminal-theme-toggle {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    padding-inline: 0 !important;
  }

  .nw-terminal-page-help-toggle > span:last-child,
  .nw-terminal-theme-label,
  .nw-terminal-user > span {
    display: none !important;
  }
}

@media (max-width: 820px) {
  .nw-terminal-filter > *,
  .nw-terminal-toolbar > * {
    flex: 0 0 auto !important;
  }

  .nw-terminal-card-head,
  .nw-terminal-record-head,
  .nw-terminal-schedule-toolbar {
    min-height: 0 !important;
  }
}

/* NeuroWerk 3.4.0 – final release-readiness alignment after global consistency rules */
.nw-terminal-body .nw-release-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}
.nw-terminal-body .nw-release-group .nw-terminal-card-head {
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: flex-start !important;
}
.nw-terminal-body .nw-release-group .nw-terminal-card-head > div:first-child {
  flex: 1 1 auto !important;
  min-width: 0;
}
.nw-terminal-body .nw-release-group-state {
  flex: 0 0 42px;
}
@media (max-width: 1100px) {
  .nw-terminal-body .nw-release-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 430px) {
  .nw-terminal-body .nw-release-metrics > article {
    min-height: 82px;
    padding: 12px !important;
  }
}

/* NeuroWerk 5.0.0 – direct WordPress handoff and transparent update diagnostics. */
.nw-terminal-wordpress-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .46);
  border-radius: 10px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.nw-terminal-wordpress-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nw-terminal-wordpress-link:hover,
.nw-terminal-wordpress-link:focus-visible {
  border-color: #fff;
  background: #fff;
  color: var(--nw-terminal-red-dark, #7f1422);
  transform: translateY(-1px);
}

.nw-license-version-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.nw-license-update-card > form,
.nw-license-update-card > details,
.nw-license-update-card > dl,
.nw-license-update-card > div + div {
  margin-top: 14px;
}

.nw-terminal-update-warning {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, #d99a22 48%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, #d99a22 10%, var(--nw-terminal-surface, #fff));
  color: var(--nw-terminal-ink, #1b1d23);
}

.nw-terminal-update-warning span {
  color: var(--nw-terminal-muted, #626874);
  font-size: 12px;
  line-height: 1.55;
}

.nw-license-update-diagnostics {
  padding-top: 12px;
  border-top: 1px solid var(--nw-terminal-line, rgba(20, 24, 34, .12));
}

.nw-license-update-technical summary {
  cursor: pointer;
  color: var(--nw-terminal-muted, #626874);
  font-size: 12px;
  font-weight: 760;
}

.nw-license-update-technical p {
  margin: 10px 0 0;
  font-size: 12px;
}

@media (max-width: 980px) {
  .nw-terminal-wordpress-link {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    padding: 0;
  }

  .nw-terminal-wordpress-link > span {
    display: none;
  }
}

@media (max-width: 640px) {
  .nw-terminal-wordpress-link {
    flex-basis: 42px;
    width: 42px;
    min-width: 42px;
    min-height: 42px;
  }

  .nw-license-version-row {
    grid-template-columns: 1fr;
  }
}
