/* =============================================
   FANTASTIC TECH — Design System
   Light, restrained, Apple/Gemini-influenced.
   Signature: ambient floating node network (canvas)
   ============================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-card-2: #f4f5f7;
  --border: #e6e8eb;
  --border-bright: #d3d8de;
  --accent-a: #4f7cff;
  --accent-b: #9b6fff;
  --accent-grad: linear-gradient(135deg, var(--accent-a) 0%, var(--accent-b) 100%);
  --text: #1d1d1f;
  --text-muted: #6e7077;
  --text-dim: #45474c;
  --success: #1fae6a;
  --warning: #c8791a;
  --danger: #e0463f;
  --radius: 14px;
  --radius-lg: 22px;
  --transition: 0.2s cubic-bezier(.4, 0, .2, 1);
  --header-h: 64px;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Helvetica Neue", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  padding-top: var(--header-h);
  padding-bottom: 60px;
  position: relative;
}

/* ---- AMBIENT BACKGROUND CANVAS ---- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* lift real content above the canvas */
.site-header,
.pricing-section,
.download-section,
.guide-section,
.site-footer,
.modal,
.overlay {
  position: relative;
  z-index: 1;
}

/* ---- HEADER ---- */
.site-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 250, 250, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.header-inner {
  max-width: 100%;
  width: 100%;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--accent-grad);
  flex-shrink: 0;
}

.brand-name {
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.header-nav a {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.header-nav a:hover {
  color: var(--text);
}

.header-nav .nav-login {
  color: var(--text);
  font-weight: 600;
  background: var(--bg-card-2);
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.header-nav .nav-login:hover {
  background: var(--border);
}

@media (max-width: 480px) {
  .header-nav {
    gap: 14px;
  }

  .header-nav a:not(.nav-login) {
    display: none;
  }
}

/* ---- SITE HEADLINE ---- */
.eyebrow {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent-a);
  margin-top: 56px;
}

.site-title {
  text-align: center;
  font-size: clamp(2rem, 5.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-top: 10px;
  color: var(--text);
}

.site-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 10px;
  margin-bottom: 8px;
}

/* ---- PRICING ---- */
.pricing-section {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px;
}

.plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 40px;
}

@media (max-width: 480px) {
  .plans {
    grid-template-columns: 1fr;
  }
}

.plan {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  position: relative;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.plan:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* signature element: gradient ring on featured card */
.plan--featured {
  border-color: transparent;
  background:
    linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
    var(--accent-grad) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 8px 28px rgba(79, 124, 255, 0.14);
}

.plan-badge {
  position: absolute;
  top: 24px;
  right: 24px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 0;
  z-index: 2;
}

.plan-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.plan-price {
  font-size: 2.2rem;
  font-weight: 750;
  color: var(--text);
  line-height: 1;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.plan-price span {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 24px;
  flex: 1;
}

.plan-features li {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding-left: 18px;
  position: relative;
}

.plan-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-grad);
}

.btn-subscribe {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  background: var(--text);
  color: #fff;
  margin-top: auto;
}

.plan--featured .btn-subscribe {
  background: var(--accent-grad);
}

.btn-subscribe:hover {
  opacity: 0.86;
  transform: translateY(-1px);
}

.btn-subscribe:active {
  transform: translateY(0);
}

.login-link {
  text-align: center;
  margin-top: 22px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.login-link a {
  color: var(--accent-a);
  text-decoration: none;
  font-weight: 600;
}

/* ---- DOWNLOAD ---- */
.download-section {
  max-width: 700px;
  margin: 64px auto 0;
  padding: 0 20px;
}

.download-section h2,
.guide-section h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.section-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.dl-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--transition), background var(--transition);
}

.dl-btn:hover {
  border-color: var(--border-bright);
  background: var(--bg-card-2);
}

.dl-icon {
  font-size: 1.3rem;
}

.dl-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dl-info strong {
  font-size: 0.86rem;
  font-weight: 600;
}

.dl-info small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---- GUIDE ---- */
.guide-section {
  max-width: 700px;
  margin: 48px auto 0;
  padding: 0 20px;
}

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

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  flex: 1;
  min-width: 120px;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.3;
}

