/* ===== FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 4px var(--glow-color), 0 0 8px var(--glow-color); }
  50% { box-shadow: 0 0 8px var(--glow-color), 0 0 16px var(--glow-color); }
}

@keyframes borderGlow {
  0%, 100% { border-color: var(--accent-service-dim); }
  50% { border-color: var(--accent-service); }
}

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

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastFadeOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

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

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ===== DARK THEME (default) ===== */
:root {
  --bg:           #0a0e14;
  --surface:      #11161d;
  --surface-2:    #1a212b;
  --border:       #2a3441;
  --text:         #b8c4ce;
  --text-bright:  #e6edf3;
  --muted:        #5f6b7a;
  --primary:      #3fb950;
  --primary-dim:  rgba(63, 185, 80, 0.12);
  --secondary:    #e3b341;
  --danger:       #f85149;
  --danger-dim:   rgba(248, 81, 73, 0.12);
  --info:         #58a6ff;
  --info-dim:     rgba(88, 166, 255, 0.12);

  /* service accent defaults (history green) */
  --accent-service:      var(--primary);
  --accent-service-dim:  var(--primary-dim);
  --accent-service-glow: rgba(63, 185, 80, 0.25);
  --glow-color:          rgba(63, 185, 80, 0.25);

  /* chart-specific */
  --c-line:   var(--primary);
  --c-fill:   rgba(63, 185, 80, 0.12);
  --c-bar:    rgba(227, 179, 65, 0.85);
  --c-axis:   rgba(184, 196, 206, 0.06);
  --c-axis2:  rgba(184, 196, 206, 0.12);
  --c-label:  #5f6b7a;
  --c-hover:  rgba(184, 196, 206, 0.22);
  --c-dot:    var(--secondary);
}

/* ===== SERVICE-SPECIFIC ACCENTS ===== */
[data-service="history"] {
  --accent-service:      #00ff41;
  --accent-service-dim:  rgba(0, 255, 65, 0.12);
  --accent-service-glow: rgba(0, 255, 65, 0.25);
  --glow-color:          rgba(0, 255, 65, 0.25);
  --c-line:   #00ff41;
  --c-fill:   rgba(0, 255, 65, 0.12);
  --c-dot:    #e3b341;
}

[data-service="compare"] {
  --accent-service:      #ffb000;
  --accent-service-dim:  rgba(255, 176, 0, 0.12);
  --accent-service-glow: rgba(255, 176, 0, 0.25);
  --glow-color:          rgba(255, 176, 0, 0.25);
  --c-line:   #ffb000;
  --c-fill:   rgba(255, 176, 0, 0.12);
  --c-dot:    #ff6b35;
}

[data-service="lisskins"] {
  --accent-service:      #00f0ff;
  --accent-service-dim:  rgba(0, 240, 255, 0.12);
  --accent-service-glow: rgba(0, 240, 255, 0.25);
  --glow-color:          rgba(0, 240, 255, 0.25);
  --c-line:   #00f0ff;
  --c-fill:   rgba(0, 240, 255, 0.12);
  --c-dot:    #ff00ff;
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
  --bg:           #f0f2f5;
  --surface:      #ffffff;
  --surface-2:    #f5f7fa;
  --border:       #d1d5db;
  --text:         #1f2937;
  --text-bright:  #030712;
  --muted:        #6b7280;
  --primary:      #047857;
  --primary-dim:  rgba(4, 120, 87, 0.08);
  --secondary:    #b45309;
  --danger:       #dc2626;
  --danger-dim:   rgba(220, 38, 38, 0.08);
  --info:         #1d4ed8;
  --info-dim:     rgba(29, 78, 216, 0.08);

  --accent-service:      var(--primary);
  --accent-service-dim:  var(--primary-dim);
  --accent-service-glow: rgba(4, 120, 87, 0.15);
  --glow-color:          rgba(4, 120, 87, 0.15);

  --c-line:   var(--primary);
  --c-fill:   rgba(4, 120, 87, 0.11);
  --c-bar:    rgba(180, 83, 9, 0.75);
  --c-axis:   rgba(31, 41, 55, 0.07);
  --c-axis2:  rgba(31, 41, 55, 0.14);
  --c-label:  #9ca3af;
  --c-hover:  rgba(31, 41, 55, 0.18);
  --c-dot:    var(--secondary);
}

