/* Layout */
.dna-view { display: grid; gap: var(--space-lg); min-width: 0; }

.dna-grid { display: grid; gap: var(--space-lg); position: relative; }

.dna-panel, .dna-list { display: grid; gap: var(--space-md); }
.dna-panel { overflow: visible; padding: var(--space-lg); word-break: break-word; }
.dna-panel__header { align-items: center; display: flex; gap: var(--space-sm); justify-content: space-between; }
.dna-panel__header--start { align-items: flex-start; }
.dna-panel__header-row { align-items: center; display: flex; gap: var(--space-sm); }
.dna-panel__header-actions { align-items: center; display: flex; gap: var(--space-sm); }
.dna-panel__title { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.dna-panel__desc { color: var(--text-secondary); font-size: var(--text-sm); margin: 0; }

/* Document grid */
.dna-doc-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}

.dna-doc-card {
  background: var(--bg-card-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-md);
  position: relative;
}

.dna-doc-card__icon { font-size: var(--space-lg); }
.dna-doc-card__thumb { border-radius: var(--radius-sm); max-height: 6rem; object-fit: contain; width: 100%; }
.dna-doc-card__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dna-doc-card__meta { color: var(--text-secondary); font-size: var(--text-xs); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dna-doc-card__delete { position: absolute; right: var(--space-xs); top: var(--space-xs); }

.dna-doc-card--add {
  align-items: center;
  aspect-ratio: 1;
  border-style: dashed;
  cursor: pointer;
  justify-content: center;
  transition: background var(--transition-fast);
}

.dna-doc-card--add:hover { background: var(--bg-hover); }
.dna-doc-card__plus { font-size: var(--text-xl); line-height: 1; }
.dna-doc-card__label { color: var(--text-secondary); font-size: var(--text-sm); }

/* Import dropzone inside modal */
.dna-import-dropzone {
  align-items: center;
  background: var(--bg-accent-soft);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  justify-content: center;
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  transition: background var(--transition-fast);
}

.dna-import-dropzone:hover { background: var(--bg-hover); }
.dna-import-dropzone__icon { font-size: var(--space-xl); }
.dna-import-dropzone__text { color: var(--text-secondary); font-size: var(--text-sm); }

/* ── Profile cards ── */

.dna-profiles-list {
  display: grid;
  gap: var(--space-sm);
}

.dna-profile-card {
  align-items: center;
  background: var(--bg-card-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  gap: var(--space-sm);
  justify-content: space-between;
  min-width: 0;
  overflow: hidden;
  padding: var(--space-sm) var(--space-md);
  transition: border-color var(--transition-fast);
  word-break: break-word;
}

.dna-profile-card:hover {
  border-color: var(--vibrance-hover);
}


.dna-profile-card__body {
  flex: 1;
  min-width: 0;
}

.dna-profile-card__header {
  align-items: center;
  display: flex;
  gap: var(--space-xs);
}

.dna-profile-card__name {
  font-size: var(--text-sm);
  font-weight: 600;
}

.dna-profile-card__badge {
  background: var(--bg-accent-soft);
  border-radius: var(--radius-pill);
  color: var(--vibrance-hover);
  font-size: var(--text-2xs);
  font-weight: 700;
  padding: var(--space-3xs) var(--space-xs);
  text-transform: uppercase;
  white-space: nowrap;
}

.dna-profile-card__preview {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-break: anywhere;
  margin: var(--space-2xs) 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dna-profile-card__actions {
  display: flex;
  flex-shrink: 0;
  gap: var(--space-2xs);
}

/* ── Profile editor (inside modal) ── */

.profile-editor {
  display: grid;
  gap: var(--space-md);
}

.profile-editor__field {
  display: grid;
  gap: var(--space-xs);
}

.profile-editor__textarea {
  min-height: 12rem;
  resize: vertical;
}

.profile-editor__imports {
  display: grid;
  gap: var(--space-sm);
}

.profile-editor__import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.profile-editor__import-btn {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  gap: var(--space-2xs);
  white-space: nowrap;
}

.profile-editor__import-btn svg {
  height: var(--icon-sm);
  width: var(--icon-sm);
}

.profile-editor__url-row {
  align-items: center;
  display: flex;
  flex: 1;
  gap: var(--space-xs);
  min-width: 16rem;
}

.profile-editor__url-input {
  flex: 1;
  min-width: 0;
}

@media (min-width: 860px) {
  .dna-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 859px) {
  .dna-panel__header { align-items: stretch; flex-direction: column; }
  .dna-profile-card { align-items: stretch; flex-direction: column; }
  .dna-profile-card__actions { justify-content: flex-end; }
  .profile-editor__import-actions { flex-direction: column; }
  .profile-editor__url-row { min-width: 0; }
}
