/* ═══════════════════════════════════════
   SCREEN: ORGANISM PROFILE
═══════════════════════════════════════ */
/* ═══════════════════════════════════════
   SCREEN: DATABASE GRID
═══════════════════════════════════════ */
.db-grid {
  width: 100%; max-width: 900px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-bottom: 64px;
}
.db-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: border-color 0.15s;
}
.db-card:hover { border-color: rgba(255,255,255,0.35); }
.db-card-art { height: 200px; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.db-card-body { padding: 14px 16px 16px; }
.db-card-name {
  font-family: var(--font-ui);
  font-size: 14px; line-height: 20px;
  color: var(--text-primary);
}

.profile {
  width: 600px;
  display: flex; flex-direction: column; gap: 28px;
  padding-bottom: 64px;
}

.profile-title {
  font-family: var(--font-ui);
  font-size: 32px; line-height: 40px; font-weight: 700;
  color: var(--text-primary);
}

.profile-meta {
  display: flex; flex-direction: column; gap: 16px;
}
.profile-scientific {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 14px; line-height: 24px;
}
.profile-desc {
  color: var(--text-primary);
  font-size: 14px; line-height: 24px;
}

.profile-image {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
  border-radius: var(--radius);
}

/* Key–value table */
.kv-table {
  width: 100%;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
  /* overflow: visible so tooltips aren't clipped;
     corner rounding is handled on first/last rows instead */
}
.kv-row {
  display: flex;
  border-bottom: 1px solid var(--border-secondary);
}
.kv-row:last-child { border-bottom: none; }
/* Clip hover bg to table corners without clipping tooltips */
.kv-row:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
.kv-row:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.kv-label {
  flex: 1; padding: 12px;
  color: var(--text-secondary);
  font-size: 14px; line-height: 24px;
}
.kv-value {
  flex: 1; padding: 12px;
  color: var(--text-primary);
  font-size: 14px; line-height: 24px;
  display: flex; align-items: center; gap: 8px;
}

/* Profile related entries */
.profile-entries-section { margin-top: 32px; }
.profile-entries-heading {
  display: flex; align-items: center;
  font-family: var(--font-ui); font-size: 13px;
  color: var(--text-secondary);
  padding: 0 0 4px;
  margin-bottom: 4px;
}
.profile-entries-heading span { flex: 1; }
.profile-create-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--icon-secondary);
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.profile-create-btn:hover { background: var(--bg-light-grey); color: var(--text-primary); }

/* Help icon */
.help-wrap {
  display: inline-flex;
  align-items: flex-start;
}
.help-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  color: var(--icon-secondary);
  cursor: help;
  transition: color 0.15s;
  margin-top: 2px;
}
.help-wrap:hover .help-icon { color: var(--text-primary); }

