html {
  font-size: 15px;
}

* {
  box-sizing: border-box;
  border-radius: 0 !important;
}

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

body {
  width: 100%;
  max-width: 100%;
  padding-left: 0;
  background-color: #1a1a1a;
  color: #e5e5e5;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1000px;
  padding: 40px 20px;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

h1 {
  font-size: 32px;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0;
  line-height: 1;
}

header h1 {
  margin: 0;
  flex-shrink: 0;
}

/* Header icon buttons */
.btn-header-icon {
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #777;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.btn-header-icon:hover {
  color: #ddd;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

#searchInput {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid #383838;
  border-radius: 6px;
  font-family: inherit;
  font-size: 1.2rem;
  background-color: #242424;
  color: #e0e0e0;
}

#searchInput:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.stats {
  margin-bottom: 30px;
  color: #777;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats .total-vertex-count,
.stats .authority-vertex-count {
  color: #999;
  margin-left: 8px;
}

.stats .selected-authority {
  font-weight: 500;
  color: #e0e0e0;
}

.back-to-authorities {
  background: none;
  border: none;
  color: #6ab0ff;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  margin-right: 12px;
}

.back-to-authorities:hover {
  text-decoration: underline;
}

.view-mode-toggle {
  background: transparent;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.view-mode-toggle:hover {
  background: #2e2e2e;
  border-color: #555;
}

.view-mode-toggle.active {
  background: #0066cc;
  border-color: #0066cc;
  color: white;
}

/* Authority Grid */
.authority-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.authority-card {
  background: #242424;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.authority-card:hover {
  border-color: #6ab0ff;
  box-shadow: 0 2px 8px rgba(106, 176, 255, 0.15);
}

.authority-card-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: #2a2a2a;
}

.authority-card-placeholder {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, #2a2a2a 0%, #333 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
}

.authority-card-info {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.authority-card-domain {
  font-size: 14px;
  font-weight: 500;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.authority-card-count {
  font-size: 12px;
  color: #777;
}

.loading {
  padding: 60px 20px;
  color: #777;
  font-size: 18px;
}

.error-message {
  background-color: #2c1215;
  color: #ff8080;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  border: 1px solid #5a2028;
}

.error-message.hidden {
  display: none;
}

.empty-state {
  padding: 80px 20px;
  color: #777;
}

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

.empty-state p {
  margin-bottom: 10px;
  font-size: 18px;
}

.empty-state .subtitle {
  font-size: 14px;
  font-style: italic;
}

.vertices-list {
  display: block;
}

.vertex-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem 0;
  margin-bottom: 0.5rem;
  border-top: 1px solid #2a2a2a;
  cursor: default;
}

.vertex-main {
  flex: 1;
  min-width: 0;
}

.vertex-marginnote {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
  margin-left: 1rem;
}

.vertex-copy-btn,
.vertex-graph-btn,
.vertex-delete-btn {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.vertex-card:hover .vertex-copy-btn,
.vertex-card:hover .vertex-graph-btn,
.vertex-card:hover .vertex-delete-btn {
  opacity: 1;
}

a.vertex-url {
  display: block;
  font-size: 1.7rem;
  font-weight: 500;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
  text-decoration: none;
  background: none;
  text-shadow: none;
  margin-bottom: 0.5rem;
}

a.vertex-url:hover {
  text-decoration: underline;
  background: none;
  text-shadow: none;
}

.archive-pill-container {
  position: relative;
  flex-shrink: 0;
}

.archive-count-pill {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  background-color: #2e2e2e;
  color: #999;
  transition: all 0.2s ease;
  min-width: 24px;
  border: none;
  cursor: pointer;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.archive-count-pill svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.archive-count-pill span {
  line-height: 1;
}

.archive-count-pill:hover:not(:disabled) {
  background-color: #383838;
  transform: scale(1.05);
  opacity: 1;
}

.archive-count-pill.active {
  background-color: #28a745;
  color: white;
  opacity: 1;
}

.archive-count-pill.active:hover {
  background-color: #218838;
}

.archive-count-pill:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.archive-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #242424;
  border: 1px solid #383838;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  min-width: 200px;
  max-height: 300px;
  overflow-y: auto;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.archive-dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: none;
  text-align: left;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  color: #ccc;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid #2e2e2e;
}

.archive-dropdown-item:last-child {
  border-bottom: none;
}

.archive-dropdown-item:hover {
  background-color: #2e2e2e;
  color: #6ab0ff;
}

.archive-dropdown-share-all {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  font-size: 13px;
  color: #888;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.archive-dropdown-share-all input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

.archive-dropdown-share-all:hover {
  color: #aaa;
}

.archive-dropdown-separator {
  height: 1px;
  background-color: #383838;
  margin: 2px 0;
}

.archive-shared-indicator {
  color: #888;
  font-size: 0.9em;
  margin-left: 4px;
}

/* Archive Viewer */
.archive-viewer {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
}

.archive-frame-container {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

.archive-fullscreen-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  width: 32px;
  height: 32px;
  background: rgba(51, 51, 51, 0.9);
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  transition: all 0.15s ease;
}

.archive-fullscreen-btn:hover {
  background: #444;
  color: #e5e5e5;
}

.archive-viewer.fullscreen .archive-frame-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: #1a1a1a;
  z-index: 100;
  padding: 0;
}

.archive-viewer.fullscreen .archive-frame {
  border-radius: 0;
  border: none;
}

.archive-fullscreen-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: rgba(30, 30, 30, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 101;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.archive-fullscreen-label {
  color: #b8860b;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 10px;
}

.archive-fullscreen-date {
  color: #999;
}

.archive-viewer.fullscreen .archive-frame-container {
  top: 28px;
  height: calc(100vh - 28px);
}

/* Archive overlay - corner brackets + center dot */
.archive-fullscreen-overlay {
  position: fixed;
  top: 28px;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 102;
}

.archive-overlay-corner {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 5px solid rgba(184, 134, 11, 0.35);
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.archive-overlay-corner.top-left {
  top: 12px;
  left: 12px;
  border-right: none;
  border-bottom: none;
}

.archive-overlay-corner.top-right {
  top: 12px;
  right: 12px;
  border-left: none;
  border-bottom: none;
}

.archive-overlay-corner.bottom-left {
  bottom: 12px;
  left: 12px;
  border-right: none;
  border-top: none;
}

.archive-overlay-corner.bottom-right {
  bottom: 12px;
  right: 12px;
  border-left: none;
  border-top: none;
}

.archive-overlay-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  background: rgba(184, 134, 11, 0.35);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.archive-overlay-date {
  position: absolute;
  bottom: 24px;
  right: 24px;
  color: rgba(184, 134, 11, 0.6);
  font-size: 20px;
  font-weight: 500;
}

.archive-viewer-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.btn-back {
  background: transparent;
  border: 1px solid #383838;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  color: #999;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-back:hover {
  background-color: #2e2e2e;
  border-color: #555;
}

.archive-viewer-header h2 {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: 500;
  color: #6ab0ff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.archive-note {
  margin-top: 0.4rem;
  margin-bottom: 0;
  padding: 2px 6px;
  min-height: unset;
  color: inherit;
}

#archiveViewerNote:empty::before {
  content: 'No archive note (click to add)';
}

#archiveVertexNote:empty::before {
  content: 'No vertex note (click to add)';
}

.archive-viewer-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: #777;
  margin-bottom: 16px;
}

.archive-nav-btn {
  background: transparent;
  border: 1px solid #383838;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: #999;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.archive-nav-btn:hover:not(:disabled) {
  background-color: #2e2e2e;
  border-color: #555;
  color: #6ab0ff;
}

.archive-nav-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.archive-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  color: #444;
  border-color: #2a2a2a;
}

.archive-frame {
  flex: 1;
  width: 100%;
  border: 1px solid #383838;
  border-radius: 8px;
  background: white;
}

.vertex-copy-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  color: #adb5bd;
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vertex-copy-btn:hover {
  color: #495057;
}

.vertex-delete-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  color: #adb5bd;
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.vertex-delete-btn:hover {
  color: #dc3545;
}

.vertex-graph-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  color: #adb5bd;
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.vertex-graph-btn:hover {
  color: #495057;
}

.vertex-note {
  font-size: 1.2rem;
  color: #888;
  line-height: 1.8rem;
  font-style: italic;
  cursor: text;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  min-height: 24px;
}

.vertex-note:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.vertex-note:empty::before {
  content: 'No note (click to add)';
  color: #505050;
}

.vertex-note.editing {
  cursor: default;
  background-color: transparent;
}

.vertex-note-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #007bff;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  color: #e0e0e0;
  background-color: #242424;
}