[data-theme="light"][data-service="history"] {
  --accent-service:      #047857;
  --accent-service-dim:  rgba(4, 120, 87, 0.08);
  --accent-service-glow: rgba(4, 120, 87, 0.15);
  --glow-color:          rgba(4, 120, 87, 0.15);
  --c-line:   #047857;
  --c-fill:   rgba(4, 120, 87, 0.07);
}

[data-theme="light"][data-service="compare"] {
  --accent-service:      #b45309;
  --accent-service-dim:  rgba(180, 83, 9, 0.08);
  --accent-service-glow: rgba(180, 83, 9, 0.15);
  --glow-color:          rgba(180, 83, 9, 0.15);
  --c-line:   #b45309;
  --c-fill:   rgba(180, 83, 9, 0.11);
}

[data-theme="light"][data-service="lisskins"] {
  --accent-service:      #0891b2;
  --accent-service-dim:  rgba(8, 145, 178, 0.08);
  --accent-service-glow: rgba(8, 145, 178, 0.15);
  --glow-color:          rgba(8, 145, 178, 0.15);
  --c-line:   #0891b2;
  --c-fill:   rgba(8, 145, 178, 0.11);
}

/* ===== RESET ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

/* Subtle scanline overlay for terminal feel */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.03) 0px,
    rgba(0,0,0,0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.6;
}

[data-theme="light"] body::before {
  opacity: 0.3;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.02) 0px,
    rgba(0,0,0,0.02) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ===== SHELL ===== */
.shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

/* ===== TOPBAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
  animation: fadeInUp 0.5s ease both;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
}

.prompt  { color: var(--accent-service); font-weight: 600; }
.host    { color: var(--info); }
.sep     { color: var(--muted); }
.cmd     { color: var(--text-bright); font-weight: 600; }

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

.service-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
}

.service-nav a {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s, transform 0.15s;
  position: relative;
}

.service-nav a:hover {
  color: var(--text-bright);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.service-nav a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 6px;
  right: 6px;
  height: 1px;
  background: var(--accent-service);
  transform: scaleX(0);
  transition: transform 0.2s;
}

.service-nav a:hover::after {
  transform: scaleX(1);
}

/* ===== TABS ===== */
.tab-nav {
  display: flex;
  gap: 4px;
}

.tab-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s, box-shadow .2s, transform .15s;
  position: relative;
  overflow: hidden;
}

.tab-btn:hover {
  color: var(--text);
  border-color: var(--text);
  transform: translateY(-1px);
}

.tab-btn.active {
  background: var(--accent-service-dim);
  border-color: var(--accent-service);
  color: var(--accent-service);
  box-shadow: 0 0 8px var(--accent-service-glow);
}

.tab-btn.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-service);
  opacity: 0.6;
}

/* ===== THEME TOGGLE ===== */
.theme-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: color .2s, border-color .2s, box-shadow .2s, transform .15s;
  white-space: nowrap;
}

.theme-btn:hover {
  color: var(--text);
  border-color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 0 6px var(--accent-service-glow);
}

/* ===== LAYOUT ===== */
.layout {
  display: grid;
  grid-template-columns: 288px 1fr;
  gap: 14px;
  align-items: start;
  animation: fadeInUp 0.6s 0.1s ease both;
}

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

/* ===== PANELS ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color .3s, box-shadow .3s;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-service-dim), transparent);
  opacity: 0.5;
}

.panel:hover {
  border-color: var(--accent-service-dim);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15), 0 0 12px var(--accent-service-glow);
}

[data-theme="light"] .panel:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 0 12px var(--accent-service-glow);
}

.controls-panel,
.summary-panel {
  padding: 14px 16px;
}

.section-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

.sublabel {
  font-weight: 400;
  font-size: 10px;
}

/* ===== INPUTS ===== */
input, select, button { font: inherit; }

