/* ============================================
   GrowBeat VPN — Personal Cabinet
   Design System: Taste Standard
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* --- Design Tokens --- */
:root {
  /* Palette */
  --canvas: #F9FAFB;
  --surface: #FFFFFF;
  --ink: #18181B;
  --secondary: #71717A;
  --muted: #94A3B8;
  --whisper-border: rgba(226, 232, 240, 0.5);
  --diffused-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.05);
  --accent: #10B981;
  --accent-hover: #059669;
  --accent-light: rgba(16, 185, 129, 0.08);
  --accent-border: rgba(16, 185, 129, 0.2);
  --danger: #E11D48;
  --danger-light: rgba(225, 29, 72, 0.08);
  --warning: #F59E0B;
  --warning-light: rgba(245, 158, 11, 0.08);

  /* Typography */
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing */
  --sidebar-width: 260px;
  --radius-sm: 0.75rem;
  --radius-md: 1.25rem;
  --radius-lg: 2.5rem;
  --padding-card: 2rem;
  --gap-section: clamp(1.5rem, 4vw, 2.5rem);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 200ms;
  --duration-normal: 350ms;
  --duration-slow: 500ms;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-display);
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100dvh;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--accent-hover);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

/* --- App Layout (Grid) --- */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100dvh;
}

/* --- Sidebar --- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--whisper-border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1rem 1.5rem;
  z-index: 10;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.75rem;
  margin-bottom: 2.5rem;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg {
  width: 22px;
  height: 22px;
  color: white;
}

.sidebar-logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.sidebar-logo-text span {
  color: var(--accent);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--secondary);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  user-select: none;
  width: 100%;
  text-align: left;
}

.sidebar-nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform var(--duration-normal) var(--ease-spring);
}

.sidebar-nav-item:hover {
  background: var(--accent-light);
  color: var(--ink);
}

.sidebar-nav-item:hover svg {
  transform: scale(1.1);
}

.sidebar-nav-item:active {
  transform: scale(0.98);
}

.sidebar-nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.sidebar-user {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--whisper-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #34D399);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-avatar svg {
  width: 18px;
  height: 18px;
  color: white;
}

.sidebar-user-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.sidebar-user-id {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* User action buttons row */
.sidebar-user-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-user-logout {
  font-size: 0.75rem;
  color: var(--secondary);
  font-weight: 500;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  border: 1px solid var(--whisper-border);
  background: var(--canvas);
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.sidebar-user-logout:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-light);
}

.sidebar-user-logout--danger {
  color: var(--danger);
  border-color: rgba(225, 29, 72, 0.15);
}

.sidebar-user-logout--danger:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-light);
}

/* --- Main Content --- */
.main-content {
  padding: clamp(1.5rem, 4vw, 3rem);
  max-width: 960px;
  width: 100%;
}

.main-header {
  margin-bottom: var(--gap-section);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

.main-header-left {
  flex: 1;
}

/* Premium User Card (Top Right) */
.premium-user-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--whisper-border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  padding: 1rem;
  min-width: 240px;
  transition: all var(--duration-fast) var(--ease-out);
}

.premium-user-card:hover {
  box-shadow: var(--diffused-shadow);
  border-color: rgba(226, 232, 240, 0.8);
}

.premium-user-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.premium-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #34D399);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.premium-user-avatar svg {
  width: 16px;
  height: 16px;
}

.premium-user-email {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.premium-user-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--whisper-border);
}

.premium-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--secondary);
  background: transparent;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.premium-btn:hover {
  color: var(--ink);
  background: var(--canvas);
}

.premium-btn--danger {
  color: var(--danger);
}

.premium-btn--danger:hover {
  background: var(--danger-light);
  color: #BE123C;
}

.premium-divider {
  width: 1px;
  height: 14px;
  background: var(--whisper-border);
}

.main-header-greeting {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 0.25rem;
}

.main-header-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--ink);
}

/* --- Section Container --- */
.section {
  display: none;
  animation: sectionFadeIn var(--duration-normal) var(--ease-out);
}

.section.active {
  display: block;
}

@keyframes sectionFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--whisper-border);
  border-radius: var(--radius-lg);
  padding: var(--padding-card);
  box-shadow: var(--diffused-shadow);
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.card + .card {
  margin-top: 1.25rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--secondary);
  margin-top: 0.25rem;
}

