/* ==========================================================================
   n8n Mobile Wrapper - Design System & UI Style
   ========================================================================== */

/* Base design tokens - dark values act as the default fallback (matches the
   app's native dark identity) before the theme class variables load. */
:root {
  --n8n-bg: #090d16;
  --n8n-bg-light: #05070c;
  --n8n-surface: #101827;
  --n8n-surface-raised: #171f2f;
  --n8n-border: #1f293d;
  --n8n-border-dark: #334155;

  /* Brand accent - reserved for primary actions/highlights, not decoration */
  --n8n-primary: #ff6d5a;
  --n8n-primary-rgb: 255, 109, 90;
  --n8n-primary-hover: #ff8571;
  --n8n-dark: #1f2937;

  /* Status colors - the only place color should carry meaning */
  --n8n-success: #22c55e;
  --n8n-error: #f87171;
  --n8n-warning: #fbbf24;
  --n8n-info: #38bdf8;

  /* Text colors */
  --n8n-text: #e2e8f0;
  --n8n-text-dark: #ffffff;
  --n8n-text-muted: #8892b0;
  --n8n-text-light: #5b6478;

  /* Heights & Navigation */
  --header-height: 56px;
  --nav-height: 60px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12);

  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-header: 'Outfit', -apple-system, sans-serif;
  --font-mono: 'Fira Code', monospace;
}

html {
  font-size: 16px;
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-sans);
  background-color: var(--n8n-bg);
  color: var(--n8n-text);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  position: fixed;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: var(--font-header);
  font-weight: 600;
  color: var(--n8n-text);
}

/* Layout container */
.n8n-layout {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background-color: var(--n8n-bg-light);
}

/* Header layout */
.n8n-header {
  flex-shrink: 0;
  height: 3rem;
  background-color: var(--n8n-surface);
  border-bottom: 1px solid var(--n8n-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.n8n-logo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.n8n-logo-icon {
  font-size: 1.35rem;
}

.n8n-logo-text {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  color: var(--n8n-dark);
}

.n8n-logo-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--n8n-primary);
  background-color: rgba(255, 109, 90, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: block;
}

.badge-demo {
  background-color: rgba(255, 109, 90, 0.08);
  color: var(--n8n-primary);
  border-color: rgba(255, 109, 90, 0.2);
}

.badge-demo .badge-dot {
  background-color: var(--n8n-primary);
  box-shadow: 0 0 6px var(--n8n-primary);
}

.badge-live {
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--n8n-success);
  border-color: rgba(16, 185, 129, 0.2);
}

.badge-live .badge-dot {
  background-color: var(--n8n-success);
  box-shadow: 0 0 6px var(--n8n-success);
  animation: pulse-badge 2s infinite;
}

.badge-disconnected {
  background-color: rgba(239, 68, 68, 0.08);
  color: var(--n8n-error);
  border-color: rgba(239, 68, 68, 0.2);
}

.badge-disconnected .badge-dot {
  background-color: var(--n8n-error);
}

/* Main content viewports */
.n8n-main {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: var(--n8n-bg-light);
}

.n8n-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  display: none;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.99);
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#view-workflows {
  overflow: hidden !important;
  padding: 0 12px;
  background-color: var(--n8n-bg-light);
}

.n8n-view.active {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

/* Bottom Navigation Bar (MD3 Style) */
.n8n-navbar {
  flex-shrink: 0;
  height: 4.8rem;
  background-color: var(--n8n-surface);
  border-top: 1px solid var(--n8n-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -3px 16px rgba(0, 0, 0, 0.04);
}

.n8n-nav-item {
  background: none;
  border: none;
  color: var(--n8n-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  height: 100%;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: color 0.2s ease;
  flex: 1;
}

.n8n-nav-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 1.8rem;
  border-radius: 0.9rem;
  transition: background-color 0.2s ease, color 0.2s ease;
  color: var(--n8n-text-muted);
}

.n8n-nav-icon-svg {
  width: 1.15rem;
  height: 1.15rem;
}

.n8n-nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  transition: font-weight 0.2s ease, color 0.2s ease;
}

.n8n-nav-item.active .n8n-nav-icon-wrapper {
  background-color: rgba(255, 109, 90, 0.12);
  color: var(--n8n-primary);
}

.n8n-nav-item.active .n8n-nav-label {
  color: var(--n8n-primary);
  font-weight: 700;
}

/* VIEW: Workflows dropdown bar styling */
.workflow-dropdown-bar {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background-color: var(--n8n-surface);
  border-left: 4px solid var(--n8n-border-dark);
  border-right: 4px solid var(--n8n-border-dark);
  border-top: 4px solid var(--n8n-border-dark);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  gap: 12px;
  z-index: 10;
}

.workflow-dropdown-bar select {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  background-color: var(--n8n-bg);
  color: var(--n8n-text);
  border: 1px solid var(--n8n-border-dark);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.workflow-dropdown-bar select:focus {
  border-color: var(--n8n-primary);
}

.action-icon-btn {
  background-color: var(--n8n-surface);
  border: 1px solid var(--n8n-border-dark);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Canvas Viewport */
.n8n-canvas-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: var(--n8n-bg);
  touch-action: none;
}

.n8n-svg-layer {
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.n8n-svg-layer:active {
  cursor: grabbing;
}

/* Floating canvas controls */
.n8n-canvas-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.n8n-ctrl-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.8);
  color: var(--n8n-text-dark);
  font-size: 1.2rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
}

.n8n-ctrl-btn:active {
  transform: scale(0.9);
  background-color: var(--n8n-bg-light);
}

.n8n-canvas-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(31, 41, 55, 0.85);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.72rem;
  pointer-events: none;
  animation: fade-out-hint 5s forwards;
  animation-delay: 2s;
  box-shadow: var(--shadow-md);
}

