/* ============================================
   PC MUSIC NETWORK - EDITOR STYLES
   Admin Interface for Graph Management
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Brand Colors */
  --pc-user: #7300FF;
  --pc-person: #0066FF;
  --pc-group: #FF6B35;
  --pc-label: #FF2D92;
  
  /* Editor Colors */
  --editor-bg: #0d0d12;
  --editor-surface: #16161d;
  --editor-surface-2: #1e1e27;
  --editor-surface-3: #262630;
  --editor-border: rgba(255, 255, 255, 0.08);
  --editor-border-hover: rgba(255, 255, 255, 0.15);
  
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-tertiary: rgba(255, 255, 255, 0.4);
  --text-muted: rgba(255, 255, 255, 0.25);
  
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  
  --transition-fast: 150ms ease;
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 400ms cubic-bezier(0.16, 1, 0.3, 1);
  
  --header-height: 64px;
  --sidebar-width: 320px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--editor-bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* ============================================
   AUTH GATE
   ============================================ */
.auth-gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--editor-bg);
  z-index: 1000;
}

.auth-gate[hidden] {
  display: none;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  text-align: center;
}

.auth-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--pc-label) 0%, var(--pc-person) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: white;
  box-shadow: 0 8px 32px rgba(255, 45, 146, 0.3);
}

.auth-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 32px;
}

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

.input-group {
  position: relative;
}

.auth-input {
  width: 100%;
  height: 52px;
  padding: 0 48px 0 16px;
  font-size: 16px;
  color: var(--text-primary);
  background: var(--editor-surface);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition-base);
}

.auth-input::placeholder {
  color: var(--text-muted);
}

.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-password svg {
  width: 20px;
  height: 20px;
}

.toggle-password .eye-closed {
  display: none;
}

.toggle-password.active .eye-open {
  display: none;
}

.toggle-password.active .eye-closed {
  display: block;
}

.auth-submit {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, var(--pc-person) 100%);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-base);
}

.auth-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.auth-submit svg {
  width: 20px;
  height: 20px;
}

.auth-error {
  font-size: 14px;
  color: var(--danger);
  min-height: 20px;
}

.auth-back {
  display: inline-block;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.auth-back:hover {
  color: var(--text-primary);
}

/* ============================================
   EDITOR APP
   ============================================ */
.editor-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.editor-app[hidden] {
  display: none;
}

/* ============================================
   HEADER
   ============================================ */
.editor-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--editor-surface);
  border-bottom: 1px solid var(--editor-border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--pc-label) 0%, var(--pc-person) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  text-decoration: none;
  flex-shrink: 0;
}

.header-title h1 {
  font-size: 18px;
  font-weight: 600;
}

.data-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.saved {
  background: var(--success);
  animation: none;
}

.status-dot.error {
  background: var(--danger);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.header-center {
  flex: 1;
  max-width: 500px;
  margin: 0 24px;
}

.global-search {
  position: relative;
  display: flex;
  align-items: center;
}

.global-search svg {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.global-search input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 40px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--editor-surface-2);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition-base);
}

.global-search input::placeholder {
  color: var(--text-muted);
}

.global-search input:focus {
  border-color: var(--accent);
  background: var(--editor-surface-3);
}

.global-search kbd {
  position: absolute;
  right: 12px;
  padding: 2px 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--editor-surface);
  border: 1px solid var(--editor-border);
  border-radius: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  height: 36px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--editor-surface-2);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.header-btn svg {
  width: 16px;
  height: 16px;
}

.header-btn:hover {
  color: var(--text-primary);
  background: var(--editor-surface-3);
  border-color: var(--editor-border-hover);
}

.header-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.header-btn.primary {
  color: white;
  background: var(--accent);
  border-color: transparent;
}

.header-btn.primary:hover {
  background: var(--accent-hover);
}

.header-btn.danger {
  color: var(--danger);
}

.header-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--editor-border);
  margin: 0 4px;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */
.editor-main {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-height));
}

/* ============================================
   SIDEBAR
   ============================================ */
