/* ─── App shell (sidebar dashboard layout) ─── */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-deep);
}

.app-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface-solid);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition: transform 0.3s ease;
}

.app-sidebar-brand {
  padding: 1.35rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.app-sidebar-brand .logo {
  font-size: 1.15rem;
  --brand-logo-size: 22px;
}

.app-sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.app-sidebar-user #sidebarAvatar {
  flex-shrink: 0;
}

.app-sidebar-user-info {
  min-width: 0;
  flex: 1;
}

.app-sidebar-user-info strong {
  display: block;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar-user-info small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.app-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.65rem;
}

.app-nav-section {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.35rem;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 0.15rem;
}

.app-nav-link:hover {
  background: rgba(0, 242, 255, 0.06);
  color: var(--text);
}

.app-nav-link.active {
  background: rgba(0, 242, 255, 0.12);
  color: var(--cyan);
  border: 1px solid var(--border-strong);
}

.app-nav-icon {
  width: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.app-sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.app-wrapper {
  flex: 1;
  margin-left: 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.75rem;
  min-height: var(--app-topbar-h, 4.25rem);
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.4rem 0.65rem;
  cursor: pointer;
}

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--success-dim);
  border: 1px solid rgba(0, 230, 118, 0.35);
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
}

.live-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.app-notify-btn {
  position: relative;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.app-notify-btn .notify-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-notify-wrap {
  position: relative;
}

.app-notify-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(360px, calc(100vw - 1.5rem));
  max-height: 420px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-notify-panel.hidden {
  display: none;
}

.app-notify-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
}

.app-notify-panel-head button {
  background: none;
  border: none;
  color: var(--cyan);
  font-size: 0.75rem;
  cursor: pointer;
}

.app-notify-list {
  overflow-y: auto;
  padding: 0.5rem;
  flex: 1;
  min-height: 0;
}

.app-notify-item {
  padding: 0.85rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  margin-bottom: 0.35rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.app-notify-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

.app-notify-item.unread {
  background: rgba(0, 242, 255, 0.06);
  border-color: rgba(0, 242, 255, 0.15);
}

.app-notify-item.unread:hover {
  background: rgba(0, 242, 255, 0.1);
}

.app-notify-item strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.app-notify-item p {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-notify-item small {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.app-notify-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

.app-notify-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.65);
}

#portfolioActionModal,
#portfolioCatalogModal {
  z-index: 2200;
}

.app-notify-modal.hidden {
  display: none;
}

.app-notify-modal-card {
  width: 100%;
  max-width: 520px;
  max-height: min(80vh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.app-notify-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.app-notify-modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.35;
}

.app-notify-modal-meta {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.app-notify-modal-body {
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  color: var(--text);
  font-size: 0.92rem;
}

.app-topbar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.8rem;
}

.app-topbar-user .avatar-slot {
  flex-shrink: 0;
}

#sidebarAvatar .avatar-slot {
  flex-shrink: 0;
}

.app-topbar-balance {
  color: var(--cyan);
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.app-content[style*="max-width"] {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.app-content {
  padding: 1.5rem 1.75rem 2.5rem;
  flex: 1;
}

.app-greeting {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.app-greeting span {
  color: var(--cyan);
}

/* Hero cards */
.dash-hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.dash-balance-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.85rem;
  background:
    linear-gradient(145deg, rgba(0, 242, 255, 0.06) 0%, transparent 42%),
    linear-gradient(180deg, rgba(13, 40, 71, 0.95) 0%, rgba(10, 22, 40, 0.98) 100%);
  border: 1px solid rgba(0, 242, 255, 0.14);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  min-height: 200px;
}

.dash-balance-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 85%);
  pointer-events: none;
}

.dash-balance-card::after {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 55%;
  height: 100%;
  background: radial-gradient(circle, rgba(0, 242, 255, 0.12), transparent 68%);
  pointer-events: none;
}

.dash-balance-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 168px;
}

.dash-balance-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.dash-balance-meta {
  min-width: 0;
}

.dash-balance-eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 0.35rem;
}

.dash-balance-desc {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.dash-balance-currency {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.22);
}