/* Canvas Node SVGs layout */
.svg-node-rect {
  fill: var(--n8n-surface);
  /* stroke and stroke-width are set dynamically in JS */
  rx: 12px;
  ry: 12px;
  transition: stroke 0.15s ease, stroke-width 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.node-group.selected .svg-node-rect {
  stroke: var(--n8n-primary) !important;
  stroke-width: 2.5px !important;
}

.node-group.selected .svg-node-shadow {
  fill: rgba(255, 109, 90, 0.25);
}

.svg-node-shadow {
  fill: rgba(15, 23, 42, 0.04);
  rx: 12px;
  ry: 12px;
}

.svg-node-icon-bg {
  fill: #f1f5f9;
  rx: 8px;
  ry: 8px;
}

.svg-node-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 24px;
  fill: var(--n8n-text-dark);
  text-anchor: middle;
}

.svg-node-type {
  display: none; /* hidden on compact square layout */
}

/* n8n signature connector handle dots */
.svg-node-connector {
  fill: var(--n8n-surface);
  stroke: var(--n8n-border-dark);
  stroke-width: 1px;
  r: 4;
  cursor: pointer;
}

.svg-node-connector:hover {
  fill: var(--n8n-primary);
  stroke: var(--n8n-primary);
}

.svg-handle-group {
  cursor: pointer;
}

.svg-handle-group.handle-active .svg-node-connector {
  r: 13;
  fill: var(--n8n-primary);
  stroke: #ffffff;
  stroke-width: 2px;
}

.svg-handle-touch {
  cursor: pointer;
}

/* Status Indicator Dot on Nodes */
.svg-node-status-dot {
  r: 3.5;
}

.svg-node-status-dot.success {
  fill: var(--n8n-success);
}

.svg-node-status-dot.failed {
  fill: var(--n8n-error);
}

.svg-node-status-dot.running {
  fill: var(--n8n-info);
  animation: pulse-badge 1s infinite;
}

/* Connection wires paths */
.svg-connection-wire {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1.5;
  transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

.svg-connection-wire.active {
  stroke: var(--n8n-primary);
  stroke-width: 2;
}

.svg-connection-wire.active:hover {
  stroke: #334155;
  stroke-width: 2.5;
  cursor: pointer;
}

.svg-connection-wire.selected {
  stroke: var(--n8n-primary) !important;
  stroke-width: 3px !important;
}

.svg-connection-wire.temp-connecting {
  stroke: var(--n8n-primary);
  stroke-width: 2px;
  stroke-dasharray: 6 5;
  opacity: 0.85;
  pointer-events: none;
}

.svg-wire-delete-btn {
  cursor: pointer;
}

.svg-wire-delete-btn circle {
  fill: #ffffff;
  stroke: var(--n8n-error);
  stroke-width: 2px;
  filter: drop-shadow(0 1px 3px rgba(15, 23, 42, 0.25));
}

.svg-wire-delete-btn text {
  fill: var(--n8n-error);
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-sans);
  user-select: none;
}

/* VIEW: Executions layout styling */
.executions-filter-header {
  padding: 16px;
  background-color: var(--n8n-surface);
  border-bottom: 1px solid var(--n8n-border);
}

.executions-filter-header h2 {
  font-size: 1.35rem;
  margin-bottom: 10px;
}