textarea.vertex-note-input {
  resize: vertical;
  min-height: 80px;
}

input.vertex-note-input {
  min-height: auto;
}

.vertex-note-input:focus {
  outline: none;
  border-color: #0056b3;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.editable-note-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.editable-note-input-row .vertex-note-input {
  flex: 1;
}

.validation-status {
  flex-shrink: 0;
  font-size: 0.85rem;
  line-height: 1;
}

.validation-checking {
  color: #888;
}

.validation-valid {
  color: #28a745;
}

.validation-invalid {
  color: #dc3545;
}

/* DraftableInput styles */
.editable-input-field {
  width: 100%;
  padding: 8px;
  border: 1px solid #007bff;
  background-color: #242424;
  font-family: inherit;
  font-size: inherit;
  color: #e0e0e0;
  line-height: 1.6rem;
  resize: vertical;
  min-height: 80px;
}

.editable-input-field:focus {
  outline: none;
  border-color: #0056b3;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.editable-input-hint {
  font-size: 0.9rem;
  color: #6c757d;
  font-style: italic;
  margin-top: 4px;
}

.draft-indicator {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: #ffc107;
  color: #000;
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 600;
  vertical-align: middle;
}

.placeholder-text,
.placeholder {
  color: #6c757d;
  font-style: italic;
}

.has-draft {
  border-left: 3px solid #ffc107;
  padding-left: 8px;
}

/* Add background to DraftableInput when not editing */
.vertex-note:not(.editing) {
  background-color: rgba(0, 0, 0, 0.02);
  padding: 8px;
  transition: background-color 0.15s ease;
}

.vertex-timestamp {
  font-size: 1rem;
  color: #505050;
  padding: 6px;
  font-style: italic;
}

.vertex-preview-inline {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 0.8rem;
  padding: 12px;
  background: #222;
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid #2a2a2a;
}

.vertex-preview-inline-text {
  flex: 1;
  min-width: 0;
}

.vertex-preview-inline-desc {
  font-size: 1.4rem;
  color: #9ca3af;
  line-height: 2rem;
  margin: 0.4rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vertex-preview-thumb {
  width: 120px;
  max-height: 120px;
  object-fit: contain;
  flex-shrink: 0;
  border: 1px solid #333;
  background: #2a2a2a;
}

.hidden {
  display: none !important;
}

/* Bulk Actions Bar (hidden when no selection) */
.bulk-actions-bar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: slideDown 0.3s ease;
}

.bulk-actions-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

#selectedCount {
  color: white;
  font-size: 15px;
  font-weight: 600;
}

.bulk-actions-buttons {
  display: flex;
  gap: 10px;
}