/* ═══════════════════════════════════════
   SCREEN: JOURNAL LIST
═══════════════════════════════════════ */
.journal-list {
  width: 600px;
  display: flex;
  flex-direction: column;
}
.journal-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s;
}
.journal-item:hover { background: var(--bg-light-grey); }
.journal-item.selected,
.journal-item.selected:hover { background: var(--bg-blue); }
.journal-item-check {
  flex-shrink: 0;
  display: flex;
  align-items: center; justify-content: center;
  width: 20px; height: 20px;
  color: var(--icon-secondary);
  background: none; border: none; padding: 0; cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s;
}
.journal-item:hover .journal-item-check,
.journal-item.selected .journal-item-check { opacity: 1; }
.journal-item.selected .journal-item-check { color: var(--selection); }
.journal-item-title {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 14px; line-height: 20px;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.journal-item-time {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 12px; line-height: 16px;
  color: var(--text-secondary);
}
.journal-divider {
  height: 1px;
  background: var(--border-secondary);
  margin: 32px 12px 0;
}
.journal-section-label {
  font-family: var(--font-ui);
  font-size: 13px; line-height: 36px;
  color: var(--text-secondary);
  padding: 4px 12px 0 42px;
}
.journal-section-label:first-child { padding-top: 4px; }

/* ═══════════════════════════════════════
   SCREEN: JOURNAL NEW ENTRY
═══════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════
   CUSTOMIZE FIELDS DIALOG
═══════════════════════════════ */
.form-row[data-hidden] { display: none; }

.dialog-overlay {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
.dialog-overlay.hidden { display: none; }
.dialog-panel {
  background: var(--bg-grey);
  border: 1px solid var(--border-secondary);
  border-radius: 12px;
  width: 560px; max-height: 56vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.dialog-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 14px 20px;
  flex-shrink: 0;
}
.dialog-title {
  flex: 1;
  font-family: var(--font-ui); font-size: 18px; font-weight: 700;
  color: var(--text-primary);
}
.dialog-body {
  flex: 1; overflow-y: auto;
  padding: 0 16px 16px;
  display: flex; flex-direction: column; gap: 0;
}
/* Column header row */
.cust-col-header {
  display: flex; align-items: center;
  padding: 6px 0 6px 0;
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  color: var(--text-secondary);
}
.cust-col-header-field { flex: 1; padding-left: 20px; }
.cust-col-header-toggle { width: 32px; margin-right: 0; text-align: center; }
.cust-section-wrap { display: block; margin-bottom: 20px; }
.cust-section {
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
  overflow: hidden;
}
.cust-section-head {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px; height: 36px;
  background: var(--bg-grey);
  transition: opacity 0.15s;
}
.cust-section-name {
  flex: 1;
  font-family: var(--font-ui); font-size: 13px; color: var(--text-secondary);
}
.cust-row {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; height: 44px;
  border-top: 1px solid var(--border-secondary);
  background: var(--bg-dark);
  transition: opacity 0.15s;
}
.cust-row.drag-over { box-shadow: inset 0 2px 0 rgba(255,255,255,0.3); }
.cust-row-label {
  flex: 1;
  font-family: var(--font-ui); font-size: 14px; color: var(--text-primary);
}
/* Row hidden — keep toggle active, grey everything else */
.cust-row.is-hidden > :not(.cust-toggle),
.cust-section-head.is-hidden > :not(.cust-toggle) { opacity: 0.35; }
/* Section hidden — grey ALL row children including their toggles */
.cust-section-wrap.is-section-hidden .cust-row { opacity: 0.35; }
/* Hide entire form-section */
.form-section[data-hidden] { display: none; }
.drag-handle {
  color: var(--text-secondary); cursor: grab; flex-shrink: 0;
  display: flex; align-items: center; opacity: 0.4;
  transition: opacity 0.1s;
}
.cust-row:hover .drag-handle { opacity: 1; }
.drag-handle:active { cursor: grabbing; }
.cust-toggle {
  position: relative; width: 32px; height: 18px; flex-shrink: 0; cursor: pointer;
}
.cust-toggle input { opacity: 0; position: absolute; }
.cust-toggle-track {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 9px; transition: background 0.15s;
}
.cust-toggle-thumb {
  position: absolute; left: 2px; top: 2px;
  width: 14px; height: 14px;
  background: rgba(255,255,255,0.4);
  border-radius: 50%; transition: transform 0.15s, background 0.15s;
}
.cust-toggle input:checked ~ .cust-toggle-track { background: rgba(255,255,255,0.35); }
.cust-toggle input:checked ~ .cust-toggle-thumb { transform: translateX(14px); background: white; }
.cust-delete-row {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex-shrink: 0;
  border-radius: 4px; color: var(--text-secondary);
  border: none; background: transparent;
  cursor: pointer; transition: background 0.1s, color 0.1s;
}
.cust-delete-row:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.cust-add-row {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px 0;
  font-family: var(--font-ui); font-size: 13px; color: var(--text-secondary);
  cursor: pointer; background: transparent; border: none; text-align: left;
  transition: color 0.1s;
}
.cust-add-row:hover { color: var(--text-primary); }
.autosave-wrap {
  display: flex; align-items: center; gap: 6px;
  padding: 0 8px;
}
#autosave-spinner { animation: spin 0.9s linear infinite; transform-origin: center; }
.autosave-text {
  font-size: 13px; color: var(--text-secondary);
  white-space: nowrap;
}

/* Split layout for journal entry + reference panel */
.entry-content {
  padding: 0 !important;
  overflow: hidden !important;
  flex-direction: row !important;
  align-items: stretch !important;
}
.split-left {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 12px 12px 40px;
  display: flex; flex-direction: column; align-items: center;
}
.split-left .entry-form { width: 100%; max-width: 600px; }
.split-right {
  display: none;
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 40px 32px 40px;
  flex-direction: column; align-items: center;
}
.split-right.open { display: flex; }
.split-right .profile { width: 100%; max-width: 540px; }

/* Split frame — unified bordered container */
.split-frame {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.split-panels {
  flex: 1; display: flex; flex-direction: row;
  min-height: 0; overflow: hidden;
}

/* Active split */
.entry-content.split-active {
  background: var(--bg-dark) !important;
  padding: 0 !important;
  gap: 0;
}
.entry-content.split-active .split-frame {
  margin: 16px;
  border: 1px solid var(--text-primary);
  border-radius: 8px;
  overflow: hidden;
}
[data-theme="light"] .entry-content.split-active .split-frame {
  border-color: rgba(0,0,0,0.2);
}
.split-view-label {
  display: none;
  flex-shrink: 0;
  height: 32px; padding: 0 12px;
  align-items: center;
  background: var(--text-primary);
  border-bottom: 1px solid var(--text-primary);
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  color: var(--bg-dark);
  letter-spacing: 0.01em;
}
.entry-content.split-active .split-view-label { display: flex; }
.split-view-text {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex-shrink: 1;
}
.ref-selector-btn {
  margin-left: auto; flex-shrink: 1; min-width: 0;
  display: flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 5px;
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  color: #000; border: 1px solid rgba(0,0,0,0.15);
  cursor: pointer; transition: background 0.12s;
}
.ref-selector-btn:hover { background: rgba(0,0,0,0.06); }
#ref-selector-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.split-close-btn {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 4px; flex-shrink: 0;
  color: #000; cursor: pointer; transition: background 0.12s;
  margin-left: 4px;
}
.split-close-btn:hover { background: rgba(0,0,0,0.07); }
.entry-content.split-active .split-left { background: transparent; }
.entry-content.split-active .split-right { background: transparent; }
.split-divider {
  display: none;
  width: 1px; flex-shrink: 0;
  background: var(--text-primary);
  cursor: col-resize;
  position: relative;
  transition: background 0.15s;
}
.split-divider::after {
  content: '';
  position: absolute;
  inset: 0 -4px;
}
.entry-content.split-active .split-divider { display: block; }
.split-divider:hover, .split-divider.dragging { background: var(--text-secondary); }

.entry-form {
  width: 600px;
  display: flex; flex-direction: column; gap: 28px;
  padding-bottom: 64px;
}

.entry-title {
  font-family: var(--font-ui);
  font-size: 32px; line-height: 40px; font-weight: 700;
  height: 40px;
  color: var(--text-primary);
  background: transparent; border: none; outline: none;
  width: 100%; padding: 0; margin: 0;
  box-sizing: content-box;
}
.entry-title::placeholder { color: var(--text-secondary); }

/* Form section card */
.form-section {
  width: 100%;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
}
.form-section-head {
  padding: 0 12px;
  height: 36px;
  display: flex; align-items: center;
  font-size: 13px; color: var(--text-secondary);
  background: var(--bg-grey);
  border-radius: var(--radius) var(--radius) 0 0;
}

.form-row {
  display: flex; align-items: center;
  border-bottom: 1px solid var(--border-secondary);
  transition: background 0.1s;
}
.form-row:last-child { border-bottom: none; }
.form-cell:has(input, select, textarea, [contenteditable]):hover { background: rgba(255,255,255,0.05); }
.form-cell:focus-within {
  background: rgba(255,255,255,0.03);
  box-shadow: inset 0 0 0 1.5px var(--text-primary);
}
.form-label:focus {
  box-shadow: inset 0 0 0 1.5px var(--text-primary);
}

.form-label {
  width: 200px; min-width: 200px;
  padding: 10px 12px;
  font-size: 14px; line-height: 24px;
  color: var(--text-secondary);
  border-right: 1px solid var(--border-secondary);
  outline: none; cursor: text;
}
.form-label:focus { background: rgba(255,255,255,0.05); }
.form-cell {
  flex: 1; padding: 10px 12px;
  display: flex; align-items: center;
  align-self: stretch;
}

.field-input {
  width: 100%; background: transparent; border: none; outline: none;
  font-family: var(--font-ui); font-size: 14px; line-height: 24px;
  color: var(--text-primary);
}
.field-input::placeholder { color: var(--text-secondary); }
.organism-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px 2px 10px;
  border: 1px solid var(--border-secondary);
  border-radius: 4px;
  font-family: var(--font-ui); font-size: 13px; line-height: 20px;
  color: var(--text-primary);
}
.organism-badge-clear {
  display: flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 2px;
  color: var(--text-secondary); cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.organism-badge-clear:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.organism-combobox { position: relative; }
.combo-dropdown {
  position: absolute; top: calc(100% + 2px); left: -1px; right: -1px;
  background: var(--bg-grey);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
  z-index: 200; overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.combo-dropdown.hidden { display: none; }
.combo-item {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  font-family: var(--font-ui); font-size: 14px; color: var(--text-primary);
  cursor: pointer; transition: background 0.1s;
}
.combo-item:hover, .combo-item.active { background: rgba(255,255,255,0.06); }
.combo-item-sub {
  font-size: 12px; font-style: italic; color: var(--text-secondary);
  margin-left: auto;
}
/* keep old names as aliases */
.organism-suggestions { position: absolute; top: calc(100% + 2px); left: -1px; right: -1px; background: var(--bg-grey); border: 1px solid var(--border-secondary); border-radius: var(--radius); z-index: 200; overflow: hidden; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.organism-suggestions.hidden { display: none; }
.organism-suggestion-item { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; font-family: var(--font-ui); font-size: 14px; color: var(--text-primary); cursor: pointer; transition: background 0.1s; }
.organism-suggestion-item:hover { background: rgba(255,255,255,0.06); }
.organism-suggestion-sci { font-size: 12px; font-style: italic; color: var(--text-secondary); margin-left: auto; }
/* combobox cell wrapper */
.combo-wrap { position: relative; flex: 1; display: flex; align-items: center; }

/* Select */
.select-wrap {
  position: relative; flex: 1; display: flex; align-items: center;
}
.field-select {
  width: 100%; background: transparent; border: none; outline: none;
  font-family: var(--font-ui); font-size: 14px; line-height: 24px;
  color: var(--text-primary);
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding-right: 20px;
}
.field-select option { background: var(--bg-light-grey); }
select.placeholder-sel { color: var(--text-secondary); }
select.field-select:not(.placeholder-sel) { color: var(--text-primary); }
.chev {
  position: absolute; right: 0; pointer-events: none;
  width: 16px; height: 16px;
  color: var(--text-secondary);
  transition: color 0.1s;
}
.form-cell:hover .chev { color: var(--text-primary); }

/* Confidence dots */
.conf-dots { display: flex; gap: 8px; align-items: center; }
.conf-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.conf-dot::after {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-primary);
  transform: scale(0);
  transition: transform 0.15s;
}
.conf-dot.filled { border-color: var(--text-primary); }
.conf-dot.filled::after { transform: scale(1); }
.conf-dot:hover { border-color: var(--text-primary); }
.conf-count {
  margin-left: 8px; font-size: 13px;
  color: var(--text-secondary);
}

/* Photo drop zone */
.photo-dropzone {
  padding: 32px 12px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--text-secondary); font-size: 14px;
  cursor: pointer; transition: background 0.15s, color 0.15s;
  border-radius: 0 0 var(--radius) var(--radius);
}
.photo-dropzone:hover { background: rgba(255,255,255,0.02); color: var(--text-primary); }
.form-section[data-section="photos"]:has(.form-row) .photo-dropzone { border-bottom: 1px solid var(--border-secondary); border-radius: 0; }

/* Notes textarea */
.form-row:has(.notes-area):hover { background: rgba(255,255,255,0.05); }
.notes-area {
  width: 100%; background: transparent; border: none; outline: none; resize: none;
  font-family: var(--font-ui); font-size: 14px; line-height: 24px;
  color: var(--text-primary); padding: 10px 12px;
  display: block;
}
.notes-area::placeholder { color: var(--text-secondary); }

/* ── Row editing ── */
.form-row { position: relative; }
.form-section-head { position: relative; }

/* Section focus ring on any row hover */
.form-section:has(.form-row:hover),
.form-section:has(.photo-dropzone:hover) { border-color: rgba(255,255,255,0.35); }

/* Row copy button — left side */
.row-copy-btn {
  position: absolute; left: -36px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); background: transparent; border: none;
  color: var(--text-secondary); cursor: pointer;
  opacity: 0; transition: opacity 0.1s, background 0.1s, color 0.1s; z-index: 2;
}
.form-row:hover .row-copy-btn { opacity: 1; }
.row-copy-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.row-copy-btn:active { background: var(--bg-light-grey); color: var(--text-primary); }

/* Section head ⋮ button */
.row-menu-btn {
  position: absolute; left: -36px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); background: transparent; border: none;
  color: var(--text-secondary); cursor: pointer;
  opacity: 0; transition: opacity 0.1s, background 0.1s, color 0.1s; z-index: 2;
}
.form-section-head:hover .row-menu-btn,
.form-section-head.row-active .row-menu-btn { opacity: 1; }
.row-menu-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.form-section.row-active { border-color: var(--text-primary); }