.executions-filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.n8n-pill {
  background-color: var(--n8n-surface);
  border: 1px solid var(--n8n-border-dark);
  color: var(--n8n-text-muted);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.n8n-pill.active {
  background-color: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

.executions-scroller {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}

.n8n-executions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.execution-card {
  background-color: var(--n8n-surface);
  border: 1px solid var(--n8n-border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.execution-card:active {
  transform: scale(0.98);
  background-color: var(--n8n-bg-light);
  border-color: var(--n8n-border-dark);
}

.exec-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.exec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.exec-workflow-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--n8n-text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.exec-id {
  font-family: var(--n8n-font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--n8n-text);
}

.exec-time {
  font-size: 0.75rem;
  color: var(--n8n-text-muted);
}

/* Badge tags */
.n8n-badge-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 12px;
}

.tag-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--n8n-success);
}

.tag-failed {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--n8n-error);
}

.tag-running {
  background-color: rgba(0, 132, 255, 0.1);
  color: var(--n8n-info);
}

/* VIEW: Settings styling */
.settings-intro {
  padding: 16px;
}

.settings-intro h2 {
  font-size: 1.35rem;
  margin-bottom: 4px;
}

.settings-intro p {
  font-size: 0.82rem;
  color: var(--n8n-text-muted);
}

.n8n-settings-form {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.n8n-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.n8n-field-group.row-flex {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  background-color: var(--n8n-surface);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--n8n-border);
}

.toggle-description {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.n8n-field-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--n8n-text);
}

.n8n-field-group input[type="url"], .n8n-field-group input[type="password"], .n8n-field-group input[type="text"] {
  background-color: var(--n8n-surface);
  border: 1px solid var(--n8n-border-dark);
  color: var(--n8n-text);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
  font-family: var(--font-sans);
  transition: border-color 0.15s;
  width: 100%;
}

.n8n-field-group input:focus {
  border-color: var(--n8n-primary);
}

.n8n-field-group small {
  font-size: 0.75rem;
  color: var(--n8n-text-muted);
}

/* Toggle Switches */
.n8n-switch-ui {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.n8n-switch-ui input {
  opacity: 0;
  width: 0;
  height: 0;
}

.n8n-slider-ui {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 34px;
}

.n8n-slider-ui:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .n8n-slider-ui {
  background-color: var(--n8n-primary);
}

input:checked + .n8n-slider-ui:before {
  transform: translateX(20px);
}

/* UI Buttons styling */
.n8n-btn {
  padding: 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.15s, transform 0.1s ease;
}

.n8n-btn:active {
  transform: scale(0.99);
}

.n8n-btn-primary {
  background-color: var(--n8n-primary);
  color: #ffffff;
}

.n8n-btn-primary:hover {
  background-color: var(--n8n-primary-hover);
}

.n8n-btn-secondary {
  background-color: var(--n8n-surface);
  border: 1px solid var(--n8n-border-dark);
  color: var(--n8n-text);
}

.n8n-btn-secondary:hover {
  background-color: var(--n8n-bg);
}

.n8n-btn-danger {
  background-color: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--n8n-error);
}

.n8n-btn-danger:hover {
  background-color: rgba(248, 113, 113, 0.18);
}

.btn-block {
  width: 100%;
}

.settings-btn-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.n8n-cors-guide {
  margin: 20px 16px;
  background-color: var(--n8n-bg-light);
  border: 1px solid var(--n8n-border);
  border-radius: 6px;
  padding: 12px;
  font-size: 0.8rem;
}

.n8n-cors-guide h4 {
  font-size: 0.85rem;
  color: var(--n8n-text);
  margin-bottom: 4px;
}

.n8n-cors-guide p {
  color: var(--n8n-text-muted);
}

.code-block-snippet {
  margin-top: 6px;
  background-color: #1e293b;
  color: #f8fafc;
  padding: 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  overflow-x: auto;
}

/* OVERLAYS: Dynamic Bottom Sheets */
.n8n-bottom-sheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  z-index: 200;
  display: none;
  align-items: flex-end; /* Sheet align bottom */
}

.n8n-bottom-sheet.active {
  display: flex;
}

.sheet-card {
  width: 100%;
  height: 90vh;
  max-height: 90vh;
  background-color: var(--n8n-surface);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  border-top: 1px solid var(--n8n-border-dark);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom);
}

.n8n-bottom-sheet.active .sheet-card {
  transform: translateY(0);
}