label {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 5px;
  transition: color .2s;
}

.field-group:focus-within label,
.cmp-control-group:focus-within label {
  color: var(--accent-service);
}

input,
select {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  transition: border-color .2s, box-shadow .2s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent-service);
  box-shadow: 0 0 0 2px var(--accent-service-dim), 0 0 8px var(--accent-service-glow);
}

input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

/* ===== SEARCH ===== */
.field-group {
  display: flex;
  flex-direction: column;
}

.field-group.compact {
  flex: 1;
  min-width: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prompt {
  position: absolute;
  left: 10px;
  color: var(--accent-service);
  pointer-events: none;
  z-index: 1;
  font-size: 13px;
  font-weight: 600;
}

#search-input {
  padding-left: 26px;
}

.search-results {
  position: absolute;
  inset: calc(100% + 4px) 0 auto;
  display: none;
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: fadeInUp 0.2s ease both;
}

.search-results.visible { display: block; }

.search-result {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  transition: background .15s, transform .1s;
}

.search-result:hover,
.search-result.active  {
  background: var(--accent-service-dim);
  transform: translateX(2px);
}

.search-result:last-child { border-bottom: none; }

.result-title {
  display: block;
  color: var(--text-bright);
  font-weight: 500;
}

.result-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

/* ===== FIELD ROW ===== */
.field-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.preset-row {
  display: flex;
  gap: 5px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.primary-button,
.ghost-button {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  transition: color .2s, border-color .2s, background .2s, box-shadow .2s, transform .15s;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.primary-button {
  background: var(--accent-service-dim);
  border-color: var(--accent-service);
  color: var(--accent-service);
  align-self: flex-end;
}

.primary-button:hover {
  background: var(--accent-service);
  color: var(--bg);
  box-shadow: 0 0 12px var(--accent-service-glow);
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(0);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
}

.ghost-button:hover {
  color: var(--text);
  border-color: var(--text);
  transform: translateY(-1px);
}

.preset-button {
  padding: 0 8px;
  font-size: 11px;
  height: 26px;
}

/* ===== SUMMARY ===== */
.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.item-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  word-break: break-word;
  line-height: 1.45;
}

.status-badge {
  font: inherit;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: box-shadow .3s;
}

.status-badge.idle    { color: var(--muted);    border-color: var(--border); }
.status-badge.loading { color: var(--info);     border-color: var(--info);   background: var(--info-dim); animation: glowPulse 2s infinite; --glow-color: var(--info-dim); }
.status-badge.ready   { color: var(--accent-service);  border-color: var(--accent-service); background: var(--accent-service-dim); animation: glowPulse 3s infinite; }
.status-badge.error   { color: var(--danger);   border-color: var(--danger);  background: var(--danger-dim); animation: shake 0.4s; }

/* ===== STATS LIST ===== */
.stats-list {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  transition: background .15s;
}

.stat-row:hover {
  background: var(--accent-service-dim);
}

.stat-row:last-child { border-bottom: none; }

.stat-key {
  color: var(--muted);
  font-size: 11px;
  flex-shrink: 0;
}

.stat-val {
  color: var(--text-bright);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.stat-val--xs {
  font-size: 10px;
  word-break: break-all;
}

/* ===== CURSOR PANEL ===== */
.cursor-panel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.cursor-label {
  font-size: 11px;
  color: var(--text);
  margin-bottom: 8px;
  word-break: break-all;
  line-height: 1.4;
}

.interval-stats { margin-top: 0; }

/* ===== CHARTS ===== */
.charts-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-block { display: flex; flex-direction: column; gap: 8px; }

.chart-wrap {
  position: relative;
  height: 300px;
}

.vol-wrap { height: 170px; }

canvas {
  width: 100%;
  height: 100%;
  display: block;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  transition: border-color .3s;
}

.chart-wrap:hover canvas {
  border-color: var(--accent-service-dim);
}

/* ===== CHART LOADER ===== */
.chart-loader {
  position: absolute;
  inset: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: 4px;
  z-index: 5;
  pointer-events: none;
}

.chart-loader.hidden { display: none; }

.loader-text {
  margin: 0;
  font: 12px/1.7 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--accent-service);
  text-align: left;
  white-space: pre;
}

/* ===== TOOLTIP ===== */
.chart-tooltip {
  position: absolute;
  min-width: 160px;
  max-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  pointer-events: none;
  font-size: 11px;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  transition: opacity .15s, transform .15s;
}

.chart-tooltip.hidden { display: none; }

.chart-tooltip strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text-bright);
  font-size: 11px;
}

