/* Graxeon Explorer — base styles */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg:           #0f0f17;
  --surface:      #1a1a28;
  --surface-2:    #22223a;
  --border:       #2e2e4a;
  --text:         #e0e0f0;
  --text-muted:   #9898b8;
  --accent:       #1d9e75;
  --accent-hover: #17845f;
  --error:        #e05c5c;
  --radius:       10px;
  --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --icon-border:  #fff;
}

/* ── Light theme ─────────────────────────────────────────────────────────────── */

[data-theme="light"] {
  --bg:           #f4f4f8;
  --surface:      #ffffff;
  --surface-2:    #ebebf2;
  --border:       #d0d0e0;
  --text:         #1a1a2e;
  --text-muted:   #6060a0;
  --icon-border:  #000;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

/* ── Topbar ─────────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  letter-spacing: normal;
  text-decoration: none;
}

.topbar__brand-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar__user {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.topbar__user--link {
  cursor: pointer;
}
.topbar__user--link:hover { color: var(--text); }

/* ── User avatar ─────────────────────────────────────────────────────────────── */

.user-avatar-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-avatar--initials {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar--img {
  object-fit: cover;
  display: block;
}

.topbar__search {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 16px;
}

/* ── Search bar ─────────────────────────────────────────────────────────────── */

.search-bar {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 380px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.search-bar:focus-within {
  border-color: var(--accent);
}

.search-bar__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 6px 12px;
  font-size: 0.875rem;
  color: var(--text);
}

.search-bar__input::placeholder {
  color: var(--text-muted);
}

.search-bar__btn {
  background: transparent;
  border: none;
  padding: 0 10px;
  height: 32px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
}

.search-bar__btn:hover {
  color: var(--accent);
}

/* ── Search results panel ───────────────────────────────────────────────────── */

.search-panel {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  height: 50vh;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.search-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-panel__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.search-panel__close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.search-panel__close:hover {
  color: var(--text);
  background: var(--surface-2);
}

.search-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
}

/* ── Main ───────────────────────────────────────────────────────────────────── */

.main {
  padding: 32px 0;
}

.main > .cards-grid {
  padding: 0 24px;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-hover); }

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn--ghost:hover { border-color: var(--text-muted); color: var(--text); }

.btn--full { width: 100%; }

.btn--danger {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}
.btn--danger:hover { background: #c04040; border-color: #c04040; }

/* ── Auth card ──────────────────────────────────────────────────────────────── */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.auth-card__title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.auth-card__sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ── Form ───────────────────────────────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 18px; }

.form__field { display: flex; flex-direction: column; gap: 6px; }

.form__field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form__field input, .form__field select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.form__field input:focus, .form__field select:focus { border-color: var(--accent); }
.form__field input::placeholder { color: var(--text-muted); }

/* ── Alerts ─────────────────────────────────────────────────────────────────── */

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 16px;
}
.alert--error { background: rgba(224,92,92,0.12); border: 1px solid var(--error); color: var(--error); }

/* ── Page header ────────────────────────────────────────────────────────────── */

.page-header {
  margin-bottom: 24px;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}
.page-header__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Collection grid ────────────────────────────────────────────────────────── */

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.collection-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.1s;
}
.collection-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.collection-card__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-card__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.collection-card__meta {
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Empty state ────────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.empty-state__hint {
  font-size: 0.875rem;
  margin-top: 8px;
}

/* ── Collection header ──────────────────────────────────────────────────────── */

.coll-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}
.coll-header__left { display: flex; flex-direction: column; gap: 4px; }

.back-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
}
.back-link:hover { color: var(--accent); }

.coll-header__title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.coll-header__desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.coll-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.node-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Views bar ──────────────────────────────────────────────────────────────── */

.views-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
  flex-wrap: wrap;
}

.view-pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.view-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.82rem;
  cursor: default;
  transition: border-color 0.15s;
}
.view-pill--active {
  border-color: var(--accent);
  color: var(--accent);
}
.view-pill__name { cursor: pointer; }
.view-pill__name:hover { color: var(--accent); }