.sheet-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--n8n-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-node-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.node-avatar {
  font-size: 1.5rem;
  width: 34px;
  height: 34px;
  background-color: var(--n8n-bg-light);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-header h3 {
  font-size: 1.05rem;
  color: var(--n8n-text);
}

.sheet-header p {
  font-size: 0.75rem;
  color: var(--n8n-text-muted);
}

.sheet-close-btn {
  background: none;
  border: none;
  color: var(--n8n-text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

/* Tabs inside bottom sheets */
.sheet-tabs-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--n8n-border);
  background-color: var(--n8n-bg-light);
}

.sheet-tab-btn {
  background: none;
  border: none;
  color: var(--n8n-text-muted);
  padding: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.sheet-tab-btn.active {
  color: var(--n8n-primary);
  border-bottom-color: var(--n8n-primary);
  background-color: var(--n8n-surface);
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 220px;
}

.sheet-body.flex-vertical {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-tab-panel {
  display: none;
}

.sheet-tab-panel.active {
  display: block;
}

/* Code Inspector Panel */
.code-block-viewer {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
  color: #38bdf8; /* Clean blue */
  display: block;
  user-select: text;
  background-color: #0f172a; /* Slate 900 background */
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #1e293b;
  max-height: 320px;
  overflow-y: auto;
}

/* Inspector parameters dynamic form rendering */
.dynamic-form-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-field-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field-row label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--n8n-text);
}

.form-field-row input, .form-field-row textarea, .form-field-row select {
  background-color: var(--n8n-surface);
  border: 1px solid var(--n8n-border-dark);
  color: var(--n8n-text);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}

.form-field-row input:focus, .form-field-row textarea:focus {
  border-color: var(--n8n-primary);
}

.form-field-row textarea {
  min-height: 80px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.kv-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kv-editor-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kv-editor-row input,
.kv-editor-row select {
  background-color: var(--n8n-surface);
  border: 1px solid var(--n8n-border-dark);
  color: var(--n8n-text);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  flex: 1;
  min-width: 0;
}

.kv-editor-row input:focus,
.kv-editor-row select:focus {
  border-color: var(--n8n-primary);
}

/* Condition rows stack vertically - 3 elements side by side never fit a phone width */
.condition-row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 10px;
  background-color: var(--n8n-bg-light);
  border-radius: 6px;
}

.condition-row select {
  width: 100%;
}

.kv-editor-remove {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid var(--n8n-border-dark);
  background: var(--n8n-surface);
  color: var(--n8n-error);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.kv-editor-add {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 0.78rem;
  padding: 6px 12px;
}

/* ==========================================================================
   AUTHENTIC N8N FIELD COMPONENTS (fx expression fields, Fixed/Expression
   toggle, section headers, add buttons) - mirrors the real n8n parameter UI
   ========================================================================== */

.n8n-field-section-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--n8n-text-dark);
  padding-bottom: 6px;
  margin-top: 4px;
  border-bottom: 1px solid var(--n8n-border);
}

.n8n-field-expr-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.n8n-fixed-expr-toggle {
  display: inline-flex;
  background: var(--n8n-bg-light);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.n8n-fixed-expr-toggle button {
  background: none;
  border: none;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--n8n-text-muted);
  padding: 3px 9px;
  border-radius: 4px;
  cursor: pointer;
}

.n8n-fixed-expr-toggle button.active {
  background: var(--n8n-surface);
  color: var(--n8n-text-dark);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.n8n-expr-box {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background-color: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 4px;
  padding: 8px 10px;
}

.n8n-fx-badge {
  flex-shrink: 0;
  font-family: 'Georgia', serif;
  font-style: italic;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.16);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
}

.n8n-expr-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  color: #fcd34d;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  resize: vertical;
}

.n8n-expr-input.n8n-expr-multiline {
  min-height: 70px;
  width: 100%;
}

.n8n-chip-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 2px 2px;
  -webkit-overflow-scrolling: touch;
}

.n8n-var-chip {
  flex-shrink: 0;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--n8n-info);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 9px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.n8n-var-chip:active {
  background: rgba(56, 189, 248, 0.22);
}

.n8n-fixed-input {
  width: 100%;
  background-color: var(--n8n-surface);
  border: 1px solid var(--n8n-border-dark);
  color: var(--n8n-text);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
}

.n8n-fixed-input:focus {
  border-color: var(--n8n-primary);
}

.n8n-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  background: var(--n8n-bg-light);
  color: var(--n8n-text-dark);
  border: none;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 4px;
}

.n8n-add-btn:active {
  background: var(--n8n-bg-light);
}

/* Reusable pill toggle switch (boolean options) */
.n8n-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}

.n8n-toggle-row .n8n-toggle-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--n8n-text);
}

.sheet-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--n8n-border);
  background-color: var(--n8n-surface);
}

/* Execution detail content layout */
.exec-meta-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--n8n-bg-light);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--n8n-border);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.meta-row-label {
  color: var(--n8n-text-muted);
  font-weight: 500;
}

.exec-nodes-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.exec-node-item {
  background-color: var(--n8n-surface);
  border: 1px solid var(--n8n-border);
  border-radius: 6px;
  overflow: hidden;
}

.exec-node-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

.exec-node-item.has-payload .exec-node-item-header {
  cursor: pointer;
}

