/* ── JOURNAL — Premium Design System ─────── */

/* ── Filter Bar ────────────────────────── */
.j-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 48px;
}
.j-filter-group {
  position: relative;
  min-width: 110px;
  flex: 1;
}
.j-filter-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 5px;
}
.j-filter-input,
.j-filter-select {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 0.82rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--fast);
}
.j-filter-input:focus,
.j-filter-select:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-ring);
}
.j-filter-select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A8A96' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}
.j-more-filters-btn {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: none;
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--fast);
}
.j-more-filters-btn:hover {
  border-color: var(--indigo);
  color: var(--indigo);
}

/* Filter tags */
.j-filter-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 0 0;
  align-items: center;
}
.j-filter-tags:empty { display: none; }
.j-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: var(--indigo-light);
  color: var(--indigo);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.j-filter-tag-x {
  cursor: pointer;
  opacity: 0.6;
  font-size: 13px;
  line-height: 1;
  margin-left: 2px;
}
.j-filter-tag-x:hover { opacity: 1; }
.j-clear-all {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 6px;
  font-family: var(--font-sans);
}
.j-clear-all:hover { color: var(--loss); }

/* More filters panel */
.j-more-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
}

/* Range inputs */
.j-range-wrap {
  display: flex;
  gap: 4px;
  align-items: center;
}
.j-range-wrap input {
  width: 72px;
  padding: 5px 8px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-sans);
}
.j-range-wrap input:focus { border-color: var(--indigo); }
.j-range-sep {
  font-size: 0.72rem;
  color: var(--text-ghost);
}

/* ── Table ────────────────────────────── */
.j-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.j-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: transparent;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.j-table tbody td {
  padding: 0 14px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
  height: 48px;
}
.j-table tbody tr { cursor: pointer; transition: background 0.1s; }
.j-table tbody tr:hover td { background: var(--surface-2); }
.j-table tbody tr:last-child td { border-bottom: none; }
.j-table tbody tr.j-row-selected td { background: var(--indigo-light); }

/* Checkbox column */
.j-check-cell { width: 40px; }
.j-check {
  width: 15px; height: 15px;
  accent-color: var(--indigo);
  cursor: pointer;
}

/* Direction badges */
.j-badge-long {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: #EAF3DE;
  color: #27500A;
}
.j-badge-short {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: #FCEBEB;
  color: #791F1F;
}
.j-badge-neutral {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: #F0EAFC;
  color: #4A3D8F;
}
[data-theme="dark"] .j-badge-long {
  background: rgba(39, 80, 10, 0.3);
  color: #97C459;
}
[data-theme="dark"] .j-badge-short {
  background: rgba(121, 31, 31, 0.3);
  color: #F09595;
}
[data-theme="dark"] .j-badge-neutral {
  background: rgba(124, 111, 224, 0.15);
  color: #B4A0F4;
}

/* P&L colors */
.j-pnl-pos { font-family: var(--font-mono); font-weight: 600; color: #3B6D11; }
.j-pnl-neg { font-family: var(--font-mono); font-weight: 600; color: #A32D2D; }
[data-theme="dark"] .j-pnl-pos { color: #97C459; }
[data-theme="dark"] .j-pnl-neg { color: #F09595; }

/* Empty dash */
.j-dash { color: var(--text-tertiary); }

/* Instrument cell */
.j-instrument { font-family: var(--font-mono); font-weight: 600; color: var(--text-primary); }

/* ── Empty State ────────────────────────── */
.j-empty {
  text-align: center;
  padding: 48px 20px;
}
.j-empty-icon {
  width: 32px; height: 32px;
  color: var(--text-ghost);
  margin: 0 auto 12px;
  display: block;
}
.j-empty-title {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.j-empty-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ── Bulk Action Bar ─────────────────────── */
.j-bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--indigo-light);
  border: 1px solid var(--indigo-ring);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--indigo);
  font-weight: 500;
}

/* ── Setup Modal ────────────────────────── */
.j-setup-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.j-setup-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 32px;
}
.j-setup-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin-bottom: 6px;
}
.j-setup-sub {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}
.j-setup-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 0.72rem;
  color: var(--text-ghost);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.j-setup-divider::before,
