/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #3a3a3a;
  --bg-dark:     #2b2b2b;
  --bg-card:     #484848;
  --bg-hover:    #525252;
  --border:      #5c5c5c;
  --border-l:    #686868;
  --text:        #e4e4e4;
  --text-muted:  #9a9a9a;
  --accent:      #5b9bd5;
  --accent-h:    #4a87be;
  --accent-soft: #7eb8e8;  /* softer blue for links on dark (e.g. sprite URL instruction) */
  --danger:      #c0392b;
  --success:     #27ae60;

  /* gear tier colours */
  --c-pensalir:  #6B9EBE;
  --c-absolab:   #C84848;
  --c-arcane:    #9B59B6;
  --c-eternal:   #D4AF37;
}

html {
  overflow: auto;
  scroll-behavior: smooth;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  font-size: 13px;
  overflow: auto;
  /* No min-height: 100vh so document height = content height; avoids scrollable grey space at bottom */
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  background: var(--bg-dark);
  border-bottom: 2px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  user-select: none;
}
.site-header img {
  align-self: flex-start;
  display: block;
}
#siteHeaderIcon {
  height: 129px !important;
  width: 134px !important;
}
.site-header .site-title {
  margin: 0;
  align-self: flex-start;
}
.site-header svg { flex-shrink: 0; }
.site-title {
  font-size: 90px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text);
}
.site-title .title-beta {
  font-size: 0.14em;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 0.15em;
  vertical-align: 0.55em;
  letter-spacing: 0.05em;
}

/* ── Layout ───────────────────────────────────────────────── */
.main-content {
  padding: 18px 20px;
  min-height: 0;
  overflow: visible;
}

.controls {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  padding: 6px 15px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--accent);
  border-color: var(--accent);
}
.btn-primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 3px 9px; font-size: 11px; }
.sf-quick { padding: 3px 11px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border-l); border-radius: 4px;
  background: var(--bg-el); color: var(--text); cursor: pointer; line-height: 1.5; }
.sf-quick:hover { border-color: var(--accent); color: var(--accent); }
.sf-quick.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-icon {
  padding: 3px 7px;
  border-radius: 3px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: color .15s, background .15s;
  line-height: 1;
}
.btn-icon:hover { color: var(--text); background: var(--bg-hover); }
#toggleAllBtn { min-width: 9.5em; }

/* ── Character list ───────────────────────────────────────── */
#char-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ── Character section card ───────────────────────────────── */
.char-section {
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: auto;
  background: var(--bg-dark);
  transition: border-color .15s;
  width: fit-content;
  max-width: 100%;
  max-height: min(calc(100vh - 200px), 88vh);
}
/* Zebra: odd-indexed character cards have cell backings 15% darker (not text, icons, image, or gear) */
.char-section.zebra-odd { background: color-mix(in srgb, var(--bg-dark) 85%, black 15%); }
.char-section.zebra-odd .row-meta,
.char-section.zebra-odd .char-info-cell,
.char-section.zebra-odd .char-sprite-wrap,
.char-section.zebra-odd .char-sets-cell {
  background: color-mix(in srgb, var(--bg-card) 85%, black 15%);
}
.char-section.drag-over  { border-color: var(--accent); }
.char-section.drop-before { box-shadow: 0 -3px 0 1px var(--accent); }
.char-section.drop-after  { box-shadow: 0  3px 0 1px var(--accent); }

