:root {
  color-scheme: dark;

  --bg: #0f1720;
  --bg-deep: #0a1017;
  --surface-1: #14212c;
  --surface-2: #1a2a38;
  --surface-3: #223646;

  --line: rgba(229, 237, 245, 0.08);
  --line-strong: rgba(229, 237, 245, 0.16);

  --text: #e9f0f7;
  --text-soft: #c3cfdb;
  --muted: #8798a9;
  --muted-2: #66798d;

  --gold: #f3c969;
  --gold-strong: #ffd98a;
  --gold-ink: #171207;
  --gold-soft: rgba(243, 201, 105, 0.12);

  --teal: #5eead4;
  --teal-soft: rgba(94, 234, 212, 0.12);

  --danger: #ff5a78;
  --danger-soft: rgba(255, 90, 120, 0.12);

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-icon: 12px;
  --radius-md: 14px;
  --radius-card: 16px;
  --radius-cta: 18px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  --gutter: 16px;
  --tabbar-h: 64px;
  --cta-h: 68px;

  --dur: 180ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  --shadow-card: 0 18px 40px rgba(0, 0, 0, 0.32);
  --shadow-gold: 0 8px 26px rgba(243, 201, 105, 0.14);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

[hidden] { display: none !important; }

body {
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(243, 201, 105, 0.10), transparent 62%),
    radial-gradient(700px 420px at 92% 8%, rgba(94, 234, 212, 0.05), transparent 60%),
    var(--bg-deep);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "tnum" 1, "kern" 1;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:disabled { cursor: default; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

::selection {
  background: rgba(243, 201, 105, 0.28);
  color: var(--text);
}

.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  background: var(--bg);
}

@media (min-width: 560px) {
  .app {
    border-inline: 1px solid var(--line);
    box-shadow: 0 0 90px rgba(0, 0, 0, 0.55);
  }
}

/* Header ------------------------------------------------------------------ */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: rgba(15, 23, 32, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--gold-ink);
  background: linear-gradient(145deg, var(--gold-strong), var(--gold));
  box-shadow: 0 6px 18px rgba(243, 201, 105, 0.22);
}

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

.brand {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: 1.15;
  white-space: nowrap;
}

.user {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
}

.scan-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 136px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  transition:
    border-color var(--dur) var(--ease),
    background var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

/* Expands the 36px visual chip to a 44px touch target. */
.scan-chip::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
}

.scan-chip:active { transform: scale(0.97); }

.scan-chip.is-refreshing {
  border-color: rgba(243, 201, 105, 0.35);
  background: var(--gold-soft);
}

.scan-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 3px rgba(135, 152, 169, 0.10);
  transition:
    background var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.scan-chip[data-state="done"] .scan-dot {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.14);
}

.scan-chip[data-state="running"] .scan-dot,
.scan-chip.is-refreshing .scan-dot {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(243, 201, 105, 0.16);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

.scan-chip[data-state="error"] .scan-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 90, 120, 0.14);
}

.scan-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--surface-3), var(--surface-2));
  color: var(--gold);
  font-size: 14px;
  font-weight: 750;
  transition:
    border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

/* Expands the 40px avatar to a 44px touch target. */
.avatar::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
}

.avatar:active { transform: scale(0.95); }

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 156px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface-1);
  box-shadow: var(--shadow-card);
}

.profile-menu[hidden] { display: none; }

