/* ---- Auth UI ---- */
.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s;
}
.auth-btn:hover { background: var(--surface2); }

/* ---- Demo banner ----
   A fixed pill floating just above the bottom edge, horizontally centered, on
   both mobile and desktop. Kept short (max-width) and out of normal flow so it
   never collides with the top-bar controls (hamburger / sign-in). z-index sits
   BELOW the feedback FAB (1100) so the FAB stays tappable when they overlap. */
.demo-banner {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: 520px;
  width: calc(100% - 32px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fffaf0 0%, #eef3fb 100%);
  border: 1px solid rgba(168, 125, 46, 0.28);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(24, 39, 75, 0.16), 0 2px 6px rgba(24, 39, 75, 0.08);
  padding: 12px 14px;
  font-size: 0.86rem;
  line-height: 1.3;
  color: #3a4a52;
  text-align: left;
  font-weight: 500;
}
/* Marketing badge — small gold pill on the left */
.demo-banner-badge {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #8a6416;
  background: linear-gradient(135deg, #ffe9b0 0%, #f6d488 100%);
  border-radius: 999px;
  padding: 4px 9px;
  text-transform: uppercase;
}
.demo-banner-text {
  flex: 1;
  min-width: 0;
}
/* CTA — a real Google-style button, not a text link */
.demo-banner-cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  color: #3a4a52 !important;
  font-weight: 600 !important;
  font-size: 0.82rem;
  text-decoration: none;
  border: 1px solid #dcdfe4;
  border-radius: 10px;
  padding: 8px 13px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.15s, transform 0.1s;
}
.demo-banner-cta:hover {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
  transform: translateY(-1px);
  text-decoration: none;
}

@keyframes flash-highlight {
  0% { box-shadow: inset 0 0 0 2px var(--accent); }
  100% { box-shadow: none; }
}

/* ---- Sidebar logo ---- */
.sidebar-logo {
  width: 155px;
  height: 155px;
}

/* ---- Sidebar footer (user profile) ---- */
.sidebar-footer {
  padding: 0 16px 20px;
}

.sidebar.collapsed .sidebar-footer {
  padding: 0 10px 20px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.sidebar-logout-btn {
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.sidebar-logout-btn:hover {
  background: var(--surface2);
  color: var(--red);
}

.sidebar-footer .auth-btn {
  width: 100%;
  text-align: center;
}

/* ---- Landing Page ---- */
/* display:block lets the tall marketing content flow as a normal block; the
   scroll itself is the base .main-wrapper safety-net scroller. */
.landing-body-bg {
  background: var(--bg);
  background-image: var(--app-bg-gradient);
  display: block;
}
.landing-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px 20px;
}
.landing {
  max-width: 680px;
  width: 100%;
  text-align: center;
}
.landing-hero {
  margin-bottom: 40px;
}
.landing-logo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  box-shadow: 0 4px 24px var(--accent-glow), 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 18px;
}
.landing-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.3;
  max-width: 600px;
  margin: 0 auto 12px;
  padding: 0 8px 4px;
  text-align: center;
  /* Override the global h1 { white-space: nowrap } — this hero title is a full
     sentence that must wrap on narrow screens, not run off the right edge. */
  white-space: normal;
  overflow-wrap: break-word;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: var(--accent); /* fallback if background-clip unsupported */
}
.landing-subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  font-weight: 400;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ---- Trust strip (security messaging) ---- */
.landing-trust {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 32px;
  text-align: left;
}
.landing-trust-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.landing-trust-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}
.landing-trust-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.landing-trust-text strong { font-size: 0.85rem; color: var(--text); }
.landing-trust-text span { font-size: 0.75rem; color: var(--muted); line-height: 1.4; }
.landing-trust-text code {
  font-size: 0.72rem;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
}

/* ---- Visual proof: sheet vs. app comparison ---- */
.landing-compare {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 40px;
}
.landing-compare-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 240px;
}
.landing-compare-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}
.landing-compare-caption {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}
.landing-compare-frame {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 280px;
  border-radius: 18px;
  border: 4px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  padding: 10px;
}
.landing-compare-arrow {
  flex: 0 0 auto;
  color: var(--accent);
  opacity: 0.7;
}
/* Mock "clunky spreadsheet" */
.landing-compare-frame--sheet { display: flex; flex-direction: column; gap: 6px; }
.mock-sheet-bar {
  height: 14px;
  border-radius: 4px;
  background: var(--surface2);
}
.mock-sheet-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr;
  grid-auto-rows: 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.mock-sheet-grid span {
  display: flex;
  align-items: center;
  padding: 0 4px;
  background: var(--surface);
  font-size: 0.5rem;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mock-sheet-grid .mock-sheet-head {
  background: var(--surface2);
  font-weight: 600;
  color: var(--text);
}
/* Mock "sleek app" */
.landing-compare-frame--app { display: flex; flex-direction: column; gap: 10px; }
.mock-app-metric {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.1);
}
.mock-app-metric b { font-size: 1.1rem; color: var(--accent); }
.mock-app-metric i { font-size: 0.62rem; color: var(--muted); font-style: normal; }
.mock-app-chart { flex: 1; }
.mock-app-chart svg { width: 100%; height: 100%; }
.mock-app-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 50px;
}
.mock-app-bars span {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: var(--accent-gradient);
}

