/* =========================================================
   Poly Syncer panel — sidebar + main layout
   Reuses tokens from style.css (which is loaded first).
   ========================================================= */

.panel-body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px 1fr;
  grid-template-rows: 64px 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
}

/* ---------- Sidebar ---------- */
.panel-sidebar {
  grid-area: sidebar;
  position: sticky; top: 0;
  height: 100vh;
  background:
    radial-gradient(ellipse 60% 40% at 0% 0%, rgba(34,211,238,.08), transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, #060912 100%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 18px 18px;
  overflow: hidden;
  z-index: 20;
}
.ps-brand { padding: 0 6px 18px; flex-shrink: 0; }
.ps-brand .brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.ps-brand .brand-text { font-size: 22px; font-weight: 800; letter-spacing: -.035em; line-height: 1; color: var(--text); }
.ps-brand .brand-accent { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ps-brand .brand-mark { filter: drop-shadow(0 6px 18px rgba(34,211,238,.4)); }
.ps-brand .brand-mark .chevron-back { animation: chevron-copy 5s ease-in-out infinite; transform-origin: center; }

.ps-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-top: 0;
  padding: 6px 0 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
.ps-nav::-webkit-scrollbar { width: 6px; }
.ps-nav::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
.ps-nav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.ps-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  color: var(--text-muted);
  font-size: 14px; font-weight: 500;
  border-radius: 9px;
  border: 1px solid transparent;
  text-decoration: none;
  letter-spacing: -.005em;
  transition: color .2s, background .2s, border-color .2s;
  position: relative;
}
.ps-nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,.03);
}
.ps-nav a.is-active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(34,211,238,.10), rgba(34,197,94,.05));
  border-color: rgba(34,211,238,.25);
}
.ps-nav a.is-active::before {
  content: '';
  position: absolute;
  left: 4px; top: 25%; bottom: 25%;
  width: 3px;
  border-radius: 2px;
  background: var(--gradient);
}
.ps-nav a.is-active { padding-left: 14px; }
.ps-nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; color: currentColor; }
.ps-nav a.is-active .ps-nav-icon { color: var(--accent); opacity: 1; }

