/*
  Nodey mockup — stylesheet
  Faithful reconstruction of design tokens from Theme/{Colors,Typography,Spacing,Gradients}.swift.
  Self-contained, scoped under .nd to avoid Webflow style collisions.
*/

.nd {
  /* Brand */
  --nd-indigo: #6C5CE7;
  --nd-indigo-light: #A29BFE;
  --nd-indigo-dark: #4834D4;
  --nd-cyan: #00CEC9;
  --nd-cyan-light: #81ECEC;

  /* Status */
  --nd-success: #00B894;
  --nd-warning: #FDCB6E;
  --nd-error: #FF6B6B;
  --nd-critical: #E17055;
  --nd-running: #00CEC9;

  /* Dark theme surfaces (Theme/Colors.swift lines 90-107) */
  --nd-bg: #0D0D1A;
  --nd-surface: #1A1A2E;
  --nd-elevated: #252547;
  --nd-text-primary: rgba(255, 255, 255, 0.95);
  --nd-text-secondary: rgba(255, 255, 255, 0.80);
  --nd-text-tertiary: rgba(255, 255, 255, 0.55);

  /* Spacing (Theme/Spacing.swift) */
  --nd-xs: 4px;
  --nd-sm: 8px;
  --nd-md: 12px;
  --nd-lg: 16px;
  --nd-xl: 20px;
  --nd-xxl: 24px;
  --nd-xxxl: 32px;

  /* Phone size — overridden in media queries */
  --phone-w: 380px;
  --phone-radius: 50px;
  --screen-radius: 38px;

  position: relative;
  display: flex;
  justify-content: center;
  padding: 1rem 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: transparent;
  box-sizing: border-box;
}

.nd *,
.nd *::before,
.nd *::after {
  box-sizing: border-box;
}

/* ---------- Phone frame (no shadow, clean black bezel) ---------- */
.nd-phone {
  width: var(--phone-w);
  aspect-ratio: 9 / 19.5;
  background: #000;
  border-radius: var(--phone-radius);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  flex-shrink: 0;
}

.nd-screen {
  width: 100%;
  height: 100%;
  background: var(--nd-bg);
  border-radius: var(--screen-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.nd-island {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 30px;
  background: #000;
  border-radius: 18px;
  z-index: 50;
  pointer-events: none;
}

/* ---------- iOS status bar ---------- */
.nd-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--nd-text-primary);
  flex-shrink: 0;
  z-index: 2;
}

.nd-statusbar__icons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nd-statusbar__bat {
  width: 22px;
  height: 11px;
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 1px;
  position: relative;
}
.nd-statusbar__bat::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 3px;
  width: 2px;
  height: 5px;
  background: currentColor;
  border-radius: 0 1px 1px 0;
}
.nd-statusbar__bat span {
  display: block;
  height: 100%;
  background: currentColor;
  border-radius: 1px;
}

/* ---------- Screen panes (tab switching) ---------- */
.nd-screens {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.nd-pane {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.nd-pane[data-active="true"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

/* ---------- iOS large-title nav ---------- */
.nd-nav {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 8px var(--nd-xxl) var(--nd-md);
  flex-shrink: 0;
}
.nd-nav__title {
  font-size: 34px;
  font-weight: 700;
  color: var(--nd-text-primary);
  line-height: 1;
  letter-spacing: 0.37px;
}
.nd-nav__action {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nd-indigo);
  margin-bottom: 4px;
  background: none;
  border: none;
  cursor: pointer;
}
.nd-nav__action svg {
  width: 22px;
  height: 22px;
}

/* ---------- Search bar ---------- */
.nd-search {
  margin: 0 var(--nd-lg) var(--nd-md);
  padding: 7px var(--nd-md);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--nd-text-tertiary);
  font-size: 14px;
  flex-shrink: 0;
}
.nd-search svg {
  width: 14px;
  height: 14px;
}

/* ---------- Scroll content ---------- */
.nd-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--nd-sm) 0 var(--nd-xxl);
  display: flex;
  flex-direction: column;
  gap: var(--nd-lg);
  -webkit-overflow-scrolling: touch;
}
.nd-content::-webkit-scrollbar {
  display: none;
}
.nd-content {
  scrollbar-width: none;
}

/* ---------- Cards ---------- */
.nd-card {
  margin: 0 var(--nd-lg);
  padding: var(--nd-lg);
  border-radius: 16px;
  background: var(--nd-surface);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.nd-card--hero {
  background: linear-gradient(135deg, var(--nd-indigo) 0%, var(--nd-cyan) 100%);
  box-shadow: 0 12px 30px -10px rgba(108, 92, 231, 0.4);
}

.nd-hero__label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 var(--nd-xs);
}
.nd-hero__value {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin: 0 0 var(--nd-xs);
  letter-spacing: -0.5px;
}
.nd-hero__sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

