@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-rgb: 14, 165, 233;
    --secondary-rgb: 34, 211, 238;
    
    --bg-main: #04101e;
    --bg-card: rgba(8, 28, 52, 0.78);
    --border-card: rgba(var(--primary-rgb), 0.12);
    --text-primary: #f0f9ff;
    --text-secondary: #94a3b8;
    --primary: rgb(var(--primary-rgb));
    --primary-dark: #0284c7;
    --primary-glow: rgba(var(--primary-rgb), 0.4);
    --secondary: rgb(var(--secondary-rgb));
    --secondary-glow: rgba(var(--secondary-rgb), 0.4);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    --warning: #f59e0b;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-smooth: background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;

    /* Input Variables */
    --input-bg: rgba(var(--primary-rgb), 0.04);
    --input-bg-focus: rgba(var(--primary-rgb), 0.08);
    --input-border: rgba(var(--primary-rgb), 0.15);
    --input-autofill-bg: #071727;
    --input-autofill-bg-focus: #0c2035;
}

.light-theme {
    --primary-rgb: 2, 132, 199;
    --secondary-rgb: 8, 145, 178;
    --bg-grad-1-rgb: 241, 245, 249;
    --bg-grad-2-rgb: 248, 250, 252;
    --bg-grad-3-rgb: 241, 245, 249;
    --bg-grad-4-rgb: 248, 250, 252;
    --bg-grad-linear-1: #f1f5f9;
    --bg-grad-linear-2: #f8fafc;
    --bg-grad-linear-3: #ffffff;
    
    --bg-main: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.75);
    --border-card: rgba(var(--primary-rgb), 0.14);
    --text-primary: #0c1a2e;
    --text-secondary: #475569;
    --primary: rgb(var(--primary-rgb));
    --primary-dark: #0369a1;
    --primary-glow: rgba(var(--primary-rgb), 0.18);
    --secondary: rgb(var(--secondary-rgb));
    --secondary-glow: rgba(var(--secondary-rgb), 0.18);
    --success: #059669;
    --success-glow: rgba(5, 150, 105, 0.1);
    --danger: #dc2626;
    --danger-glow: rgba(220, 38, 38, 0.1);
    --warning: #d97706;
    
    /* Input Variables */
    --input-bg: rgba(var(--primary-rgb), 0.08);
    --input-bg-focus: rgba(var(--primary-rgb), 0.15);
    --input-border: rgba(var(--primary-rgb), 0.2);
    --input-autofill-bg: #f0f7fc;
    --input-autofill-bg-focus: #e1f0fa;
}

/* Disable transitions temporarily during theme changes to prevent flicker/stutter */
.disable-transitions,
.disable-transitions * {
    transition: none !important;
}

/* Temporarily suspend transitions while the browser is actively resizing */
.is-resizing,
.is-resizing * {
    transition: none !important;
}

body.is-resizing {
    background-attachment: scroll;
}

body.is-resizing *,
body.is-resizing *::before,
body.is-resizing *::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* ============================================================
   CHROME COMPOSITOR / RENDERING FIXES
   Chrome (Blink) differs from Safari (WebKit) in how it handles:
   - backdrop-filter on layers without explicit will-change
   - opacity transitions that stall on background-tab return
   - fadeIn animations re-firing when tabs regain focus
   ============================================================ */

/* Promote background gradient to its own GPU layer so Chrome doesn't
   repaint it on every tab-return or scroll event. */
body::before {
    will-change: opacity;
    transform: translateZ(0);
}

/* Glass cards: Chrome needs an explicit stacking context to avoid
   backdrop-filter repaints bleeding into sibling composited layers. */
.glass-card {
    transform: translateZ(0);
    isolation: isolate;
}

/* Prevent Chrome from re-running fadeIn when switching back to a tab.
   Instead of animation:forwards on the base class, we play it once via
   a short-lived class so subsequent renders just see a static opacity:1. */
.glass-card {
    animation-fill-mode: both;
    animation-play-state: running;
}

/* Remove the repeating body-level transition — Chrome applies it on
   every repaint cycle including visibility-change repaint, causing a
   momentary flash. Use the more targeted version below instead. */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dashboard content: tell Chrome to keep the composited layer alive
   between tab switches so fields don't need to rasterize from scratch. */
#dashboard-view-content {
    will-change: opacity;
    transform: translateZ(0);
    contain: layout style;
}

/* Modal overlay: Chrome drops the backdrop-filter GPU layer when
   pointer-events:none is set; force it to stay composited. */
.modal-overlay {
    transform: translateZ(0);
    will-change: opacity;
}

/* Portfolio toolbar: Chrome re-runs its fadeIn on every hash change.
   Keep it as a simple opacity:1 static layer after first paint. */
.dash-portfolio-toolbar {
    animation: none;
    opacity: 1;
}

/* Metric cards: the ::after pseudo-element with a large radial gradient
   forces Chrome to repaint the entire card on scroll. Reduce its cost. */
.metric-card::after {
    will-change: unset;
    pointer-events: none;
    contain: strict;
}

/* Nav items: avoid Chrome running --transition-smooth (which includes
   opacity, transform, box-shadow) on every mouse-leave during scroll. */
.dash-nav-item {
    transition: color 0.2s ease, border-color 0.2s ease;
}

/* Home page cards: don't re-composite on every visibility change */
.home-hero,
.home-side-card {
    transform: translateZ(0);
    isolation: isolate;
}

/* Buttons: Chrome can stutter on filter:brightness hover when the parent
   has backdrop-filter. Use opacity instead for Chrome. */
.btn-primary:hover {
    filter: none;
    opacity: 0.92;
}

/* Skeleton shimmer: use transform instead of background-position for
   Chrome GPU acceleration (background-position forces software raster). */
