/* ========================================================================
   TraderPiyush — 6 built-in themes
   ------------------------------------------------------------------------
   Default (no data-theme attribute) → the original "green trader" theme.
   Alternate themes live under body[data-theme="…"] blocks below and only
   override colours + accent glow, so layout stays identical.
   ======================================================================== */
:root, body[data-theme="green"] {
  --bg-0: #050c07;
  --bg-1: #0a1610;
  --bg-2: #0f1e17;
  --line: rgba(52, 211, 153, 0.14);
  --line-strong: rgba(52, 211, 153, 0.28);
  --text: #eafff2;
  --text-dim: rgba(234, 255, 242, 0.72);
  --text-mute: rgba(234, 255, 242, 0.44);
  --accent: #34d399;
  --accent-2: #10b981;
  --accent-glow: rgba(52, 211, 153, 0.55);
  --up: #34d399;
  --down: #ef4444;
  --gold: #f59e0b;
  --verify: #38bdf8;
}

/* --- Cyber Neon — cyan + magenta on deep navy --------------------- */
body[data-theme="cyber"] {
  --bg-0: #05070e;
  --bg-1: #0a0d1a;
  --bg-2: #101426;
  --line: rgba(34, 211, 238, 0.14);
  --line-strong: rgba(34, 211, 238, 0.28);
  --text: #e6f7ff;
  --text-dim: rgba(230, 247, 255, 0.72);
  --text-mute: rgba(230, 247, 255, 0.44);
  --accent: #22d3ee;
  --accent-2: #a855f7;
  --accent-glow: rgba(34, 211, 238, 0.55);
  --up: #34d399;
  --down: #f87171;
  --gold: #e879f9;
  --verify: #38bdf8;
}

/* --- Sunset — orange + red on warm dark ---------------------------- */
body[data-theme="sunset"] {
  --bg-0: #10060a;
  --bg-1: #1a0d13;
  --bg-2: #24141c;
  --line: rgba(251, 146, 60, 0.14);
  --line-strong: rgba(251, 146, 60, 0.32);
  --text: #fff2e6;
  --text-dim: rgba(255, 242, 230, 0.72);
  --text-mute: rgba(255, 242, 230, 0.44);
  --accent: #fb923c;
  --accent-2: #ef4444;
  --accent-glow: rgba(251, 146, 60, 0.55);
  --up: #34d399;
  --down: #ef4444;
  --gold: #fbbf24;
  --verify: #38bdf8;
}

/* --- Royal Gold — gold + luxe black -------------------------------- */
body[data-theme="gold"] {
  --bg-0: #0a0805;
  --bg-1: #14100a;
  --bg-2: #1e180f;
  --line: rgba(251, 191, 36, 0.16);
  --line-strong: rgba(251, 191, 36, 0.32);
  --text: #fef8e6;
  --text-dim: rgba(254, 248, 230, 0.72);
  --text-mute: rgba(254, 248, 230, 0.44);
  --accent: #fbbf24;
  --accent-2: #b45309;
  --accent-glow: rgba(251, 191, 36, 0.5);
  --up: #a7f3d0;
  --down: #f87171;
  --gold: #fbbf24;
  --verify: #f59e0b;
}

/* --- Ocean — teal + deep blue -------------------------------------- */
body[data-theme="ocean"] {
  --bg-0: #04080e;
  --bg-1: #061421;
  --bg-2: #0a1e32;
  --line: rgba(56, 189, 248, 0.14);
  --line-strong: rgba(56, 189, 248, 0.3);
  --text: #e0f2fe;
  --text-dim: rgba(224, 242, 254, 0.72);
  --text-mute: rgba(224, 242, 254, 0.44);
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --accent-glow: rgba(56, 189, 248, 0.55);
  --up: #34d399;
  --down: #f87171;
  --gold: #fbbf24;
  --verify: #38bdf8;
}

/* --- Midnight — purple + pink -------------------------------------- */
body[data-theme="midnight"] {
  --bg-0: #0b061a;
  --bg-1: #150c2a;
  --bg-2: #1e133c;
  --line: rgba(167, 139, 250, 0.16);
  --line-strong: rgba(167, 139, 250, 0.32);
  --text: #f3ecff;
  --text-dim: rgba(243, 236, 255, 0.72);
  --text-mute: rgba(243, 236, 255, 0.44);
  --accent: #a78bfa;
  --accent-2: #ec4899;
  --accent-glow: rgba(167, 139, 250, 0.55);
  --up: #34d399;
  --down: #f87171;
  --gold: #f472b6;
  --verify: #a78bfa;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- Layout ---------- */
.tp-page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding-top: 12px;
}