/* ---------- AI Workflow Builder card ---------- */
.nd-aibuilder {
  display: flex;
  align-items: center;
  gap: var(--nd-md);
  margin: 0 var(--nd-lg);
  padding: var(--nd-lg);
  border-radius: 16px;
  background: linear-gradient(90deg, var(--nd-indigo) 0%, var(--nd-indigo-light) 100%);
  box-shadow: 0 8px 24px -8px rgba(108, 92, 231, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease;
  border: none;
  width: calc(100% - 32px);
  text-align: left;
  font: inherit;
  color: inherit;
}
.nd-aibuilder:active {
  transform: scale(0.98);
}
.nd-aibuilder__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.nd-aibuilder__icon svg {
  width: 24px;
  height: 24px;
}
.nd-aibuilder__text {
  flex: 1;
  min-width: 0;
}
.nd-aibuilder__title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 2px;
}
.nd-aibuilder__sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}
.nd-aibuilder__chev {
  color: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}
.nd-aibuilder__chev svg {
  width: 14px;
  height: 14px;
}

/* ---------- Stats grid ---------- */
.nd-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--nd-md);
  margin: 0 var(--nd-lg);
}
.nd-stat {
  padding: var(--nd-lg);
  border-radius: 16px;
  background: var(--nd-surface);
  display: flex;
  align-items: center;
  gap: var(--nd-md);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.nd-stat__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nd-stat__icon svg {
  width: 18px;
  height: 18px;
}
.nd-stat__icon--cyan { background: rgba(0, 206, 201, 0.15); color: var(--nd-cyan); }
.nd-stat__icon--error { background: rgba(255, 107, 107, 0.15); color: var(--nd-error); }
.nd-stat__icon--success { background: rgba(0, 184, 148, 0.15); color: var(--nd-success); }
.nd-stat__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.nd-stat__value {
  font-size: 22px;
  font-weight: 700;
  color: var(--nd-text-primary);
  line-height: 1.1;
}
.nd-stat__label {
  font-size: 13px;
  color: var(--nd-text-secondary);
}

.nd-updated {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--nd-text-tertiary);
  padding: var(--nd-xs) 0 0;
}

/* ---------- Recent Errors ---------- */
.nd-errors__header {
  display: flex;
  align-items: center;
  gap: var(--nd-sm);
  margin-bottom: var(--nd-md);
}
.nd-errors__header svg {
  width: 16px;
  height: 16px;
  color: var(--nd-error);
}
.nd-errors__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--nd-text-primary);
  margin: 0;
}
.nd-errors__list {
  display: flex;
  flex-direction: column;
  gap: var(--nd-sm);
}
.nd-error-row {
  display: flex;
  align-items: center;
  gap: var(--nd-md);
  padding: var(--nd-md);
  border-radius: 14px;
  background: rgba(255, 107, 107, 0.15);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
  border: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}
.nd-error-row:hover { background: rgba(255, 107, 107, 0.20); }
.nd-error-row:active { transform: scale(0.98); }
.nd-error-row[aria-expanded="true"] { background: rgba(255, 107, 107, 0.22); }
.nd-error-row__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.20);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--nd-error);
}
.nd-error-row__icon svg { width: 16px; height: 16px; }
.nd-error-row__text { flex: 1; min-width: 0; }
.nd-error-row__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--nd-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 2px;
}
.nd-error-row__time {
  font-size: 13px;
  color: var(--nd-text-secondary);
  margin: 0;
}
.nd-error-row__chev {
  color: var(--nd-text-tertiary);
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.nd-error-row__chev svg { width: 12px; height: 12px; }
.nd-error-row[aria-expanded="true"] .nd-error-row__chev {
  transform: rotate(90deg);
}

/* ---------- AI diagnosis panel ---------- */
.nd-diag {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.5s ease;
}
.nd-diag[data-open="true"] {
  max-height: 800px;
}
.nd-diag__inner {
  padding: var(--nd-md);
  margin-top: var(--nd-sm);
  background: var(--nd-elevated);
  border-radius: 14px;
  border: 1px solid rgba(108, 92, 231, 0.25);
}
.nd-diag__header {
  display: flex;
  align-items: center;
  gap: var(--nd-sm);
  padding-bottom: var(--nd-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: var(--nd-sm);
}
.nd-diag__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--nd-indigo), var(--nd-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.nd-diag__avatar svg { width: 14px; height: 14px; }
.nd-diag__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--nd-text-primary);
  margin: 0;
}
.nd-diag__model {
  font-size: 11px;
  color: var(--nd-text-tertiary);
  margin: 0;
}
.nd-diag__loading {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--nd-text-tertiary);
  font-size: 12px;
  padding: var(--nd-sm) 0;
}
.nd-diag__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nd-cyan);
  animation: nd-pulse 1.4s ease-in-out infinite;
}
.nd-diag__dot:nth-child(2) { animation-delay: 0.2s; }
.nd-diag__dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes nd-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}
.nd-diag__body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--nd-text-secondary);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.nd-diag__body strong {
  color: var(--nd-text-primary);
  font-weight: 700;
}
.nd-diag__body code {
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 12px;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  color: var(--nd-cyan);
}
.nd-diag__cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--nd-cyan);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: nd-blink 1s steps(2) infinite;
}
@keyframes nd-blink {
  50% { opacity: 0; }
}

