*, *::before, *::after { box-sizing: border-box; }

:root,
[data-theme="light"] {
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --color-text-primary: #0f1117;
    --color-text-secondary: #4b5563;
    --color-text-tertiary: #9ca3af;
    --color-text-success: #16a34a;
    --color-text-danger: #dc2626;
    --color-background-primary: #ffffff;
    --color-background-secondary: #f9fafb;
    --color-background-hover: #f3f4f6;
    --color-card-chrome: #e2e8f0;
    --color-card-chrome-hover: #d1d9e6;
    --color-border-tertiary: #e5e7eb;
    --color-border-secondary: #d1d5db;
    --color-accent: #2272BE;
    --border-radius-sm: 6px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;

    /* DTE pills */
    --dte-ok-bg: #dcfce7;     --dte-ok-color: #16a34a;
    --dte-warn-bg: #fef3c7;   --dte-warn-color: #92400e;
    --dte-urgent-bg: #fee2e2; --dte-urgent-color: #dc2626;

    /* Badges */
    --badge-cc-bg: #dcfce7;   --badge-cc-color: #16a34a;
    --badge-neg-bg: #fee2e2;  --badge-neg-color: #dc2626;
}

[data-theme="dark"] {
    --color-text-primary: #f3f4f6;
    --color-text-secondary: #9ca3af;
    --color-text-tertiary: #6b7280;
    --color-text-success: #6ee7b7;
    --color-text-danger: #fca5a5;
    --color-background-primary: #111827;
    --color-background-secondary: #1f2937;
    --color-background-hover: #2d3748;
    --color-card-chrome: #182535;
    --color-card-chrome-hover: #1e2f44;
    --color-border-tertiary: #374151;
    --color-border-secondary: #4b5563;
    --color-accent: #60a5fa;

    /* DTE pills */
    --dte-ok-bg: #14532d;     --dte-ok-color: #86efac;
    --dte-warn-bg: #78350f;   --dte-warn-color: #fcd34d;
    --dte-urgent-bg: #7f1d1d; --dte-urgent-color: #fca5a5;

    /* Badges */
    --badge-cc-bg: #14532d;   --badge-cc-color: #86efac;
    --badge-neg-bg: #7f1d1d;  --badge-neg-color: #fca5a5;
}