/* collapsed: hide full gear rows, show compact summary */
.char-section.collapsed .gear-rows      { display: none; }
.char-section.collapsed .gear-summary   { display: flex; flex: 1; min-height: 0; }
.char-section.collapsed .gear-summary .summary-row { flex: 1; min-height: 0; }
.char-section.collapsed .toggle-btn     { transform: rotate(-90deg); }
/* collapsed: strip info cell to name + class (with block icon) only */
.char-section.collapsed .char-level       { display: none; }
.char-section.collapsed .world-part       { display: none; }
.char-section.collapsed .legion-icons-row { display: none; }
.char-section.collapsed .symbols-row      { display: none; }
.char-section.collapsed .char-row       { min-height: 0; }
/* collapsed: fixed row height so only the sets column scrolls internally */
.char-section.collapsed .char-row        { min-height: 52px; height: 52px; }
/* Collapsed: sprite at top of column (no absolute centering; Tallahart row is hidden) */
.char-section.collapsed .char-sprite-wrap {
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.char-section.collapsed .char-sprite-inner {
  position: static;
  width: 100%;
}
.char-section.collapsed .char-sprite { max-height: none; height: auto; margin-top: 23px; }
.char-section.collapsed .char-sprite-placeholder { margin-top: 0; align-self: center; }
.char-section.collapsed .char-sprite-wrap .char-sprite[src*="Character_Self"] { margin-top: 23px; } /* matches other sprites when collapsed */
/* Collapsed: info middle fills cell so no lighter band at bottom; section clips to row height */
.char-section.collapsed .char-info-cell { min-height: 0; }
.char-section.collapsed .char-info-middle { flex: 1; min-height: 0; border-bottom: none; }
.char-section.collapsed { overflow: hidden; height: fit-content; max-height: none; }

/* ── Character row (top bar) ──────────────────────────────── */
.char-row {
  display: flex;
  align-items: stretch;
  min-height: 76px;
}

/* ── Left controls strip ──────────────────────────────────── */
.row-meta {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;   /* centers the drag handle */
  padding: 6px 4px;
  min-width: 28px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
/* toggle arrow stays pinned to the top of the strip */
.row-meta .toggle-btn {
  position: absolute;
  top: 6px;
}
/* collapsed: push hamburger/checkbox to the bottom so it doesn't crowd the arrow */
.char-section.collapsed .drag-handle,
.char-section.collapsed .row-select-cb {
  position: absolute;
  bottom: 6px;
}
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  padding: 2px;
  border-radius: 3px;
  transition: color .1s;
  position: relative;
}
.drag-handle:hover { color: var(--text); }
.drag-handle:active { cursor: grabbing; }
.handle-menu {
  position: fixed;
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border-l);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  min-width: 110px;
  overflow: hidden;
}
.handle-menu button {
  background: none;
  border: none;
  color: var(--text);
  font-size: 12px;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background .1s;
}
.handle-menu button:hover { background: var(--border); }
.handle-menu .menu-delete { color: var(--danger); }
.toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  transition: transform .2s, color .1s;
  line-height: 1;
}
.toggle-btn:hover { color: var(--text); }

