/* ═══════════════════════════════════════════════════════════════
   CfgLoot Editor — stylesheet
   Inherits design language from the main site / trader editor
   ═══════════════════════════════════════════════════════════════ */

/* ── Base / reset ─────────────────────────────────────────────── */
:root {
  --bg:            #0d0d0d;
  --surface:       #161616;
  --surface2:      #1e1e1e;
  --surface3:      #252525;
  --border:        #2a2a2a;
  --border-hi:     #3a3a3a;
  --text:          #d4d4d4;
  --text-muted:    #777;
  --accent:        #4e8a2e;
  --accent-hover:  #5ea336;
  --accent-dim:    rgba(78,138,46,0.15);
  --danger:        #8b1e1e;
  --danger-hover:  #a62828;
  --radius:        6px;
  --shadow:        0 2px 12px rgba(0,0,0,0.5);

  /* loot type colours */
  --type-none:     #555;
  --type-group:    #4a90d9;
  --type-weapon:   #c97b2a;
  --type-magazine: #7bbf4e;
  --type-pile:     #9b6fcf;
  --type-backpack: #d4934e;
  --type-vehicle:  #4eb8d4;
  --type-container:#e0b44a;
  --type-custom:   #d45e5e;
}
[data-theme="light"] {
  --bg: #f4f4f4; --surface: #fff; --surface2: #f0f0f0; --surface3: #e8e8e8;
  --border: #ddd; --border-hi: #bbb; --text: #1a1a1a; --text-muted: #666;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); }

/* ── Tool header ──────────────────────────────────────────────── */
.tool-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}
.tool-header-inner {
  max-width: 1600px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.tool-header-title { display: flex; align-items: center; gap: 0.8rem; }
.tool-header-icon  { font-size: 2rem; line-height: 1; }
.tool-header-title h1 { font-size: 1.3rem; font-weight: 700; }
.tool-header-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.tool-header-link {
  font-size: 0.82rem; color: var(--text-muted);
  text-decoration: none; padding: 0.3rem 0.7rem;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.tool-header-link:hover { border-color: var(--border-hi); color: var(--text); }

/* ── Main layout ──────────────────────────────────────────────── */
main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card h2 {
  font-size: 1rem; font-weight: 700; margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.card-desc {
  font-size: 0.84rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.6;
}
.card-desc code {
  background: var(--surface3); padding: 1px 5px; border-radius: 3px; font-size: 0.85em;
}
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 0.75rem; font-weight: 700;
  flex-shrink: 0;
}
.hidden { display: none !important; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.3em;
  padding: 0.45rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--border-hi); background: var(--surface2);
  color: var(--text); font-size: 0.82rem; font-family: inherit;
  cursor: pointer; user-select: none; transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface3); border-color: #555; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger  { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm  { padding: 0.22rem 0.6rem !important; font-size: 0.76rem !important; }
.btn-lg  { padding: 0.6rem 1.4rem; font-size: 0.95rem; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

/* ── Import ───────────────────────────────────────────────────── */
.import-grid { display: grid; gap: 1rem; }
.drop-zone {
  border: 2px dashed var(--border-hi);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent); background: var(--accent-dim);
}
.drop-icon  { font-size: 2.4rem; margin-bottom: 0.5rem; }
.drop-label { font-weight: 600; margin-bottom: 0.25rem; }
.drop-hint  { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }

.import-status {
  margin-top: 0.75rem; padding: 0.6rem 0.9rem;
  border-radius: var(--radius); font-size: 0.83rem;
  background: var(--surface2); border: 1px solid var(--border);
}
.import-status.ok    { border-color: var(--accent); color: #7bd45e; }
.import-status.error { border-color: var(--danger);  color: #e07070; }

/* ── Editor layout ────────────────────────────────────────────── */
.editor-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: calc(100vh - 300px);
  min-height: 480px;
}

/* Group / building editors need to fill the detail panel height */
#group-editor {
  display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
}
#group-editor .table-wrap {
  flex: 1; overflow-y: auto; min-height: 0;
}
#building-editor {
  flex: 1; overflow-y: auto;
}