.view-pill__edit {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0 0 0 4px;
  line-height: 1;
}
.view-pill__edit:hover { color: var(--accent); }

.view-pill__remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0 0 0 2px;
  line-height: 1;
}
.view-pill__remove:hover { color: var(--error); }

.btn--sm { padding: 5px 12px; font-size: 0.8rem; }

/* ── Cards grid ─────────────────────────────────────────────────────────────── */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Grid (sheet) view ─────────────────────────────────────────────────────── */

.sheet-container { overflow-x: auto; }

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.sheet-th {
  text-align: left;
  padding: 8px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.sheet-th:last-child { border-right: none; }
.sheet-th__name { font-weight: 600; }
.sheet-th__type {
  display: block;
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: lowercase;
}

.sheet-td {
  padding: 0;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: middle;
  max-width: 260px;
}
.sheet-td:last-child { border-right: none; }
.sheet-table tbody tr:last-child .sheet-td { border-bottom: none; }
.sheet-td--center { text-align: center; }
.sheet-td--number { text-align: right; }

.sheet-cell {
  padding: 7px 12px;
  min-height: 1.4em;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet-cell:focus {
  white-space: normal;
  overflow: visible;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.sheet-cell-link {
  display: block;
  padding: 7px 12px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet-cell-link:hover { color: var(--accent); text-decoration: underline; }

.sheet-cell-bool { display: inline-block; padding: 7px 12px; cursor: pointer; }

.sheet-cell-select, .sheet-cell-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 7px 12px;
  font: inherit;
  outline: none;
}
.sheet-cell-select:focus, .sheet-cell-input:focus { box-shadow: inset 0 0 0 2px var(--accent); }

.sheet-cell-currency-code {
  padding-left: 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.sheet-cell-asset {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.sheet-cell-asset:hover { color: var(--accent); }
.sheet-cell-asset--empty { color: var(--text-muted); }

.sheet-td--image { padding: 0; height: 48px; }

.sheet-cell-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  overflow: hidden;
  background: var(--surface-2);
}
.sheet-cell-image:hover { opacity: .85; }
.sheet-cell-image--empty {
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
}
.sheet-cell-image--empty:hover { opacity: 1; background: var(--surface-2); }
.sheet-cell-image__img {
  width: 100%;
  height: 48px;
  object-fit: cover;
  display: block;
}

.sheet-th--check, .sheet-td--check {
  width: 36px;
  text-align: center;
  padding-left: 0;
  padding-right: 0;
}
.sheet-th--check input, .sheet-td--check input { accent-color: var(--accent); cursor: pointer; }

.sheet-bulk-toolbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 10px 8px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 100;
}

.sheet-bulk-toolbar__count {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-right: 4px;
  white-space: nowrap;
}

.sheet-bulk-toolbar__danger { color: var(--error); border-color: var(--error); }
.sheet-bulk-toolbar__danger:hover { background: var(--error); color: #fff; }

.sheet-bulk-toolbar__clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 6px;
  line-height: 1;
}
.sheet-bulk-toolbar__clear:hover { color: var(--text); }

/* ── Node card ──────────────────────────────────────────────────────────────── */

.node-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, transform 0.1s;
}
.node-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.node-card__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.node-card__name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.node-card__types { display: flex; gap: 4px; flex-wrap: wrap; }

.type-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(29,158,117,0.12);
  border: 1px solid rgba(29,158,117,0.3);
  border-radius: 4px;
  padding: 1px 6px;
}

.node-card__fields { display: flex; flex-direction: column; gap: 4px; }

.card-field {
  display: flex;
  gap: 6px;
  font-size: 0.8rem;
  align-items: baseline;
}
.card-field__key {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  min-width: 50px;
}
.card-field__val {
  color: var(--text);
  word-break: break-word;
}

.card-body {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.node-card__tags { display: flex; gap: 5px; flex-wrap: wrap; }

.card-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.node-card__source {
  font-size: 0.68rem;
  color: var(--border);
  font-family: "SF Mono", "Consolas", monospace;
  margin-top: auto;
  word-break: break-all;
}

/* ── Tag group card — compact pill cluster for name-only nodes ──────────────── */

.tag-group-card {
  padding: 12px;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  align-self: start;
}

.tag-chip {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.tag-chip:hover {
  border-color: var(--accent);
  background: rgba(29,158,117,0.08);
  color: var(--accent);
}

/* ── Item page (Monaco + preview) ───────────────────────────────────────────── */

.item-page {
  position: relative;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px);  /* 52px = topbar height */
  overflow: hidden;
}

.item-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.item-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

.item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.item-header__title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.item-header__right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.item-header__meta {
  display: flex;
  gap: 6px;
  align-items: center;
}

.item-body {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 1px;
  background: var(--border);
}

.item-editor-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 0;
}

.item-editor-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 0;
}

