:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #6366f1;
  --accent-dim: #4f46e5;
  --success: #22c55e;
  --error: #ef4444;
  --hash: #818cf8;
  --border: #2a2a3a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

::selection {
  background: var(--accent);
  color: white;
}

body {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 3rem;
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: 0.4em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@media (max-width: 768px) {
  header h1 {
    font-size: 1.8rem;
    letter-spacing: 0.2em;
  }
}

.tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
}

section {
  margin-bottom: 1.5rem;
}

.input-section label {
  display: block;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-group input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  border-radius: 4px;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent);
}

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

button {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

button:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

button.loading {
  position: relative;
  color: transparent;
}

button.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.example-manifests {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.example-manifests span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.example-btn {
  padding: 0.35rem 0.75rem;
  background: var(--bg-tertiary);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.example-btn:hover {
  background: var(--border);
}

h2,
h3 {
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

.canvases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}

.canvas-item {
  cursor: pointer;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  transition: all 0.2s ease;
}

.canvas-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.canvas-item.selected {
  border-color: var(--accent);
  background: var(--bg-tertiary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.canvas-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--bg-tertiary);
}

.canvas-label {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.enrichment-section {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.enrichment-section h3 {
  margin-bottom: 1rem;
}

.enrichment-section h3 span {
  color: var(--accent);
}

.enrichment-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-group label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

select {
  padding: 0.5rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: 4px;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--accent);
}

.activity-section {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.activity-log {
  font-size: 0.85rem;
  max-height: 300px;
  overflow-y: auto;
}

.log-entry {
  padding: 0.35rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.log-icon {
  flex-shrink: 0;
  width: 1em;
}

.log-pending {
  color: var(--text-secondary);
}

.log-pending .log-icon {
  color: var(--accent);
  animation: pulse 1s infinite;
}

.log-success {
  color: var(--text-primary);
}

.log-success .log-icon {
  color: var(--success);
}

.log-error {
  color: var(--error);
}

.log-hash {
  color: var(--hash);
  font-size: 0.8rem;
  padding-left: 1.5rem;
}

.log-content {
  color: var(--text-secondary);
  font-style: italic;
  padding-left: 1.5rem;
}

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

.preservation-notice {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.1) 0%,
    rgba(168, 85, 247, 0.1) 100%
  );
  border: 1px solid var(--accent);
  padding: 1.5rem;
  border-radius: 4px;
  text-align: center;
}

.preservation-notice p {
  color: var(--text-primary);
  font-size: 1rem;
}

.preservation-notice .subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.existing-section {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.existing-enrichments {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.enrichment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 4px;
}

.enrichment-info {
  font-size: 0.85rem;
}

.enrichment-info .hash {
  color: var(--hash);
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.enrichment-item button {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.enrichment-item button:hover {
  background: var(--border);
}

footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

footer p {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.9rem;
}

footer .footer-sub {
  color: var(--text-muted);
  font-style: normal;
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.hidden {
  display: none !important;
}

.no-canvases {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}

/* Commons Explorer */
.commons-section {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-top: 2rem;
}

.commons-description {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.explore-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.explore-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.commons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.commons-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.commons-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.card-kind {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
}

.card-lang {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
}

.card-label {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-hash {
  font-size: 0.7rem;
  color: var(--hash);
  font-family: monospace;
}

.card-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.loading,
.empty-commons,
.error {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.error {
  color: var(--error);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

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

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.25s ease;
}

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

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  width: 32px;
  height: 32px;
  padding: 0;
  cursor: pointer;
  z-index: 10;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--border);
  transform: none;
}

.detail-view {
  padding: 2rem;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.detail-header h2 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin: 0;
}

.detail-lang {
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.detail-meta {
  background: var(--bg-tertiary);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

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

.meta-label {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.meta-value {
  color: var(--text-primary);
  font-size: 0.8rem;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

.meta-value.hash {
  color: var(--hash);
  font-family: monospace;
}

.detail-content {
  margin-bottom: 1.5rem;
}

.detail-content h4,
.detail-share h4,
.detail-provenance h4 {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
}

.content-box {
  background: var(--bg-tertiary);
  border-radius: 4px;
  padding: 1rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.detail-share {
  margin-bottom: 1.5rem;
}

.share-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.permalink-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--hash);
  font-family: monospace;
  font-size: 0.75rem;
  border-radius: 4px;
}

.share-row button {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

.share-buttons {
  display: flex;
  gap: 0.5rem;
}

.share-buttons button {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.share-buttons button:hover {
  background: var(--border);
  color: var(--text-primary);
}

.detail-provenance {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.provenance-json {
  background: var(--bg-tertiary);
  border-radius: 4px;
  padding: 1rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
}

/* Collections Browser */
.collections-section {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-top: 2rem;
}

.collections-description {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.collection-sources {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.source-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.source-badge.configured {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
}

.source-badge.unconfigured {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.source-name {
  font-weight: 500;
}

.source-status {
  font-size: 0.7rem;
}

.no-sources {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1rem 0;
}

.collection-search {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.collection-search select {
  min-width: 200px;
}

.collection-search input {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: 4px;
}

.collection-search input:focus {
  outline: none;
  border-color: var(--accent);
}

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

.collection-results {
  margin-top: 1.5rem;
}

.results-count {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.result-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.result-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
}

.result-image {
  width: 100%;
  height: 120px;
  overflow: hidden;
  background: var(--bg-primary);
}

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

.result-info {
  padding: 0.75rem;
}

.result-title {
  font-size: 0.8rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.result-creator {
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.empty-results {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}

.item-image {
  margin-bottom: 1.5rem;
  border-radius: 4px;
  overflow: hidden;
}

.item-image img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: var(--bg-tertiary);
}

.detail-actions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.detail-actions h4 {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
}

.detail-actions button,
.action-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  text-decoration: none;
}

.action-link {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 4px;
}

.action-link:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* Commons Tabs */
.commons-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
}

.tab-btn:hover {
  background: var(--border);
}

.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.commons-tab {
  margin-top: 0.5rem;
}

/* Audio Controls */
.audio-controls {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.play-btn {
  flex: 1;
  background: var(--success);
  font-size: 1rem;
}

.play-btn:hover {
  background: #16a34a;
}

.stop-btn {
  background: var(--error);
}

.stop-btn:hover {
  background: #dc2626;
}

/* Session Commons */
.session-commons {
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.session-commons h3 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.session-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.session-tab {
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 6px;
}

.session-tab:hover {
  background: var(--border);
  transform: none;
}

.session-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.session-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.session-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.item-type {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
}

.item-hash {
  font-size: 0.65rem;
  color: var(--hash);
  word-break: break-all;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: var(--bg-primary);
  border-radius: 4px;
}

.item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.item-meta .meta-label {
  color: var(--text-muted);
}

.item-meta .meta-value {
  color: var(--text-secondary);
}

.item-meta .meta-value.hash {
  color: var(--hash);
  font-size: 0.65rem;
}

.ipfs-notice {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}

.ipfs-notice strong {
  color: var(--accent);
  display: block;
  margin-bottom: 0.5rem;
}

.ipfs-notice p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.full-hash {
  font-size: 0.7rem;
  word-break: break-all;
}

.clickable-hash {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  transition: color 0.2s ease;
}

.clickable-hash:hover {
  color: var(--accent);
  text-decoration-style: solid;
}

.error-notice {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.error-notice p {
  margin: 0.5rem 0;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* ========================================
   MOBILE NAVIGATION & TAB SYSTEM
   ======================================== */

.mobile-nav {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-secondary);
  padding: 0.25rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  position: sticky;
  top: 0.5rem;
  z-index: 100;
}

.nav-tab {
  flex: 1;
  padding: 0.75rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  transform: none;
}

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

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* ========================================
   MANIFEST INFO PANEL
   ======================================== */

.manifest-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.manifest-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.manifest-header h2 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.manifest-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.meta-badge {
  padding: 0.25rem 0.6rem;
  background: var(--bg-tertiary);
  border-radius: 20px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.manifest-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.manifest-details .detail-row {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  align-items: baseline;
}

.manifest-details .label {
  color: var(--text-muted);
  min-width: 90px;
  flex-shrink: 0;
}

.manifest-details .value {
  color: var(--text-secondary);
  word-break: break-all;
}

.manifest-details .value.hash {
  color: var(--hash);
  font-size: 0.75rem;
}

.manifest-details .value.clickable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.manifest-details .value.clickable:hover {
  color: var(--accent);
}

.manifest-details .value.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.manifest-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.btn-secondary:hover {
  background: var(--border);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ========================================
   COLLECTIONS SECTION
   ======================================== */

.collections-section {
  padding: 0;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.collection-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.source-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
}

.source-badge.configured {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.source-badge.configured .source-status {
  color: var(--success);
}

.source-badge.unconfigured {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}

.source-badge.unconfigured .source-status {
  color: var(--text-muted);
  font-size: 0.65rem;
}

.source-name {
  color: var(--text-secondary);
}

.collection-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.collection-search select {
  flex: 0 0 auto;
  min-width: 160px;
}

.collection-search input {
  flex: 1;
  min-width: 150px;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  border-radius: 6px;
}

.collection-search input:focus {
  outline: none;
  border-color: var(--accent);
}

.collection-search button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.collection-search .btn-icon {
  display: none;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.results-count {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.btn-clear {
  padding: 0.4rem 0.8rem;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.result-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.result-image {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-tertiary);
}

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

.result-info {
  padding: 0.75rem;
}

.result-title {
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-creator {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
}

.result-date {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.collection-empty,
.commons-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-hint {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  color: var(--text-muted);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.85rem;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .container {
    padding: 0.75rem;
  }

  header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
  }

  header h1 {
    font-size: 1.5rem;
    letter-spacing: 0.15em;
  }

  .tagline {
    font-size: 0.75rem;
  }

  .mobile-nav {
    position: sticky;
    top: 0;
    margin: -0.75rem -0.75rem 1rem;
    border-radius: 0;
    padding: 0.5rem;
  }

  .nav-tab {
    padding: 0.6rem 0.25rem;
    font-size: 0.7rem;
  }

  .input-group {
    flex-direction: column;
  }

  .input-group input,
  .input-group button {
    width: 100%;
  }

  .example-manifests {
    justify-content: center;
  }

  .example-btn {
    font-size: 0.65rem;
    padding: 0.3rem 0.5rem;
  }

  .manifest-header {
    flex-direction: column;
  }

  .manifest-header h2 {
    font-size: 1rem;
  }

  .manifest-details .detail-row {
    flex-direction: column;
    gap: 0.15rem;
  }

  .manifest-details .label {
    min-width: auto;
  }

  .manifest-details .value.truncate {
    max-width: 100%;
  }

  .canvases-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
  }

  .canvas-item img {
    height: 80px;
  }

  .canvas-label {
    font-size: 0.65rem;
  }

  .enrichment-section {
    padding: 1rem;
  }

  .enrichment-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .control-group {
    width: 100%;
  }

  .control-group select {
    flex: 1;
  }

  #enrich-btn {
    width: 100%;
    margin-top: 0.5rem;
  }

  .collection-search {
    flex-direction: column;
  }

  .collection-search select,
  .collection-search input,
  .collection-search button {
    width: 100%;
  }

  .collection-search .btn-text {
    display: none;
  }

  .collection-search .btn-icon {
    display: inline;
  }

  .results-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .result-info {
    padding: 0.5rem;
  }

  .result-title {
    font-size: 0.7rem;
  }

  .modal-content {
    margin: 0;
    max-height: 100vh;
    border-radius: 0;
    width: 100%;
  }

  .detail-view {
    padding: 1rem;
  }

  .detail-header h2 {
    font-size: 1.1rem;
  }

  .provenance-json {
    font-size: 0.65rem;
  }

  .session-grid {
    grid-template-columns: 1fr;
  }

  footer {
    padding: 1.5rem 0;
  }

  footer p {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .mobile-nav {
    gap: 0.15rem;
  }

  .nav-tab {
    font-size: 0.65rem;
    padding: 0.5rem 0.2rem;
  }

  .results-grid {
    grid-template-columns: 1fr 1fr;
  }

  .source-badge {
    font-size: 0.65rem;
    padding: 0.35rem 0.5rem;
  }
}
