:root,
:root[data-theme=light] {
  --color-bg: #f5f6fa;
  --color-bg-muted: #f0f1f7;
  --color-bg-hover: #eef0f8;
  --color-surface: #ffffff;
  --color-input-bg: #ffffff;
  --color-border: #e2e4ea;
  --color-border-muted: #eceef4;
  --color-text: #1f2230;
  --color-text-muted: #6b7280;
  --color-primary: #06b6d4;
  --color-primary-hover: #0891b2;
  --color-primary-light: rgba(6, 182, 212, 0.12);
  --color-primary-tint: #ecfeff;
  --color-sidebar-bg: #171923;
  --color-sidebar-text: #cbd0dc;
  --color-sidebar-text-active: #ffffff;
  --color-success: #16a34a;
  --color-success-bg: #ecfdf3;
  --color-danger: #dc2626;
  --color-danger-bg: #fef2f2;
  --color-warning: #d97706;
  --color-warning-bg: #fffbeb;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 2px 8px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.12);
}

:root[data-theme=dark] {
  --color-bg: #0d1117;
  --color-bg-muted: #161b22;
  --color-bg-hover: #21262d;
  --color-surface: #161b22;
  --color-input-bg: #0d1117;
  --color-border: #30363d;
  --color-border-muted: #21262d;
  --color-text: #e6edf3;
  --color-text-muted: #8d96a0;
  --color-primary: #22d3ee;
  --color-primary-hover: #06b6d4;
  --color-primary-light: rgba(34, 211, 238, 0.15);
  --color-primary-tint: #164e63;
  --color-sidebar-bg: #0a0c10;
  --color-sidebar-text: #9198a1;
  --color-sidebar-text-active: #ffffff;
  --color-success: #3fb950;
  --color-success-bg: #0d2818;
  --color-danger: #f85149;
  --color-danger-bg: #2d1214;
  --color-warning: #d29922;
  --color-warning-bg: #2b2111;
  --shadow-sm: 0 1px 2px rgba(1, 4, 9, 0.5);
  --shadow-md: 0 3px 10px rgba(1, 4, 9, 0.6);
  --shadow-lg: 0 8px 24px rgba(1, 4, 9, 0.7);
}

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

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Roboto, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1, h2, h3 {
  margin: 0 0 12px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
}
.btn:hover {
  background: var(--color-bg-hover);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.btn--primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
}
.btn--primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  box-shadow: 0 4px 6px rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
}
.btn--danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}
.btn--danger:hover {
  opacity: 0.9;
  box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.btn--ghost:hover {
  box-shadow: none;
  background: rgba(0, 0, 0, 0.04);
  transform: none;
}
.btn--sm {
  padding: 6px 12px;
  font-size: 13px;
}
.btn--block {
  width: 100%;
}
.btn--icon {
  padding: 6px;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--color-text-muted);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.btn--icon:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
  box-shadow: none;
  transform: none;
}
.btn--icon.btn--danger, .btn--icon--danger {
  color: var(--color-danger);
  background: transparent;
  border: none;
  box-shadow: none;
}
.btn--icon.btn--danger:hover, .btn--icon--danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
  box-shadow: none;
  transform: none;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.card--pad {
  padding: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, .input {
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-input-bg);
  color: var(--color-text);
  width: 100%;
}

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

.field__hint {
  font-size: 12px;
  color: var(--color-text-muted);
}

input[type=checkbox],
input[type=radio] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background-color 0.15s;
}

input[type=checkbox] {
  border-radius: 5px;
}

input[type=radio] {
  border-radius: 50%;
}

input[type=checkbox]:hover,
input[type=radio]:hover {
  border-color: var(--color-primary);
}

input[type=checkbox]:checked,
input[type=radio]:checked {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

input[type=checkbox]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type=radio]:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

input[type=checkbox]:focus-visible,
input[type=radio]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

input[type=checkbox]:disabled,
input[type=radio]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
}

.badge--success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge--danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge--warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge--primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  color: var(--color-text-muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-muted);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--color-bg-hover);
}

.data-table a.row-link {
  color: var(--color-primary);
  font-weight: 600;
}

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}

.alert--error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.alert--success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 24, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--color-surface);
  border-radius: 8px;
  padding: 22px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  max-height: 86vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 16px;
  margin-bottom: 16px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}

.score-pill--high {
  background: var(--color-success);
}

.score-pill--mid {
  background: var(--color-warning);
}

.score-pill--low {
  background: var(--color-danger);
}