@media (max-width: 800px) {
  .item-editor-right { display: none; }
}

.item-body--readonly .item-editor-left { display: none; }

/* ── Image item view ─────────────────────────────────────────────────────────── */

.item-image-view {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 1px;
  background: var(--border);
}

.item-image-media {
  flex: 1;
  min-width: 0;
  background: #000;
  overflow: hidden;
}

.item-image-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.item-image-placeholder {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.item-image-props {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.item-props-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  min-height: 36px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.item-props-toolbar__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.item-props-toolbar__actions { display: flex; gap: 4px; }

.item-props-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

.item-text-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.item-prop-value--muted {
  color: var(--text-muted);
  font-style: italic;
}

.item-prop-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 3px 0;
  outline: none;
  flex: 1;
  min-width: 0;
  transition: border-color 0.12s;
}
.item-prop-input:focus {
  border-bottom-color: var(--accent);
}
select.item-prop-input {
  background: transparent;
  cursor: pointer;
}

.preview-props-toggle {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 4px;
  line-height: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.preview-props-toggle:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.preview-props-toggle--active { color: var(--accent); border-color: var(--border); }

.item-prop {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.item-prop:last-child {
  border-bottom: none;
}

.item-prop-label {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  background: none;
  padding: 0;
  border: none;
  display: block;
  white-space: nowrap;
  line-height: 1;
}

.item-prop-value {
  font-size: 13px;
  color: var(--text);
  padding: 2px 0;
  flex: 1;
  word-break: break-word;
  line-height: 1.5;
  min-width: 0;
}

.item-prop-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px 8px;
  flex: 1;
  align-content: flex-start;
}

.item-prop-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  border: 1px solid var(--border);
}

.item-props-empty {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}

.item-prop-textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  padding: 3px 0;
  resize: vertical;
  outline: none;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  min-height: 72px;
  transition: border-color 0.12s;
}
.item-prop-textarea:focus {
  border-bottom-color: var(--accent);
}

.save-status {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 60px;
  text-align: right;
}

@media (max-width: 768px) {
  .item-image-view {
    flex-direction: column;
  }

  .item-image-media {
    flex: none;
    height: 50vh;
  }

  .item-image-props {
    width: 100%;
    max-height: 50vh;
  }
  .item-image-props .item-props-content {
    overflow-y: auto;
  }
}

/* ── Video item view ─────────────────────────────────────────────────────────── */

.item-video-view {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 1px;
  background: var(--border);
}

.item-video-media {
  flex: 1;
  min-width: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.item-video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 768px) {
  .item-video-view {
    flex-direction: column;
  }

  .item-video-media {
    flex: none;
    height: 50vh;
  }
}

/* ── PDF item view ───────────────────────────────────────────────────────────── */

.item-pdf-view {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 1px;
  background: var(--border);
}

.item-pdf-media {
  flex: 1;
  min-width: 0;
  background: #525659;
  overflow: hidden;
}

.item-pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