.exec-node-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exec-node-chevron {
  color: var(--n8n-text-muted);
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.exec-node-item.expanded .exec-node-chevron {
  transform: rotate(180deg);
}

.node-item-name {
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.exec-node-payload {
  display: none;
  padding: 0 10px 10px;
}

.exec-node-item.expanded .exec-node-payload {
  display: block;
}

.exec-node-payload .code-block-viewer {
  margin: 0;
  max-height: 200px;
}

/* Animations */
@keyframes pulse-badge {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes fade-out-hint {
  to {
    opacity: 0;
  }
}

/* ONBOARDING LANDING SCREEN STYLING */
.n8n-landing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--n8n-bg-light) 0%, var(--n8n-bg) 100%);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.n8n-landing-overlay.active {
  display: flex;
}

/* Background blobs */
.landing-bg-blobs {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
}
.blob-1 {
  width: 320px;
  height: 320px;
  background-color: var(--n8n-primary);
  top: -50px;
  right: -50px;
}
.blob-2 {
  width: 280px;
  height: 280px;
  background-color: #3b82f6;
  bottom: -50px;
  left: -50px;
}

.landing-card {
  background-color: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 24px;
  padding: 40px 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 28px;
  z-index: 2;
  transition: background-color 0.3s, border-color 0.3s;
}

html.dark-theme .landing-card {
  background-color: rgba(16, 24, 39, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.landing-logo {
  text-align: center;
}

@keyframes float-icon {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}
.landing-logo-icon {
  font-size: 3.2rem;
  display: inline-block;
  margin-bottom: 12px;
  animation: float-icon 4s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(255, 109, 90, 0.25));
}

.landing-logo h2 {
  font-family: var(--font-header);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--n8n-primary) 30%, #ff8c7a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.landing-logo p {
  font-size: 0.8rem;
  color: var(--n8n-text-muted);
  font-weight: 500;
}

.landing-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.landing-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.landing-field label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--n8n-text-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.landing-field input {
  background-color: rgba(255, 255, 255, 0.6);
  border: 2px solid var(--n8n-border);
  color: var(--n8n-text-dark);
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  outline: none;
  font-weight: 500;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  width: 100%;
}

.key-input-wrap {
  position: relative;
}

.key-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 6px;
  opacity: 0.6;
  line-height: 1;
}

/* CSS-only masking (not type="password") so mobile password managers/autofill
   never target this field - that substitution was the actual cause of the
   401 "invalid API key" reports, not a real key problem. */
.key-masked {
  -webkit-text-security: disc;
  text-security: disc;
}

.key-masked.revealed {
  -webkit-text-security: none;
  text-security: none;
}

.key-toggle-btn:active {
  opacity: 1;
}

html.dark-theme .landing-field input {
  background-color: rgba(15, 23, 42, 0.4);
}

.landing-field input:focus {
  border-color: var(--n8n-primary);
  background-color: var(--n8n-surface);
  box-shadow: 0 0 0 4px rgba(255, 109, 90, 0.15);
}

.landing-card .n8n-btn {
  border-radius: 12px;
  padding: 14px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.15s, background-color 0.2s, box-shadow 0.2s;
}
.landing-card .n8n-btn-primary {
  background: linear-gradient(135deg, var(--n8n-primary) 0%, #e05240 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 14px rgba(255, 109, 90, 0.22);
}
.landing-card .n8n-btn-primary:active {
  background: linear-gradient(135deg, #e05240 0%, var(--n8n-primary) 100%);
}
.landing-card .n8n-btn-secondary {
  background-color: transparent;
  color: var(--n8n-text-dark);
  border: 2px solid var(--n8n-border-dark);
}
.landing-card .n8n-btn-secondary:active {
  background-color: rgba(255, 109, 90, 0.08);
  border-color: var(--n8n-primary);
  color: var(--n8n-primary);
}

.landing-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--n8n-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.landing-divider::before, .landing-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--n8n-border);
}

.landing-divider span {
  padding: 0 12px;
}

.landing-footer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--n8n-text-muted);
  line-height: 1.5;
  font-weight: 500;
}

/* CREDENTIALS SECTION STYLING */
.n8n-credentials-section {
  margin: 16px 0;
  background-color: var(--n8n-surface);
  border: 1px solid var(--n8n-border);
  border-radius: 6px;
  padding: 16px;
}

.n8n-credentials-section h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--n8n-text);
  border-bottom: 1px solid var(--n8n-border);
  padding-bottom: 6px;
}

.credentials-list-group {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.credential-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background-color: var(--n8n-bg);
  border: 1px solid var(--n8n-border);
  border-radius: 4px;
}

.cred-name-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cred-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--n8n-text);
}

.cred-type {
  font-size: 0.72rem;
  color: var(--n8n-text-muted);
}

.cred-status-indicator {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--n8n-success);
}