/* Green corner glows evoking bull / bear silhouettes */
.tp-side-glow {
  position: absolute;
  top: 0; bottom: 0;
  width: 40%;
  z-index: 0;
  pointer-events: none;
}
.tp-side-glow.left {
  left: 0;
  background:
    radial-gradient(ellipse at 0% 40%, rgba(16, 185, 129, 0.22), transparent 60%),
    radial-gradient(circle at 15% 30%, rgba(0, 0, 0, 0.55), transparent 55%);
}
.tp-side-glow.right {
  right: 0;
  background:
    radial-gradient(ellipse at 100% 40%, rgba(16, 185, 129, 0.22), transparent 60%),
    radial-gradient(circle at 85% 30%, rgba(0, 0, 0, 0.55), transparent 55%);
}
.tp-grid-bg {
  position: absolute; inset: 0;
  z-index: 0;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(52, 211, 153, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 211, 153, 0.5) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 30%, black 40%, transparent 100%);
          mask-image: radial-gradient(ellipse 60% 55% at 50% 30%, black 40%, transparent 100%);
  pointer-events: none;
}

/* Side text stacks — visible on tablet+ only, mobile hides them */
.tp-shoulder {
  position: absolute;
  top: 40px; bottom: 40px;
  width: 130px;
  z-index: 1;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
}
.tp-shoulder.left  { left: 0;  text-align: left; }
.tp-shoulder.right { right: 0; text-align: right; }
.tp-side-text {
  font-family: var(--tp-font-sideText, 'Bebas Neue', 'Anton', 'Rajdhani', Impact, sans-serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.28em;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.35;
  text-transform: uppercase;
  text-shadow: 0 0 22px rgba(52, 211, 153, 0.18);
}
.tp-side-text::before {
  content: '';
  display: block;
  width: 22px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  margin: 0 0 10px;
  border-radius: 1px;
}
.tp-shoulder.right .tp-side-text::before {
  margin-left: auto;
  background: linear-gradient(90deg, transparent, var(--accent));
}
.tp-script {
  font-family: var(--tp-font-bottomScript, 'Great Vibes', 'Dancing Script', cursive);
  font-size: 30px;
  font-weight: 400;
  color: rgba(52, 211, 153, 0.7);
  line-height: 1.05;
  text-shadow: 0 0 22px rgba(52, 211, 153, 0.45);
}
@media (max-width: 900px) {
  .tp-shoulder { display: none; }
}

/* ---------- Container ---------- */
.tp-container {
  position: relative;
  z-index: 2;
  max-width: 420px;
  margin: 0 auto;
  padding: 10px 18px 20px;
}

/* ---------- Hero avatar ---------- */
.tp-hero {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}
.tp-avatar-ring {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  padding: 4px;
  background: transparent;
  border: 2.5px solid var(--accent);
  box-shadow:
    0 0 0 4px rgba(52, 211, 153, 0.08),
    0 0 24px -4px var(--accent-glow),
    inset 0 0 14px rgba(52, 211, 153, 0.2);
}
.tp-avatar-round {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-1);
}
.tp-live-dot {
  position: absolute;
  right: 4px; top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-0);
  box-shadow: 0 0 10px var(--accent-glow);
  animation: tp-pulse 1.6s ease-in-out infinite;
}
@keyframes tp-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}
.tp-hero-script {
  position: absolute;
  right: 20px; top: 6px;
  font-family: var(--tp-font-heroScript, 'Great Vibes', cursive);
  font-size: 18px;
  color: rgba(234, 255, 242, 0.88);
  line-height: 1.05;
  text-align: left;
}
.tp-hero-script .tp-underline {
  display: block;
  height: 1.5px;
  width: 60px;
  margin-top: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: skewY(-2deg);
}

/* ---------- Identity block ---------- */
.tp-identity { text-align: center; margin-bottom: 12px; }
.tp-name {
  font-family: var(--tp-font-name, inherit);
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: -0.01em;
}
.tp-verified {
  color: var(--verify);
  width: 16px; height: 16px;
}
.tp-role {
  font-family: var(--tp-font-tagline, inherit);
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}
.tp-handle { font-family: var(--tp-font-handle, inherit); }
.tp-quote {
  font-family: var(--tp-font-quote, inherit);
  margin: 6px auto 0;
  font-style: italic;
  font-size: 11px;
  line-height: 1.4;
  max-width: 320px;
  color: var(--text-dim);
}