.landing-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}
.landing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}
.landing-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.landing-card strong {
  font-size: 0.85rem;
  color: var(--text);
}
.landing-card span {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}
.landing-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.landing-card-icon--holdings { background: rgba(46, 125, 50, 0.1); color: var(--page-holdings); }
.landing-card-icon--chart { background: rgba(21, 101, 192, 0.1); color: var(--page-trades); }
.landing-card-icon--irr { background: rgba(var(--accent-rgb), 0.1); color: var(--accent); }
.landing-card-icon--sync { background: rgba(21, 101, 192, 0.1); color: var(--page-trades); }
.landing-card-icon--dip { background: rgba(198, 40, 40, 0.1); color: var(--page-dip-finder); }
.landing-card-icon--free { background: rgba(var(--accent-rgb), 0.1); color: var(--accent); }
[data-theme="dark"] .landing-card-icon--holdings { background: rgba(102, 187, 106, 0.12); }
[data-theme="dark"] .landing-card-icon--chart { background: rgba(100, 181, 246, 0.12); }
[data-theme="dark"] .landing-card-icon--irr { background: rgba(77, 175, 200, 0.12); }
[data-theme="dark"] .landing-card-icon--sync { background: rgba(100, 181, 246, 0.12); }
[data-theme="dark"] .landing-card-icon--dip { background: rgba(239, 83, 80, 0.12); }
[data-theme="dark"] .landing-card-icon--free { background: rgba(77, 175, 200, 0.12); }
.landing-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}
.landing-btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  padding: 12px 28px;
  border-radius: 10px;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--accent-gradient) border-box;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.landing-btn:hover {
  transform: translateY(-1px);
  background:
    linear-gradient(var(--surface2), var(--surface2)) padding-box,
    var(--accent-gradient-hover) border-box;
  box-shadow: 0 4px 14px var(--accent-glow);
}
/* Primary CTA (Demo) — filled gradient for instant time-to-value */
.landing-btn--primary {
  background: var(--accent-gradient);
  color: #fff;
}
.landing-btn--primary:hover {
  background: var(--accent-gradient-hover);
  color: #fff;
}
@media (max-width: 700px) {
  .landing-trust { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .landing-cards { grid-template-columns: repeat(2, 1fr); }
  .landing-compare { flex-direction: column; }
  /* Wider stacked phone-mockups so the section fills the column instead of
     leaving a lonely narrow strip centered with empty space either side. */
  .landing-compare-col { max-width: 280px; }
  .landing-compare-frame { max-height: 340px; }
  .landing-compare-arrow { transform: rotate(90deg); }
}

/* ---- Sign-in Prompt ---- */
.signin-prompt {
  position: fixed;
  top: 16px;
  right: 62px;
  z-index: 1200;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  animation: signin-slide-in 0.3s ease;
}

@keyframes signin-slide-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.signin-prompt-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.signin-prompt-header svg {
  flex-shrink: 0;
}

.signin-prompt-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}
.signin-prompt-close:hover {
  color: var(--text);
}

.signin-prompt-body {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.signin-prompt-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.signin-prompt-btn:hover {
  background: var(--surface2);
  box-shadow: var(--shadow-sm);
}

.signin-prompt-note {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

[data-theme="dark"] .signin-prompt {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ---- Top-right bar ---- */
.topbar-right {
  position: fixed;
  /* Vertically centered on the page title, and this is the SINGLE source of
     truth for that position — the auth JS no longer overrides `top` on login
     (that override collapsed the row to y≈17px, above the ~29px title center,
     which read as "sign-in sits too high"). The header is NOT fixed on desktop:
     it's the first element in the content column with padding-top:18px, so the
     h1's center sits ~29px from the viewport top. Letting this row collapse to
     its natural height (~34px, the theme toggle) and pinning top:12px centers
     the controls at ~29px too, so they line up with the title on every page and
     in every auth state. (A fixed height:56px + vertical padding pushed the
     centered buttons to ~40px — visibly below the title.) */
  top: 12px;
  right: 12px;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  background: transparent;
}

/* ---- Theme Toggle ---- */
.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s, border-color 0.2s;
}
.theme-toggle:hover {
  background: var(--surface2);
  border-color: var(--accent);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: color 0.2s;
}
.theme-toggle:hover svg {
  color: var(--accent);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-user-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  padding: 2px 4px;
  transition: background 0.2s;
}
.topbar-user-link:hover {
  background: var(--surface2);
}

/* ---- Profile page ---- */
.profile-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 20px;
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}
.profile-details dt {
  color: var(--muted);
  font-weight: 500;
}
.profile-details dd {
  margin: 0;
  color: var(--text);
}
.profile-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 1rem;
  line-height: 1.55;
}
.profile-note a { color: var(--accent); }
.profile-danger {
  border-color: var(--red);
}
.profile-status {
  margin-left: 12px;
  font-size: 0.85rem;
}

/* ---- Dark-mode overrides for hardcoded-color elements ---- */
[data-theme="dark"] .demo-banner {
  background: linear-gradient(135deg, #232a24 0%, #1a2332 100%);
  border-color: rgba(246, 212, 136, 0.22);
  color: var(--text);
}
[data-theme="dark"] .demo-banner-badge {
  color: #2a2010;
  background: linear-gradient(135deg, #f6d488 0%, #e6bf6a 100%);
}
[data-theme="dark"] .demo-banner-cta {
  background: var(--surface2);
  color: var(--text) !important;
  border-color: var(--border);
}

/* ---- Feedback FAB ---- */
.feedback-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.feedback-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.feedback-modal-content {
  max-width: 560px;
  width: 92%;
  position: relative;
  padding: 2rem;
}

.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.feedback-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.modal-close:hover {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}

.feedback-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s;
}
.feedback-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.feedback-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.feedback-status {
  font-size: 0.8rem;
  color: var(--muted);
}
