/* Profit Alerts — design tokens + app shell (sidebar / topbar) */

:root {
  --pa-space-1: 8px;
  --pa-space-2: 12px;
  --pa-space-3: 16px;
  --pa-space-4: 24px;
  --pa-bg-deep: #090c11;
  --pa-bg-elevated: #0f141c;
  --pa-surface: #151b26;
  --pa-border: rgba(148, 163, 184, 0.1);
  --pa-text: #e8eaed;
  --pa-text-muted: #94a3b8;
  --pa-accent: #38bdf8;
  --pa-accent-strong: #2563eb;
  --pa-positive: #34d399;
  --pa-negative: #f87171;
  --pa-sidebar-w: 284px;
  --pa-sidebar-collapsed-w: 72px;
  --pa-topbar-h: 56px;
  /* Global motion: 150–200ms, ease-in-out (premium UI baseline) */
  --pa-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --pa-dur: 165ms;
}

html[data-theme="light"] {
  --pa-bg-deep: #f3f4f6;
  --pa-bg-elevated: #ffffff;
  --pa-surface: #ffffff;
  --pa-border: rgba(15, 23, 42, 0.08);
  --pa-text: #111827;
  --pa-text-muted: #6b7280;
}

.pa-body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

.pa-app {
  display: flex;
  min-height: 100vh;
  background: var(--pa-bg-deep);
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.022) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: center top;
}

.pa-sidebar {
  flex: 0 0 var(--pa-sidebar-w);
  width: var(--pa-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Softer lift: closer to main canvas, less competing chrome */
  background: linear-gradient(180deg, rgba(14, 18, 26, 0.92) 0%, rgba(9, 12, 17, 0.98) 100%);
  border-right: 1px solid rgba(148, 163, 184, 0.065);
  z-index: 1040;
  transition:
    flex-basis var(--pa-dur) var(--pa-ease),
    width var(--pa-dur) var(--pa-ease);
}

html[data-theme="light"] .pa-sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f4f5f7 100%);
  border-right-color: rgba(15, 23, 42, 0.06);
}

.pa-sidebar--collapsed {
  flex-basis: var(--pa-sidebar-collapsed-w);
  width: var(--pa-sidebar-collapsed-w);
}

.pa-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pa-space-1);
  padding: 14px 13px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.065);
  min-height: var(--pa-topbar-h);
}

.pa-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.pa-sidebar-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: -0.02em;
  color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  box-shadow: 0 1px 8px rgba(37, 99, 235, 0.2);
  flex-shrink: 0;
}

.pa-sidebar-title {
  font-weight: 650;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.95) 0%, rgba(34, 211, 238, 0.9) 50%, rgba(52, 211, 153, 0.85) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.pa-sidebar--collapsed .pa-sidebar-title,
.pa-sidebar--collapsed .pa-nav-label,
.pa-sidebar--collapsed .pa-nav-section-kicker {
  display: none;
}

.pa-sidebar--collapsed .pa-sidebar-brand {
  justify-content: center;
  flex-direction: column;
}

.pa-sidebar-collapse {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(26, 34, 51, 0.5);
  color: var(--pa-text-muted);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--pa-dur) var(--pa-ease),
    border-color var(--pa-dur) var(--pa-ease),
    transform var(--pa-dur) var(--pa-ease),
    box-shadow var(--pa-dur) var(--pa-ease);
}

.pa-sidebar-collapse:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--pa-text);
}

.pa-sidebar-collapse:active {
  transform: scale(0.94);
}

.pa-sidebar-collapse:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.pa-sidebar-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /* Avoid clipping section titles; horizontal scroll is prevented at html/.pa-body level */
  overflow-x: visible;
  -webkit-overflow-scrolling: touch;
}

.pa-sidebar-nav {
  flex: 0 0 auto;
  padding: 10px 13px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pa-sidebar--collapsed .pa-sidebar-desk-intel {
  display: none;
}

.pa-nav-section-kicker {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(186, 198, 215, 0.88);
  padding: 6px 2px 3px;
  line-height: 1.35;
  flex-shrink: 0;
  align-self: stretch;
  overflow: visible;
  white-space: normal;
  word-break: break-word;
}

.pa-nav-section-kicker:not(:first-child) {
  margin-top: 12px;
  padding-top: 10px;
}

html[data-theme="light"] .pa-nav-section-kicker {
  color: rgba(71, 85, 105, 0.88);
}

.pa-nav-section-kicker--muted {
  opacity: 0.78;
}

.pa-nav-item--subtle {
  font-size: 0.8125rem;
  font-weight: 550;
  opacity: 0.9;
  padding: 6px 10px;
  min-height: 36px;
}

.pa-nav-item--subtle:hover {
  opacity: 1;
}

html[data-theme="light"] .pa-nav-item--subtle {
  opacity: 0.92;
}

.pa-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  min-height: 38px;
  border-radius: 8px;
  text-decoration: none !important;
  color: rgba(229, 231, 235, 0.86) !important;
  font-weight: 600;
  font-size: 0.86rem;
  border: 1px solid transparent;
  transition:
    background var(--pa-dur) var(--pa-ease),
    border-color var(--pa-dur) var(--pa-ease),
    color var(--pa-dur) var(--pa-ease),
    transform var(--pa-dur) var(--pa-ease),
    opacity var(--pa-dur) var(--pa-ease),
    box-shadow var(--pa-dur) var(--pa-ease);
}