.settings-layout {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.settings-sidebar {
  flex: 0 0 208px;
  position: sticky;
  top: 28px;
}

.settings-content {
  flex: 1;
  min-width: 0;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.settings-nav__tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: background 0.1s ease, color 0.1s ease;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.settings-nav__tab svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
  opacity: 0.7;
}
.settings-nav__tab:hover {
  background: var(--color-bg-hover, var(--color-bg));
  color: var(--color-text);
}
.settings-nav__tab:hover svg {
  opacity: 1;
}
.settings-nav__tab--active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}
.settings-nav__tab--active svg {
  opacity: 1;
}

.toast-container {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, 100vw - 32px);
  pointer-events: none;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(16px);
  }
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-text-muted);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  padding: 12px 12px 12px 14px;
  font-size: 13px;
  color: var(--color-text);
  animation: toast-in 0.18s ease-out;
}
.toast--leaving {
  animation: toast-out 0.15s ease-in forwards;
}
.toast--success {
  border-left-color: var(--color-success);
}
.toast--error {
  border-left-color: var(--color-danger);
}
.toast--info {
  border-left-color: var(--color-primary);
}
.toast__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.toast--success .toast__icon {
  background: var(--color-success);
}
.toast--error .toast__icon {
  background: var(--color-danger);
}
.toast--info .toast__icon {
  background: var(--color-primary);
}
.toast__text {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
  word-break: break-word;
}
.toast__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.toast__close:hover {
  color: var(--color-text);
}

.confirm-dialog {
  width: 380px;
}
.confirm-dialog__message {
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 4px;
  white-space: pre-line;
}

.dialog {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 22px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop {
  background: rgba(15, 17, 24, 0.45);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 24, 0.45);
  z-index: 1000;
  display: none;
  justify-content: flex-end;
}

.drawer {
  width: 520px;
  max-width: 100%;
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: drawer-in 0.2s ease-out;
}

@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
.drawer__header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer__header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.drawer__close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--color-text-muted);
}
.drawer__close:hover {
  color: var(--color-text);
}

.drawer__tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border-muted);
  padding: 0 24px;
  background: var(--color-bg-muted);
}

.drawer__tab {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  background: none;
  border: none;
  font-size: 13px;
}
.drawer__tab:hover {
  color: var(--color-text);
}
.drawer__tab.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.process-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background-color 0.15s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  height: auto;
  gap: 12px;
}
.process-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.process-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.process-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.process-card__actions {
  display: flex;
  gap: 8px;
}
.process-card__actions .btn-action {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.15s ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.process-card__actions .btn-action:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
  transform: translateY(-1px);
}
.process-card__actions .btn-action--danger:hover {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

.chat-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
}
.chat-bubble--user {
  background: var(--color-bg-hover);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
  color: var(--color-text);
}
.chat-bubble--ai {
  background: var(--color-primary-light);
  align-self: flex-end;
  border-bottom-right-radius: 2px;
  color: var(--color-primary);
}
.chat-bubble--ai strong {
  color: var(--color-primary);
}

.chat-verdict {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
  font-size: 12.5px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
}

.app-logo-image {
  max-height: 28px;
  max-width: 100%;
  object-fit: contain;
}

.sidebar__logo {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  padding: 0 8px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.sidebar__logo span {
  color: var(--color-primary);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--color-sidebar-text);
  font-size: 14px;
  transition: background 0.12s, color 0.12s;
}
.sidebar__link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-sidebar-text-active);
}
.sidebar__link.is-active {
  background: var(--color-primary);
  color: #fff;
}

.sidebar__menu-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
}

.sidebar__menu-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--color-sidebar-text);
  font-size: 14px;
  background: transparent;
  border: none;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
}
.sidebar__menu-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-sidebar-text-active);
}
.sidebar__menu-trigger.is-active {
  color: var(--color-sidebar-text-active);
}
.sidebar__menu-trigger .arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.sidebar__menu-trigger.is-open .arrow {
  transform: rotate(180deg);
}

.sidebar__submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 20px;
  margin-top: 2px;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
}
.sidebar__submenu[hidden] {
  display: none;
}

.sidebar__submenu-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--color-sidebar-text);
  font-size: 13px;
  opacity: 0.85;
  transition: background 0.12s, color 0.12s, opacity 0.12s;
}
.sidebar__submenu-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-sidebar-text-active);
  opacity: 1;
}
.sidebar__submenu-link.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 600;
  opacity: 1;
}

.sidebar__footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
  margin-top: 12px;
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.page-subtitle {
  color: var(--color-text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-bg);
}