@keyframes skeleton-shimmer-chrome {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skeleton-row td {
    overflow: hidden;
    position: relative;
    background: rgba(var(--primary-rgb), 0.07) !important;
}

.skeleton-row td::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(var(--primary-rgb), 0.12) 50%,
        transparent 100%
    );
    animation: skeleton-shimmer-chrome 1.4s infinite;
    will-change: transform;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans, sans-serif);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image:
        radial-gradient(ellipse at 0% 0%, rgba(var(--primary-rgb), 0.20) 0px, transparent 55%),
        radial-gradient(ellipse at 100% 0%, rgba(var(--secondary-rgb), 0.12) 0px, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(var(--primary-rgb), 0.15) 0px, transparent 55%),
        radial-gradient(ellipse at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
    /* Chrome: promote to its own GPU layer so it never repaints on scroll/tab-switch */
    will-change: opacity;
    transform: translateZ(0);
    pointer-events: none;
}

body.light-theme::before {
    background-image:
        radial-gradient(ellipse at 0% 0%, rgba(var(--primary-rgb), 0.08) 0%, transparent 55%),
        radial-gradient(ellipse at 100% 0%, rgba(var(--secondary-rgb), 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(var(--primary-rgb), 0.06) 0%, transparent 55%),
        linear-gradient(135deg, var(--bg-grad-linear-1) 0%, var(--bg-grad-linear-2) 40%, var(--bg-grad-linear-3) 70%, var(--bg-main) 100%);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 15px var(--primary-glow); }
    50% { box-shadow: 0 0 25px rgba(var(--primary-rgb), 0.6); }
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Auth Pages Container */
.auth-wrapper {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* Glassmorphism Card */
.glass-card {
    background: var(--bg-card);
    /* Reduced blur radius from 16px to 10px: halves Chrome compositor cost
       with no visible quality difference at these card sizes */
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    border: 1px solid var(--border-card);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    /* animation-fill-mode:both + isolation already set above by the Chrome
       fixes block; keep opacity:1 as default so tab-return doesn't blink */
    opacity: 1;
    width: 100%;
}

/* Only animate on first appearance (inside .view-section.active the first
   time it becomes visible). Chrome won't re-run this because animation-name
   is removed once the section is already painted. */
.view-section.active .glass-card {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-card {
    max-width: 480px;
    padding: 40px;
}

.auth-wrapper.home-mode {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
}

.auth-wrapper.home-mode .auth-card {
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-width: none;
    min-height: 100vh;
    padding: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
}

.auth-wrapper.home-mode .brand-logo-container,
.auth-wrapper.home-mode .brand-title,
.auth-wrapper.home-mode .brand-subtitle,
.auth-wrapper.home-mode #global-status {
    display: none;
}

.home-shell {
    max-width: 1600px;
    margin: 0 auto;
    padding: 30px 32px 24px;
}

.home-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
    gap: 16px;
}

.home-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.home-brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border-card);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.home-brand-name {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.home-topbar-actions {
    display: flex;
    gap: 10px;
}

.home-topbar-actions .btn {
    width: auto;
    min-width: 110px;
    padding: 10px 16px;
    font-size: 0.86rem;
}

.home-topbar-actions .home-signin-btn {
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    color: var(--primary);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    box-shadow: none;
}

.home-topbar-actions .home-signin-btn:hover {
    background: rgba(var(--primary-rgb), 0.2);
    transform: none;
    box-shadow: none;
    filter: none;
}

.home-topbar-actions .home-signin-btn:active {
    background: rgba(var(--primary-rgb), 0.25);
}

.home-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(330px, 1fr);
    gap: 22px;
    align-items: start;
}

.home-main-left,
.home-main-right {
    display: grid;
    gap: 18px;
}

.home-hero {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
    border: 1px solid var(--border-card);
    border-radius: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
}

.home-badge {
    width: fit-content;
    background: rgba(var(--primary-rgb), 0.14);
    border: 1px solid rgba(var(--primary-rgb), 0.28);
    border-radius: 999px;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 6px 12px;
    text-transform: uppercase;
}

.home-title {
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.home-lead {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
}

.home-desc {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.7;
    margin-top: 10px;
}

.home-dashboard-preview {
    margin-top: 2px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    /* Prevent layout shift by maintaining aspect ratio */
    aspect-ratio: 16 / 9;
    background: rgba(255, 255, 255, 0.02);
}

.home-dashboard-img {
    width: 100%;
    display: block;
    border-radius: 12px;
    transition: opacity 0.4s ease-in-out;
}

.home-snapshot-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.home-stat-card {
    padding: 18px;
}

.home-graph-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.home-graph-card {
    padding: 20px;
}

.home-card-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
}

.home-main-right .home-side-card {
    padding: 20px;
}

#home-allocation-bars {
    display: grid;
    gap: 10px;
}

.home-allocation-row {
    display: grid;
    gap: 6px;
}

.home-allocation-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.home-allocation-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.home-allocation-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.home-momentum-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    min-height: 160px;
    padding-top: 18px;
}

.home-momentum-bar {
    flex: 1;
    border-radius: 10px 10px 4px 4px;
    background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.9) 0%, rgba(var(--primary-rgb), 0.3) 100%);
    min-height: 18px;
    position: relative;
}

.home-momentum-bar span {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.home-search-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.home-inline-error {
    color: var(--danger);
    font-size: 0.82rem;
    display: none;
    margin-top: 10px;
}

.home-search-result {
    margin-top: 14px;
    border: 1px solid var(--border-card);
    border-radius: 14px;
    padding: 14px;
    background: rgba(var(--primary-rgb), 0.05);
}

.home-search-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.home-search-ticker,
.home-search-price {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.home-search-price {
    color: var(--primary);
}

.home-search-meta {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.home-search-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.home-recent-searches {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.home-recent-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
}

.home-news-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.home-news-updated {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.home-news-feed {
    display: grid;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 6px;
}

.home-news-card {
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
}

.home-news-card-title {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.45;
    margin: 6px 0;
}

.home-news-card-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auth-card.auth-card-wide {
    max-width: 820px;
}

/* Header & Typography */
.brand-title {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-align: center;
    margin-bottom: 8px;
}

.brand-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    text-align: center;
    margin-bottom: 32px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-control {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans, sans-serif);
    font-size: 0.95rem;
    padding: 14px 16px;
    outline: none;
    transition: var(--transition-smooth);
    width: 100%;
}

.input-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: var(--input-bg-focus);
}

/* Autofill Style Override */
.input-control:-webkit-autofill,
.input-control:-webkit-autofill:hover, 
.input-control:-webkit-autofill:focus, 
.input-control:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--input-autofill-bg) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.input-control:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--input-autofill-bg-focus) inset !important;
    border-color: var(--primary) !important;
}