/* ── Nav panel ────────────────────────────────────────────────── */
.nav-panel {
  background: var(--surface2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.nav-search-wrap {
  padding: 0.55rem;
  border-bottom: 1px solid var(--border);
}
.nav-search-wrap input {
  width: 100%; background: var(--surface3); border: 1px solid var(--border);
  border-radius: 4px; padding: 0.3rem 0.5rem; font-size: 0.8rem;
  color: var(--text); font-family: inherit;
}
.nav-search-wrap input:focus { outline: none; border-color: var(--accent); }
.nav-tabs {
  display: flex; border-bottom: 1px solid var(--border);
}
.nav-tab {
  flex: 1; padding: 0.45rem 0.5rem; font-size: 0.76rem; font-family: inherit;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); cursor: pointer; transition: color 0.12s;
}
.nav-tab:hover  { color: var(--text); }
.nav-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.nav-tree {
  overflow-y: auto; flex: 1; padding: 0.4rem 0;
}
.nav-group {
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  border-radius: 3px; margin: 1px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 0.4rem;
  user-select: none;
}
.nav-group:hover  { background: var(--surface3); }
.nav-group.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-group-file   { font-size: 0.7rem; color: var(--text-muted); margin: 0.3rem 0.7rem 0.1rem;
                    text-transform: uppercase; letter-spacing: 0.04em; }
.nav-group-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-muted);
}
.nav-group-dot.modified { background: var(--accent); }

/* ── Detail panel ─────────────────────────────────────────────── */
.detail-panel {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface);
}
.detail-empty {
  flex: 1; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 2.5rem;
  color: var(--text-muted); font-size: 0.9rem;
  text-align: center;
}
.detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.detail-header h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.detail-actions   { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.file-badge {
  display: inline-block; font-size: 0.7rem; color: var(--text-muted);
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 3px; padding: 0 5px; margin-top: 2px;
}

/* ── Chance bar ───────────────────────────────────────────────── */
.chance-bar-wrap {
  padding: 0.6rem 1rem 0;
}
.chance-bar {
  height: 10px; border-radius: 3px; overflow: hidden; background: var(--surface3);
  display: flex; margin-bottom: 0.35rem;
}
.chance-bar-seg {
  height: 100%; transition: width 0.2s;
}
.chance-legend {
  display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem;
  font-size: 0.7rem; color: var(--text-muted);
}
.chance-legend-item { display: flex; align-items: center; gap: 0.3rem; }
.chance-legend-dot  { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* ── Table ────────────────────────────────────────────────────── */
.table-wrap {
  flex: 1; overflow: auto; padding: 0 1rem 0.5rem;
}
.loot-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.8rem;
}
.loot-table th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface2); font-weight: 600;
  padding: 0.4rem 0.5rem; text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.loot-table td {
  padding: 0.28rem 0.5rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.loot-table tr:hover td { background: var(--surface2); }
.loot-table tr.drag-over td { border-top: 2px solid var(--accent); }

.col-drag    { width: 22px; }
.col-type    { width: 120px; }
.col-chance  { width: 80px; }
.col-class   { min-width: 160px; }
.col-extra   { min-width: 130px; }
.col-actions { width: 60px; text-align: right; }

.drag-handle {
  cursor: grab; color: var(--text-muted); font-size: 1rem;
  padding: 0 4px; user-select: none;
}
.drag-handle:active { cursor: grabbing; }

/* inline editable cells */
.cell-input {
  background: transparent; border: none; border-bottom: 1px solid transparent;
  color: var(--text); font-size: 0.8rem; font-family: inherit;
  width: 100%; min-width: 50px; padding: 1px 2px;
}
.cell-input:focus {
  outline: none; border-bottom-color: var(--accent);
  background: var(--surface3); border-radius: 2px;
}
.cell-select {
  background: var(--surface3); border: 1px solid var(--border);
  color: var(--text); font-size: 0.78rem; font-family: inherit;
  border-radius: 3px; padding: 1px 4px; cursor: pointer;
}
.cell-select:focus { outline: none; border-color: var(--accent); }

/* type pill */
.type-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.7rem; font-weight: 600; padding: 1px 6px;
  border-radius: 10px; white-space: nowrap; cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}
.type-pill:hover { filter: brightness(1.15); }

.row-delete {
  background: none; border: none; color: var(--text-muted); font-size: 1rem;
  cursor: pointer; padding: 2px 4px; border-radius: 3px;
}
.row-delete:hover { color: #e07070; background: rgba(200,50,50,0.1); }

/* ── Group stats ──────────────────────────────────────────────── */
.group-stats {
  padding: 0.4rem 1rem;
  font-size: 0.76rem; color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface2);
  display: flex; gap: 1.5rem; flex-wrap: wrap;
}
.group-stats span em { color: var(--text); font-style: normal; font-weight: 600; }