.editor-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--editor-surface);
  border-right: 1px solid var(--editor-border);
}

.sidebar-nav {
  display: flex;
  border-bottom: 1px solid var(--editor-border);
}

.nav-item {
  flex: 1;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition-base);
  position: relative;
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  color: var(--text-secondary);
  background: var(--editor-surface-2);
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.nav-count {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--editor-surface-3);
  border-radius: 10px;
}

.nav-item.active .nav-count {
  color: white;
  background: var(--accent);
}

.sidebar-filters {
  padding: 16px;
  border-bottom: 1px solid var(--editor-border);
}

.filter-section {
  margin-bottom: 16px;
}

.filter-section:last-child {
  margin-bottom: 0;
}

.filter-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  height: 30px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--editor-surface-2);
  border: 1px solid var(--editor-border);
  border-radius: 15px;
  cursor: pointer;
  transition: var(--transition-base);
}

.filter-chip:hover {
  border-color: var(--editor-border-hover);
}

.filter-chip.active {
  color: white;
  background: var(--accent);
  border-color: transparent;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.chip-dot.person { background: var(--pc-person); }
.chip-dot.group { background: var(--pc-group); }
.chip-dot.label { background: var(--pc-label); }

.filter-select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--editor-surface-2);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--accent);
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.sidebar-list::-webkit-scrollbar {
  width: 6px;
}

.sidebar-list::-webkit-scrollbar-thumb {
  background: var(--editor-border);
  border-radius: 3px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.list-item:hover {
  background: var(--editor-surface-2);
}

.list-item.active {
  background: var(--editor-surface-3);
  border: 1px solid var(--editor-border-hover);
}

.list-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--editor-border);
  flex-shrink: 0;
}

.list-item-avatar.person { border-color: var(--pc-person); }
.list-item-avatar.group { border-color: var(--pc-group); }
.list-item-avatar.label { border-color: var(--pc-label); }

.list-item-info {
  flex: 1;
  min-width: 0;
}

.list-item-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.list-item-type {
  text-transform: capitalize;
}

.list-item-connections {
  display: flex;
  align-items: center;
  gap: 4px;
}

.list-item-connections svg {
  width: 12px;
  height: 12px;
}

/* Link list items */
.list-item-link {
  padding: 12px;
}

.link-preview {
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-preview-node {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--editor-border);
}

.link-preview-arrow {
  color: var(--text-muted);
}

.link-preview-arrow svg {
  width: 16px;
  height: 16px;
}

.link-preview-strength {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-tertiary);
  background: var(--editor-surface);
  border-radius: 10px;
}

.sidebar-actions {
  padding: 16px;
  border-top: 1px solid var(--editor-border);
}

.action-btn {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-base);
}

.action-btn:hover {
  background: var(--accent-hover);
}

.action-btn svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   CONTENT AREA
   ============================================ */
.editor-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--editor-bg);
}

/* Empty State */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
  color: var(--text-muted);
}

.empty-icon svg {
  width: 100%;
  height: 100%;
}

.empty-state h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

.empty-btn {
  height: 44px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-base);
}

.empty-btn:hover {
  background: var(--accent-hover);
}

.empty-btn svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   EDITOR FORM
   ============================================ */
.editor-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-form[hidden] {
  display: none;
}

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

.form-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--editor-surface-2);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.back-btn:hover {
  color: var(--text-primary);
  background: var(--editor-surface-3);
}

.back-btn svg {
  width: 18px;
  height: 18px;
}

.form-title {
  font-size: 18px;
  font-weight: 600;
}

.form-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-btn {
  height: 36px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--editor-surface-2);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.form-btn svg {
  width: 16px;
  height: 16px;
}

.form-btn:hover {
  background: var(--editor-surface-3);
}

.form-btn.primary {
  color: white;
  background: var(--accent);
  border-color: transparent;
}

.form-btn.primary:hover {
  background: var(--accent-hover);
}

.form-btn.danger {
  color: var(--danger);
}

.form-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
}

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

.form-grid {
  max-width: 900px;
  margin: 0 auto;
}

.form-section {
  margin-bottom: 32px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--editor-border);
}