html[data-theme="light"] .pa-nav-item {
  color: #374151 !important;
}

.pa-nav-item:hover {
  background: rgba(56, 189, 248, 0.06);
  border-color: rgba(56, 189, 248, 0.14);
  color: #fff !important;
}

.pa-nav-item.pa-nav-item--active {
  background: rgba(56, 189, 248, 0.07);
  border-color: rgba(56, 189, 248, 0.2);
  color: #fff !important;
  box-shadow: inset 2px 0 0 0 rgba(56, 189, 248, 0.72);
}

.pa-nav-item:active {
  transform: scale(0.99);
  opacity: 0.96;
}

.pa-nav-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35);
  border-color: rgba(56, 189, 248, 0.35);
}

html[data-theme="light"] .pa-nav-item.pa-nav-item--active {
  color: #0f172a !important;
  background: rgba(14, 165, 233, 0.09);
  box-shadow: inset 2px 0 0 0 rgba(14, 165, 233, 0.65);
}

.pa-nav-icon {
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity var(--pa-dur) var(--pa-ease);
}

.pa-sidebar-nav .pa-nav-label {
  flex-shrink: 0;
}

.pa-nav-item:hover .pa-nav-icon,
.pa-nav-item.pa-nav-item--active .pa-nav-icon {
  opacity: 1;
}

.pa-sidebar-footer {
  padding: 10px 13px;
  border-top: 1px solid rgba(148, 163, 184, 0.065);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pa-icon-btn {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(26, 34, 51, 0.45);
  color: var(--pa-text);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--pa-dur) var(--pa-ease),
    border-color var(--pa-dur) var(--pa-ease);
}

.pa-icon-btn:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
}

.pa-sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 12, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1030;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.pa-sidebar-scrim[hidden] {
  display: none !important;
}

.pa-shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* Sticky topbar must paint above <main> (later sibling); isolate shell stacking. */
  isolation: isolate;
  z-index: 0;
}

.pa-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--pa-topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding:
    max(8px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    8px
    max(12px, env(safe-area-inset-left, 0px));
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(71, 85, 105, 0.22);
}

.pa-topbar-left,
.pa-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pa-topbar-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pa-text-muted);
}

.pa-market-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pa-text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(26, 34, 51, 0.55);
  font-variant-numeric: tabular-nums;
  transition:
    border-color var(--pa-dur) var(--pa-ease),
    box-shadow var(--pa-dur) var(--pa-ease);
}

.pa-market-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.35);
  transition:
    background var(--pa-dur) var(--pa-ease),
    box-shadow var(--pa-dur) var(--pa-ease);
}

.pa-market-dot--live {
  background: #34d399;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.35);
  animation: pa-pulse 2s ease-in-out infinite;
}

@keyframes pa-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.pa-page {
  flex: 1;
  min-width: 0;
}


/* Sticky rail clears sticky topbar */
.pa-shell-main .right-rail {
  position: sticky;
  top: 0.75rem;
}

@media (min-width: 992px) {
  .pa-shell-main .right-rail {
    top: 5rem;
  }
}

/* News cards: subtle leading edge */
.feed-card.card-surface-soft {
  border-left: 3px solid rgba(71, 85, 105, 0.35);
  transition: border-color var(--pa-dur) var(--pa-ease);
}

.feed-card.card-surface-soft:has(.badge.bg-success) {
  border-left-color: rgba(52, 211, 153, 0.45);
}

.feed-card.card-surface-soft:has(.badge.bg-danger) {
  border-left-color: rgba(248, 113, 113, 0.45);
}

.feed-card.card-surface-soft:has(.badge.bg-secondary) {
  border-left-color: rgba(148, 163, 184, 0.35);
}

@media (max-width: 991.98px) {
  .pa-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateX(-102%);
    transition: transform var(--pa-dur) var(--pa-ease);
    box-shadow: 8px 0 36px rgba(0, 0, 0, 0.28);
  }

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

  .pa-sidebar--collapsed {
    flex-basis: var(--pa-sidebar-w);
    width: var(--pa-sidebar-w);
  }
}

@media (min-width: 992px) {
  .pa-sidebar-collapse {
    display: flex !important;
  }
}
