@import "tailwindcss";

/* ── Template modal ──────────────────────────────────────────────────────────── */

.cn-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 24, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.cn-modal {
  background: #0e1120;
  border: 1px solid #1e2340;
  border-radius: 12px;
  width: 100%;
  max-width: 780px;
  overflow: hidden;
}

.cn-modal__header {
  position: relative;
  padding: 28px 32px 20px;
  border-bottom: 1px solid #1e2340;
}

.cn-modal__title {
  font-size: 18px;
  font-weight: 700;
  color: #e2e8f0;
  margin: 0 0 6px;
}

.cn-modal__sub {
  font-size: 13px;
  color: #4a5570;
  margin: 0;
}

.cn-modal__close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid #1e2340;
  border-radius: 5px;
  color: #3a4060;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}

.cn-modal__close:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

.cn-modal__templates {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 20px 24px;
}

.cn-template-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #13162a;
  border: 1px solid #1e2340;
  border-radius: 8px;
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s;
  width: 100%;
}

.cn-template-card:hover {
  border-color: #3b82f6;
  background: #161a30;
}

.cn-template-card__name {
  font-size: 15px;
  font-weight: 700;
  color: #e2e8f0;
}

.cn-template-card__tagline {
  font-size: 11px;
  font-weight: 600;
  color: #3b82f6;
  letter-spacing: 0.04em;
}

.cn-template-card__desc {
  font-size: 12px;
  color: #4a5570;
  line-height: 1.5;
  margin-top: 4px;
}

.cn-template-card__meta {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.cn-template-card__meta span {
  font-size: 10px;
  color: #2a3050;
  font-family: monospace;
}

.cn-modal__footer {
  padding: 16px 32px;
  border-top: 1px solid #1e2340;
  text-align: right;
}

.cn-modal__skip {
  font-size: 12px;
  color: #3a4060;
  text-decoration: none;
  transition: color 0.12s;
}

.cn-modal__skip:hover {
  color: #8892b0;
}

.cn-modal__body {
  padding: 8px 32px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cn-announcement {
  border-left: 2px solid #3a4060;
  padding: 8px 0 8px 16px;
}

.cn-announcement__title {
  font-size: 13px;
  font-weight: 600;
  color: #c9d1d9;
  margin: 0 0 4px;
}

.cn-announcement__body {
  font-size: 12px;
  color: #8892b0;
  margin: 0 0 4px;
  line-height: 1.5;
}

.cn-announcement__date {
  font-size: 11px;
  color: #3a4060;
}

/* ── Auth layout ─────────────────────────────────────────────────────────────── */

.auth-body {
  margin: 0;
  min-height: 100vh;
  background: #0a0d18;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.auth-wrap {
  width: 100%;
  max-width: 380px;
  padding: 24px;
}

.auth-card {
  background: #0e1120;
  border: 1px solid #1e2340;
  border-radius: 10px;
  padding: 32px;
}

.auth-logo {
  font-size: 18px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 4px;
}

.auth-sub {
  font-size: 13px;
  color: #4a5570;
  margin: 0 0 24px;
}

.auth-notice {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 5px;
  padding: 8px 12px;
  font-size: 13px;
  color: #10b981;
  margin-bottom: 16px;
}

.auth-alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 5px;
  padding: 8px 12px;
  font-size: 13px;
  color: #ef4444;
  margin-bottom: 16px;
}

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

.auth-field label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4a5570;
}

.auth-field input {
  background: #090c18;
  border: 1px solid #1e2340;
  border-radius: 5px;
  padding: 9px 12px;
  font-size: 14px;
  color: #c8d0e0;
  outline: none;
  transition: border-color 0.12s;
}

.auth-field input:focus {
  border-color: #3b82f6;
}

.auth-card input[type="submit"] {
  width: 100%;
  margin-top: 8px;
  background: #3b82f6;
  border: none;
  border-radius: 5px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background 0.12s;
}

.auth-card input[type="submit"]:hover {
  background: #2563eb;
}