/* --- Status Badge --- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.status-badge--active {
  background: var(--accent-light);
  color: var(--accent);
}

.status-badge--active::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

.status-badge--expired {
  background: var(--danger-light);
  color: var(--danger);
}

.status-badge--expired::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
}

.status-badge--awaits {
  background: var(--warning-light);
  color: var(--warning);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* --- Subscription Info Grid --- */
.sub-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.sub-info-item {
  padding: 1.25rem;
  background: var(--canvas);
  border-radius: var(--radius-md);
  border: 1px solid var(--whisper-border);
}

.sub-info-label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.375rem;
}

.sub-info-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.sub-info-value--mono {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

/* --- Subscription Link --- */
.sub-link-block {
  background: var(--canvas);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 1px solid var(--whisper-border);
  margin-bottom: 1.5rem;
}

.sub-link-label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.sub-link-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sub-link-url {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--secondary);
  background: var(--surface);
  padding: 0.625rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--whisper-border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}

.sub-link-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.sub-link-copy:hover {
  background: var(--accent);
  color: white;
}

.sub-link-copy:active {
  transform: scale(0.92);
}

.sub-link-copy svg {
  width: 18px;
  height: 18px;
}

/* --- Client Apps --- */
.client-apps {
  margin-top: 1.5rem;
}

.client-apps-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 1rem;
}

.client-app {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-top: 1px solid var(--whisper-border);
}

.client-app:last-child {
  padding-bottom: 0;
}

.client-app-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.client-app-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.client-app-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
}

.client-app-desc {
  font-size: 0.8125rem;
  color: var(--muted);
}

.client-app-links {
  display: flex;
  gap: 0.5rem;
}

.client-app-link {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--canvas);
  border: 1px solid var(--whisper-border);
  color: var(--secondary);
  transition: all var(--duration-fast) var(--ease-out);
}

.client-app-link:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-light);
}

.client-app-link:active {
  transform: translateY(1px);
}

/* --- Pricing / Plans --- */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.plan-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.25rem;
  padding: 2.5rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--whisper-border);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.plan-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--accent);
  transition: width var(--duration-normal) var(--ease-out);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.plan-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--diffused-shadow);
}

.plan-card:hover::before {
  width: 4px;
}

.plan-card:active {
  transform: scale(0.985);
}

.plan-card--popular {
  border-color: var(--accent-border);
  background: var(--accent-light);
}

.plan-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.plan-duration {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.plan-per-month {
  font-size: 0.8125rem;
  color: var(--muted);
}

.plan-popular-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: white;
}

.plan-price {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--ink);
}

.plan-price-currency {
  font-size: 0.875rem;
  color: var(--secondary);
  font-weight: 500;
  margin-left: 0.25rem;
}

/* --- Transactions --- */
.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.transaction-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: 1.125rem 0;
  border-bottom: 1px solid var(--whisper-border);
  animation: staggerIn var(--duration-normal) var(--ease-out) backwards;
}

.transaction-item:last-child {
  border-bottom: none;
}

.transaction-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  width: 1.5rem;
  text-align: center;
}

.transaction-info {
  min-width: 0;
}

.transaction-id {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--secondary);
  word-break: break-all;
  line-height: 1.4;
}

.transaction-date {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.125rem;
}

.transaction-amount {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.transaction-status {
  font-size: 0.75rem;
}

/* --- Referrals --- */
.ref-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ref-stat {
  padding: 1.5rem;
  background: var(--canvas);
  border-radius: var(--radius-md);
  border: 1px solid var(--whisper-border);
  text-align: center;
}

.ref-stat-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.ref-stat-label {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.375rem;
}

.ref-how {
  margin-top: 1.5rem;
}

.ref-how-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 1rem;
}

.ref-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ref-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.875rem 0;
  border-top: 1px solid var(--whisper-border);
}

.ref-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ref-step-text {
  font-size: 0.9375rem;
  color: var(--secondary);
  line-height: 1.5;
  padding-top: 0.1875rem;
}

.ref-step-text strong {
  color: var(--ink);
  font-weight: 600;
}

/* --- Settings --- */
.settings-group {
  padding: 0;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--whisper-border);
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.settings-item-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
}

