/* Tracker H5 + share report */
.tracker-page {
  max-width: min(1440px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 12px max(12px, var(--safe-l)) calc(88px + var(--safe-b)) max(12px, var(--safe-r));
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 768px) {
  .tracker-page {
    gap: 20px;
    padding: 20px max(16px, var(--safe-l)) 48px max(16px, var(--safe-r));
  }
}

.tracker-header .site-header-inner { height: 48px; }
.tracker-header .lang-switch { transform: scale(0.92); transform-origin: right center; }
@media (max-width: 640px) {
  .tracker-header .help { display: none; }
  .tracker-header #settingsBtn {
    width: 36px; height: 36px; padding: 0;
    display: grid; place-items: center;
    font-size: 0;
  }
  .tracker-header #settingsBtn::before {
    content: "⚙";
    font-size: 16px;
    line-height: 1;
  }
}

.query-card {
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: var(--shadow-card);
  padding: 12px;
}
@media (min-width: 768px) {
  .query-card { padding: 16px; border-radius: 14px; }
}
.query-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.chain-switch {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.chain-seg {
  appearance: none;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 36px;
  transition: background .15s, color .15s, transform .12s;
}
.chain-seg:active { transform: scale(0.97); }
.chain-seg.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.query-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 640px) {
  .query-row {
    grid-template-columns: 140px 1fr auto;
    align-items: center;
  }
}
.query-row select,
.query-row input[type="text"] {
  width: 100%;
  height: 44px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
  font-size: 15px;
  outline: none;
}
.query-row input[type="text"] {
  font-family: var(--mono);
  font-size: 13px;
}
.query-row select:focus,
.query-row input:focus {
  border-color: rgba(13, 148, 136, 0.45);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.query-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
@media (min-width: 640px) {
  .query-actions {
    display: flex;
    flex-shrink: 0;
  }
}
#queryBtn {
  flex: 1;
  height: 44px;
  min-width: 88px;
  border: 0;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s, transform .12s;
}
@media (min-width: 640px) {
  #queryBtn { flex: 0 0 auto; padding: 0 18px; }
}
#queryBtn:active { transform: scale(0.98); }
#queryBtn:disabled { opacity: 0.4; }
#testBtn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
#testBtn svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}
#testBtn.btn-spin svg {
  animation: spin .8s linear infinite;
}
#testBtn:active { transform: scale(0.95); }
#testBtn:disabled { opacity: 0.45; }

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (min-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}
@media (min-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(6, 1fr); gap: 12px; }
}
.kpi-card {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 14px;
  padding: 12px;
  min-width: 0;
  box-shadow: var(--shadow-card);
}
.kpi-card.hero { grid-column: 1 / -1; }
@media (min-width: 1100px) {
  .kpi-card.hero { grid-column: auto; }
}
.kpi-label { font-size: 11px; color: #64748b; margin-bottom: 4px; }
.kpi-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.kpi-card.hero .kpi-value { font-size: 28px; }
.kpi-sub { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.kpi-meta {
  margin-top: 8px;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 0 2px;
}

.data-card {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.tabs-bar {
  position: sticky;
  top: 48px;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #f1f5f9;
  padding: 10px 12px 0;
}
.tabs-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 10px;
}
.tabs-scroll::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  border: 0;
  background: #f1f5f9;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 36px;
  transition: background .15s, color .15s, transform .12s;
}
.tab:active { transform: scale(0.97); }
.tab.active {
  background: #0f172a;
  color: #fff;
}

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
}
@media (min-width: 768px) {
  .filter-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }
}
.filter-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.dir-switch {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 3px;
  width: 100%;
}
@media (min-width: 480px) {
  .dir-switch { width: auto; }
}
.dir-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 650;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 34px;
}
.dir-tab.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.filter-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border-radius: 10px;
  padding: 6px 10px;
}
.filter-field label { font-size: 11px; color: #94a3b8; white-space: nowrap; }
.filter-field input {
  border: 0;
  background: transparent;
  font-size: 13px;
  outline: none;
  min-width: 0;
  color: #0f172a;
}
.filter-actions { display: flex; gap: 6px; }
.ghost-btn {
  border: 0;
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  cursor: pointer;
}
.ghost-btn:active { transform: scale(0.97); }

.table-wrap {
  overflow: auto;
  max-height: min(520px, calc(100vh - 320px));
  -webkit-overflow-scrolling: touch;
}
.desktop-only { display: none; }
.mobile-only { display: block; }
@media (min-width: 768px) {
  .desktop-only { display: block; }
  .mobile-only { display: none !important; }
}

.tx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}
.tx-card {
  border: 1px solid #eef2f7;
  background: #fafbfc;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 8px;
  transition: transform .12s, background .15s;
}
.tx-card:active { transform: scale(0.99); background: #f1f5f9; }
.tx-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tx-amount {
  font-size: 17px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.tx-amount.in { color: #059669; }
.tx-amount.out { color: #dc2626; }
.tx-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}
.tx-tag.in { background: #ecfdf5; color: #047857; }
.tx-tag.out { background: #fff1f2; color: #be123c; }
.tx-time { font-size: 12px; color: #94a3b8; }
.tx-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: #64748b;
  word-break: break-all;
  line-height: 1.45;
}
.tx-meta a { color: #0f766e; text-decoration: underline; text-underline-offset: 2px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 14px;
}
.pager span { font-size: 12px; color: #94a3b8; }

.mobile-dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  padding: 8px 12px calc(8px + var(--safe-b));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
}
@media (min-width: 768px) {
  .mobile-dock { display: none; }
}
.dock-btn {
  height: 44px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.dock-btn.primary {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}
.dock-btn:active { transform: scale(0.97); }
.dock-btn:disabled { opacity: 0.4; pointer-events: none; }

.share-bar {
  display: none;
  gap: 8px;
  flex-wrap: wrap;
}
@media (min-width: 768px) {
  .share-bar { display: flex; }
}
.share-bar .primary-share {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

#shareOverlay:not(.open) { display: none; }
#shareOverlay.open {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: overlayIn .22s ease-out both;
}
.share-sheet {
  width: 100%;
  max-width: 440px;
  max-height: min(92vh, 900px);
  overflow: auto;
  background: #f8fafc;
  border-radius: 20px 20px 0 0;
  padding: 8px 14px calc(18px + var(--safe-b));
  box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.18);
  animation: sheetUp .34s cubic-bezier(.22, 1, .36, 1) both;
}
@media (min-width: 640px) {
  #shareOverlay.open { align-items: center; padding: 16px; }
  .share-sheet {
    border-radius: 20px;
    animation: modalIn .28s cubic-bezier(.22, 1, .36, 1) both;
    padding-bottom: 20px;
  }
}
.share-handle {
  width: 36px; height: 4px;
  background: #cbd5e1;
  border-radius: 999px;
  margin: 6px auto 12px;
}
@media (min-width: 640px) { .share-handle { display: none; } }

.report-poster {
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0%, rgba(45, 212, 191, 0.28), transparent 42%),
    radial-gradient(circle at 0% 100%, rgba(14, 165, 233, 0.18), transparent 40%),
    linear-gradient(160deg, #0b1220 0%, #102a2a 55%, #0a1628 100%);
  padding: 22px 18px 20px;
  position: relative;
}
.report-poster::before {
  content: "₮";
  position: absolute;
  right: -8px;
  top: -18px;
  font-size: 140px;
  font-weight: 900;
  opacity: 0.05;
  line-height: 1;
  pointer-events: none;
}
.report-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  position: relative;
}
.report-brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.report-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin-top: 4px;
}
.report-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.18);
  color: #99f6e4;
  border: 1px solid rgba(45, 212, 191, 0.28);
}
.report-year {
  font-family: var(--display);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 4px 0 6px;
}
.report-addr {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  word-break: break-all;
  margin-bottom: 18px;
}
.report-hero-net { margin-bottom: 16px; }
.report-hero-net .lbl {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}
.report-hero-net .val {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.report-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.report-stat {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 12px;
}
.report-stat .lbl { font-size: 11px; color: rgba(255,255,255,0.5); }
.report-stat .val {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.report-stat .val.in { color: #34d399; }
.report-stat .val.out { color: #fb7185; }
.report-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 56px;
  margin: 4px 0 8px;
}
.report-bar {
  flex: 1;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #2dd4bf, rgba(45, 212, 191, 0.25));
  min-height: 4px;
}
.report-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 14px;
}
.report-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 12px;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
}
.share-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 10px;
}
.share-controls select {
  height: 40px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 600;
}
.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.share-actions .wide { grid-column: 1 / -1; }
.share-act {
  height: 44px;
  border-radius: 12px;
  border: 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.share-act.primary { background: #0f766e; color: #fff; }
.share-act.secondary { background: #0f172a; color: #fff; }
.share-act.ghost { background: #e2e8f0; color: #334155; }
.share-act:active { transform: scale(0.98); }

.empty-state {
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: var(--shadow-card);
  padding: 48px 20px;
  text-align: center;
}
.panel { padding: 0 0 4px; }
.panel.hidden { display: none; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