.chart-tooltip div {
  color: var(--muted);
  line-height: 1.85;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  max-width: 320px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: toastSlideIn 0.3s ease both;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(4px);
}

.toast.toast-out {
  animation: toastFadeOut 0.3s ease both;
}

.toast.toast-success { border-color: var(--primary); color: var(--primary); background: var(--primary-dim); }
.toast.toast-error   { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }
.toast.toast-info    { border-color: var(--info); color: var(--info); background: var(--info-dim); }

.toast-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* ===== KEYBOARD SHORTCUTS HINT ===== */
.kb-hint {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 10px;
  color: var(--muted);
  opacity: 0.7;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.kb-hint:hover {
  opacity: 1;
}

.kb-hint kbd {
  display: inline-block;
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-2);
  font-family: inherit;
  font-size: 10px;
  color: var(--text-bright);
  margin: 0 2px;
}

/* ===== COMPARE SECTION ===== */
#compare-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeInUp 0.6s 0.1s ease both;
}

.cmp-controls-panel {
  padding: 14px 16px;
}

.cmp-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.cmp-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmp-countdown {
  font-size: 11px;
  color: var(--muted);
  font-family: inherit;
  white-space: nowrap;
  min-width: 80px;
}

.cmp-controls-row {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}

.cmp-control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cmp-toggle-group {
  display: flex;
  gap: 2px;
}

.cmp-toggle {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s, box-shadow .2s, transform .15s;
  white-space: nowrap;
}

.cmp-toggle:hover {
  color: var(--text);
  border-color: var(--text);
  transform: translateY(-1px);
}

.cmp-toggle.active {
  background: var(--accent-service-dim);
  border-color: var(--accent-service);
  color: var(--accent-service);
  box-shadow: 0 0 8px var(--accent-service-glow);
}

/* ===== COMPARE TABLE PANEL ===== */
.cmp-table-panel {
  padding: 0;
  overflow: hidden;
}