.j-setup-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.j-setup-preview {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 8px;
  margin: 12px 0 16px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* Column Builder */
.j-col-list { margin: 16px 0; }
.j-col-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.j-col-row:last-child { border-bottom: none; }
.j-col-row[draggable="true"] { cursor: grab; }
.j-col-row.dragging { opacity: 0.4; }
.j-col-drag {
  color: var(--text-ghost);
  flex-shrink: 0;
  width: 16px;
  display: flex;
  align-items: center;
}
.j-col-name-input,
.j-col-type-select,
.j-col-opts-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.82rem;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  outline: none;
}
.j-col-name-input { flex: 1; min-width: 100px; }
.j-col-type-select {
  width: 150px;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-appearance: none;
}
.j-col-opts-input { flex: 1; min-width: 0; font-size: 0.78rem; }
.j-col-name-input:focus,
.j-col-type-select:focus,
.j-col-opts-input:focus { border-color: var(--indigo); }
.j-col-del {
  cursor: pointer;
  color: var(--text-ghost);
  background: none;
  border: none;
  padding: 4px;
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
  transition: color var(--fast);
}
.j-col-del:hover { color: var(--loss); }
.j-col-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--indigo);
  background: none;
  border: 1px dashed var(--indigo-ring);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background var(--fast);
}
.j-col-add-btn:hover { background: var(--indigo-light); }
.j-col-warn {
  font-size: 0.75rem;
  color: var(--caution);
  background: var(--caution-bg);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--caution-border);
  margin-top: 12px;
}

/* ── Trade Drawer ────────────────────────── */
.j-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(3px);
  z-index: 250;
  opacity: 0;
  transition: opacity var(--med);
  pointer-events: none;
}
.j-drawer-overlay.open { opacity: 1; pointer-events: auto; }

.j-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: 251;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--med) var(--ease);
}
.j-drawer.open { transform: translateX(0); }

.j-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.j-drawer-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
}
.j-drawer-x {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  padding: 4px;
}
.j-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.j-drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.j-field {
  margin-bottom: 16px;
}
.j-field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 5px;
  letter-spacing: 0.04em;
}
.j-field input,
.j-field select,
.j-field textarea {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--fast);
}
.j-field input:focus,
.j-field select:focus,
.j-field textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-ring);
}
.j-field textarea { resize: vertical; min-height: 60px; }
.j-field select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.j-field-currency {
  position: relative;
}
.j-field-currency::before {
  content: '$';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.85rem;
  pointer-events: none;
}
.j-field-currency input { padding-left: 24px; }

/* Toggle */
.j-toggle-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
}
.j-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background var(--fast);
  border: none;
  padding: 0;
  flex-shrink: 0;
}
.j-toggle.on { background: var(--indigo); }
.j-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--fast);
}
.j-toggle.on::after { transform: translateX(18px); }
.j-toggle-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Range slider (emotion score) */
.j-range-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.j-range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.j-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--indigo);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 3px var(--indigo-ring);
  cursor: pointer;
  transition: transform 0.12s;
}
.j-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.j-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--indigo);
  border: 2px solid var(--surface);
  cursor: pointer;
}
.j-range-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 50px;
  flex-shrink: 0;
}
.j-range-val {
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.j-range-state {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ── Trade Detail Popup ──────────────────── */
.j-detail-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 260;
}
.j-detail {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  z-index: 261;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}
.j-detail-head {
  padding: 24px 28px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
}
.j-detail-instrument {
  font-family: var(--font-serif);
  font-size: 1.3rem;
}
.j-detail-date {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-left: auto;
}
.j-detail-x {
  position: absolute;
  top: 16px; right: 16px;
  background: none; border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}
.j-detail-pnl {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  padding: 12px 28px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.j-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px 28px;
}
.j-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 8px 10px 0;
  border-bottom: 0.5px solid var(--border);
}
.j-detail-item:nth-child(even) { padding-left: 8px; padding-right: 0; }
.j-detail-lbl {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.j-detail-val {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}
.j-detail-actions {
  display: flex;
  gap: 10px;
  padding: 16px 28px;
}

/* Delete confirm inline */
.j-inline-confirm {
  padding: 14px 28px;
  background: var(--loss-bg);
  border-top: 1px solid var(--loss-border);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.j-inline-confirm p {
  font-size: 0.82rem;
  color: var(--loss);
  margin-bottom: 10px;
}
.j-inline-confirm-btns {
  display: flex;
  gap: 8px;
}

/* ── Confirm Modal (Bulk Delete) ─────────── */
.j-confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 270;
}
.j-confirm-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-xl);
  z-index: 271;
  width: min(400px, calc(100vw - 32px));
  padding: 28px;
  text-align: center;
}
.j-confirm-title {
  font-weight: 600;
  margin-bottom: 6px;
}
.j-confirm-sub {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-bottom: 20px;
}
.j-confirm-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ── Import Flow ────────────────────────── */
.j-import-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.j-import-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 32px;
  position: relative;
}
.j-import-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  margin-bottom: 6px;
}
.j-import-sub {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-bottom: 20px;
}
.j-import-x {
  position: absolute;
  top: 16px; right: 16px;
  background: none; border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}