/* ── Character info cell: top = Arcane symbols, middle = char info, bottom = Sacred symbols ── */
.char-info-cell {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0;
  min-width: 155px;
  width: 155px;
  max-width: 155px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.char-info-cell .arcane-symbols-row {
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--border);
}
.char-info-middle {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.char-info-cell .sacred-symbols-row {
  padding: 8px 10px 6px;
}

.char-text { min-width: 0; }
.char-name {
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.char-level { font-size: 15px; color: var(--text-muted); margin-top: 2px; }
.char-cls-world { font-size: 15px; color: var(--text-muted); margin-top: 1px; }
.char-cls-world .cls                    { color: #a9c9e8; }
.char-cls-world .cls[data-cls-cat="Warrior"] { color: #e07070; }
.char-cls-world .cls[data-cls-cat="Mage"]    { color: #a9c9e8; }
.char-cls-world .cls[data-cls-cat="Archer"]  { color: #6ecf6e; }
.char-cls-world .cls[data-cls-cat="Thief"]   { color: #c084fc; }
.char-cls-world .cls[data-cls-cat="Pirate"]  { color: #f5a623; }
.char-cls-world .cls[data-cls-cat="Xenon"]   { color: #22d3ee; }
.cls-line { display: flex; align-items: center; gap: 5px; }
.legion-icons-row { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.legion-block-icon { width: 18px; height: 18px; object-fit: contain; image-rendering: pixelated; flex-shrink: 0; }
.legion-tile-icon  { width: 75px; height: 75px; object-fit: contain; image-rendering: pixelated; }

/* Arcane / Sacred symbol rows (above and below character name), 3 per row */
.symbols-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  justify-items: center;
  gap: 6px;
  margin: 4px 0;
}
.symbol-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.symbol-cell.symbol-locked {
  opacity: 0.45;
  pointer-events: none;
}
.symbol-cell.symbol-locked .symbol-icon {
  pointer-events: auto;
}
.symbol-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}
.symbol-lv-wrap {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.symbol-lv {
  width: 2.2em;
  min-width: 24px;
  padding: 1px 2px;
  font-size: 12px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  -moz-appearance: textfield;
}
/* When symbol spinners are enabled (dev toggle), input joins spinner on the right */
body.symbol-spinners-enabled .symbol-lv-wrap .symbol-lv { border-right: none; border-radius: 3px 0 0 3px; }
.symbol-lv::-webkit-outer-spin-button,
.symbol-lv::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; appearance: none; }
.symbol-lv:disabled { cursor: not-allowed; }
.symbol-lv::placeholder { color: var(--text-muted); }
.symbol-spinner {
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 0 3px 3px 0;
  background: var(--bg-input, rgba(255,255,255,0.06));
  overflow: hidden;
}
body.symbol-spinners-enabled .symbol-spinner { display: flex; }
.symbol-spinner .symbol-btn {
  width: 16px;
  height: 11px;
  padding: 0;
  font-size: 8px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.symbol-spinner .symbol-btn:last-child { border-bottom: none; }
.symbol-spinner .symbol-btn:hover:not(:disabled) { background: var(--bg-hover, rgba(255,255,255,0.1)); color: var(--text); }
.symbol-spinner .symbol-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.symbol-btn:hover:not(:disabled) { background: var(--bg-hover, rgba(255,255,255,0.08)); }
.symbol-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.arcane-symbols-row { margin: 0; }
.sacred-symbols-row { margin: 0; }

/* ── Multi-select ──────────────────────────────────────────── */
.row-select-cb {
  display: none;
  width: 15px; height: 15px;
  margin-bottom: 4px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.multiselect-active .row-select-cb { display: block; }
.multiselect-active .drag-handle   { display: none; }

/* ── Delete confirmation grid ── */
.delete-confirm-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  margin: 12px 0;
}
.delete-confirm-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.delete-confirm-card .dc-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.delete-confirm-card .dc-cls {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #a9c9e8;
}
.delete-confirm-card .dc-cls img {
  width: 16px; height: 16px;
  object-fit: contain;
  flex-shrink: 0;
}

.multiselect-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-card);
  border-top: 2px solid var(--accent);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 200;
  box-shadow: 0 -4px 16px rgba(0,0,0,.4);
}
.multiselect-bar .ms-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-right: 6px;
  min-width: 100px;
}
.multiselect-bar .ms-spacer { flex: 1; }

/* ── Character sprite column: sprite at absolute center (ignoring Tallahart), Tallahart at bottom ── */
.char-sprite-wrap {
  width: 96px;
  flex-shrink: 0;
  align-self: stretch;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
}
.char-sprite-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.char-sprite-wrap .grand-sacred-symbols-row {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 6px 0;
  padding-bottom: 2px; /* manually lowered: less space above column bottom */
  grid-template-columns: 1fr;
  justify-items: center;
  width: 100%;
  z-index: 2;
}

/* ── Inner Ability Table ──────────────────────────────── */
.ia-table {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(3px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.ia-header {
  padding: 4px 6px;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgb(40, 40, 40, 0.8);
  color: #B4E500;
  border-bottom: 1px solid rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.ia-line-btn {
  display: block;
  width: 100%;
  min-height: 22px;
  padding: 4px 6px;
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  background: rgba(60, 60, 60, 0.7);
  color: var(--text);
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.ia-line-btn:last-child {
  border-bottom: none;
}

.ia-line-btn:hover:not(.ia-locked):not(.ia-configured) {
  background: rgba(80, 80, 80, 0.8);
}

.ia-line-btn.ia-configured {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.ia-line-btn.ia-configured:hover {
  filter: brightness(1.1);
}

.ia-line-btn.ia-locked {
  opacity: 0.4;
  cursor: not-allowed;
  font-style: italic;
}

/* ── IA Panel (floating) ──────────────────────────────── */
.ia-panel {
  position: fixed;
  z-index: 99999;
  display: flex;
  flex-direction: row;
  background: #252525;
  border: 1px solid var(--border-l);
  border-radius: 4px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.7);
  max-height: 400px;
}

.ia-panel-section {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-width: 100px;
  max-height: 400px;
  overflow-y: auto;
}

.ia-panel-section:last-child {
  border-right: none;
}

.ia-panel-opt {
  padding: 6px 12px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ia-panel-opt:last-child {
  border-bottom: none;
}

.ia-panel-opt:hover {
  background: rgba(255, 255, 255, 0.08);
}

.ia-panel-opt.ia-active {
  background: rgba(99, 179, 237, 0.12);
  font-weight: 600;
}

/* Collapsed state: hide IA table */
.char-section.collapsed .ia-table {
  display: none;
}
.char-sprite {
  max-width: 96px;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: bottom center;
  image-rendering: pixelated;
  display: block;
}
.char-sprite-placeholder {
  width: 96px;
  height: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

/* ── Sets column (after sprite, before gear) ──────────────────────── */
.char-sets-cell {
  width: 182px;
  min-width: 182px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 3px 8px;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}
/* When expanded, no top padding so Set Effects header aligns with Weapon row and the divider lines up */
.char-section:not(.collapsed) .char-sets-cell {
  padding-top: 0;
}
/* When collapsed, overflow only in this column: scroll inside the cell; align to top so 3+ lines can scroll to margin */
.char-section.collapsed .char-sets-cell {
  overflow-y: auto;
  min-height: 0;
  justify-content: flex-start;
}
.char-sets-cell .sets-line {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}
/* When collapsed: wrap only between set tags; match summary-chip font. Equidistant vertical spacing for up to two lines. */
.char-section.collapsed .char-sets-cell .sets-line {
  white-space: normal;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding-top: 1px;
  padding-bottom: 1px;
}
/* Rounded rectangle behind set name (complements text color; not a button) */
.char-sets-cell .set-tag {
  cursor: help;
  white-space: nowrap;
  display: inline-block;
  padding: 2px 4px;
  margin-bottom: 2px;
  border-radius: 3px;
  border: 1px solid transparent;
  font-size: 9px;
  transition: opacity .1s;
}
.char-sets-cell .set-tag:hover {
  opacity: 0.9;
}
/* Content below Set effects header: one cell, no extra box (aligns with slot-body) */
.char-sets-cell .sets-expanded {
  margin-top: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 4px 0 0 0;
}
/* Same metrics as .slot-header so the divider below aligns with gear headers (Weapon, Secondary, etc.) */
.char-sets-cell .sets-header {
  flex-shrink: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 4px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  margin: 0 -8px 0 -8px;
}
.char-section.collapsed .char-sets-cell .sets-header { display: none; }
.char-sets-cell .sets-expanded-header {
  display: none;
}
.char-section.collapsed .char-sets-cell .sets-expanded { display: none; }
/* When expanded, hide the collapsed summary line; expanded uses same inline wrapping as collapsed */
.char-section:not(.collapsed) .char-sets-cell .sets-line { display: none; }
/* Expanded: single wrapping line of set tags (same methodology as collapsed) */
.char-sets-cell .sets-expanded-line {
  white-space: normal;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding-top: 1px;
  padding-bottom: 1px;
}
.char-sets-cell .sets-total-cumulative-head {
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  margin-top: 6px;
  margin-bottom: 2px;
}
.char-sets-cell .sets-total-cumulative {
  font-size: 10px;
  color: var(--text-muted);
  padding-left: 8px;
  line-height: 1.3;
}
.char-sets-cell .sets-total-cumulative-line {
  margin-bottom: 1px;
}
.char-sets-cell .set-block {
  margin-bottom: 4px;
}
.char-sets-cell .set-block:last-child { margin-bottom: 0; }
.char-sets-cell .set-block-title {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 2px;
  cursor: help;
}
.char-sets-cell .set-cumulative-head {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.char-sets-cell .set-cumulative {
  font-size: 10px;
  color: var(--text-muted);
  padding-left: 8px;
  line-height: 1.3;
}
.char-sets-cell .set-cumulative-line {
  margin-bottom: 1px;
}

/* Sets tooltip (two columns: Set Effects | Cumulative) */
.sets-tooltip {
  display: none;
  position: fixed;
  z-index: 10000;
  flex-direction: row;
  flex-wrap: nowrap;
  background: var(--bg-card);
  border: 1px solid var(--border-l);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.4;
  max-width: 420px;
  pointer-events: none;
}
.sets-tooltip .sets-tt-col {
  flex: 0 1 auto;
  min-width: 140px;
  max-width: 200px;
  padding: 0 10px 0 0;
}
/* Vertical separator from Cumulative heading to last cumulative line */
.sets-tooltip .sets-tt-col:last-child {
  padding-right: 0;
  border-left: 1px solid var(--border);
  padding-left: 10px;
}
.sets-tooltip .sets-tt-head {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 11px;
}
.sets-tooltip .sets-tt-tier {
  font-weight: 600;
  color: var(--text);
  margin-top: 6px;
  margin-bottom: 2px;
  font-size: 10px;
}
.sets-tooltip .sets-tt-tier:first-of-type { margin-top: 0; }
.sets-tooltip .sets-tt-line {
  color: var(--text-muted);
  margin-bottom: 1px;
}

/* ── Gear content (wraps both expanded rows and collapsed summary) ── */
.gear-content {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Expanded: two scrollable rows of slot cards ─────────── */
.gear-rows {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.gear-row {
  display: flex;
  flex: 1;
  min-height: 0;
  width: max-content;
  overflow-x: auto;
  align-items: stretch;
  border-top: 1px solid var(--border);
}
.gear-row:first-child { border-top: none; }

.gear-slot {
  min-width: 115px;
  width: 115px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}
.gear-slot:last-child { border-right: 1px solid var(--border); }

/* Grey N/A badge shown when no item is selected */
.gear-badge-na {
  background: #3a3a4a !important;
  color: #666;
  border: 1px dashed #555;
}

/* Bottom slot when an Overall is equipped above it */
.gear-slot.slot-na {
  opacity: 0.45;
}
.gear-slot.slot-na select { pointer-events: none; }

/* ── Collapsed: compact colored-text summary ─────────────── */
.gear-summary {
  display: none;          /* toggled to flex when .collapsed */
  flex-direction: column;
  flex: 1;
}
.summary-row {
  display: flex;
  width: max-content;
  overflow-x: auto;
  align-items: stretch;
  border-top: 1px solid var(--border);
}
.summary-row:first-child { border-top: none; }
.summary-chip {
  min-width: 115px;
  width: 115px;
  flex-shrink: 0;
  box-sizing: border-box;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 6px;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  letter-spacing: 0.04em;
  cursor: default;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity .1s;
  display: flex;
  align-items: center;
}
.summary-chip.chip-none {
  color: var(--text-muted);
  opacity: 0.35;
}

.slot-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 4px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
}

.slot-body {
  padding: 6px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.gear-select {
  width: 100%;
  background-color: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 18px 3px 4px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23b0b0b0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
}
.gear-select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

/* Oz Ring level (1–6): wrapper + explicit chevron so arrow always visible */
.oz-level-wrap {
  position: relative;
  display: inline-block;
  width: 64px; /* match .gear-icon-wrap (rounded square above) */
}
.star-row select.oz-level-select {
  width: 100%;
  box-sizing: border-box;
  background-color: var(--bg);
  padding-right: 18px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.star-row select.oz-level-select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.oz-level-chevron {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  opacity: 0.9;
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Custom gear item dropdown ───────────────────────────── */
.gear-sel-wrap { position: relative; width: 100%; }
.gear-sel-disp {
  width: 100%; box-sizing: border-box;
  position: relative;
  background-color: var(--bg);
  color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 3px 14px 3px 4px; font-size: 11px; font-family: inherit;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-height: 20px;
  user-select: none; line-height: 1.4;
}
.gear-sel-disp .gear-sel-disp-text { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.gear-sel-disp .gear-sel-disp-chevron {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-size: 9px; opacity: 0.9; color: var(--text-muted);
  pointer-events: none;
}
.gear-sel-wrap.open .gear-sel-disp { outline: 1px solid var(--accent); border-color: var(--accent); }
.gear-sel-wrap.disabled .gear-sel-disp { opacity: 0.45; cursor: default; pointer-events: none; }
.gear-slot.slot-na .gear-sel-disp { pointer-events: none; }
.gear-sel-panel {
  position: fixed; z-index: 9999;
  background: #252525; border: 1px solid var(--border-l);
  border-radius: 4px; box-shadow: 0 4px 18px rgba(0,0,0,.7);
  display: none;
  font-size: 11px; font-family: inherit;
}
.gear-sel-panel.open { display: block; }
.gear-sel-opt { padding: 4px 10px; cursor: pointer; white-space: nowrap; }
.gear-sel-opt:hover { background: rgba(255,255,255,.08); }
.gear-sel-opt.sel-active { background: rgba(99,179,237,.12); }
.gear-sel-sep { height: 1px; background: var(--border); margin: 2px 0; }

/* Gear icon display */
.gear-icon-wrap {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.gear-icon-wrap.hidden { display: none; }

.gear-img {
  max-width: 64px;
  max-height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
}
.gear-badge {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: rgba(255,255,255,.9);
  letter-spacing: .5px;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
  border: 2px solid rgba(255,255,255,.15);
}

.star-row-wrap {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.star-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.star-row.hidden { display: none; }
.star-input {
  width: 40px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  text-align: center;
  font-size: 11px;
  font-family: inherit;
  padding: 2px 2px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.star-input::-webkit-inner-spin-button,
.star-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.star-input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.star-lbl { font-size: 10px; color: var(--text-muted); }

/* "None" placeholder text */
.none-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.none-text.hidden { display: none; }

/* ── Continues cell ───────────────────────────────────────── */
.continues-cell {
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  flex-shrink: 0;
}

/* ── Bottom add row ───────────────────────────────────────── */
.add-row {
  margin-top: 10px;
  padding: 4px 0;
}
.add-char-dashed {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s, color .15s, background .15s;
}
.add-char-dashed:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(91,155,213,.06);
}

/* ── Class hover tooltip ──────────────────────────────────── */
#cls-tooltip {
  position: fixed; z-index: 9500;
  background: var(--bg-card); border: 1px solid var(--border-l);
  border-radius: 6px; padding: 10px 13px;
  min-width: 270px; max-width: 360px;
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
  pointer-events: none; font-size: 12px; line-height: 1.5;
  display: none;
}
#cls-tooltip.visible { display: block; }
.ctt-title   { font-weight: 700; font-size: 13px; color: var(--accent); margin-bottom: 7px; }
.ctt-title[data-cls-cat="Warrior"] { color: #e07070; }
.ctt-title[data-cls-cat="Mage"]    { color: #a9c9e8; }
.ctt-title[data-cls-cat="Archer"]  { color: #6ecf6e; }
.ctt-title[data-cls-cat="Thief"]   { color: #c084fc; }
.ctt-title[data-cls-cat="Pirate"]  { color: #f5a623; }
.ctt-title[data-cls-cat="Xenon"]   { color: #22d3ee; }
.ctt-section { margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--border); }
.ctt-label   { font-size: 10px; font-weight: 700; letter-spacing: .05em;
               text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.ctt-link-row { display: flex; align-items: flex-start; gap: 8px; }
.ctt-link-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 4px;
                 image-rendering: pixelated; }
.ctt-link-text { flex: 1; min-width: 0; }
.ctt-name    { font-weight: 600; font-size: 12px; }
.ctt-tag     { font-size: 10px; color: var(--text-muted); font-weight: 400;
               background: var(--bg-el); border-radius: 3px; padding: 0 4px;
               margin-left: 5px; vertical-align: middle; }
.ctt-effect  { color: var(--text); margin-top: 1px; }
.ctt-muted   { color: var(--text-muted); font-style: italic; }
.cls[data-cls-tooltip] { cursor: help; }

/* ── Modal ────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}
.overlay.hidden { display: none; }
.hidden { display: none; }

.modal {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 440px;
  max-width: 100%;
  padding: 24px;
  animation: slide-in .18s ease;
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
}

.form-row { margin-bottom: 13px; }

/* Accessory preset multi-select (checkboxes in preset order) */
.accessory-preset-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  position: relative;
}
.accessory-preset-checks .accessory-preset-check { margin-bottom: 0; }
.import-acc-presets-cell {
  position: relative;
  vertical-align: middle;
}
.import-acc-presets-cell .acc-preset-multi-trigger {
  width: 100%;
  min-width: 100px;
  text-align: left;
}
.acc-preset-multi-panel {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 2px;
  min-width: 100%;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 100;
}
/* Form/modal accessory panel: match Class picker panel (same bg as trigger) */
.acc-preset-multi-panel.form-dropdown-panel {
  background: var(--bg-dark);
  border-color: var(--border-l);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.acc-preset-multi-panel.hidden { display: none; }
.acc-preset-multi-option:hover { background: rgba(255,255,255,0.06); }
.preset-list-divider {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 6px 8px 2px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  width: 100%;
  pointer-events: none;
}
.preset-list-divider-custom {
  border-top: none;
  margin-top: 0;
  opacity: 0.85;
}
.form-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.form-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}
.form-input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.sprite-instruction-link { color: var(--accent-soft); text-decoration: none; }
.sprite-instruction-link:hover { color: var(--accent); text-decoration: underline; }

/* Gear preset custom dropdown: same as Class picker (button + panel, ▼ chevron) */
.gear-preset-dropdown-wrap {
  position: relative;
  width: 100%;
}
.gear-preset-dropdown-wrap select {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  font-size: 13px;
}
.gear-preset-dropdown-wrap .gear-preset-trigger {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 7px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-family: inherit;
}
.gear-preset-dropdown-wrap .gear-preset-trigger:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.gear-preset-dropdown-wrap .gear-preset-trigger .gear-preset-text.picker-placeholder { color: var(--text-muted); }
.gear-preset-dropdown-wrap .gear-preset-trigger .gear-preset-chevron { opacity: .5; font-size: 10px; }
.gear-preset-panel {
  position: absolute;
  left: 0; right: 0;
  background: var(--bg-dark);
  border: 1px solid var(--border-l);
  border-radius: 6px;
  padding: 8px 0;
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.gear-preset-panel.hidden { display: none; }
.gear-preset-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gear-preset-option:hover { background: rgba(255,255,255,0.08); }
.gear-preset-panel .preset-list-divider { margin-top: 4px; padding-top: 6px; }
.form-dropdown:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
/* Accessory preset trigger in forms: match Class/Gear dropdown exactly (bg, font, border) */
.accessory-preset-checks .acc-preset-multi-trigger {
  width: 100%;
  min-width: 100px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--bg-dark) !important;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  min-height: 34px;
}
.accessory-preset-checks .acc-preset-multi-trigger .acc-preset-trigger-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: inherit;
  font-size: 13px;
}
.accessory-preset-checks .acc-preset-multi-trigger .acc-preset-trigger-chevron {
  opacity: .5;
  font-size: 10px;
  flex-shrink: 0;
}
.accessory-preset-checks .acc-preset-multi-trigger .acc-preset-trigger-text.picker-placeholder { color: var(--text-muted); }

.lookup-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.lookup-status {
  font-size: 11px;
  color: var(--text-muted);
  min-height: 16px;
  margin-top: 5px;
}
.lookup-status.ok  { color: var(--success); }
.lookup-status.err { color: var(--danger); }
.lookup-status.loading { color: var(--accent); }

/* Character preview in modal – match .char-section / .char-row cell visuals */
.char-preview {
  display: flex;
  align-items: stretch;
  min-height: 76px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin: 10px 0 14px;
}
.char-preview.hidden { display: none; }
.char-preview-sprite-wrap {
  width: 96px;
  min-width: 96px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
}
.char-preview-sprite-wrap .preview-img {
  width: auto;
  height: auto;
  max-width: 96px;
  max-height: 100%;
  object-fit: contain;
  object-position: bottom center;
  image-rendering: pixelated;
  display: block;
}
.char-preview-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 10px;
  min-width: 135px;
  background: var(--bg-card);
  flex: 1;
}
.char-preview-info .char-text { min-width: 0; }
.char-preview-info .char-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ── Class Picker ─────────────────────────────────────────── */
.class-picker-btn {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 7px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.class-picker-btn:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.class-picker-btn .picker-placeholder { color: var(--text-muted); }

/* Wrapper for in-form Class/World pickers so the panel opens under the button */
.picker-dropdown-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 420px;
}
.picker-dropdown-wrap .class-picker-panel {
  top: 100%;
  margin-top: 4px;
}

.class-picker-panel {
  position: absolute;
  left: 0;
  width: 100%;
  max-width: 420px;
  background: var(--bg-dark);
  border: 1px solid var(--border-l);
  border-radius: 6px;
  padding: 12px;
  z-index: 200;
  max-height: 380px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.class-picker-panel.hidden { display: none; }

.cp-search {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 6px 9px;
  font-size: 12px;
  margin-bottom: 10px;
}
.cp-search:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.cp-faction { margin-bottom: 10px; }
.cp-faction.hidden { display: none; }
.cp-faction-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.cp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}
.cp-class-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 11px;
  padding: 4px 6px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .12s, border-color .12s;
}
.cp-class-btn:hover  { background: var(--border); border-color: var(--border-l); }
.cp-class-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.floating-picker {
  position: fixed;
  z-index: 10002;
  min-width: 260px;
  max-width: 420px;
}
.floating-picker.hidden { display: none !important; }
.floating-picker .class-picker-panel {
  position: relative;
  left: auto;
  right: auto;
  max-height: 380px;
}

/* ── Inline picker trigger (table cells) ── */
.inline-picker-trigger {
  width: 100%;
  min-width: 100px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
  padding: 5px 8px;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inline-picker-trigger .inline-picker-trigger-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inline-picker-chevron {
  opacity: .5;
  font-size: 10px;
  flex-shrink: 0;
}
.inline-picker-trigger:hover { border-color: var(--border-l); }
.inline-picker-trigger.picker-placeholder { color: var(--text-muted); }
.inline-picker-trigger.picker-placeholder .inline-picker-trigger-text { color: inherit; }
/* Accessory preset trigger: same chevron style in import table */
.import-review-table .acc-preset-trigger-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.import-review-table .acc-preset-trigger-chevron { opacity: .5; font-size: 10px; flex-shrink: 0; }

/* ── Import Modal ─────────────────────────────────────────── */
.import-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 14px; }

/* Name list pane: spacing before/after character input to match modal style */
.import-name-list-pane .import-name-list-instruction {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.import-name-list-pane .import-name-list-textarea {
  margin-bottom: 14px;
  resize: vertical;
  min-height: calc(1.5em * 6 + 16px); /* match rows="6" so height can't be reduced below initial */
  max-height: min(320px, 40vh); /* cap height so review table below stays usable */
}
.import-name-list-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}
.import-tab-btn {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); padding: 7px 14px; cursor: pointer; font-size: 13px;
  margin-bottom: -1px; transition: color .12s, border-color .12s;
}
.import-tab-btn:hover  { color: var(--text); }
.import-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.import-dropzone {
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--border); border-radius: 6px; padding: 22px 16px;
  cursor: pointer; text-align: center; color: var(--text-muted); font-size: 13px;
  transition: border-color .15s, background .15s;
}
.import-dropzone:hover,
.import-dropzone.drag-over { border-color: var(--accent); background: rgba(99,179,237,.05); }

/* ── Import review section: spacing and visible results box ── */
.import-review-section { margin-top: 24px; }
.import-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.import-review-title { font-weight: 700; font-size: 13px; }
.import-review-select-all { font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.import-review-scroll {
  max-height: 320px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-l);
  border-radius: 6px;
  background: var(--bg-card);
  padding: 0;
}
.import-review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }

.import-review-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.import-review-table th {
  background: var(--bg-dark);
  padding: 8px 6px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
}
/* Explicit column widths: checkbox minimal (name next to it), level/class close, stars/status no overlap */
.import-review-table th:nth-child(1),
.import-review-table td:nth-child(1) { width: 34px; padding-left: 6px; padding-right: 2px; }
.import-review-table th:nth-child(2),
.import-review-table td:nth-child(2) { width: 120px; padding-left: 2px; padding-right: 6px; }
.import-review-table th:nth-child(3),
.import-review-table td:nth-child(3) { width: 64px; padding-left: 6px; padding-right: 6px; }
.import-review-table th:nth-child(4),
.import-review-table td:nth-child(4) { width: 140px; padding-left: 6px; padding-right: 6px; }
.import-review-table th:nth-child(5),
.import-review-table td:nth-child(5) { width: 100px; padding-left: 6px; padding-right: 6px; }
.import-review-table th:nth-child(6),
.import-review-table td:nth-child(6) { width: 130px; padding-left: 6px; padding-right: 6px; }
.import-review-table th:nth-child(7),
.import-review-table td:nth-child(7) { width: 130px; padding-left: 6px; padding-right: 6px; }
.import-review-table th:nth-child(8),
.import-review-table td:nth-child(8) { width: 260px; padding-left: 6px; padding-right: 8px; min-width: 0; }
.import-review-table th:nth-child(9),
.import-review-table td:nth-child(9) { width: 82px; padding-left: 6px; padding-right: 8px; }
.import-review-table td { padding: 6px; padding-left: 6px; padding-right: 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.import-review-table td:nth-child(1) { padding-left: 6px; padding-right: 2px; }
.import-review-table td:nth-child(2) { padding-left: 2px; }
.import-review-table tr.row-exists td { opacity: 0.4; }
.import-review-table td:nth-child(4) .inline-picker-trigger,
.import-review-table td:nth-child(5) .inline-picker-trigger { max-width: 100%; box-sizing: border-box; }
.import-review-table td:nth-child(8) { overflow: hidden; }
.import-review-table td:nth-child(8) .stars-cell { min-width: 0; overflow: hidden; }
.import-review-table input[type=text],
.import-review-table input[type=number]:not(.stars-type-input) {
  width: 100%; background: transparent; border: none; color: inherit;
  font-size: 12px; padding: 0; outline: none;
}
.import-review-table input[type=number]:not(.stars-type-input) { width: 50px; }
.import-review-table select {
  background: var(--bg-dark); border: 1px solid var(--border); color: var(--text);
  font-size: 11px; padding: 2px 4px; border-radius: 3px; max-width: 100%; width: 100%; box-sizing: border-box;
}
/* Gear Preset: wrapper + custom chevron (hide native select arrow) */
.import-gear-preset-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.import-gear-preset-wrap select {
  flex: 1;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 22px;
  background: var(--bg);
  font-size: 12px;
  padding-top: 5px;
  padding-bottom: 5px;
  padding-left: 8px;
  border-radius: 4px;
}
.import-gear-preset-chevron {
  position: absolute;
  right: 8px;
  pointer-events: none;
  opacity: .5;
  font-size: 10px;
}
/* ── Mass Edit table overrides ── */
.mass-edit-table td { padding: 6px 12px; }
.mass-edit-table th { padding: 8px 12px; }
.mass-edit-table select { max-width: none; width: 100%; font-size: 12px; padding: 3px 6px; }
.mass-edit-table input[type=text]  { font-size: 13px; }
/* Level column number input only (not Stars) */
.import-review-table td:nth-child(3) input[type=number],
.mass-edit-table td:nth-child(2) input[type=number] { width: 52px; font-size: 13px; }

/* ── sf-quick buttons inside tables (compact) ── */
.import-review-table .sf-quick,
.mass-edit-table     .sf-quick { padding: 2px 7px; font-size: 11px; }
.stars-cell { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; white-space: nowrap; min-width: 0; }
/* Stars type box: same as Add/Edit (18, 22, then number input with spinner) - must look like a real input box */
.stars-type-input,
.import-review-table .stars-type-input,
.mass-edit-table .stars-type-input {
  width: 65px !important;
  min-width: 65px !important;
  cursor: text;
  text-align: center;
  box-sizing: border-box;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
}
.stars-cell .stars-type-input { flex-shrink: 0; }
.stars-type-input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
#presetStarsCount,
#inputStarsCount,
#starsModalInput { cursor: text; text-align: center; }
/* Import modal: wide layout for table, not narrow like other modals */
.import-modal {
  width: min(1150px, 92vw);
  max-width: none;
  min-width: 680px;
}
.import-modal .form-input { min-width: 0; }
.badge-new    { color: var(--success); font-size: 10px; font-weight: 700; }
.badge-exists { color: var(--text-muted); font-size: 10px; }

/* ── Site footer ──────────────────────────────────────────── */
.site-footer {
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.footer-link:hover { color: var(--accent); }

/* ── Feedback modal ───────────────────────────────────────── */
.feedback-modal { max-width: 420px; }
.feedback-intro {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 1rem 0;
}
.feedback-field {
  margin-bottom: 0.75rem;
}
.feedback-field label { display: block; font-size: 12px; margin-bottom: 2px; color: var(--text-muted); }
.feedback-field .required { color: var(--danger); }
.feedback-field .form-input { width: 100%; box-sizing: border-box; }
.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
.feedback-status { font-size: 12px; margin: 0 0 0 0.5rem; }
.feedback-fallback-msg { font-size: 13px; color: var(--text-muted); }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-l); }

/* ── Tooltip-like title override ──────────────────────────── */
[title] { cursor: default; }

/* Legion Backup: only Export + Import buttons visible; file input is programmatic only. */
#backupOverlay .backup-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  margin-bottom: 10px;
}
#backupOverlay .modal-actions {
  margin-top: 12px;
}
.backup-file-input-hidden,
#backupFileInput {
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
}