html[data-card-chrome="blue"][data-theme="light"],
html[data-card-chrome="blue"]:not([data-theme="dark"])  { --color-card-chrome: #2272BE; --color-card-chrome-hover: #2272BE; }
html[data-card-chrome="blue"][data-theme="dark"]         { --color-card-chrome: #1e3a5c; --color-card-chrome-hover: #1e4570; }

/* Cream text for card chrome areas when blue is active in light mode */
html[data-card-chrome="blue"]:not([data-theme="dark"]) .group-header,
html[data-card-chrome="blue"][data-theme="light"] .group-header,
html[data-card-chrome="blue"]:not([data-theme="dark"]) .group-footer,
html[data-card-chrome="blue"][data-theme="light"] .group-footer,
html[data-card-chrome="blue"]:not([data-theme="dark"]) .an-section-header,
html[data-card-chrome="blue"][data-theme="light"] .an-section-header,
html[data-card-chrome="blue"]:not([data-theme="dark"]) .section-header,
html[data-card-chrome="blue"][data-theme="light"] .section-header {
    --color-text-primary: #fdf8f0;
    --color-text-secondary: rgba(253,248,240,0.82);
    --color-text-tertiary: rgba(253,248,240,0.55);
    --color-border-tertiary: rgba(253,248,240,0.2);
    --color-text-success: #4ade80;
    --color-text-danger: #f87171;
}

/* Apply card chrome background to Analytics and Settings section headers */
html[data-card-chrome="blue"] .an-section-header,
html[data-card-chrome="blue"] .section-header { background: var(--color-card-chrome); }

/* Keep the Manage button readable against the blue footer */
html[data-card-chrome="blue"]:not([data-theme="dark"]) .group-footer button,
html[data-card-chrome="blue"][data-theme="light"] .group-footer button {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.35);
    color: #fdf8f0;
}

html[data-card-chrome="emerald"][data-theme="light"],
html[data-card-chrome="emerald"]:not([data-theme="dark"]) { --color-card-chrome: #1a6b4a; --color-card-chrome-hover: #1a6b4a; }
html[data-card-chrome="emerald"][data-theme="dark"]        { --color-card-chrome: #0e3f2b; --color-card-chrome-hover: #114d34; }

/* Light text for card chrome areas when emerald is active in light mode */
html[data-card-chrome="emerald"]:not([data-theme="dark"]) .group-header,
html[data-card-chrome="emerald"][data-theme="light"] .group-header,
html[data-card-chrome="emerald"]:not([data-theme="dark"]) .group-footer,
html[data-card-chrome="emerald"][data-theme="light"] .group-footer,
html[data-card-chrome="emerald"]:not([data-theme="dark"]) .an-section-header,
html[data-card-chrome="emerald"][data-theme="light"] .an-section-header,
html[data-card-chrome="emerald"]:not([data-theme="dark"]) .section-header,
html[data-card-chrome="emerald"][data-theme="light"] .section-header {
    --color-text-primary: #f0fdf4;
    --color-text-secondary: rgba(240,253,244,0.82);
    --color-text-tertiary: rgba(240,253,244,0.55);
    --color-border-tertiary: rgba(240,253,244,0.2);
    --color-text-success: #d1fae5;
    --color-text-danger: #fda4af;
}

/* Apply card chrome background to Analytics and Settings section headers */
html[data-card-chrome="emerald"] .an-section-header,
html[data-card-chrome="emerald"] .section-header { background: var(--color-card-chrome); }

/* Keep the Manage button readable against the emerald footer */
html[data-card-chrome="emerald"]:not([data-theme="dark"]) .group-footer button,
html[data-card-chrome="emerald"][data-theme="light"] .group-footer button {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.35);
    color: #f0fdf4;
}

html[data-card-chrome="obsidian"][data-theme="light"],
html[data-card-chrome="obsidian"]:not([data-theme="dark"]) { --color-card-chrome: #1a1825; --color-card-chrome-hover: #221f30; }
html[data-card-chrome="obsidian"][data-theme="dark"]        { --color-card-chrome: #0f0e16; --color-card-chrome-hover: #16141f; }

/* Light text for card chrome areas when obsidian is active */
html[data-card-chrome="obsidian"] .group-header,
html[data-card-chrome="obsidian"] .group-footer,
html[data-card-chrome="obsidian"] .an-section-header,
html[data-card-chrome="obsidian"] .section-header {
    --color-text-primary: #e2e8f0;
    --color-text-secondary: rgba(226,232,240,0.75);
    --color-text-tertiary: rgba(226,232,240,0.45);
    --color-border-tertiary: rgba(226,232,240,0.1);
    --color-text-success: #4ade80;
    --color-text-danger: #f87171;
}

/* Apply card chrome background to Analytics and Settings section headers */
html[data-card-chrome="obsidian"] .an-section-header,
html[data-card-chrome="obsidian"] .section-header { background: var(--color-card-chrome); }

/* Keep the Manage button readable against the obsidian footer */
html[data-card-chrome="obsidian"] .group-footer button {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #e2e8f0;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text-primary);
    background: var(--color-background-secondary);
}

a { color: #2272BE; }

button {
    font-family: var(--font-sans);
    font-size: 12px;
    padding: 4px 10px;
    border: 0.5px solid var(--color-border-tertiary);
    border-radius: var(--border-radius-sm);
    background: var(--color-background-primary);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.1s;
}

button:hover { background: var(--color-background-secondary); }

/* Separator — change content here to update everywhere */
.sep::before {
    content: "/";
    color: var(--color-text-tertiary);
    opacity: 0.9;
    margin: 0 6px;
    font-weight: 300;
    font-size: 0.85em;
    letter-spacing: 0;
}

/* Skeleton shimmer — global so any page can use .skel-block */
@keyframes skel-shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}

.skel-block {
    border-radius: 4px;
    background: linear-gradient(90deg,
        var(--color-border-tertiary) 25%,
        var(--color-background-secondary) 50%,
        var(--color-border-tertiary) 75%);
    background-size: 1200px 100%;
    animation: skel-shimmer 1.5s ease-in-out infinite;
}

/* DTE pills — global so Settings preview can use them */
.dte-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    letter-spacing: 0.01em;
}

.dte-ok     { background: var(--dte-ok-bg);     color: var(--dte-ok-color); }
.dte-warn   { background: var(--dte-warn-bg);   color: var(--dte-warn-color); }
.dte-urgent { background: var(--dte-urgent-bg); color: var(--dte-urgent-color); }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

#blazor-error-ui {
    background: #fefce8;
    border-top: 1px solid #fde68a;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.1);
    display: none;
    left: 0;
    padding: 0.5rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 13px;
    color: #92400e;
}

#blazor-error-ui .dismiss { cursor: pointer; float: right; }

.loading-progress {
    position: relative;
    display: block;
    width: 6rem; height: 6rem;
    margin: 20vh auto 1rem;
}

.loading-progress circle {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #2272BE;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 500;
    font-size: 13px;
    color: var(--color-text-tertiary);
    inset: calc(20vh + 2.5rem) 0 auto 0;
}

.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Loading"); }

.brand-accent { color: var(--color-accent); }

/* ── Auth pages ── */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--color-background-secondary);
}