.j-import-platforms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.j-import-platform {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--fast);
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
}
.j-import-platform:hover,
.j-import-platform.selected {
  border-color: var(--indigo);
  background: var(--indigo-light);
}
.j-import-platform-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 10px;
  background: var(--surface-3);
  color: var(--text-secondary);
  flex-shrink: 0;
}
.j-import-or {
  text-align: center;
  padding: 6px 0;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.j-import-or a {
  color: var(--indigo);
  cursor: pointer;
  font-weight: 500;
}
.j-import-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--fast);
  margin-top: 12px;
}
.j-import-dropzone:hover,
.j-import-dropzone.dragover {
  border-color: var(--indigo);
  background: var(--indigo-light);
}
.j-import-dropzone-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.j-import-dropzone-sub {
  font-size: 0.72rem;
  color: var(--text-ghost);
  margin-top: 6px;
}

/* Mapping */
.j-mapping-wrap { margin: 16px 0; }
.j-mapping-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.j-mapping-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
}
.j-mapping-table td {
  padding: 6px 10px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}
.j-mapping-csv {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.j-mapping-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.8rem;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
}
.j-mapping-select:focus { border-color: var(--indigo); }
.j-mapping-tip {
  font-size: 0.75rem;
  color: var(--caution);
  background: var(--caution-bg);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--caution-border);
}
.j-mapping-err {
  font-size: 0.75rem;
  color: var(--loss);
  margin-top: 8px;
}

/* Import preview mini-table */
.j-preview-mini {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin: 12px 0;
}
.j-preview-mini th {
  padding: 6px 8px;
  text-align: left;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
}
.j-preview-mini td {
  padding: 5px 8px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-secondary);
}

/* Step indicator */
.j-import-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}
.j-import-step {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
}
.j-import-step.active { background: var(--indigo); }
.j-import-step.done { background: var(--profit); }

/* ── Responsive ─────────────────────────── */
@media (max-width: 768px) {
  .j-drawer { width: 100vw; }
  .j-detail-grid { grid-template-columns: 1fr; }
  .j-import-platforms { grid-template-columns: 1fr; }
  .j-filter-bar { gap: 8px; }
  .j-filter-group { min-width: 100%; }
}

/* ── Column Builder Headers ─────────────── */
.j-col-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 6px;
  margin-bottom: 2px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-ghost);
}
.j-col-header-drag { width: 16px; flex-shrink: 0; }
.j-col-header-name { flex: 1; min-width: 100px; }
.j-col-header-type { width: 150px; flex-shrink: 0; }
.j-col-header-del { width: 24px; flex-shrink: 0; }

/* ── Image Column — Table Cell ──────────── */
.j-cell-img {
  max-height: 36px;
  max-width: 64px;
  border-radius: 4px;
  object-fit: cover;
  cursor: pointer;
  transition: opacity var(--fast);
  vertical-align: middle;
}
.j-cell-img:hover { opacity: 0.8; }

/* ── Image Column — Drawer Upload ────────── */
.j-img-upload {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.j-img-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid var(--border);
}
.j-img-actions {
  display: flex;
  gap: 8px;
}
.j-img-pick,
.j-img-remove {
  font-size: 0.76rem;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--fast);
}
.j-img-pick:hover { border-color: var(--indigo); color: var(--indigo); }
.j-img-remove:hover { border-color: var(--loss); color: var(--loss); }

/* ── Image Column — Detail Popup ──────────── */
.j-detail-item-full {
  grid-column: 1 / -1;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.j-detail-img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 8px;
  object-fit: contain;
  cursor: pointer;
  transition: opacity var(--fast);
}
.j-detail-img:hover { opacity: 0.85; }

/* ═══════════════════════════════════════════
   JOURNAL TABLE — Theme-aware cells
   ═══════════════════════════════════════════ */

/* Column picker button */
.j-col-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.j-col-btn:hover { border-color: var(--border-2); color: var(--text-1); }

/* Table header cells */
.j-th {
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .09em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}
.j-th-check { width: 36px; padding: 10px 8px; }

/* Table body cells */
.j-td { padding: 11px 14px; vertical-align: middle; }