/* ---------- Workflows / list rows ---------- */
.nd-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(108, 92, 231, 0.15);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  color: var(--nd-indigo);
}
.nd-filter-pill svg { width: 12px; height: 12px; }
.nd-list { display: flex; flex-direction: column; }
.nd-list-row {
  display: flex;
  align-items: center;
  gap: var(--nd-md);
  padding: var(--nd-md) var(--nd-lg);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
}
.nd-list-row__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nd-list-row__icon svg { width: 16px; height: 16px; }
.nd-list-row__icon--indigo { background: rgba(108, 92, 231, 0.15); color: var(--nd-indigo); }
.nd-list-row__icon--neutral { background: rgba(160, 174, 192, 0.15); color: #A0AEC0; }
.nd-list-row__icon--cyan { background: rgba(0, 206, 201, 0.15); color: var(--nd-cyan); }
.nd-list-row__text { flex: 1; min-width: 0; }
.nd-list-row__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--nd-text-primary);
  margin: 0 0 4px;
}
.nd-list-row__meta {
  display: flex;
  align-items: center;
  gap: var(--nd-sm);
  flex-wrap: wrap;
}
.nd-tag {
  display: inline-flex;
  padding: 1px 8px;
  background: rgba(108, 92, 231, 0.1);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  color: var(--nd-indigo);
}
.nd-meta-time {
  font-size: 11px;
  color: var(--nd-text-secondary);
  font-weight: 500;
}

/* ---------- iOS toggle ---------- */
.nd-toggle {
  width: 44px;
  height: 26px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.16);
  position: relative;
  cursor: pointer;
  transition: background 0.25s ease;
  flex-shrink: 0;
  border: none;
  padding: 0;
}
.nd-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s ease;
}
.nd-toggle[aria-checked="true"] { background: var(--nd-indigo); }
.nd-toggle[aria-checked="true"]::after { transform: translateX(18px); }
.nd-toggle--cyan[aria-checked="true"] { background: var(--nd-cyan); }

/* ---------- Executions list ---------- */
.nd-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.nd-status-badge svg { width: 11px; height: 11px; }
.nd-status-badge--success { background: rgba(0, 184, 148, 0.15); color: var(--nd-success); }
.nd-status-badge--error { background: rgba(255, 107, 107, 0.15); color: var(--nd-error); }
.nd-status-badge--running { background: rgba(0, 206, 201, 0.15); color: var(--nd-running); }
.nd-status-badge--waiting { background: rgba(253, 203, 110, 0.15); color: var(--nd-warning); }
.nd-exec-row {
  display: flex;
  align-items: center;
  gap: var(--nd-md);
  padding: var(--nd-md) var(--nd-lg);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
}
.nd-exec-row__text { flex: 1; min-width: 0; }
.nd-exec-row__name {
  font-size: 14px;
  font-weight: 500;
  color: var(--nd-text-primary);
  margin: 0 0 4px;
  line-height: 1.3;
}
.nd-exec-row__meta {
  font-size: 11px;
  color: var(--nd-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--nd-sm);
}
.nd-exec-row__chev {
  color: var(--nd-text-tertiary);
  flex-shrink: 0;
}
.nd-exec-row__chev svg { width: 11px; height: 11px; }

/* ---------- Triggers ---------- */
.nd-trigger-tabs {
  display: flex;
  padding: 0 var(--nd-lg);
  margin-bottom: var(--nd-md);
  flex-shrink: 0;
}
.nd-trigger-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 0;
  color: var(--nd-text-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font: inherit;
}
.nd-trigger-tab__head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}
.nd-trigger-tab__head svg { width: 14px; height: 14px; }
.nd-trigger-tab__count {
  background: var(--nd-indigo);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 100px;
  line-height: 1.4;
}
.nd-trigger-tab__bar {
  height: 2px;
  width: 100%;
  background: transparent;
  border-radius: 1px;
}
.nd-trigger-tab[data-active="true"] { color: var(--nd-indigo); }
.nd-trigger-tab[data-active="true"] .nd-trigger-tab__bar {
  background: var(--nd-indigo);
}