/* Buttons */
.btn {
    align-items: center;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    font-family: var(--font-sans, sans-serif);
    font-size: 0.95rem;
    font-weight: 600;
    justify-content: center;
    padding: 14px 24px;
    transition: var(--transition-smooth);
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
    filter: brightness(1.1);
}

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

.btn-google {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--input-border);
}

.btn-google:hover {
    background: var(--input-bg-focus);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-google svg {
    margin-right: 10px;
    width: 18px;
    height: 18px;
}

.google-btn-wrapper {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-outline {
    background: rgba(var(--primary-rgb), 0.06);
    border: 1px solid rgba(var(--primary-rgb), 0.5);
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.15);
    transition: var(--transition-smooth);
}

.btn-outline:hover {
    background: rgba(var(--primary-rgb), 0.15);
    border-color: var(--secondary);
    color: var(--text-primary);
    box-shadow: 0 4px 15px var(--primary-glow);
    transform: translateY(-2px);
}

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

.btn-outline:disabled,
.btn-outline[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    box-shadow: none;
}

.btn-action-small {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid var(--border-card);
}

.btn-action-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

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

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

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px var(--danger-glow);
}

/* Divider */
.divider {
    align-items: center;
    color: var(--text-secondary);
    display: flex;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 24px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-card);
}

.divider::before { margin-right: 16px; }
.divider::after { margin-left: 16px; }

/* Links */
.auth-links {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.auth-link {
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.auth-link:hover {
    color: var(--secondary);
    text-decoration: underline;
}

.info-page-view {
    width: 100%;
}

/* When info pages are rendered inside the dashboard layout (logged-in user) */
#dashboard-view-content .info-page-view {
    max-width: 820px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 36px 40px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.info-page-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-page-intro {
    margin-bottom: 0;
    text-align: left;
}

.info-page-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-page-section h3 {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
}

.info-page-section p,
.info-page-list {
    color: var(--text-secondary);
    font-size: 0.94rem;
    line-height: 1.7;
}

.info-page-list {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.site-links-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-card);
}

.auth-wrapper.home-mode .site-links-footer {
    max-width: 1600px;
    margin: 10px auto 24px;
    padding: 18px 32px 0;
}

.dashboard-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--border-card);
}

.dashboard-footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
}

.search-insight-title {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.search-peer-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-peer-chip {
    background: rgba(var(--primary-rgb), 0.12);
    border: 1px solid rgba(var(--primary-rgb), 0.22);
    border-radius: 999px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-sans, sans-serif);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 12px;
    transition: var(--transition-smooth);
}

.search-peer-chip:hover {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: var(--primary);
    color: var(--primary);
}

.search-recommendations-list {
    display: grid;
    gap: 10px;
}

.search-dividends-list {
    display: grid;
    gap: 10px;
}

.search-recommendation-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
}

.search-recommendation-legend .rec-pill {
    font-size: 0.66rem;
    padding: 3px 7px;
}

.search-insight-empty {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-card);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.5;
    padding: 12px 14px;
}

.search-recommendation-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 12px 14px;
}

.search-dividend-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 12px 14px;
}

.search-dividend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.search-dividend-date {
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 700;
}

.search-dividend-amount {
    color: var(--success);
    font-size: 0.82rem;
    font-weight: 700;
}

.search-dividend-meta {
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.74rem;
    line-height: 1.4;
}

.search-data-source {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.22);
    border-radius: 12px;
    color: var(--warning);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.3;
    padding: 4px 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-block;
    width: fit-content;
    align-self: flex-end;
}

.search-price-source {
    margin-top: 0;
}

.search-dividend-source {
    margin-top: 10px;
}

.search-recommendation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.search-recommendation-period {
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 700;
}

.search-recommendation-summary {
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
}

.search-recommendation-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rec-pill {
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 8px;
}

.rec-pill.strong-buy,
.rec-pill.buy {
    background: rgba(16, 185, 129, 0.14);
    color: var(--success);
}

.rec-pill.hold {
    background: rgba(245, 158, 11, 0.14);
    color: var(--warning);
}

.rec-pill.sell,
.rec-pill.strong-sell {
    background: rgba(239, 68, 68, 0.14);
    color: var(--danger);
}

.text-center {
    text-align: center;
}

.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.status-message {
    border-radius: 12px;
    font-size: 0.9rem;
    padding: 12px 16px;
    margin-bottom: 24px;
    display: none;
    line-height: 1.4;
}

.status-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success);
    color: #34d399;
    display: block;
}

.status-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    color: #f87171;
    display: block;
}

/* Dashboard Layout */
.dashboard-wrapper {
    max-width: 1600px;
    margin: 0 auto;
    padding: 40px 32px;
}

/* Header */
.dash-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
}

.header-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 32px;
}

.user-profile {
    align-items: center;
    display: flex;
    gap: 12px;
}

.avatar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    height: 48px;
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-info .name {
    font-size: 1.1rem;
    font-weight: 600;
}

.user-info .account {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.btn-ticker-search-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(var(--primary-rgb), 0.10);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    color: var(--primary);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: var(--font-sans, sans-serif);
}

.btn-ticker-search-toggle:hover {
    background: rgba(var(--primary-rgb), 0.20);
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.2);
}