.auth-card {
  width: 100%;
  max-width: 360px;
  padding: 32px;
  background: var(--color-surface);
  border-radius: 8px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}

.auth-card__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 22px;
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.editor-shell {
  display: flex;
  height: calc(100vh - 150px);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.editor-canvas-wrap {
  flex: 1;
  position: relative;
  background: var(--color-bg-muted);
  overflow: hidden;
}

.node-toolbar {
  position: absolute;
  z-index: 20;
  display: flex;
  gap: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 4px;
}

.node-toolbar__btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.node-toolbar__btn:hover {
  background: var(--color-bg-hover);
}

.node-toolbar__btn--danger {
  color: var(--color-danger);
}

.node-toolbar__btn--danger:hover {
  background: var(--color-danger-bg);
}

#drawflow {
  width: 100%;
  height: 100%;
  background-size: 22px 22px;
  background-image: radial-gradient(circle, var(--color-border) 1px, transparent 1px);
}

#drawflow .drawflow-node {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  padding: 12px 14px 12px 18px;
  min-width: 180px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

#drawflow .drawflow-node:hover {
  box-shadow: var(--shadow-md);
}

#drawflow .drawflow-node.selected {
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

#drawflow .drawflow-node::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 8px 0 0 8px;
  background: var(--color-border);
}

#drawflow .drawflow-node.node-start::before {
  background: var(--color-success);
}

#drawflow .drawflow-node.node-client-reply::before {
  background: var(--color-primary);
}

#drawflow .drawflow-node.node-finish::before {
  background: var(--color-text-muted);
}

#drawflow .drawflow-node .node-eyebrow {
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 3px;
}

#drawflow .drawflow-node .node-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text);
}

#drawflow .drawflow-node .node-icon {
  font-size: 13px;
  line-height: 1;
}

#drawflow .drawflow-node .node-subtitle {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 220px;
}

#drawflow .drawflow-node .input,
#drawflow .drawflow-node .output {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
  top: 0;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

#drawflow .drawflow-node .input {
  left: -21px;
}

#drawflow .drawflow-node .output {
  right: -9px;
}

#drawflow .drawflow-node .input:hover,
#drawflow .drawflow-node .output:hover {
  border-color: var(--color-primary);
}

#drawflow .connection .main-path {
  stroke: var(--color-text-muted);
  stroke-width: 2px;
}

#drawflow .connection .main-path:hover {
  stroke: var(--color-primary);
  cursor: pointer;
}

#drawflow .connection .main-path.selected {
  stroke: var(--color-primary);
}

#drawflow .connection.on_pass .main-path {
  stroke: var(--color-success);
}

#drawflow .connection.on_fail .main-path {
  stroke: var(--color-danger);
}

#drawflow .connection .point {
  stroke: var(--color-border);
  stroke-width: 2px;
  fill: var(--color-surface);
  r: 4;
}

#drawflow .connection .point:hover,
#drawflow .connection .point.selected {
  stroke: var(--color-primary);
  fill: var(--color-primary-light);
}

.editor-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  padding: 18px;
  overflow-y: auto;
}

.editor-sidebar h3 {
  font-size: 14px;
  margin-bottom: 12px;
}

.node-palette__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: grab;
  font-size: 13px;
  color: var(--color-text);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.node-palette__item:not([data-disabled]):hover {
  background: var(--color-bg-hover);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.node-palette__item:not([data-disabled]):active {
  cursor: grabbing;
}

.node-palette__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--color-bg-muted);
  font-size: 14px;
}

.node-palette__label {
  line-height: 1.3;
}

.node-palette__item[data-disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.editor-toolbar__status {
  font-size: 12px;
  color: var(--color-text-muted);
}

.node-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 24, 0.45);
  z-index: 200;
  display: flex;
  justify-content: flex-end;
}

.node-drawer {
  width: 420px;
  max-width: 100%;
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.node-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border);
}

.node-drawer__header h2 {
  font-size: 16px;
  margin: 0;
}

.node-drawer__close {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.node-drawer__close:hover {
  background: var(--color-bg-hover);
}

.node-drawer__body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.node-drawer__footer {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
}

.node-drawer__advanced {
  margin-top: 4px;
  border-top: 1px solid var(--color-border-muted);
  padding-top: 14px;
}

.node-drawer__advanced summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.node-drawer__advanced summary:hover {
  color: var(--color-text);
}

.node-drawer__advanced[open] summary {
  margin-bottom: 14px;
}