.nd-info-card {
  margin: var(--nd-md) var(--nd-lg) 0;
  padding: var(--nd-md);
  background: var(--nd-surface);
  border-radius: 14px;
  display: flex;
  gap: var(--nd-md);
  align-items: flex-start;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.nd-info-card__icon {
  color: var(--nd-indigo);
  flex-shrink: 0;
  padding-top: 2px;
}
.nd-info-card__icon svg { width: 18px; height: 18px; }
.nd-info-card__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--nd-text-primary);
  margin: 0 0 2px;
}
.nd-info-card__body {
  font-size: 12px;
  color: var(--nd-text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ---------- Settings ---------- */
.nd-settings-section { margin-bottom: var(--nd-xl); }
.nd-settings-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--nd-indigo);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 var(--nd-lg) var(--nd-sm);
}
.nd-settings-card {
  margin: 0 var(--nd-lg);
  background: var(--nd-surface);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.nd-settings-row {
  display: flex;
  align-items: center;
  gap: var(--nd-md);
  padding: 12px var(--nd-md);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
}
.nd-settings-row:last-child { border-bottom: none; }
.nd-settings-row__icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nd-settings-row__icon svg { width: 14px; height: 14px; }
.nd-settings-row__icon--indigo { background: rgba(108, 92, 231, 0.15); color: var(--nd-indigo); }
.nd-settings-row__icon--cyan { background: rgba(0, 206, 201, 0.15); color: var(--nd-cyan); }
.nd-settings-row__icon--warning { background: rgba(253, 203, 110, 0.15); color: var(--nd-warning); }
.nd-settings-row__text { flex: 1; min-width: 0; }
.nd-settings-row__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--nd-text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nd-settings-row__sub {
  font-size: 12px;
  color: var(--nd-text-secondary);
  margin: 1px 0 0;
}
.nd-settings-row__value {
  font-size: 14px;
  color: var(--nd-text-secondary);
  margin-right: 4px;
}
.nd-settings-row__chev { color: var(--nd-text-tertiary); }
.nd-settings-row__chev svg { width: 11px; height: 11px; }
.nd-tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: linear-gradient(90deg, var(--nd-indigo), var(--nd-cyan));
  color: #fff;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nd-cloud-pill {
  padding: 1px 7px;
  background: rgba(0, 206, 201, 0.10);
  color: var(--nd-cyan);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
}

/* ---------- Tab bar ---------- */
.nd-tabbar {
  display: flex;
  justify-content: space-around;
  padding: 8px 4px 28px;
  background: rgba(13, 13, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}
.nd-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--nd-text-tertiary);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  font: inherit;
  transition: color 0.15s ease;
}
.nd-tab svg { width: 22px; height: 22px; }
.nd-tab[data-active="true"] {
  color: var(--nd-indigo);
  font-weight: 600;
}
.nd-tab span { font-size: 10px; line-height: 1.2; }

/* ---------- AI Workflow Builder bottom sheet ---------- */
.nd-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 10;
  border-radius: var(--screen-radius);
}
.nd-sheet-backdrop[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}
.nd-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--nd-bg);
  border-radius: 24px 24px var(--screen-radius) var(--screen-radius);
  transform: translateY(110%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 20;
  max-height: 92%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.nd-sheet[data-open="true"] {
  transform: translateY(0);
}
.nd-sheet__handle {
  width: 38px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.25);
  margin: 8px auto 0;
  flex-shrink: 0;
}
.nd-sheet__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px var(--nd-xxl);
  flex-shrink: 0;
}
.nd-sheet__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--nd-text-primary);
  margin: 0;
}
.nd-sheet__close {
  border: none;
  background: transparent;
  color: var(--nd-indigo);
  font-size: 16px;
  padding: 4px 0;
  cursor: pointer;
  font: inherit;
}
.nd-sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--nd-lg) var(--nd-lg);
  display: flex;
  flex-direction: column;
  gap: var(--nd-md);
}
.nd-sheet__body::-webkit-scrollbar { display: none; }