.btn-logout {

    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

.btn-display-mode {
    background: rgba(var(--primary-rgb), 0.12);
    border: 1px solid rgba(var(--primary-rgb), 0.32);
    color: var(--text-primary);
    font-weight: 700;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-display-mode:hover {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.btn-currency-select {
    background: rgba(var(--primary-rgb), 0.12);
    border: 1px solid rgba(var(--primary-rgb), 0.32);
    color: var(--text-primary);
    font-weight: 700;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    cursor: pointer;
    outline: none;
    transition: var(--transition-smooth);
    margin-right: 8px;
}

.btn-currency-select:hover {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.btn-currency-select option,
#profile-currency-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.metric-card {
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 80%);
    pointer-events: none;
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.metric-subtext {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 4px;
}

.metric-change {
    align-items: center;
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: 600;
    gap: 4px;
    border-radius: 6px;
    padding: 2px 8px;
}

.metric-change.positive {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.metric-change.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Charts / Content Section */
/* Navigation Tabs */
.dash-nav {
    display: flex;
    align-items: center;
    margin-left: 0;
}

.dash-nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

/* Portfolio Toolbar Styling */
.dash-portfolio-toolbar {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 12px 24px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.4s ease-out;
}

.portfolio-switcher-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portfolio-switcher-container select {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: var(--transition-smooth);
    width: 220px;
}

.portfolio-switcher-container select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.light-theme .portfolio-switcher-container select {
    background: rgba(var(--primary-rgb), 0.06);
    border-color: rgba(var(--primary-rgb), 0.2);
    color: var(--text-primary);
}

.light-theme .portfolio-switcher-container select option {
    background: #e2f1fc;
    color: var(--text-primary);
}

.light-theme .dash-portfolio-toolbar {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(var(--primary-rgb), 0.14);
}

.portfolio-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portfolio-actions .btn-action-small {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.portfolio-actions .btn-create {
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    color: var(--primary);
}

.portfolio-actions .btn-create:hover {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: var(--primary);
}

.portfolio-actions .btn-rename {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
}

.portfolio-actions .btn-rename:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.portfolio-actions .btn-delete {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.portfolio-actions .btn-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

.switcher-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.dash-nav-item {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    padding: 8px 0;
    transition: var(--transition-smooth);
}

.dash-nav-item:hover {
    color: var(--text-primary);
}

.dash-nav-item.active {
    color: var(--primary);
}

.dash-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--primary-glow);
}

/* Responsive Content Grid for Charts */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    margin-bottom: 40px;
}

@media(min-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media(max-width: 1199px) and (min-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr 1fr;
    }
    .content-grid .chart-card:first-child {
        grid-column: span 2;
    }
}

/* Horizontal Bar Charts (Gainers / Losers) */
.bar-chart-row {
    margin-bottom: 16px;
}
.bar-chart-row:last-child {
    margin-bottom: 0;
}


.chart-card {
    padding: 24px;
}

.card-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* SVG Chart */
.chart-container {
    height: 250px;
    width: 100%;
    position: relative;
}

/* Donut Chart Layout */
.donut-chart-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 24px;
    width: 100%;
    min-height: 240px;
}

.donut-chart-wrapper {
    position: relative;
    width: 240px;
    height: 240px;
    flex-shrink: 0;
}

#weight-chart-svg, #sector-chart-svg {
    transform: rotate(-90deg);
    border-radius: 50%;
    flex-shrink: 0;
    width: 100%;
    height: 100%;
}

#donut-chart-center, #sector-chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
    width: 150px;
    height: 150px;
    border-radius: 50%;
}

#donut-center-label, #sector-center-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

#donut-center-value, #sector-center-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
}

#chart-legend, #sector-chart-legend {
    flex: 1 1 200px;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 8px;
    font-size: 0.85rem;
}

#chart-legend::-webkit-scrollbar, #sector-chart-legend::-webkit-scrollbar {
    width: 4px;
}
#chart-legend::-webkit-scrollbar-track, #sector-chart-legend::-webkit-scrollbar-track {
    background: transparent;
}
#chart-legend::-webkit-scrollbar-thumb, #sector-chart-legend::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.2);
    border-radius: 2px;
}
#chart-legend::-webkit-scrollbar-thumb:hover, #sector-chart-legend::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), 0.4);
}

.chart-svg {
    height: 100%;
    width: 100%;
}

.chart-grid-line {
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 1;
}

.chart-line {
    fill: none;
    stroke: url(#chart-gradient);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: drawLine 2s ease-out forwards;
}

.chart-area {
    fill: url(#area-gradient);
}

/* Holdings Section */
.holdings-card {
    padding: 28px;
    background: #081c34 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.light-theme .holdings-card {
    background: rgba(var(--primary-rgb), 0.04) !important;
}

/* ── Light-theme table overrides ── */

/* holdings-table - base td/th */
.light-theme .holdings-table td {
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.10);
    color: var(--text-primary);
}

.light-theme .holdings-table th {
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.18);
}

/* row hover */
.light-theme .holdings-table tr:hover td {
    background: rgba(var(--primary-rgb), 0.05);
}

/* ticker group rows */
.light-theme .holdings-table tr.ticker-group-row td {
    background: rgba(var(--primary-rgb), 0.06);
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.14);
}

.light-theme .holdings-table tr.ticker-group-row:hover td {
    background: rgba(var(--primary-rgb), 0.10);
}

/* child breakdown rows */
.light-theme .holdings-table tr.ticker-child-row td {
    background: rgba(var(--primary-rgb), 0.02);
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.07);
}

.light-theme .holdings-table tr.ticker-child-row:hover td {
    background: rgba(var(--primary-rgb), 0.06);
}

.light-theme .holdings-table tr.ticker-child-row:last-child td {
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.16);
}

/* option child rows */
.light-theme .holdings-table tr.option-child-row td {
    background: rgba(var(--primary-rgb), 0.02);
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.07);
}

.light-theme .holdings-table tr.option-child-row:hover td {
    background: rgba(var(--primary-rgb), 0.06);
}