.section-btn {
  height: 28px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.section-btn:hover {
  background: rgba(99, 102, 241, 0.1);
}

.section-btn svg {
  width: 14px;
  height: 14px;
}

/* Cover Section */
.cover-section {
  position: relative;
  margin-bottom: 48px;
}

.cover-preview {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--editor-surface-2);
  position: relative;
}

.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition-base);
}

.cover-preview:hover .cover-overlay {
  opacity: 1;
}

.cover-btn {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: white;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-base);
}

.cover-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.cover-btn svg {
  width: 18px;
  height: 18px;
}

.avatar-preview {
  position: absolute;
  left: 24px;
  bottom: -40px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--editor-surface);
  border: 4px solid var(--editor-bg);
  overflow: hidden;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition-base);
}

.avatar-preview:hover .avatar-btn {
  opacity: 1;
}

.avatar-btn svg {
  width: 24px;
  height: 24px;
  color: white;
}

/* Form Fields */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-row.four-col {
  grid-template-columns: repeat(4, 1fr);
}

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

.form-field:last-child {
  margin-bottom: 0;
}

.form-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-field label svg {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--editor-surface);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition-base);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-muted);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.range-field {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-field input[type="range"] {
  flex: 1;
  height: 6px;
  padding: 0;
  background: var(--editor-surface-3);
  border: none;
  border-radius: 3px;
  -webkit-appearance: none;
}

.range-field input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-appearance: none;
}

.range-value {
  min-width: 40px;
  padding: 4px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--editor-surface);
  border-radius: var(--radius-sm);
}

/* Users List */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--editor-surface);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-md);
}

.user-item-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--editor-border);
}

.user-item-info {
  flex: 1;
  min-width: 0;
}

.user-item-name {
  font-size: 14px;
  font-weight: 500;
}

.user-item-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.user-item-actions {
  display: flex;
  gap: 4px;
}

.user-item-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.user-item-btn:hover {
  color: var(--text-primary);
  background: var(--editor-surface-2);
  border-color: var(--editor-border);
}

.user-item-btn.danger:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.user-item-btn svg {
  width: 16px;
  height: 16px;
}

/* Connections */
.connections-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.connection-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--editor-surface);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-sm);
}

.connection-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.connection-item-info {
  flex: 1;
  min-width: 0;
}

.connection-item-name {
  font-size: 13px;
  font-weight: 500;
}

.connection-item-type {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: capitalize;
}

.connection-item-strength {
  padding: 2px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--editor-surface-2);
  border-radius: 10px;
}

.connection-item-remove {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition-base);
}

.connection-item-remove:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.connection-item-remove svg {
  width: 14px;
  height: 14px;
}

.connection-count {
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--editor-surface-2);
  border-radius: 10px;
}

.add-connection-btn {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px dashed var(--editor-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.add-connection-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.add-connection-btn svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   LINK EDITOR
   ============================================ */
.link-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 40px;
  margin-bottom: 32px;
  background: var(--editor-surface);
  border-radius: var(--radius-lg);
}

.link-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.link-node img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--editor-border);
  transition: var(--transition-base);
}

.link-node.source img {
  border-color: var(--pc-person);
}

.link-node.target img {
  border-color: var(--pc-group);
}

.link-node span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.link-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.link-line svg {
  width: 100px;
  height: 20px;
}

.link-strength {
  padding: 4px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.15);
  border-radius: 20px;
}

/* ============================================
   GRAPH PREVIEW
   ============================================ */
.graph-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.graph-preview[hidden] {
  display: none;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.preview-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.preview-actions {
  display: flex;
  gap: 8px;
}

.preview-btn {
  height: 36px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--editor-surface);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.preview-btn:hover {
  background: var(--editor-surface-2);
}

.preview-btn svg {
  width: 16px;
  height: 16px;
}

.preview-graph {
  flex: 1;
  background: var(--editor-surface);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.preview-graph svg {
  width: 100%;
  height: 100%;
}

.preview-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 16px;
  padding: 16px;
  background: var(--editor-surface);
  border-radius: var(--radius-md);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 600;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--editor-surface);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.modal-small {
  max-width: 400px;
}

.modal.modal-large {
  max-width: 600px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--editor-surface-2);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--editor-border);
}