.auth-btn {
  display: inline-block;
  background: #3b82f6;
  border: none;
  border-radius: 5px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background 0.12s;
}

.auth-btn:hover {
  background: #2563eb;
}

.cn-projects-page {
  width: 100%;
  max-width: 600px;
  padding: 48px 24px;
}

.cn-projects-header {
  margin-bottom: 32px;
}

.cn-projects-title {
  font-size: 22px;
  font-weight: 700;
  color: #c9d1d9;
  margin: 0 0 6px;
}

.cn-projects-sub {
  font-size: 13px;
  color: #3a4060;
  margin: 0;
}

.cn-projects-footer {
  margin-top: 24px;
}

.cn-btn {
  display: inline-block;
  background: #1e2340;
  border: 1px solid #2e3460;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #8892b0;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.cn-btn:hover {
  border-color: #3b82f6;
  color: #c9d1d9;
}

.cn-project-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cn-project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #0f1225;
  border: 1px solid #1e2340;
  border-radius: 8px;
  transition: border-color 0.12s;
}

.cn-project-item:hover {
  border-color: #2e3460;
}

.cn-project-item__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cn-project-item__name {
  font-size: 14px;
  font-weight: 600;
  color: #c9d1d9;
  text-decoration: none;
}

.cn-project-item__name:hover {
  color: #3b82f6;
}