.nd-builder__model-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--nd-text-secondary);
  margin: 0 0 var(--nd-sm);
}
.nd-builder__model-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--nd-sm) var(--nd-md);
  background: var(--nd-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin-bottom: var(--nd-md);
  font-size: 14px;
  color: var(--nd-text-primary);
}
.nd-builder__model-pick svg { color: var(--nd-text-tertiary); }
.nd-builder__describe-card {
  padding: var(--nd-lg);
  border-radius: 16px;
  background: var(--nd-surface);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.nd-builder__describe-head {
  display: flex;
  align-items: center;
  gap: var(--nd-sm);
  margin-bottom: var(--nd-md);
}
.nd-builder__describe-head svg {
  color: var(--nd-indigo);
  width: 20px;
  height: 20px;
}
.nd-builder__describe-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--nd-text-primary);
  margin: 0;
}
.nd-builder__describe-help {
  font-size: 13px;
  color: var(--nd-text-tertiary);
  margin: 0 0 var(--nd-md);
  line-height: 1.5;
}
.nd-builder__textarea {
  width: 100%;
  padding: var(--nd-md);
  background: var(--nd-elevated);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--nd-text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  min-height: 110px;
  resize: none;
  outline: none;
}
.nd-builder__textarea::placeholder { color: var(--nd-text-tertiary); }
.nd-builder__textarea:focus { border-color: var(--nd-indigo); }
.nd-builder__samples {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--nd-md);
}
.nd-builder__samples-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--nd-text-tertiary);
  margin: 0 0 2px;
}
.nd-builder__sample {
  text-align: left;
  padding: 10px 12px;
  background: rgba(108, 92, 231, 0.10);
  border: 1px solid rgba(108, 92, 231, 0.25);
  border-radius: 10px;
  color: var(--nd-text-primary);
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.nd-builder__sample:hover { background: rgba(108, 92, 231, 0.18); }
.nd-builder__sample:active { transform: scale(0.98); }
.nd-builder__build {
  width: 100%;
  padding: 14px;
  background: var(--nd-indigo);
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--nd-sm);
}
.nd-builder__build:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.nd-builder__build:not(:disabled):hover {
  background: var(--nd-indigo-light);
}
.nd-builder__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: nd-spin 0.8s linear infinite;
}
@keyframes nd-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Workflow result canvas ---------- */
.nd-result {
  margin-top: var(--nd-md);
  padding: var(--nd-lg);
  background: var(--nd-surface);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.nd-result__head {
  display: flex;
  align-items: center;
  gap: var(--nd-sm);
  margin-bottom: var(--nd-md);
}
.nd-result__head svg {
  color: var(--nd-success);
  width: 16px;
  height: 16px;
}
.nd-result__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--nd-text-primary);
  margin: 0;
}
.nd-result__count {
  font-size: 11px;
  color: var(--nd-text-tertiary);
  margin-left: auto;
  font-family: "SF Mono", ui-monospace, monospace;
}
.nd-canvas {
  position: relative;
  width: 100%;
  height: 280px;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0, 206, 201, 0.06) 0%, transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: auto, auto, 16px 16px, 16px 16px;
  background-color: var(--nd-bg);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
.nd-canvas svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.nd-canvas-edge {
  fill: none;
  stroke: var(--nd-indigo);
  stroke-width: 1.5;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  transition: stroke-dashoffset 0.5s ease;
  opacity: 0.6;
}
.nd-canvas-edge[data-visible="true"] {
  stroke-dashoffset: 0;
  opacity: 0.7;
}
.nd-node {
  position: absolute;
  transform: translate(-50%, -50%) scale(0.5);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  background: var(--nd-elevated);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--nd-text-primary);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.nd-node[data-visible="true"] {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.nd-node__dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 8px;
  font-weight: 700;
}
.nd-node--trigger .nd-node__dot { background: var(--nd-indigo); color: #fff; }
.nd-node--ai .nd-node__dot { background: var(--nd-cyan); color: var(--nd-bg); }
.nd-node--branch .nd-node__dot { background: var(--nd-warning); color: var(--nd-bg); }
.nd-node--slack .nd-node__dot { background: #4A154B; color: #fff; }
.nd-node--linear .nd-node__dot { background: #5E6AD2; color: #fff; }

/* ---------- Click-me hint pill ---------- */
.nd-hint {
  position: absolute;
  z-index: 90;
  padding: 7px 14px;
  background: var(--nd-indigo);
  color: #fff;
  border-radius: 100px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.5);
  animation: nd-hint-bounce 1.6s ease-in-out infinite;
  white-space: nowrap;
}
/* Position: just above the first error row, horizontally centred-ish */
.nd-hint--errors {
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
}
.nd-hint svg {
  width: 12px;
  height: 12px;
}
.nd-hint[data-visible="false"] {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
@keyframes nd-hint-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}

/* ---------- Reset pill ---------- */
.nd-reset {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 100;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--nd-text-secondary);
  border-radius: 100px;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.nd-reset[data-visible="true"] {
  opacity: 1;
  transform: translateY(0);
}
.nd-reset:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--nd-text-primary);
}
.nd-reset svg { width: 11px; height: 11px; }

/* ---------- Force pointer cursor on all interactive elements ---------- */
.nd button,
.nd [data-tab-btn],
.nd [data-trigger-tab],
.nd [data-diag] {
  cursor: pointer;
}

/* ---------- Mobile responsive ---------- */
@media (max-width: 768px) {
  .nd { padding: 0.75rem 0; }
  .nd-phone { --phone-w: 340px; }
}

