/* ===== Custom Fonts ===== */

@font-face {
  font-family: 'PlanetSide2';
  src: url('/fonts/PlanetSide2.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geo';
  src: url('/fonts/Geo-Md.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vera';
  src: url('/fonts/Vera.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vera';
  src: url('/fonts/VeraBd.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'VeraMono';
  src: url('/fonts/VeraMono.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'VeraMono';
  src: url('/fonts/VeraMoBd.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ===== CSS Variables ===== */

:root {
  --bg-primary: #040a14;
  --bg-secondary: #071427;
  --bg-tertiary: #0b1b33;
  --bg-hover: #123050;

    --text-primary: #e8edf3;     /* high-contrast off-white */
    --text-secondary: #9badc2;   /* readable blue-gray */
    --text-muted: #5f7389;       /* low-emphasis text */

    --accent-primary: #4ab3e8;
    --accent-secondary: #7ad8ff;
    --accent-glow: rgba(74, 179, 232, 0.28);

    --font-display: 'PlanetSide2', 'Geo', 'Vera', 'Inter', sans-serif;
    --font-body: 'Vera', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'VeraMono', 'JetBrains Mono', monospace;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --border-color: #1a3d63;
  --border-radius: 8px;
  --border-radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);

  --transition: all 0.2s ease;

  --stat-oq: #22c55e;
  --stat-cd: #3b82f6;
  --stat-dr: #f59e0b;
  --stat-fl: #ec4899;
  --stat-hr: #ef4444;
  --stat-ma: #8b5cf6;
  --stat-pe: #06b6d4;
  --stat-sr: #f97316;
  --stat-ut: #84cc16;
  --stat-cr: #6366f1;
  --stat-er: #14b8a6;
}

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

html {
  font-size: 14px;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 16% 18%, rgba(0, 160, 255, 0.08), transparent 40%),
    radial-gradient(circle at 84% 8%, rgba(80, 255, 160, 0.05), transparent 34%),
    linear-gradient(180deg, #040a14 0%, #030812 60%, #02070f 100%);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(102, 157, 209, 0.78) rgba(4, 17, 31, 0.9);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: rgba(4, 17, 31, 0.9);
  border-left: 1px solid rgba(26, 74, 118, 0.35);
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(92, 145, 196, 0.92), rgba(61, 110, 157, 0.9));
  border-radius: 8px;
  border: 2px solid rgba(4, 17, 31, 0.9);
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(122, 184, 242, 0.95), rgba(80, 141, 198, 0.92));
}

*::-webkit-scrollbar-corner {
  background: rgba(4, 17, 31, 0.9);
}

/* Display font for all headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
}

/* ===== Layout ===== */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: linear-gradient(180deg, rgba(7, 20, 35, 0.95), rgba(5, 16, 29, 0.9));
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: inset 0 0 0 1px rgba(16, 70, 118, 0.28);
}

.header-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
  text-decoration: none;
}

.header-logo-image {
  display: block;
  height: 52px;
  width: auto;
  max-width: min(36vw, 300px);
  object-fit: contain;
}

.nav {
  display: flex;
  gap: 8px;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: var(--transition);
}

.nav-btn:hover {
  background: rgba(74, 179, 232, 0.1);
  border-color: rgba(122, 216, 255, 0.26);
  color: var(--text-primary);
}

.nav-btn.active {
  background: linear-gradient(180deg, rgba(11, 50, 86, 0.82), rgba(6, 28, 49, 0.92));
  border-color: rgba(0, 190, 255, 0.74);
  box-shadow: inset 0 -2px 0 rgba(0, 190, 255, 0.62), 0 0 10px rgba(0, 160, 255, 0.25);
  color: #d8f3ff;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-radius: 20px;
  font-size: 0.85rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 2s infinite;
}

.status-dot.connected {
  background: var(--success);
  animation: none;
}

.status-dot.error {
  background: var(--danger);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.main {
  flex: 1;
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Views ===== */
.view {
  display: none;
}

.view.active {
  display: block;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.view-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

#resourcesView .view-header,
#schematicsView .view-header,
#itemsView .view-header,
#questsView .view-header,
#playerLookupView .view-header,
#cityLookupView .view-header,
#guildLookupView .view-header,
#marketplaceView .view-header,
#expertiseCalculatorView .view-header,
#profileView .view-header,
#petsView .view-header,
#logViewerView .view-header {
  display: none;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ===== Dashboard ===== */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-simple {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 24px 16px;
}

.dashboard-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dashboard-logo .logo-icon {
  font-size: 3rem;
  opacity: 0.9;
}

.dashboard-logo h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.dashboard-logo .logo-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.dashboard-chart-card {
  width: 100%;
  max-width: 900px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: linear-gradient(160deg, rgba(10, 26, 44, 0.88), rgba(9, 20, 35, 0.9));
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-glow);
}

.stat-icon {
  font-size: 2rem;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius);
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ===== Cards ===== */
.card {
  background: linear-gradient(160deg, rgba(8, 22, 38, 0.9), rgba(6, 16, 28, 0.92));
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 60, 120, 0.2);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, rgba(8, 24, 40, 0.92), rgba(6, 18, 30, 0.9));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.card-body {
  padding: 20px;
}

/* ===== Tables ===== */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: linear-gradient(180deg, rgba(15, 37, 59, 0.9), rgba(12, 29, 47, 0.88));
  font-weight: 600;
  color: #83b8de;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(74, 179, 232, 0.08);
}

.data-table tbody tr.clickable-row {
  cursor: pointer;
}

.data-table tbody tr.clickable-row:hover {
  background: var(--bg-hover);
  box-shadow: inset 3px 0 0 var(--accent-primary);
}

.data-table td.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

/* Stat cells */
.stat-cell {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
}

.stat-cell.high {
  color: var(--success);
  font-weight: 600;
}

.stat-cell.medium {
  color: var(--warning);
}

.stat-cell.low {
  color: var(--text-muted);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: linear-gradient(160deg, rgba(12, 33, 52, 0.86), rgba(10, 26, 43, 0.9));
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover {
  background: linear-gradient(160deg, rgba(15, 42, 66, 0.9), rgba(12, 33, 52, 0.92));
  border-color: rgba(112, 178, 228, 0.6);
}

.btn-primary {
  background: linear-gradient(180deg, rgba(14, 67, 112, 0.9), rgba(9, 44, 76, 0.94));
  border-color: rgba(107, 203, 255, 0.62);
  color: #d6f3ff;
}

.btn-primary:hover {
  background: linear-gradient(180deg, rgba(18, 82, 138, 0.92), rgba(12, 58, 99, 0.96));
  border-color: rgba(133, 223, 255, 0.75);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 6px 10px;
}

/* ===== Forms ===== */
.search-box {
  display: flex;
  gap: 8px;
}

.search-box input,
input[type="text"],
select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: linear-gradient(160deg, rgba(10, 25, 42, 0.9), rgba(8, 18, 30, 0.92));
  color: var(--text-primary);
  font-size: 0.9rem;
  min-width: 200px;
}

.search-box input:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ===== Resource Class Grid ===== */
.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.class-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.class-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.class-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.class-card-name {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  flex: 1;
  min-width: 0;
}

.class-card-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: auto;
}

.class-card-active {
  color: var(--success);
  font-weight: 500;
}

/* Resource Icons */
.resource-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
}