/* ==========================================================================
   MOBILE LAYOUT FIX & OVERVIEW DASHBOARD STYLES
   ========================================================================== */

/* Force rigid flexbox layout to avoid cutoffs and hidden navbars on mobile */
/* Core layout variables overrides */

/* Overview Section Header */
.overview-header-panel {
  padding: 24px 16px 16px 16px;
  background: var(--n8n-surface);
  border-bottom: 1px solid var(--n8n-border);
}
.overview-header-panel h2 {
  font-family: var(--font-header);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--n8n-text-dark);
  margin: 0 0 6px 0;
}
.overview-header-panel p {
  font-size: 0.8rem;
  color: var(--n8n-text-muted);
  margin: 0;
  line-height: 1.4;
}

/* Stats Metrics 2x2 Grid Layout */
.overview-metrics-carousel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
  background: var(--n8n-bg-light);
}
.metric-card {
  background: var(--n8n-surface);
  border: 1px solid var(--n8n-border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.metric-label {
  font-size: 0.72rem;
  color: var(--n8n-text-muted);
  font-weight: 600;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}
.metric-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--n8n-text-dark);
  font-family: var(--font-header);
}
.metric-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.metric-badge.success {
  color: var(--n8n-success);
  background: rgba(34, 197, 94, 0.08);
}
.metric-badge.danger {
  color: var(--n8n-error);
  background: rgba(239, 68, 68, 0.08);
}

/* Overview Section pills */
.overview-section-tabs {
  display: flex;
  background: var(--n8n-surface);
  border-bottom: 1px solid var(--n8n-border);
  padding: 0 8px;
}
.overview-tab-btn {
  flex: 1;
  background: none;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--n8n-text-muted);
  padding: 16px 4px;
  text-align: center;
  position: relative;
  outline: none;
  cursor: pointer;
}
.overview-tab-btn.active {
  color: var(--n8n-primary);
}
.overview-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 15%;
  right: 15%;
  height: 3px;
  background: var(--n8n-primary);
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
}

/* Search bar and list items card */
/* Search bar and list items card */
.overview-list-card {
  background: transparent;
  display: flex;
  flex-direction: column;
}
.overview-search-container {
  padding: 14px 16px;
  border-bottom: 1px solid var(--n8n-border);
  position: relative;
}
.overview-search-container::before {
  content: '🔍';
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--n8n-text-muted);
  pointer-events: none;
}
.overview-search-container input {
  width: 100%;
  padding: 10px 16px 10px 38px;
  border: 1px solid var(--n8n-border-dark);
  border-radius: 20px;
  font-size: 0.88rem;
  outline: none;
  background: var(--n8n-bg-light);
  transition: all 0.2s ease;
}
.overview-search-container input:focus {
  border-color: var(--n8n-primary);
  background: var(--n8n-surface);
  box-shadow: 0 0 0 3px rgba(255, 109, 90, 0.08);
}
.overview-list-scrollable {
  overflow-y: auto;
  max-height: calc(100vh - 350px);
  background: var(--n8n-bg-light);
  padding-bottom: 16px;
}
.overview-items-list-group {
  list-style: none;
  padding: 0;
  margin: 0;
}
.overview-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background-color: var(--n8n-surface);
  border: 1px solid var(--n8n-border);
  border-radius: 8px;
  margin: 5px 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.overview-item-row:active {
  background: var(--n8n-bg-light);
}
.overview-item-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}
.overview-item-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background-color: rgba(255, 109, 90, 0.1);
  color: var(--n8n-primary);
  flex-shrink: 0;
}
.overview-item-avatar.cred-avatar {
  background-color: rgba(139, 92, 246, 0.08);
  color: #8b5cf6;
}
.overview-item-avatar.table-avatar {
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--n8n-success);
}
.avatar-svg {
  width: 18px;
  height: 18px;
}
.overview-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.overview-item-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--n8n-text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.overview-item-meta {
  font-size: 0.8rem;
  color: var(--n8n-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.overview-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 12px;
  flex-shrink: 0;
}

.notif-bell-btn {
  background: none;
  border: none;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--n8n-text-light);
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.notif-bell-btn:active {
  background: var(--n8n-bg-light);
}

.notif-bell-btn.subscribed {
  color: var(--n8n-warning);
}

/* API Notices for limitations/errors */
.n8n-api-notice {
  margin: 12px 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.4;
  background-color: rgba(255, 109, 90, 0.06);
  border: 1px solid rgba(255, 109, 90, 0.15);
  color: var(--n8n-text-dark);
}
.n8n-api-notice strong {
  color: var(--n8n-primary);
}

/* Node Creator Floating button styling */
.n8n-floating-add-btn {
  position: absolute;
  bottom: 16px;
  left: 16px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--n8n-primary);
  color: #ffffff;
  border: none;
  font-size: 1.8rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(255, 109, 90, 0.35);
  z-index: 101;
  outline: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.n8n-floating-add-btn:active {
  transform: scale(0.9);
}

/* Node Selector overlay modal lists */
.node-selector-search {
  padding: 14px 16px;
  border-bottom: 1px solid var(--n8n-border);
}
.node-selector-search input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--n8n-border);
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  background: var(--n8n-bg-light);
}
.node-selector-search input:focus {
  border-color: var(--n8n-primary);
  background: var(--n8n-surface);
}
.node-selector-scrollable {
  padding: 8px 0;
}
.node-selector-list-group {
  list-style: none;
  padding: 0;
  margin: 0;
}
.node-selector-category-header {
  padding: 14px 16px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--n8n-text-muted);
  background: var(--n8n-surface);
}
.node-selector-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--n8n-border);
  cursor: pointer;
}
.node-selector-item:active {
  background: var(--n8n-bg-light);
}
.node-selector-icon {
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--n8n-bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--n8n-border);
}
.node-selector-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.node-selector-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--n8n-text-dark);
}
.node-selector-type {
  font-size: 0.72rem;
  color: var(--n8n-text-muted);
}