.dash-balance-amount {
  font-size: clamp(2.1rem, 4vw, 2.85rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0;
  padding-bottom: 0.85rem;
  line-height: 1.1;
}

.dash-today-pnl {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.1rem;
  margin-bottom: auto;
}

.dash-today-pnl-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.dash-today-pnl-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dash-today-pnl-positive {
  color: var(--success);
}

.dash-today-pnl-negative {
  color: var(--danger);
}

.dash-today-pnl-flat {
  color: var(--text-muted);
}

.dash-balance-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .dash-balance-card {
  background:
    linear-gradient(145deg, rgba(0, 140, 160, 0.08) 0%, transparent 42%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border-color: rgba(0, 120, 140, 0.16);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .dash-balance-card::before {
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
}

[data-theme="light"] .dash-balance-currency {
  background: rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .dash-balance-actions {
  border-top-color: rgba(15, 23, 42, 0.08);
}

/* ─── Language switcher ─── */
.lang-switcher-wrap {
  display: flex;
  align-items: center;
  list-style: none;
}

.lang-switcher-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.lang-switcher-icon {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.85;
}

.lang-select {
  appearance: none;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.45rem 1.75rem 0.45rem 0.55rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238898aa' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  max-width: 160px;
}

.lang-select:hover,
.lang-select:focus {
  border-color: var(--cyan);
  outline: none;
}

[dir="rtl"] .lang-select {
  padding: 0.45rem 0.55rem 0.45rem 1.75rem;
  background-position: left 0.45rem center;
}

.lang-switcher-topbar {
  margin-right: 0.35rem;
}

.lang-switcher-fixed {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1099;
}

.lang-switcher-fixed .lang-select {
  max-width: 150px;
}

.app-sidebar-lang-slot {
  width: 100%;
  margin-bottom: 0.75rem;
}

.app-sidebar-lang-slot .lang-switcher-wrap,
.app-sidebar-lang-slot .lang-switcher-sidebar {
  width: 100%;
}

.app-sidebar-lang-slot .lang-switcher-label {
  width: 100%;
}

.app-sidebar-lang-slot .lang-select {
  flex: 1;
  width: 100%;
  max-width: none;
  font-size: 0.85rem;
}

.app-sidebar-theme-slot {
  width: 100%;
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.app-theme-mount {
  width: 100%;
}

.app-theme-mount .theme-toggle.theme-toggle-row {
  width: 100%;
  height: auto;
  min-height: 40px;
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  box-shadow: none;
}

.app-theme-mount .theme-toggle.theme-toggle-row:hover {
  transform: none;
  border-color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.app-theme-mount .theme-toggle-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

.user-dropdown-lang-slot {
  padding: 0.65rem 1rem 0.75rem;
}

.user-dropdown-lang-slot .lang-switcher-label {
  width: 100%;
}

.user-dropdown-lang-slot .lang-select {
  width: 100%;
  max-width: none;
  font-size: 0.85rem;
}

body.app-layout {
  --app-topbar-h: 4.25rem;
}

@media (max-width: 768px) {
  body.app-layout {
    --app-topbar-h: 3.75rem;
  }

  .app-topbar-right > .lang-switcher-wrap.lang-switcher-topbar {
    display: none !important;
  }

  .navbar .nav-links > .lang-switcher-wrap-li {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .app-sidebar-lang-slot,
  .user-dropdown-lang-slot {
    display: none;
  }
}

.dash-status-card {
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dash-status-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dash-status-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--btn-glow-text, #060a14);
  flex-shrink: 0;
}

.dash-status-meta h3 {
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.dash-status-meta p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.dash-verify-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dash-verify-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.dash-verify-list li:last-child {
  border-bottom: none;
}

.dash-verify-ok {
  color: var(--success);
  font-weight: 600;
  font-size: 0.8rem;
}

.dash-verify-pending {
  color: var(--warning);
  font-weight: 600;
  font-size: 0.8rem;
}

/* Quick actions */
.dash-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.dash-quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 1.25rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s, color 0.2s;
}

.dash-quick-item:hover {
  border-color: var(--border-strong);
  color: var(--cyan);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.dash-quick-item--live {
  border-color: rgba(124, 58, 237, 0.45);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.12), 0 0 20px rgba(124, 58, 237, 0.12);
}

.dash-quick-item--live .dash-quick-icon {
  background: rgba(124, 58, 237, 0.14);
  border-color: rgba(124, 58, 237, 0.35);
}

.dash-quick-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(0, 242, 255, 0.08);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Crypto assets row */
.dash-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.dash-assets-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.dash-asset-chip {
  padding: 0.75rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.dash-asset-chip:hover {
  border-color: var(--border-strong);
}

.dash-asset-head {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.dash-asset-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--surface-2, rgba(255, 255, 255, 0.04));
}

.dash-asset-logo--stock {
  object-fit: contain;
  padding: 2px;
  background: #fff;
}

.dash-asset-logo-fallback {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: var(--surface-2, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--border);
}

.dash-asset-meta {
  flex: 1;
  min-width: 0;
}

.dash-asset-meta strong {
  display: block;
  font-size: 0.82rem;
  line-height: 1.2;
}

.dash-asset-name {
  display: block;
  font-size: 0.62rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-asset-chip .price {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-asset-chip .change {
  font-size: 0.68rem;
  font-weight: 600;
  flex-shrink: 0;
}

.dash-asset-chip .change.up { color: var(--success); }
.dash-asset-chip .change.down { color: var(--danger); }

/* Dashboard crypto news */
.dash-news-section {
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.dash-news-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.dash-news-section-head .dash-section-title {
  margin-bottom: 0;
  font-size: 0.98rem;
}

.dash-news-section-head .crypto-news-updated {
  font-size: 0.72rem;
}

.dash-news-section .crypto-news-carousel-xs {
  padding: 0 1.75rem 0.85rem;
  margin: 0;
}

.dash-news-section .crypto-news-carousel-xs .crypto-news-item-carousel {
  flex: 0 0 min(178px, 64vw);
}

.dash-news-section .crypto-news-carousel-xs .crypto-news-thumb,
.dash-news-section .crypto-news-carousel-xs .crypto-news-thumb-fallback {
  height: 78px;
}

.dash-news-section .crypto-news-carousel-xs .crypto-news-thumb-fallback {
  font-size: 1.2rem;
}

.dash-news-section .crypto-news-carousel-xs .crypto-news-item-body {
  padding: 0.6rem 0.7rem 0.65rem;
}

.dash-news-section .crypto-news-carousel-xs .crypto-news-source {
  font-size: 0.6rem;
}

.dash-news-section .crypto-news-carousel-xs .crypto-news-title {
  font-size: 0.78rem;
  margin: 0.2rem 0 0.25rem;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.dash-news-section .crypto-news-carousel-xs .crypto-news-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
  font-size: 0.68rem;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
}

.dash-news-section .crypto-news-carousel-xs .crypto-news-time {
  font-size: 0.65rem;
}

.dash-news-section .crypto-news-carousel-xs .carousel-btn {
  width: 30px;
  height: 30px;
  font-size: 1.05rem;
}

.dash-news-section .crypto-news-carousel-xs .crypto-news-dots {
  margin-top: 0.55rem;
}

.dash-news-section .crypto-news-carousel-xs .carousel-dot {
  width: 6px;
  height: 6px;
}

.dash-panels {
  display: grid;
  gap: 1.25rem;
}

.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.dash-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.95rem;
}

.dash-panel-head a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--cyan);
}

.dash-panel-head-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.assets-page-balance {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.assets-page-balance strong {
  color: var(--text);
  font-weight: 700;
}

.assets-allocation-card {
  position: relative;
  padding: 0;
  overflow: visible;
  isolation: isolate;
  border: 1px solid rgba(0, 242, 255, 0.14);
  background:
    linear-gradient(145deg, rgba(124, 58, 237, 0.1) 0%, transparent 45%),
    linear-gradient(220deg, rgba(0, 242, 255, 0.07) 0%, transparent 55%),
    var(--surface);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 16px 48px rgba(0, 0, 0, 0.22);
}

.assets-allocation-glow {
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 55%;
  pointer-events: none;
  background: radial-gradient(ellipse 65% 50% at 50% 0%, rgba(0, 242, 255, 0.14), transparent 72%);
  z-index: 0;
}

.assets-allocation-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.assets-allocation-eyebrow {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
}

.assets-allocation-sub {
  display: none;
}

.assets-allocation-count {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cyan);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 242, 255, 0.25);
  background: rgba(0, 242, 255, 0.08);
}

.assets-allocation-count:empty {
  display: none;
}

.assets-allocation-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.5rem;
  padding: 0.85rem 1.15rem 1rem;
}

.assets-pie-stage {
  position: relative;
  flex: 0 0 184px;
  width: 184px;
  max-width: 100%;
  aspect-ratio: 1;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.25));
}

.assets-pie-wrap {
  position: absolute;
  inset: 0;
}

.assets-pie-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.assets-pie-track {
  stroke: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .assets-pie-track {
  stroke: rgba(12, 18, 34, 0.1);
}

.assets-pie-outer-ring {
  stroke: rgba(0, 242, 255, 0.22);
  stroke-width: 1.25;
}

[data-theme="light"] .assets-pie-outer-ring {
  stroke: rgba(0, 135, 153, 0.28);
}

.assets-pie-slice {
  transform-origin: 120px 120px;
  animation: assetsPieSliceIn 0.5s ease backwards;
  animation-delay: var(--slice-delay, 0s);
  stroke: rgba(8, 12, 24, 0.35);
  stroke-width: 0.75;
  paint-order: stroke fill;
}

[data-theme="light"] .assets-pie-slice {
  stroke: rgba(255, 255, 255, 0.65);
}

@keyframes assetsPieSliceIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.assets-pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 200px;
  min-width: min(100%, 220px);
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.assets-pie-legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  animation: assetsPieLegendIn 0.35s ease backwards;
  animation-delay: var(--legend-delay, 0s);
  font-size: 0.78rem;
  line-height: 1.25;
  min-width: 0;
}

.assets-pie-legend-end {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-shrink: 0;
  padding-left: 0.5rem;
}

.assets-pie-legend-swatch {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 2px;
  background: var(--legend-color);
  box-shadow: 0 0 6px color-mix(in srgb, var(--legend-color) 40%, transparent);
}

.assets-pie-legend-symbol {
  flex: 0 0 auto;
  min-width: 2.25rem;
  max-width: 5rem;
  font-weight: 600;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assets-pie-legend-value {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  white-space: nowrap;
}

.assets-pie-legend-pct {
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  white-space: nowrap;
}

@keyframes assetsPieLegendIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.assets-pie-legend-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

[data-theme="light"] .assets-allocation-card {
  border-color: rgba(0, 135, 153, 0.18);
  background:
    linear-gradient(145deg, rgba(124, 58, 237, 0.06) 0%, transparent 45%),
    linear-gradient(220deg, rgba(0, 135, 153, 0.06) 0%, transparent 55%),
    var(--surface);
  box-shadow:
    0 0 0 1px rgba(12, 18, 34, 0.04) inset,
    0 12px 36px rgba(12, 18, 34, 0.08);
}

@media (max-width: 520px) {
  .assets-allocation-body {
    display: grid;
    grid-template-columns: minmax(128px, 156px) 1fr;
    align-items: center;
    gap: 0.65rem 0.85rem;
    padding: 0.75rem 0.85rem 0.85rem;
  }

  .assets-pie-stage {
    flex: none;
    width: min(100%, 156px);
    margin: 0;
  }

  .assets-pie-legend {
    flex: none;
    min-width: 0;
    max-width: none;
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
  }

  .assets-pie-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  .assets-pie-legend-end {
    display: inline-flex;
    margin-left: auto;
    padding-left: 0.25rem;
    gap: 0.4rem;
    flex-shrink: 0;
  }

  .assets-pie-legend-symbol {
    min-width: 2rem;
    max-width: 3.5rem;
    font-size: 0.75rem;
  }

  .assets-pie-legend-value {
    font-size: 0.65rem;
  }

  .assets-pie-legend-pct {
    font-size: 0.65rem;
  }
}

.dash-panel-body {
  padding: 0;
}

.dash-panel-head-tabs {
  gap: 0.75rem;
}

.dash-panel-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.dash-panel-tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
}

.dash-panel-tab.active {
  color: var(--text);
  border-color: var(--cyan);
  background: color-mix(in srgb, var(--cyan) 12%, transparent);
}

.dash-user-assets-intro {
  margin: 0;
  padding: 0.85rem 1rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.dash-user-assets-table-wrap {
  margin-top: 0.25rem;
}

.dash-user-assets-table {
  width: 100%;
  table-layout: fixed;
}

.dash-user-assets-table th:nth-child(1),
.dash-user-assets-table .dash-user-asset-d-symbol {
  width: 32%;
}

.dash-user-assets-table th:nth-child(2),
.dash-user-assets-table .dash-user-asset-d-change {
  width: 12%;
}

.dash-user-assets-table th:nth-child(3),
.dash-user-assets-table .dash-user-asset-d-price {
  width: 18%;
}

.dash-user-assets-table th:nth-child(4),
.dash-user-assets-table .dash-user-asset-d-qty {
  width: 19%;
}

.dash-user-assets-table th:nth-child(5),
.dash-user-assets-table .dash-user-asset-d-value {
  width: 19%;
}

.dash-user-asset-row--clickable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dash-user-asset-row--clickable:hover td,
.dash-user-asset-row--clickable:focus-visible td {
  background: rgba(0, 242, 255, 0.06);
}

.dash-user-asset-row--clickable:focus-visible {
  outline: none;
}

.dash-user-asset-row--clickable:focus-visible td:first-child {
  box-shadow: inset 3px 0 0 var(--cyan);
}

.dash-user-asset-m-td {
  display: none;
}

.dash-user-asset-row--owned td {
  background: color-mix(in srgb, var(--cyan) 4%, transparent);
}

.dash-user-asset-id {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.dash-user-asset-titles {
  min-width: 0;
}

.dash-user-asset-ticker {
  display: block;
  font-size: 0.92rem;
  line-height: 1.2;
}

.dash-user-asset-name {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9rem;
}

.dash-user-asset-change.up {
  color: var(--success);
}

.dash-user-asset-change.down {
  color: var(--danger);
}

.dash-user-asset-layout {
  padding: 0;
}

/* Mobile: no column headers; symbol + 24h left, qty/value right */
@media (max-width: 768px) {
  .dash-user-assets-table {
    table-layout: auto;
  }

  .dash-user-assets-table thead {
    display: none;
  }

  .dash-user-asset-d-td {
    display: none;
  }

  .dash-user-asset-m-td {
    display: table-cell;
    padding: 0.7rem 1rem !important;
  }

  .dash-user-asset-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .dash-user-asset-start {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
  }

  .dash-user-asset-change-col {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
  }

  .dash-user-asset-holding-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    gap: 0.1rem;
    text-align: right;
  }

  .dash-user-asset-qty-bold {
    font-size: 0.95rem;
    line-height: 1.2;
  }

  .dash-user-asset-value-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
  }

  .dash-user-asset-name {
    max-width: 7.5rem;
  }
}

/* Desktop: real table columns aligned with header */
@media (min-width: 769px) {
  .dash-user-asset-name {
    max-width: none;
  }

  .dash-user-asset-d-change {
    font-weight: 600;
    font-size: 0.85rem;
  }

  .dash-user-assets-table th:nth-child(3),
  .dash-user-asset-d-price {
    text-align: center;
  }

  .dash-user-asset-d-price {
    font-weight: 700;
  }

  .dash-user-assets-table th:nth-child(4),
  .dash-user-assets-table th:nth-child(5),
  .dash-user-asset-d-qty,
  .dash-user-asset-d-value {
    text-align: right;
  }

  .dash-user-asset-d-value {
    color: var(--text-muted);
  }
}

.dash-user-assets-foot {
  display: flex;
  justify-content: flex-end;
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid var(--border);
}

.portfolio-modal-card,
.portfolio-catalog-card {
  max-width: 28rem;
  width: calc(100% - 2rem);
}

.portfolio-modal-card {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  padding: 0 1rem 1rem;
}

.portfolio-modal-card .app-notify-modal-head,
.portfolio-modal-card .portfolio-modal-tabs {
  padding-left: 0;
  padding-right: 0;
}

.portfolio-modal-card .app-notify-modal-head {
  padding-top: 1rem;
}

.portfolio-tab,
.portfolio-modal-card .btn,
.portfolio-convert-option {
  touch-action: manipulation;
}

.portfolio-modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 0 0.15rem 0.85rem;
}

.portfolio-convert-picker {
  max-height: 11rem;
  margin-top: 0.4rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated, rgba(255, 255, 255, 0.03));
  -webkit-overflow-scrolling: touch;
}

.portfolio-convert-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.portfolio-convert-option:last-child {
  border-bottom: 0;
}

.portfolio-convert-option:hover,
.portfolio-convert-option.is-selected {
  background: rgba(0, 242, 255, 0.08);
  color: var(--cyan);
}

.portfolio-convert-empty {
  margin: 0;
  padding: 0.65rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.portfolio-catalog-card {
  max-width: 36rem;
}

.portfolio-catalog-row--clickable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.portfolio-catalog-row--clickable:hover td,
.portfolio-catalog-row--clickable:focus-visible td {
  background: rgba(0, 242, 255, 0.06);
}

.portfolio-catalog-row--clickable:focus-visible {
  outline: none;
}

.portfolio-modal-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.portfolio-tab {
  flex: 1;
  border: 1px solid color-mix(in srgb, var(--border-strong, var(--border)) 55%, var(--text-muted));
  background: color-mix(in srgb, var(--surface-solid, var(--surface)) 65%, transparent);
  color: color-mix(in srgb, var(--text) 82%, var(--text-muted));
  padding: 0.45rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.portfolio-tab:not(.active):not(:disabled):hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--cyan) 40%, var(--border));
  background: color-mix(in srgb, var(--cyan) 7%, var(--surface-solid, var(--surface)));
}