@media (max-width: 480px) {
  .nd { padding: 0.5rem 0; }
  .nd-phone {
    --phone-w: min(340px, calc(100vw - 24px));
    --phone-radius: 42px;
    --screen-radius: 32px;
    padding: 6px;
  }
  .nd-island { width: 95px; height: 26px; }
  .nd-statusbar { padding: 12px 22px 6px; font-size: 13px; }
  .nd-nav { padding: 6px var(--nd-xl) var(--nd-sm); }
  .nd-nav__title { font-size: 28px; }
  .nd-hero__value { font-size: 30px; }
  .nd-stat__value { font-size: 20px; }
  .nd-aibuilder__icon { width: 42px; height: 42px; }
  .nd-aibuilder__icon svg { width: 22px; height: 22px; }
  .nd-canvas { height: 240px; }
  .nd-node { font-size: 9px; padding: 5px 7px; }
  .nd-tab span { font-size: 9px; }
  .nd-tabbar { padding: 6px 2px 24px; }
  .nd-hint { font-size: 11px; padding: 6px 10px; }
}

@media (max-width: 360px) {
  .nd-phone {
    --phone-w: calc(100vw - 12px);
    --phone-radius: 38px;
    --screen-radius: 28px;
    padding: 5px;
  }
  .nd-nav { padding: 4px 18px var(--nd-sm); }
  .nd-nav__title { font-size: 26px; }
  .nd-stats { gap: 8px; }
  .nd-stat { padding: var(--nd-md); }
  .nd-stat__icon { width: 32px; height: 32px; }
  .nd-stat__value { font-size: 18px; }
  .nd-stat__label { font-size: 12px; }
  .nd-card { margin: 0 var(--nd-md); padding: var(--nd-md); }
  .nd-aibuilder { margin: 0 var(--nd-md); padding: var(--nd-md); width: calc(100% - 24px); }
  .nd-aibuilder__title { font-size: 15px; }
  .nd-aibuilder__sub { font-size: 12px; }
  .nd-list-row { padding: var(--nd-sm) var(--nd-md); }
  .nd-exec-row { padding: var(--nd-sm) var(--nd-md); }
  .nd-tab svg { width: 20px; height: 20px; }
  .nd-tab span { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .nd-pane,
  .nd-diag,
  .nd-sheet,
  .nd-node,
  .nd-canvas-edge,
  .nd-error-row,
  .nd-reset,
  .nd-toggle,
  .nd-toggle::after,
  .nd-hint { transition: none !important; animation: none !important; }
  .nd-diag__cursor { animation: none; opacity: 0; }
  .nd-diag__dot { animation: none; opacity: 0.6; }
  .nd-builder__spinner { animation: none; border-top-color: rgba(255, 255, 255, 0.3); }
}

/* ============================================================
   v2 — Detail screens (push/pop stack navigation)
   ============================================================ */

.nd-detail-stack {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}

.nd-detail {
  position: absolute;
  inset: 0;
  background: var(--nd-bg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: auto;
  z-index: 1;
}
.nd-detail[data-active="true"] {
  transform: translateX(0);
}
.nd-detail[data-popping="true"] {
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0.0, 1, 1);
}

/* Back-button nav header */
.nd-detail__nav {
  display: flex;
  align-items: center;
  gap: var(--nd-md);
  padding: 8px var(--nd-lg) var(--nd-md);
  flex-shrink: 0;
}
.nd-detail__back {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--nd-indigo);
  font: inherit;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.nd-detail__back:active {
  background: rgba(255, 255, 255, 0.12);
}
.nd-detail__back svg {
  width: 18px;
  height: 18px;
}
.nd-detail__title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  color: var(--nd-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nd-detail__action {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--nd-indigo);
  cursor: pointer;
  flex-shrink: 0;
}
.nd-detail__action svg {
  width: 18px;
  height: 18px;
}

.nd-detail__content {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 var(--nd-xxl);
  -webkit-overflow-scrolling: touch;
}
.nd-detail__content::-webkit-scrollbar { display: none; }
.nd-detail__content { scrollbar-width: none; }

/* ============================================================
   Workflow detail screen
   ============================================================ */

.nd-wfd__hero {
  padding: var(--nd-md) var(--nd-lg) var(--nd-xl);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
  margin-bottom: var(--nd-lg);
}
.nd-wfd__name {
  font-size: 28px;
  font-weight: 700;
  color: var(--nd-text-primary);
  margin: 0 0 var(--nd-sm);
  line-height: 1.2;
  letter-spacing: -0.4px;
}
.nd-wfd__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--nd-sm);
  margin-bottom: var(--nd-md);
}
.nd-wfd__active-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--nd-md);
  background: var(--nd-surface);
  border-radius: 12px;
  margin-bottom: var(--nd-sm);
}
.nd-wfd__active-label {
  display: flex;
  align-items: center;
  gap: var(--nd-sm);
  font-size: 14px;
  color: var(--nd-text-primary);
  font-weight: 500;
}
.nd-wfd__active-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nd-success);
  box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.6);
  animation: nd-pulse-dot 2s ease-out infinite;
}
@keyframes nd-pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(0, 184, 148, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0); }
}