/* csv-preview-table */
.light-theme .csv-preview-table th,
.light-theme .csv-preview-table td {
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.10);
    color: var(--text-primary);
}

.light-theme .csv-preview-table th {
    background: rgba(var(--primary-rgb), 0.08);
}

.light-theme .csv-preview-table tr:hover td {
    background: rgba(var(--primary-rgb), 0.04);
}

/* bar chart track (Top Gainers / Losers) */
.light-theme .bar-chart-row .bar-track {
    background: rgba(var(--primary-rgb), 0.08) !important;
}

/* ── Light-theme global element overrides ── */

/* Scrollbar thumb */
.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.2);
}

/* Secondary / Rename buttons */
.light-theme .btn-secondary {
    background: rgba(var(--primary-rgb), 0.06);
    border-color: rgba(var(--primary-rgb), 0.18);
    color: var(--text-primary);
}
.light-theme .btn-secondary:hover {
    background: rgba(var(--primary-rgb), 0.12);
}

.light-theme .portfolio-actions .btn-rename {
    background: rgba(var(--primary-rgb), 0.05);
    border-color: rgba(var(--primary-rgb), 0.16);
    color: var(--text-secondary);
}
.light-theme .portfolio-actions .btn-rename:hover {
    background: rgba(var(--primary-rgb), 0.10);
    color: var(--text-primary);
}

/* Allocation bar track (home page) */
.light-theme .home-allocation-track {
    background: rgba(var(--primary-rgb), 0.10);
}

/* Recent ticker chips (home page) */
.light-theme .home-recent-chip {
    background: rgba(var(--primary-rgb), 0.06);
}

/* News cards (home page) */
.light-theme .home-news-card {
    background: rgba(var(--primary-rgb), 0.04);
}

/* Search insight / recommendation / dividend cards */
.light-theme .search-insight-empty,
.light-theme .search-recommendation-card,
.light-theme .search-dividend-card {
    background: rgba(var(--primary-rgb), 0.04);
}

/* Home dashboard image placeholder */
.light-theme .home-dashboard-img-wrapper {
    background: rgba(var(--primary-rgb), 0.04);
}

#trading-subview-detail .trading-detail-card {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}


.table-responsive {
    overflow-x: auto;
    width: 100%;
}

/* Keep Options table area stable while rerendering rows */
.options-table-shell {
    min-height: 480px;
}

@media (max-width: 768px) {
    .options-table-shell {
        min-height: 360px;
    }
}

.holdings-table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
}

.holdings-table tr {
    height: auto;
}

.holdings-table th {
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.15);
    min-height: 44px;
    display: table-cell;
    vertical-align: middle;
}

.holdings-table td {
    padding: 20px;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    min-height: 48px;
    display: table-cell;
    vertical-align: middle;
}

/* Compact table variant for wide multi-column tables (e.g. Options Trading) */
.holdings-table-compact th {
    padding: 10px 12px;
    font-size: 0.72rem;
    min-height: 40px;
    display: table-cell;
    vertical-align: middle;
}

.holdings-table-compact td {
    padding: 10px 12px;
    font-size: 0.85rem;
    min-height: 40px;
    display: table-cell;
    vertical-align: middle;
}

.holdings-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Grouped ticker summary row */
.holdings-table tr.ticker-group-row {
    cursor: pointer;
}
.holdings-table tr.ticker-group-row td {
    background: rgba(var(--primary-rgb), 0.04);
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.12);
}
.holdings-table tr.ticker-group-row:hover td {
    background: rgba(var(--primary-rgb), 0.09);
}
.ticker-expand-chevron {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.22s ease;
    vertical-align: middle;
}
.ticker-expand-chevron.open {
    transform: rotate(90deg);
    color: var(--primary);
}
.ticker-multi-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(var(--primary-rgb), 0.18);
    color: var(--secondary);
    border-radius: 10px;
    padding: 2px 7px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.3px;
}

/* Child portfolio breakdown rows */
.holdings-table tr.ticker-child-row td {
    background: rgba(255, 255, 255, 0.015);
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.025);
}
.holdings-table tr.ticker-child-row:last-child td {
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.15);
}
.holdings-table tr.ticker-child-row:hover td {
    background: rgba(255, 255, 255, 0.03);
}
.child-portfolio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 28px;
}
.child-portfolio-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    opacity: 0.6;
}
.child-portfolio-name {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Option sub-rows */
.holdings-table tr.option-child-row td {
    background: rgba(var(--primary-rgb), 0.03);
    padding-top: 10px;
    padding-bottom: 10px;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.08);
    border-left: none;
}
.holdings-table tr.option-child-row:hover td {
    background: rgba(var(--primary-rgb), 0.07);
}
.holdings-table tr.option-child-row:last-child td {
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.18);
}