.settings-item-desc {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* --- Referral Registration CTA --- */
.referral-cta {
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  transition: transform var(--duration-fast) var(--ease-out);
}

.referral-cta:hover {
  transform: translateY(-2px);
}

.referral-cta-icon {
  width: 44px;
  height: 44px;
  background: var(--surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
  flex-shrink: 0;
}

.referral-cta-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.5;
}

.referral-cta-link {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 600;
}



/* --- Toggle Switch --- */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  transition: background var(--duration-fast) var(--ease-out);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform var(--duration-normal) var(--ease-spring);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: white;
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--secondary {
  background: transparent;
  border: 1px solid var(--whisper-border);
  color: var(--secondary);
}

.btn--secondary:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-light);
}

.btn--full {
  width: 100%;
}

.btn svg {
  width: 18px;
  height: 18px;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  background: var(--canvas);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

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

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.empty-state-text {
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 30ch;
  margin: 0 auto;
  line-height: 1.5;
}

/* --- Toast / Notification --- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 100;
  opacity: 0;
  transition: all var(--duration-normal) var(--ease-spring);
  pointer-events: none;
  white-space: nowrap;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(24, 24, 27, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all var(--duration-normal) var(--ease-out);
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  transform: translateY(20px) scale(0.95);
  transition: all var(--duration-normal) var(--ease-spring);
  border: 1px solid var(--whisper-border);
  margin: 1rem;
}

.modal-overlay.visible .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  transition: all var(--duration-fast);
}

.modal-close:hover {
  background: var(--canvas);
  color: var(--ink);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.5rem;
  padding-right: 2rem;
}

.modal-desc {
  font-size: 0.875rem;
  color: var(--secondary);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* Password Input Wrapper */
.password-input-wrapper {
  position: relative;
  display: block;
  width: 100%;
}

.password-input-wrapper .auth-input {
  padding-right: 2.5rem; /* Space for eye icon */
}

.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--duration-fast);
  border-radius: var(--radius-sm);
}

.password-toggle:hover {
  color: var(--ink);
  background: var(--canvas);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

/* Auth field styles copied to main style.css for modal */
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.auth-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

.auth-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--whisper-border);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.auth-input::placeholder {
  color: var(--muted);
}

/* --- Stagger Animation --- */
@keyframes staggerIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stagger-child {
  animation: staggerIn var(--duration-normal) var(--ease-out) backwards;
}

/* --- Shimmer / Skeleton Loader --- */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 0%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite ease-in-out;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

/* --- Mobile Bottom Nav --- */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--whisper-border);
  z-index: 50;
  padding: 0.5rem 0.75rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0));
}

.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
}

.mobile-nav-item.active {
  color: var(--accent);
}

.mobile-nav-item:active {
  transform: scale(0.92);
}

/* --- Mobile Header --- */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--whisper-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.mobile-header-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-header-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-header-logo-icon svg {
  width: 18px;
  height: 18px;
  color: white;
}

.mobile-header-logo-text {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.mobile-header-logo-text span {
  color: var(--accent);
}

.mobile-header-id {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--canvas);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
}

/* --- Instruction link --- */
.instruction-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  background: var(--canvas);
  border: 1px solid var(--whisper-border);
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--secondary);
  transition: all var(--duration-fast) var(--ease-out);
}

.instruction-link:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