.step-arrow {
  color: var(--text-muted);
  font-size: 1rem;
}

@media (max-width: 480px) {
  .step-arrow {
    display: none;
  }

  .steps {
    flex-direction: column;
  }

  .step {
    width: 100%;
  }
}

/* ---- FOOTER ---- */
.site-footer {
  text-align: center;
  margin-top: 72px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* =============================================
   MODALS
   ============================================= */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 25, 0.42);
  backdrop-filter: blur(6px);
  z-index: 100;
  transition: opacity 0.2s;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 101;
  padding: 20px;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  position: relative;
  animation: slideUp 0.25s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text);
}

.modal-box h3 {
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* email input */
#input-email {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-bright);
  border-radius: 11px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition);
  margin-bottom: 8px;
}

#input-email:focus {
  border-color: var(--accent-a);
}

.field-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-bottom: 12px;
}

/* ---- PROMO CODE INPUT ---- */
.promo-field {
  margin-top: 6px;
  margin-bottom: 14px;
}

#input-promo {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-bright);
  border-radius: 11px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  text-transform: uppercase;
  outline: none;
  transition: border-color var(--transition);
}

#input-promo:focus {
  border-color: var(--accent-a);
}

.btn-promo-apply {
  height: 42px;
  padding: 0 16px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-a, #6366f1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-promo-apply:hover {
  background: rgba(99, 102, 241, 0.22);
}

.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--accent-grad);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 14px;
  transition: opacity var(--transition);
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- PAYMENT METHOD TOGGLE ---- */
.pay-method-toggle {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.pay-method {
  flex: 1;
  padding: 9px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-bright);
  background: var(--bg);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.pay-method.active {
  border-color: transparent;
  background: var(--accent-grad);
  color: #fff;
}

/* ---- PAYMENT MODAL (QR) ---- */
.payment-amount {
  font-size: 1.6rem;
  font-weight: 750;
  color: var(--text);
  margin-bottom: 20px;
}

.qr-container {
  width: 200px;
  height: 200px;
  margin: 0 auto 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.qr-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
}

.qr-loading p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.qr-image {
  width: 200px;
  height: 200px;
  object-fit: contain;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-a);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.payment-timer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.timer {
  color: var(--warning);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.payment-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.payment-status p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dots {
  display: flex;
  gap: 6px;
}

.dots span {
  width: 6px;
  height: 6px;
  background: var(--accent-a);
  border-radius: 50%;
  animation: pulse 1.2s ease infinite;
}

.dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }

  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* ---- CARD MODAL (Stripe Payment Element) ---- */
#payment-element {
  margin-top: 4px;
  margin-bottom: 4px;
}

#card-form .btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#card-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#card-error {
  margin-top: 10px;
  margin-bottom: 0;
  text-align: center;
}

/* ---- SUCCESS MODAL ---- */
.modal-box--success {
  text-align: center;
}

.success-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.success-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.sub-qr-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  width: fit-content;
  margin: 0 auto 16px;
}

.sub-url-box {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.sub-url-box input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-dim);
  font-size: 0.7rem;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#copy-btn {
  padding: 10px 14px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--transition);
  flex-shrink: 0;
}

#copy-btn:hover {
  opacity: 0.88;
}

.email-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.usage-guide {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  text-align: left;
}

.guide-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.guide-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ---- RENEWAL UI ---- */
.renewal-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
  display: inline-block;
  animation: pulseRotate 2.5s infinite ease-in-out;
}

@keyframes pulseRotate {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1); }
}

.renewal-info-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 14px 0 18px;
  text-align: left;
}

.renewal-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.renewal-info-row:last-of-type {
  border-bottom: none;
}

.renewal-label {
  color: var(--text-muted);
}

.renewal-val {
  font-weight: 600;
  color: var(--text);
}

.renewal-info-row--highlight .renewal-val {
  color: #10b981;
  font-weight: 700;
}