/* CALL / PUT option type badge */
.option-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    border-radius: 5px;
    padding: 2px 7px;
    letter-spacing: 0.5px;
    vertical-align: middle;
    text-transform: uppercase;
}
.option-badge.call {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.option-badge.put {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.holding-ticker {
    font-weight: 700;
    color: var(--text-primary);
}

.holding-logo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(var(--primary-rgb), 0.10);
    border: 1px solid rgba(var(--primary-rgb), 0.16);
    flex-shrink: 0;
}

.holding-logo.small {
    width: 18px;
    height: 18px;
}

.holding-logo-img,
.holding-logo-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.holding-logo-img {
    object-fit: cover;
    background: #ffffff;
}

.holding-logo-fallback {
    color: var(--text-primary);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.holding-logo.small .holding-logo-fallback {
    font-size: 0.54rem;
}

.holding-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.holding-price {
    font-weight: 500;
}

.badge-trend {
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    padding: 4px 8px;
    display: inline-block;
}

.badge-trend.up {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-trend.down {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.table-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    display: inline-flex;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.btn-icon-edit:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

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

/* Modals */
.modal-overlay {
    align-items: center;
    background: rgba(0, 0, 0, 0.82);
    /* Chrome: skip backdrop-filter on modal overlay — it causes heavy
       re-compositing when opacity transitions. Use a solid bg tint instead. */
    display: flex;
    height: 100%;
    justify-content: center;
    left: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    top: 0;
    transition: opacity 0.22s ease;
    width: 100%;
    z-index: 1000;
    transform: translateZ(0);
    will-change: opacity;
}

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

.modal-card {
    max-width: 500px;
    padding: 32px;
    transform: translateY(20px);
    transition: var(--transition-smooth);
    background: var(--bg-main) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

.modal-actions .btn {
    width: auto;
}

/* Session Widget */
.session-widget {
    position: static;
    padding: 0;
    border-top: none;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

.session-widget-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.session-widget-inline {
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
}

.session-widget-link {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-family: var(--font-sans, sans-serif);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0;
    text-align: left;
    width: fit-content;
}

.session-widget-link:hover {
    color: var(--secondary);
    text-decoration: underline;
}

.mobile-nav-wrapper {
    display: none !important;
}

/* Responsive */
@media(max-width: 1024px) {
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media(max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .metrics-grid .metric-card:first-child {
        grid-column: span 1;
    }
    .metric-value {
        font-size: 1.8rem;
    }
    .donut-chart-container {
        flex-direction: column;
        gap: 24px;
        align-items: center;
    }
    #chart-legend {
        margin-left: 0;
        max-height: none;
        overflow-y: visible;
        width: 100%;
        padding-right: 0;
    }
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .dash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .header-left {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }
    .dash-nav {
        margin-left: auto !important;
        width: auto !important;
        display: flex !important;
        align-items: center !important;
    }
    .dash-nav-links {
        display: none !important;
    }
    .mobile-nav-dropdown {
        display: block !important;
    }
    .mobile-nav-wrapper {
        display: flex !important;
        align-items: center;
        gap: 8px;
    }
    .dash-portfolio-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 16px;
        margin-bottom: 24px;
    }
    .portfolio-switcher-container {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }
    .portfolio-switcher-container select {
        width: 100%;
    }
    .portfolio-actions {
        width: 100%;
        display: flex;
        gap: 8px;
        justify-content: space-between;
    }
    .portfolio-actions .btn-action-small {
        flex: 1;
        text-align: center;
    }
    .dash-logo {
        height: 32px;
        width: 32px;
    }
    .header-right {
        display: none !important;
    }
    .user-profile {
        min-width: 0;
        flex: 1;
    }
    .user-info {
        min-width: 0;
    }
    .user-info .name {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .user-info .account {
        font-size: 0.75rem;
    }
    .btn-logout {
        width: auto;
        white-space: nowrap;
        flex-shrink: 0;
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    .auth-card {
        padding: 24px;
    }
    .auth-wrapper.home-mode .auth-card {
        padding: 0;
    }
    .home-shell {
        padding: 20px 14px;
    }
    .home-topbar {
        flex-wrap: wrap;
    }
    .home-topbar-actions {
        width: 100%;
    }
    .home-topbar-actions .btn {
        flex: 1;
    }
    .home-main-grid,
    .home-graph-grid,
    .home-snapshot-grid {
        grid-template-columns: 1fr;
    }
    .home-title {
        font-size: 1.45rem;
    }
    .home-search-form {
        flex-wrap: wrap;
    }
    .home-search-form .btn {
        width: 100% !important;
    }
    .home-title {
        font-size: 1.4rem;
    }
    .site-links-footer,
    .dashboard-footer-links {
        justify-content: center;
        gap: 12px 16px;
    }
    .dashboard-footer-row {
        flex-direction: column;
        align-items: center;
    }
    .session-widget {
        width: 100%;
        justify-content: center;
    }
    .session-widget-inline {
        margin-left: 0;
        white-space: normal;
        justify-content: center;
        text-align: center;
        flex-wrap: wrap;
    }
    .info-page-section p,
    .info-page-list {
        font-size: 0.9rem;
    }

    /* Responsive Card Headers & Buttons wrapping */
    .card-header-actions {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
        margin-bottom: 20px !important;
    }
    .card-header-actions > div {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100% !important;
    }
    #prices-last-updated {
        width: 100% !important;
        flex: 1 1 100% !important;
        margin-bottom: 4px !important;
    }
    .card-header-actions > div button,
    .card-header-actions > div select {
        flex: 1 1 calc(50% - 8px) !important;
        min-width: 120px !important;
        justify-content: center !important;
    }
    .holdings-card, .glass-card {
        padding: 16px !important;
    }
    .search-news-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

}

/* Hidden views */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

/* ===== PAGE TRANSITION: fade-in when content is ready ===== */
#dashboard-view-content {
    /* Chrome: explicit compositing so tab-return doesn't re-rasterize */
    transform: translateZ(0);
    will-change: opacity;
    contain: layout style;
    /* Keep transition short and only on opacity — not 'all' */
    transition: opacity 0.12s ease;
}

#dashboard-view-content.page-loading {
    opacity: 1;
    pointer-events: auto;
}

/* Skeleton shimmer rows shown while data loads */
.skeleton-row td {
    background: linear-gradient(90deg,
        rgba(var(--primary-rgb), 0.06) 25%,
        rgba(var(--primary-rgb), 0.12) 50%,
        rgba(var(--primary-rgb), 0.06) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    color: transparent !important;
    border-radius: 4px;
    user-select: none;
}

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

/* ================= UNIVERSAL THEME TOGGLE STYLING ================= */
.theme-toggle-container {
    position: fixed;
    bottom: 80px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.btn-theme-toggle {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-card);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    width: 48px;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.2);
}

.btn-theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.btn-theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

.profile-accent-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 260px;
}

.profile-accent-swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-accent-swatch {
    border: 2px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    height: 28px;
    outline: none;
    position: relative;
    transition: var(--transition-smooth);
    width: 28px;
}

.profile-accent-swatch::after {
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 999px;
    content: "";
    inset: 4px;
    position: absolute;
}

.profile-accent-swatch.theme-default { background: #0ea5e9; }
.profile-accent-swatch.theme-purple { background: #8b5cf6; }
.profile-accent-swatch.theme-emerald { background: #10b981; }
.profile-accent-swatch.theme-amber { background: #f59e0b; }
.profile-accent-swatch.theme-rose { background: #f43f5e; }

.profile-accent-swatch:hover,
.profile-accent-swatch:focus-visible {
    transform: translateY(-1px);
}

.profile-accent-swatch.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* ================= ACCENT COLOR THEME OVERRIDES ================= */
/* Emerald Theme */
body.theme-emerald {
    --primary-rgb: 16, 185, 129;
    --secondary-rgb: 52, 211, 153;
    --input-autofill-bg: #071c16;
    --input-autofill-bg-focus: #0c2820;
}
body.light-theme.theme-emerald {
    --primary-rgb: 5, 150, 105;
    --secondary-rgb: 16, 185, 129;
    --input-autofill-bg: #f0fdf4;
    --input-autofill-bg-focus: #dcfce7;
}

/* Purple Theme */
body.theme-purple {
    --primary-rgb: 139, 92, 246;
    --secondary-rgb: 167, 139, 250;
    --input-autofill-bg: #140d24;
    --input-autofill-bg-focus: #1d1433;
}
body.light-theme.theme-purple {
    --primary-rgb: 124, 58, 237;
    --secondary-rgb: 139, 92, 246;
    --input-autofill-bg: #faf5ff;
    --input-autofill-bg-focus: #f3e8ff;
}

/* Amber Theme */
body.theme-amber {
    --primary-rgb: 245, 158, 11;
    --secondary-rgb: 251, 191, 36;
    --input-autofill-bg: #1a1205;
    --input-autofill-bg-focus: #281b0a;
}
body.light-theme.theme-amber {
    --primary-rgb: 217, 119, 6;
    --secondary-rgb: 245, 158, 11;
    --input-autofill-bg: #fffbeb;
    --input-autofill-bg-focus: #fef3c7;
}

/* Rose Theme */
body.theme-rose {
    --primary-rgb: 244, 63, 94;
    --secondary-rgb: 251, 113, 133;
    --input-autofill-bg: #1c0a0d;
    --input-autofill-bg-focus: #2a1115;
}
body.light-theme.theme-rose {
    --primary-rgb: 225, 29, 72;
    --secondary-rgb: 244, 63, 94;
    --input-autofill-bg: #fff5f5;
    --input-autofill-bg-focus: #ffe4e6;
}

/* ================= BRAND LOGO STYLING ================= */
.brand-logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.brand-logo {
    height: 80px;
    width: 80px;
    border-radius: 50%;
    border: 2px solid var(--border-card);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    filter: drop-shadow(0 0 12px var(--primary-glow));
    transition: var(--transition-smooth);
    cursor: pointer;
}

.brand-logo:hover {
    transform: scale(1.08) rotate(5deg);
    border-color: var(--primary);
}

.dash-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.dash-brand:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

.dash-brand:active {
    transform: translateY(0) scale(0.98);
}

.dash-logo {
    height: 40px;
    width: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-card);
    filter: drop-shadow(0 0 6px var(--primary-glow));
}

.dash-brand-name {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: var(--font-sans, sans-serif);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Drag and Drop Upload Zone */
.upload-drag-zone {
    border: 2px dashed var(--border-card);
    border-radius: 12px;
    padding: 32px 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-bottom: 20px;
}

.upload-drag-zone.dragover {
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
    background: rgba(255, 255, 255, 0.05);
}

.upload-drag-zone:hover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.04);
}

.upload-icon-container {
    margin-bottom: 12px;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
    display: flex;
    justify-content: center;
}

.upload-drag-zone:hover .upload-icon-container,
.upload-drag-zone.dragover .upload-icon-container {
    color: var(--primary);
    transform: translateY(-2px);
}

.upload-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-family: var(--font-sans, sans-serif);
}

.upload-subtext {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-sans, sans-serif);
}

/* CSV Preview Table */
.csv-preview-card {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-card);
    border-radius: 8px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
}

.csv-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    color: var(--text-primary);
    font-family: var(--font-sans, sans-serif);
}

.csv-preview-table th, 
.csv-preview-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.csv-preview-table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

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

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

.spin {
    animation: spin 1s linear infinite;
}

/* Tooltip styling */
.chart-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.9); /* Dark slate background */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: var(--font-sans, sans-serif);
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.15s ease;
    transform: translate(-50%, -115%);
}