.profile-name {
  overflow: hidden;
  padding: 7px 10px 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-logout {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(255, 90, 120, 0.24);
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.profile-logout:active { transform: scale(0.98); }

/* Layout ------------------------------------------------------------------ */

main {
  padding: 14px var(--gutter) 0;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel[data-panel="card"] {
  padding-bottom: calc(var(--tabbar-h) + var(--cta-h) + 28px + env(safe-area-inset-bottom));
}

.panel[data-panel="targets"],
.panel[data-panel="sell"] {
  padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 0;
}

.panel-sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.muted {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.meta-chips:empty,
.status-line:empty,
.chart-foot:empty {
  display: none;
}

/* Cards rail -------------------------------------------------------------- */

.rail {
  position: relative;
  margin-inline: calc(var(--gutter) * -1);
}

.rail::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 12px;
  width: 34px;
  background: linear-gradient(90deg, rgba(15, 23, 32, 0), var(--bg));
  pointer-events: none;
}

.cards-strip {
  display: flex;
  gap: 10px;
  padding: 2px var(--gutter) 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.cards-strip::-webkit-scrollbar { display: none; }

.tile {
  position: relative;
  display: flex;
  flex: 0 0 206px;
  align-items: center;
  gap: 10px;
  min-height: 92px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-1);
  color: var(--text);
  text-align: left;
  scroll-snap-align: start;
  transition:
    border-color var(--dur) var(--ease),
    background var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.tile:active { transform: scale(0.985); }

.tile.is-active {
  border-color: rgba(243, 201, 105, 0.72);
  background: linear-gradient(180deg, rgba(243, 201, 105, 0.07), var(--surface-1) 62%);
  box-shadow:
    0 0 0 1px rgba(243, 201, 105, 0.35),
    var(--shadow-gold);
}

.tile.is-selected {
  border-color: rgba(243, 201, 105, 0.72);
  background: linear-gradient(180deg, rgba(243, 201, 105, 0.10), var(--surface-1) 62%);
  box-shadow:
    0 0 0 1px rgba(243, 201, 105, 0.35),
    var(--shadow-gold);
}

.tile-check {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-2);
}

.tile-check.is-checked {
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: inset 0 0 0 4px var(--surface-1);
}

.tile-media {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-icon);
  background: var(--surface-2);
}

.tile-media img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 4px;
  object-fit: contain;
}

.tile-mono {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.06), transparent 60%);
  color: var(--text-soft);
  font-size: 18px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.tile-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.tile-name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tile-price {
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.profit-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.profit-badge.is-negative {
  background: var(--danger-soft);
  color: var(--danger);
}

.tile-skeleton { pointer-events: none; }

.sk-media {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border-radius: var(--radius-icon);
}

/* Detail ------------------------------------------------------------------ */

.detail,
.detail-skeleton {
  display: grid;
  gap: var(--space-3);
}

.detail { scroll-margin-top: 76px; }

.hero-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: var(--space-4);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.hero-card::before {
  content: "";
  position: absolute;
  top: -70px;
  left: -50px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(243, 201, 105, 0.16), transparent 65%);
  pointer-events: none;
}

.hero-media {
  position: relative;
  width: clamp(96px, 24vw, 112px);
  height: clamp(96px, 24vw, 112px);
  flex: 0 0 clamp(96px, 24vw, 112px);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--surface-2);
}

.hero-media img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  padding: 6px;
  object-fit: contain;
}

.hero-mono {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.07), transparent 60%);
  color: var(--text-soft);
  font-size: 26px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.hero-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  min-width: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.hero-body h1 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: clamp(17px, 4.6vw, 20px);
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.25;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.chip svg {
  width: 12px;
  height: 12px;
  opacity: 0.8;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.badge-gold {
  border-color: rgba(243, 201, 105, 0.24);
  background: var(--gold-soft);
  color: var(--gold);
}

.badge-teal {
  border-color: rgba(94, 234, 212, 0.22);
  background: var(--teal-soft);
  color: var(--teal);
}

.badge-muted {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.badge-danger {
  border-color: rgba(255, 90, 120, 0.24);
  background: var(--danger-soft);
  color: var(--danger);
}

/* Buttons ----------------------------------------------------------------- */

.btn-buy-compact,
.btn-skip-compact,
.btn-primary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  transition:
    background var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.btn-buy-compact {
  border-color: rgba(243, 201, 105, 0.32);
  background: var(--gold-soft);
  color: var(--gold);
}

.btn-skip-compact {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text-soft);
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold-strong), var(--gold));
  box-shadow: 0 8px 22px rgba(243, 201, 105, 0.20);
  color: var(--gold-ink);
}