.renewal-note {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.4;
  background: rgba(16, 185, 129, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  border-left: 3px solid #10b981;
}

.renewal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn-cancel {
  flex: 1;
  padding: 12px;
  background: var(--bg);
  color: var(--text-dim);
  border: 1px solid var(--border-bright);
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-cancel:hover {
  background: var(--border);
  color: var(--text);
}

.renewal-actions .btn-primary {
  flex: 1.4;
  margin-top: 0;
}

.renewal-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-subscribe--disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  pointer-events: none;
  background: var(--border) !important;
  color: var(--text-muted) !important;
}

/* ---- ACCESSIBILITY ---- */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-a);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---- UTILITY ---- */
.hidden {
  display: none !important;
}

/* =============================================
   PAYMENT-COMPLETE REDIRECT PAGE
   Reuses existing tokens from the main stylesheet —
   no new colors or fonts introduced.
   ============================================= */

.redirect-section {
  max-width: 480px;
  margin: 0 auto;
  padding: 80px 20px 0;
  display: flex;
  justify-content: center;
}

.redirect-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  width: 100%;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.redirect-state h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--text);
}

.redirect-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.spinner--lg {
  width: 40px;
  height: 40px;
  margin: 0 auto;
}

.fail-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary--link {
  display: inline-block;
  text-decoration: none;
  width: auto;
  padding: 12px 28px;
  margin-top: 20px;
}

/* =============================================
   PHASE 2 — Auth Modal + Dashboard
   ============================================= */

/* ---- Invite field in checkout modal ---- */
.invite-field {
  margin-top: 10px;
}

.invite-field input {
  font-family: 'SF Mono', 'Menlo', monospace;
  letter-spacing: 0.12em;
  font-size: 1rem;
}

/* ---- Auth-aware header button ---- */
.nav-login--active {
  background: var(--accent-grad) !important;
  color: #fff !important;
  border-color: transparent !important;
}

/* ---- Auth Modal tabs ---- */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card-2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Inputs inside auth forms */
#auth-login-form input,
#auth-register-form input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--bg-card-2);
  color: var(--text);
  transition: border-color var(--transition);
  outline: none;
}

#auth-login-form input:focus,
#auth-register-form input:focus {
  border-color: var(--accent-a);
}

/* ---- Password strength bar ---- */
.password-strength {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: -6px 0 12px;
  overflow: hidden;
  transition: all 0.3s;
}

.password-strength::after {
  content: '';
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
  width: var(--pw-pct, 0%);
  background: var(--pw-color, var(--border));
}

/* ---- Wide modal variant for dashboard ---- */
.modal-box--wide {
  max-width: 480px;
  width: 100%;
}