@media (max-width: 768px) {
  .item-pdf-view {
    flex-direction: column;
  }

  .item-pdf-media {
    flex: none;
    height: 50vh;
  }
}

/* ── Image scroll mode — related items below fold ────────────────────────────── */

.item-page--image-scroll {
  height: auto;
  overflow: visible;
}

.item-page--image-scroll .item-image-view,
.item-page--image-scroll .item-video-view,
.item-page--image-scroll .item-pdf-view,
.item-page--image-scroll .item-body {
  flex: none;
  height: calc(100vh - 154px); /* topbar 52px + item-header ~52px + 50px peek */
}

/* ── Related items section ───────────────────────────────────────────────────── */

.item-related {
  padding: 32px 24px 48px;
  border-top: 1px solid var(--border);
}

.item-related-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.item-related-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.item-related-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Toolbar */
.markdown-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  min-height: 36px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.md-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-width: 28px;
  min-height: 28px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
}

.md-btn:hover  { background: var(--surface-2); color: var(--text); }
.md-btn.active { background: var(--accent); color: #fff; }
.md-btn.active:hover { background: var(--accent-hover); }

.md-separator {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Monaco container */
.monaco-container {
  flex: 1;
  min-height: 0;
}

/* Preview panel */
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  min-height: 36px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.preview-toolbar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.story-preview-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--surface);
  min-height: 0;
}

.story-preview-content {
  max-width: 760px;
  margin: 0 auto;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.story-preview-content.is-visible { opacity: 1; }

/* Markdown content styles */
.story-preview-content h1,
.story-preview-content h2,
.story-preview-content h3 {
  color: var(--text);
  margin: 24px 0 12px;
  line-height: 1.3;
}

.story-preview-content h1 {
  font-size: 1.7rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.story-preview-content h2 { font-size: 1.35rem; }
.story-preview-content h3 { font-size: 1.1rem; }

.story-preview-content p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 16px;
}

.story-preview-content strong { color: var(--text); font-weight: 600; }
.story-preview-content em    { font-style: italic; }
.story-preview-content del   { opacity: 0.6; }

.story-preview-content a {
  color: var(--accent);
  text-decoration: none;
}
.story-preview-content a:hover { text-decoration: underline; }

.story-preview-content code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 0.85em;
  color: var(--text);
}

.story-preview-content pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  margin: 0;
}

.story-preview-content pre code {
  background: none;
  padding: 16px;
  font-size: 0.82rem;
  display: block;
}

.code-block-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.copy-code-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.code-block-wrapper:hover .copy-code-button { opacity: 1; }
.copy-code-button:hover { color: var(--text); background: var(--surface-2); }

.story-preview-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin-left: 0;
  color: var(--text-muted);
  font-style: italic;
}

.story-preview-content ul, .story-preview-content ol {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 16px;
  padding-left: 24px;
}

.story-preview-content ul { list-style: disc; }
.story-preview-content ol { list-style: decimal; }

.story-preview-content li  { margin-bottom: 6px; }
.story-preview-content ul ul { list-style: circle; margin-top: 6px; }

.story-preview-content .task-list-item {
  list-style: none;
  margin-left: -24px;
  padding-left: 24px;
}

.story-preview-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.story-preview-content th,
.story-preview-content td {
  padding: 8px 12px;
  text-align: left;
  border: 1px solid var(--border);
}

.story-preview-content th {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.story-preview-content td { color: var(--text-muted); }
.story-preview-content tr:hover td { background: var(--surface-2); }

.story-preview-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 16px 0;
  border: 1px solid var(--border);
  display: block;
}

.story-preview-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ── Image card ─────────────────────────────────────────────────────────────── */