.btn-danger {
  border-color: rgba(255, 90, 120, 0.30);
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-buy-compact svg,
.btn-skip-compact svg,
.btn-primary svg,
.btn-danger svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.btn-buy-compact:active,
.btn-skip-compact:active,
.btn-primary:active,
.btn-danger:active {
  transform: scale(0.97);
}

.btn-buy-compact:disabled,
.btn-skip-compact:disabled,
.btn-primary:disabled,
.btn-danger:disabled {
  opacity: 0.45;
  box-shadow: none;
}

/* Stats ------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.stat-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.stat-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--muted);
}

.stat-icon svg {
  width: 14px;
  height: 14px;
}

.stat-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stat-value {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.stat.good .stat-value { color: var(--teal); }
.stat.bad .stat-value { color: var(--danger); }

.stat-flags .stat-value {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.stat.is-muted .stat-value { color: var(--muted); }

.stat-skeleton { min-height: 84px; }

/* Chart ------------------------------------------------------------------- */

.chart-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.chart-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chart-last {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chart-last::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.chart-last.gold { color: var(--gold); }
.chart-last.teal { color: var(--teal); }

.ranges {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 3px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}

.ranges button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.ranges button:active { transform: scale(0.96); }

.ranges button.is-active {
  background: var(--gold);
  box-shadow: 0 4px 12px rgba(243, 201, 105, 0.18);
  color: var(--gold-ink);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
}

.legend-dot.is-gold { background: var(--gold); }
.legend-dot.is-teal { background: var(--teal); }

.chart-wrap {
  position: relative;
  height: 248px;
  min-height: 220px;
}

.chart-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.chart-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  border-radius: var(--radius-icon);
  background: var(--surface-1);
}

.chart-loading .sk-chart {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-icon);
}

.chart-foot {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  white-space: pre-line;
}

/* Targets / sell rows ----------------------------------------------------- */

.list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.row-card {
  display: flex;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-1);
}

.row-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-icon);
  background: var(--surface-2);
  color: var(--gold);
}

.row-icon svg {
  width: 19px;
  height: 19px;
}

.row-card[data-kind="sell"] .row-icon { color: var(--teal); }

.row-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.row-head .badge { flex: 0 0 auto; }

.row-title {
  display: -webkit-box;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.row-meta .price {
  color: var(--text-soft);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.dot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted-2);
}

.row-action {
  align-self: flex-start;
  margin-top: 3px;
}

.row-skeleton { align-items: flex-start; }

.sk-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--radius-icon);
}

.sk-btn-sm {
  width: 96px;
  height: 36px;
  margin-top: 2px;
  border-radius: var(--radius-pill);
}

/* Empty states ------------------------------------------------------------ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 30px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.empty-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 2px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--muted);
}

.empty-icon svg {
  width: 22px;
  height: 22px;
}

.empty strong {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.empty.is-danger .empty-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Skeleton ---------------------------------------------------------------- */

.skeleton {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.07) 48%,
    transparent 76%
  );
  animation: shimmer 1.5s infinite;
}

.sk-line {
  width: 100%;
  height: 9px;
  border-radius: var(--radius-pill);
}

.sk-line + .sk-line { margin-top: 6px; }