/* Table rows */
.j-row {
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.j-row:hover { background: var(--surface-2); }
.j-row.j-row-selected { background: var(--indigo-dim); }
.j-row:last-child { border-bottom: none; }

/* Delete button in row */
.trade-del-btn {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--red);
  padding: 4px;
  border-radius: 4px;
  transition: opacity .15s;
}
.j-row:hover .trade-del-btn { opacity: 1; }

/* ── Cell classes ── */
.j-dash { color: var(--text-3); }

.j-cell-date { font-size: 12px; color: var(--text-1); }
.j-cell-time { font-size: 10px; color: var(--text-3); }

.j-cell-instrument { font-size: 13px; font-weight: 600; color: var(--text-1); }

.j-dir-badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  display: inline-block;
}
.j-dir-long {
  background: rgba(74,222,128,.12);
  color: #4ADE80;
  border: 1px solid rgba(74,222,128,.25);
}
.j-dir-short {
  background: rgba(248,113,113,.12);
  color: #F87171;
  border: 1px solid rgba(248,113,113,.25);
}
[data-theme="light"] .j-dir-long {
  background: rgba(5,150,105,.08);
  color: #059669;
  border-color: rgba(5,150,105,.25);
}
[data-theme="light"] .j-dir-short {
  background: rgba(220,38,38,.08);
  color: #DC2626;
  border-color: rgba(220,38,38,.25);
}

.j-cell-mono {
  font-family: var(--fm);
  font-size: 12px;
  color: var(--text-2);
}

.j-cell-pnl {
  font-family: var(--fm);
  font-size: 13px;
  font-weight: 600;
}
.j-pnl-pos { color: #4ADE80; }
.j-pnl-neg { color: #F87171; }
.j-pnl-zero { color: var(--text-3); }
[data-theme="light"] .j-pnl-pos { color: #059669; }
[data-theme="light"] .j-pnl-neg { color: #DC2626; }

.j-cell-session {
  font-size: 11px;
  text-transform: capitalize;
  font-weight: 500;
}
.j-session-london { color: #7C6FE0; }
.j-session-ny { color: #3B82F6; }
.j-session-asia { color: #F59E0B; }
.j-session-overlap { color: #10B981; }

.j-cell-setup {
  font-size: 11px;
  color: var(--text-2);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 4px;
}

.j-cell-emo {
  display: flex;
  align-items: center;
  gap: 5px;
}
.j-emo-track {
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.j-emo-val {
  font-family: var(--fm);
  font-size: 10px;
}

.j-cell-default {
  font-size: 12px;
  color: var(--text-2);
}

.j-empty-sub {
  font-size: 12px;
  color: var(--text-3);
}

/* ── Journal mobile table ── */
@media (max-width: 768px) {
  .j-table { font-size: 11px; }
  .j-th { padding: 8px 10px; font-size: 9px; }
  .j-td { padding: 8px 10px; }
  .j-cell-instrument { font-size: 12px; }
  .j-cell-pnl { font-size: 12px; }

  /* ── Journal toolbar — mobile rework ── */
  .j-toolbar-wrap {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .j-toolbar-actions {
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: flex-start !important;
    width: 100% !important;
  }
  .j-toolbar-actions .j-col-btn {
    font-size: 11px;
    padding: 5px 9px;
  }
  .j-toolbar-actions .btn-sm {
    font-size: 11px;
    padding: 5px 9px;
    white-space: nowrap;
  }
}

/* ── Image Lightbox ──────────────────────── */
.j-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fadeIn 0.15s ease;
}
.j-lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  object-fit: contain;
  cursor: default;
}
.j-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--fast);
}
.j-lightbox-close:hover { opacity: 1; }

/* ═══════════════════════════════════════════
   COLUMN PICKER MODAL — Theme-aware
   ═══════════════════════════════════════════ */
.j-colpicker-modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  width: min(580px, calc(100vw - 32px));
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
}

.j-colpicker-search {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px 9px 36px;
  font-size: 13px;
  color: var(--text-1);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.j-colpicker-search:focus { border-color: var(--indigo); }
.j-colpicker-search::placeholder { color: var(--text-3); }

.j-colpicker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
}
.j-colpicker-item:hover { background: var(--surface-2); }
.j-colpicker-item.active {
  border-color: rgba(124,111,224,.3);
  background: var(--indigo-dim);
}

.j-colpicker-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.j-colpicker-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-2);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}
.j-colpicker-check.active {
  border-color: #7C6FE0;
  background: #7C6FE0;
}