.auth-card {
    background: var(--color-background-primary);
    border: 0.5px solid var(--color-border-tertiary);
    border-radius: var(--border-radius-lg);
    padding: 44px 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.auth-brand { text-align: center; margin-bottom: 32px; }

.auth-logo {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.03em;
}

.auth-tagline {
    font-size: 13px;
    color: var(--color-text-tertiary);
    margin-top: 5px;
}

.auth-error {
    background: rgba(239, 68, 68, 0.08);
    border: 0.5px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--border-radius-sm);
    color: var(--color-text-danger);
    font-size: 13px;
    padding: 10px 14px;
    margin-bottom: 18px;
}

.auth-field { margin-bottom: 18px; }

.auth-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 7px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-input {
    width: 100%;
    padding: 10px 13px;
    background: var(--color-background-secondary);
    border: 1px solid var(--color-border-tertiary);
    border-radius: var(--border-radius-sm);
    color: var(--color-text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.auth-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 15%, transparent);
}

/* Override browser autofill chrome so inputs stay on-theme */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--color-background-secondary) inset;
    -webkit-text-fill-color: var(--color-text-primary);
    caret-color: var(--color-text-primary);
    transition: background-color 5000s;
}

.auth-validation { display: block; font-size: 11px; color: var(--color-text-danger); margin-top: 4px; }

.auth-btn {
    width: 100%;
    padding: 11px;
    margin-top: 6px;
    font-size: 14px;
    font-weight: 600;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: opacity 0.15s;
    letter-spacing: 0.01em;
    justify-content: center;
}
.auth-btn:hover { opacity: 0.88; background: var(--color-accent); }
.auth-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.auth-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    margin-top: -4px;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--color-text-secondary);
    cursor: pointer;
    user-select: none;
}

.auth-remember input[type="checkbox"] { cursor: pointer; accent-color: var(--color-accent); }

.auth-forgot {
    font-size: 13px;
    color: var(--color-accent);
    text-decoration: none;
}
.auth-forgot:hover { text-decoration: underline; }

.auth-hint {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin: 0 0 20px;
    line-height: 1.5;
}

.auth-success {
    background: rgba(34, 197, 94, 0.08);
    border: 0.5px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--border-radius-sm);
    color: var(--color-text-success);
    font-size: 13px;
    padding: 12px 14px;
    margin-bottom: 16px;
    line-height: 1.6;
}