/* ── Building editor ──────────────────────────────────────────── */
.building-fields {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem; padding: 1rem;
}
.building-field { display: flex; flex-direction: column; gap: 0.25rem; }
.building-field label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.building-field input, .building-field select {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 0.85rem; font-family: inherit;
  border-radius: 4px; padding: 0.3rem 0.5rem;
}
.building-field input:focus, .building-field select:focus { outline: none; border-color: var(--accent); }
.building-zombies-section {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}
.building-zombies-section h4 { font-size: 0.82rem; font-weight: 700; margin: 0.75rem 0 0.5rem; }
.zombie-tags {
  display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem;
}
.zombie-tag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 12px; padding: 2px 8px; font-size: 0.75rem;
}
.zombie-tag button {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 0.85rem; padding: 0; line-height: 1;
}
.zombie-tag button:hover { color: #e07070; }

/* Position array info row */
.building-pos-info {
  padding: 0.4rem 1rem; font-size: 0.75rem; color: var(--text-muted);
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem;
  border-top: 1px solid var(--border);
}
.pos-info-label { margin-right: 0.2rem; }
.pos-count-badge {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 6px; font-size: 0.72rem;
  font-family: monospace; color: var(--text);
}

/* Zombie picker modal */
.modal-class-search {
  width: 100%; margin-top: 0.5rem; padding: 0.3rem 0.5rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text); font-size: 0.85rem;
  box-sizing: border-box; font-family: monospace;
}
.modal-class-search:focus { outline: none; border-color: var(--accent); }
.base-arma-label {
  display: flex; align-items: center; gap: 0.4rem;
  margin-top: 0.35rem; font-size: 0.78rem; color: var(--text-muted);
  cursor: pointer; user-select: none;
}
.base-arma-label input[type=checkbox] { cursor: pointer; }
.zombie-quick-cats {
  margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem;
  max-height: 260px; overflow-y: auto;
}
.zombie-cat-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.2rem;
}
.zombie-cat-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.zombie-chip {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 3px; padding: 2px 7px;
  font-size: 0.72rem; cursor: pointer; line-height: 1.6; font-family: monospace;
}
.zombie-chip:hover { background: var(--surface3); border-color: var(--accent); color: var(--text); }

/* ── Display names chips ──────────────────────────────────────── */
.dn-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 0.35rem;
}
.modal-class-search {
  flex: 1; min-width: 120px;
}
.dn-toggle { font-size: 0.76rem; padding: 2px 8px; }
.dn-toggle.active { border-color: var(--accent); color: var(--accent); }
.chip-has-dn {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  padding: 3px 7px; line-height: 1.3;
}
.chip-dn  { font-size: 0.74rem; color: var(--text); font-family: inherit; }
.chip-cn-sub { font-size: 0.62rem; color: var(--text-muted); font-family: monospace; }

/* Table display name cells */
.tbl-dn     { display: block; font-size: 0.82rem; color: var(--text); }
.tbl-cn-sub { display: block; font-size: 0.7rem; color: var(--text-muted); font-family: monospace; }

/* ── Display name stringtable upload ─────────────────────────── */
.dn-upload-section {
  margin-top: 0.75rem; border: 1px solid var(--border);
  border-radius: 6px; padding: 0;
}
.dn-upload-summary {
  padding: 0.45rem 0.75rem; cursor: pointer; font-size: 0.82rem;
  color: var(--text-muted); list-style: none; user-select: none;
}
.dn-upload-summary::-webkit-details-marker { display: none; }
.dn-upload-body {
  padding: 0.5rem 0.75rem 0.65rem; display: flex; align-items: center;
  flex-wrap: wrap; gap: 0.5rem;
}
.dn-upload-desc { font-size: 0.79rem; color: var(--text-muted); margin: 0 0.25rem 0 0; }
.dn-upload-btn {
  font-size: 0.77rem; padding: 3px 10px; cursor: pointer; display: inline-flex;
  align-items: center; gap: 0.3rem;
}
.dn-upload-status {
  font-size: 0.77rem; color: var(--accent); padding: 2px 0;
}
.zombie-picker-row { display: flex; gap: 0.5rem; }
.zombie-picker-row input { flex: 1; }
.modal-sm { width: 560px; max-width: 96vw; }