/* Plan card at bottom */
.ps-plan {
  margin-top: 14px;
  padding: 14px 16px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid var(--border-2);
  border-radius: 10px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
  overflow: hidden;
}
.ps-plan::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(34,211,238,.07), transparent 60%);
  pointer-events: none;
}
.ps-plan.plan-elite::before {
  background: linear-gradient(135deg, rgba(167,139,250,.12), transparent 60%);
}
.ps-plan > * { position: relative; }
.ps-plan-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-dim);
  font-weight: 600;
}
.ps-plan strong {
  font-size: 18px; font-weight: 700; line-height: 1;
  color: var(--text);
  letter-spacing: -.01em;
}
.ps-plan.plan-pro strong   { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ps-plan.plan-elite strong { background: linear-gradient(135deg,#a78bfa,#22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ps-plan-meta { font-size: 11.5px; color: var(--text-dim); display: block; line-height: 1.5; }
.ps-plan-meta time { color: var(--text-muted); }
.ps-plan-days {
  display: inline-block; margin-top: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  font-family: var(--font-mono);
  padding: 2px 7px; border-radius: 5px;
  background: rgba(34,211,238,.12); color: var(--accent); border: 1px solid rgba(34,211,238,.32);
}
.ps-plan-cta {
  margin-top: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: color .2s;
}
.ps-plan-cta:hover { color: #67e8f9; }

/* ---------- Topbar ---------- */
.panel-topbar {
  grid-area: topbar;
  position: sticky; top: 0;
  min-height: 76px;
  display: flex; align-items: center;
  gap: 16px;
  padding: 12px 28px;
  background: rgba(11,15,26,.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.pt-title {
  flex: 1;
  font-size: 18px; font-weight: 700;
  letter-spacing: -.015em;
}

/* ---- Premium per-page title block (accent bar + icon glyph + gradient title + sub) ---- */
.pt-title-block {
  flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0;
}
.pt-title-bar {
  width: 3px; height: 36px; flex-shrink: 0; border-radius: 100px;
  background: var(--ptc, #22d3ee);
  box-shadow: 0 0 12px -2px color-mix(in oklab, var(--ptc, #22d3ee) 65%, transparent);
}
.pt-title-glyph {
  width: 38px; height: 38px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ptc, #22d3ee);
  background: color-mix(in oklab, var(--ptc, #22d3ee) 14%, transparent);
  border: 1px solid color-mix(in oklab, var(--ptc, #22d3ee) 32%, transparent);
  box-shadow: 0 0 0 1px rgba(255,255,255,.04) inset, 0 6px 18px -10px color-mix(in oklab, var(--ptc, #22d3ee) 50%, transparent);
}
.pt-title-glyph svg { width: 19px; height: 19px; }
.pt-title-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pt-title-h {
  margin: 0;
  font-size: 19px; font-weight: 700; letter-spacing: -.018em; line-height: 1.15;
  background: linear-gradient(180deg, var(--text), #93a3bf 130%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pt-title-sub {
  font-size: 12px; color: var(--text-muted); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 720px) {
  .pt-title-glyph { width: 34px; height: 34px; border-radius: 10px; }
  .pt-title-h { font-size: 16.5px; }
  .pt-title-sub { display: none; }
}
.pt-actions { display: flex; align-items: center; gap: 10px; }
.pt-wallet {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 100px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.pt-wallet:hover { border-color: rgba(34,211,238,.4); background: var(--surface-2); }
.pt-wallet code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}
.pt-wallet-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(34,197,94,.18);
  animation: pulse-g 1.6s ease-in-out infinite;
}
.pt-wallet-caret { width: 11px; height: 7px; color: var(--text-dim); margin-left: 2px; transition: transform .2s; }
.pt-wallet[aria-expanded="true"] .pt-wallet-caret { transform: rotate(180deg); }

.pt-wallet-wrap { position: relative; }
.pt-wallet-menu {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  min-width: 280px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
  z-index: 30;
  animation: pwm-fade .18s ease both;
}
.pt-wallet-menu[hidden] { display: none; }
@keyframes pwm-fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.pt-wallet-menu-head {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px 13px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.pt-wallet-menu-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-dim); font-weight: 600;
}
.pt-wallet-menu-head code {
  font-family: var(--font-mono);
  font-size: 12.5px; color: var(--text);
  word-break: break-all;
  display: block;
  margin-top: 2px;
}
.pt-wallet-menu hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}
.pt-wallet-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: left;
}
.pt-wallet-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .9; }
.pt-wallet-menu-item:hover { background: rgba(255,255,255,.04); }
.pt-wallet-menu-item.is-danger { color: var(--danger); }
.pt-wallet-menu-item.is-danger:hover { background: rgba(248,113,113,.08); }
.pt-wallet-menu-item.is-success { color: var(--accent-2); }

.panel-mobile-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border-2);
  background: transparent;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer;
}
.panel-mobile-toggle span {
  display: block; width: 16px; height: 2px;
  background: var(--text); border-radius: 2px;
}

/* ---------- Main content ---------- */
.panel-main {
  grid-area: main;
  padding: 28px clamp(20px, 3.5vw, 40px) 60px;
  min-width: 0;
  overflow-x: hidden;
}

/* ---------- Reusable panel components ---------- */

.pc-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 24px;
  position: relative;
  isolation: isolate;
}
.pc-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}
.pc-card-title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-dim);
  font-weight: 700;
}
.pc-card h3 { font-size: 17px; font-weight: 700; letter-spacing: -.015em; margin: 0; }

.pc-grid {
  display: grid;
  gap: 16px;
}
.pc-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.pc-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.pc-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Stat tile */
.pc-stat {
  display: flex; flex-direction: column; gap: 4px;
}
.pc-stat-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  font-weight: 600;
}
.pc-stat-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1.1;
}
.pc-stat-value.up { color: var(--accent-2); }
.pc-stat-value.down { color: var(--danger); }
.pc-stat-meta { font-size: 12.5px; color: var(--text-muted); }

/* =======================================================================
   Section title — premium framed panel.
   Themed body aurora per colour variant (head-cyan/violet/green/...).
   Iridescent gradient border + right-edge bloom are universal so all
   panels feel like the same product family.
   ======================================================================= */
.pc-section-head {
  position: relative; isolation: isolate;
  display: flex; align-items: center; justify-content: space-between;
  margin: 30px 0 16px;
  padding: 16px 24px 16px 22px;
  gap: 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  overflow: hidden;
  /* Defaults — overridden per .head-* variant below */
  --head-c: linear-gradient(180deg,#22d3ee,#22c55e);
  --head-solo: #22d3ee;
  --head-aurora: linear-gradient(270deg,
    rgba(34,211,238,.14)   0%,
    rgba(34,197,94,.085)  22%,
    rgba(167,139,250,.06)  55%,
    rgba(255,255,255,.025) 85%,
    rgba(255,255,255,.012) 100%);
  --head-bloom-1: rgba(34,211,238,.30);
  --head-bloom-2: rgba(167,139,250,.10);
  --head-edge:   rgba(34,211,238,.45);
  --head-edge-2: rgba(167,139,250,.30);
  background: var(--head-aurora);
  backdrop-filter: blur(14px) saturate(165%);
  -webkit-backdrop-filter: blur(14px) saturate(165%);
  border: 1px solid var(--head-edge);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.10),
    0 0 0 1px var(--head-edge-2),
    0 14px 32px -22px var(--head-bloom-1);
}
/* Right-edge spotlight bleed — themed per variant */
.pc-section-head::before {
  content: ""; position: absolute;
  right: -70px; top: 50%;
  width: 240px; height: 240px;
  transform: translateY(-50%);
  background: radial-gradient(circle, var(--head-bloom-1) 0%, var(--head-bloom-2) 45%, transparent 68%);
  filter: blur(26px);
  z-index: -1; pointer-events: none;
}
/* Iridescent border disabled — keeping the rule commented for easy revival.
.pc-section-head::after {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg,
    rgba(34,211,238,.55)   0%,
    rgba(167,139,250,.55) 32%,
    rgba(236,72,153,.45)  58%,
    rgba(251,191,36,.40)  82%,
    rgba(255,255,255,.10) 100%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
*/
/* Inner blocks above the iridescent stroke */
.pc-section-head > * { position: relative; z-index: 1; }
.pc-section-head > div:first-child {
  padding-left: 16px;
}
.pc-section-head > div:first-child::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px; border-radius: 100px;
  background: var(--head-c);
  box-shadow: 0 0 12px -1px color-mix(in oklab, var(--head-solo) 70%, transparent);
}
.pc-section-head h2,
.pc-section-head h3 {
  margin: 0;
  font-size: 22px; font-weight: 700; line-height: 1.18;
  letter-spacing: -.022em;
  background: linear-gradient(180deg, #ffffff 0%, #8a9ab5 145%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  display: inline-flex; align-items: center; gap: 9px;
}
.pc-section-head h2::before,
.pc-section-head h3::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--head-solo);
  box-shadow: 0 0 8px -1px var(--head-solo);
  flex-shrink: 0;
}
.pc-section-head p {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 720px;
}
.pc-section-head p strong { color: var(--text); font-weight: 600; }

/* Colour variants — each gets its own aurora body gradient + bloom hue.
   The iridescent border stroke is shared across all variants for cohesion. */
.pc-section-head.head-cyan {
  --head-c: linear-gradient(180deg,#22d3ee,#0ea5e9); --head-solo:#22d3ee;
  --head-aurora: linear-gradient(270deg,
    rgba(34,211,238,.14) 0%, rgba(34,197,94,.085) 22%,
    rgba(167,139,250,.06) 55%, rgba(255,255,255,.012) 100%);
  --head-bloom-1: rgba(34,211,238,.30);
  --head-bloom-2: rgba(34,197,94,.10);
  --head-edge:   rgba(34,211,238,.45);
  --head-edge-2: rgba(34,197,94,.30);
}
.pc-section-head.head-violet {
  --head-c: linear-gradient(180deg,#a78bfa,#7c3aed); --head-solo:#a78bfa;
  --head-aurora: linear-gradient(270deg,
    rgba(167,139,250,.14) 0%, rgba(236,72,153,.075) 24%,
    rgba(34,211,238,.045) 58%, rgba(255,255,255,.012) 100%);
  --head-bloom-1: rgba(167,139,250,.32);
  --head-bloom-2: rgba(236,72,153,.10);
  --head-edge:   rgba(167,139,250,.45);
  --head-edge-2: rgba(236,72,153,.30);
}
.pc-section-head.head-green {
  --head-c: linear-gradient(180deg,#22c55e,#16a34a); --head-solo:#22c55e;
  --head-aurora: linear-gradient(270deg,
    rgba(34,197,94,.14) 0%, rgba(20,184,166,.085) 22%,
    rgba(6,182,212,.045) 55%, rgba(255,255,255,.012) 100%);
  --head-bloom-1: rgba(34,197,94,.30);
  --head-bloom-2: rgba(20,184,166,.10);
  --head-edge:   rgba(34,197,94,.45);
  --head-edge-2: rgba(20,184,166,.30);
}
.pc-section-head.head-amber {
  --head-c: linear-gradient(180deg,#fbbf24,#f59e0b); --head-solo:#fbbf24;
  --head-aurora: linear-gradient(270deg,
    rgba(251,191,36,.14) 0%, rgba(251,146,60,.085) 22%,
    rgba(236,72,153,.045) 56%, rgba(255,255,255,.012) 100%);
  --head-bloom-1: rgba(251,191,36,.32);
  --head-bloom-2: rgba(251,146,60,.10);
  --head-edge:   rgba(251,191,36,.45);
  --head-edge-2: rgba(251,146,60,.30);
}
.pc-section-head.head-pink {
  --head-c: linear-gradient(180deg,#ec4899,#db2777); --head-solo:#ec4899;
  --head-aurora: linear-gradient(270deg,
    rgba(236,72,153,.14) 0%, rgba(244,63,94,.075) 24%,
    rgba(251,191,36,.045) 58%, rgba(255,255,255,.012) 100%);
  --head-bloom-1: rgba(236,72,153,.32);
  --head-bloom-2: rgba(244,63,94,.10);
  --head-edge:   rgba(236,72,153,.45);
  --head-edge-2: rgba(244,63,94,.30);
}
.pc-section-head.head-red {
  --head-c: linear-gradient(180deg,#f87171,#ef4444); --head-solo:#f87171;
  --head-aurora: linear-gradient(270deg,
    rgba(248,113,113,.14) 0%, rgba(251,146,60,.085) 22%,
    rgba(251,191,36,.045) 56%, rgba(255,255,255,.012) 100%);
  --head-bloom-1: rgba(248,113,113,.32);
  --head-bloom-2: rgba(251,146,60,.10);
  --head-edge:   rgba(248,113,113,.45);
  --head-edge-2: rgba(251,146,60,.30);
}

/* Same accent-bar treatment for any "premium subhead" block */
.pc-subhead {
  position: relative;
  padding-left: 16px;
  margin: 0 0 14px;
  --head-c: linear-gradient(180deg,#22d3ee,#22c55e);
  --head-solo: #22d3ee;
}
.pc-subhead::before {
  content: '';
  position: absolute;
  left: 0; top: 5px; bottom: 5px;
  width: 3px; border-radius: 100px;
  background: var(--head-c);
  box-shadow: 0 0 12px -1px color-mix(in oklab, var(--head-solo) 70%, transparent);
}
.pc-subhead h3, .pc-subhead h4 {
  margin: 0;
  font-size: 19px; font-weight: 700; letter-spacing: -.02em; line-height: 1.18;
  background: linear-gradient(180deg, #ffffff 0%, #8a9ab5 145%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  display: inline-flex; align-items: center; gap: 9px;
}
.pc-subhead h3::before, .pc-subhead h4::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--head-solo);
  box-shadow: 0 0 8px -1px var(--head-solo);
  flex-shrink: 0;
}
.pc-subhead p {
  margin: 6px 0 0; color: var(--text-muted); font-size: 13.5px; line-height: 1.55;
  max-width: 700px;
}
.pc-subhead p strong { color: var(--text); font-weight: 600; }
.pc-subhead.head-cyan   { --head-c: linear-gradient(180deg,#22d3ee,#0ea5e9); --head-solo:#22d3ee; }
.pc-subhead.head-violet { --head-c: linear-gradient(180deg,#a78bfa,#7c3aed); --head-solo:#a78bfa; }
.pc-subhead.head-green  { --head-c: linear-gradient(180deg,#22c55e,#16a34a); --head-solo:#22c55e; }
.pc-subhead.head-amber  { --head-c: linear-gradient(180deg,#fbbf24,#f59e0b); --head-solo:#fbbf24; }
.pc-subhead.head-pink   { --head-c: linear-gradient(180deg,#ec4899,#db2777); --head-solo:#ec4899; }
.pc-subhead.head-red    { --head-c: linear-gradient(180deg,#f87171,#ef4444); --head-solo:#f87171; }

/* Feature row — gated/locked */
.pc-feature {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  transition: border-color .2s, background .2s;
}
.pc-feature:hover { border-color: var(--border-2); }
.pc-feature.is-locked { opacity: .55; }
.pc-feature-tick {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(34,197,94,.15);
  color: var(--accent-2);
  flex-shrink: 0;
}
.pc-feature.is-locked .pc-feature-tick {
  background: rgba(255,255,255,.04);
  color: var(--text-dim);
}
.pc-feature-tick svg { width: 12px; height: 12px; }
.pc-feature-label { font-size: 14px; font-weight: 500; color: var(--text); }
.pc-feature-badge {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 100px;
  border: 1px solid var(--border-2);
}
.pc-feature-badge.tier-trial { background: rgba(255,255,255,.04); color: var(--text-muted); }
.pc-feature-badge.tier-pro   { background: rgba(34,211,238,.1); color: var(--accent); border-color: rgba(34,211,238,.3); }
.pc-feature-badge.tier-elite { background: linear-gradient(135deg, rgba(167,139,250,.18), rgba(34,211,238,.12)); color: #c4b5fd; border-color: rgba(167,139,250,.35); }

/* Plan picker (billing) */
.plan-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.plan-pick {
  position: relative;
  padding: 26px 22px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border-2);
  border-radius: 8px;
  display: flex; flex-direction: column; gap: 12px;
  isolation: isolate;
  cursor: pointer;
  transition: transform .2s var(--ease), border-color .25s, box-shadow .25s;
}
.plan-pick:hover { transform: translateY(-2px); border-color: rgba(34,211,238,.4); }
.plan-pick.is-current { border-color: var(--accent-2); box-shadow: 0 0 0 1px rgba(34,197,94,.3); }
.plan-pick.tier-elite { background: linear-gradient(180deg, rgba(167,139,250,.06), var(--surface-2)); border-color: rgba(167,139,250,.3); }
.plan-pick-name { font-size: 14px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; }
.plan-pick-price { display: flex; align-items: baseline; gap: 6px; }
.plan-pick-price .num { font-size: 36px; font-weight: 800; letter-spacing: -.02em; }
.plan-pick.tier-pro .plan-pick-price .num   { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plan-pick.tier-elite .plan-pick-price .num { background: linear-gradient(135deg,#a78bfa,#22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plan-pick-price .per { font-size: 13px; color: var(--text-muted); }
.plan-pick-tagline { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; }
.plan-pick-list { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.plan-pick-list li { padding-left: 20px; position: relative; color: var(--text); }
.plan-pick-list li::before {
  content: '';
  position: absolute; left: 2px; top: 6px;
  width: 12px; height: 12px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12l5 5L20 7'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
}
.plan-pick-cta { margin-top: auto; }
.plan-pick-current-badge {
  position: absolute;
  top: -10px; right: 18px;
  padding: 4px 10px;
  background: var(--accent-2);
  color: #06241a;
  border-radius: 100px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
}

/* Empty state */
.pc-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.pc-empty svg { width: 48px; height: 48px; margin: 0 auto 14px; color: var(--text-dim); }
.pc-empty h3 { font-size: 17px; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.pc-empty p { font-size: 14px; margin: 0 0 18px; max-width: 380px; margin-left: auto; margin-right: auto; }

/* Bot control banner — top of dashboard overview */
.pc-bot-control {
  display: flex; align-items: center; gap: 18px;
  padding: 18px 24px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border-2);
  border-radius: 8px;
  position: relative;
  isolation: isolate;
  flex-wrap: wrap;
}
.pc-bot-control.is-running {
  background: linear-gradient(180deg, rgba(34,197,94,.05), var(--surface-2));
  border-color: rgba(34,197,94,.4);
}
.pc-bot-status { display: flex; align-items: center; gap: 14px; min-width: 180px; }
.pc-bot-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.pc-bot-control.is-running .pc-bot-dot {
  background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(34,197,94,.18);
  animation: pulse-g 1.6s ease-in-out infinite;
}
.pc-bot-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-dim); font-weight: 600; line-height: 1; margin-bottom: 4px;
}
.pc-bot-status strong {
  font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.015em;
}
.pc-bot-control.is-running .pc-bot-status strong { color: var(--accent-2); }
.pc-bot-meta {
  flex: 1;
  font-size: 13px; color: var(--text-muted);
}
.pc-bot-meta time { color: var(--text); font-family: var(--font-mono); font-size: 12.5px; }
.pc-bot-control .btn[disabled] {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}

/* "Locked" pattern — content stays VISIBLE so users can see what they're missing.
   Only the action buttons are disabled, paired with a small upgrade badge. */
.pc-locked .pc-card-cta-row > .btn,
.pc-locked button[data-action]:not(.pc-upgrade-link) {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(.4);
  pointer-events: none;
}
.pc-locked-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 100px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  background: rgba(167,139,250,.12);
  color: #c4b5fd;
  border: 1px solid rgba(167,139,250,.32);
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s, border-color .2s, transform .2s;
}
.pc-locked-badge:hover { background: rgba(167,139,250,.2); border-color: rgba(167,139,250,.5); transform: translateY(-1px); }
.pc-locked-badge svg { width: 11px; height: 11px; opacity: .9; }
.pc-locked-badge.tier-pro   { background: rgba(34,211,238,.1); color: var(--accent); border-color: rgba(34,211,238,.32); }
.pc-locked-badge.tier-pro:hover { background: rgba(34,211,238,.18); border-color: rgba(34,211,238,.5); }
.pc-locked-badge.tier-elite { background: linear-gradient(135deg, rgba(167,139,250,.16), rgba(34,211,238,.1)); }

/* Tables */
.pc-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  overflow-x: auto;
}
.pc-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.pc-table th, .pc-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.pc-table th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  font-weight: 600;
  background: rgba(255,255,255,.02);
}
.pc-table tbody tr:last-child td { border-bottom: 0; }
.pc-table tbody tr:hover { background: rgba(34,211,238,.03); }
.pc-table .num { text-align: right; font-family: var(--font-mono); }
.pc-table .up { color: var(--accent-2); }
.pc-table .down { color: var(--danger); }
.pc-table code { font-family: var(--font-mono); font-size: 12.5px; color: var(--text); background: rgba(255,255,255,.04); padding: 3px 8px; border-radius: 5px; }

/* ============= Toasts (bottom-right) ============= */
.pc-toast-container {
  position: fixed; bottom: 22px; right: 22px;
  z-index: 9000;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(360px, calc(100% - 32px));
  pointer-events: none;
  transition: bottom .2s var(--ease);
}
/* When the global Save FAB is visible, lift toasts above it so they don't overlap.
   :has() is supported on every modern browser; works for both desktop and mobile FAB sizes. */
body:has(.pc-save-fab:not([hidden])) .pc-toast-container {
  bottom: 86px;
}
.pc-toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 14px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border-2);
  border-radius: 9px;
  box-shadow: 0 16px 44px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.02);
  pointer-events: auto;
  min-width: 280px;
  opacity: 1;
  transform: none;
}
.pc-toast.is-leaving { opacity: 0; transform: translateX(110%); transition: opacity .2s, transform .25s ease; }
.pc-toast-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pc-toast-icon svg { width: 14px; height: 14px; }
.pc-toast-success { border-color: rgba(34,197,94,.4); }
.pc-toast-success .pc-toast-icon { background: rgba(34,197,94,.18); color: var(--accent-2); box-shadow: 0 0 0 4px rgba(34,197,94,.08); }
.pc-toast-error   { border-color: rgba(248,113,113,.4); }
.pc-toast-error   .pc-toast-icon { background: rgba(248,113,113,.18); color: var(--danger);   box-shadow: 0 0 0 4px rgba(248,113,113,.08); }
.pc-toast-info    { border-color: rgba(34,211,238,.4); }
.pc-toast-info    .pc-toast-icon { background: rgba(34,211,238,.18); color: var(--accent);    box-shadow: 0 0 0 4px rgba(34,211,238,.08); }
.pc-toast-msg {
  flex: 1;
  font-size: 13.5px; font-weight: 500;
  color: var(--text); line-height: 1.45;
  word-break: break-word;
}
.pc-toast-close {
  background: transparent; border: 0;
  color: var(--text-dim);
  font-size: 19px; line-height: 1;
  cursor: pointer; padding: 0 4px;
  align-self: flex-start;
}
.pc-toast-close:hover { color: var(--text); }

/* ============= Modal — base layer (covers .pc-modal-ui, #pcPayModal, etc.) ============= */
.pc-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.pc-modal[hidden] { display: none; }
.pc-modal-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  padding: 28px;
  max-width: 480px;
  width: 100%;
  position: relative;
}
.pc-modal-card h3 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.015em; }
.pc-modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  border: 0; color: var(--text-muted);
  cursor: pointer; font-size: 22px; line-height: 1;
}
.pc-modal-close:hover { background: rgba(255,255,255,.1); color: var(--text); }

/* ============= alert/confirm/prompt variant (window.modal.*) ============= */
.pc-modal-ui {
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 1;
  transition: opacity .18s ease;
}
.pc-modal-ui.is-leaving { opacity: 0; }
.pc-modal-ui .pc-modal-card {
  max-width: 440px;
  text-align: center;
  padding: 32px 28px 22px;
  transition: transform .2s ease, opacity .18s ease;
}
.pc-modal-ui.is-leaving .pc-modal-card { transform: scale(.96); opacity: 0; }
.pcm-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.pcm-icon svg { width: 24px; height: 24px; }
.pcm-icon-info     { background: rgba(34,211,238,.15); color: var(--accent);   box-shadow: 0 0 0 6px rgba(34,211,238,.08); }
.pcm-icon-warn     { background: rgba(251,191,36,.15); color: var(--warn);     box-shadow: 0 0 0 6px rgba(251,191,36,.08); }
.pcm-icon-question { background: rgba(167,139,250,.15); color: #a78bfa;        box-shadow: 0 0 0 6px rgba(167,139,250,.08); }
.pcm-title {
  font-size: 18px; font-weight: 700; letter-spacing: -.015em;
  margin: 0 0 6px; color: var(--text);
}
.pcm-msg {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 14px; line-height: 1.55;
}
.pcm-input {
  margin-top: 14px;
  font-family: var(--font-mono);
  text-align: center;
}
.pcm-actions {
  display: flex; gap: 10px; justify-content: center;
  margin-top: 22px;
}
.pcm-actions .btn { min-width: 120px; }

.btn-danger {
  background: linear-gradient(135deg, #f87171, #ef4444);
  color: #fff;
  border: 0;
  box-shadow: 0 6px 18px rgba(248,113,113,.32), 0 1px 0 rgba(255,255,255,.18) inset;
}
.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(248,113,113,.45), 0 1px 0 rgba(255,255,255,.22) inset;
}

@media (max-width: 560px) {
  .pc-toast-container { right: 12px; bottom: 14px; left: 12px; max-width: none; }
  .pc-toast { min-width: 0; width: 100%; }
  body:has(.pc-save-fab:not([hidden])) .pc-toast-container { bottom: 76px; }
}
@media (max-width: 420px) {
  /* On tiny phones the FAB is full-width across the bottom — push toast even higher */
  body:has(.pc-save-fab:not([hidden])) .pc-toast-container { bottom: 80px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 1024px) {
  .panel-body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }
  .panel-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
  }
  .panel-sidebar.is-open { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); }
  .panel-mobile-toggle { display: inline-flex; }
  .panel-topbar { padding: 0 18px; }
  .panel-main { padding: 22px 16px 60px; }
  .pc-grid.cols-3, .pc-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .plan-picker { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .pc-grid.cols-2, .pc-grid.cols-3, .pc-grid.cols-4 { grid-template-columns: 1fr; }
  .pt-title { font-size: 16px; }
  .pt-title-h { font-size: 15.5px; }
  .pt-wallet code { font-size: 12px; }
}

/* =================================================================
   GLOBAL FLOATING SAVE BUTTON (FAB) — bottom-right, sticks to viewport
   ================================================================= */
.pc-save-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 9500;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 18px 11px 14px;
  background: linear-gradient(135deg, #22d3ee, #22c55e);
  color: #062014;
  border: 0; border-radius: 10px;
  font-size: 13.5px; font-weight: 700; letter-spacing: -.005em;
  cursor: pointer;
  box-shadow:
    0 14px 32px -8px rgba(34,211,238,.45),
    0 0 0 1px rgba(255,255,255,.18) inset,
    0 0 0 1px rgba(0,0,0,.15);
  transition: transform .15s var(--ease), box-shadow .2s, opacity .2s, background .2s;
  font-family: inherit;
}
.pc-save-fab:hover {
  transform: translateY(-2px);
  box-shadow:
    0 18px 38px -10px rgba(34,211,238,.55),
    0 0 0 1px rgba(255,255,255,.25) inset,
    0 0 0 1px rgba(0,0,0,.18);
}
.pc-save-fab:active { transform: translateY(0); }
.pc-save-fab[hidden] { display: none; }
.pc-save-fab:disabled { opacity: .65; cursor: progress; transform: none; }
.pc-save-fab.is-dirty { animation: pc-fab-pop .25s ease; }
.pc-save-fab-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.32);
  flex-shrink: 0;
}
.pc-save-fab-dot[hidden] { display: none; }
.pc-save-fab-ico { flex-shrink: 0; }
.pc-save-fab-kbd {
  display: inline-flex; align-items: center;
  margin-left: 4px; padding: 1px 6px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  background: rgba(0,0,0,.18); color: rgba(6,32,20,.9);
  border-radius: 5px; letter-spacing: .04em;
}
@keyframes pc-fab-pop { 0%,100% { transform: scale(1); } 50% { transform: scale(1.045); } }
@media (max-width: 640px) {
  .pc-save-fab { bottom: 14px; right: 14px; padding: 10px 14px 10px 12px; font-size: 12.5px; }
  .pc-save-fab-kbd { display: none; }
}
@media (max-width: 420px) {
  .pc-save-fab { left: 14px; right: 14px; bottom: 14px; justify-content: center; border-radius: 10px; }
}

/* =================================================================
   COMPREHENSIVE RESPONSIVE PASS — every panel page, mobile-perfect
   ================================================================= */

/* Prevent horizontal scroll caused by inline-styled grids that don't wrap */
.panel-main { min-width: 0; }
.panel-main > * { max-width: 100%; min-width: 0; }
/* `overflow-x: clip` instead of `hidden` so the sidebar can still
   position:sticky inside the grid (overflow:hidden on an ancestor
   defeats sticky positioning in modern browsers). */
html, body { overflow-x: clip; }

/* ---- Tablet: ≤980px ---- */
@media (max-width: 980px) {
  /* Topbar: compact layout, smaller paddings */
  .panel-topbar { padding: 10px 16px; gap: 10px; min-height: 70px; }
  .pt-title-block { gap: 10px; }
  .pt-title-bar   { height: 32px; }

  /* Wallet button — keep visible but compact */
  .pt-wallet { padding: 6px 10px; gap: 7px; }
  .pt-wallet-menu { right: 0; left: auto; min-width: min(260px, calc(100vw - 24px)); max-width: calc(100vw - 24px); }

  /* Command center cockpit — already stacks at 980 */
  .pc-cmd { padding: 16px 16px; border-radius: 8px; }
  .pc-cmd-title { font-size: 20px; }
  .pc-cmd-sub { font-size: 12.5px; }
  .pc-cmd-status { padding: 14px 16px; }
  .pc-cmd-cta { padding: 11px 18px; font-size: 13.5px; }

  /* Stat tiles 4 → 2 cols */
  .pc-stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* Quick action cards 4 → 2 cols (already done) */

  /* Capability cards 3 → 2 cols (already done at 1180) */

  /* Categories board scrolls horizontally below threshold */
  .pc-cat-grid-head { flex-direction: column; align-items: stretch; }
  .pc-cat-tools { width: 100%; }
  .pc-cat-search { flex: 1; min-width: 0; }

  /* Categories hero stats wrap */
  .pc-cat-hero { padding: 22px 18px; }
  .pc-cat-hero-content { grid-template-columns: 1fr; gap: 18px; }
  .pc-cat-hero-stats { width: 100%; }
  .pc-cat-stat { flex: 1; min-width: 140px; }

  /* Settings/leaders/leaderboard 2-col card grids */
  .pc-grid.cols-2 { grid-template-columns: 1fr; }

  /* Section heads — title shrinks slightly */
  .pc-section-head h2,
  .pc-section-head h3 { font-size: 19px; }
  .pc-subhead h3 { font-size: 17px; }
}

/* ---- Phone: ≤640px ---- */
@media (max-width: 640px) {
  .panel-main { padding: 16px 12px 60px; }

  /* Topbar — wallet button shrinks to icon-only */
  .panel-topbar { padding: 8px 12px; min-height: 64px; gap: 8px; }
  .pt-title-block { gap: 8px; }
  .pt-title-bar { height: 28px; }
  .pt-title-glyph { width: 30px; height: 30px; border-radius: 9px; }
  .pt-title-glyph svg { width: 16px; height: 16px; }
  .pt-title-h { font-size: 15px; }
  .pt-actions { gap: 6px; }
  .pt-wallet { padding: 5px 8px; }
  .pt-wallet code { font-size: 11px; }
  .pt-wallet-caret { display: none; }

  /* Command center */
  .pc-cmd { padding: 14px 14px; border-radius: 10px; }
  .pc-cmd-head { padding-bottom: 12px; margin-bottom: 12px; }
  .pc-cmd-title { font-size: 18px; }
  .pc-cmd-sub { font-size: 12px; line-height: 1.45; }
  .pc-cmd-readouts { grid-template-columns: 1fr 1fr; gap: 6px; }
  .pc-cmd-readout { padding: 9px 11px; }
  .pc-cmd-r-val { font-size: 16px; }
  .pc-cmd-log-body { height: 320px; max-height: 320px; padding: 0 10px; }
  .pc-cmd-log-line { grid-template-columns: 60px 50px 1fr; gap: 6px; font-size: 11px; padding: 4px 0; }
  .pc-cmd-log-head { padding: 8px 10px; }
  .pc-cmd-log-title { font-size: 11px; gap: 7px; }
  .pc-cmd-log-state { font-size: 9px; padding: 1px 5px; }
  .pc-cmd-log-counter { display: none; }

  /* Stat grid 2 → 1 */
  .pc-stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pc-stat-tile { padding: 12px 14px 12px; }
  .pc-stat-value { font-size: 22px; }
  .pc-stat-icon { width: 26px; height: 26px; border-radius: 8px; }
  .pc-stat-icon svg { width: 14px; height: 14px; }
  .pc-stat-label { font-size: 10px; }

  /* Quick-actions 2 → 1 */
  .pc-quick-grid { grid-template-columns: 1fr; gap: 10px; }
  .pc-quick-card { padding: 14px 14px; }

  /* Capability cards 2 → 1, tighter padding */
  .pc-feat-grid { grid-template-columns: 1fr; gap: 10px; }
  .pc-feat-card { padding: 14px 16px 12px; }
  .pc-feat-card-head { padding-bottom: 8px; gap: 8px; }
  .pc-feat-progress-track { width: 36px; }
  .pc-feat-row { font-size: 12.5px; padding: 4px 0; }

  /* Section heads */
  .pc-section-head { margin: 22px 0 12px; flex-direction: column; align-items: stretch; }
  .pc-section-head h2,
  .pc-section-head h3 { font-size: 18px; }
  .pc-section-head p { font-size: 12.5px; }
  .pc-overview-head { gap: 12px; margin-bottom: 12px; }
  .pc-overview-head-title { font-size: 18px; }
  .pc-overview-head-sub { font-size: 12.5px; }

  /* Subheads inside cards */
  .pc-subhead h3 { font-size: 16.5px; }
  .pc-subhead p  { font-size: 12.5px; }

  /* Inline 2-col leaderboard cards (Quick-follow + Manual entry) — stack */
  .pc-card[style*="grid-template-columns:1fr 1fr"],
  .pc-card[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* Categories board mobile layout lives in dashboard-categories.php
     (inline <style>) so it can override the row's own desktop rules. */

  /* Settings / forms — stack rows */
  .pc-card[style*="display:flex"][style*="justify-content:space-between"] {
    flex-wrap: wrap;
  }

  /* Tables — already overflow-x:auto. Make scrollbar visible cue */
  .pc-table-wrap { -webkit-overflow-scrolling: touch; }
  .pc-table { min-width: 540px; }
  .pc-table th, .pc-table td { padding: 10px 12px; font-size: 13px; }

  /* Modal full-width on phone */
  .pc-modal-card { padding: 20px; max-width: calc(100vw - 24px); border-radius: 10px; }

  /* Bot/cat hero typography */
  .pc-cat-hero-title { font-size: 22px; }
  .pc-cat-hero-sub { font-size: 12.5px; }
  .pc-cat-hero-stats { gap: 10px; }
  .pc-cat-stat { padding: 12px 16px; min-width: 0; flex-basis: calc(50% - 5px); }
  .pc-cat-stat-value strong { font-size: 22px; }

  /* Cat tools — search + segments stack */
  .pc-cat-tools { flex-direction: column; align-items: stretch; }
  .pc-cat-search { width: 100%; }
  .pc-cat-segments { width: 100%; justify-content: space-between; }
  .pc-cat-segments button { flex: 1; justify-content: center; }
}

/* ---- Small phone: ≤420px ---- */
@media (max-width: 420px) {
  .panel-main { padding: 14px 10px 56px; }
  .panel-topbar { padding: 8px 10px; }
  .pt-title-glyph { display: none; }
  .pt-title-h { font-size: 14.5px; }
  .pt-wallet code { display: inline; font-size: 10.5px; }
  .pt-wallet { padding: 5px 7px; }

  .pc-stat-grid { grid-template-columns: 1fr; }
  .pc-cmd-readouts { grid-template-columns: 1fr; }

  .pc-cmd-log-line { grid-template-columns: 52px 44px 1fr; font-size: 10.5px; }
  .pc-cmd-log-line .ts  { font-size: 10px; }
  .pc-cmd-log-line .lvl { font-size: 9.5px; }

  /* Categories rows — even more compact */
  .pc-cat-row { padding: 10px 10px !important; }
  .pc-cat-name { font-size: 13px; }

  /* Sidebar drawer width */
  .panel-sidebar { width: min(280px, 86vw); }

  /* Feature progress numeric only (hide track) on tiniest screens */
  .pc-feat-progress-track { display: none; }
}

/* ---- Touch targets — at least 36px on phones ---- */
@media (hover: none) and (pointer: coarse) {
  .btn-mini { min-height: 34px; }
  .pc-cat-iconbtn { min-width: 32px; min-height: 32px; }
  .pc-cmd-log-btn { min-width: 28px; min-height: 28px; }
  /* No hover-only tooltips remain — fine */
}

/* =================================================================
   MOBILE POLISH PASS — scan card, contact ticket, tables, forms
   ================================================================= */

/* iOS Safari zooms on focus when input font is < 16px. Force 16px on
   phones for every panel form control to suppress the involuntary zoom. */
@media (max-width: 640px) {
  .cf-input,
  .ds-input,
  .ds-textarea,
  textarea.cf-input,
  select.cf-input,
  input[type="text"].cf-input,
  input[type="email"].cf-input,
  input[type="number"].cf-input { font-size: 16px; }
}

/* Tables already scroll horizontally; add a subtle right-edge fade so
   the user knows there is more content to swipe. */
.pc-table-wrap { position: relative; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
  .pc-table-wrap::after {
    content: "";
    position: absolute; top: 0; right: 0; bottom: 0; width: 22px;
    background: linear-gradient(90deg, transparent, var(--bg-2));
    pointer-events: none;
  }
}

/* ---- Leaderboard hero ".lb-scan" ---- */
@media (max-width: 880px) {
  .lb-scan { padding: 16px 16px; }
}
@media (max-width: 640px) {
  .lb-scan { padding: 14px; gap: 12px; border-radius: 10px; }
  .lb-scan-main { gap: 12px; }
  .lb-scan-pulse { width: 36px; height: 36px; flex-basis: 36px; }
  .lb-scan-pulse-core { width: 12px; height: 12px; }
  .lb-scan-eyebrow { font-size: 9.5px; }
  .lb-scan-count   { font-size: 24px; }
  .lb-scan-unit    { font-size: 12.5px; }
  .lb-scan-sub     { font-size: 11px; }

  .lb-scan-stats { width: 100%; padding: 10px 0 0; gap: 0; flex-direction: column; }
  .lb-scan-stats li {
    padding: 8px 0; border-left: 0;
    border-top: 1px solid var(--border);
    flex-direction: row; justify-content: space-between; align-items: baseline;
  }
  .lb-scan-stats li:first-child { border-top: 0; padding-top: 4px; }
  .lb-stat-key  { font-size: 10px; }
  .lb-stat-val  { font-size: 14.5px; }
  .lb-stat-meta { font-size: 10.5px; margin-left: auto; }
}

/* ---- Sort pill in section head ---- */
@media (max-width: 520px) {
  .lb-sort-pill { font-size: 10.5px; padding: 1px 6px; }
  .lb-sort-ind  { width: 8px; }
  #lbTable th   { white-space: nowrap; }
}

/* ---- Dashboard contact ticket card ---- */
@media (max-width: 640px) {
  .ds-ticket { padding: 20px 16px 18px; border-radius: 8px; }
  .ds-ticket-head { gap: 10px; padding-bottom: 14px; margin-bottom: 16px; }
  .ds-ticket-trust { font-size: 10.5px; padding: 4px 9px; }
  .ds-identity { gap: 11px; }
  .ds-identity-avatar { width: 32px; height: 32px; flex-basis: 32px; }
  .ds-identity-addr { font-size: 12.5px; }
  .ds-identity-label { font-size: 9.5px; }
  .ds-identity-plan { font-size: 9.5px; padding: 3px 7px; }
  .ds-form { gap: 18px; }
  .ds-step-title { font-size: 13.5px; }
}
@media (max-width: 520px) {
  .ds-topic { padding: 11px 12px; gap: 8px; }
  .ds-topic-icon { width: 30px; height: 30px; border-radius: 8px; }
  .ds-topic-label { font-size: 12.5px; }
  .ds-topic-desc  { font-size: 10.5px; }
  .ds-textarea { padding: 14px; font-size: 16px; }
  .ds-textarea-foot { padding: 7px 12px 9px; }
  .ds-counter, .ds-textarea-tips { font-size: 10.5px; }
  .ds-submit { padding: 12px 16px; font-size: 13px; flex: 1 1 auto; justify-content: center; }
  .ds-form-actions { gap: 10px; flex-wrap: wrap; }
  .ds-form-success { padding: 14px; gap: 12px; }
  .ds-form-success-ring { width: 32px; height: 32px; flex-basis: 32px; }
  .ds-form-success p { font-size: 12.5px; line-height: 1.55; }
  .ds-form-error { padding: 11px 13px; font-size: 12.5px; }
}

/* ---- Support channels grid ---- */
@media (max-width: 640px) {
  .ds-channels { gap: 12px; }
  .ds-channel-stripe { width: 2px; }
  .ds-channel-icon { width: 32px; height: 32px; border-radius: 9px; }
  .ds-channel-foot { gap: 8px; padding-top: 10px; }
  .ds-channel-meta { font-size: 10.5px; }
}

/* ---- Section heads collapse cleanly on phones ---- */
@media (max-width: 640px) {
  .pc-section-head { gap: 10px; padding: 0 0 0 14px; }
  .pc-section-head > div:first-child::before {
    width: 3px;
  }
  .pc-section-head h2,
  .pc-section-head h3 { line-height: 1.25; }
  .pc-section-head p  { line-height: 1.55; }
}

/* ---- Wallet dropdown safety on tiny phones (no horizontal overflow) ---- */
@media (max-width: 380px) {
  .pt-wallet-menu {
    right: 10px !important; left: 10px !important;
    min-width: 0 !important; width: auto !important;
    max-width: none !important;
  }
}

/* ---- Long page titles ("Top Polymarket wallets · 30 d") never overflow ---- */
@media (max-width: 520px) {
  .pc-card h3 { word-break: break-word; }
  .pc-card p  { word-break: break-word; }
}

/* ---- Inline-styled "follow X / capLabel" line on leaderboard ---- */
@media (max-width: 640px) {
  .pc-card[style*="justify-content:space-between"][style*="flex-wrap:wrap"] > div:last-child {
    width: 100%;
  }
}

/* ---- Make sure the FAB never overlaps the bottom-most form on phones ---- */
@media (max-width: 640px) {
  .panel-main { padding-bottom: 96px; }
}