/* ==========================================================================
   UPGRADED NODE INSPECTOR INTERFACE STYLES (n8n Authentic Layout)
   ========================================================================== */
.panel-toggle-bar {
  padding: 10px 16px;
  display: flex;
  justify-content: center;
  background: var(--n8n-bg-light);
  border-bottom: 1px solid var(--n8n-border);
}
.toggle-capsule {
  display: flex;
  background: var(--n8n-bg-light);
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
}
.capsule-btn {
  background: none;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--n8n-text-muted);
  padding: 5px 14px;
  border-radius: 18px;
  outline: none;
  cursor: pointer;
}
.capsule-btn.active {
  background: var(--n8n-surface);
  color: var(--n8n-text-dark);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.panel-content-area {
  padding: 16px;
  background: var(--n8n-bg-light);
  min-height: 250px;
}

/* Empty node execution details state wrapper */
.n8n-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  text-align: center;
}
.n8n-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.75;
}
.n8n-empty-state p {
  font-size: 0.82rem;
  color: var(--n8n-text-muted);
  margin: 0 0 20px 0;
  line-height: 1.4;
  max-width: 250px;
}

.panel-action-bar {
  padding: 10px 16px;
  background: var(--n8n-surface);
  border-bottom: 1px solid var(--n8n-border);
  display: flex;
  justify-content: flex-end;
}

.n8n-btn-execute {
  background: var(--n8n-surface);
  color: var(--n8n-primary);
  border: 1px solid var(--n8n-primary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.n8n-btn-execute:active {
  background: rgba(255, 109, 90, 0.05);
}

/* Output Preview Table & Schema styling */
.table-container-scrollable {
  overflow-x: auto;
  width: 100%;
  border: 1px solid var(--n8n-border);
  border-radius: 6px;
  margin-top: 10px;
  background-color: var(--n8n-surface);
}

.n8n-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
  color: var(--n8n-text);
}

.n8n-data-table th, .n8n-data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--n8n-border);
  white-space: nowrap;
}

.n8n-data-table th {
  background-color: var(--n8n-bg);
  font-weight: 600;
  color: var(--n8n-text-muted);
  border-bottom: 2px solid var(--n8n-border);
}

.n8n-data-table tbody tr:last-child td {
  border-bottom: none;
}

.n8n-data-table tbody tr:hover {
  background-color: rgba(255, 109, 90, 0.03);
}

.schema-viewer-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--n8n-border);
  border-radius: 6px;
  margin-top: 10px;
  background-color: var(--n8n-surface);
  overflow: hidden;
}

.schema-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--n8n-border);
  font-size: 0.8rem;
}

.schema-row:last-child {
  border-bottom: none;
}

.schema-key {
  font-weight: 500;
  color: var(--n8n-text);
  font-family: var(--font-mono);
}

.schema-type {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--n8n-primary);
  background-color: rgba(255, 109, 90, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* WORKFLOWS SPLIT LAYOUT */
.workflows-split-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-left: 4px solid var(--n8n-border-dark);
  border-right: 4px solid var(--n8n-border-dark);
  border-bottom: 4px solid var(--n8n-border-dark);
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  background-color: var(--n8n-surface);
}

.workflows-split-layout .n8n-canvas-viewport {
  flex: 1 !important;
  height: auto !important;
  border-bottom: 3px solid var(--n8n-border-dark);
  min-width: 0;
  min-height: 0;
}