.portfolio-tab.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: color-mix(in srgb, var(--cyan) 11%, transparent);
}

.portfolio-tab--disabled,
.portfolio-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.portfolio-modal-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.portfolio-trade-preview {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: color-mix(in srgb, var(--text) 75%, var(--cyan));
  min-height: 1.25em;
}

#dashPaneAssets {
  padding-bottom: 0.5rem;
}

#dashPaneAssets .table-wrap {
  padding: 0 0.5rem 0.5rem;
}

.dash-panel-body .table-wrap {
  border: none;
  border-radius: 0;
}

.copy-trader-label {
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}

.dash-tx-filters {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0;
  flex-wrap: wrap;
}

.dash-tx-filter {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.dash-tx-filter:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.dash-tx-filter.active {
  background: rgba(0, 242, 255, 0.1);
  border-color: var(--cyan);
  color: var(--cyan);
}

.dash-link-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dash-link-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.15s;
}

.dash-link-card strong {
  font-size: 0.95rem;
  color: var(--text);
}

.dash-link-card span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dash-link-card:hover {
  border-color: var(--cyan);
  transform: translateY(-2px);
}

.dash-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.dash-accordion summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  background: var(--surface);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-accordion summary::-webkit-details-marker {
  display: none;
}

.dash-accordion[open] summary {
  border-bottom: 1px solid var(--border);
}