.auth-switch {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 22px;
}
.auth-switch a { color: var(--color-accent); font-weight: 500; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* Password strength indicator */
.pw-strength { display: flex; align-items: center; gap: 8px; margin-top: 7px; margin-left: 1px; margin-right: 1px; }
.pw-strength-bars { display: flex; gap: 4px; flex: 1; }
.pw-bar {
    height: 3px;
    flex: 1;
    border-radius: 2px;
    background: var(--color-border-tertiary);
    transition: background 0.2s;
}
.pw-bar-1 { background: #ef4444; }
.pw-bar-2 { background: #f97316; }
.pw-bar-3 { background: #eab308; }
.pw-bar-4 { background: #22c55e; }
.pw-strength-label {
    font-size: 11px;
    font-weight: 600;
    min-width: 42px;
    text-align: right;
    transition: color 0.2s;
}
.pw-label-1 { color: #ef4444; }
.pw-label-2 { color: #f97316; }
.pw-label-3 { color: #eab308; }
.pw-label-4 { color: #22c55e; }

/* ── Landing page ── */
.landing-shell {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 80px;
}

.landing-hero {
    text-align: center;
    padding: 48px 0 32px;
    animation: hv-fade-up 0.5s ease both;
}

.landing-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: 20px;
}

.landing-headline {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--color-text-primary);
    margin: 0 0 24px;
}

.landing-sub {
    font-size: 16px;
    color: var(--color-text-secondary);
    line-height: 1.75;
    max-width: 520px;
    margin: 0 auto 28px;
}

.landing-ctas {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.landing-btn-primary {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    background: var(--color-accent);
    color: #fff;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: opacity 0.15s;
}

.landing-btn-primary:hover { opacity: 0.88; color: #fff; }

.landing-btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}

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

.landing-divider { margin-bottom: 32px; animation: hv-fade-up 0.5s 0.1s ease both; }

.landing-ticker-strip {
    display: flex;
    overflow: hidden;
    background: var(--color-background-primary);
    border: 0.5px solid var(--color-border-tertiary);
    border-radius: var(--border-radius-lg);
    padding: 16px 0;
}

.landing-ticker-group {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 100%;
    animation: ticker-scroll 28s linear infinite;
}

.landing-ticker-strip:hover .landing-ticker-group { animation-play-state: paused; }

.landing-ticker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    flex-shrink: 0;
}

.landing-ticker-sym   { font-size: 13px; font-weight: 700; color: var(--color-text-primary); letter-spacing: 0.02em; }
.landing-ticker-strategy { font-size: 12px; color: var(--color-text-tertiary); }
.landing-ticker-pnl   { font-size: 13px; font-weight: 600; }

.landing-ticker-item.pos .landing-ticker-pnl { color: var(--color-text-success); }
.landing-ticker-item.neg .landing-ticker-pnl { color: var(--color-text-danger); }

.landing-sep { width: 1px; height: 28px; background: var(--color-border-tertiary); flex-shrink: 0; }

.landing-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    animation: hv-fade-up 0.5s 0.18s ease both;
}

.landing-feature {
    background: var(--color-background-primary);
    border: 0.5px solid var(--color-border-tertiary);
    border-radius: var(--border-radius-lg);
    padding: 28px 24px;
    transition: border-color 0.15s;
}

.landing-feature:hover { border-color: var(--color-border-secondary); }

.landing-feature-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-md);
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 20px;
    color: var(--color-accent);
}

.landing-feature { text-align: center; }
.landing-feature-icon-wrap { margin-left: auto; margin-right: auto; }
.landing-feature-title { font-size: 15px; font-weight: 600; color: var(--color-text-primary); margin: 0 0 8px; }
.landing-feature-desc  { font-size: 13px; color: var(--color-text-secondary); line-height: 1.65; margin: 0; }

/* Landing — product preview */
.landing-preview {
    margin: 0 -32px 56px;
    padding: 64px 32px;
    background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--color-accent) 6%, transparent), transparent 70%);
    border-top: 0.5px solid var(--color-border-tertiary);
    border-bottom: 0.5px solid var(--color-border-tertiary);
    display: flex;
    flex-direction: column;
    gap: 72px;
    animation: hv-fade-up 0.5s 0.14s ease both;
}

.preview-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.preview-text {
    text-align: center;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-heading {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--color-text-primary);
    margin: 0;
}

.preview-desc {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.75;
    margin: 0;
}

.preview-frame {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--color-border-secondary);
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.5),
        0 8px 24px rgba(0, 0, 0, 0.3),
        0 0 0 0.5px var(--color-border-tertiary);
}

.preview-chrome {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--color-background-secondary);
    border-bottom: 1px solid var(--color-border-tertiary);
}

.preview-chrome span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.preview-chrome span:nth-child(1) { background: #ff5f57; }
.preview-chrome span:nth-child(2) { background: #febc2e; }
.preview-chrome span:nth-child(3) { background: #28c840; }

.preview-img {
    width: 100%;
    display: block;
}

@keyframes live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
    50%       { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0); }
}

@keyframes ticker-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-100%); }
}

@keyframes hv-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
    .landing-hero     { padding: 32px 0 24px; }
    .landing-features { grid-template-columns: 1fr; }
    .landing-ticker-item { gap: 8px; }
}