.cmp-table-info {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.cmp-table-container {
  overflow-x: auto;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.cmp-empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.cmp-th {
  padding: 8px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  line-height: 1.4;
  transition: color .2s;
}

.cmp-th-num {
  width: 36px;
  text-align: center;
}

.cmp-sortable {
  cursor: pointer;
  user-select: none;
}

.cmp-sortable:hover {
  color: var(--text);
  background: var(--surface);
}

.sort-arrow {
  font-size: 10px;
  opacity: 0.7;
}

.cmp-td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
  line-height: 1.5;
  transition: background .15s;
}

.cmp-row {
  transition: background .15s;
}

.cmp-row:nth-child(even) {
  background: rgba(127, 127, 127, 0.02);
}

.cmp-row:hover .cmp-td {
  background: var(--accent-service-dim);
}

.cmp-row:hover {
  background: var(--accent-service-dim);
}

.cmp-td-num {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  width: 36px;
}

.cmp-td-name {
  max-width: 260px;
}

.cmp-item-name {
  display: block;
  color: var(--text-bright);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.cmp-links {
  display: inline-flex;
  gap: 4px;
  margin-top: 2px;
}

.ext-link {
  display: inline-block;
  padding: 0 5px;
  height: 18px;
  line-height: 18px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  color: var(--info);
  background: var(--info-dim);
  transition: all .2s;
}

.ext-link:hover {
  opacity: 1;
  border-color: var(--info);
  box-shadow: 0 0 6px var(--info-dim);
  transform: translateY(-1px);
}

.ext-link-lis {
  color: var(--secondary);
  background: transparent;
  border-color: var(--secondary);
}

.ext-link-lis:hover {
  box-shadow: 0 0 6px rgba(227, 179, 65, 0.3);
}

.cmp-td-price {
  white-space: nowrap;
  color: var(--text-bright);
  font-weight: 500;
  text-align: right;
}

.cmp-td-vol {
  text-align: right;
  color: var(--text);
  white-space: nowrap;
}

.cmp-td-profit {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

.profit-pos { color: var(--primary); }
.profit-neg { color: var(--danger); }
.profit-zero { color: var(--muted); }

.cmp-td-chart-btn {
  text-align: center;
  white-space: nowrap;
  padding: 4px 8px;
}

.cmp-chart-btn {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: 3px;
}

.cmp-sub {
  color: var(--muted);
  font-size: 10px;
}

.cmp-orders-hint {
  cursor: default;
  text-decoration: underline dotted;
}

/* ===== COMPARE FILTER INPUTS ===== */
.cmp-range-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cmp-range-sep {
  color: var(--muted);
  font-size: 11px;
}

.cmp-filter-input {
  height: 28px;
  width: 72px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  transition: border-color .2s, box-shadow .2s;
}

.cmp-filter-input:focus {
  outline: none;
  border-color: var(--accent-service);
  box-shadow: 0 0 0 2px var(--accent-service-dim);
}

/* ===== ORDERS TOOLTIP ===== */
.cmp-orders-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text);
  min-width: 180px;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.4), 0 0 8px var(--accent-service-glow);
  line-height: 1.8;
  backdrop-filter: blur(4px);
}

.cmp-ott-name {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
  max-width: 120px;
  vertical-align: bottom;
  text-overflow: ellipsis;
}

.cmp-ott-price {
  color: var(--text-bright);
  font-weight: 600;
}

.cmp-ott-count {
  color: var(--accent-service);
}

/* ===== COMPARE CHART HOVER TIP ===== */
.cmp-chart-hover-tip {
  position: absolute;
  z-index: 10;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 10px;
  color: var(--text);
  pointer-events: none;
  white-space: nowrap;
  display: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
}

.cmp-tip-date {
  color: var(--muted);
  margin-bottom: 2px;
}

/* ===== COMPARE INLINE CHART ===== */
.cmp-chart-row .cmp-chart-td {
  padding: 0;
  background: var(--surface-2);
  border-bottom: 2px solid var(--accent-service);
}

.cmp-chart-wrap {
  position: relative;
  height: 260px;
}

.cmp-chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--surface-2);
}

.cmp-chart-loader {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  z-index: 3;
}

/* ===== COMPARE DUAL CHART (steam + market) ===== */
.cmp-dual-chart-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  position: relative;
  min-height: 260px;
}

.cmp-dual-chart-left,
.cmp-dual-chart-right {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cmp-dual-chart-center {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 8px;
}

.cmp-dual-chart-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
  text-align: center;
}

.cmp-dual-stats {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 10px 12px;
  font-size: 11px;
}

.cmp-dual-stats-title {
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-service);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.cmp-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(127,127,127,0.06);
}

.cmp-stat-row:last-child {
  border-bottom: none;
}

.cmp-stat-type {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
  width: 36px;
  flex-shrink: 0;
}

.cmp-stat-buy,
.cmp-stat-sell {
  font-variant-numeric: tabular-nums;
  color: var(--text-bright);
  font-weight: 500;
}

.cmp-stat-arrow {
  color: var(--muted);
  font-size: 10px;
}

.cmp-stat-profit {
  font-weight: 600;
  font-size: 10px;
  text-align: right;
  min-width: 44px;
}

/* ===== CS2 LISSKINS BROWSE TAB ===== */

#lis-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 20px;
  animation: fadeInUp 0.6s 0.1s ease both;
}

.lis-name-group {
  flex: 2;
  min-width: 240px;
}

.lis-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 10px;
  height: 30px;
  transition: border-color .2s, box-shadow .2s;
}