.chart-tooltip .tooltip-header {
    font-weight: 700;
    margin-bottom: 2px;
    font-size: 0.9rem;
    color: #a78bfa; /* Violet accent */
}

.chart-tooltip .tooltip-body {
    font-weight: 500;
}



/* Mobile Navigation Dropdown */
.mobile-nav-dropdown {
    display: none;
    position: relative;
}

.btn-menu-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.mobile-menu-content {
    display: none;
    position: absolute;
    top: 48px;
    right: 0;
    left: auto;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    width: 180px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    flex-direction: column;
    padding: 8px 0;
}

.mobile-menu-content.show {
    display: flex;
}

.mobile-nav-item {
    padding: 12px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.mobile-nav-item:hover, .mobile-nav-item.active {
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
}

/* ============================================================
   PWA / Mobile App Styles
   ============================================================ */

/* Safe area insets for notched phones (iPhone X+, Android) */
body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* When running as an installed PWA (standalone/fullscreen) */
@media (display-mode: standalone), (display-mode: fullscreen) {
    /* Extra top padding for status bar on standalone mode */
    body {
        padding-top: max(env(safe-area-inset-top), 8px);
    }

    /* Hide browser-only hint text */
    .browser-only { display: none !important; }

    /* Give installed app a slightly elevated header */
    .dash-header {
        padding-top: max(env(safe-area-inset-top), 16px);
    }
}

/* PWA install prompt banner */
#pwa-install-banner {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    padding: 14px 20px;
    border-radius: 16px;
    font-size: 0.87rem;
    font-weight: 600;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    max-width: 92vw;
    animation: slideInUp 0.4s ease-out;
}