.nd-wfd__section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--nd-text-tertiary);
  padding: 0 var(--nd-lg) var(--nd-sm);
  margin: var(--nd-md) 0 0;
}

/* AI feature grid */
.nd-aigrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--nd-sm);
  padding: 0 var(--nd-lg);
}
.nd-aifeat {
  background: var(--nd-surface);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: var(--nd-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}
.nd-aifeat:active {
  transform: scale(0.97);
}
.nd-aifeat:hover {
  background: var(--nd-elevated);
}
.nd-aifeat__icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--nd-indigo), var(--nd-cyan));
  color: #fff;
  margin-bottom: var(--nd-xs);
}
.nd-aifeat__icon svg {
  width: 16px;
  height: 16px;
}
.nd-aifeat__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--nd-text-primary);
  margin: 0;
  line-height: 1.2;
}
.nd-aifeat__desc {
  font-size: 11px;
  color: var(--nd-text-tertiary);
  margin: 0;
  line-height: 1.35;
}

/* ============================================================
   AI feature output screen
   ============================================================ */

.nd-aiout {
  padding: 0 var(--nd-lg) var(--nd-lg);
}
.nd-aiout__hero {
  display: flex;
  align-items: center;
  gap: var(--nd-md);
  padding: var(--nd-sm) 0 var(--nd-lg);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
  margin-bottom: var(--nd-lg);
}
.nd-aiout__hero-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--nd-indigo), var(--nd-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.nd-aiout__hero-icon svg {
  width: 22px;
  height: 22px;
}
.nd-aiout__hero-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--nd-text-primary);
  margin: 0 0 2px;
  letter-spacing: -0.2px;
}
.nd-aiout__hero-context {
  font-size: 12px;
  color: var(--nd-text-tertiary);
  margin: 0;
}
.nd-aiout__hero-context strong {
  color: var(--nd-text-secondary);
  font-weight: 500;
}

.nd-aiout__model-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--nd-sm) var(--nd-md);
  background: var(--nd-elevated);
  border-radius: 10px;
  margin-bottom: var(--nd-md);
  font-size: 12px;
}
.nd-aiout__model-name {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--nd-text-secondary);
  font-weight: 500;
}
.nd-aiout__model-name svg {
  width: 12px;
  height: 12px;
  color: var(--nd-cyan);
}
.nd-aiout__model-time {
  color: var(--nd-text-tertiary);
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 11px;
}

.nd-aiout__body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--nd-text-secondary);
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 200px;
}
.nd-aiout__body strong {
  color: var(--nd-text-primary);
  font-weight: 700;
}
.nd-aiout__body code {
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 12px;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  color: var(--nd-cyan);
}
.nd-aiout__body pre {
  background: var(--nd-elevated);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: var(--nd-sm) var(--nd-md);
  overflow-x: auto;
  margin: var(--nd-sm) 0;
  font-size: 11px;
  line-height: 1.5;
}
.nd-aiout__body pre code {
  background: none;
  padding: 0;
  color: var(--nd-text-primary);
  font-size: 11px;
}

/* Loading state */
.nd-aiout__loading {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--nd-text-tertiary);
  font-size: 13px;
  padding: var(--nd-md) 0;
}
.nd-aiout__loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nd-cyan);
  animation: nd-pulse 1.4s ease-in-out infinite;
}
.nd-aiout__loading-dot:nth-child(2) { animation-delay: 0.2s; }
.nd-aiout__loading-dot:nth-child(3) { animation-delay: 0.4s; }