.resource-icon-lg {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.resource-class-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Resource name in tables */
.resource-name {
  font-size: 1.1rem;
  font-weight: 600;
}

/* ===== Advanced Stat Filters ===== */
.advanced-filters code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.stat-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.stat-filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  padding: 8px 12px;
  border-radius: var(--border-radius);
}

.stat-filter-item label {
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 28px;
  color: var(--accent-secondary);
}

.stat-filter-item select.stat-operator {
  width: 50px;
  min-width: 50px;
  padding: 6px;
  font-size: 0.85rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 4px;
}

.stat-filter-item input.stat-value {
  width: 80px;
  min-width: 60px;
  padding: 6px 8px;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 4px;
}

.stat-filter-item input.stat-value:focus,
.stat-filter-item select.stat-operator:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.stat-filter-item.active {
  border: 1px solid var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ===== Schematics ===== */
.schematics-list-card {
  margin-bottom: 16px;
}

.schematics-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.schematic-letter-btn {
  min-width: 26px;
  height: 24px;
  padding: 0 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  cursor: pointer;
}

.schematic-letter-btn:hover,
.schematic-letter-btn.active {
  border-color: var(--accent-primary);
  color: var(--accent-secondary);
  background: rgba(110, 231, 183, 0.08);
}

.schematic-index-table-wrap {
  max-height: 560px;
  overflow-y: auto;
}

.schematic-index-row.selected {
  background: rgba(110, 231, 183, 0.1);
}

.schematic-index-name {
  font-weight: 600;
  color: var(--text-primary);
}

.schematic-index-internal {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.schematic-workbench {
  margin-top: 16px;
}

.schematic-breadcrumb {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.schematic-workbench-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.schematic-hero-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1.5fr) minmax(200px, 1fr) minmax(200px, 1fr);
}

.schematic-hero-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 14px;
}

.schematic-hero-card h3,
.schematic-hero-card h4 {
  margin: 0 0 8px 0;
}

.schematic-hero-card p {
  margin: 0;
  color: var(--text-secondary);
}

.schematic-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.schematic-mini-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.schematic-mini-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.schematic-detail-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.schematic-tab-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
}

.schematic-tab-btn.active,
.schematic-tab-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-secondary);
}

.schematic-tab-pane {
  margin-top: 8px;
}

.schematic-detail-table .schematic-group-row td {
  background: rgba(15, 35, 30, 0.75);
  color: var(--accent-secondary);
  font-weight: 600;
}

.schematic-age-cell {
  font-size: 0.82rem;
  font-weight: 500;
}

.schematic-age-cell.active {
  color: var(--success);
}

.schematic-age-cell.historical {
  color: var(--text-muted);
}

@media (max-width: 1050px) {
  .schematic-hero-grid {
    grid-template-columns: 1fr;
  }
}

.slot-tag {
  font-size: 0.75rem;
  padding: 4px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
}