.btn-bulk-delete,
.btn-bulk-clear {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-bulk-delete {
  background-color: #dc3545;
  color: white;
}

.btn-bulk-delete:hover:not(:disabled) {
  background-color: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.btn-bulk-delete:disabled {
  background-color: #2e2e2e;
  color: #555;
  cursor: not-allowed;
}

.btn-bulk-clear {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-bulk-clear:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Archive Share Section */
.archive-share-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-share {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 14px;
  font-style: italic;
  color: #555;
  cursor: pointer;
  transition: color 0.15s ease;
}

.btn-share:hover:not(:disabled) {
  color: #aaa;
}

.btn-share:disabled {
  color: #333;
  cursor: not-allowed;
}

.btn-share svg {
  display: none;
}

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

a.share-link {
  font-size: 13px;
  color: #6ab0ff;
  background: none;
  text-shadow: none;
  text-decoration: none;
}

a.share-link:hover {
  text-decoration: underline;
  background: none;
  text-shadow: none;
}

.share-link-anchor {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: #6ab0ff;
  text-decoration: none;
  word-break: break-all;
}

.share-link-anchor:hover {
  text-decoration: underline;
}

.share-link-separator {
  margin: 0 0.5rem;
  color: #444;
}

.share-link-unions {
  font-size: 0.9rem;
  color: #666;
  text-decoration: none;
}

.share-link-unions:hover {
  color: #888;
  text-decoration: underline;
}

.btn-share-for-unions {
  margin-left: auto;
  padding: 0.25rem 0.5rem;
  background: transparent;
  border: 1px solid #444;
  color: #888;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.btn-share-for-unions:hover {
  border-color: #666;
  color: #aaa;
}

/* Archive empty state */
.archive-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #777;
}

.archive-empty-state p {
  margin: 0 0 8px 0;
}

.archive-empty-subtitle {
  font-size: 0.9rem;
  color: #555;
}

.archive-visit-link {
  display: inline-block;
  margin-top: 20px;
  color: #6ab0ff;
  text-decoration: none;
  font-size: 0.95rem;
}

.archive-visit-link:hover {
  text-decoration: underline;
}

.globe-icon {
  flex-shrink: 0;
  font-size: 1rem;
}

.btn-copy {
  background: transparent;
  border: 1px solid #383838;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  color: #999;
  cursor: pointer;
  transition: all 0.2s ease, box-shadow 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.btn-copy:hover {
  background-color: #007bff;
  border-color: #007bff;
  color: white;
  transform: scale(1.05);
}

.btn-copy:active {
  transform: scale(0.95);
}

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

/* ============================================
   Graph View Styles (Tufte-inspired)
   ============================================ */

.graph-view {
  /* Inherits adaptive width from .container */
}

/* Breadcrumb navigation */
.graph-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  line-height: 1.6;
}

.breadcrumb-link {
  color: #6ab0ff;
  cursor: pointer;
  text-decoration: none;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: #666;
  flex-shrink: 0;
  /* ET Book font doesn't have the › character, causing corrupt rendering.
     Use system font to ensure the separator displays correctly. */
  font-family: system-ui, -apple-system, sans-serif;
}

.breadcrumb-current {
  color: #e5e5e5;
  font-weight: 500;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-view-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.btn-draw {
  padding: 0.4rem 0.8rem;
  background: #444;
  border: 1px solid #666;
  color: #ccc;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-draw:hover {
  background: #666;
  border-color: #666;
  color: white;
}

.graph-content {
  padding-top: 1rem;
}

/* Graph Visualization Page */
.graph-viz-page {
  height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  position: relative;
  /* Inherits adaptive width from .container */
}

.graph-viz-page.fullscreen {
  width: calc(100vw - 40px);
  max-width: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100vh;
  background: #1a1a1a;
  z-index: 100;
  padding: 1rem;
  box-sizing: border-box;
}

.graph-viz-fullscreen-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  width: 32px;
  height: 32px;
  background: rgba(51, 51, 51, 0.9);
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  transition: all 0.15s ease;
}

.graph-viz-fullscreen-btn:hover {
  background: #444;
  color: #e5e5e5;
}

.graph-viz-container {
  flex: 1;
  border: 1px solid #3a3a3a;
  background: #2a2a2a;
  overflow: hidden;
}

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

.graph-viz-svg text {
  user-select: none;
  pointer-events: none;
}

.graph-instructions {
  font-size: 1.2rem;
  color: #6c757d;
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 2rem;
  text-align: center;
}

.graph-section {
  margin-bottom: 2rem;
  border: 1px solid #3a3a3a;
  background: #2a2a2a;
  padding: 0;
}

.graph-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #3a3a3a;
  background: #333;
}

.graph-section-label {
  font-size: 1.1rem;
  font-weight: 500;
  color: #e5e5e5;
}

.graph-section-count {
  font-size: 0.95rem;
  color: #aaa;
  background: #444;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

.expand-icon {
  color: #9ca3af;
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.graph-edges-list {
  padding: 0;
  max-height: 600px;
  overflow-y: auto;
  transition: max-height 0.3s ease;
}

.graph-edges-list.collapsed {
  max-height: 0;
  overflow: hidden;
  padding: 0;
}

/* Horizontal scrolling row of edge cards */
.graph-edges-row {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.graph-edges-row::-webkit-scrollbar {
  height: 6px;
}

.graph-edges-row::-webkit-scrollbar-track {
  background: #2a2a2a;
}

.graph-edges-row::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
}

.graph-edges-row::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* Individual edge preview card */
.graph-edge-card {
  flex: 0 0 220px;
  min-width: 220px;
  max-width: 220px;
  background: #333;
  border: 1px solid #444;
  cursor: pointer;
  position: relative;
  scroll-snap-align: start;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.graph-edge-card:hover {
  border-color: #666;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.graph-edge-card-union {
  opacity: 0.7;
}

.graph-edge-card-union:hover {
  opacity: 0.85;
}

.graph-edge-card-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  background: #2a2a2a;
}

.graph-edge-card-content {
  padding: 0.75rem;
}

.graph-edge-card-title {
  font-size: 1rem;
  font-weight: 500;
  color: #e5e5e5;
  line-height: 1.3;
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.graph-edge-card-desc {
  font-size: 0.85rem;
  color: #9ca3af;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.graph-edge-card-url {
  display: block;
  font-size: 0.8rem;
  color: #9ca3af;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-edge-card-url:hover {
  text-decoration: underline;
  color: #6ab0ff;
}

/* Edge card action buttons container */
.graph-edge-card-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.graph-edge-card:hover .graph-edge-card-actions {
  opacity: 1;
}

.graph-edge-card-edit,
.graph-edge-card-delete {
  width: 22px;
  height: 22px;
  background: rgba(51, 51, 51, 0.9);
  border: 1px solid #555;
  border-radius: 3px;
  color: #999;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.graph-edge-card-edit:hover {
  background: #4a90d9;
  border-color: #4a90d9;
  color: white;
}

.graph-edge-card-delete:hover {
  background: #dc3545;
  border-color: #dc3545;
  color: white;
}

/* Edge info display on card */
.graph-edge-card-info {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #444;
  font-size: 0.8rem;
  color: #9ca3af;
  font-style: italic;
  line-height: 1.4;
  white-space: pre-wrap;
}

/* Edge Info Modal */
.edge-info-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.edge-info-modal {
  background: #2a2a2a;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.edge-info-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.edge-info-modal-close:hover {
  background: #444;
  color: #e5e5e5;
}

.edge-info-modal-preview {
  padding: 1.5rem;
  border-bottom: 1px solid #444;
}

.edge-info-modal-image {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.edge-info-modal-content {
  padding-right: 2rem;
}

.edge-info-modal-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: #e5e5e5;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.edge-info-modal-desc {
  font-size: 0.9rem;
  color: #9ca3af;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.edge-info-modal-url {
  font-size: 0.85rem;
  color: #6ab0ff;
  text-decoration: none;
  word-break: break-all;
}

.edge-info-modal-url:hover {
  text-decoration: underline;
}

.edge-info-modal-note-section {
  padding: 1.5rem;
}

.edge-info-modal-note-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.edge-info-modal-note {
  min-height: 40px;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #e5e5e5;
  cursor: pointer;
  white-space: pre-wrap;
}

.edge-info-modal-note:empty::before {
  content: 'Click to add a note...';
  color: #777;
  font-style: italic;
}

.edge-info-modal-note.editing {
  cursor: text;
}

.edge-info-modal-note .vertex-note-input {
  width: 100%;
  min-height: 80px;
  border: 1px solid #4a90d9;
  border-radius: 4px;
  outline: none;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  padding: 0.5rem;
  background: #333;
  color: #e5e5e5;
  box-sizing: border-box;
}

.graph-edge-card-info-actions .btn-save:disabled,
.graph-edge-card-info-actions .btn-cancel:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.graph-edge-item {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #3a3a3a;
  position: relative;
}

.graph-edge-item:last-child {
  border-bottom: none;
}

.graph-edge-item:hover {
  background: #333;
}

.graph-edge-vertex-section {
  margin-bottom: 0.5rem;
}

.graph-edge-vertex-title {
  font-size: 1.3rem;
  font-weight: 500;
  color: #e5e5e5;
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

.graph-edge-vertex-url {
  display: block;
  font-size: 1rem;
  color: #9ca3af;
  text-decoration: none;
  line-height: 1.4;
  word-break: break-word;
}

.graph-edge-vertex-url:hover {
  text-decoration: underline;
}

.graph-edge-vertex {
  display: block;
  font-size: 1.2rem;
  color: #e5e5e5;
  text-decoration: none;
  line-height: 1.5;
  margin-bottom: 0.4rem;
  word-break: break-word;
}

.graph-edge-vertex:hover {
  text-decoration: underline;
}

.graph-edge-metadata {
  display: flex;
  gap: 1rem;
  font-size: 1rem;
  color: #9ca3af;
  margin-bottom: 0.5rem;
}

.graph-edge-type {
  font-style: italic;
}

.graph-edge-timestamp {
  font-size: 0.95rem;
}

.graph-edge-info {
  font-size: 1.1rem;
  color: #bbb;
  line-height: 1.6;
  margin: 0.5rem 0 0 0;
  font-style: italic;
}

.graph-edge-delete {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid #555;
  color: #999;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  transition: all 0.15s ease;
}

.graph-edge-delete:hover {
  background: #dc3545;
  border-color: #dc3545;
  color: white;
}

.graph-empty-message {
  padding: 2rem 1.5rem;
  text-align: center;
  color: #9ca3af;
  font-size: 1.1rem;
  font-style: italic;
  margin: 0;
}

.graph-create-edge {
  margin-top: 3rem;
  padding: 2rem;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
}

.graph-create-edge h3 {
  font-size: 1.4rem;
  font-weight: 500;
  color: #e5e5e5;
  margin: 0 0 1.5rem 0;
}

.edge-form .form-row {
  margin-bottom: 1rem;
}

.edge-form input[type="url"],
.edge-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #3a3a3a;
  background: #1a1a1a;
  font-size: 1.2rem;
  color: #e5e5e5;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.edge-form input[type="url"]:focus,
.edge-form textarea:focus {
  outline: none;
  border-color: #555;
  background: #2a2a2a;
}

.edge-form textarea {
  resize: vertical;
  line-height: 1.6;
}

.btn-create-edge {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 1px solid #e5e5e5;
  color: #e5e5e5;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-create-edge:hover {
  background: #e5e5e5;
  color: #1a1a1a;
}

.btn-create-edge:active {
  transform: scale(0.98);
}

/* Autocomplete Dropdown */
.autocomplete-container {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 2px;
}

.autocomplete-dropdown.hidden {
  display: none;
}

.autocomplete-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #3a3a3a;
  transition: background-color 0.15s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: #333;
}

.autocomplete-title {
  font-size: 1.2rem;
  font-weight: 500;
  color: #e5e5e5;
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.autocomplete-url {
  font-size: 1rem;
  color: #9ca3af;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.autocomplete-url-only {
  font-size: 1.1rem;
  color: #e5e5e5;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Inline vertex autocomplete for graph view */
.vertex-autocomplete {
  position: relative;
  margin: 0.75rem 1rem;
}

.vertex-autocomplete-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #3a3a3a;
  background: #1a1a1a;
  font-size: 1.1rem;
  color: #e5e5e5;
  font-family: inherit;
}

.vertex-autocomplete-input:focus {
  outline: none;
  border-color: #555;
  background: #2a2a2a;
}

.vertex-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-top: none;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.vertex-autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #3a3a3a;
}

.vertex-autocomplete-item:last-child {
  border-bottom: none;
}

.vertex-autocomplete-item:hover,
.vertex-autocomplete-item.selected {
  background: #333;
}

.vertex-autocomplete-image {
  width: 40px;
  height: 40px;
  object-fit: cover;
  flex-shrink: 0;
  background: #2a2a2a;
}

.vertex-autocomplete-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.vertex-autocomplete-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: #e5e5e5;
  margin-bottom: 0.2rem;
  line-height: 1.4;
}

.vertex-autocomplete-url {
  font-size: 0.95rem;
  color: #9ca3af;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vertex-autocomplete-url-only {
  font-size: 1rem;
  color: #e5e5e5;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Vertex autocomplete confirmation step */
.vertex-autocomplete-confirm {
  padding: 0.75rem;
  background: #333;
  border: 1px solid #444;
}

.vertex-autocomplete-selected {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.vertex-autocomplete-selected-label {
  font-size: 0.9rem;
  color: #9ca3af;
}

.vertex-autocomplete-selected-title {
  font-size: 1rem;
  font-weight: 500;
  color: #e5e5e5;
}

.vertex-autocomplete-info-input {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
  color: #e5e5e5;
}

.vertex-autocomplete-info-input:focus {
  outline: none;
}

.vertex-autocomplete-info-input::placeholder {
  color: #777;
  font-style: italic;
}

.vertex-autocomplete-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.vertex-autocomplete-actions .btn-cancel,
.vertex-autocomplete-actions .btn-confirm {
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid #444;
}

.vertex-autocomplete-actions .btn-cancel {
  background: #333;
  color: #ccc;
}

.vertex-autocomplete-actions .btn-cancel:hover {
  background: #444;
}

.vertex-autocomplete-actions .btn-confirm {
  background: #4a90d9;
  border-color: #4a90d9;
  color: white;
}

.vertex-autocomplete-actions .btn-confirm:hover {
  background: #3a7bc8;
  border-color: #3a7bc8;
}

/* Graph view center vertex card */
.graph-current-vertex {
  margin: 2rem 0;
}

.graph-center-card {
  padding: 2rem;
  background: #2a2a2a;
  border: 2px solid #e5e5e5;
  text-align: center;
}

.graph-center-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: #e5e5e5;
  margin: 0 0 1rem 0;
  line-height: 1.4;
}

.graph-center-description {
  font-size: 1.2rem;
  color: #9ca3af;
  line-height: 1.6;
  margin: 0 0 1rem 0;
  font-style: italic;
}

.graph-center-url {
  display: inline-block;
  font-size: 1.1rem;
  color: #e5e5e5;
  text-decoration: none;
  line-height: 1.5;
  margin-bottom: 1rem;
  word-break: break-all;
}

.graph-center-url:hover {
  text-decoration: underline;
}

.graph-center-image {
  max-width: 100%;
  max-height: 300px;
  margin-top: 1rem;
  border: 1px solid #3a3a3a;
}

/* Graph section header row with + button */
.graph-section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #3a3a3a;
  background: #333;
}

.graph-section-header-row h3 {
  font-size: 1.4rem;
  font-weight: 500;
  color: #e5e5e5;
  margin: 0;
  line-height: 1.4;
}

.btn-add-edge {
  background: #444;
  border: 1px solid #666;
  color: #ccc;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-add-edge:hover {
  background: #666;
  border-color: #666;
  color: white;
}

/* Graph modal */
.graph-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.graph-modal.hidden {
  display: none;
}

.graph-modal-content {
  background: #2a2a2a;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  border: 1px solid #3a3a3a;
}

.graph-modal-content h3 {
  font-size: 1.6rem;
  font-weight: 500;
  color: #e5e5e5;
  margin: 0 0 1.5rem 0;
}

.form-buttons {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.btn-cancel {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 1px solid #999;
  color: #999;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-cancel:hover {
  background: #999;
  color: white;
}

/* Graph visualization SVG styles */
.graph-viz-svg text {
  fill: #ccc;
}

/* Line strokes are set inline via D3 */

.graph-viz-svg circle {
  fill: #5a9fd4;
}

/* Graph context menu */
.graph-context-menu {
  position: fixed;
  background: #2a2a2a;
  border: 1px solid #444;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  min-width: 150px;
}

.graph-context-menu-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
  font-size: 0.9rem;
  color: #ccc;
  cursor: pointer;
  border-bottom: 1px solid #333;
}

.graph-context-menu-item:last-child {
  border-bottom: none;
}

.graph-context-menu-item:hover {
  background: #333;
  color: #6ab0ff;
}

.graph-context-menu-item-danger {
  color: #e57373;
}

.graph-context-menu-item-danger:hover {
  background: #4a2020;
  color: #ff8a80;
}

/* Connection mode hint */
.graph-viz-connecting-hint {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(42, 42, 42, 0.95);
  border: 1px solid #6ab0ff;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  color: #e5e5e5;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.graph-viz-connecting-hint button {
  padding: 0.25rem 0.75rem;
  background: transparent;
  border: 1px solid #666;
  color: #ccc;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}

.graph-viz-connecting-hint button:hover {
  border-color: #999;
  color: #fff;
}

/* Edge creation modal */
.edge-creation-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}

.edge-creation-modal {
  background: #2a2a2a;
  border: 1px solid #444;
  padding: 1.5rem;
  min-width: 400px;
  max-width: 90vw;
  position: relative;
}

.edge-creation-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.edge-creation-modal-close:hover {
  color: #ccc;
}

.edge-creation-modal h3 {
  margin: 0 0 1.25rem 0;
  font-size: 1.2rem;
  font-weight: 500;
  color: #e5e5e5;
}

.edge-creation-vertices {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.edge-creation-vertex {
  flex: 1;
  padding: 0.75rem;
  background: #333;
  border: 1px solid #444;
}

.edge-creation-label {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.edge-creation-title {
  display: block;
  font-size: 0.95rem;
  color: #e5e5e5;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edge-creation-arrow {
  color: #6ab0ff;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.edge-creation-note {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #444;
  background: #1a1a1a;
  color: #e5e5e5;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 1rem;
}

.edge-creation-note:focus {
  outline: none;
  border-color: #6ab0ff;
}

.edge-creation-note::placeholder {
  color: #666;
}

.edge-creation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.edge-creation-actions .btn-cancel {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid #666;
  color: #ccc;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}

.edge-creation-actions .btn-cancel:hover {
  border-color: #888;
  color: #fff;
}

.edge-creation-actions .btn-confirm {
  padding: 0.5rem 1.25rem;
  background: #4a90d9;
  border: none;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}

.edge-creation-actions .btn-confirm:hover:not(:disabled) {
  background: #5a9fe9;
}

.edge-creation-actions .btn-confirm:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================
   Vertex Sets Styles
   ============================================ */

/* Sets dropdown button in vertex card */
.vertex-sets-container {
  position: relative;
  flex-shrink: 0;
}

.vertex-add-sets-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: #adb5bd;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vertex-card:hover .vertex-add-sets-btn {
  opacity: 1;
}

.vertex-add-sets-btn:hover {
  color: #6ab0ff;
}

/* Sets dropdown */
.vertex-sets-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #242424;
  border: 1px solid #383838;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  min-width: 200px;
  max-height: 300px;
  animation: slideDown 0.2s ease;
}

.vertex-sets-dropdown input {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid #383838;
  background: #1a1a1a;
  color: #e5e5e5;
  font-size: 1.1rem;
  font-family: inherit;
  box-sizing: border-box;
}

.vertex-sets-dropdown input:focus {
  outline: none;
}

.vertex-sets-dropdown-list {
  max-height: 240px;
  overflow-y: auto;
}

.vertex-sets-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  text-align: left;
  font-size: 14px;
  color: #ccc;
  cursor: pointer;
  border-bottom: 1px solid #2e2e2e;
}

.vertex-sets-indicator {
  width: 14px;
  flex-shrink: 0;
  color: #28a745;
  font-size: 12px;
}

.vertex-sets-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vertex-sets-dropdown-item:last-child {
  border-bottom: none;
}

.vertex-sets-dropdown-item:hover {
  background: #2e2e2e;
  color: #6ab0ff;
}

.vertex-sets-dropdown-item.in-set {
  color: #888;
}

.vertex-sets-dropdown-item.in-set:hover {
  color: #dc3545;
}

.vertex-sets-shared {
  color: #888;
  flex-shrink: 0;
}

.vertex-sets-dropdown-item.in-set:hover .vertex-sets-indicator {
  color: #dc3545;
}

.vertex-sets-dropdown-item.highlighted {
  background: #252525;
  border-left: 2px solid #6ab0ff;
  padding-left: 10px;
}

/* "New set" option */
.vertex-sets-dropdown-item.vertex-sets-new {
  color: #6ab0ff;
  font-weight: 500;
  border-bottom: 1px solid #383838;
}

.vertex-sets-dropdown-item.vertex-sets-new:hover {
  background: #2e2e2e;
}

/* Inline input for new set name */
.vertex-sets-new-input-container {
  padding: 0;
  border-bottom: 1px solid #383838;
}

.vertex-sets-new-input {
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: #1a1a1a;
  color: #e5e5e5;
  font-size: 1.1rem;
  font-family: inherit;
  box-sizing: border-box;
}

.vertex-sets-new-input:focus {
  outline: none;
  background: #242424;
}

/* ============================================
   Vertex Sets Page Styles
   ============================================ */

.vertex-sets-page {
  padding-top: 1rem;
}

.btn-create-set {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid #6ab0ff;
  color: #6ab0ff;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s ease;
}

.btn-create-set:hover {
  background: #6ab0ff;
  color: #1a1a1a;
}

/* Create set form */
.vertex-set-create-form {
  background: #242424;
  border: 1px solid #383838;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.vertex-set-create-form input,
.vertex-set-create-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #383838;
  background: #1a1a1a;
  color: #e5e5e5;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
  margin-bottom: 0.75rem;
}

.vertex-set-create-form input:focus,
.vertex-set-create-form textarea:focus {
  outline: none;
  border-color: #6ab0ff;
}

.vertex-set-create-form textarea {
  resize: vertical;
  min-height: 60px;
}

.vertex-set-create-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.vertex-set-create-actions .btn-cancel,
.vertex-set-create-actions .btn-confirm {
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  border: 1px solid #444;
}

.vertex-set-create-actions .btn-cancel {
  background: #333;
  color: #ccc;
}

.vertex-set-create-actions .btn-cancel:hover {
  background: #444;
}

.vertex-set-create-actions .btn-confirm {
  background: #6ab0ff;
  border-color: #6ab0ff;
  color: #1a1a1a;
}

.vertex-set-create-actions .btn-confirm:hover {
  background: #5a9fd4;
  border-color: #5a9fd4;
}

.vertex-set-create-actions .btn-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Sets list */
.vertex-sets-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.vertex-set-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-top: 1px solid #2a2a2a;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.vertex-set-card:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.vertex-set-main {
  flex: 1;
  min-width: 0;
}

.vertex-set-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.4rem;
  font-weight: 500;
  color: #e5e5e5;
  margin: 0 0 0.25rem 0;
}

.vertex-set-shared-icon {
  color: #888;
  flex-shrink: 0;
}

.vertex-set-description {
  font-size: 1.1rem;
  color: #9ca3af;
  margin: 0 0 0.5rem 0;
  line-height: 1.5;
}

.vertex-set-meta {
  font-size: 0.95rem;
  color: #6c757d;
  margin: 0;
}

.vertex-set-updated {
  color: #555;
}

.vertex-set-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.vertex-set-card:hover .vertex-set-actions {
  opacity: 1;
}

.vertex-set-delete-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  color: #adb5bd;
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vertex-set-delete-btn:hover {
  color: #dc3545;
}

/* ============================================
   Vertex Set Detail Page Styles
   ============================================ */

.vertex-set-detail {
  padding-top: 1rem;
}

.vertex-set-detail-top {
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #2a2a2a;
}

.vertex-set-detail-header-section {
  min-width: 0;
}

.vertex-set-detail-sidebar {
  max-height: 200px;
  overflow-y: auto;
}

.vertex-set-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.vertex-set-detail-info {
  flex: 1;
}

.vertex-set-detail-name {
  font-size: 1.8rem;
  font-weight: 500;
  color: #e5e5e5;
  margin: 0 0 0.5rem 0;
  cursor: text;
}

.vertex-set-detail-name:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.vertex-set-detail-name .vertex-note-input {
  font-size: inherit;
  font-weight: inherit;
  padding: 0;
  border: none;
  border-bottom: 2px solid #6ab0ff;
  border-radius: 0;
  background: transparent;
}

.vertex-set-name-input {
  width: 100%;
  padding: 4px 8px;
  margin-left: -8px;
  margin-bottom: 0.5rem;
  border: 1px solid #6ab0ff;
  background: #242424;
  color: #e5e5e5;
  font-size: 1.8rem;
  font-weight: 500;
  font-family: inherit;
  box-sizing: border-box;
}

.vertex-set-name-input:focus {
  outline: none;
}

.vertex-set-detail-description {
  font-size: 1.2rem;
  color: #9ca3af;
  margin: 0;
  line-height: 1.5;
  min-height: 1.5em;
  cursor: text;
}

.vertex-set-detail-description:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.vertex-set-detail-description .vertex-note-input {
  font-size: inherit;
  color: inherit;
  line-height: inherit;
  padding: 0;
  border: none;
  border-bottom: 2px solid #6ab0ff;
  border-radius: 0;
  background: transparent;
  min-height: 3em;
}

.vertex-set-description-input {
  width: 100%;
  padding: 4px 8px;
  margin-left: -8px;
  border: 1px solid #6ab0ff;
  background: #242424;
  color: #e5e5e5;
  font-size: 1.2rem;
  font-family: inherit;
  line-height: 1.5;
  box-sizing: border-box;
  resize: vertical;
  min-height: 60px;
}

.vertex-set-description-input:focus {
  outline: none;
}

/* Share section */
.vertex-set-share-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.vertex-set-share-section .btn-share {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 14px;
  font-style: italic;
  color: #555;
  cursor: pointer;
  transition: color 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vertex-set-share-section .btn-share:hover {
  color: #aaa;
}

.vertex-set-share-section .btn-share svg {
  flex-shrink: 0;
}

/* Detail content */
.vertex-set-detail-content {
  margin-top: 1rem;
}

/* Vertex set grid layout */
.vertex-set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.vertex-set-vertices-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #333;
}

.vertex-set-vertex-count {
  font-size: 1.1rem;
  color: #777;
}

.btn-add-vertex {
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid #6ab0ff;
  color: #6ab0ff;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.btn-add-vertex:hover {
  background: #6ab0ff;
  color: #1a1a1a;
}

.btn-cancel-add {
  margin-top: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: #333;
  border: 1px solid #444;
  color: #ccc;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-cancel-add:hover {
  background: #444;
}

/* Vertices in set */
.vertex-set-vertices-list {
  display: flex;
  flex-direction: column;
}

.vertex-set-vertex-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 0;
  border-top: 1px solid #2a2a2a;
}