.dash-accordion-body {
  padding: 1.25rem;
  background: var(--surface-solid);
}

.dash-accordion-body .grid-2 {
  gap: 1.25rem;
}

.app-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 199;
}

/* ─── Bottom tab navigation (mobile only) ─── */
.app-bottom-nav {
  display: none;
  position: fixed;
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  z-index: 150;
  align-items: stretch;
  justify-content: space-around;
  gap: 0.15rem;
  width: min(30rem, calc(100% - 1.5rem));
  min-height: 3.55rem;
  padding: 0.35rem 0.45rem;
  background: var(--navbar-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow:
    0 10px 36px rgba(0, 0, 0, 0.32),
    0 2px 8px rgba(0, 0, 0, 0.18);
}

.app-bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.4rem 0.25rem;
  min-width: 0;
  max-width: 5.5rem;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.app-bottom-nav-item:hover {
  color: var(--text);
}

.app-bottom-nav-item.active {
  color: var(--cyan);
  background: rgba(0, 242, 255, 0.12);
}

.app-bottom-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.app-bottom-nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
  line-height: 1.15;
}

@media (max-width: 1024px) {
  .app-topbar {
    padding: 0.75rem 1.25rem;
  }

  .app-greeting {
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
  }

  .dash-hero-grid {
    grid-template-columns: 1fr;
  }

  .dash-assets-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dash-quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .dash-quick-item {
    padding: 0.75rem 0.4rem;
    font-size: 0.68rem;
  }

  .dash-quick-icon {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .dash-balance-amount {
    font-size: clamp(2.15rem, 5vw, 2.75rem);
  }

  .dash-balance-card {
    padding: 1.5rem 1.4rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .app-sidebar {
    width: 72px;
  }

  .app-sidebar-user-info,
  .app-sidebar-brand .logo-name,
  .app-nav-link span:not(.app-nav-icon),
  .app-nav-section,
  .app-sidebar-footer .btn,
  .app-sidebar-theme-slot .theme-toggle-label {
    display: none;
  }

  .app-sidebar-theme-slot {
    margin-bottom: 0.5rem;
  }

  .app-sidebar-theme-slot .theme-toggle.theme-toggle-row {
    width: 40px;
    min-height: 40px;
    padding: 0;
    justify-content: center;
    margin: 0 auto;
  }

  .app-nav-link {
    justify-content: center;
    padding: 0.75rem;
  }

  .app-nav-icon {
    margin: 0;
    font-size: 1.2rem;
  }

  .app-sidebar-user {
    justify-content: center;
    padding: 1rem 0.5rem;
  }

  .app-wrapper {
    margin-left: 72px;
  }

  .app-sidebar-brand {
    text-align: center;
    padding: 1rem 0.5rem;
  }

  .app-sidebar-brand .logo {
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  .app-bottom-nav {
    display: flex;
  }

  /* Smartsupp: keep chat bubble above the floating bottom pill */
  body.app-layout #smartsupp-widget-container {
    bottom: calc(3.55rem + 0.75rem + env(safe-area-inset-bottom, 0) + 0.75rem) !important;
  }

  /* While typing: hide floating chrome so it is not parked above the keyboard */
  body.app-layout.mobile-keyboard-open .app-bottom-nav,
  body.app-layout.mobile-keyboard-open #smartsupp-widget-container {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  body.has-bottom-nav.app-layout {
    --app-bottom-nav-h: calc(3.55rem + 0.75rem + env(safe-area-inset-bottom, 0) + 0.5rem);
    padding-bottom: var(--app-bottom-nav-h);
  }

  .app-sidebar {
    transform: translateX(-100%);
    /* Above sticky topbar (1000) so the drawer isn't covered when open */
    z-index: 1100;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-sidebar-overlay {
    z-index: 1090;
  }

  .app-sidebar-overlay.open {
    display: block;
  }

  .app-wrapper {
    margin-left: 0;
  }

  .app-menu-toggle {
    display: block;
  }

  .app-topbar {
    padding: 0.65rem 1rem;
  }

  .app-notify-panel.app-notify-panel-mobile,
  .app-notify-panel-mobile {
    position: fixed;
    top: calc(var(--app-topbar-h, 4.25rem) + env(safe-area-inset-top, 0) + 0.35rem);
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
    max-height: min(420px, calc(100dvh - var(--app-topbar-h, 4.25rem) - env(safe-area-inset-top, 0) - 1.25rem));
    z-index: 1500;
  }

  .app-notify-list {
    flex: 1;
    min-height: 0;
  }

  .app-notify-modal {
    align-items: flex-end;
    padding: 0.75rem;
    padding-bottom: 0.75rem;
  }

  body.mobile-modal-open {
    overflow: hidden;
  }

  body.mobile-modal-open.app-layout #smartsupp-widget-container {
    display: none !important;
  }

  /* Full-screen dim; sheet at top. Do not use dvh max-height here (iOS shrinks it with keyboard). */
  body.mobile-modal-open .app-notify-modal:not(.hidden) {
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: max(0.35rem, env(safe-area-inset-top, 0)) 0.75rem 0.75rem;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.72);
  }

  body.mobile-modal-open.has-bottom-nav.app-layout .app-notify-modal:not(.hidden) {
    padding-bottom: 0.75rem;
  }

  body.mobile-keyboard-open .app-notify-modal:not(.hidden) {
    top: var(--app-vv-offset-top, 0);
    height: var(--app-vv-height, 100%);
    max-height: var(--app-vv-height, 100%);
    padding-top: max(0.25rem, env(safe-area-inset-top, 0));
    padding-bottom: 0.35rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.mobile-modal-open .app-notify-modal-card,
  body.mobile-modal-open .portfolio-modal-card,
  body.mobile-modal-open .portfolio-catalog-card {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0) - 1.5rem));
    height: auto;
    min-height: 0;
    margin: 0;
    align-self: flex-start;
    flex: 0 0 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--surface-solid, #0f1528);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--border-strong, var(--border));
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    isolation: isolate;
    pointer-events: auto;
  }

  body.mobile-modal-open .portfolio-modal-card,
  body.mobile-modal-open .portfolio-catalog-card {
    padding: 1rem 1rem 1.1rem;
  }

  body.mobile-modal-open .portfolio-modal-card .form-control,
  body.mobile-modal-open .portfolio-catalog-card .form-control {
    background: var(--bg-elevated, rgba(6, 10, 20, 0.95));
  }

  body.mobile-modal-open .portfolio-modal-card .portfolio-tab.active {
    background: color-mix(in srgb, var(--cyan) 14%, var(--surface-solid, #0f1528));
  }

  .app-notify-modal-card {
    max-height: min(80dvh, calc(100dvh - var(--app-topbar-h, 4.25rem) - 2rem - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)));
  }

  body.has-bottom-nav.app-layout:not(.mobile-modal-open) .app-notify-modal-card {
    max-height: min(
      80dvh,
      calc(100dvh - var(--app-topbar-h, 4.25rem) - var(--app-bottom-nav-h, 3.75rem) - 2rem - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0))
    );
  }

  body.mobile-modal-open .app-notify-modal-body {
    overflow: visible;
  }

  body.mobile-modal-open .app-dialog-overlay:not(.hidden) {
    inset: 0;
    height: 100%;
    max-height: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: max(0.35rem, env(safe-area-inset-top, 0)) 0.75rem 0.75rem;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.72);
  }

  body.mobile-keyboard-open .app-dialog-overlay:not(.hidden) {
    top: var(--app-vv-offset-top, 0);
    height: var(--app-vv-height, 100%);
    max-height: var(--app-vv-height, 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.mobile-modal-open .app-dialog-card {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0) - 1.5rem));
    height: auto;
    align-self: flex-start;
    flex: 0 0 auto;
    margin: 0;
    border-radius: var(--radius);
    background: var(--surface-solid, #0f1528);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body.mobile-modal-open #copyModal:not(.hidden) {
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: max(0.35rem, env(safe-area-inset-top, 0)) 0.75rem 0.75rem !important;
    overflow: hidden !important;
    background: rgba(0, 0, 0, 0.72) !important;
  }

  body.mobile-keyboard-open #copyModal:not(.hidden) {
    top: var(--app-vv-offset-top, 0) !important;
    height: var(--app-vv-height, 100%) !important;
    max-height: var(--app-vv-height, 100%) !important;
    overflow-y: auto !important;
  }

  body.mobile-modal-open #copyModal:not(.hidden) .card {
    max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0) - 1.5rem)) !important;
    height: auto !important;
    align-self: flex-start !important;
    flex: 0 0 auto !important;
    overflow: visible !important;
    margin: 0 !important;
    width: 100% !important;
    border-radius: var(--radius) !important;
    background: var(--surface-solid, #0f1528) !important;
    backdrop-filter: none !important;
  }

  .app-greeting {
    font-size: 1.1rem;
    margin-bottom: 1rem;
  }

  .app-content {
    padding: 1rem;
  }

  .dash-quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 1.25rem;
  }

  .dash-quick-item {
    padding: 0.55rem 0.3rem 0.6rem;
    gap: 0.35rem;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.15;
    border-radius: var(--radius);
    text-align: center;
    -webkit-tap-highlight-color: transparent;
  }

  .dash-quick-item:hover {
    transform: none;
    box-shadow: none;
  }

  .dash-quick-item:active {
    transform: scale(0.97);
    border-color: var(--cyan);
    color: var(--cyan);
  }

  .dash-quick-item > span:last-child {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    max-width: 100%;
  }

  .dash-quick-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 0.9rem;
    background: rgba(0, 242, 255, 0.06);
  }

  .dash-assets-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .dash-asset-chip {
    padding: 0.65rem 0.55rem;
  }

  .dash-asset-meta strong {
    font-size: 0.78rem;
  }

  .dash-asset-chip .price {
    font-size: 0.72rem;
  }

  .dash-balance-amount {
    font-size: clamp(1.9rem, 5.5vw, 2.2rem);
    padding-bottom: 1.1rem;
  }

  .dash-balance-card {
    padding: 1.35rem 1.25rem;
    min-height: auto;
  }

  .dash-balance-inner {
    min-height: auto;
  }

  .dash-balance-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    padding-top: 1rem;
  }

  .dash-balance-actions .btn {
    flex: none;
    width: 100%;
    min-height: 42px;
    max-height: none;
    padding: 0.5rem 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    border-radius: 12px;
    white-space: normal;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
  }

  .dash-balance-actions .btn-glow {
    box-shadow: 0 2px 10px rgba(0, 242, 255, 0.22);
  }

  .dash-balance-actions .btn-glow:hover,
  .dash-balance-actions .btn-glow:active {
    transform: none;
    box-shadow: 0 2px 10px rgba(0, 242, 255, 0.22);
  }

  .dash-balance-actions .btn-outline {
    background: rgba(255, 255, 255, 0.04);
    border-width: 1px;
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text);
  }

  .dash-balance-actions .btn-outline:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(0, 242, 255, 0.35);
    color: var(--text);
    box-shadow: none;
    transform: none;
  }

  .dash-balance-actions .btn-outline:active {
    transform: scale(0.98);
    background: rgba(0, 242, 255, 0.08);
  }

  [data-theme="light"] .dash-balance-actions .btn-outline {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.12);
    color: var(--text);
  }

  [data-theme="light"] .dash-balance-actions .btn-outline:hover {
    background: rgba(15, 23, 42, 0.07);
    border-color: rgba(0, 140, 160, 0.35);
  }

  .dash-news-section .crypto-news-carousel-xs .crypto-news-item-carousel {
    flex: 0 0 min(168px, 62vw);
  }

  .dash-hero-grid {
    gap: 1rem;
    margin-bottom: 1.25rem;
  }

  .dash-status-card {
    padding: 1rem 1.05rem;
    gap: 0;
    border-radius: 14px;
    align-items: stretch;
    overflow: hidden;
  }

  .dash-status-header {
    gap: 0.75rem;
    padding-bottom: 0.9rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
  }

  .dash-status-header .avatar-img,
  .dash-status-header .avatar-fallback {
    width: 44px !important;
    height: 44px !important;
    flex-shrink: 0;
  }

  .dash-status-meta {
    min-width: 0;
    flex: 1;
  }

  .dash-status-meta h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dash-status-meta p {
    font-size: 0.72rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dash-verify-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .dash-verify-list li {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.4rem;
    padding: 0.65rem 0.7rem;
    min-height: 58px;
    border-bottom: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .dash-verify-list li > span:first-child {
    color: var(--text-muted);
    font-weight: 500;
    white-space: normal;
    word-break: break-word;
  }

  .dash-verify-list li > span:last-child,
  .dash-verify-list li > strong {
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.2;
  }

  .dash-verify-list li #kycVerifyStatus,
  .dash-verify-list li #twoFaStatus {
    display: flex;
    align-items: center;
  }

  .dash-verify-list #positionCount {
    color: var(--cyan);
    font-size: 0.82rem;
    font-weight: 700;
  }

  .dash-verify-ok,
  .dash-verify-pending {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
  }

  .dash-verify-ok {
    background: rgba(0, 230, 118, 0.14);
    color: var(--success);
  }

  .dash-verify-pending {
    background: rgba(255, 193, 7, 0.14);
    color: var(--warning);
  }

  [data-theme="light"] .dash-verify-list li {
    background: rgba(15, 23, 42, 0.035);
  }

  [data-theme="light"] .dash-verify-ok {
    background: rgba(0, 180, 90, 0.12);
  }

  [data-theme="light"] .dash-verify-pending {
    background: rgba(200, 140, 0, 0.12);
  }

  .dash-section-title {
    font-size: 0.98rem;
  }
}