/* ---------- Social icon row ---------- */
.tp-social-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.tp-social-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.tp-social-btn:hover { transform: translateY(-2px); }
.tp-social-btn .tp-icon-tile {
  width: 36px !important; height: 36px !important;
  border-radius: 50% !important;
}
.tp-social-btn .tp-icon-tile .tp-icon-inner { width: 18px !important; height: 18px !important; }

/* ---------- Links list ---------- */
.tp-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.tp-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(16, 185, 129, 0.05), rgba(16, 185, 129, 0.015));
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.tp-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.04));
  box-shadow: 0 10px 30px -14px var(--accent-glow);
}
.tp-link:active { transform: scale(0.99); }
.tp-link-body { min-width: 0; flex: 1; }
.tp-link-title {
  font-family: var(--tp-font-linkTitle, inherit);
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.tp-link-sub {
  font-family: var(--tp-font-linkSub, inherit);
  display: block;
  margin-top: 1px;
  font-size: 10px;
  color: var(--text-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.tp-link-chev {
  color: var(--accent);
  flex-shrink: 0;
  opacity: 0.85;
}

/* --- Highlighted link — subtle shine sweep + soft glow pulse --- */
.tp-link.tp-highlight {
  position: relative;
  overflow: hidden;
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
  animation: tp-glow-pulse 2.6s ease-in-out infinite;
}
.tp-link.tp-highlight .tp-link-title { font-size: 14px; }

/* Shine sweep — white streak crosses the card every few seconds. */
.tp-link.tp-highlight::before {
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 45%; height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(52, 211, 153, 0.28) 45%,
    rgba(255, 255, 255, 0.42) 50%,
    rgba(52, 211, 153, 0.28) 55%,
    transparent 100%
  );
  filter: blur(6px);
  transform: skewX(-18deg);
  animation: tp-shimmer 3.4s ease-in-out infinite;
  pointer-events: none;
}
.tp-link.tp-highlight .tp-link-body,
.tp-link.tp-highlight .tp-icon-tile,
.tp-link.tp-highlight .tp-link-chev { position: relative; z-index: 1; }

@keyframes tp-shimmer {
  0%   { left: -60%; opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { left: 130%; opacity: 0; }
}
@keyframes tp-glow-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(52, 211, 153, 0.08),
      0 12px 40px -18px var(--accent-glow);
  }
  50% {
    box-shadow:
      0 0 0 4px rgba(52, 211, 153, 0.18),
      0 18px 55px -14px var(--accent-glow),
      inset 0 0 20px rgba(52, 211, 153, 0.1);
  }
}

/* Subtle chevron pulse on ALL link cards — trader-terminal style */
.tp-link-chev {
  animation: tp-chev-nudge 2.4s ease-in-out infinite;
}
@keyframes tp-chev-nudge {
  0%, 100% { transform: translateX(0); opacity: 0.85; }
  50%      { transform: translateX(3px); opacity: 1; }
}

.tp-link { position: relative; }

/* ---------- Stats box ---------- */
.tp-stats-wrap {
  padding: 2px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.3), rgba(16, 185, 129, 0.05));
  margin-bottom: 10px;
}
.tp-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-radius: 12px;
  background: rgba(5, 12, 7, 0.9);
  padding: 8px 6px;
}
.tp-stat { text-align: center; padding: 0 2px; }
.tp-stat-value {
  font-family: var(--tp-font-statValue, inherit);
  font-size: 15px;
  font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.tp-stat-label {
  font-family: var(--tp-font-statLabel, inherit);
  margin-top: 2px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
  line-height: 1.15;
}

/* ---------- Motto (featured quote) card ---------- */
.tp-motto {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--accent);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.14), rgba(16, 185, 129, 0.04));
  box-shadow: 0 10px 30px -18px var(--accent-glow);
  margin-bottom: 10px;
}
.tp-motto-quote {
  font-family: 'Great Vibes', cursive;
  font-size: 30px;
  line-height: 0.5;
  color: var(--accent);
  padding-top: 12px;
}
.tp-motto-quote.closing { padding-top: 22px; }
.tp-motto-text {
  font-family: var(--tp-font-motto, inherit);
  display: flex;
  flex-direction: column;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
}
.tp-motto-text span:first-child { color: var(--text); }
.tp-motto-text span:last-child  { color: var(--accent); font-weight: 800; }
.tp-motto-chart { color: var(--accent); width: 32px; height: 24px; }