/* ── Export ───────────────────────────────────────────────────── */
.export-btns { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.export-info { font-size: 0.82rem; color: var(--text-muted); }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-hi);
  border-radius: var(--radius); box-shadow: var(--shadow);
  width: 480px; max-width: 96vw; padding: 1.25rem;
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.modal-body { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.modal-extras { display: flex; flex-direction: column; gap: 0.6rem; }
.field-row { display: flex; flex-direction: column; gap: 0.2rem; }
.field-row label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.field-row input, .field-row select {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 0.85rem; font-family: inherit;
  border-radius: 4px; padding: 0.35rem 0.5rem;
}
.field-row input:focus, .field-row select:focus { outline: none; border-color: var(--accent); }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ── Type colours ─────────────────────────────────────────────── */
.t0  { background: rgba(85,85,85,0.18);   color: var(--type-none);      border-color: #555; }
.t1  { background: rgba(74,144,217,0.18); color: var(--type-group);     border-color: #4a90d9; }
.t2  { background: rgba(201,123,42,0.18); color: var(--type-weapon);    border-color: #c97b2a; }
.t3  { background: rgba(123,191,78,0.18); color: var(--type-magazine);  border-color: #7bbf4e; }
.t4  { background: rgba(155,111,207,0.18);color: var(--type-pile);      border-color: #9b6fcf; }
.t5  { background: rgba(212,147,78,0.18); color: var(--type-backpack);  border-color: #d4934e; }
.t6  { background: rgba(78,184,212,0.18); color: var(--type-vehicle);   border-color: #4eb8d4; }
.t7  { background: rgba(224,180,74,0.18); color: var(--type-container); border-color: #e0b44a; }
.t8  { background: rgba(212,94,94,0.18);  color: var(--type-custom);    border-color: #d45e5e; }

/* bar segment colours */
.bs0 { background: var(--type-none); }
.bs1 { background: var(--type-group); }
.bs2 { background: var(--type-weapon); }
.bs3 { background: var(--type-magazine); }
.bs4 { background: var(--type-pile); }
.bs5 { background: var(--type-backpack); }
.bs6 { background: var(--type-vehicle); }
.bs7 { background: var(--type-container); }
.bs8 { background: var(--type-custom); }

/* ── Beta tag ────────────────────────────────────────────────── */
.beta-tag {
  display: inline-block; font-size: 0.45em; font-weight: 700;
  letter-spacing: 0.05em; background: #1a3a12; border: 1px solid #4a8a3a;
  color: #7fd460; border-radius: 3px; padding: 1px 5px;
  vertical-align: middle; line-height: 1.5; margin-left: 0.4em;
}

/* ── Help / instructions card ─────────────────────────────────── */
.help-card {
  padding: 0;
  overflow: hidden;
}
.help-summary {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 1rem 1.5rem; cursor: pointer; user-select: none;
  list-style: none;
}
.help-summary::-webkit-details-marker { display: none; }
.help-summary:hover { background: var(--surface2); }
.help-summary-icon   { font-size: 1.1rem; }
.help-summary-label  { font-size: 0.9rem; font-weight: 700; flex: 1; }
.help-summary-caret  {
  font-size: 0.65rem; color: var(--text-muted);
  transition: transform 0.15s;
}
details[open] .help-summary-caret { transform: rotate(180deg); }

.help-body {
  padding: 0 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
}
.help-cols {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding-top: 1rem;
}
@media (max-width: 900px) { .help-cols { grid-template-columns: 1fr; } }

.help-block-title {
  font-size: 0.82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.6rem;
}
.help-steps {
  padding-left: 1.1rem; font-size: 0.83rem; line-height: 1.75;
  color: var(--text);
}
.help-steps li { margin-bottom: 0.25rem; }
.help-steps code {
  background: var(--surface3); padding: 1px 5px; border-radius: 3px; font-size: 0.88em;
}

/* Loot type table inside help */
.help-type-table {
  width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.help-type-table th {
  text-align: left; padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted); font-weight: 600;
  white-space: nowrap;
}
.help-type-table td {
  padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.help-type-table tr:last-child td { border-bottom: none; }
.help-type-table code {
  background: var(--surface3); padding: 1px 4px; border-radius: 3px;
  font-size: 0.85em; white-space: nowrap;
}

/* Tips row */
.help-tips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.help-tip {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.6rem 0.75rem;
  font-size: 0.8rem; line-height: 1.6; color: var(--text-muted);
  display: flex; gap: 0.5rem;
}
.help-tip strong { color: var(--text); }
.help-tip p { margin: 0; }
.help-tip-icon { flex-shrink: 0; font-size: 1rem; line-height: 1.4; }

/* ── Nav search row (search input + mode toggle) ─────────────── */
.nav-search-row {
  display: flex; gap: 4px; align-items: center;
}
.nav-search-row input { flex: 1; }
.nav-search-mode-btn {
  flex-shrink: 0;
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-muted);
  font-size: 0.85rem; cursor: pointer; padding: 3px 6px;
  line-height: 1; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.nav-search-mode-btn:hover  { border-color: var(--accent); color: var(--text); }
.nav-search-mode-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* Match count badge shown in entry-search mode */
.nav-match-count {
  margin-left: auto; flex-shrink: 0;
  font-size: 0.65rem; font-weight: 700;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 8px;
  padding: 0 5px; line-height: 1.5;
}

/* ── Sort select ──────────────────────────────────────────────── */
.sort-select {
  background: var(--surface3); border: 1px solid var(--border);
  color: var(--text); font-size: 0.76rem; font-family: inherit;
  border-radius: 4px; padding: 3px 6px; cursor: pointer;
}
.sort-select:focus { outline: none; border-color: var(--accent); }

/* ── Cross-reference links ────────────────────────────────────── */
.xref-link {
  color: var(--type-group); text-decoration: none;
  border-bottom: 1px dashed currentColor; padding-bottom: 1px;
  font-size: inherit;
}
.xref-link:hover { color: #7ab8f5; border-bottom-style: solid; }
.xref-missing {
  color: var(--type-custom); opacity: 0.8;
  border-bottom: 1px dashed currentColor; padding-bottom: 1px;
  font-size: inherit; cursor: help;
}

/* ── Validate panel ───────────────────────────────────────────── */
.validate-panel {
  margin-top: 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 1rem; font-size: 0.82rem;
  max-height: 320px; overflow-y: auto;
}
.validate-ok {
  color: #7bd45e; display: flex; align-items: center; gap: 0.4rem;
}
.validate-header {
  color: #e09050; font-weight: 600; margin-bottom: 0.5rem;
}
.validate-error {
  padding: 0.25rem 0; border-bottom: 1px solid var(--border);
  display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap;
}
.validate-error:last-child { border-bottom: none; }
.validate-ref {
  font-weight: 700; color: var(--type-custom); white-space: nowrap;
  background: rgba(212,94,94,0.1); border-radius: 3px; padding: 0 4px;
}
.validate-error-msg { color: var(--text-muted); font-size: 0.79rem; }

/* ── Group ↔ Building cross-view ──────────────────────────────── */
.group-usedby {
  padding: 0.4rem 0.75rem 0.5rem;
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem;
}
.usedby-label { color: var(--text-muted); flex-shrink: 0; }
.building-jump-btn {
  background: var(--surface2); border: 1px solid var(--border-hi);
  color: var(--accent); border-radius: 3px; padding: 1px 7px;
  font-size: 0.75rem; cursor: pointer; line-height: 1.6;
}
.building-jump-btn:hover { background: var(--surface3); border-color: var(--accent); }

.loot-preview-box {
  margin: 0.75rem 0.75rem 0.5rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.loot-preview-missing {
  font-size: 0.8rem; padding: 0.6rem 0.75rem;
  color: var(--text-muted); background: var(--surface2);
}
.loot-preview-hdr {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2); padding: 0.35rem 0.7rem;
  font-size: 0.8rem; border-bottom: 1px solid var(--border);
}
.loot-preview-count {
  color: var(--text-muted); font-weight: 400; font-size: 0.73rem;
  margin-left: 0.4rem;
}
.loot-preview-table {
  width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.loot-preview-table td {
  padding: 2px 8px; border-bottom: 1px solid var(--border);
  color: var(--text);
}
.loot-preview-table tr:last-child td { border-bottom: none; }
.loot-preview-pct {
  text-align: right; color: var(--text-muted); width: 3.5rem;
}
.loot-preview-groupref { color: var(--accent); font-style: italic; }
.loot-preview-more {
  text-align: center; color: var(--text-muted); font-size: 0.73rem;
  padding: 3px 0 4px;
}

/* ── Demo banner + try block ──────────────────────────────────── */
.demo-try {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  margin-top: 0.75rem; padding: 0.5rem 0;
  font-size: 0.82rem; color: var(--text-muted);
}
.demo-try-or {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--border-hi); padding: 0 0.25rem;
}
.demo-try-desc { font-size: 0.76rem; }
.demo-banner {
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(78,138,46,0.10); border: 1px solid rgba(78,138,46,0.30);
  color: #8ed462; border-radius: var(--radius);
  padding: 0.45rem 0.9rem; font-size: 0.82rem; margin-bottom: 0.75rem;
}
.demo-banner a {
  color: #8ed462; text-decoration: underline;
}

/* ── Scrollbar styling ────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface2); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .editor-layout { grid-template-columns: 1fr; }
  .nav-panel { border-right: none; border-bottom: 1px solid var(--border); max-height: 220px; }
}