@media (max-width: 480px) {
  .dash-assets-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .dash-quick-grid {
    gap: 0.4rem;
    margin-bottom: 1rem;
  }

  .dash-quick-item {
    padding: 0.48rem 0.2rem 0.52rem;
    font-size: 0.58rem;
  }

  .dash-quick-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    font-size: 0.82rem;
  }

  .dash-balance-amount {
    font-size: clamp(1.85rem, 5vw, 2.1rem);
    line-height: 1.1;
  }

  .dash-balance-card {
    padding: 1.2rem 1rem;
  }

  .dash-status-card {
    padding: 0.9rem 0.95rem;
  }

  .dash-status-header {
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .dash-verify-list {
    gap: 0.4rem;
  }

  .dash-verify-list li {
    padding: 0.55rem 0.6rem;
    min-height: 54px;
    font-size: 0.64rem;
  }

  .dash-verify-list li > span:last-child,
  .dash-verify-list li > strong {
    font-size: 0.7rem;
  }

  .dash-balance-actions {
    gap: 0.4rem;
  }

  .dash-balance-actions .btn {
    min-height: 40px;
    padding: 0.45rem 0.3rem;
    font-size: 0.68rem;
  }

  .app-content {
    padding: 0.85rem;
  }
}

.traders-toolbar {
  margin-bottom: 1.25rem;
  max-width: 420px;
}