/* ---------- Instagram follow card ---------- */
.tp-ig-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(232, 121, 249, 0.12), transparent 55%),
    radial-gradient(120% 120% at 100% 100%, rgba(249, 115, 22, 0.10), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  color: var(--text);
  margin-bottom: 10px;
  transition: transform 140ms ease, border-color 140ms ease;
}
.tp-ig-card:hover {
  transform: translateY(-1px);
  border-color: rgba(232, 121, 249, 0.4);
}
.tp-ig-ring {
  --sz: 54px;
  width: var(--sz); height: var(--sz);
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 220deg,
    #f9ce34 0%, #ee2a7b 25%, #6228d7 50%, #ee2a7b 75%, #f9ce34 100%);
  flex-shrink: 0;
}
.tp-ig-avatar {
  display: block;
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-1);
  border: 2px solid var(--bg-0);
}
.tp-ig-body { min-width: 0; }
.tp-ig-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp-ig-handle {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 1px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.tp-ig-bio {
  margin-top: 4px;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tp-ig-follow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(120deg, #f9ce34 0%, #ee2a7b 45%, #6228d7 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 22px -10px rgba(238, 42, 123, 0.65);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---------- Footer ---------- */
.tp-footer {
  font-family: var(--tp-font-footer, inherit);
  text-align: center;
  color: var(--text-mute);
  font-size: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.tp-footer strong { color: var(--text); font-weight: 800; }
.tp-footer .copy {
  margin-top: 2px;
  color: rgba(234, 255, 242, 0.32);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- Icon tiles (shared with admin) ---------- */
.tp-icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}
.tp-icon-inner svg { width: 100%; height: 100%; }
.tp-bg-sky      { background: rgba(56, 189, 248, 0.16); }
.tp-bg-fuchsia  { background: rgba(232, 121, 249, 0.16); }
.tp-bg-red      { background: rgba(239, 68, 68, 0.16); }
.tp-bg-emerald  { background: rgba(16, 185, 129, 0.20); }
.tp-bg-slate    { background: rgba(148, 163, 184, 0.14); }
.tp-bg-indigo   { background: rgba(99, 102, 241, 0.16); }
.tp-bg-blue     { background: rgba(59, 130, 246, 0.16); }
.tp-bg-cyan     { background: rgba(34, 211, 238, 0.16); }
.tp-bg-orange   { background: rgba(249, 115, 22, 0.16); }
.tp-bg-amber    { background: rgba(245, 158, 11, 0.16); }
.tp-bg-violet   { background: rgba(139, 92, 246, 0.16); }
.tp-bg-teal     { background: rgba(20, 184, 166, 0.16); }
.tp-text-sky      { color: #38bdf8; }
.tp-text-fuchsia  { color: #e879f9; }
.tp-text-red      { color: #f87171; }
.tp-text-emerald  { color: #34d399; }
.tp-text-slate    { color: #cbd5e1; }
.tp-text-indigo   { color: #a5b4fc; }
.tp-text-blue     { color: #60a5fa; }
.tp-text-cyan     { color: #67e8f9; }
.tp-text-orange   { color: #fb923c; }
.tp-text-amber    { color: #fbbf24; }
.tp-text-violet   { color: #c4b5fd; }
.tp-text-teal     { color: #5eead4; }
.tp-text-white    { color: #ffffff; }
.tp-icon-tile.tp-icon-custom {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
}
.tp-icon-tile.tp-icon-custom img { border-radius: 10px; }


/* ========================================================================
   ADMIN — polished dark editor with side navigation
   ======================================================================== */
.tp-admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  position: relative;
  z-index: 2;
  align-items: start;
}

@media (max-width: 820px) {
  .tp-admin-shell { grid-template-columns: 1fr; gap: 14px; padding: 14px 12px 60px; }
}

.tp-side {
  position: sticky;
  top: 20px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (max-width: 820px) {
  .tp-side { position: static; }
}

.tp-side-brand { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tp-side-title { font-size: 16px; font-weight: 900; letter-spacing: 0.02em; color: var(--text); }
.tp-side-sub   { font-size: 10px; font-weight: 700; letter-spacing: 0.28em; text-transform: uppercase; color: var(--accent); margin-top: 2px; }

.tp-side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
@media (max-width: 820px) {
  .tp-side-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .tp-side-nav::-webkit-scrollbar { display: none; }
}

.tp-side-item {
  all: unset;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  border: 1px solid transparent;
}
.tp-side-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.tp-side-item.active {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.25);
  color: var(--text);
}
.tp-side-item.active span { color: var(--text); }
.tp-side-item span { color: inherit; }
@media (max-width: 820px) {
  .tp-side-item {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
  }
}

.tp-side-foot { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
@media (max-width: 820px) {
  .tp-side-foot { flex-direction: row; }
  .tp-side-foot .tp-btn { flex: 1; }
}

.tp-main { min-width: 0; }
.tp-panel { animation: tp-fade 180ms ease-out; }
@keyframes tp-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Legacy container name — kept so the login screen still renders */
.tp-admin {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 80px;
  position: relative;
  z-index: 2;
}
.tp-admin h1 { margin: 4px 0 2px; font-size: 24px; font-weight: 900; }
.tp-admin .lead-hint {
  font-size: 11px; font-weight: 800; color: var(--accent);
  letter-spacing: 0.28em; text-transform: uppercase;
}
.tp-admin-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 20px;
}
.tp-btn {
  height: 36px; padding: 0 14px;
  border-radius: 10px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 120ms ease, border-color 120ms ease;
}
.tp-btn:hover { background: rgba(255, 255, 255, 0.08); }
.tp-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tp-btn.primary {
  background: var(--accent); color: #031018; border-color: transparent;
}
.tp-btn.primary:hover { background: #6ee7b7; }
.tp-btn.danger {
  color: #fecaca; border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

.tp-card {
  border-radius: 18px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  padding: 16px; margin-bottom: 14px;
}
.tp-card-title {
  margin: 0 0 12px; font-size: 11px; font-weight: 800;
  letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--text-mute);
}
.tp-grid-2 { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .tp-grid-2 { grid-template-columns: 1fr 1fr; }
  .tp-full   { grid-column: 1 / -1; }
}
.tp-field label {
  display: block; font-size: 10px; font-weight: 800;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 4px;
}
.tp-input, .tp-textarea, .tp-select {
  width: 100%; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03); color: var(--text);
  font-size: 13px; font-family: inherit; outline: none;
}
.tp-input:focus, .tp-textarea:focus, .tp-select:focus {
  border-color: var(--accent);
}
.tp-textarea { resize: vertical; min-height: 72px; }

.tp-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 8px;
  transition: opacity 120ms ease;
  flex-wrap: wrap;
}
.tp-row.inactive { opacity: 0.5; }
.tp-row-main { flex: 1; min-width: 200px; }
.tp-row-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700;
  flex-wrap: wrap;
}
.tp-row-url {
  margin-top: 2px; font-size: 11px; color: var(--text-mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tp-icon-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim); cursor: pointer; padding: 0;
}
.tp-icon-btn:hover  { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.tp-icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.tp-icon-btn.star.on { color: var(--gold); }

.tp-row-editor {
  width: 100%;
  border-top: 1px solid var(--line);
  padding-top: 12px; margin-top: 10px;
  display: none;
}
.tp-row-editor.open { display: block; }

.tp-icon-picker {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.tp-icon-picker button {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 6px; border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-mute);
  font-size: 9px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer;
}
.tp-icon-picker button.selected {
  border-color: var(--accent);
  background: rgba(52, 211, 153, 0.14);
  color: #d1fae5;
}

.tp-add-form {
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  padding: 16px; margin-top: 18px;
}
.tp-add-form h2 {
  margin: 0 0 10px; font-size: 12px; font-weight: 800;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.tp-add-form h2 .plus { color: var(--accent); }

.tp-notice {
  padding: 10px 14px; border-radius: 12px;
  font-size: 12px; margin-bottom: 12px;
}
.tp-notice.ok  { background: rgba(16, 185, 129, 0.14); color: #a7f3d0; border: 1px solid rgba(16, 185, 129, 0.3); }
.tp-notice.err { background: rgba(239, 68, 68, 0.14); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.35); }

/* Login */
.tp-login {
  max-width: 360px; margin: 100px auto 0;
  padding: 32px 26px; border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
}
.tp-login .tag {
  color: var(--accent); font-size: 11px; font-weight: 800;
  letter-spacing: 0.32em; text-transform: uppercase;
}
.tp-login h1 { margin: 8px 0 6px; font-size: 22px; font-weight: 900; }
.tp-login p { margin: 0 0 20px; color: var(--text-dim); font-size: 13px; }
.tp-login input {
  height: 46px; padding: 0 14px;
  border-radius: 12px; width: 100%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03); color: var(--text);
  font-size: 14px;
}
.tp-login button {
  height: 44px; border-radius: 12px; width: 100%;
  margin-top: 10px; background: var(--accent);
  color: #031018; font-weight: 800; font-size: 14px;
  border: none; cursor: pointer;
}

/* Analytics — advanced dashboard */
.tp-analytics { display: block; }
.tp-analytics .cell {
  display: inline-block;
  padding: 14px 12px; margin-right: 8px; margin-bottom: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(52, 211, 153, 0.05);
  min-width: 100px; text-align: center;
}
.tp-analytics .val { font-size: 22px; font-weight: 900; color: var(--accent); }
.tp-analytics .lbl {
  font-size: 9px; font-weight: 800; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--text-mute); margin-top: 2px;
}

.tp-al-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.tp-al-tile {
  padding: 12px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(52,211,153,0.06), rgba(52,211,153,0.02));
  text-align: center;
}
.tp-al-tile .v {
  font-size: 22px; font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.tp-al-tile .v small { font-size: 12px; color: var(--text-mute); font-weight: 700; }
.tp-al-tile .l {
  margin-top: 2px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-mute);
}

.tp-al-block {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 12px;
}
.tp-al-hdr {
  margin-bottom: 10px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--text-mute);
}
.tp-al-legend {
  display: flex; justify-content: space-between;
  margin-top: 4px;
  font-size: 10px; color: var(--text-mute);
}

.tp-al-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.tp-al-toprow {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.tp-al-toprow:last-child { border-bottom: none; }
.tp-al-toprow .rank {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(52,211,153,0.14);
  color: var(--accent);
  font-size: 11px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.tp-al-toprow .ttl { font-size: 12px; font-weight: 700; color: var(--text); }
.tp-al-toprow .bar {
  margin-top: 5px;
  height: 5px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
}
.tp-al-toprow .bar::before {
  content: '';
  position: absolute; inset: 0;
  width: var(--pct); border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), rgba(52, 211, 153, 0.5));
}
.tp-al-toprow .val { text-align: right; font-variant-numeric: tabular-nums; }
.tp-al-toprow .val strong { display: block; color: var(--text); font-weight: 900; }
.tp-al-toprow .val small  { color: var(--text-mute); font-size: 10px; }

.tp-al-mini {
  display: grid;
  grid-template-columns: 20px 60px 1fr 40px;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text-dim);
}
.tp-al-mini .ic { font-size: 14px; }
.tp-al-mini .dot { width: 10px; height: 10px; border-radius: 50%; margin-left: 5px; }
.tp-al-mini .ttl { text-transform: capitalize; color: var(--text); }
.tp-al-mini .bar {
  height: 5px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.tp-al-mini .bar span { display: block; height: 100%; border-radius: 3px; }
.tp-al-mini .num {
  text-align: right; font-weight: 900;
  color: var(--accent); font-variant-numeric: tabular-nums;
}

.tp-al-recent {
  display: grid;
  grid-template-columns: 22px 62px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12px;
}
.tp-al-recent:last-child { border-bottom: none; }
.tp-al-recent .dev { text-align: center; font-size: 14px; }
.tp-al-recent .src {
  font-size: 10px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tp-al-recent .ttl {
  color: var(--text); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tp-al-recent .ago { color: var(--text-mute); font-size: 11px; }

.tp-clicks-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 800; color: #a7f3d0;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.28);
  font-variant-numeric: tabular-nums;
}
.tp-slug-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.tp-copy-btn {
  cursor: pointer; padding: 4px 10px; font-size: 10px; font-weight: 700;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim); border-radius: 6px;
}
.tp-copy-btn:hover { color: var(--text); }

.tp-upload-btn {
  display: inline-block;
  cursor: pointer; padding: 6px 10px; border-radius: 8px;
  font-size: 11px; font-weight: 700;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.02); color: var(--text-dim);
}
.tp-upload-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.tp-upload-btn input[type=file] { display: none; }

/* Theme picker cards */
.tp-themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.tp-theme-card {
  cursor: pointer;
  border-radius: 14px;
  padding: 10px;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  transition: transform 120ms ease, border-color 120ms ease;
  text-align: left;
  color: var(--text);
}
.tp-theme-card:hover { transform: translateY(-1px); }
.tp-theme-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.14);
}
.tp-theme-swatch {
  height: 44px;
  border-radius: 10px;
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}
.tp-theme-swatch::before {
  content: '';
  position: absolute;
  right: 8px; top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 0 0 8px currentColor;
}
.tp-theme-name {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.tp-theme-sub {
  margin-top: 2px;
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