.cn-project-item__url {
  font-size: 11px;
  color: #3a4060;
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cn-project-item__del {
  flex-shrink: 0;
  margin-left: 12px;
  background: none;
  border: none;
  color: #3a4060;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}

.cn-project-item__del:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

/* ── Collaborators panel ────────────────────────────────────────────────────── */

.cn-collab-panel {
  position: absolute;
  top: 52px; right: 16px;
  width: 320px;
  background: #0e1120;
  border: 1px solid #1e2340;
  border-radius: 8px;
  z-index: 60;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: none;
}

.cn-collab-panel:not(:empty) { display: block; }

turbo-frame#collaborators-panel:not(:empty) .cn-collab-panel { display: block; }

.cn-collab-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #1e2340;
}

.cn-collab-panel__title {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  margin: 0;
}

.cn-collab-panel__close {
  background: none;
  border: none;
  color: #4b5563;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}

.cn-collab-panel__close:hover { color: #e2e8f0; }

.cn-collab-panel__list {
  padding: 8px 0;
  max-height: 280px;
  overflow-y: auto;
}

.cn-collab-panel__empty {
  font-size: 12px;
  color: #3a4060;
  padding: 8px 16px;
  margin: 0;
}

.cn-collab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
}

.cn-collab-item__info {
  flex: 1;
  min-width: 0;
}

.cn-collab-item__email {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cn-collab-item__persona {
  display: block;
  font-size: 11px;
  color: #6366f1;
  margin-top: 1px;
}

.cn-collab-item__status {
  display: block;
  font-size: 10px;
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cn-collab-item__status--pending  { color: #4b5563; }
.cn-collab-item__status--accepted { color: #10b981; }

.cn-collab-item__del {
  background: none; border: none;
  color: #374151; cursor: pointer;
  font-size: 14px; padding: 2px 6px;
  border-radius: 4px;
}
.cn-collab-item__del:hover { color: #ef4444; background: rgba(239,68,68,0.08); }

.cn-collab-panel__invite {
  padding: 12px 16px;
  border-top: 1px solid #1e2340;
}

.cn-collab-panel__form {
  display: flex;
  gap: 8px;
}

.cn-collab-panel__input {
  flex: 1;
  background: #13162a;
  border: 1px solid #1e2340;
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 12px;
  padding: 6px 10px;
  outline: none;
}

.cn-collab-panel__input:focus { border-color: #6366f1; }

.cn-btn--sm {
  font-size: 12px;
  padding: 6px 12px;
}

/* ── Invite & persona selection pages ───────────────────────────────────────── */

.cn-invite {
  width: 100%;
  max-width: 480px;
}

.cn-invite__header { margin-bottom: 24px; }

.cn-invite__title {
  font-size: 22px;
  font-weight: 700;
  color: #e2e8f0;
  margin: 0 0 8px;
}

.cn-invite__sub {
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

.cn-invite__desc {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 24px;
}

.cn-invite__accepted {
  font-size: 13px;
  color: #10b981;
  margin-bottom: 16px;
}

.cn-persona-select {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.cn-persona-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: #0e1120;
  border: 1px solid #1e2340;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.12s;
}

.cn-persona-option input[type="radio"] { margin-top: 3px; accent-color: #6366f1; }

.cn-persona-option:hover { border-color: #6366f1; }

.cn-persona-option__body { flex: 1; min-width: 0; }

.cn-persona-option__name {
  display: block;
  font-size: 14px;
  color: #e2e8f0;
  margin-bottom: 2px;
}

.cn-persona-option__desc {
  font-size: 12px;
  color: #4b5563;
  margin: 0 0 4px;
}

.cn-persona-option__url {
  font-size: 10px;
  color: #1e2340;
  font-family: monospace;
  word-break: break-all;
}

/* ── Canvas app shell ──────────────────────────────────────────────────────── */

.cn-body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #0a0d18;
}

.cn-app {
  position: fixed;
  inset: 0;
  display: flex;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  color: #c8d0e0;
  background: #0a0d18;
  overflow: hidden;
}

/* ── Palette ────────────────────────────────────────────────────────────────── */

.cn-palette {
  position: absolute;
  top: 0; left: 0;
  width: 200px;
  height: 100%;
  background: #0e1120;
  border-right: 1px solid #1e2340;
  overflow-y: auto;
  padding: 0 8px 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: #2a2f45 transparent;
}

.cn-palette__logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #e2e8f0;
  padding: 14px 6px 10px;
  border-bottom: 1px solid #1e2340;
  margin-bottom: 6px;
}

.cn-palette__section {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #3a4060;
  padding: 10px 6px 3px;
  margin: 0;
}

.cn-palette__btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #8892b0;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cn-palette__btn:hover {
  background: #161930;
  border-color: #2a2f45;
  color: #c8d0e0;
}

.cn-palette__btn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cn-palette__btn--source::before     { background: #ef4444; }
.cn-palette__btn--transform::before  { background: #8b5cf6; }
.cn-palette__btn--branch::before     { background: #ec4899; }
.cn-palette__btn--modulation::before { background: #10b981; }
.cn-palette__btn--output::before     { background: #6366f1; }

/* ── Top bar ─────────────────────────────────────────────────────────────────── */

.cn-topbar {
  position: absolute;
  top: 0; left: 200px; right: 0;
  height: 44px;
  background: #0e1120;
  border-bottom: 1px solid #1e2340;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  z-index: 20;
  overflow: hidden;
}

.cn-topbar__name {
  font-weight: 600;
  font-size: 13px;
  color: #e2e8f0;
  flex-shrink: 0;
}

.cn-topbar__api {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  flex: 1;
}

.cn-topbar__api-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #3a4060;
  flex-shrink: 0;
}

.cn-topbar__api-url {
  font-size: 11px;
  font-family: "SF Mono", "Fira Code", monospace;
  color: #4fc3f7;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cn-topbar__api-url:hover { text-decoration: underline; }

.cn-save-status {
  margin-left: auto;
  font-size: 11px;
  color: #3a4060;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.cn-topbar__snapshot {
  font-size: 11px;
  background: #1e2340;
  border: 1px solid #2a3050;
  border-radius: 4px;
  color: #8892b0;
  padding: 3px 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s;
}

.cn-topbar__snapshot:hover {
  background: #2a3050;
  color: #c8d0e0;
}

.cn-topbar__history {
  font-size: 11px;
  color: #3a4060;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.12s;
}

.cn-topbar__history:hover {
  background: #1e2340;
  color: #8892b0;
}

/* ── History panel ───────────────────────────────────────────────────────────── */

.cn-history {
  position: absolute;
  top: 44px;
  right: 0;
  width: 260px;
  height: calc(100vh - 44px);
  background: #0e1120;
  border-left: 1px solid #1e2340;
  z-index: 25;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cn-history__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #1e2340;
  flex-shrink: 0;
}

.cn-history__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4a5570;
}

.cn-history__close {
  color: #2a3050;
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
  transition: color 0.12s;
}

.cn-history__close:hover { color: #8892b0; }

.cn-history__list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: #2a2f45 transparent;
}

.cn-history__empty {
  font-size: 12px;
  color: #2a3050;
  text-align: center;
  margin-top: 24px;
  font-style: italic;
}

.cn-history__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 5px;
  border: 1px solid #1e2340;
  margin-bottom: 6px;
  background: #13162a;
}

.cn-history__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cn-history__time {
  font-size: 12px;
  color: #8892b0;
}

.cn-history__nodes {
  font-size: 10px;
  color: #2a3050;
  font-family: monospace;
}

.cn-history__restore {
  font-size: 10px;
  background: transparent;
  border: 1px solid #2a3050;
  border-radius: 3px;
  color: #4a5570;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
}

.cn-history__restore:hover {
  border-color: #10b981;
  color: #10b981;
}

.cn-topbar__logout {
  font-size: 11px;
  color: #3a4060;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.12s;
}

.cn-topbar__logout:hover {
  background: #1e2340;
  color: #8892b0;
}

.cn-topbar__logo {
  font-size: 12px;
  font-weight: 700;
  color: #3a4060;
  text-decoration: none;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  transition: color 0.12s;
}

.cn-topbar__logo:hover {
  color: #8892b0;
}

/* ── Dashboard ───────────────────────────────────────────────────────────────── */

.cn-dashboard {
  min-height: 100vh;
  background: #0a0d18;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.cn-dashboard__header {
  text-align: center;
  margin-bottom: 48px;
}

.cn-dashboard__logo {
  font-size: 20px;
  font-weight: 700;
  color: #c9d1d9;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
}

.cn-dashboard__sub {
  font-size: 13px;
  color: #3a4060;
  margin: 0;
}

.cn-dashboard__nav {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 480px;
}

.cn-dashboard__card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 20px;
  background: #0f1225;
  border: 1px solid #1e2340;
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.12s, background 0.12s;
}

.cn-dashboard__card:hover {
  border-color: #3b82f6;
  background: #111530;
}

.cn-dashboard__card-icon {
  font-size: 22px;
  color: #3a4060;
}

.cn-dashboard__card-title {
  font-size: 15px;
  font-weight: 700;
  color: #c9d1d9;
  margin: 0 0 4px;
}

.cn-dashboard__card-desc {
  font-size: 12px;
  color: #3a4060;
  margin: 0;
  line-height: 1.5;
}

.cn-dashboard__footer {
  margin-top: 32px;
}

.cn-dashboard__logout {
  font-size: 12px;
  color: #3a4060;
  text-decoration: none;
  transition: color 0.12s;
}

.cn-dashboard__logout:hover {
  color: #8892b0;
}

/* ── Canvas area ─────────────────────────────────────────────────────────────── */

.cn-canvas {
  position: absolute;
  top: 44px; left: 200px; right: 0; bottom: 0;
  overflow: hidden;
  cursor: grab;
  background-color: #0a0d18;
  background-image:
    radial-gradient(circle, #1e2340 1.5px, transparent 1.5px);
  background-size: 28px 28px;
}

.cn-canvas:active { cursor: grabbing; }

/* ── World (transform container) ────────────────────────────────────────────── */

.cn-world {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* ── SVG edges ───────────────────────────────────────────────────────────────── */

.cn-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
}

.cn-edge {
  fill: none;
  stroke: #2a4070;
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: stroke;
  cursor: pointer;
}

.cn-edge--temp {
  stroke: #4fc3f7;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  opacity: 0.8;
  pointer-events: none;
}

.cn-edge--selected {
  stroke: #4fc3f7;
  stroke-width: 2.5;
  opacity: 1;
}

.cn-edge-del {
  pointer-events: all;
  cursor: pointer;
}

.cn-edge-del__circle {
  fill: #0e1120;
  stroke: #ef4444;
  stroke-width: 1.5;
}

.cn-edge-del__icon {
  fill: #ef4444;
  font-size: 13px;
  font-family: system-ui, sans-serif;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.cn-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
  cursor: pointer;
}

/* ── Zoom indicator ──────────────────────────────────────────────────────────── */

.cn-zoom {
  position: absolute;
  bottom: 12px; right: 12px;
  background: #0e1120;
  border: 1px solid #1e2340;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: monospace;
  color: #3a4060;
  z-index: 20;
  pointer-events: none;
  letter-spacing: 0.04em;
}

/* ── Cursors (collaboration) ─────────────────────────────────────────────────── */

.cn-cursors {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.cn-cursor {
  position: absolute;
  top: 0; left: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  will-change: transform;
}

.cn-cursor__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.4);
}

.cn-cursor__name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(14,17,32,0.75);
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}

/* ── Nodes ───────────────────────────────────────────────────────────────────── */

.cn-node {
  position: absolute;
  width: 220px;
  user-select: none;
}

.cn-node__card {
  margin: 0 10px;
  background: #13162a;
  border: 1px solid #1e2340;
  border-radius: 7px;
  overflow: hidden;
  transition: border-color 0.12s;
}

.cn-node:hover .cn-node__card {
  border-color: #2a3050;
}

.cn-node__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #0e1120;
  border-bottom: 1px solid #1e2340;
  cursor: grab;
}

.cn-node__header:active { cursor: grabbing; }

.cn-node__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cn-node__kind {
  flex: 1;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4a5570;
}

.cn-node__del {
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  color: #2a3050;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.12s;
  flex-shrink: 0;
}

.cn-node__del:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.cn-node__body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cn-node__label {
  font-size: 13px;
  font-weight: 500;
  color: #c8d0e0;
  min-height: 18px;
  outline: none;
  border-radius: 3px;
  padding: 1px 3px;
  cursor: text;
  word-break: break-word;
  line-height: 1.4;
  transition: background 0.1s;
}

.cn-node__label:focus { background: #090c18; }

.cn-node__label:empty::before {
  content: attr(placeholder);
  color: #2a3050;
  pointer-events: none;
}

.cn-node__desc {
  font-size: 11px;
  color: #4a5570;
  min-height: 14px;
  outline: none;
  border-radius: 3px;
  padding: 1px 3px;
  cursor: text;
  word-break: break-word;
  line-height: 1.5;
  transition: background 0.1s;
}

.cn-node__desc:focus { background: #090c18; color: #8892b0; }

.cn-node__desc:empty::before {
  content: attr(placeholder);
  color: #1e2340;
  pointer-events: none;
  font-style: italic;
}

.cn-node__hint {
  font-size: 10px;
  color: #2d6b50;
  line-height: 1.5;
  font-style: italic;
  padding: 1px 3px;
  user-select: none;
}

/* ── Ports ───────────────────────────────────────────────────────────────────── */

.cn-node__inputs,
.cn-node__outputs {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.cn-node__inputs  { left: 0; }
.cn-node__outputs { right: 0; }

.cn-port {
  display: flex;
  align-items: center;
}

.cn-port__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #2a3050;
  background: #0a0d18;
  transition: all 0.12s;
  flex-shrink: 0;
}

.cn-port--out .cn-port__dot {
  cursor: crosshair;
}

.cn-port--out:hover .cn-port__dot,
.cn-port--in:hover .cn-port__dot {
  background: #1e2a40;
  transform: scale(1.35);
  box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.15);
}

/* ── Mod port ────────────────────────────────────────────────────────────────── */

.cn-port--mod .cn-port__dot {
  border-radius: 3px; /* diamond-ish to distinguish from regular ports */
}

/* ── Mod edge ────────────────────────────────────────────────────────────────── */

.cn-edge--mod {
  stroke: #10b981;
  stroke-width: 1.5;
  stroke-dasharray: 5 3;
  opacity: 0.55;
}

/* ── Modulation controls ─────────────────────────────────────────────────────── */

.cn-node__mod {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid #181e35;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cn-node__mod-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cn-node__mod-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #10b981;
  flex-shrink: 0;
  width: 22px;
}

.cn-node__mod-slider {
  flex: 1;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: #1e2340;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.cn-node__mod-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  cursor: pointer;
}

.cn-node__mod-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  border: none;
  cursor: pointer;
}

.cn-node__mod-val {
  font-size: 10px;
  font-family: monospace;
  color: #10b981;
  width: 14px;
  text-align: right;
  flex-shrink: 0;
}

.cn-node__mod-date {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid #1e2340;
  color: #3a4060;
  font-size: 10px;
  padding: 2px 3px;
  outline: none;
  cursor: pointer;
  color-scheme: dark;
}

.cn-node__mod-date:focus {
  border-color: #10b981;
  color: #8892b0;
}

/* ── Zoom level adaptations ──────────────────────────────────────────────────── */

/* medium: hide description and modulation */
[data-zoom-level="medium"] .cn-node__desc { display: none; }
[data-zoom-level="medium"] .cn-node__mod  { display: none; }

/* overview: collapse nodes to pill */
[data-zoom-level="overview"] .cn-node__desc,
[data-zoom-level="overview"] .cn-node__label { display: none; }
[data-zoom-level="overview"] .cn-node__mod    { display: none; }

[data-zoom-level="overview"] .cn-node__body { padding: 2px 6px; }

[data-zoom-level="overview"] .cn-node__card {
  border-radius: 4px;
}

[data-zoom-level="overview"] .cn-edge {
  stroke-width: 1;
  stroke: #1e2f50;
}

[data-zoom-level="overview"] .cn-node__del { display: none; }

/* ── Persona pin node ────────────────────────────────────────────────────────── */

.cn-node--persona {
  width: 200px;
}

.cn-node--persona-pending .cn-node__card {
  background: #0f1118;
  border: 1px solid #1f2333;
  opacity: 0.7;
}

.cn-node--persona-active .cn-node__card {
  background: linear-gradient(160deg, #1a1740 0%, #0f0e2a 100%);
  border: 1px solid #4338ca;
  box-shadow: 0 0 16px rgba(99,102,241,0.1);
}

.cn-pin__name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  padding: 2px 0 4px;
  word-break: break-all;
}

.cn-pin__status {
  font-size: 10px;
  color: #4b5563;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cn-pin__skills {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
}

.cn-pin__skill {
  font-size: 10px;
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid rgba(99,102,241,0.2);
}

/* ── Output (Telos) node ─────────────────────────────────────────────────────── */

.cn-node--output {
  width: 240px;
}

.cn-node--output .cn-node__card {
  background: linear-gradient(160deg, #1a1740 0%, #0f0e2a 100%);
  border: 1px solid #4338ca;
  border-top: 2px solid #6366f1;
  box-shadow: 0 0 24px rgba(99,102,241,0.12), 0 0 0 1px rgba(99,102,241,0.08);
}

.cn-node--output:hover .cn-node__card {
  border-color: #6366f1;
  box-shadow: 0 0 32px rgba(99,102,241,0.22), 0 0 0 1px rgba(99,102,241,0.15);
}

.cn-node--output .cn-node__kind {
  color: #a5b4fc;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 700;
}

.cn-node--output .cn-node__dot {
  background: #6366f1 !important;
}

.cn-node--output .cn-node__hint {
  color: #6366f1;
  font-size: 10px;
  opacity: 0.7;
}