.traders-empty {
  color: var(--text-muted);
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.5rem 0;
  text-align: center;
}

/* ─────────────── User confirm dialog ─────────────── */

.app-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top, 0px));
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.62);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.app-dialog-overlay.hidden { display: none !important; }

.app-dialog-card {
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 0;
  overflow: hidden;
}

.app-dialog-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
}

.app-dialog-body { padding: 1.1rem 1.25rem; }

.app-dialog-body p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.app-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
  .app-dialog-overlay { align-items: flex-end; padding: 0; }
  .app-dialog-card {
    max-width: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
  .app-dialog-footer { padding-bottom: max(0.85rem, env(safe-area-inset-bottom, 0px)); }
}

/* ─────────────── Trading signals: shared ─────────────── */

.signal-strength-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.signal-strength-badge.tier-low { background: var(--danger-dim); color: var(--danger); }
.signal-strength-badge.tier-medium { background: rgba(255, 176, 32, 0.16); color: var(--warning); }
.signal-strength-badge.tier-high { background: var(--success-dim); color: var(--success); }

.signal-meter {
  display: flex;
  gap: 3px;
  align-items: center;
}

.signal-meter-cell {
  flex: 1;
  height: 8px;
  border-radius: 3px;
  background: rgba(139, 157, 195, 0.18);
}

.signal-meter-cell.filled.tier-low { background: var(--danger); }
.signal-meter-cell.filled.tier-medium { background: var(--warning); }
.signal-meter-cell.filled.tier-high { background: var(--success); }

.signal-progress {
  height: 8px;
  width: 100%;
  border-radius: 50px;
  background: rgba(139, 157, 195, 0.16);
  overflow: hidden;
}

.signal-progress-fill {
  height: 100%;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--cyan-dim), var(--cyan));
  transition: width 0.6s ease;
}

.signal-progress-fill.is-paused {
  background: linear-gradient(90deg, rgba(255, 176, 32, 0.7), var(--warning));
}

/* ─────────────── Signals page ─────────────── */

.signals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.signal-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.35rem;
}

.signal-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.signal-card-name {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
}

.signal-card-price {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--cyan);
  line-height: 1;
}

.signal-card-price-label {
  display: block;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.signal-card-meter-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.signal-card-rows {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.15rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.signal-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  padding-top: 0.45rem;
}

.signal-card-row span { color: var(--text-muted); }
.signal-card-row strong { font-weight: 600; }

.signal-card-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.signal-card .btn { width: 100%; }

.signals-empty {
  color: var(--text-muted);
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.5rem 0;
  text-align: center;
}

/* ─────────────── AI program cards (catalog + active) ─────────────── */

.ai-programs-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.35rem;
}