/* ---- Dashboard layout ---- */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.dash-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.dash-role {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn-logout {
  flex-shrink: 0;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ---- Subscription card inside dashboard ---- */
.dash-card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.dash-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.tier-badge {
  display: inline-block;
  background: var(--accent-grad);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 20px;
}

.tier-badge--premium {
  background: linear-gradient(135deg, #c9a227 0%, #f5d769 100%);
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.status-badge--active {
  background: rgba(31, 174, 106, 0.12);
  color: var(--success);
}

.status-badge--expired {
  background: rgba(224, 70, 63, 0.1);
  color: var(--danger);
}

/* ---- Live usage bar ---- */
.usage-block {
  margin-bottom: 14px;
}

.usage-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.usage-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent-grad);
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}

.usage-bar-fill.usage-bar-fill--warn {
  background: linear-gradient(90deg, var(--warning), #e8a12a);
}

.usage-bar-fill.usage-bar-fill--danger {
  background: linear-gradient(90deg, var(--danger), #f06f6a);
}

/* ---- Dashboard meta row ---- */
.dash-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.dash-meta strong {
  color: var(--text);
  font-weight: 600;
}

/* ---- Empty state ---- */
.dash-empty {
  text-align: center;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---- Invite code section ---- */
.dash-invite {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 4px;
}

.dash-invite-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.btn-invite {
  padding: 7px 14px;
  border: 1px solid var(--accent-a);
  border-radius: 20px;
  background: transparent;
  color: var(--accent-a);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-invite:hover {
  background: var(--accent-a);
  color: #fff;
}

.invite-result {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.invite-result code {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text);
  flex: 1;
}

.invite-countdown {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* =============================================
   FULL DEDICATED DASHBOARD VIEW (ChatGPT/Claude Collapsible Sidebar)
   ============================================= */

.dash-view {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(100vh - var(--header-h));
  z-index: 100;
  display: flex;
  background: transparent;
}

.dash-view.hidden {
  display: none !important;
}

/* Hide landing page HTML content when dashboard is active so only bg-canvas animates behind dashboard */
body.dash-active .pricing-section,
body.dash-active .download-section,
body.dash-active .guide-section,
body.dash-active .site-footer {
  display: none !important;
}

/* ---- COLLAPSIBLE SIDEBAR ---- */
.dash-sidebar {
  width: 240px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
  transition: width 0.3s cubic-bezier(.4, 0, .2, 1);
  flex-shrink: 0;
  z-index: 10;
}

/* Collapsed state (icon-only mode) */
.dash-sidebar.collapsed {
  width: 68px;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-toggle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card-2);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all var(--transition);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--border);
  color: var(--text);
}

.dash-sidebar.collapsed .sidebar-toggle .toggle-icon {
  transform: rotate(180deg);
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  transition: opacity 0.2s;
}

.dash-sidebar.collapsed .sidebar-brand-name {
  opacity: 0;
  pointer-events: none;
  width: 0;
}

/* Sidebar Menu Nav Items */
.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-item:hover {
  background: var(--bg-card-2);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--bg-card-2);
  color: var(--accent-a);
  border: 1px solid var(--border);
}

.item-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.item-label {
  transition: opacity 0.2s;
  opacity: 1;
}

.dash-sidebar.collapsed .item-label {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

/* Sidebar Footer (User Profile & Logout) */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  overflow: hidden;
}

.user-avatar {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s;
}

.dash-sidebar.collapsed .user-info {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logout:hover {
  background: rgba(224, 70, 63, 0.08);
  color: var(--danger);
  border-color: var(--danger);
}

.dash-sidebar.collapsed .sidebar-logout .item-label {
  opacity: 0;
  width: 0;
}

/* ---- DASHBOARD MAIN CONTENT ---- */
.dash-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  max-width: 900px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .dash-main {
    padding: 20px 16px;
  }
}

.dash-page-title {
  margin-bottom: 24px;
}

.dash-page-title h2 {
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.dash-page-sub {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.dash-tab-content.hidden {
  display: none !important;
}

/* Subscription URL Box & Copy */
.sub-url-section {
  margin-top: 18px;
}

.sub-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}

.btn-copy {
  padding: 10px 18px;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
  white-space: nowrap;
}

.btn-copy:hover {
  opacity: 0.9;
}

/* QR Code Action Section */
.qr-action-section {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.btn-secondary {
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  border-color: var(--border-bright);
  background: var(--bg-card-2);
}

.dash-sub-qr-wrapper {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dash-sub-qr-wrapper.hidden {
  display: none !important;
}

.qr-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Empty Subscription State */
.dash-empty {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.dash-empty .empty-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
}

.dash-empty h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.dash-empty p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 18px;
}

/* Inline Usage Loading Spinner */
.inline-loader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.mini-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--accent-a);
  border-radius: 50%;
  animation: miniSpin 0.7s linear infinite;
}

@keyframes miniSpin {
  to { transform: rotate(360deg); }
}

/* Invite Card */
.dash-invite-card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 24px;
}

.dash-invite-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.invite-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Dashboard Plans Embed */
.plans--dashboard {
  margin-top: 12px;
}

/* =============================================
   PURCHASE HISTORY TABLE (ORDERS TAB)
   ============================================= */

.orders-loading {
  text-align: center;
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.orders-list {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
}

.orders-table th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.orders-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.orders-table tr:last-child td {
  border-bottom: none;
}

.order-intent-id {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.order-status-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.order-status-tag--paid {
  background: rgba(31, 174, 106, 0.12);
  color: var(--success);
}

.order-status-tag--pending {
  background: rgba(200, 121, 26, 0.12);
  color: var(--warning);
}

.order-status-tag--failed {
  background: rgba(224, 70, 63, 0.1);
  color: var(--danger);
}