.image-card {
  padding: 0;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.image-card__fill {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-card--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
}

.image-card__empty {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Video card ─────────────────────────────────────────────────────────────── */

.video-card {
  padding: 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  position: relative;
}

.video-card__fill {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-card__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.6rem;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.video-card:hover .video-card__play { opacity: 1; }

.video-card--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
}

.video-card__empty {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Text card ──────────────────────────────────────────────────────────────── */

.text-card {
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.text-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.text-card__summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.pdf-card__icon {
  font-size: 2rem;
  line-height: 1;
}

.pdf-card--empty .pdf-card__icon { opacity: 0.4; }

/* ── Modal ──────────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 50vw;
  height: 50vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.confirm-modal {
  width: 360px;
  height: auto;
}
.confirm-modal__body {
  padding: 18px 24px 8px;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
  margin: 0;
}

/* ── Tabs ───────────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  flex-shrink: 0;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn--active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tab-panel[hidden] { display: none; }

.tab-body,
.modal-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 20px 24px;
}
.tab-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

/* ── Info list (dl) ─────────────────────────────────────────────────────────── */

.info-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 0.875rem;
}
.info-list dt {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 1px;
}
.info-list dd { color: var(--text); word-break: break-all; }

.muted-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ── Checkboxes / radio ─────────────────────────────────────────────────────── */

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.checkbox-list--compact { gap: 5px; max-height: 160px; }

.checkbox-label, .radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
}
.checkbox-label input, .radio-label input { accent-color: var(--accent); }

.radio-group { display: flex; flex-direction: column; gap: 8px; }

/* ── Card mapping (settings Cards tab) ─────────────────────────────────────── */

.card-mapping-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.card-mapping-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.875rem;
}

.card-mapping-row__type {
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-mapping-row__select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.card-mapping-row__select:focus { outline: none; border-color: var(--accent); }

/* ── Profile modal extras ────────────────────────────────────────────────────── */

.prof-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.prof-section-label { margin-top: 20px; margin-bottom: 10px; }

.save-msg { font-size: 0.82rem; }
.save-msg--ok    { color: var(--accent); }
.save-msg--error { color: var(--error); }

.required-star { color: var(--error); margin-left: 2px; }

/* ── Settings rows (appearance tab) ─────────────────────────────────────────── */

.settings-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
}
.settings-row + .settings-row {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.settings-row-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}
.settings-row-title { font-size: 13px; color: var(--text); font-weight: 500; }
.settings-row-hint  { font-size: 11px; color: var(--text-muted); }

.settings-theme-options { display: flex; gap: 6px; flex-shrink: 0; }
.settings-theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  min-width: 60px;
  transition: border-color 0.1s;
}
.settings-theme-card input[type=radio] { display: none; }
.settings-theme-card:hover { border-color: var(--text-muted); }
.settings-theme-card.active { border-color: var(--accent); background: var(--surface-2); }
.settings-theme-icon { font-size: 18px; line-height: 1; }
.settings-theme-label { font-size: 11px; color: var(--text-muted); }
.settings-theme-card.active .settings-theme-label { color: var(--accent); font-weight: 500; }