.modal-btn {
  height: 40px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.modal-btn.secondary {
  color: var(--text-secondary);
  background: var(--editor-surface-2);
  border: 1px solid var(--editor-border);
}

.modal-btn.secondary:hover {
  background: var(--editor-surface-3);
}

.modal-btn.primary {
  color: white;
  background: var(--accent);
  border: none;
}

.modal-btn.primary:hover {
  background: var(--accent-hover);
}

.modal-btn.danger {
  color: white;
  background: var(--danger);
  border: none;
}

.modal-btn.danger:hover {
  background: #dc2626;
}

.modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Import Modal */
.import-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.import-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--editor-surface-2);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.import-option:hover {
  border-color: var(--editor-border-hover);
}

.import-option input[type="radio"] {
  margin-top: 2px;
  accent-color: var(--accent);
}

.option-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option-content strong {
  font-size: 14px;
}

.option-content small {
  font-size: 12px;
  color: var(--text-tertiary);
}

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  border: 2px dashed var(--editor-border);
  border-radius: var(--radius-lg);
  transition: var(--transition-base);
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.drop-zone svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.drop-zone p {
  font-size: 14px;
  color: var(--text-tertiary);
}

.drop-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.drop-btn:hover {
  background: rgba(99, 102, 241, 0.1);
}

.import-preview {
  margin-top: 16px;
  padding: 12px;
  background: var(--editor-surface-2);
  border-radius: var(--radius-sm);
}

.import-preview[hidden] {
  display: none;
}

.preview-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.file-name {
  font-size: 14px;
  font-weight: 500;
}

.file-stats {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--editor-surface);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.hiding {
  animation: toastOut 0.2s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-icon.success { color: var(--success); }
.toast-icon.error { color: var(--danger); }
.toast-icon.warning { color: var(--warning); }
.toast-icon.info { color: var(--accent); }

.toast-message {
  font-size: 14px;
}

/* ============================================
   KEYBOARD SHORTCUTS
   ============================================ */
.shortcuts-help {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.shortcuts-help[hidden] {
  display: none;
}

.shortcuts-content {
  max-width: 500px;
  padding: 24px;
  background: var(--editor-surface);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.shortcuts-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: center;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.shortcut {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shortcut kbd {
  min-width: 28px;
  padding: 4px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-primary);
  background: var(--editor-surface-2);
  border: 1px solid var(--editor-border);
  border-radius: 4px;
  text-align: center;
}

.shortcut span {
  font-size: 13px;
  color: var(--text-secondary);
}

.shortcuts-close {
  width: 100%;
  height: 40px;
  font-size: 14px;
  font-weight: 500;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
}

.shortcuts-close:hover {
  background: var(--accent-hover);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 280px;
  }
  
  .header-center {
    display: none;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
  }
  
  .editor-main {
    flex-direction: column;
  }
  
  .editor-sidebar {
    width: 100%;
    min-width: auto;
    height: auto;
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid var(--editor-border);
  }
  
  .sidebar-list {
    max-height: 200px;
  }
  
  .header-title h1 {
    font-size: 14px;
  }
  
  .data-status {
    display: none;
  }
  
  .header-btn span {
    display: none;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-row.four-col {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .link-visual {
    flex-direction: column;
    padding: 24px;
  }
  
  .link-line svg {
    transform: rotate(90deg);
  }
  
  .preview-stats {
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .shortcuts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .auth-container {
    padding: 20px;
  }
  
  .form-body {
    padding: 16px;
  }
  
  .cover-preview {
    height: 150px;
  }
  
  .avatar-preview {
    width: 80px;
    height: 80px;
    bottom: -32px;
    left: 16px;
  }
  
  .form-row.four-col {
    grid-template-columns: 1fr;
  }
  
  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--editor-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--editor-border-hover);
}

/* ============================================
   FOCUS STATES
   ============================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}