/* ── Completionist page ──────────────────────────────── */
.comp-wrap {
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Station cards ───────────────────────────────────── */
.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.station-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.station-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.station-card-header h3 {
  font-size: 1.02rem;
  margin-bottom: 0.15rem;
}

.station-level-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  position: relative;
}

.station-level {
  font-size: 0.82rem;
  color: var(--muted);
}

.station-level.maxed {
  color: #8eff8e;
  font-weight: 600;
}

.edit-level-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  font-family: inherit;
}
.edit-level-btn:hover { background: var(--border); color: var(--text); }

/* ── Level-set popover ───────────────────────────────── */
.level-popover {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  width: 190px;
}
.level-popover.open { display: block; }
.level-popover p {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
  line-height: 1.35;
}
.level-popover-row {
  display: flex;
  gap: 0.4rem;
}
.level-popover input[type="number"] {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.4rem;
  font-family: inherit;
  font-size: 0.85rem;
}
.level-popover button {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
  font-family: inherit;
  white-space: nowrap;
}
.level-popover button:hover { background: var(--border); }

/* ── Requirements list ───────────────────────────────── */
.req-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 0.4em
}
.req-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 0.2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.req-list::-webkit-scrollbar { width: 5px; }
.req-list::-webkit-scrollbar-track { background: transparent; }
.req-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.req-item {
  position: relative;
  /*overflow: hidden;*/
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.req-item .req-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  opacity: 0.55;
  transition: width 0.15s;
}
.req-item .req-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
}
.req-item .req-icon-box {
  width: 24px; height: 24px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.req-item .req-icon {
  width: auto; height: auto;
  max-width: 24px; max-height: 24px;
  image-rendering: pixelated;
}
.req-item .req-name { font-weight: 600; }
.req-item .req-qty {
  color: var(--text);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.req-item.req-short .req-qty { color: #ff9999; font-weight: 600; }
.req-empty {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Card action buttons ─────────────────────────────── */
.station-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}
.station-card-actions button {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
  font-family: inherit;
}
.station-card-actions button:hover:not(:disabled) { background: var(--border); }
.station-card-actions button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ── Tabs + ore table (mirrors inventory page) ───────── */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tab-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}
.tab-btn:hover { background: var(--border); color: var(--text); }
.tab-btn.active {
  background: var(--border);
  color: var(--text);
  font-weight: 600;
  border-color: var(--muted);
}
.tab-divider {
  width: 1px;
  background: var(--border);
  align-self: stretch;
  margin: 0 0.1rem;
}

.section-panel { display: none; }
.section-panel.active { display: block; }
.section-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
}
.section-title-bar strong { font-size: 0.9rem; }

/* Horizontal-only scroll wrapper. The panel is never height-constrained —
   it always takes up exactly the vertical space its rows need. Only
   left/right scrolling happens here. The sticky rules below keep the
   ore-name column ("frozen" like a spreadsheet) and the header row
   visible while scrolling. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.ore-table {
  width: 100%;
  min-width: 700px; /* forces horizontal scroll instead of squishing on narrow screens */
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}
.ore-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 0.4rem 0.6rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.ore-table thead th.th-right { text-align: right; }
.ore-table thead th.th-center { text-align: center; }
.ore-table tbody tr:hover { background: rgba(255,255,255,0.025); }
[data-theme="light"] .ore-table tbody tr:hover { background: rgba(0,0,0,0.03); }
/* Border lives on the cells, not the row — a <tr> border isn't reliably
   painted once a sticky-positioned cell (the frozen name column) is
   involved, since the sticky cell paints above the row's own border. */
.ore-table td {
  padding: 0.32rem 0.6rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.ore-table tbody tr:last-child td { border-bottom: none; }

/* Freeze the first (ore name) column while horizontally scrolling.
   width:1% + white-space:nowrap makes this column shrink-wrap to its
   content instead of stretching wider than the name/icon needs. */
.ore-table td:first-child,
.ore-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--panel);
  width: 1%;
  white-space: nowrap;
}
/* Top-left corner cell sits above both sticky axes */
.ore-table thead th:first-child { z-index: 4; }

/* ── Sortable column headers (mirrors Inventory Viewer) ─ */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: color 0.1s ease;
}
.sortable-th:hover { color: var(--text); }
.sort-icon {
  display: inline-block;
  margin-left: 0.25rem;
  font-size: 0.75rem;
  opacity: 0.4;
  transition: opacity 0.1s ease;
}
.sortable-th:hover .sort-icon { opacity: 0.8; }
.sortable-th.active-sort { color: var(--text); font-weight: bold; }
.sortable-th.active-sort .sort-icon { opacity: 1; }

.td-center {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Fixed-width, consistently-sized ore buttons */
.ore-name-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: 160px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: 'Source Sans 3', 'Source Sans Pro', system-ui, sans-serif;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
}
.ore-name-btn .ore-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ore-icon-box {
  width: 26px; height: 26px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.ore-icon {
  width: auto; height: auto;
  max-width: 26px; max-height: 26px;
  image-rendering: pixelated;
  border-radius: 2px;
}
.td-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.td-muted { color: var(--muted); }
/*.td-focus { font-size: 0.98rem; font-weight: 800; }*/
.td-remaining { color: #ff9999; font-weight: 600; }
.td-remainder { color: #8eff8e; }
.table-empty {
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.data-notice { font-size: 0.8rem; color: var(--muted); }

/* ── Confirm modal ────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  width: 100%;
  max-width: 400px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-box h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.modal-box p { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
.modal-box ul {
  margin: 0.25rem 0 0.5rem 1.1rem;
  font-size: 0.85rem;
  color: var(--text);
  max-height: 35vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.modal-box .confirm-short { color: #ff9999; font-weight: 600; }
.confirm-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 0.6rem;
  cursor: pointer;
}
.confirm-checkbox-row input[type="checkbox"] {
  cursor: pointer;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.modal-actions button {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  font-family: inherit;
}
.modal-actions button:hover { background: var(--border); }
.modal-actions button.btn-primary {
  background: #1a3a1a; border-color: #2d6b2d; color: #8eff8e;
}
.modal-actions button.btn-primary:hover { background: #254825; }

/* ── Small toolbar (Compact View toggle) ─────────────── */
.comp-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
  font-family: inherit;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.toolbar-btn:hover { background: var(--border); }
.toolbar-btn.active-toggle {
  background: var(--border);
  border-color: var(--muted);
  font-weight: 600;
}

/* ── Compact mode ─────────────────────────────────────
   Only difference from the normal view: ore buttons drop their name
   label, becoming a square icon-only button (icon stays the same size
   as normal). The base ore-name-btn has a fixed 160px width for
   consistent columns in the normal view; that's overridden here since
   there's no name left to keep space for — everything else (fonts,
   row height, columns) stays exactly as it is outside compact mode. */
.comp-wrap.compact .ore-name-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  gap: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.comp-wrap.compact .ore-name-btn .ore-name-text {
  display: none;
}