#pwa-install-banner .pwa-banner-text {
    flex: 1;
    line-height: 1.4;
}

#pwa-install-banner .pwa-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

#pwa-install-banner button {
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 7px 14px;
    transition: all 0.2s;
}

#pwa-install-banner .btn-install {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

#pwa-install-banner .btn-install:hover {
    background: rgba(255,255,255,0.4);
}

#pwa-install-banner .btn-dismiss {
    background: none;
    color: rgba(255,255,255,0.65);
    padding: 7px 8px;
}

/* Update available banner */
#pwa-update-banner {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom) + 80px);
    left: 50%;
    transform: translateX(-50%);
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Prevent text selection and tap highlight on buttons on mobile */
@media (max-width: 768px) {
    button, .btn, .search-peer-chip, .mobile-nav-item {
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }

    /* Larger touch targets on mobile */
    .btn {
        min-height: 44px;
    }

    input, select, textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    /* Search grid stack on mobile */
    .search-news-grid {
        grid-template-columns: 1fr !important;
    }

    /* Stack footer row on narrow screens */
    .dashboard-footer-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* Mobile-First Native Feel Optimizations */
@media (pointer: coarse) {
    html, body {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Remove tap highlight color and click delays globally for touch devices */
    a, button, input, select, textarea, [role="button"], .btn, .nav-item, .chip, .search-peer-chip, .mobile-nav-item {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Disable selection for UI elements to prevent native browser copying highlights during fast taps */
    body {
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Re-enable selection for inputs and textareas so users can copy/paste values */
    input, textarea, [contenteditable="true"] {
        -webkit-user-select: text;
        user-select: text;
    }
    
    /* Ensure scrollable blocks use native touch momentum */
    .modal-card, .scroll-container, #session-devices-list, .csv-preview-card, .home-news-feed {
        -webkit-overflow-scrolling: touch;
    }
}

/* Fix for sharing tables on mobile - ensure cells are visible */
@media(max-width: 768px) {
    #sharing-sent-list-body td,
    #sharing-received-list-body td {
        padding: 8px 10px !important;
        font-size: 0.75rem !important;
        min-height: 36px !important;
    }

    #sharing-sent-list-body tr,
    #sharing-received-list-body tr {
        height: auto;
    }
}

.calendars-card {
    padding: 24px;
}

.calendars-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.calendars-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.calendars-tab-actions {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.calendars-tab-btn {
    border: 1px solid var(--border-card);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.calendars-tab-btn.active {
    color: var(--text-primary);
    border-color: rgba(var(--primary-rgb), 0.38);
    background: rgba(var(--primary-rgb), 0.15);
}

.calendars-panel {
    display: none;
}

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

.calendars-toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 12px;
    flex-wrap: wrap;
}

.calendars-filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.calendars-toggle-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.calendars-toggle-row {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 132px;
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
}

.calendars-switch {
    position: relative;
    display: inline-flex;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.calendars-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.calendars-switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.45);
    transition: all 0.2s ease;
}

.calendars-switch-slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.calendars-switch input:checked + .calendars-switch-slider {
    background: rgba(var(--primary-rgb), 0.45);
    border-color: rgba(var(--primary-rgb), 0.65);
}

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

.calendars-switch input:focus-visible + .calendars-switch-slider {
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.35);
}

.calendars-filter-label {
    font-size: 0.84rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.calendar-range-select {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 0.84rem;
    font-weight: 600;
}

.calendars-refresh-theme-btn {
    background: rgba(var(--primary-rgb), 0.1) !important;
    border: 1px solid rgba(var(--primary-rgb), 0.25) !important;
    color: var(--primary) !important;
    border-radius: 999px !important;
    padding: 6px 16px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.calendars-refresh-theme-btn:hover {
    background: rgba(var(--primary-rgb), 0.2) !important;
}

.calendars-source-note {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.78;
    line-height: 1.1;
}

.calendars-source-note-inline {
    margin-left: 4px;
    align-self: center;
}

.calendars-body-grid {
    display: grid;
    grid-template-columns: minmax(260px, 360px) 1fr;
    gap: 14px;
}

.calendars-list-panel,
.calendars-detail-panel {
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    min-height: 420px;
    max-height: 560px;
    overflow-y: auto;
}

.calendars-empty-message {
    color: var(--text-secondary);
    font-size: 0.86rem;
    text-align: center;
    padding: 28px 14px;
}

.calendars-list-item {
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.01);
    color: var(--text-primary);
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: var(--transition-smooth);
}

.calendars-list-item.active,
.calendars-list-item:hover {
    border-color: rgba(var(--primary-rgb), 0.38);
    background: rgba(var(--primary-rgb), 0.12);
}

.calendars-item-title {
    font-size: 0.92rem;
    font-weight: 700;
}

.calendars-ticker-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.calendars-ticker-logo {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    padding: 1px;
}

.calendars-item-subtitle {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.calendars-item-date {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
}

.calendars-detail-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.calendars-detail-grid {
    display: grid;
    gap: 8px;
}

.calendars-detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px dashed rgba(var(--primary-rgb), 0.2);
    padding-bottom: 8px;
}

.calendars-detail-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.calendars-detail-value {
    font-size: 0.84rem;
    font-weight: 600;
    text-align: right;
}

.calendars-event-card {
    cursor: default;
    grid-template-columns: 1fr auto;
}

.calendars-economic-metrics {
    grid-column: 1 / -1;
    margin-top: 8px;
    border-top: 1px dashed rgba(var(--primary-rgb), 0.2);
    padding-top: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

@media (max-width: 980px) {
    .calendars-body-grid {
        grid-template-columns: 1fr;
    }

    .calendars-list-panel,
    .calendars-detail-panel {
        min-height: 260px;
    }
}