/* Snackbar */
.snackbar {
  position: fixed; top: calc(var(--header-h) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--bg-light-grey); border: 1px solid var(--border-secondary);
  border-radius: 20px; padding: 8px 16px;
  font-family: var(--font-ui); font-size: 13px; color: var(--text-primary);
  z-index: 3000; pointer-events: none;
  opacity: 0; transition: opacity 0.2s; white-space: nowrap;
}
.snackbar.show { opacity: 1; }

/* Delete-only sections: single centered button on the whole section */
.form-section[data-delete-only] { position: relative; }
.section-delete-btn {
  position: absolute; left: -36px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); background: transparent; border: none;
  color: var(--text-secondary); cursor: pointer; opacity: 0;
  transition: opacity 0.1s, background 0.1s, color 0.1s; z-index: 2;
}
.form-section[data-delete-only]:hover .section-delete-btn,
.form-section[data-delete-only].row-active .section-delete-btn { opacity: 1; color: var(--text-primary); }
.section-delete-btn:hover { background: rgba(255,255,255,0.06); }
.form-section[data-delete-only].row-active::after {
  content: ''; position: absolute; inset: 0;
  border: 1.5px solid var(--text-primary);
  border-radius: var(--radius);
  pointer-events: none; z-index: 10;
}

.dd-divider { height: 1px; background: var(--border-secondary); margin: 4px 0; }

