html, body { margin: 0; }
body { background: #0f1117; color: #e2e8f0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* Minimal base reset (Tailwind Preflight subset — lost when CDN removed) */
*, *::before, *::after { box-sizing: border-box; }
button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}
button {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}
h1, h2, h3, p { margin: 0; }
img, svg {
  display: block;
  max-width: 100%;
}
svg { flex-shrink: 0; }

/* Layout utilities (replaces Tailwind CDN) */
.min-h-screen { min-height: 100vh; }
.max-w-app { max-width: 50rem; }
.max-w-6xl { max-width: 72rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.gap-0\.5 { gap: 0.125rem; }
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.flex-shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }
.min-w-\[200px\] { min-width: 200px; }
.max-w-full { max-width: 100%; }
.basis-\[160px\] { flex-basis: 160px; }
.relative { position: relative; }
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }
.w-full { width: 100%; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.w-3 { width: 0.75rem; }
.h-3 { height: 0.75rem; }
.w-3\.5 { width: 0.875rem; }
.h-3\.5 { height: 0.875rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-16 { width: 4rem; }
.h-16 { height: 4rem; }
.p-2 { padding: 0.5rem; }
.p-1\.5 { padding: 0.375rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-0 { padding-top: 0; padding-bottom: 0; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.pt-2 { padding-top: 0.5rem; }
.pb-3 { padding-bottom: 0.75rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.ml-1 { margin-left: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-\[10px\] { font-size: 10px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.text-white { color: #fff; }
.whitespace-nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leading-tight { line-height: 1.25; }
.select-none { user-select: none; }
.cursor-pointer { cursor: pointer; }
.transition-opacity { transition: opacity 0.15s ease; }
.hover\:opacity-80:hover { opacity: 0.8; }
.hover\:underline:hover { text-decoration: underline; }

@media (min-width: 640px) {
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
  .sm\:gap-3 { gap: 0.75rem; }
  .sm\:text-lg { font-size: 1.125rem; line-height: 1.75rem; }
  .sm\:block { display: block; }
}

@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.live-dot { animation: pulse-dot 2s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 1s linear infinite; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease-out; }

.group-card {
  position: relative;
  scroll-margin-top: calc(var(--site-header-height, 4rem) + var(--groups-toolbar-height, 2.5rem) + 0.5rem);
  transition: box-shadow 0.2s;
}

.groups-toolbar-outer {
  position: sticky;
  top: var(--site-header-height, 4rem);
  z-index: 40;
  background: #0f1117;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.groups-toolbar {
  background: #1a1d27;
  border: 1px solid #2a2d3a;
  border-radius: 0.75rem;
  padding: 0.25rem 0.5rem;
}
.group-card:hover { box-shadow: 0 4px 24px rgba(0,0,0,0.4); }

.group-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.25s ease, opacity 0.25s ease;
  opacity: 1;
}
.group-body.collapsed {
  grid-template-rows: 0fr;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.group-body.collapsed .group-body-inner {
  overflow: hidden;
}
.group-body:not(.collapsed) .group-body-inner {
  overflow: visible;
}
.group-table-wrap {
  position: relative;
  overflow-x: auto;
  overflow-y: clip;
}

.group-body-inner {
  overflow: hidden;
  min-height: 0;
}

.chevron { transition: transform 0.25s ease; }
.chevron.collapsed { transform: rotate(-90deg); }

input { outline: none; }
input:focus { box-shadow: 0 0 0 2px #6366f1; }

::-webkit-scrollbar { height: 6px; width: 6px; }
::-webkit-scrollbar-track { background: #1a1d27; }
::-webkit-scrollbar-thumb { background: #2a2d3a; border-radius: 3px; }

tbody tr { transition: background 0.1s; }
tbody tr:nth-child(even) td { background: rgba(255,255,255,0.05); }
tbody tr:hover td { background: rgba(99,102,241,0.07); }

.col-header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #9ca3af;
}
thead th { overflow: visible; }
thead tr { border-bottom: 1px solid #2a2d3a; background: rgba(255,255,255,0.03); }

.group-table-wrap table {
  table-layout: fixed;
  width: 100%;
}
.group-table-wrap thead th {
  overflow: visible;
}
.group-table-wrap td {
  overflow: visible;
}

.group-table-wrap .col-item,
.group-table-wrap .col-item-name {
  padding-right: 0;
}
.group-table-wrap .col-buy {
  padding-left: 0;
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #9ca3af;
}

.item-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.item-icon-placeholder {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: #2a2d3a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #6b7280;
  flex-shrink: 0;
}

.item-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  max-height: 220px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid #2a2d3a;
  background: #1a1d27;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.item-suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  font-size: 13px;
  color: #e2e8f0;
  background: transparent;
  border: none;
  cursor: pointer;
}
.item-suggestion:hover,
.item-suggestion.active { background: rgba(99,102,241,0.12); }
.item-suggestion-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.item-suggestion-icon-placeholder {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #2a2d3a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #6b7280;
  flex-shrink: 0;
}
.item-suggestion-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-header-toggle {
  cursor: grab;
  padding: 0.375rem 0.75rem;
}
.group-header-toggle button,
.group-header-toggle .chevron {
  cursor: pointer;
}
.group-card.dragging .group-header-toggle {
  cursor: grabbing;
}

.item-row {
  user-select: none;
  cursor: default;
}
.item-row * {
  cursor: default;
}
.item-row a,
.item-row a:visited {
  color: inherit;
  text-decoration: none;
}
.item-row a,
.item-row a * {
  cursor: pointer;
}
.item-row .cell-copyable:hover {
  background: rgba(99, 102, 241, 0.08);
}
.item-row .cell-copyable.cell-copied {
  background: rgba(34, 197, 94, 0.15);
}

.group-card.dragging,
.item-row.dragging { opacity: 0.45; }

#groups-container { position: relative; }
.drop-insert-marker-h {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 3px;
  border-radius: 999px;
  background: #818cf8;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.35), 0 0 12px rgba(99,102,241,0.55);
  pointer-events: none;
  z-index: 20;
  transform: translateY(-50%);
}
.drop-insert-marker-h.hidden { display: none; }

.group-name {
  cursor: text;
  border-radius: 4px;
  padding: 0 4px;
  margin: 0 -4px;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.25;
}
.group-name:hover { background: rgba(255,255,255,0.05); }
.group-name-input {
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  background: #0f1117;
  border: 1px solid #6366f1;
  border-radius: 6px;
  padding: 2px 8px;
  min-width: 120px;
  max-width: 280px;
}

.group-shortcut-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #2a2d3a;
  background: #0f1117;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.group-shortcut-item {
  cursor: grab;
}
.group-shortcut-item.dragging { opacity: 0.45; cursor: grabbing; }
#groups-shortcut-list { position: relative; }
.group-shortcut-drop-marker {
  position: absolute;
  top: 50%;
  width: 3px;
  height: 36px;
  border-radius: 999px;
  background: #818cf8;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.35), 0 0 12px rgba(99,102,241,0.55);
  pointer-events: none;
  z-index: 20;
  transform: translate(-50%, -50%);
}
.group-shortcut-drop-marker.hidden { display: none; }
.group-shortcut-btn:hover {
  border-color: #6366f1;
  background: rgba(99,102,241,0.08);
  box-shadow: 0 0 0 1px rgba(99,102,241,0.25);
}
.toolbar-action-btn {
  cursor: pointer;
  flex-shrink: 0;
  color: #9ca3af;
}
.toolbar-action-btn:hover { color: #e2e8f0; }
.group-shortcut-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  image-rendering: pixelated;
}
.group-shortcut-icon-placeholder {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: #2a2d3a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
}

.item-wiki-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: #4b5563;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.item-wiki-link svg { width: 12px; height: 12px; }
.item-wiki-link:hover {
  color: #c4b5fd;
  background: rgba(99,102,241,0.1);
}

.show-add-items-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  border-radius: 0.5rem;
  color: #374151;
  background: transparent;
  transition: color 0.15s, background 0.15s;
}
.show-add-items-btn:hover {
  color: #a5b4fc;
  background: rgba(99,102,241,0.1);
}
.remove-item-btn,
.remove-group-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 0.5rem;
  background: transparent;
  border: none;
  transition: color 0.15s, background 0.15s;
}
.remove-item-btn { color: #4b5563; }
.remove-group-btn { color: #374151; }
.remove-item-btn:hover,
.remove-group-btn:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.1);
}
.group-add-panel { display: none; }
.group-card.show-add-items .group-add-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0.75rem;
  border-bottom: 1px solid #2a2d3a;
}
.group-add-panel-field {
  position: relative;
  flex: 1 1 200px;
  min-width: 0;
}
.group-add-panel .add-items-btn,
.group-add-panel .cancel-add-items-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25;
  white-space: nowrap;
  transition: opacity 0.15s, color 0.15s, background 0.15s, border-color 0.15s;
}
.group-add-panel .add-items-btn {
  background: #6366f1;
  color: #fff;
  border: 1px solid #6366f1;
  font-weight: 500;
}
.group-add-panel .add-items-btn:hover {
  opacity: 0.85;
}
.group-add-panel .cancel-add-items-btn {
  background: transparent;
  color: #9ca3af;
  border: 1px solid #2a2d3a;
  font-weight: 500;
}
.group-add-panel .cancel-add-items-btn:hover {
  color: #e2e8f0;
  border-color: #4b5563;
  background: rgba(255, 255, 255, 0.04);
}

.item-row > td { padding-top: 0.125rem; padding-bottom: 0.125rem; }
thead th { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.item-row .price-buy,
.item-row .price-sell,
.item-row .price-margin,
.item-row .price-volume {
  font-size: 12px;
  line-height: 1.25;
}
.price-with-move {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
  max-width: 100%;
}
.price-move-slot:empty {
  display: none;
}
.price-move {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  user-select: none;
  height: 12px;
  position: relative;
}
.price-move svg {
  display: block;
  width: 9px;
  height: 12px;
  fill: currentColor;
  position: relative;
  z-index: 1;
}
.price-move.down svg {
  transform: rotate(180deg);
}
.price-move.up { color: #a3e635; }
.price-move.down { color: #ff5555; }
/* Soft static edge glow (no animation — animating filter flickers) */
.price-move.pulse.up svg {
  filter: drop-shadow(0 0 2px rgba(163, 230, 53, 0.85));
}
.price-move.pulse.down svg {
  filter: drop-shadow(0 0 2px rgba(255, 85, 85, 0.95))
          drop-shadow(0 0 4px rgba(255, 140, 140, 0.55));
}
.price-move.strong.up svg {
  filter: drop-shadow(0 0 2px rgba(163, 230, 53, 1))
          drop-shadow(0 0 5px rgba(163, 230, 53, 0.75));
}
.price-move.strong.down svg {
  filter: drop-shadow(0 0 2px rgba(255, 120, 120, 1))
          drop-shadow(0 0 5px rgba(255, 85, 85, 0.9))
          drop-shadow(0 0 8px rgba(255, 160, 160, 0.55));
}
/* Halo pulse via opacity only */
.price-move.pulse::before,
.price-move.strong::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.price-move.pulse.up::before {
  width: 24px;
  height: 27px;
  background: radial-gradient(circle, rgba(163, 230, 53, 0.9) 0%, rgba(163, 230, 53, 0.35) 45%, transparent 70%);
  animation: price-move-halo 1.6s ease-in-out infinite;
}
.price-move.pulse.down::before {
  width: 24px;
  height: 27px;
  background: radial-gradient(circle, rgba(255, 190, 190, 1) 0%, rgba(255, 85, 85, 0.75) 40%, rgba(255, 85, 85, 0.3) 55%, transparent 70%);
  animation: price-move-halo 1.6s ease-in-out infinite;
}
.price-move.strong.up::before {
  width: 39px;
  height: 42px;
  background: radial-gradient(circle, rgba(217, 249, 157, 1) 0%, rgba(163, 230, 53, 0.75) 35%, rgba(163, 230, 53, 0.25) 55%, transparent 72%);
  animation: price-move-halo-strong 1.6s ease-in-out infinite;
}
.price-move.strong.down::before {
  width: 39px;
  height: 42px;
  background: radial-gradient(circle, rgba(255, 230, 230, 1) 0%, rgba(255, 150, 150, 0.95) 28%, rgba(255, 85, 85, 0.7) 48%, rgba(255, 85, 85, 0.25) 62%, transparent 74%);
  animation: price-move-halo-strong 1.6s ease-in-out infinite;
}
@keyframes price-move-halo {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 0.2375; }
}
@keyframes price-move-halo-strong {
  0%, 100% { opacity: 0.125; }
  50% { opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) {
  .price-move.pulse::before,
  .price-move.strong::before {
    animation: none;
    opacity: 0.1875;
  }
}

/* Restore pulsed glow on move-arrow tooltips only (was lost when arrow filter anim was removed) */
.price-move.pulse.up::after {
  animation: price-move-tip-glow-up 1.6s ease-in-out infinite;
}
.price-move.pulse.down::after {
  animation: price-move-tip-glow-down 1.6s ease-in-out infinite;
}
.price-move.strong.up::after {
  animation: price-move-tip-glow-up-strong 1.6s ease-in-out infinite;
}
.price-move.strong.down::after {
  animation: price-move-tip-glow-down-strong 1.6s ease-in-out infinite;
}
@keyframes price-move-tip-glow-up {
  0%, 100% {
    filter: drop-shadow(0 0 2px rgba(163, 230, 53, 0.55))
            drop-shadow(0 0 4px rgba(163, 230, 53, 0.25));
  }
  50% {
    filter: drop-shadow(0 0 4px rgba(163, 230, 53, 1))
            drop-shadow(0 0 8px rgba(163, 230, 53, 0.7));
  }
}
@keyframes price-move-tip-glow-down {
  0%, 100% {
    filter: drop-shadow(0 0 2px rgba(255, 85, 85, 0.75))
            drop-shadow(0 0 5px rgba(255, 150, 150, 0.45));
  }
  50% {
    filter: drop-shadow(0 0 4px rgba(255, 160, 160, 1))
            drop-shadow(0 0 10px rgba(255, 85, 85, 0.9));
  }
}
@keyframes price-move-tip-glow-up-strong {
  0%, 100% {
    filter: drop-shadow(0 0 4px rgba(163, 230, 53, 1))
            drop-shadow(0 0 10px rgba(163, 230, 53, 0.85))
            drop-shadow(0 0 18px rgba(190, 242, 100, 0.55));
  }
  50% {
    filter: drop-shadow(0 0 6px rgba(190, 242, 100, 1))
            drop-shadow(0 0 14px rgba(163, 230, 53, 1))
            drop-shadow(0 0 26px rgba(217, 249, 157, 0.95))
            drop-shadow(0 0 36px rgba(163, 230, 53, 0.55));
  }
}
@keyframes price-move-tip-glow-down-strong {
  0%, 100% {
    filter: drop-shadow(0 0 4px rgba(255, 120, 120, 1))
            drop-shadow(0 0 10px rgba(255, 85, 85, 0.95))
            drop-shadow(0 0 18px rgba(255, 190, 190, 0.7));
  }
  50% {
    filter: drop-shadow(0 0 6px rgba(255, 220, 220, 1))
            drop-shadow(0 0 14px rgba(255, 120, 120, 1))
            drop-shadow(0 0 26px rgba(255, 160, 160, 0.95))
            drop-shadow(0 0 36px rgba(255, 85, 85, 0.7));
  }
}
@media (prefers-reduced-motion: reduce) {
  .price-move.pulse.up::after,
  .price-move.pulse.down::after,
  .price-move.strong.up::after,
  .price-move.strong.down::after {
    animation: none;
  }
}
.touch-tip.tip-glow-up { animation: price-move-tip-glow-up 1.6s ease-in-out infinite; }
.touch-tip.tip-glow-down { animation: price-move-tip-glow-down 1.6s ease-in-out infinite; }
.touch-tip.tip-glow-up-strong { animation: price-move-tip-glow-up-strong 1.6s ease-in-out infinite; }
.touch-tip.tip-glow-down-strong { animation: price-move-tip-glow-down-strong 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .touch-tip.tip-glow-up,
  .touch-tip.tip-glow-down,
  .touch-tip.tip-glow-up-strong,
  .touch-tip.tip-glow-down-strong {
    animation: none;
  }
}

tbody td { overflow: visible; }
@media (hover: hover) {
  tbody tr.item-row:has(.has-tip:hover) td:not(.col-item-icon) {
    position: relative;
    z-index: 30;
  }
}
.has-tip {
  position: relative;
  cursor: default;
}
.has-tip::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  padding: 5px 9px;
  border-radius: 6px;
  background: #1a1d27;
  border: 1px solid #2a2d3a;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  visibility: hidden;
}
@media (hover: hover) {
  .has-tip:hover::after {
    visibility: visible;
  }
}
.touch-tip {
  position: fixed;
  z-index: 400;
  padding: 5px 9px;
  border-radius: 6px;
  background: #1a1d27;
  border: 1px solid #2a2d3a;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
.touch-tip.hidden {
  display: none;
}
tbody tr.item-row:last-child .has-tip::after {
  top: auto;
  bottom: calc(100% + 6px);
}
td.text-right .has-tip::after {
  left: auto;
  right: 0;
}
button.has-tip::after,
.header-icon-btn.has-tip::after,
.group-shortcut-btn.has-tip::after {
  left: 50%;
  transform: translateX(-50%);
}
.item-icon-wrap {
  display: inline-flex;
  flex-shrink: 0;
}
.item-price-link-icon {
  display: inline-flex;
  flex-shrink: 0;
}
.item-price-link-name {
  display: inline-block;
  max-width: 100%;
  min-width: 0;
}
.item-cell-inner {
  min-width: 0;
}
.item-name-wrap {
  flex: 1 1 0%;
  min-width: 0;
  overflow: visible;
}
.item-name-tip {
  display: inline-block;
  max-width: 100%;
  overflow: visible;
}

@media (hover: none), (pointer: coarse) {
  .item-name-tip.has-tip::after {
    content: none;
    display: none;
    visibility: hidden;
  }
}

.header-icon-btn {
  padding: 0.5rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  transition: opacity 0.15s;
  background: #2a2d3a;
  color: #e2e8f0;
}
.header-icon-btn:hover { opacity: 0.8; }

.ie-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.ie-modal.hidden { display: none; }
.ie-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}
.ie-modal-panel {
  position: relative;
  width: 100%;
  max-width: min(32rem, calc(100vw - 2rem));
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 12px;
  padding: 1.25rem;
  background: #1a1d27;
  border: 1px solid #2a2d3a;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}
.ie-modal-panel .has-tip::after {
  white-space: normal;
  max-width: min(18rem, calc(100vw - 2.5rem));
  text-align: center;
}
#import-main-content {
  min-width: 0;
}
#import-text {
  max-width: 100%;
  box-sizing: border-box;
  resize: vertical;
}
#import-preview {
  min-width: 0;
  word-break: break-word;
}
.ie-choice-panel {
  padding-top: 0.25rem;
}
.ie-choice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.ie-btn {
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: opacity 0.15s;
}
.ie-btn:hover { opacity: 0.85; }
.ie-btn-merge { background: #6366f1; color: #fff; }
.ie-btn-cancel { background: transparent; color: #6b7280; border: 1px solid #2a2d3a; }

/* --- Mobile: prevent table column squash / overlap --- */
@media (max-width: 640px) {
  html {
    overflow-x: hidden;
  }

  :root {
    --group-inset-x: 0.5rem;
  }

  .max-w-app.mx-auto {
    margin-left: 0;
    margin-right: 0;
    max-width: none;
    width: 100%;
  }

  #site-header > .max-w-app {
    padding-left: 0.125rem;
    padding-right: 0.125rem;
  }

  #site-main {
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .groups-toolbar-outer {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-top: 0.125rem;
    padding-bottom: 0.125rem;
  }

  .groups-toolbar-inset {
    padding-left: 0;
    padding-right: 0;
  }

  .groups-toolbar {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-left: var(--group-inset-x);
    padding-right: var(--group-inset-x);
    margin-left: 0;
    margin-right: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .groups-toolbar > .flex {
    min-width: 0;
  }

  #groups-container {
    gap: 0.125rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .group-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
    overflow-y: visible;
  }

  .group-card:has(.group-body.collapsed) {
    overflow: hidden;
  }

  .group-header-toggle {
    min-width: 0;
  }

  .group-header-toggle > .flex {
    min-width: 0;
  }

  .group-header-toggle .group-name {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .group-body {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .group-body:not(.collapsed) .group-body-inner {
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
  }

  .group-table-wrap {
    -webkit-overflow-scrolling: touch;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: clip;
  }

  .group-table-wrap table {
    table-layout: fixed;
    width: max-content;
    min-width: 0;
    max-width: none;
  }

  .group-table-wrap .col-item-name {
    width: 6.5rem;
    min-width: 6.5rem;
    max-width: 6.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .group-table-wrap .col-item-icon {
    position: sticky;
    left: 0;
    z-index: 4;
    width: 2.5rem;
    min-width: 2.5rem;
    max-width: 2.5rem;
    overflow: hidden;
  }

  .group-table-wrap thead th.col-item-icon {
    position: sticky;
    left: 0;
    z-index: 6;
    width: 2.5rem;
    min-width: 2.5rem;
    max-width: 2.5rem;
    /* Opaque match for thead rgba(255,255,255,0.03) on #1a1d27 card bg */
    background-color: #21242d;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
  }

  .group-table-wrap thead th.col-item-name {
    position: relative;
    z-index: 1;
  }

  .group-table-wrap thead th:not(.col-item-icon) {
    position: relative;
    z-index: 1;
  }

  .group-table-wrap tbody td.col-item-icon,
  .group-table-wrap thead th.col-item-icon,
  .group-table-wrap tbody td.col-item-name,
  .group-table-wrap thead th.col-item-name {
    border: none;
    box-shadow: none;
  }

  .group-table-wrap tbody td.col-item-icon,
  .group-table-wrap thead th.col-item-icon {
    padding-right: 0;
  }

  .group-table-wrap tbody td.col-item-name,
  .group-table-wrap thead th.col-item-name {
    padding-left: 0;
    padding-right: 0;
    overflow: visible;
  }

  .group-table-wrap .col-item-name .item-price-link-name {
    padding-left: 0.25rem;
  }

  .group-table-wrap tbody td.col-buy,
  .group-table-wrap thead th.col-buy {
    border-left: none;
    padding-left: 0;
  }

  /* Opaque item columns while scrolled (icon + name stay matched) */
  .group-table-wrap.has-h-scroll tbody td.col-item-icon,
  .group-table-wrap.has-h-scroll tbody td.col-item-name {
    background-color: #1a1d27;
  }
  .group-table-wrap.has-h-scroll tbody tr:nth-child(even) td.col-item-icon,
  .group-table-wrap.has-h-scroll tbody tr:nth-child(even) td.col-item-name {
    background-color: #1a1d27;
    box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.05);
  }
  .group-table-wrap.has-h-scroll tbody tr:hover td.col-item-icon,
  .group-table-wrap.has-h-scroll tbody tr:hover td.col-item-name {
    background-color: #1a1d27;
    box-shadow: inset 0 0 0 9999px rgba(99, 102, 241, 0.07);
  }

  .group-table-wrap tbody td.col-buy,
  .group-table-wrap thead th.col-buy {
    width: 6rem;
    min-width: 6rem;
    max-width: 6rem;
    overflow: visible;
  }

  .group-table-wrap tbody td.col-sell,
  .group-table-wrap thead th.col-sell {
    width: 6rem;
    min-width: 6rem;
    max-width: 6rem;
    overflow: visible;
  }

  .group-table-wrap tbody td.col-buy,
  .group-table-wrap thead th.col-buy,
  .group-table-wrap tbody td.col-sell,
  .group-table-wrap thead th.col-sell {
    padding-left: 0.125rem;
    padding-right: 0.125rem;
  }

  .group-table-wrap .item-row .price-buy,
  .group-table-wrap .item-row .price-sell,
  .group-table-wrap .item-row .price-margin,
  .group-table-wrap .item-row .price-volume {
    font-size: 11px;
  }

  .group-table-wrap .price-with-move {
    gap: 0.125rem;
  }

  .group-table-wrap tbody td.col-margin,
  .group-table-wrap thead th.col-margin {
    width: 4.25rem;
    min-width: 4.25rem;
    max-width: 4.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .group-table-wrap tbody td.col-volume,
  .group-table-wrap thead th.col-volume {
    width: 3.5rem;
    min-width: 3.5rem;
    max-width: 3.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .group-table-wrap tbody td.col-remove,
  .group-table-wrap thead th.col-remove {
    width: 2rem;
    min-width: 2rem;
    max-width: 2rem;
  }

  .group-table-wrap th,
  .group-table-wrap td {
    padding-left: var(--group-inset-x);
    padding-right: var(--group-inset-x);
  }

  .group-table-wrap td {
    overflow: hidden;
  }

  .group-header-toggle {
    padding: 0.125rem var(--group-inset-x);
  }

  .group-add-panel {
    padding-left: var(--group-inset-x) !important;
    padding-right: var(--group-inset-x) !important;
  }

  .group-card.show-add-items .group-add-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 0.375rem;
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
  }

  .group-add-panel-field {
    grid-column: 1 / -1;
  }

  .group-add-panel .add-items-btn,
  .group-add-panel .cancel-add-items-btn {
    width: 100%;
  }

  .group-shortcut-btn {
    width: 32px;
    height: 32px;
  }

  .group-shortcut-item {
    touch-action: none;
  }

  .group-shortcut-icon,
  .group-shortcut-icon-placeholder {
    width: 22px;
    height: 22px;
  }
}