/* Debug Companion chat thread variant */
.nd-chat {
  display: flex;
  flex-direction: column;
  gap: var(--nd-sm);
}
.nd-chat__bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.5;
}
.nd-chat__bubble--user {
  align-self: flex-end;
  background: var(--nd-indigo);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.nd-chat__bubble--ai {
  align-self: flex-start;
  background: var(--nd-elevated);
  color: var(--nd-text-secondary);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.nd-chat__bubble--ai strong {
  color: var(--nd-text-primary);
  font-weight: 600;
}
.nd-chat__bubble--ai code {
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 11px;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--nd-cyan);
}
.nd-chat__sender {
  font-size: 10px;
  color: var(--nd-text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 14px;
}
.nd-chat__sender--ai {
  align-self: flex-start;
}
.nd-chat__sender--user {
  align-self: flex-end;
}

/* ============================================================
   Trigger detail screen (location)
   ============================================================ */

.nd-trd__hero {
  padding: var(--nd-md) var(--nd-lg) var(--nd-md);
}
.nd-trd__name {
  font-size: 24px;
  font-weight: 700;
  color: var(--nd-text-primary);
  margin: 0 0 var(--nd-xs);
  line-height: 1.2;
  letter-spacing: -0.3px;
}
.nd-trd__sub {
  font-size: 13px;
  color: var(--nd-text-secondary);
  margin: 0;
}

/* Mock map for location triggers */
.nd-map {
  position: relative;
  margin: var(--nd-md) var(--nd-lg) var(--nd-lg);
  height: 180px;
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(108, 92, 231, 0.08) 0%, transparent 60%),
    var(--nd-elevated);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.nd-map__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
}
.nd-map__streets {
  position: absolute;
  inset: 0;
}
.nd-map__streets path {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
  fill: none;
  stroke-linecap: round;
}
.nd-map__streets path.thin {
  stroke-width: 2;
  stroke: rgba(255, 255, 255, 0.04);
}
.nd-map__radius {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108, 92, 231, 0.25) 0%, rgba(108, 92, 231, 0.08) 70%, transparent 100%);
  border: 1.5px solid var(--nd-indigo);
  box-shadow: 0 0 30px rgba(108, 92, 231, 0.3);
}
.nd-map__pin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -100%);
  z-index: 2;
}
.nd-map__pin svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
  color: var(--nd-indigo);
}
.nd-map__pin::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  z-index: -1;
}

/* NFC tag visualisation */
.nd-nfc-tag {
  margin: var(--nd-md) var(--nd-lg) var(--nd-lg);
  height: 180px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 206, 201, 0.08) 0%, rgba(108, 92, 231, 0.05) 100%);
  border: 1px solid rgba(0, 206, 201, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.nd-nfc-tag__waves {
  position: absolute;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nd-nfc-tag__wave {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--nd-cyan);
  opacity: 0;
  animation: nd-nfc-wave 2.4s ease-out infinite;
}
.nd-nfc-tag__wave:nth-child(1) { width: 60px; height: 60px; animation-delay: 0s; }
.nd-nfc-tag__wave:nth-child(2) { width: 60px; height: 60px; animation-delay: 0.6s; }
.nd-nfc-tag__wave:nth-child(3) { width: 60px; height: 60px; animation-delay: 1.2s; }
@keyframes nd-nfc-wave {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}
.nd-nfc-tag__core {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--nd-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nd-bg);
  z-index: 2;
  box-shadow: 0 0 20px rgba(0, 206, 201, 0.5);
}
.nd-nfc-tag__core svg {
  width: 24px;
  height: 24px;
}
.nd-nfc-tag__id {
  position: absolute;
  bottom: 12px;
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--nd-text-tertiary);
  letter-spacing: 0.05em;
}

/* Detail rows shared between location and NFC */
.nd-trd__rows {
  margin: 0 var(--nd-lg);
  background: var(--nd-surface);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.nd-trd__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--nd-md);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
  gap: var(--nd-sm);
}
.nd-trd__row:last-child {
  border-bottom: none;
}
.nd-trd__row-label {
  font-size: 13px;
  color: var(--nd-text-secondary);
  font-weight: 500;
}
.nd-trd__row-value {
  font-size: 13px;
  color: var(--nd-text-primary);
  font-weight: 500;
  font-family: "SF Mono", ui-monospace, monospace;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}
.nd-trd__row-value--regular {
  font-family: inherit;
}

.nd-trd__history {
  margin: var(--nd-lg) var(--nd-lg) 0;
}
.nd-trd__history-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--nd-text-tertiary);
  margin: 0 0 var(--nd-sm);
}
.nd-trd__history-list {
  background: var(--nd-surface);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.nd-trd__history-row {
  display: flex;
  align-items: center;
  gap: var(--nd-sm);
  padding: 10px var(--nd-md);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
}
.nd-trd__history-row:last-child {
  border-bottom: none;
}
.nd-trd__history-icon {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.nd-trd__history-icon--success { background: var(--nd-success); }
.nd-trd__history-icon--enter { background: var(--nd-indigo); }
.nd-trd__history-icon--exit { background: var(--nd-warning); }
.nd-trd__history-event {
  flex: 1;
  color: var(--nd-text-secondary);
}
.nd-trd__history-time {
  color: var(--nd-text-tertiary);
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 11px;
}

/* Mobile tweaks for new screens */
@media (max-width: 480px) {
  .nd-wfd__name { font-size: 24px; }
  .nd-aigrid { gap: 6px; }
  .nd-aifeat { padding: 10px; }
  .nd-aifeat__name { font-size: 12px; }
  .nd-aifeat__desc { font-size: 10px; }
  .nd-aiout__hero-name { font-size: 16px; }
  .nd-aiout__body { font-size: 12px; }
  .nd-trd__name { font-size: 22px; }
  .nd-map { height: 150px; }
  .nd-nfc-tag { height: 150px; }
}