.row-dropdown {
  position: fixed;
  background: var(--bg-grey);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  padding: 4px;
  z-index: 1001;
  min-width: 168px;
}
.row-dd-divider {
  height: 1px;
  background: var(--border-primary);
  margin: 4px 0;
}
.row-dd-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 14px; line-height: 20px;
  color: var(--text-primary);
  background: transparent; border: none; cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.row-dd-item:hover { background: var(--bg-light-grey); }
.row-dd-item.danger { color: var(--error); }
.row-dd-item.danger:hover { background: rgba(196,75,75,0.12); }

/* Single floating tooltip — appended to <body>, positioned via JS */
#floating-tip {
  position: fixed;
  background: var(--bg-light-grey);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px; line-height: 20px;
  color: var(--text-primary);
  white-space: normal;
  max-width: 280px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 999;
}

/* ── Settings dialog ── */
.settings-panel {
  display: flex; flex-direction: row !important;
}
.settings-dialog-sidebar {
  width: 180px; flex-shrink: 0;
  background: var(--bg-grey);
  padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.settings-sidebar-item {
  height: 32px; width: 100%;
  display: flex; align-items: center;
  padding: 0 10px;
  border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 13px;
  color: var(--text-primary);
  cursor: pointer; transition: background 0.12s;
  text-align: left;
}
.settings-sidebar-item:hover { background: var(--bg-light-grey); color: var(--text-primary); }
.settings-sidebar-item.active { background: var(--bg-light-grey); color: var(--text-primary); font-weight: 500; }
.settings-dialog-right {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  background: var(--bg-dark);
}
.settings-dialog-content {
  flex: 1; overflow-y: auto;
  padding: 20px 24px;
}
/* ── Settings profile pane ── */
.settings-state-switcher {
  display: flex; gap: 4px; margin-bottom: 20px;
  padding: 3px; background: var(--bg-light-grey); border-radius: 8px;
  width: fit-content;
}
.settings-state-btn {
  padding: 4px 12px; border-radius: 6px;
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; transition: background 0.12s, color 0.12s;
}
.settings-state-btn.active { background: var(--bg-grey); color: var(--text-primary); }
.settings-profile-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; margin-bottom: 20px;
  border: 1px solid var(--border-secondary); border-radius: var(--radius);
}
.settings-avatar-lg {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: var(--border-secondary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-size: 18px; font-weight: 600;
  color: var(--text-primary);
}
.settings-profile-name {
  font-family: var(--font-ui); font-size: 15px; font-weight: 600;
  color: var(--text-primary); margin-bottom: 8px;
}
.settings-profile-sub {
  font-family: var(--font-ui); font-size: 12px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 5px;
}
.settings-divider { height: 1px; background: var(--border-secondary); margin: 4px 0 20px; }
.settings-sub-section-label {
  font-family: var(--font-ui); font-size: 12px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-secondary); margin-bottom: 10px; margin-top: 20px;
}
.settings-input-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
}
.settings-input-row .field-input { flex: 1; }
.settings-save-btn {
  padding: 6px 14px; border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  background: var(--bg-light-grey); color: var(--text-primary);
  border: 1px solid var(--border-secondary); cursor: pointer;
  transition: background 0.12s; white-space: nowrap; flex-shrink: 0;
}
.settings-save-btn:hover { background: var(--border-secondary); }
.settings-auth-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--border-secondary); border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 13px; color: var(--text-secondary);
  margin-bottom: 20px;
}
.settings-footer-actions {
  display: flex; gap: 8px; padding-top: 16px; margin-top: 8px;
  border-top: 1px solid var(--border-secondary);
}
.settings-action-btn {
  padding: 7px 16px; border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  border: 1px solid var(--border-secondary); cursor: pointer;
  color: var(--text-primary); background: transparent;
  transition: background 0.12s;
}
.settings-action-btn:hover { background: var(--bg-light-grey); }
.settings-action-btn.danger { color: #C44B4B; border-color: rgba(196,75,75,0.3); }
.settings-action-btn.danger:hover { background: rgba(196,75,75,0.08); }
.settings-field-group { margin-bottom: 20px; }
.settings-field-label {
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
}
.settings-select-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; width: auto;
  border: 1px solid var(--border-secondary); border-radius: var(--radius);
  background: transparent;
  font-family: var(--font-ui); font-size: 14px; color: var(--text-primary);
  cursor: pointer; transition: background 0.12s;
}
.settings-select-btn:hover { background: var(--bg-light-grey); }
.settings-body { padding: 24px; max-width: 480px; }
.settings-section { margin-bottom: 24px; }
.settings-section-label {
  font-family: var(--font-ui); font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-secondary); margin-bottom: 8px;
}
.settings-row {
  display: flex; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border-secondary);
}
.settings-row-label {
  flex: 1; font-family: var(--font-ui); font-size: 14px; color: var(--text-primary);
}
.settings-row-control { display: flex; gap: 6px; }
.theme-btn {
  padding: 5px 14px; border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 13px;
  color: var(--text-secondary); border: 1px solid var(--border-secondary);
  cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-btn:hover { color: var(--text-primary); }
.theme-btn.active {
  background: var(--bg-light-grey);
  color: var(--text-primary); border-color: transparent;
}
.settings-name-input { width: 200px; }

.journal-signin-banner {
  display: flex; flex-direction: column; align-items: center;
  max-width: 420px; width: 100%;
  margin: 64px auto 0;
  text-align: center;
}
.journal-signin-banner-lock {
  color: var(--icon-secondary);
  margin-bottom: 24px;
  flex-shrink: 0;
}
.journal-signin-banner-title {
  font-family: var(--font-ui); font-size: 26px; line-height: 32px; font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 24px;
}
.journal-signin-banner-body {
  font-family: var(--font-ui); font-size: 14px; line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 24px;
}
.journal-signin-banner-btn {
  height: 36px; width: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border-primary);
  background: var(--bg-light-grey);
  font-family: var(--font-ui); font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.journal-signin-banner-btn:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.journal-signin-banner-signup {
  font-family: var(--font-ui); font-size: 13px;
  color: var(--text-secondary);
  margin: 20px 0 0;
}
.journal-signin-banner-signup-btn {
  color: var(--text-primary);
  text-decoration: underline;
  cursor: pointer;
}
.journal-signin-banner-signin {
  font-family: var(--font-ui); font-size: 13px;
  color: var(--text-secondary);
  margin-top: 16px;
}
.journal-signin-banner-signin button {
  color: var(--text-primary);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
}
.journal-signin-banner-signin button:hover { color: var(--text-primary); opacity: 0.8; }

/* ══ SIGN-IN DIALOG ══ */
/* ══ SIGN-IN FULL-SCREEN PAGE ══ */
.signin-page {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg-grey);
  display: flex; align-items: center; justify-content: center;
}
.signin-page.hidden { display: none; }
.signin-page-back {
  position: absolute; top: 16px; right: 16px;
  color: var(--icon-secondary);
}
.signin-page-content {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 360px;
  padding: 0 24px;
  gap: 32px;
  text-align: center;
}
.signin-page-logo {
  color: var(--text-primary);
  margin-bottom: 8px;
}
.signin-page-headline {
  font-family: var(--font-ui); font-size: 26px; font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.signin-page-sub {
  font-family: var(--font-ui); font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
}
.signin-page-sub:empty { display: none; }
.signin-email-form {
  width: 100%;
  display: flex; flex-direction: column; gap: 12px;
}
.signin-email-form .signin-field { width: 100%; text-align: left; }
.signin-email-form .journal-signin-banner-btn { width: 100%; margin-top: 4px; }
.signin-page-content .signin-toggle { width: 100%; }
.signin-google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 40px; width: 100%; border-radius: var(--radius);
  border: 1px solid var(--border-primary);
  background: var(--bg-light-grey);
  font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s;
}
.signin-google-btn:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.signin-divider {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  color: var(--text-secondary);
  font-family: var(--font-ui); font-size: 12px;
}
.signin-divider::before,
.signin-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-hover); }
.signin-field { display: flex; flex-direction: column; gap: 5px; }
.signin-label {
  font-family: var(--font-ui); font-size: 12px;
  color: var(--text-secondary);
}
.signin-input {
  height: 38px; padding: 0 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.12s;
}
.signin-input:focus { border-color: var(--text-secondary); }
.signin-submit-btn {
  height: 40px; border-radius: var(--radius);
  background: var(--text-primary);
  border: none;
  font-family: var(--font-ui); font-size: 14px; font-weight: 600;
  color: var(--bg-dark);
  cursor: pointer;
  transition: opacity 0.12s;
  margin-top: 4px;
}
.signin-submit-btn:hover { opacity: 0.85; }
.signin-submit-btn:disabled { opacity: 0.45; cursor: default; }
.signin-toggle {
  text-align: center;
  font-family: var(--font-ui); font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}
.signin-toggle-btn {
  background: none; border: none;
  font-family: var(--font-ui); font-size: 13px;
  color: var(--text-primary);
  cursor: pointer; text-decoration: underline;
}
.signin-error.hidden, .signin-success.hidden { display: none; }
.signin-error {
  padding: 10px 12px;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 13px;
  color: #f87171;
}
.signin-success {
  padding: 10px 12px;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 13px;
  color: #4ade80;
}