/* Collapsed by default: just the peek header. Expands on tap. */
.workflow-logs-panel {
  height: 44px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--n8n-surface);
  min-width: 0;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  overflow: hidden;
  transition: height 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.workflow-logs-panel.expanded {
  height: 42%;
}

.logs-panel-header {
  flex-shrink: 0;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--n8n-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--n8n-bg-light);
  min-width: 0;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
}

.logs-panel-chevron {
  font-size: 0.6rem;
  color: var(--n8n-text-muted);
  transition: transform 0.25s ease;
  margin-left: 8px;
}

.workflow-logs-panel.expanded .logs-panel-chevron {
  transform: rotate(180deg);
}

.logs-panel-header h3 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--n8n-text-muted);
  margin: 0;
}

.logs-count-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--n8n-primary);
  background-color: rgba(255, 109, 90, 0.08);
  padding: 2px 8px;
  border-radius: 12px;
  flex-shrink: 0;
}

.logs-panel-list-wrapper {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.workflow-logs-list-group {
  list-style: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.workflow-log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--n8n-border);
  cursor: pointer;
  transition: background-color 0.15s ease;
  min-width: 0;
}

.workflow-log-item:active {
  background-color: var(--n8n-bg-light);
}

.log-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.log-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.log-status-dot.success {
  background-color: var(--n8n-success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.log-status-dot.failed {
  background-color: var(--n8n-error);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.log-status-dot.running {
  background-color: var(--n8n-info);
  box-shadow: 0 0 6px rgba(0, 132, 255, 0.4);
}

.log-item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.log-id {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--n8n-text-dark);
}

.log-meta {
  font-size: 0.72rem;
  color: var(--n8n-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dark is the app's native, default identity (see html.dark-theme on <html>).
   Light is the opt-in override, defined further down under html.light-theme. */
html.dark-theme {
  --n8n-bg: #090d16;
  --n8n-bg-light: #05070c;
  --n8n-surface: #101827;
  --n8n-surface-raised: #171f2f;
  --n8n-border: #1f293d;
  --n8n-border-dark: #334155;
  --n8n-text: #e2e8f0;
  --n8n-text-dark: #ffffff;
  --n8n-text-muted: #8892b0;
}

/* Opt-in light override */
html.light-theme {
  --n8n-bg: #fafbfc;
  --n8n-bg-light: #f1f5f9;
  --n8n-surface: #ffffff;
  --n8n-surface-raised: #ffffff;
  --n8n-border: #e2e8f0;
  --n8n-border-dark: #cbd5e1;
  --n8n-text: #1e293b;
  --n8n-text-dark: #0f172a;
  --n8n-text-muted: #64748b;
}

/* Header actions & theme button */
.header-right-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.header-theme-btn {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 1.8rem;
  height: 1.8rem;
  transition: background-color 0.2s;
  color: var(--n8n-text-dark);
}
.header-theme-btn:active {
  background-color: rgba(255, 109, 90, 0.15);
}

/* Workflow header action controls */
.workflow-action-btn {
  background-color: var(--n8n-primary);
  color: white;
  border: none;
  border-radius: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
}
.workflow-action-btn:active {
  background-color: var(--n8n-primary-hover);
}
.workflow-action-btn.play-btn {
  background-color: #10b981; /* green for run test */
}
.workflow-action-btn.play-btn:active {
  background-color: #059669;
}
.workflow-action-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Material Switch Active Toggle */
.workflow-active-toggle-container {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.md-switch {
  position: relative;
  display: inline-block;
  width: 1.6rem;
  height: 1rem;
}
.md-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.md-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--n8n-border-dark);
  transition: .3s;
  border-radius: 1rem;
}
.md-switch-slider:before {
  position: absolute;
  content: "";
  height: 0.7rem;
  width: 0.7rem;
  left: 0.15rem;
  bottom: 0.15rem;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
.md-switch input:checked + .md-switch-slider {
  background-color: var(--n8n-primary);
}
.md-switch input:checked + .md-switch-slider:before {
  transform: translateX(0.6rem);
}
.switch-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--n8n-text-muted);
  text-transform: uppercase;
}

/* Material Design Ripple Click Effect */
.ripple-container {
  position: relative !important;
  overflow: hidden !important;
}
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple-animation 0.4s ease-out;
  background-color: rgba(255, 109, 90, 0.22);
  pointer-events: none;
}
@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Glowing Canvas Nodes halos based on execution status */
.node-group.success .svg-node-rect {
  stroke: #10b981 !important;
  stroke-width: 3.5px !important;
  filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.5));
}
.node-group.failed .svg-node-rect {
  stroke: #ef4444 !important;
  stroke-width: 3.5px !important;
  filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.6));
}
.node-group.running .svg-node-rect {
  stroke: #f59e0b !important;
  stroke-width: 3.5px !important;
  filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.5));
}