.ai-program-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.2rem 1.35rem;
  border-radius: var(--radius-lg, 14px);
  border: 1px solid rgba(0, 242, 255, 0.22);
  background:
    linear-gradient(155deg, rgba(124, 58, 237, 0.12) 0%, transparent 42%),
    linear-gradient(220deg, rgba(0, 242, 255, 0.08) 0%, transparent 50%),
    rgba(10, 16, 32, 0.92);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 12px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  isolation: isolate;
}

.ai-program-card__glow {
  position: absolute;
  inset: -40% -20% auto -20%;
  height: 70%;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 55% at 50% 0%, rgba(124, 58, 237, 0.35), transparent 70%);
  opacity: 0.85;
  z-index: 0;
}

.ai-program-card__scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 242, 255, 0.15) 2px,
    rgba(0, 242, 255, 0.15) 3px
  );
  z-index: 0;
}

.ai-program-card.is-live .ai-program-card__glow {
  animation: ai-program-glow 4s ease-in-out infinite alternate;
}

.ai-program-card__head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.ai-program-card__titles {
  flex: 1;
  min-width: 0;
}

.ai-program-card__eyebrow {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(0, 242, 255, 0.85);
  margin-bottom: 0.35rem;
}

.ai-program-card__name {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.ai-program-card__tagline,
.ai-program-card__slug {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.ai-program-card__status {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  color: var(--success);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.15);
}

.ai-program-card__fee-block {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  background: rgba(0, 242, 255, 0.06);
  border: 1px solid rgba(0, 242, 255, 0.14);
}

.ai-program-card__fee-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ai-program-card__fee-value {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(120deg, #fff 20%, var(--cyan) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ai-program-card__metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.ai-program-card__metrics--catalog {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-program-metric {
  padding: 0.5rem 0.55rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-program-metric span {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  line-height: 1.2;
}

.ai-program-metric strong {
  font-size: 0.88rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.ai-program-card__pairs {
  position: relative;
  z-index: 1;
}

.ai-program-card__pairs-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.ai-program-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ai-program-chip {
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  color: rgba(0, 242, 255, 0.95);
  background: rgba(0, 242, 255, 0.08);
  border: 1px solid rgba(0, 242, 255, 0.2);
}

.ai-program-chip--muted {
  color: var(--text-muted);
  border-color: var(--border);
  background: transparent;
}

.ai-program-card__stake {
  position: relative;
  z-index: 1;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius);
  background: rgba(6, 10, 22, 0.55);
  border: 1px solid rgba(124, 58, 237, 0.25);
}

.ai-program-card__stake-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: color-mix(in srgb, var(--text) 88%, var(--text-muted));
}

.ai-program-card__stake-input {
  background: rgba(0, 0, 0, 0.35) !important;
  border-color: rgba(0, 242, 255, 0.22) !important;
  font-variant-numeric: tabular-nums;
}

.ai-program-card__stake-input:focus {
  border-color: rgba(0, 242, 255, 0.55) !important;
  box-shadow: 0 0 0 2px rgba(0, 242, 255, 0.12);
}

.ai-program-card__stake-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ai-program-card__cta {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: 0.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ai-program-card__cta--stop {
  border-color: rgba(255, 255, 255, 0.15);
}

.ai-program-card--running {
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.08) inset,
    0 0 28px rgba(124, 58, 237, 0.2),
    0 12px 40px rgba(0, 0, 0, 0.35);
}

.ai-program-card--active.is-paused {
  border-color: rgba(255, 176, 32, 0.35);
}

.ai-program-card--active.is-paused .ai-program-card__glow {
  background: radial-gradient(ellipse 70% 55% at 50% 0%, rgba(255, 176, 32, 0.25), transparent 70%);
}

@keyframes ai-program-glow {
  from {
    opacity: 0.55;
    transform: translateY(0);
  }
  to {
    opacity: 1;
    transform: translateY(4px);
  }
}

@media (max-width: 768px) {
  .ai-program-card {
    padding: 1.15rem 1rem 1.25rem;
  }

  .ai-program-card__metrics {
    grid-template-columns: 1fr 1fr;
  }

  .ai-program-card__metrics .ai-program-metric:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .ai-program-card__fee-value {
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-program-card.is-live .ai-program-card__glow {
    animation: none;
  }
}

.signal-active-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.signal-active-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.35rem;
}

.signal-active-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.signal-active-head-text {
  flex: 1;
  min-width: 0;
}

.signal-active-progress-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.signal-active-progress-label strong {
  font-size: 1.1rem;
  color: var(--cyan);
  font-weight: 800;
}

.signal-active-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.signal-active-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.signal-active-stat span {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.signal-active-stat strong {
  font-size: 0.95rem;
  font-weight: 700;
}

/* ─────────────── Dashboard signal widget ─────────────── */

.dash-signal-card {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.dash-signal-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.dash-signal-eyebrow {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dash-signal-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}

.dash-signal-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.16rem 0.55rem;
  border-radius: 50px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--success-dim);
  color: var(--success);
}

.dash-signal-pill.is-manual { background: rgba(0, 242, 255, 0.12); color: var(--cyan); }
.dash-signal-pill.is-mixed { background: rgba(124, 58, 237, 0.16); color: var(--purple); }
.dash-signal-pill.is-paused { background: rgba(255, 176, 32, 0.16); color: var(--warning); }

.dash-signal-link {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--cyan);
  text-decoration: none;
  white-space: nowrap;
}

.dash-signal-link:hover { text-decoration: underline; }

.dash-signal-bar-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dash-signal-bar-row .signal-progress { height: 6px; }

.dash-signal-bar-pct {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--cyan);
  min-width: 3.1rem;
  text-align: right;
}

.dash-signal-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: flex-start;
}

.dash-signal-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dash-signal-stat span {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dash-signal-stat strong {
  font-size: 0.88rem;
  font-weight: 700;
}

.dash-signal-chips {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.signal-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.5rem;
  border-radius: 50px;
  font-size: 0.68rem;
  font-weight: 700;
}

.signal-chip.is-win { background: var(--success-dim); color: var(--success); }
.signal-chip.is-loss { background: var(--danger-dim); color: var(--danger); }
.signal-chip.is-today { background: rgba(0, 242, 255, 0.12); color: var(--cyan); }
.signal-chip.is-today.is-negative { background: var(--danger-dim); color: var(--danger); }

.dash-signal-others {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.dash-signal-other {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

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

@media (max-width: 560px) {
  .dash-signal-stats { gap: 0.5rem 1.1rem; }
  .signal-active-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ─────────────── Dashboard AI trading widget ─────────────── */

.dash-ai-card {
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
  position: relative;
}

.dash-ai-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 12% 50%, rgba(124, 58, 237, 0.14), transparent 55%);
  opacity: 0.9;
}

.dash-ai-layout {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  position: relative;
  z-index: 1;
}

.dash-ai-visual {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ai-orb {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 242, 255, 0.35);
  opacity: 0;
}

.dash-ai-visual.is-live .ai-orb-ring--1 {
  animation: ai-orb-pulse 2.4s ease-out infinite;
}

.dash-ai-visual.is-live .ai-orb-ring--2 {
  animation: ai-orb-pulse 2.4s ease-out 0.8s infinite;
}

.dash-ai-visual.is-live .ai-orb-ring--3 {
  animation: ai-orb-pulse 2.4s ease-out 1.6s infinite;
}

.ai-orb-core {
  position: relative;
  z-index: 2;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(124, 58, 237, 0.45), rgba(0, 242, 255, 0.25));
  border: 1px solid rgba(0, 242, 255, 0.45);
  box-shadow: 0 0 24px rgba(124, 58, 237, 0.35);
}

.dash-ai-visual.is-live .ai-orb-core {
  animation: ai-orb-glow 2s ease-in-out infinite alternate;
}

.dash-ai-visual.is-idle .ai-orb-core {
  opacity: 0.75;
  box-shadow: none;
}

.ai-orb-icon {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--cyan);
}