.lis-search-wrap:focus-within {
  border-color: var(--accent-service);
  box-shadow: 0 0 0 2px var(--accent-service-dim), 0 0 8px var(--accent-service-glow);
}

.lis-search-wrap .input-prompt {
  color: var(--accent-service);
  font-size: 12px;
  flex-shrink: 0;
  font-weight: 600;
}

.lis-search-wrap input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  width: 100%;
}

.lis-search-wrap .search-results {
  top: 100%;
  left: -1px;
  right: -1px;
  z-index: 100;
}

.lis-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  height: 28px;
  padding: 0 7px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}

.lis-select:focus {
  border-color: var(--accent-service);
  box-shadow: 0 0 0 2px var(--accent-service-dim);
}

.lis-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color .2s;
}

.lis-checkbox-label:hover {
  color: var(--text);
}

.lis-checkbox-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent-service);
}

/* Table columns */
.lis-th-name      { min-width: 220px; }
.lis-th-price     { min-width: 70px;  text-align: right; }
.lis-th-float     { min-width: 120px; }
.lis-th-seed      { min-width: 55px;  text-align: center; }
.lis-th-stickers  { min-width: 120px; }
.lis-th-link      { min-width: 45px;  text-align: center; }

.lis-td-name      { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 480px; }
.lis-td-price     { text-align: right; font-variant-numeric: tabular-nums; }
.lis-td-float     { font-variant-numeric: tabular-nums; font-size: 11px; }
.lis-td-seed      { text-align: center; font-size: 11px; color: var(--muted); }
.lis-td-stickers  { white-space: nowrap; }
.lis-td-link      { text-align: center; }

.lis-float {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.lis-no-val {
  color: var(--muted);
}

.lis-sticker-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  vertical-align: middle;
  border-radius: 2px;
  transition: transform .2s;
}

.lis-sticker-icon:hover {
  transform: scale(1.15);
}

.lis-lock {
  font-size: 11px;
}

.lis-row-locked .cmp-td {
  opacity: 0.5;
}

.lis-ext-link {
  font-size: 10px;
  padding: 2px 6px;
  text-decoration: none;
  display: inline-block;
  transition: all .2s;
}

.lis-ext-link:hover {
  transform: translateY(-1px);
}

.lis-load-label {
  font-size: 11px;
  color: var(--muted);
  margin-left: 10px;
}

/* ===== CS2 Skin Rarity Badges ===== */
.skin-rarity-badge, .skin-wear-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 4px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
  white-space: nowrap;
  transition: transform .2s, box-shadow .2s;
}

.skin-rarity-badge:hover, .skin-wear-badge:hover {
  transform: scale(1.05);
}

.cmp-item-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cmp-rarity-container {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* Lis table rarity styling */
.lis-td-name .skin-rarity-badge,
.lis-td-name .skin-wear-badge {
  font-size: 10px;
  padding: 2px 5px;
  margin-right: 4px;
}

/* ===== MOBILE ===== */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 240px 1fr;
    gap: 12px;
  }

  .chart-wrap { height: 240px; }
  .vol-wrap   { height: 140px; }
}

@media (max-width: 680px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .service-nav { display: none; }

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

  .chart-wrap { height: 200px; }
  .vol-wrap   { height: 120px; }

  .shell { padding: 0 12px 28px; }

  .topbar { padding: 8px 0; }

  /* 2-col stats on mobile */
  .stats-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .stats-list .stat-row {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .stats-list .stat-row:nth-child(even) {
    border-right: none;
  }

  .stats-list .stat-row:nth-last-child(-n+2) {
    border-bottom: none;
  }

  .interval-stats {
    grid-template-columns: 1fr 1fr;
    display: grid;
  }

  .kb-hint { display: none; }
}

@media (max-width: 400px) {
  .stats-list {
    grid-template-columns: 1fr;
  }

  .stats-list .stat-row {
    border-right: none;
  }

  .stats-list .stat-row:nth-last-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }

  .stats-list .stat-row:last-child {
    border-bottom: none;
  }
}