.vertex-set-vertex-main {
  flex: 1;
  min-width: 0;
}

.vertex-set-vertex-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.15s ease;
  margin-left: 1rem;
}

.vertex-set-vertex-card:hover .vertex-set-vertex-actions {
  opacity: 1;
}

.vertex-set-vertex-graph-btn,
.vertex-set-vertex-remove-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  color: #adb5bd;
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vertex-set-vertex-graph-btn:hover {
  color: #6ab0ff;
}

.vertex-set-vertex-remove-btn:hover {
  color: #dc3545;
}

/* ============================================
   Unions Panel Styles
   ============================================ */

.unions-panel {
  padding: 0;
}

.unions-panel h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  font-weight: 400;
  color: #777;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.unions-empty,
.unions-loading {
  color: #555;
  font-size: 0.95rem;
  font-style: italic;
  margin: 0;
}

.unions-list {
  display: flex;
  flex-direction: column;
}

.union-add-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.union-alias-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.4rem;
  background: #2a3a4a;
  border-radius: 3px;
  color: #6ab0ff;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.union-alias-pill button {
  background: transparent;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 0;
  margin-left: 0.2rem;
  line-height: 1;
  font-size: 0.9rem;
}

.union-alias-pill button:hover {
  color: #888;
}

.union-add-input-with-pill {
  flex: 1;
}

