:root {
  --bg-0: #fff7fb;
  --bg-1: #ffeff7;
  --bg-2: #ffe2f1;
  --bg-3: #ffd4e8;
  --text-1: #4e2340;
  --text-2: #7a4661;
  --text-3: #a06a86;
  --line: rgba(189, 96, 140, 0.26);
  --line-strong: rgba(189, 96, 140, 0.46);
  --accent: #e95fa6;
  --accent-2: #ff8dbf;
  --gain: #2f9a75;
  --warn: #d08a2f;
  --loss: #cd3d66;
  --chip: #fff3f9;
  --shadow: 0 18px 42px rgba(197, 108, 153, 0.24);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", sans-serif;
  background: var(--bg-0);
  color: var(--text-1);
  line-height: 1.4;
}

.bg-gradient,
.bg-grid,
.bg-petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

.bg-gradient {
  background:
    radial-gradient(circle at 8% 6%, rgba(255, 143, 198, 0.3) 0%, transparent 35%),
    radial-gradient(circle at 93% 10%, rgba(245, 132, 180, 0.24) 0%, transparent 30%),
    radial-gradient(circle at 53% 106%, rgba(238, 94, 155, 0.22) 0%, transparent 34%),
    linear-gradient(180deg, #fff7fb 0%, #ffeaf4 65%, #ffe0ef 100%);
}

.bg-grid {
  z-index: -1;
  background-image:
    linear-gradient(rgba(231, 120, 168, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(231, 120, 168, 0.06) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 88%);
}

.bg-petals {
  z-index: -1;
  opacity: 0.62;
  background-image:
    radial-gradient(circle at 14% 22%, rgba(255, 164, 206, 0.48) 0 10px, transparent 11px),
    radial-gradient(circle at 30% 64%, rgba(255, 174, 212, 0.45) 0 8px, transparent 9px),
    radial-gradient(circle at 55% 30%, rgba(255, 156, 199, 0.42) 0 9px, transparent 10px),
    radial-gradient(circle at 74% 78%, rgba(245, 130, 181, 0.38) 0 8px, transparent 9px),
    radial-gradient(circle at 92% 40%, rgba(255, 172, 213, 0.42) 0 9px, transparent 10px);
  animation: sakura-drift 22s linear infinite;
}

@keyframes sakura-drift {
  from {
    transform: translateY(-10px) translateX(0);
  }
  50% {
    transform: translateY(10px) translateX(-8px);
  }
  to {
    transform: translateY(-10px) translateX(0);
  }
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

input,
select,
button {
  font-family: inherit;
}

.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px;
  animation: app-enter 360ms ease;
}

@keyframes app-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 247, 252, 0.96), rgba(255, 239, 248, 0.96));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(3px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  align-items: center;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.topbar h1 {
  font-size: clamp(1.8rem, 2.5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-block {
  min-width: 0;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(233, 95, 166, 0.46),
    0 10px 26px rgba(212, 104, 157, 0.34);
}

.subtitle {
  margin-top: 4px;
  color: var(--text-2);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-stack {
  display: grid;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  background: var(--chip);
  color: var(--text-2);
  white-space: nowrap;
}

.pill-live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--gain);
  box-shadow: 0 0 0 6px rgba(47, 154, 117, 0.12);
}

.layout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
}

.side-nav {
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 560px;
}

.side-nav nav {
  display: grid;
  gap: 8px;
}

.nav-btn {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  text-align: left;
  background: rgba(255, 241, 249, 0.92);
  color: var(--text-1);
  cursor: pointer;
  font-weight: 600;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.nav-btn:hover {
  border-color: var(--line-strong);
  transform: translateX(2px);
}

.nav-btn.is-active {
  border-color: rgba(233, 95, 166, 0.9);
  background: linear-gradient(90deg, rgba(255, 179, 217, 0.7), rgba(255, 220, 236, 0.7));
}

.side-meta {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--text-2);
}

.meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-3);
}

.meta-value {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 4px;
}

.meta-note {
  font-size: 0.82rem;
  margin-top: 10px;
}

.content {
  min-width: 0;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: fade-in 260ms ease;
}

#view-auction.is-active {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
}

#view-auction .view-panel:first-child {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
}

#view-auction .view-panel:nth-child(2),
#view-auction .view-panel:nth-child(3) {
  grid-column: 2 / 3;
}

.view-panel {
  padding: 16px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-head p {
  color: var(--text-2);
  font-size: 0.9rem;
  margin-top: 3px;
}

.panel-head.compact {
  margin-bottom: 10px;
}

.toolbar {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar input,
.toolbar select {
  background: rgba(255, 249, 253, 0.98);
  border: 1px solid var(--line);
  color: var(--text-1);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  min-height: 38px;
}

.toolbar input::placeholder {
  color: #ab6f8b;
}

.auction-toolbar input[type="search"] {
  min-width: 240px;
  flex: 1;
}

.auction-toolbar input[type="number"] {
  width: 130px;
}

.btn {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff8fc, #ffeaf4);
  color: var(--text-1);
  padding: 9px 12px;
  min-height: 38px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease;
}

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

.btn-primary {
  border-color: rgba(233, 95, 166, 0.7);
  background: linear-gradient(90deg, rgba(245, 116, 179, 0.96), rgba(228, 86, 155, 0.96));
  color: #fff8fc;
}

.btn-ghost {
  background: rgba(255, 243, 250, 0.95);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(233, 95, 166, 0.65);
  outline-offset: 1px;
}

.view-state {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
  color: var(--text-2);
  background: rgba(255, 246, 251, 0.95);
  min-height: 42px;
  display: flex;
  align-items: center;
}

.view-state.state-loading {
  border-color: rgba(233, 95, 166, 0.44);
  color: var(--accent);
}

.view-state.state-error {
  border-color: rgba(205, 61, 102, 0.52);
  color: #9a3156;
  background: rgba(255, 225, 236, 0.9);
}

.view-state.state-empty {
  color: var(--warn);
}

.kpi-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}

.kpi-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: linear-gradient(180deg, #fff7fb, #ffeff7);
}

.kpi-label {
  font-size: 0.73rem;
  text-transform: uppercase;
  color: var(--text-3);
}

.kpi-value {
  margin-top: 6px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.03rem;
}

.table-wrap {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  max-height: 520px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid rgba(178, 99, 137, 0.18);
  white-space: nowrap;
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #9f567d;
  letter-spacing: 0.05em;
  background: rgba(255, 238, 247, 0.98);
}

td {
  font-size: 0.92rem;
  color: #6e324f;
}

.entity-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
}