.settings-accent-row { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.settings-color-input {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}
.settings-color-input:hover { border-color: var(--text-muted); }
.settings-color-value { font-size: 11px; color: var(--text-muted); font-family: 'Consolas', 'Monaco', monospace; }

/* ── Cypher textarea ────────────────────────────────────────────────────────── */

.cypher-input {
  width: 100%;
  min-height: 90px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 0.82rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.cypher-input:focus { border-color: var(--accent); }

/* ── Dashboard section headers ─────────────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.section-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Role badge ──────────────────────────────────────────────────────────────── */

.role-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
  padding: 2px 7px;
}
.role-badge--admin { background: rgba(29,158,117,0.15); color: var(--accent); border: 1px solid rgba(29,158,117,0.3); }
.role-badge--edit  { background: rgba(100,100,200,0.12); color: #8888cc; border: 1px solid rgba(100,100,200,0.25); }
.role-badge--view  { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Member list ─────────────────────────────────────────────────────────────── */

.member-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.member-row__info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.member-row__name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-row__email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.member-row__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.billing-summary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.billing-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  font-size: 0.9rem;
}

.billing-summary__row--total {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 12px;
  font-weight: 700;
  color: var(--text);
}

.billing-summary__label { color: var(--text-muted); }

/* ── New File wizard ─────────────────────────────────────────────────────────── */

.wizard-modal {
  width: 64vw;
  height: 72vh;
  max-width: 880px;
  min-width: 560px;
}

.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.wizard-step__num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: border-color .15s, background .15s, color .15s;
}
.wizard-step__label { font-size: 0.82rem; font-weight: 500; }
.wizard-step__sep { width: 28px; height: 1px; background: var(--border); }
.wizard-step--active { color: var(--text); }
.wizard-step--active .wizard-step__num { border-color: var(--accent); color: var(--accent); }
.wizard-step--done .wizard-step__num { background: var(--accent); border-color: var(--accent); color: #fff; }
.wizard-step--done { color: var(--text); }

.wizard-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wizard-panel[hidden] { display: none; }

.wizard-search {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wizard-search__input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.wizard-search__input:focus { border-color: var(--accent); }
.wizard-search__input::placeholder { color: var(--text-muted); }

.wizard-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.wizard-sidebar {
  width: 160px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.wizard-category-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}
.wizard-category-btn:hover { background: var(--surface-2); color: var(--text); }
.wizard-category-btn--active { background: var(--surface-2); color: var(--accent); font-weight: 600; }
.wizard-category-btn__count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 10px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.wizard-types {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  align-content: start;
}
.wizard-types__empty {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 30px 10px;
}

.wizard-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.wizard-type-card:hover { border-color: var(--text-muted); }
.wizard-type-card--active { border-color: var(--accent); background: rgba(29,158,117,.08); }

.wizard-type-card__icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.wizard-type-card__icon--media    { background: rgba(124,147,255,.16); color: #7c93ff; }
.wizard-type-card__icon--document { background: rgba(224,163,86,.16);  color: #e0a356; }
.wizard-type-card__icon--data     { background: rgba(29,158,117,.16); color: var(--accent); }

.wizard-type-card__name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.wizard-footer-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}
.wizard-footer-file__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  flex-shrink: 0;
}
.wizard-footer-file__select {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 5px 8px;
}
.wizard-footer-file__select:disabled { color: var(--text-muted); cursor: default; }

.wizard-footer-spacer { flex: 1; }

/* ── Asset drop zone (new item modal) ───────────────────────────────────────── */
.asset-drop {
  width: 100%;
  min-height: 90px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--surface-2);
  box-sizing: border-box;
  text-align: center;
}
.asset-drop:hover,
.asset-drop--over {
  border-color: var(--accent);
  background: rgba(29,158,117,.06);
}
.asset-drop__icon  { font-size: 22px; color: var(--text-muted); }
.asset-drop__text  { font-size: 12px; color: var(--text); font-weight: 500; }
.asset-drop__hint  { font-size: 11px; color: var(--text-muted); }
.asset-drop__selected {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.asset-drop__filename { font-size: 12px; color: var(--text-muted); word-break: break-all; }
.asset-thumb {
  max-width: 100%;
  max-height: 100px;
  border-radius: 4px;
  object-fit: contain;
  border: 1px solid var(--border);
}

/* ── Relationship step (new item modal, step 4) ─────────────────────────────── */
.wizard-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}
.wizard-direction {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wizard-direction__option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color .15s, background .15s;
}
.wizard-direction__option:hover { border-color: var(--text-muted); }
.wizard-direction__option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(29,158,117,.06);
}

/* ── Page-level drag-drop overlay (drag a file onto item/collection pages) ──── */
body.wiz-drop-active::after {
  content: 'Drop to create a new item';
  position: fixed;
  inset: 14px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--surface);
  opacity: 0.97;
  border: 3px dashed var(--accent);
  border-radius: 14px;
  pointer-events: none;
}

/* ── Button spinner ──────────────────────────────────────────────────────────── */
.btn-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  vertical-align: -3px;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