.union-add-input {
  width: 100%;
  padding: 0.5rem 0;
  background: transparent;
  border: none;
  color: #e5e5e5;
  font-family: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.union-add-input:focus {
  outline: none;
}

.union-add-input::placeholder {
  color: #505050;
  font-style: italic;
}

.union-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #242424;
  border: 1px solid #333;
  border-top: none;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.union-autocomplete-item {
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #2a2a2a;
  transition: background-color 0.15s ease;
}

.union-autocomplete-item:last-child {
  border-bottom: none;
}

.union-autocomplete-item:hover,
.union-autocomplete-highlighted {
  background: #2a2a2a;
}

.union-autocomplete-name {
  display: block;
  color: #e5e5e5;
  font-size: 0.9rem;
  margin-bottom: 0.1rem;
}

.union-autocomplete-id,
.union-autocomplete-owner {
  display: block;
  font-size: 0.8rem;
  color: #555;
}

.union-autocomplete-external {
  background: #1f261f;
}

.union-autocomplete-external:hover,
.union-autocomplete-external.union-autocomplete-highlighted {
  background: #252d25;
}

.union-autocomplete-loading,
.union-autocomplete-empty {
  padding: 0.6rem 0.75rem;
  color: #555;
  font-size: 0.9rem;
  font-style: italic;
}

.union-item {
  padding: 0.75rem 0;
  position: relative;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.union-item-selected {
  opacity: 1;
}

.union-item-selected .union-item-name {
  color: #6ab0ff;
}

.union-item:not(.union-item-selected) {
  opacity: 0.6;
}

.union-item:not(.union-item-selected):hover {
  opacity: 0.8;
}

.union-item-name {
  display: block;
  color: #999;
  text-decoration: none;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.union-item-name:hover {
  color: #6ab0ff;
}

.union-owner {
  display: block;
  font-size: 0.85rem;
  color: #555;
  font-style: italic;
}

.union-description {
  font-size: 0.85rem;
  color: #555;
  margin: 0.25rem 0 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}

.union-remove-btn {
  position: absolute;
  top: 0.75rem;
  right: 0;
  background: transparent;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.union-item:hover .union-remove-btn {
  opacity: 1;
}

.union-remove-btn:hover {
  color: #dc3545;
}

/* Sidebar scrollbar */
.vertex-set-detail-sidebar::-webkit-scrollbar {
  width: 4px;
}

.vertex-set-detail-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.vertex-set-detail-sidebar::-webkit-scrollbar-thumb {
  background: #333;
}

.vertex-set-detail-sidebar::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/* Responsive: tablet screens */
@media (max-width: 900px) {
  .vertex-set-detail-top {
    grid-template-columns: 1fr;
  }

  .vertex-set-detail-sidebar {
    max-height: none;
  }
}

/* Responsive: mobile screens */
@media (max-width: 600px) {
  html {
    font-size: 14px;
  }

  .container {
    padding: 20px 16px;
  }

  header {
    flex-wrap: wrap;
    gap: 12px;
  }

  header h1 {
    font-size: 24px;
  }

  #searchInput {
    width: 100%;
    order: 10;
    font-size: 1rem;
    padding: 12px 14px;
  }

  .stats {
    flex-wrap: wrap;
    gap: 8px;
    font-size: 1rem;
  }

  a.vertex-url {
    font-size: 1.3rem;
  }

  .vertex-card {
    padding: 1rem 0;
  }

  .vertex-marginnote {
    margin-left: 0.5rem;
  }

  .vertex-note {
    font-size: 1rem;
  }

  .vertex-meta {
    font-size: 0.85rem;
  }

  /* Authority grid */
  .authority-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }

  /* Archive viewer */
  .archive-viewer-header h2 {
    font-size: 1rem;
    word-break: break-all;
  }

  .archive-viewer-meta {
    font-size: 0.9rem;
  }

  /* Graph edges */
  .graph-edge-card {
    flex: 0 0 180px;
    min-width: 180px;
    max-width: 180px;
  }

  .graph-edge-card-image {
    height: 100px;
  }

  /* Set detail */
  .vertex-set-detail-name {
    font-size: 1.4rem;
  }

  .vertex-set-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

  /* Help modal */
  .help-modal {
    max-width: calc(100vw - 32px);
    padding: 1rem 1.25rem;
  }

  /* Unions panel */
  .unions-panel {
    padding: 1rem;
  }

  /* Archive fullscreen overlay */
  .archive-overlay-corner {
    width: 40px;
    height: 40px;
    border-width: 4px;
  }

  .archive-overlay-center {
    width: 14px;
    height: 14px;
  }

  .archive-overlay-date {
    font-size: 16px;
    bottom: 16px;
    right: 16px;
  }

  /* Archive fullscreen bar */
  .archive-fullscreen-bar {
    gap: 8px;
  }

  .archive-fullscreen-label {
    font-size: 9px;
  }

  .archive-fullscreen-date {
    font-size: 11px;
  }
}

/* ===== Help Modal ===== */
.help-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.help-modal {
  background: #2a2a2a;
  border: 1px solid #444;
  padding: 1.5rem 2rem;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.help-modal h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  color: #fff;
}

.help-modal-description {
  margin: 0 0 1.25rem 0;
  color: #aaa;
  font-size: 0.95rem;
  line-height: 1.5;
}

.help-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.help-modal-close:hover {
  color: #fff;
}

.help-content {
  width: 100%;
}

.help-content section {
  margin-bottom: 1.25rem;
  width: 100%;
}

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

.help-content h3 {
  font-size: 0.95rem;
  color: #ccc;
  margin: 0 0 0.4rem 0;
  font-weight: 600;
  width: 100%;
}

.help-content p {
  margin: 0 0 0.5rem 0;
  color: #999;
  font-size: 0.9rem;
  line-height: 1.5;
  width: 100%;
  max-width: none;
}

.help-content p:last-child {
  margin-bottom: 0;
}

.help-content dl {
  margin: 0;
  width: 100%;
}

.help-content dt {
  color: #bbb;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 0.5rem;
}

.help-content dt:first-child {
  margin-top: 0;
}

.help-content dd {
  margin: 0.15rem 0 0 0;
  color: #888;
  font-size: 0.85rem;
  line-height: 1.4;
}