.entity-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 28ch;
}

.asset-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 1px solid rgba(205, 120, 163, 0.45);
  border-radius: 5px;
  background: rgba(255, 238, 247, 0.96);
  object-fit: cover;
  image-rendering: pixelated;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.asset-icon.is-sm {
  width: 20px;
  height: 20px;
  min-width: 20px;
}

.asset-icon.is-md {
  width: 28px;
  height: 28px;
  min-width: 28px;
}

.skin-head {
  border-radius: 4px;
}

.item-icon {
  border-radius: 5px;
}

.item-inline {
  cursor: help;
}

.item-inline:hover .item-qty-badge {
  border-color: rgba(233, 95, 166, 0.65);
  color: #7f2952;
}

.item-qty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 6px;
  border: 1px solid rgba(233, 95, 166, 0.4);
  border-radius: 999px;
  background: rgba(255, 232, 244, 0.94);
  color: #8a2d59;
  font-size: 0.7rem;
  line-height: 1;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.item-hover-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1200;
  pointer-events: none;
  max-width: min(480px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid rgba(233, 95, 166, 0.42);
  border-radius: 10px;
  background: rgba(255, 244, 250, 0.98);
  color: #672b49;
  box-shadow: 0 20px 40px rgba(198, 109, 155, 0.28);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  line-height: 1.38;
  white-space: pre-wrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 90ms ease, transform 90ms ease;
}

.item-hover-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.asset-icon.is-fallback {
  opacity: 0.92;
  filter: saturate(0.75);
}

td .entity-text {
  max-width: 24ch;
}

.summary-value .entity-inline {
  font-family: "Space Grotesk", sans-serif;
}

.signal-card li .entity-inline,
.opportunity-list li .entity-inline {
  margin-right: 6px;
}

tbody tr:hover {
  background: rgba(255, 227, 241, 0.62);
}

.value-positive {
  color: var(--gain);
}

.value-negative {
  color: var(--loss);
}

.row-new {
  animation: new-row-pulse 1500ms ease;
}

.row-drop {
  animation: drop-row-pulse 1500ms ease;
}

@keyframes new-row-pulse {
  0% {
    background: rgba(129, 219, 187, 0.3);
  }
  100% {
    background: transparent;
  }
}

@keyframes drop-row-pulse {
  0% {
    background: rgba(226, 105, 142, 0.32);
  }
  100% {
    background: transparent;
  }
}

.pagination {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pagination .btn {
  min-height: 34px;
  padding: 6px 10px;
}

.quant-lab {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 245, 251, 0.98), rgba(255, 236, 246, 0.98));
}

.quant-toolbar {
  margin-top: 8px;
}

.quant-toolbar select {
  min-width: 220px;
}

.chart-grid {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 246, 252, 0.97);
  padding: 10px;
}

.chart-card h4 {
  margin-bottom: 8px;
  color: #bd3f7f;
}

#item-history-chart,
#market-history-chart {
  width: 100%;
  height: 240px;
  border-radius: 8px;
  border: 1px solid rgba(233, 95, 166, 0.26);
  background: linear-gradient(180deg, rgba(255, 251, 254, 0.99), rgba(255, 241, 249, 0.99));
}

.chart-legend {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.74rem;
  color: var(--text-2);
  background: rgba(255, 240, 248, 0.96);
}

.chart-pill b {
  color: #7a2f56;
}

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

.signal-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 245, 251, 0.97);
  padding: 10px;
  min-height: 200px;
}

.signal-card h4 {
  margin-bottom: 8px;
  color: #be3f80;
}

.signal-card ul,
.opportunity-list {
  margin: 0;
  padding-left: 18px;
}

.signal-card li,
.opportunity-list li {
  margin-bottom: 6px;
  color: var(--text-2);
}

.summary-grid {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 244, 250, 0.97);
  padding: 10px;
}

.summary-title {
  color: var(--text-3);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.summary-value {
  margin-top: 5px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
}

tbody tr.is-highlighted {
  background: linear-gradient(90deg, rgba(249, 145, 191, 0.28), rgba(249, 145, 191, 0));
}

#toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 20;
}

.toast {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: rgba(255, 245, 251, 0.98);
  color: #662a49;
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 260px;
  box-shadow: var(--shadow);
  animation: fade-in 220ms ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1260px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  #view-auction.is-active {
    grid-template-columns: 1fr;
  }

  #view-auction .view-panel:first-child,
  #view-auction .view-panel:nth-child(2),
  #view-auction .view-panel:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 960px) {
  .app-shell {
    padding: 12px;
  }

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

  .side-nav {
    min-height: auto;
    padding: 12px;
  }

  .side-nav nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .brand-logo {
    width: 48px;
    height: 48px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .side-nav nav {
    grid-template-columns: 1fr;
  }

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

  .auction-toolbar input[type="number"] {
    width: 100%;
  }

  .table-wrap {
    max-height: 420px;
  }

  table {
    min-width: 560px;
  }
}