.w-40 { width: 40%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-70 { width: 70%; }
.w-80 { width: 80%; }
.w-90 { width: 90%; }

.sk-media-lg {
  width: clamp(96px, 24vw, 112px);
  height: clamp(96px, 24vw, 112px);
  flex: 0 0 clamp(96px, 24vw, 112px);
  border-radius: var(--radius-card);
}

.sk-chip {
  width: 90px;
  height: 22px;
  border-radius: var(--radius-pill);
}

.sk-btn {
  width: 120px;
  height: 44px;
  border-radius: var(--radius-pill);
}

.sk-chart {
  width: 100%;
  height: 220px;
  border-radius: var(--radius-icon);
}

/* Bottom navigation ------------------------------------------------------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 30;
  display: flex;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  max-width: 480px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: rgba(15, 23, 32, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

@media (min-width: 560px) {
  .tabbar {
    border-inline: 1px solid var(--line);
    border-radius: var(--radius-cta) var(--radius-cta) 0 0;
  }
}

.tab {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 4px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.tab:active { transform: scale(0.96); }

.tab.is-active { color: var(--gold); }

.tab-icon {
  width: 30px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  transition: background var(--dur) var(--ease);
}

.tab-icon svg {
  width: 21px;
  height: 21px;
}

.tab.is-active .tab-icon { background: var(--gold-soft); }

.tab-label {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

/* Sticky buy bar ---------------------------------------------------------- */

.sticky-cta {
  position: fixed;
  bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(calc(100% - 24px), 456px);
  padding: 10px 10px 10px 16px;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-cta);
  background: var(--surface-2);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  will-change: transform;
}

.sticky-cta.is-hidden {
  transform: translate(-50%, calc(100% + 18px));
  opacity: 0;
  pointer-events: none;
}

.cta-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.cta-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cta-price {
  font-size: 16px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.cta-profit {
  margin-left: auto;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.cta-profit.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.sticky-cta .btn-primary {
  flex: 0 0 auto;
  min-width: 112px;
  min-height: 48px;
}

.batch-bar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 2 * var(--gutter));
  max-width: 430px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface-1);
  box-shadow: var(--shadow-card);
  transform: translateX(-50%);
}

.batch-bar[hidden] { display: none; }

.batch-count {
  flex: 0 0 auto;
  padding-left: 6px;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.batch-count strong { color: var(--text); }

.btn-batch-skip,
.btn-batch-cancel {
  min-height: 40px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
}

.btn-batch-skip {
  flex: 1;
  border: 1px solid rgba(243, 201, 105, 0.32);
  background: var(--gold-soft);
  color: var(--gold);
}

.btn-batch-skip:disabled { opacity: 0.45; }

.btn-batch-cancel {
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-soft);
}

#selection-toggle[aria-pressed="true"] {
  border-color: rgba(243, 201, 105, 0.45);
  background: var(--gold-soft);
  color: var(--gold);
}

/* Toast ------------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--cta-h) + 24px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 40;
  width: max-content;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-icon);
  background: var(--surface-3);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  animation: toast-in 180ms var(--ease);
}

/* Motion ------------------------------------------------------------------ */

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Hover ------------------------------------------------------------------- */

@media (hover: hover) {
  .tile:hover { border-color: var(--line-strong); }
  .tile.is-active:hover { border-color: rgba(243, 201, 105, 0.85); }

  .scan-chip:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
  }

  .avatar:hover { border-color: rgba(243, 201, 105, 0.45); }

  .btn-buy-compact:hover {
    border-color: rgba(243, 201, 105, 0.45);
    background: rgba(243, 201, 105, 0.18);
  }

  .btn-skip-compact:hover {
    border-color: var(--line-strong);
    background: var(--surface-3);
    color: var(--text);
  }

  .btn-primary:hover { filter: brightness(1.04); }
  .btn-danger:hover { background: rgba(255, 90, 120, 0.18); }

  .ranges button:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
  }

  .tab:hover { color: var(--text-soft); }
  .tab.is-active:hover { color: var(--gold); }
}

/* Narrow phones ----------------------------------------------------------- */

@media (max-width: 380px) {
  .chart-head { flex-direction: column; align-items: stretch; }
  .ranges { width: 100%; margin-left: 0; justify-content: space-between; }
  .ranges button { flex: 1; }
  .chart-wrap { height: 224px; }
  .hero-card { gap: var(--space-3); padding: 14px; }
  .hero-body h1 { font-size: 17px; }
  .stat { padding: 9px 10px; }
}

/* Reduced motion ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