.ai-orb-dot {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.dash-ai-visual.is-live .ai-orb-dot {
  animation: ai-dot-blink 1.2s ease-in-out infinite;
}

.dash-ai-visual.is-idle .ai-orb-dot {
  background: var(--warning);
  box-shadow: none;
}

.ai-data-stream {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  height: 12px;
  align-items: flex-end;
  opacity: 0.5;
}

.dash-ai-visual.is-live .ai-data-stream span {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: var(--cyan);
  animation: ai-bar-dance 0.9s ease-in-out infinite;
}

.dash-ai-visual.is-live .ai-data-stream span:nth-child(1) { animation-delay: 0s; height: 6px; }
.dash-ai-visual.is-live .ai-data-stream span:nth-child(2) { animation-delay: 0.15s; height: 10px; }
.dash-ai-visual.is-live .ai-data-stream span:nth-child(3) { animation-delay: 0.3s; height: 7px; }
.dash-ai-visual.is-live .ai-data-stream span:nth-child(4) { animation-delay: 0.45s; height: 11px; }

.dash-ai-visual.is-idle .ai-data-stream {
  opacity: 0.25;
}

.dash-ai-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.dash-ai-head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.dash-ai-eyebrow {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--purple, #a78bfa);
}

.dash-ai-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
}

.dash-ai-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
}

.dash-ai-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.55rem;
  border-radius: 50px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.dash-ai-pill.is-live {
  background: rgba(124, 58, 237, 0.18);
  color: var(--purple, #a78bfa);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.2);
}

.dash-ai-pill.is-paused {
  background: rgba(255, 176, 32, 0.16);
  color: var(--warning);
}

.dash-ai-link {
  font-size: 0.78rem;
  color: var(--cyan);
  text-decoration: none;
}

.dash-ai-link:hover { text-decoration: underline; }

.dash-ai-manage-link {
  align-self: flex-start;
  margin-top: 0.15rem;
}

.dash-ai-tagline {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-word;
}

.dash-ai-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem 0.75rem;
  margin-top: 0.15rem;
}

.dash-ai-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dash-ai-stat span {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dash-ai-stat strong {
  font-size: 0.88rem;
  font-weight: 700;
}

.dash-ai-pnl-positive { color: var(--success); }
.dash-ai-pnl-negative { color: var(--danger); }

.dash-ai-others {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.dash-ai-other {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

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

@keyframes ai-orb-pulse {
  0% { transform: scale(0.65); opacity: 0.85; }
  100% { transform: scale(1.35); opacity: 0; }
}

@keyframes ai-orb-glow {
  0% { box-shadow: 0 0 16px rgba(124, 58, 237, 0.3); }
  100% { box-shadow: 0 0 28px rgba(0, 242, 255, 0.45); }
}

@keyframes ai-dot-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

@keyframes ai-bar-dance {
  0%, 100% { transform: scaleY(0.45); opacity: 0.5; }
  50% { transform: scaleY(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .dash-ai-visual.is-live .ai-orb-ring,
  .dash-ai-visual.is-live .ai-orb-core,
  .dash-ai-visual.is-live .ai-orb-dot,
  .dash-ai-visual.is-live .ai-data-stream span {
    animation: none;
  }
}

@media (max-width: 768px) {
  .dash-ai-card {
    padding: 1rem 1rem 1.05rem;
  }

  .dash-ai-layout {
    align-items: flex-start;
    gap: 0.85rem;
  }

  .dash-ai-visual {
    width: 72px;
    height: 72px;
    margin-top: 0.15rem;
  }

  .dash-ai-visual .ai-orb {
    width: 64px;
    height: 64px;
  }

  .dash-ai-visual .ai-orb-core {
    width: 46px;
    height: 46px;
  }

  .dash-ai-body {
    gap: 0.65rem;
    width: 100%;
  }

  .dash-ai-name {
    font-size: 1rem;
  }

  .dash-ai-stats {
    width: 100%;
    padding: 0.65rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .dash-ai-stat strong {
    font-size: 0.92rem;
  }

  .dash-ai-manage-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 0;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(0, 242, 255, 0.35);
    background: rgba(0, 242, 255, 0.06);
    font-weight: 600;
    text-align: center;
    box-sizing: border-box;
  }

  .dash-ai-manage-link:hover {
    text-decoration: none;
    background: rgba(0, 242, 255, 0.1);
  }

  .dash-ai-other {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .dash-ai-other span {
    font-size: 0.72rem;
    line-height: 1.4;
  }
}

@media (max-width: 380px) {
  .dash-ai-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-ai-stat:last-child {
    grid-column: 1 / -1;
  }

  .dash-ai-stat span {
    font-size: 0.58rem;
  }
}

@media (min-width: 769px) {
  .dash-ai-body {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    column-gap: 1rem;
  }

  .dash-ai-head {
    grid-column: 1;
    grid-row: 1;
  }

  .dash-ai-manage-link {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    white-space: nowrap;
    margin-top: 0.35rem;
  }

  .dash-ai-stats {
    grid-column: 1 / -1;
    grid-row: 2;
    border: none;
    padding: 0;
    margin-top: 0;
  }

  .dash-ai-others {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

.ai-page-active-banner {
  margin-bottom: 1rem;
}

.ai-orb-wrap--compact {
  width: 56px;
  height: 56px;
}

.ai-orb-wrap--compact .ai-orb {
  width: 48px;
  height: 48px;
}

.ai-orb-wrap--compact .ai-orb-core {
  width: 38px;
  height: 38px;
}

.ai-orb-wrap--compact .ai-orb-icon {
  font-size: 0.58rem;
}

.ai-orb-wrap--compact .ai-orb-dot {
  width: 5px;
  height: 5px;
  top: 6px;
  right: 7px;
}

.ai-orb-wrap--compact .ai-data-stream {
  display: none;
}

.signal-active-card--live {
  position: relative;
  overflow: hidden;
}

.signal-active-card--live::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 80% at 0% 50%, rgba(124, 58, 237, 0.1), transparent 55%);
}