/* ===== Modal ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: linear-gradient(160deg, rgba(8, 21, 36, 0.94), rgba(5, 14, 24, 0.96));
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-content.modal-large {
  max-width: 900px;
}

.schematic-modal {
  max-width: min(960px, 92vw);
  max-height: 90vh;
}

.schematic-modal-body {
  padding: 28px 32px 32px;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

/* ===== Resource Detail ===== */
.resource-detail {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.resource-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.resource-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.resource-info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.resource-info-value {
  font-weight: 500;
}

.resource-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.resource-stat-item {
  background: var(--bg-tertiary);
  border-radius: var(--border-radius);
  padding: 12px;
  text-align: center;
}

.resource-stat-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.resource-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.resource-stat-bar {
  margin-top: 8px;
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  overflow: hidden;
}

.resource-stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ===== Schematic Detail ===== */
.schematic-detail {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.schematic-detail-header {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.schematic-info-column {
  flex: 1;
  min-width: 260px;
}

.schematic-description {
  margin-bottom: 20px;
  padding: 16px 18px;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  border-left: 3px solid var(--accent-primary);
}

.schematic-description p {
  color: var(--text-secondary);
  margin: 0;
  font-style: italic;
  line-height: 1.5;
}

.schematic-info-column .resource-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.schematic-model-column {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.schematic-slots-section {
  margin-top: 8px;
}

.schematic-slots-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 20px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.model-viewer-container {
  width: 320px;
  height: 320px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Viewer wrapper fills container so canvas + UV controls both fit inside fixed height */
.model-viewer-container .swg-model-viewer-wrapper {
  align-self: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* Responsive: stack on smaller screens */
@media (max-width: 700px) {
  .schematic-detail-header {
    flex-direction: column-reverse;
    align-items: center;
  }

  .schematic-model-column {
    width: 100%;
  }

  .model-viewer-container {
    width: 280px;
    height: 280px;
  }
}

.model-loading {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.schematic-slots {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.slot-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px 24px;
  min-width: 0;
}

.slot-card.slot-card-has-best {
  grid-template-columns: 1fr auto;
  gap: 24px 32px;
}

@media (max-width: 560px) {
  .slot-card.slot-card-has-best {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.slot-card-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.slot-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.slot-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.slot-quantity {
  font-size: 0.9rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.slot-resource-class {
  font-size: 0.9rem;
  color: var(--accent-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.slot-resource-class .resource-class-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.slot-ingredient-model {
  width: 100%;
  max-width: 200px;
}

.slot-model-viewer {
  width: 100%;
  height: 88px;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.slot-model-viewer canvas {
  max-width: 100%;
  max-height: 100%;
}

.model-loading-mini {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.slot-type-badge {
  font-size: 0.65rem;
  padding: 3px 8px;
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.slot-weights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weight-tag {
  font-size: 0.78rem;
  padding: 6px 10px;
  background: var(--bg-primary);
  border-radius: 6px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.slot-best-resources {
  min-width: 180px;
  padding: 14px 16px;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.slot-best-heading {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.best-resource {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.best-resource:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.best-resource:first-of-type {
  padding-top: 0;
}

.best-resource-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.best-resource-name {
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--accent-secondary);
}

.best-resource-name:hover {
  text-decoration: underline;
}

.best-resource-score {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--success);
  margin-top: 2px;
}

.best-resource-inactive {
  color: var(--text-muted);
}

/* ===== Status Badge ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.status-badge.inactive {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* ===== Loading ===== */
.loading {
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state-text {
  font-size: 1.1rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-logo-image {
    height: 42px;
    max-width: min(70vw, 260px);
  }

  .header-content {
    flex-wrap: wrap;
    height: auto;
    padding: 16px;
    gap: 16px;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .view-header {
    flex-direction: column;
    align-items: stretch;
  }

  .view-controls {
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .search-box input {
    flex: 1;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .resource-info {
    grid-template-columns: 1fr;
  }
}

/* ===== Login Screen ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1a2e 100%);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-image {
  display: block;
  margin: 0 auto;
  width: min(100%, 280px);
  height: auto;
  object-fit: contain;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-error {
  color: var(--danger);
  font-size: 0.9rem;
  text-align: center;
  min-height: 20px;
}

.btn-full {
  width: 100%;
  padding: 12px 24px;
  font-size: 1rem;
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== Hidden Class ===== */
.hidden {
  display: none !important;
}

/* ===== Main App ===== */
.main-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== User Menu ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.user-menu-btn {
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
.user-menu-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.user-menu-btn.active {
  background: var(--accent-primary);
  color: white;
}

/* ===== Admin Badge ===== */
.admin-badge {
  background: linear-gradient(135deg, var(--warning), #f97316);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ===== Admin Panel - Redesigned Layout ===== */

/* Top-level layout container */
.admin-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Full-width sections (stat bar, tables) */
.admin-section--full {
  width: 100%;
}

.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.admin-section-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Horizontal stat bar */
.admin-stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Main 3-column grid */
.admin-grid-main {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 1200px) {
  .admin-grid-main {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .admin-grid-main {
    grid-template-columns: 1fr;
  }
}

/* Column within the grid */
.admin-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Admin Card */
.admin-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
}

.admin-card--danger {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.04);
}

.admin-card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-card-header h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.admin-card-body {
  padding: 16px;
}

/* Admin buttons grid (wraps) */
.admin-btn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-btn-grid .btn {
  flex: 1 1 auto;
  min-width: 120px;
  font-size: 0.82rem;
  padding: 7px 12px;
  white-space: nowrap;
}

/* Admin button row */
.admin-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Inline form (input + btn) */
.admin-inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-input {
  flex: 1;
  min-width: 120px;
  padding: 7px 10px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 0.85rem;
  font-family: var(--font-body);
}

.admin-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Admin selects */
.admin-select {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 0.85rem;
}

.admin-select-sm {
  padding: 5px 8px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 0.8rem;
}

/* Form rows */
.admin-form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-form-row .admin-select {
  flex: 1;
}

.admin-form-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Mini stats block */
.admin-mini-stats {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Status line */
.admin-status-line {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Scroll box */
.admin-scroll-box {
  max-height: 260px;
  overflow-y: auto;
}

/* Hint text */
.admin-hint {
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* Admin header actions cluster */
.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Admin Stat Item (used inside admin-stat-bar and admin-stats grids) ===== */

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.admin-stat-item {
  background: var(--bg-tertiary);
  padding: 12px 14px;
  border-radius: var(--border-radius);
  text-align: center;
  flex: 1 1 140px;
  min-width: 120px;
}

.admin-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
  letter-spacing: 0.3px;
}

.admin-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}

.sync-status-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(95, 155, 255, 0.14);
}

#adminSyncStatus {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sync-status-row:last-child {
  border-bottom: 0;
}

.sync-status-label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.2;
  min-width: 84px;
}

.sync-status-value {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-primary);
  line-height: 1.25;
  text-align: right;
}

@media (max-width: 900px) {
  .sync-status-row {
    flex-direction: column;
    gap: 4px;
  }

  .sync-status-value {
    text-align: left;
  }
}

/* ===== Config Display ===== */
.config-display {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.config-section {
  margin-bottom: 16px;
}

.config-section-title {
  font-weight: 600;
  color: var(--accent-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.config-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius);
  margin-bottom: 4px;
}

.config-key {
  color: var(--text-secondary);
}

.config-value {
  color: var(--text-primary);
}

.config-value.path-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  max-width: 60%;
  text-align: right;
  word-break: break-all;
}

.path-status {
  flex-shrink: 0;
  font-weight: bold;
}

.path-exists .path-status {
  color: var(--success);
}

.path-missing .path-status {
  color: var(--danger);
}

.path-missing {
  color: var(--text-muted);
}

/* ===== Admin Actions ===== */
.admin-actions {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.action-group h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-warning {
  background: var(--warning);
  border-color: var(--warning);
  color: #000;
}

.btn-warning:hover {
  background: #d97706;
  border-color: #d97706;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.danger-zone {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--border-radius);
  padding: 16px;
}

.danger-warning {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* ===== Modal Variations ===== */
.modal-small {
  max-width: 400px;
}

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

/* ===== Admin Only ===== */
.admin-only {
  display: none;
}

.is-admin .admin-only {
  display: block;
}

/* Admin view sections should still respect the .view toggle */
.is-admin .view.admin-only {
  display: none;
}

.is-admin .view.admin-only.active {
  display: block;
}

.is-admin .nav .admin-only {
  display: inline-flex;
}

/* ===== Loading Button ===== */
.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--danger);
}

.toast.warning {
  border-color: var(--warning);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== Responsive Admin ===== */
@media (max-width: 768px) {
  .admin-grid-main {
    grid-template-columns: 1fr;
  }

  .admin-stat-bar {
    flex-direction: column;
  }

  .admin-form-row {
    flex-direction: column;
  }

  .admin-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .login-container {
    margin: 16px;
    padding: 24px;
  }

  .header-actions {
    flex-wrap: wrap;
  }

  .user-menu {
    order: 3;
    width: 100%;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
  }
}

/* ===== Item Lookup ===== */
.item-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.item-type-badge.weapon {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.item-type-badge.armor {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.item-type-badge.clothing {
  background: rgba(236, 72, 153, 0.2);
  color: #ec4899;
}

.item-type-badge.droid {
  background: rgba(139, 92, 246, 0.2);
  color: #8b5cf6;
}

.item-type-badge.vehicle {
  background: rgba(14, 165, 233, 0.2);
  color: #0ea5e9;
}

.item-type-badge.consumable {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.item-type-badge.component {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.item-type-badge.misc {
  background: rgba(107, 114, 128, 0.2);
  color: #6b7280;
}

/* Item Detail */
.item-detail {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.item-stats-section {
  background: var(--bg-tertiary);
  border-radius: var(--border-radius);
  padding: 16px;
}

.item-stats-section h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.item-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.item-stat {
  text-align: center;
  padding: 12px;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
}

.item-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.item-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.item-stat-value.damage {
  color: var(--danger);
}

.item-stat-value.armor {
  color: var(--info);
}

.item-stat-value.dps {
  color: var(--success);
}

.item-stat-value.speed {
  color: var(--warning);
}

/* Armor Resistances Grid */
.armor-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.armor-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
}

.armor-stat-icon {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.armor-stat-value {
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.armor-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pagination .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* DPS highlight */
.dps-cell {
  font-family: var(--font-mono);
  font-weight: 600;
}

.dps-cell.high {
  color: var(--success);
}

.dps-cell.medium {
  color: var(--warning);
}

.dps-cell.low {
  color: var(--text-muted);
}

/* Item comparison */
.compare-checkbox {
  cursor: pointer;
}

/* Responsive items */
@media (max-width: 768px) {
  .armor-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .item-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Error Tracking ===== */
.error-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.error-badge.has-errors {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.error-badge.no-errors {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.error-category-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.error-category-badge.schematic {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.error-category-badge.item {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.error-category-badge.resource {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.error-category-badge.general {
  background: rgba(107, 114, 128, 0.2);
  color: #6b7280;
}

.error-file-path {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-message {
  color: var(--danger);
  font-size: 0.85rem;
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-details-btn {
  padding: 2px 8px;
  font-size: 0.75rem;
  cursor: pointer;
}

.error-detail-section {
  margin-bottom: 16px;
}

.error-detail-section h4 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.error-detail-content {
  background: var(--bg-tertiary);
  padding: 12px;
  border-radius: var(--border-radius);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
}

.error-detail-content.file-path {
  color: var(--accent-secondary);
}

.error-detail-content.error-msg {
  color: var(--danger);
}

.error-detail-content.stack-trace {
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* ===== Enhanced Item Stats ===== */
.item-stat-value.damage {
  color: var(--danger);
  font-weight: 600;
}

.item-stat-value.speed {
  color: var(--accent-secondary);
}

.item-stat-value.dps {
  color: var(--warning);
  font-weight: 600;
}

.item-stat-value.armor {
  color: var(--info);
  font-weight: 600;
}

.item-stats-section h4 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  font-weight: 500;
}

.skill-mod-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-mod-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  font-size: 0.8rem;
}

.skill-mod-item .skill-name {
  color: var(--text-secondary);
}

.skill-mod-item .skill-value {
  font-weight: 600;
}

.skill-mod-item .skill-value.positive {
  color: var(--success);
}

.skill-mod-item .skill-value.negative {
  color: var(--danger);
}

/* ===== Quest Styles ===== */
.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  padding: 0 8px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #fff;
  font-weight: 600;
  border-radius: 4px;
  font-size: 0.9rem;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: capitalize;
}

.type-badge.type-solo {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.type-badge.type-group {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.type-badge.type-heroic {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
}

.type-badge.type-pvp {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.type-badge.type-unknown {
  background: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.quest-name {
  font-weight: 500;
  color: var(--text-primary);
}

.quest-id {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.quest-detail {
  max-height: 70vh;
  overflow-y: auto;
}

.quest-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.reward-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
}

.reward-icon {
  font-size: 1.2rem;
}

.reward-item.reward-choice {
  flex-direction: column;
  align-items: flex-start;
}

.penalty-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.task-item {
  transition: transform 0.2s, box-shadow 0.2s;
}

.task-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.tasks-list {
  max-height: 400px;
  overflow-y: auto;
}

#questTableBody tr {
  transition: background 0.15s ease;
}

#questTableBody tr:hover {
  background: var(--bg-hover);
}

/* ===== Map Zoom Controls ===== */
.map-zoom-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

.map-zoom-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 26, 45, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  font-family: var(--font-mono);
  user-select: none;
}

.map-zoom-btn:hover {
  background: rgba(99, 102, 241, 0.3);
  border-color: var(--accent-primary);
}

.map-zoom-btn:active {
  transform: scale(0.92);
}

.map-zoom-level {
  text-align: center;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  padding: 2px 0;
  user-select: none;
}

/* ===== Collapsible Sections ===== */
.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 12px 16px;
}

.collapsible-header:hover {
  background: var(--bg-hover);
}

.collapsible-header h2 {
  font-size: 1rem;
  margin: 0;
}

.collapsible-toggle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  display: inline-block;
}

.collapsible-toggle.collapsed {
  transform: rotate(-90deg);
}

.collapsible-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  max-height: 2000px;
  opacity: 1;
}

.collapsible-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* ===== Admin Button ===== */
.btn-admin-action {
  background: var(--accent-danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.15s ease;
}

.btn-admin-action:hover {
  background: #dc2626;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* ===== Admin Char Actions Modal ===== */
.admin-action-group {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.admin-action-group h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: var(--text-primary);
}

.admin-action-group .admin-action-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.admin-action-group .admin-action-row .field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 100px;
}

.admin-action-group .admin-action-row .field-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-action-group .admin-action-row .field-group input,
.admin-action-group .admin-action-row .field-group select {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-body);
}

.admin-action-group--danger {
  border-color: rgba(239, 68, 68, 0.3);
}

.admin-action-group--danger h3 {
  color: var(--accent-danger);
}

/* ===== Objvar Table ===== */
.objvar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.objvar-table th,
.objvar-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.objvar-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-weight: 600;
  background: var(--bg-tertiary);
  position: sticky;
  top: 0;
}

.objvar-table td:first-child {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-primary);
  word-break: break-all;
}

.objvar-table td:nth-child(2) {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.75rem;
}

.objvar-table td:last-child {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  word-break: break-all;
}

.objvar-table tr:hover {
  background: var(--bg-hover);
}

/* ===== Objvar Mappings List (Admin) ===== */
.mapping-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  gap: 8px;
}

.mapping-row:hover {
  background: var(--bg-hover);
}

.mapping-row .mapping-name {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mapping-row .mapping-label {
  color: var(--text-primary);
  flex: 1;
}

.mapping-row .mapping-category {
  color: var(--text-secondary);
  font-size: 0.7rem;
  flex: 0 0 80px;
  text-align: center;
}

.mapping-row .mapping-delete {
  cursor: pointer;
  color: var(--accent-danger);
  font-size: 0.7rem;
  padding: 2px 6px;
  border: 1px solid var(--accent-danger);
  border-radius: 4px;
  background: transparent;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.mapping-row .mapping-delete:hover {
  background: var(--accent-danger);
  color: #fff;
}

/* ===== Map Player Toggle (Cartographer) ===== */
.map-control-bar {
  flex-wrap: wrap;
  row-gap: 8px;
}

.map-planet-select {
  min-width: 160px;
  height: 32px;
  padding: 0 30px 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(0, 170, 255, 0.45);
  background: linear-gradient(160deg, rgba(8, 28, 46, 0.92), rgba(5, 18, 31, 0.95));
  color: #bfe4ff;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-shadow: inset 0 0 0 1px rgba(0, 60, 120, 0.25);
  background-image:
    linear-gradient(45deg, transparent 50%, #76cfff 50%),
    linear-gradient(135deg, #76cfff 50%, transparent 50%),
    linear-gradient(160deg, rgba(8, 28, 46, 0.92), rgba(5, 18, 31, 0.95));
  background-position:
    calc(100% - 14px) 13px,
    calc(100% - 9px) 13px,
    0 0;
  background-size:
    5px 5px,
    5px 5px,
    100% 100%;
  background-repeat: no-repeat;
}

.map-planet-select:hover {
  border-color: rgba(0, 210, 255, 0.66);
}

.map-planet-select:focus {
  border-color: rgba(120, 225, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(0, 170, 255, 0.2), inset 0 0 0 1px rgba(0, 90, 160, 0.35);
}

.map-planet-select option {
  background: #0b1b33;
  color: #d9eeff;
}

.map-player-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(0, 229, 255, 0.3);
  background: rgba(0, 229, 255, 0.06);
  transition: all 0.15s ease;
  user-select: none;
}

.map-player-toggle:hover {
  border-color: rgba(0, 229, 255, 0.5);
  background: rgba(0, 229, 255, 0.12);
}

.map-player-toggle input[type="checkbox"] {
  accent-color: #00e5ff;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.map-player-toggle-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #00e5ff;
  letter-spacing: 0.02em;
}

/* ===== Map Player List (sidebar) ===== */
.map-player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.12s ease;
  border-left: 2px solid transparent;
}

.map-player-row:hover {
  background: rgba(0, 229, 255, 0.08);
  border-left-color: rgba(0, 229, 255, 0.4);
}

.map-player-row--active {
  background: rgba(0, 229, 255, 0.14);
  border-left-color: #00e5ff;
}

.map-player-row--active .map-player-row-name {
  color: #00e5ff;
}

.map-player-row--active .map-player-row-dot {
  box-shadow: 0 0 6px #00e5ff;
}

.map-player-row-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00e5ff;
  flex-shrink: 0;
}

.map-player-row-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-player-row-coords {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.map-player-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.map-player-pagination .btn {
  padding: 2px 8px;
  font-size: 0.75rem;
  min-width: 28px;
}

/* Waypoint list pagination */
.waypoint-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.waypoint-pagination .btn {
  padding: 2px 8px;
  font-size: 0.75rem;
  min-width: 28px;
}

/* ===== Expertise Calculator (Legacy Look) ===== */
.expertise-root {
  padding: 10px 8px 14px;
  background:
    radial-gradient(circle at 16% 18%, rgba(0, 160, 255, 0.08), transparent 40%),
    radial-gradient(circle at 84% 8%, rgba(80, 255, 160, 0.06), transparent 34%),
    linear-gradient(180deg, #040a14 0%, #030812 60%, #02070f 100%);
  min-height: calc(100vh - 190px);
}

.expertise-shell {
  border: 1px solid rgba(0, 126, 220, 0.2);
  border-radius: 8px;
  background: rgba(3, 12, 22, 0.72);
  box-shadow: inset 0 0 0 1px rgba(0, 60, 120, 0.2), 0 0 25px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.expertise-char-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid rgba(0, 96, 180, 0.3);
  background: linear-gradient(180deg, rgba(4, 19, 33, 0.95), rgba(4, 14, 24, 0.85));
}

.expertise-char-tab {
  border: 1px solid rgba(0, 120, 220, 0.25);
  background: rgba(7, 28, 48, 0.65);
  color: #7fb0d9;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 4px;
}

.expertise-char-tab:hover {
  border-color: rgba(0, 190, 255, 0.55);
  color: #a9daff;
}

.expertise-char-tab.active {
  border-color: rgba(0, 190, 255, 0.75);
  color: #d4f2ff;
  box-shadow: 0 0 12px rgba(0, 170, 255, 0.28);
  background: linear-gradient(180deg, rgba(11, 50, 86, 0.72), rgba(6, 28, 49, 0.82));
}

.expertise-topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0, 90, 160, 0.3);
  background: rgba(7, 20, 35, 0.9);
}

.expertise-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.expertise-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.expertise-view-switch {
  display: inline-flex;
  border: 1px solid rgba(0, 120, 220, 0.32);
  border-radius: 6px;
  overflow: hidden;
}

.expertise-view-toggle {
  border: none;
  background: rgba(8, 30, 50, 0.76);
  color: #7fb0d9;
  padding: 5px 10px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}

.expertise-view-toggle + .expertise-view-toggle {
  border-left: 1px solid rgba(0, 120, 220, 0.32);
}

.expertise-view-toggle:hover {
  color: #d3ecff;
}

.expertise-view-toggle.active {
  background: linear-gradient(180deg, rgba(11, 50, 86, 0.78), rgba(6, 28, 49, 0.9));
  color: #d4f2ff;
  box-shadow: inset 0 -2px 0 rgba(0, 190, 255, 0.65);
}

.expertise-heroic-toggle {
  border: 1px solid rgba(255, 201, 95, 0.5);
  background: rgba(45, 33, 8, 0.72);
  color: #ffd78b;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}

.expertise-heroic-toggle:hover {
  border-color: rgba(255, 214, 120, 0.85);
  color: #ffe8b7;
}

.expertise-heroic-toggle.active {
  box-shadow: inset 0 -2px 0 rgba(255, 196, 78, 0.85);
  border-color: rgba(255, 214, 120, 0.85);
}
.expertise-build-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(64, 94, 124, 0.42);
  background: linear-gradient(180deg, rgba(25, 27, 31, 0.88), rgba(18, 21, 26, 0.92));
  flex-wrap: wrap;
}
.expertise-build-input,
.expertise-build-select {
  height: 32px;
  border: 1px solid rgba(86, 97, 114, 0.6);
  background: rgba(32, 34, 38, 0.88);
  color: #c3d5e7;
  border-radius: 7px;
  padding: 0 11px;
  font-size: 0.98rem;
  min-width: 220px;
}
.expertise-build-input.share {
  min-width: 280px;
}
.expertise-build-btn {
  height: 32px;
  border: 1px solid rgba(62, 86, 121, 0.7);
  border-radius: 7px;
  padding: 0 12px;
  background: rgba(20, 35, 56, 0.86);
  color: #89b8e5;
  font-size: 0.96rem;
  font-weight: 600;
}
.expertise-build-btn:hover {
  border-color: rgba(101, 160, 220, 0.84);
  color: #cde9ff;
}
.expertise-build-btn.save {
  border-color: rgba(113, 216, 126, 0.72);
  background: rgba(20, 50, 29, 0.88);
  color: #8ee596;
}
.expertise-build-btn.share {
  border-color: rgba(116, 141, 255, 0.72);
  background: rgba(31, 40, 75, 0.88);
  color: #9bc4ff;
}
.expertise-build-btn.danger {
  border-color: rgba(220, 98, 98, 0.72);
  background: rgba(69, 21, 28, 0.88);
  color: #ffa1a1;
}
.expertise-build-empty {
  color: #6f7f92;
  font-size: 0.9rem;
}

.expertise-btn-danger {
  border-color: rgba(233, 73, 73, 0.5);
  background: rgba(81, 16, 20, 0.72);
  color: #ff8a8a;
}

.expertise-btn-danger:hover {
  border-color: rgba(255, 96, 96, 0.8);
  color: #ffd5d5;
  box-shadow: 0 0 8px rgba(255, 95, 95, 0.25);
}

.expertise-tree-pill,
.expertise-point-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  border: 1px solid rgba(80, 230, 130, 0.4);
  color: #8ff7b7;
  background: rgba(20, 52, 34, 0.58);
  border-radius: 4px;
  padding: 4px 8px;
  white-space: nowrap;
}

.expertise-point-pill strong {
  color: #d9fff1;
}

.expertise-point-pill span {
  color: #78b89a;
}

.expertise-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: 560px;
}

.expertise-sidebar {
  border-right: 1px solid rgba(0, 90, 160, 0.28);
  background: rgba(4, 12, 20, 0.88);
  padding: 10px 8px;
  overflow-y: auto;
}

.expertise-side-group + .expertise-side-group {
  margin-top: 10px;
}

.expertise-side-group-title {
  font-size: 0.64rem;
  color: #4f748f;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin: 2px 4px 6px;
  font-weight: 700;
}

.expertise-side-item {
  width: 100%;
  border: 1px solid rgba(0, 70, 130, 0.25);
  background: rgba(8, 24, 38, 0.7);
  color: #9bbcd8;
  border-radius: 4px;
  padding: 5px 7px;
  margin-bottom: 4px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
}

.expertise-side-item span {
  color: #7ad78c;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.expertise-side-item:hover {
  border-color: rgba(0, 190, 255, 0.45);
  color: #d2ecff;
}

.expertise-side-item.active {
  border-color: rgba(0, 205, 255, 0.8);
  background: linear-gradient(180deg, rgba(11, 52, 85, 0.72), rgba(8, 29, 48, 0.86));
  color: #dff3ff;
  box-shadow: 0 0 12px rgba(0, 170, 255, 0.22);
}

.expertise-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: auto;
}

.expertise-grid-frame {
  position: relative;
  padding: 14px;
  border-bottom: 1px solid rgba(0, 90, 160, 0.25);
  min-height: 440px;
  overflow-x: auto;
}

.expertise-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.expertise-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px 14px;
  min-width: 100%;
}

.expertise-node {
  position: relative;
  border: 1px solid rgba(48, 86, 124, 0.56);
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(10, 24, 39, 0.84), rgba(8, 20, 32, 0.9));
  min-height: 84px;
  padding: 8px 10px;
  opacity: 0.85;
  transition: border-color 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.expertise-node:hover {
  border-color: rgba(96, 214, 255, 0.8);
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(0, 170, 255, 0.2);
}

.expertise-node.locked {
  opacity: 0.38;
}

.expertise-node.invested {
  border-color: rgba(101, 198, 82, 0.86);
  background: linear-gradient(135deg, rgba(12, 38, 26, 0.88), rgba(11, 28, 22, 0.92));
  box-shadow: 0 0 12px rgba(96, 194, 72, 0.18);
}

.expertise-node.maxed {
  border-color: rgba(74, 179, 232, 0.92);
  background: linear-gradient(135deg, rgba(12, 30, 46, 0.88), rgba(10, 22, 36, 0.92));
  box-shadow: 0 0 18px rgba(74, 179, 232, 0.23);
}

.expertise-node.selected {
  box-shadow: 0 0 0 1px rgba(0, 220, 255, 0.45), 0 0 22px rgba(0, 180, 255, 0.25);
}

.expertise-node-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #4f6e8a;
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.expertise-node.invested .expertise-node-top {
  color: #7ab999;
}

.expertise-node.maxed .expertise-node-top {
  color: #77c5ee;
}

.expertise-node-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  image-rendering: pixelated;
  border: 1px solid rgba(62, 98, 128, 0.6);
  background: rgba(9, 20, 32, 0.9);
}

.expertise-node-name {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #cfe3f6;
  font-size: 0.9rem;
  line-height: 1.2;
  margin-bottom: 7px;
}

.expertise-node-pips {
  display: flex;
  gap: 3px;
}

.expertise-node-pips span {
  display: block;
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: rgba(46, 70, 90, 0.9);
}

.expertise-node-pips span.filled {
  background: linear-gradient(90deg, #66c95a, #9be859);
}

.expertise-node.maxed .expertise-node-pips span.filled {
  background: linear-gradient(90deg, #58bbe8, #72ddff);
}

.expertise-node-actions {
  position: absolute;
  right: 8px;
  bottom: 7px;
  display: flex;
  gap: 4px;
}

.expertise-mini-btn {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1px solid rgba(80, 128, 170, 0.45);
  background: rgba(9, 30, 47, 0.82);
  color: #93bddf;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

.expertise-mini-btn:hover:not(:disabled) {
  border-color: rgba(0, 190, 255, 0.74);
  color: #d6f5ff;
}

.expertise-mini-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.expertise-node-detail {
  padding: 10px 12px 12px;
  min-height: 160px;
  background: linear-gradient(180deg, rgba(5, 16, 28, 0.8), rgba(3, 10, 18, 0.82));
}

.expertise-detail-empty {
  color: #6284a0;
  font-size: 0.84rem;
}

.expertise-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.expertise-detail-header h4 {
  margin: 0;
  font-size: 0.95rem;
  color: #d9eeff;
  letter-spacing: 0.01em;
}

.expertise-detail-sub {
  color: #5c84a4;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.expertise-detail-rank {
  color: #9be86d;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.expertise-rank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 6px;
}

.expertise-rank-block {
  border: 1px solid rgba(38, 74, 104, 0.42);
  border-radius: 6px;
  background: rgba(7, 21, 34, 0.7);
  padding: 6px 8px;
}

.expertise-rank-block.active {
  border-color: rgba(102, 201, 91, 0.7);
  background: rgba(20, 46, 30, 0.63);
}

.expertise-rank-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #7da7c8;
  margin-bottom: 4px;
}

.expertise-rank-block.active .expertise-rank-title {
  color: #9ae986;
}

.expertise-rank-line {
  font-size: 0.77rem;
  color: #a8cbe3;
  line-height: 1.3;
}

.expertise-rank-line.cmd {
  color: #75c9f0;
}

.expertise-tooltip {
  position: fixed;
  z-index: 9999;
  width: min(290px, calc(100vw - 16px));
  border: 1px solid rgba(41, 107, 164, 0.78);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(9, 26, 43, 0.96), rgba(5, 15, 25, 0.98));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 14px rgba(0, 150, 255, 0.2);
  pointer-events: none;
  overflow: hidden;
}

.expertise-tooltip-title {
  padding: 8px 10px 4px;
  font-weight: 700;
  color: #d4ebff;
  font-size: 0.9rem;
}

.expertise-tooltip-sub {
  padding: 0 10px 6px;
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #72a5cb;
  border-bottom: 1px solid rgba(45, 90, 128, 0.45);
}

.expertise-tooltip-reason {
  margin: 6px 10px;
  padding: 5px 6px;
  border: 1px solid rgba(205, 98, 78, 0.45);
  background: rgba(83, 26, 21, 0.45);
  color: #ffb7a5;
  font-size: 0.72rem;
  border-radius: 4px;
}

.expertise-tooltip-body {
  padding: 6px 10px 8px;
  max-height: 330px;
  overflow-y: auto;
}

.expertise-tooltip-rank {
  border-left: 2px solid transparent;
  padding: 3px 0 3px 6px;
}

.expertise-tooltip-rank.invested {
  opacity: 1;
}

.expertise-tooltip-rank.current {
  border-left-color: rgba(110, 220, 86, 0.9);
  background: rgba(24, 58, 34, 0.4);
}

.expertise-tooltip-rank-title {
  color: #8fb8d8;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}

.expertise-tooltip-line {
  color: #9ec7e4;
  font-size: 0.76rem;
  line-height: 1.25;
}

.expertise-tooltip-line.cmd {
  color: #75cdf7;
}

.expertise-build-summary {
  border-top: 1px solid rgba(0, 92, 160, 0.32);
  background: linear-gradient(180deg, rgba(5, 16, 27, 0.92), rgba(4, 11, 20, 0.96));
  padding: 8px 8px 10px;
}

.expertise-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: #6fa2c9;
  font-family: var(--font-mono);
  margin-bottom: 7px;
}

.expertise-summary-head strong {
  color: #91f28e;
  font-weight: 700;
}

.expertise-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 6px;
}

.expertise-summary-card {
  min-height: 78px;
  border: 1px solid rgba(36, 82, 116, 0.55);
  background: linear-gradient(180deg, rgba(7, 22, 37, 0.78), rgba(5, 14, 24, 0.88));
  border-radius: 4px;
  padding: 6px 7px;
}

.expertise-summary-card h4 {
  margin: 0 0 5px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #70a7cd;
  font-family: var(--font-mono);
  font-weight: 700;
}

.expertise-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.71rem;
  color: #b8d7ef;
  line-height: 1.25;
}

.expertise-summary-row span:last-child {
  color: #8af18f;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.expertise-summary-empty {
  color: #547796;
  font-size: 0.72rem;
}

.expertise-summary-cmd {
  font-size: 0.72rem;
  color: #8fd5f8;
  line-height: 1.3;
}

.expertise-heroic-shell {
  margin: 12px 0;
  border: 1px solid #1a3050;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(160deg, #060d16 0%, #080f1a 100%);
}

.expertise-heroic-head {
  padding: 10px 12px;
  border-bottom: 1px solid #1a3050;
  background: rgba(8, 18, 32, 0.95);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.expertise-heroic-head span {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #4ab3e8;
  font-family: var(--font-mono);
  font-weight: 700;
}

.expertise-heroic-head small {
  color: #2f6489;
  font-size: 0.72rem;
}

.expertise-heroic-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  min-height: 420px;
}

.expertise-heroic-sidebar {
  border-right: 1px solid #1a3050;
  max-height: 560px;
  overflow-y: auto;
  padding: 8px 0;
}

.expertise-heroic-group + .expertise-heroic-group {
  margin-top: 6px;
}

.expertise-heroic-group-title {
  padding: 5px 10px 3px;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #2b5678;
  font-family: var(--font-mono);
  border-bottom: 1px solid #0d1f30;
  margin-bottom: 2px;
}

.expertise-heroic-class {
  width: 100%;
  border: none;
  border-left: 2px solid transparent;
  background: transparent;
  color: #4f7fa5;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  text-align: left;
  font-size: 0.8rem;
}

.expertise-heroic-class .icon {
  width: 14px;
}

.expertise-heroic-class.active {
  background: rgba(74, 179, 232, 0.1);
  border-left-color: #4ab3e8;
  color: #d2eaff;
  font-weight: 700;
}

.expertise-heroic-class:hover {
  color: #c6e2fb;
}

.expertise-heroic-main {
  padding: 12px;
  max-height: 560px;
  overflow-y: auto;
}

.expertise-heroic-placeholder,
.expertise-heroic-empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #244b69;
  font-style: italic;
}

.expertise-heroic-class-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  margin-bottom: 10px;
}

.expertise-heroic-class-header h4 {
  margin: 0;
  color: #c8dff0;
  font-size: 1.05rem;
}

.expertise-heroic-class-header .req {
  grid-column: 1 / 2;
  color: #5688aa;
  font-size: 0.82rem;
}

.expertise-heroic-class-header .req span {
  color: #77b6df;
}

.expertise-heroic-class-header .count {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  align-self: center;
  color: #355f80;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.expertise-heroic-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  align-items: start;
}

.expertise-heroic-card {
  border: 1px solid #1a3050;
  border-radius: 8px;
  overflow: hidden;
}

.expertise-heroic-card.open {
  border-color: var(--set-color);
}

.expertise-heroic-card-head {
  width: 100%;
  border: none;
  background: rgba(6, 14, 24, 0.8);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.expertise-heroic-card-head .marker {
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--set-color);
}

.expertise-heroic-card-head .title {
  flex: 1;
  text-align: left;
  color: #7fb3d9;
  font-weight: 700;
}

.expertise-heroic-card.open .expertise-heroic-card-head .title {
  color: var(--set-color);
}

.expertise-heroic-card-head .pcs,
.expertise-heroic-card-head .arrow {
  color: #2f5774;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.expertise-heroic-card-body {
  background: rgba(4, 10, 18, 0.6);
  padding: 8px 10px;
}

.expertise-heroic-card-body .set-requirement {
  color: #5f95bd;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.expertise-heroic-card-body .itemstats-title {
  font-size: 0.62rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: #366685;
  margin-bottom: 4px;
  font-family: var(--font-mono);
}

.expertise-heroic-card-body .effect-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  border-bottom: 1px solid #0a1820;
  padding: 2px 0;
  font-size: 0.9rem;
}

.expertise-heroic-card-body .effect-row span:first-child {
  color: #6f9fc0;
}

.expertise-heroic-card-body .effect-row span:last-child {
  color: #58cc65;
  font-family: var(--font-mono);
}

.expertise-heroic-card-body .effect-row small {
  color: #2f7b4f;
}

.expertise-heroic-card-body .effect-row em {
  font-style: normal;
  font-size: 0.62rem;
  color: #4d81a5;
  border: 1px solid #285073;
  border-radius: 3px;
  padding: 1px 3px;
  margin-left: 4px;
}

.expertise-heroic-card-body .divider {
  border-bottom: 1px solid #1a3050;
  margin: 6px 0;
}

.expertise-heroic-card-body .piece-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 5px;
}

.expertise-heroic-card-body .piece-count {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--set-color);
  background: rgba(12, 28, 43, 0.82);
  color: var(--set-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
}

.expertise-heroic-card-body .piece-effects {
  flex: 1;
}

.expertise-heroic-card-body .effect-ability {
  border-bottom: 1px solid #0a1820;
  padding: 4px 0;
}

.expertise-heroic-card-body .effect-ability .line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.expertise-heroic-card-body .effect-ability .line span:first-child {
  color: #69bfdf;
}

.expertise-heroic-card-body .effect-ability .unlock {
  color: #69b9e5;
  border: 1px solid #246089;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
}

.expertise-heroic-card-body .effect-ability .desc {
  font-size: 0.78rem;
  color: #4a7090;
  line-height: 1.35;
  margin-top: 3px;
  padding-left: 6px;
  border-left: 2px solid #1a4060;
}

@media (max-width: 1100px) {
  .expertise-layout {
    grid-template-columns: 1fr;
  }

  .expertise-sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(0, 90, 160, 0.28);
    max-height: 220px;
  }

  .expertise-summary-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .expertise-build-input,
  .expertise-build-select {
    min-width: 180px;
  }

  .expertise-heroic-layout {
    grid-template-columns: 1fr;
  }

  .expertise-heroic-sidebar {
    border-right: none;
    border-bottom: 1px solid #1a3050;
    max-height: 220px;
  }
}

@media (max-width: 720px) {
  .expertise-root {
    padding: 6px;
  }

  .expertise-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .expertise-topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .expertise-build-actions {
    gap: 8px;
  }

  .expertise-build-input,
  .expertise-build-select,
  .expertise-build-input.share {
    min-width: 100%;
  }

  .expertise-grid {
    grid-template-columns: 1fr !important;
  }

  .expertise-node {
    min-height: 92px;
  }

  .expertise-summary-grid {
    grid-template-columns: 1fr;
  }

  .expertise-heroic-cards {
    grid-template-columns: 1fr;
  }
}