.instruction-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* --- Skeleton Loaders --- */
.skeleton-line {
  background: linear-gradient(90deg, var(--whisper-border) 25%, var(--canvas) 50%, var(--whisper-border) 75%);
  background-size: 200% 100%;
  animation: skeletonLoad 1.5s infinite linear;
  border-radius: 4px;
}
@keyframes skeletonLoad {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Support Sidebar --- */
.sidebar-support {
  margin-top: 1rem;
  padding: 0 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar-support-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.sidebar-support a {
  color: var(--secondary);
}
.sidebar-support a:hover {
  color: var(--accent);
}

/* --- Mobile Logout Header --- */
.mobile-logout {
  margin-bottom: 0.75rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  background: var(--canvas);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
}
.mobile-logout:active {
  background: var(--danger-light);
  color: var(--danger);
}
.mobile-logout svg {
  width: 18px;
  height: 18px;
}



/* --- Support Popover --- */
.mobile-support-popover {
  position: fixed;
  right: 1.25rem;
  bottom: calc(9rem + env(safe-area-inset-bottom, 0));
  background: var(--surface);
  border: 1px solid var(--whisper-border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 89;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all var(--duration-normal) var(--ease-out);
}
.mobile-support-popover.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.mobile-support-popover a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  color: var(--ink);
  font-weight: 500;
  background: var(--canvas);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
}
.mobile-support-popover a:hover {
  background: white;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 220px 1fr;
  }

  :root {
    --sidebar-width: 220px;
  }

  .main-content {
    padding: 2rem;
  }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .plans-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .mobile-support-fab {
    display: flex;
    right: 1.25rem;
    bottom: calc(5.5rem + env(safe-area-inset-bottom, 0));
  }

  .mobile-support-popover {
    display: flex;
    right: 1.25rem;
    bottom: calc(9.5rem + env(safe-area-inset-bottom, 0));
  }

  .mobile-nav {
    display: block;
  }

  .main-content {
    padding: 1.25rem;
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0));
  }

  .main-header {
    margin-bottom: 1.25rem;
    flex-direction: column;
  }

  .premium-user-card {
    min-width: 100%;
    justify-content: space-between;
  }
  
  .premium-user-card .sidebar-user-info {
    align-items: flex-start !important;
  }

  .main-header-title {
    font-size: 1.375rem;
  }

  .card {
    padding: 1.25rem;
    border-radius: var(--radius-md);
  }

  .sub-info-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .sub-info-item {
    padding: 1rem;
  }

  .sub-link-url {
    white-space: normal;
    word-break: break-all;
    font-size: 0.75rem;
    line-height: 1.4;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .ref-stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .transaction-item {
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
  }

  .transaction-number {
    display: none;
  }

  .transaction-status {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .transaction-amount {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }

  .transaction-info {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .plan-card {
    padding: 1.25rem;
  }

  .plan-price {
    font-size: 1.0625rem;
  }

  .sub-link-row {
    flex-direction: column;
    align-items: stretch;
  }

  .sub-link-copy {
    width: 100%;
    height: 44px;
    padding: 0.625rem;
    margin-top: 0.25rem;
  }

  .client-app {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .toast {
    bottom: calc(5rem + env(safe-area-inset-bottom, 0));
    left: 1rem;
    right: 1rem;
    transform: translateX(0) translateY(120%);
    text-align: center;
  }

  .toast.visible {
    transform: translateX(0) translateY(0);
  }
}

/* --- Small Mobile --- */
@media (max-width: 375px) {
  .main-content {
    padding: 1rem;
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0));
  }

  .ref-stats-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav-item {
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
  }

  .mobile-nav-item svg {
    width: 20px;
    height: 20px;
  }
}

/* --- Settings Section Layout --- */
.settings-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.settings-nav-top {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.5rem;
  border-bottom: 1px solid var(--whisper-border);
  padding-bottom: 1rem;
  margin-bottom: 0.5rem;
  position: static !important;
  width: 100% !important;
  overflow-x: auto;
  scrollbar-width: none;
}

.settings-nav-top::-webkit-scrollbar {
  display: none;
}

.settings-nav-top .settings-subnav-btn {
  width: auto !important;
  padding: 0.625rem 1.25rem;
  white-space: nowrap;
}

.settings-content {
  flex: 1;
  min-width: 0;
}


.settings-subnav-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  color: var(--secondary);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: all var(--duration-fast);
  background: transparent;
  border: 1px solid transparent;
}

.settings-subnav-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.settings-subnav-btn:hover {
  background: var(--canvas);
  color: var(--ink);
}

.settings-subnav-btn.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-border);
  font-weight: 600;
}

.settings-subnav-btn.active svg {
  opacity: 1;
}

.settings-panel {
  display: none;
  animation: sectionFadeIn var(--duration-normal) var(--ease-out);
}

.settings-panel.active {
  display: block;
}

.settings-panel-text {
  font-size: 0.875rem;
  color: var(--secondary);
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.notifications-table {
  display: flex;
  flex-direction: column;
}

.notif-header-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  padding: 0.5rem 0;
  border-bottom: 2px solid var(--whisper-border);
  margin-bottom: 0.5rem;
}

.notif-col-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.notif-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  align-items: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--whisper-border);
}

.notif-row:last-child {
  border-bottom: none;
}

.notif-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.125rem;
}

.notif-desc {
  font-size: 0.8125rem;
  color: var(--muted);
}

.notif-toggle {
  display: flex;
  justify-content: center;
}

@media (max-width: 480px) {
  .notif-header-row, .notif-row {
    grid-template-columns: 1fr 65px 65px;
  }
  .notif-col-label {
    font-size: 0.6875rem;
  }
}


.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.toggle-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--secondary);
}



.settings-actions {
  margin-top: 2rem;
  display: flex;
  justify-content: flex-start;
}



