:root {
    /* Automate Fundamentals brand: obsidian and champagne. Values from brand/kit/tokens.css. */
    --ink: #0b0f17;
    --ink-raised: #1c2230;
    --ink-soft: #3d4452;
    --muted: #667085;
    --line: #e7e3da;
    --bg: #ffffff;
    --surface: #ffffff;
    --text-strong: #0b0f17;
    --field-line: #d6d1c6;
    --bg-alt: #f7f4ee;
    --accent: #a8843f;
    --accent-dark: #8a6a2c;
    --accent-soft: #f3ecdd;
    --accent-on-ink: #d9bc7a;
    --mist: #b9c0cc;
    --warn: #b45309;
    --danger: #b42318;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(11, 15, 23, .06), 0 12px 32px rgba(11, 15, 23, .08);
    --font: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

html { font-size: 16px; scroll-padding-top: 80px; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--text-strong);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--text-strong); letter-spacing: -0.025em; line-height: 1.15; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; margin: 0 0 1rem; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); font-weight: 750; margin: 0 0 1.5rem; }
h3 { font-size: 1.1rem; font-weight: 650; margin: 0 0 .5rem; }
a { color: var(--accent-dark); }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid rgba(168, 132, 63, .55); outline-offset: 2px; }

.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .74rem; font-weight: 650; color: var(--accent-dark); margin: 0 0 .75rem; }
.lead-ft { font-size: 1.15rem; color: var(--ink-soft); max-width: 40rem; }
.muted { color: var(--muted); font-size: .95rem; }
.page-narrow { max-width: 760px; margin: 0 auto; padding: 3rem 1rem; }

/* Buttons */
.btn-ft {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1.1rem; border-radius: 8px; border: 1px solid transparent;
    font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}
.btn-ft-lg { padding: .8rem 1.5rem; font-size: 1.02rem; }
.btn-ft-block { display: flex; width: 100%; }
.btn-ft-primary { background: var(--ink); color: #fff; }
.btn-ft-primary:hover { background: var(--ink-raised); color: var(--accent-on-ink); }
.btn-ft-gold { background: var(--accent-on-ink); color: var(--ink); }
.btn-ft-gold:hover { background: #e6cf98; color: var(--ink); }
.btn-ft-outline { background: var(--surface); color: var(--text-strong); border-color: var(--line); }
.btn-ft-outline:hover { border-color: var(--ink-soft); color: var(--text-strong); }
.btn-ft-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ft-ghost:hover { color: var(--text-strong); border-color: var(--ink-soft); }
.btn-ft-light { background: #fff; color: var(--ink); }
.btn-ft-light:hover { background: var(--accent-on-ink); color: var(--ink); }
.btn-ft-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .28); }
.btn-ft-outline-light:hover { color: var(--accent-on-ink); border-color: var(--accent-on-ink); }

/* Header */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
}
.site-header .navbar { padding: .7rem 0; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--text-strong); text-decoration: none; margin-right: 1.5rem; }
.brand:hover { color: var(--text-strong); }
.brand-mark { display: block; width: 30px; height: 30px; flex: 0 0 auto; }
.brand-mark .af-fg { fill: var(--ink); }
.brand-mark .af-ac { fill: var(--accent); }
.brand-name { font-size: .82rem; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }
.brand-name b { font-weight: 800; }
.brand-name span { font-weight: 400; }
.brand-small .brand-mark { width: 24px; height: 24px; }
.brand-small .brand-name { font-size: .74rem; }
.site-header .nav-link { color: var(--ink-soft); font-weight: 550; padding: .4rem .8rem !important; border-radius: 6px; }
.site-header .nav-link:hover { color: var(--text-strong); background: var(--bg-alt); }
.site-header .nav-link.active { color: var(--text-strong); background: var(--bg-alt); }
.nav-actions { display: flex; align-items: center; gap: .5rem; }
@media (max-width: 767.98px) {
    .nav-actions { flex-direction: column; align-items: stretch; padding: .75rem 0 .5rem; border-top: 1px solid var(--line); margin-top: .5rem; }
    .nav-actions form, .nav-actions form .btn-ft { width: 100%; }
}

/* Hero */
.hero {
    padding: 5.5rem 0 5rem; color: #fff;
    background:
        radial-gradient(900px 420px at 85% 10%, rgba(217, 188, 122, .16), transparent 60%),
        radial-gradient(700px 380px at 0% 100%, rgba(217, 188, 122, .07), transparent 60%),
        var(--ink);
    border-bottom: 1px solid rgba(217, 188, 122, .25);
}
.hero h1 { color: #fff; }
.hero .eyebrow { color: var(--accent-on-ink); }
.hero .lead-ft { color: var(--mist); }
.hero .mock-card { border-color: rgba(217, 188, 122, .35); box-shadow: 0 24px 60px rgba(0, 0, 0, .45); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3.5rem; align-items: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
@media (max-width: 991.98px) { .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; } .hero { padding: 3rem 0; } }

.mock-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 1.4rem; }
.mock-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.mock-title { font-weight: 700; }
.pill { font-size: .75rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); }
.rule-list { list-style: none; padding: 0; margin: 0 0 1.2rem; font-size: .92rem; }
.rule-list li { display: flex; gap: .75rem; padding: .5rem 0; border-bottom: 1px dashed var(--line); }
.rule-list li:last-child { border-bottom: 0; }
.rule-key { flex: 0 0 5.5rem; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; padding-top: .1rem; }
.mock-score { background: var(--bg-alt); border-radius: 10px; padding: .8rem 1rem; }
.score-row { display: grid; grid-template-columns: 7rem 1fr 2rem; align-items: center; gap: .6rem; font-size: .85rem; padding: .25rem 0; }
.score-row span:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.mock-note { font-size: .75rem; color: var(--muted); margin: .8rem 0 0; }

/* Sections */
.section { padding: 4.5rem 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.card-grid { display: grid; gap: 1.25rem; }
.card-grid.two { grid-template-columns: repeat(2, 1fr); }
.card-grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 991.98px) { .card-grid.three { grid-template-columns: 1fr; } }
@media (max-width: 767.98px) { .card-grid.two { grid-template-columns: 1fr; } .section { padding: 3rem 0; } }
.info-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.info-card p { color: var(--ink-soft); margin: 0; }
.kicker { font-size: .75rem !important; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-dark) !important; margin-bottom: .4rem !important; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.steps li { display: flex; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.steps p { color: var(--ink-soft); margin: 0; }
.step-num { flex: 0 0 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--ink); color: var(--accent-on-ink); display: grid; place-items: center; font-weight: 700; }
@media (max-width: 767.98px) { .steps { grid-template-columns: 1fr; } }

/* Pricing */
.pricing { max-width: 820px; }
.price-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem; display: flex; flex-direction: column; }
.price-card.featured { border: 2px solid var(--accent); box-shadow: var(--shadow); }
.price { font-size: 2.4rem; font-weight: 800; margin: .25rem 0 0; line-height: 1.1; }
.price span { font-size: 1rem; font-weight: 500; color: var(--muted); }
.price-alt { color: var(--muted); font-size: .9rem; margin: .25rem 0 0; }
.price-card ul { list-style: none; padding: 0; margin: 1.25rem 0 1.5rem; flex: 1; }
.price-card li { padding: .35rem 0 .35rem 1.6rem; position: relative; color: var(--ink-soft); }
.price-card li::before { content: ""; position: absolute; left: 0; top: .72rem; width: .9rem; height: .5rem; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

/* FAQ */
.faq details { border-bottom: 1px solid var(--line); padding: 1rem 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { color: var(--ink-soft); margin: .75rem 0 0; }

.cta-band { background: radial-gradient(700px 300px at 50% 0%, rgba(217, 188, 122, .14), transparent 70%), var(--ink); color: #fff; padding: 4.5rem 0; }
.cta-inner { text-align: center; }
.cta-band h2 { color: #fff; margin-bottom: .5rem; }
.cta-band p { color: var(--mist); margin-bottom: 1.75rem; }

/* Auth */
.auth { min-height: calc(100vh - 260px); display: grid; place-items: center; padding: 3rem 1rem; background: var(--bg-alt); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 16px; box-shadow: var(--shadow); padding: 2rem; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: .25rem; }
.auth-sub { color: var(--muted); margin-bottom: 1.5rem; }
.field-label { display: block; font-weight: 600; font-size: .9rem; margin: 1rem 0 .35rem; }
.field {
    display: block; width: 100%; padding: .7rem .85rem; font-size: 1rem;
    border: 1px solid var(--field-line); border-radius: 8px; background: var(--surface); color: var(--text-strong);
}
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168, 132, 63, .2); }
.field.input-validation-error { border-color: var(--danger); }
.password-wrap { position: relative; }
.password-wrap .field { padding-right: 4.2rem; }
.password-toggle {
    position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
    border: 0; background: transparent; color: var(--accent-dark); font-weight: 600; font-size: .85rem; padding: .35rem .5rem; cursor: pointer; border-radius: 6px;
}
.password-toggle:hover { background: var(--accent-soft); }
.field-hint { display: block; font-size: .82rem; color: var(--muted); margin-top: .3rem; }
.field-error { display: block; font-size: .85rem; color: var(--danger); margin-top: .3rem; }
.field-error:empty { display: none; }
.form-alert ul { list-style: none; padding: .75rem 1rem; margin: 0 0 .5rem; background: #fef3f2; border: 1px solid #fecdca; border-radius: 8px; color: var(--danger); font-size: .9rem; }
.form-alert.validation-summary-valid { display: none; }
.check { display: flex; align-items: center; gap: .5rem; margin: 1rem 0 0; font-size: .92rem; color: var(--ink-soft); cursor: pointer; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.auth-card button[type="submit"] { margin-top: 1.5rem; padding: .8rem; font-size: 1rem; }
.auth-switch { text-align: center; margin: 1.25rem 0 0; color: var(--muted); font-size: .92rem; }

/* Dashboard */
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 2rem 0; }
.status-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; display: flex; flex-direction: column; }
.status-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.status-value { font-size: 1.3rem; font-weight: 700; }
@media (max-width: 575.98px) { .status-grid { grid-template-columns: 1fr; } }
.link-arrow { font-weight: 600; text-decoration: none; }
.link-arrow::after { content: " \2192"; }

/* Business plan */
.plan-hero { background: var(--bg-alt); border-bottom: 1px solid var(--line); padding: 3rem 0 0; }
.plan-hero .lead-ft { margin-bottom: 2rem; }
.subtabs { display: flex; gap: .25rem; }
.subtabs a {
    padding: .7rem 1.1rem; font-weight: 600; color: var(--ink-soft); text-decoration: none;
    border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; margin-bottom: -1px;
}
.subtabs a:hover { color: var(--text-strong); }
.subtabs a.active { background: var(--surface); color: var(--text-strong); border-color: var(--line); }

.pitch { max-width: 960px; padding-top: 3rem; padding-bottom: 4rem; }
.pitch-block { padding: 2.5rem 0; border-bottom: 1px solid var(--line); }
.pitch-block:first-child { padding-top: 0; }
.pitch-block > p { color: var(--ink-soft); max-width: 48rem; }
.pitch-block h2 { display: flex; align-items: baseline; gap: .8rem; }
.num { font-family: var(--mono); font-size: .9rem; color: var(--accent-dark); font-weight: 600; }
.pitch-quote { font-size: 1.35rem; font-weight: 600; color: var(--text-strong) !important; border-left: 4px solid var(--accent); padding-left: 1rem; }
.pitch-block .card-grid { margin-top: 1.5rem; }
.pitch-cta { text-align: center; padding: 3rem 0 0; }
.pitch-cta p { color: var(--muted); }

.table-wrap { overflow-x: auto; margin: 1.25rem 0; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 0; }
.table-wrap th { background: var(--bg-alt); text-align: left; font-weight: 650; padding: .7rem .9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-wrap td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-soft); }
.table-wrap tr:last-child td { border-bottom: 0; }
.data-table tr.highlight td { background: var(--accent-soft); color: var(--text-strong); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1.5rem 0; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.stat-value { display: block; font-size: 2rem; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { display: block; font-size: .85rem; color: var(--muted); margin-top: .35rem; }
@media (max-width: 767.98px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

.timeline { list-style: none; padding: 0; margin: 1.5rem 0 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1.5rem 1.5rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
.timeline li.current::before { background: var(--accent); border-color: var(--accent); }
.timeline li.blocked::before { border-color: var(--warn); }
.tl-phase { display: block; font-weight: 700; }
.tl-when { display: block; font-size: .85rem; color: var(--muted); }
.timeline li.current .tl-when { color: var(--accent-dark); font-weight: 600; }
.timeline li.blocked .tl-when { color: var(--warn); font-weight: 600; }
.timeline p { color: var(--ink-soft); margin: .35rem 0 0; }

.risk-list { padding-left: 1.2rem; color: var(--ink-soft); }
.risk-list li { margin-bottom: .6rem; }
.risk-list strong { color: var(--text-strong); }

/* Full document */
.doc-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 3rem; padding-top: 2.5rem; padding-bottom: 4rem; }
.doc-toc details { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow-y: auto; font-size: .88rem; }
.doc-toc summary { font-weight: 700; margin-bottom: .5rem; cursor: pointer; }
.doc-toc ul { list-style: none; padding: 0; margin: 0; }
.doc-toc li a { display: block; padding: .22rem 0; color: var(--ink-soft); text-decoration: none; }
.doc-toc li a:hover { color: var(--accent-dark); }
.doc-toc .toc-l3 a { padding-left: .9rem; font-size: .84rem; color: var(--muted); }
@media (max-width: 991.98px) {
    .doc-layout { grid-template-columns: 1fr; gap: 1.5rem; }
    .doc-toc details { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
}

.prose { max-width: 50rem; color: var(--ink-soft); }
.prose h1 { font-size: 2rem; }
.prose h2 { font-size: 1.6rem; margin: 3rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.prose h3 { font-size: 1.2rem; margin: 2rem 0 .75rem; }
.prose strong { color: var(--text-strong); }
.prose hr { display: none; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--bg-alt); padding: .1em .35em; border-radius: 4px; color: var(--text-strong); }
.prose pre { background: var(--ink); color: #e2e8f0; padding: 1rem 1.2rem; border-radius: 10px; overflow-x: auto; font-size: .85rem; }
.prose pre code { background: transparent; color: inherit; padding: 0; }
.prose blockquote { border-left: 4px solid var(--accent); padding-left: 1rem; color: var(--text-strong); }
.prose li { margin-bottom: .3rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 2.5rem 0 2rem; background: var(--bg-alt); }
.footer-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: var(--ink-soft); text-decoration: none; font-size: .92rem; }
.footer-links a:hover { color: var(--text-strong); }
.disclaimer { font-size: .82rem; color: var(--muted); max-width: 52rem; margin: 0 0 .5rem; }
.copyright { font-size: .82rem; color: var(--muted); margin: 0; }

/* Connect: account type detected from the Key ID */
.key-kind { display: inline-flex; align-items: center; gap: .4rem; margin-top: .45rem; padding: .25rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 700; letter-spacing: .02em; }
.key-kind::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.key-kind[hidden] { display: none; }
.key-kind-paper { background: var(--accent-soft); color: var(--accent-dark); }
.key-kind-live { background: #fef3f2; color: var(--danger); }
.form-alert-box { padding: .75rem 1rem; margin: 0 0 1rem; background: #fef3f2; border: 1px solid #fecdca; border-radius: 8px; color: var(--danger); font-size: .9rem; }

/* Portfolio dashboard: follows the site theme (light by default, obsidian panels in dark) */
.pf {
    /* Light theme: the landing page's white and ivory with ink text and champagne accents. */
    --pf-bg: var(--bg-alt); --pf-panel: #fff; --pf-line: var(--line); --pf-text: var(--ink-soft); --pf-strong: var(--ink);
    --pf-dim: var(--muted); --pf-gold: var(--accent-dark); --pf-gold-soft: var(--accent-soft); --pf-hover: rgba(11, 15, 23, .025);
    --pf-up: #0f7a55; --pf-down: #c2362f; --pf-inset: var(--bg-alt); --pf-shadow: var(--shadow); --pf-glow: rgba(168, 132, 63, .08);
    background: radial-gradient(1000px 400px at 80% -10%, var(--pf-glow), transparent 60%), var(--pf-bg);
    color: var(--pf-text); padding: 2.5rem 0 3rem; min-height: calc(100vh - 70px);
}
[data-theme="dark"] .pf {
    --pf-bg: var(--ink); --pf-panel: #121826; --pf-line: rgba(255, 255, 255, .07); --pf-text: #e8eaef; --pf-strong: #fff;
    --pf-dim: #8a93a3; --pf-gold: var(--accent-on-ink); --pf-gold-soft: rgba(217, 188, 122, .16); --pf-hover: rgba(255, 255, 255, .02);
    --pf-up: #3fb68b; --pf-down: #e5484d; --pf-inset: rgba(0, 0, 0, .25); --pf-glow: rgba(217, 188, 122, .10);
    --pf-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 40px rgba(0, 0, 0, .25);
}
.pf h1, .pf h2 { color: var(--pf-strong); }
.pf-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.75rem; }
.pf-head h1 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); margin: 0; }
.pf .eyebrow { color: var(--pf-gold); }
.pf-note { background: rgba(63, 182, 139, .12); border: 1px solid rgba(63, 182, 139, .3); color: var(--pf-up); padding: .7rem 1rem; border-radius: 10px; }

.pf-grid-top { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.25rem; margin-bottom: 1.25rem; }
.pf-grid-bottom { display: grid; grid-template-columns: minmax(0, 3.2fr) minmax(0, 5fr) minmax(0, 4.3fr); gap: 1.25rem; }
@media (max-width: 1199.98px) { .pf-grid-bottom { grid-template-columns: 1fr 1fr; } .pf-grid-bottom > :first-child { grid-row: span 2; } }
@media (max-width: 991.98px) { .pf-grid-top, .pf-grid-bottom { grid-template-columns: 1fr; } .pf-grid-bottom > :first-child { grid-row: auto; } }

.pf-card {
    background: var(--pf-panel);
    border: 1px solid var(--pf-line); border-radius: 16px; padding: 1.4rem; min-width: 0;
    box-shadow: var(--pf-shadow);
}
.pf-empty-card p { color: var(--pf-dim); margin: 0; }
.pf-title { font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--pf-dim) !important; margin: 0 0 1.1rem; }
.pf-title-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.pf-title-row .pf-title { margin: 0; }
.pf-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem 1.5rem; }
.pf-label { display: block; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--pf-dim); margin-bottom: .2rem; }
.pf-big { display: block; font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--pf-strong); }
.pf-mid { display: block; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--pf-strong); }
.pf small { font-size: .72em; font-weight: 600; margin-left: .35rem; }
.pf-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--pf-line); font-size: .8rem; color: var(--pf-dim); }
.pf-meta b { color: var(--pf-text); font-weight: 600; margin-left: .25rem; }
.pf .up { color: var(--pf-up) !important; }
.pf .down { color: var(--pf-down) !important; }
.pf-change { font-weight: 700; font-variant-numeric: tabular-nums; }

.pf-chart { position: relative; height: 280px; }
.pf-seg { display: inline-flex; margin-top: 1rem; padding: .2rem; border: 1px solid var(--pf-line); border-radius: 10px; background: var(--pf-inset); }
.pf-seg button, .pf-tabs button {
    border: 0; background: transparent; color: var(--pf-dim); font: inherit; font-size: .8rem; font-weight: 700;
    padding: .35rem .8rem; border-radius: 7px; cursor: pointer; transition: color .15s, background .15s;
}
.pf-seg button:hover, .pf-tabs button:hover { color: var(--pf-strong); }
.pf-seg button.active, .pf-tabs button.active { background: var(--pf-gold-soft); color: var(--pf-gold); }
.pf-tabs { display: inline-flex; gap: .25rem; }
.pf-tabs span { color: inherit; opacity: .7; margin-left: .15rem; }
.pf-select { background: var(--pf-inset); color: var(--pf-text); border: 1px solid var(--pf-line); border-radius: 8px; padding: .3rem .5rem; font: inherit; font-size: .85rem; }

.pf-table-wrap { max-height: 420px; overflow: auto; margin: 0 -.4rem; }
.pf-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.pf-table th { position: sticky; top: 0; background: var(--pf-panel); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--pf-dim); font-weight: 700; text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--pf-line); white-space: nowrap; }
.pf-table td { padding: .65rem .4rem; border-bottom: 1px solid var(--pf-line); white-space: nowrap; }
.pf-table tr:hover td { background: var(--pf-hover); }
.pf-table .r { text-align: right; }
.pf-table .sym { font-weight: 800; color: var(--pf-strong); letter-spacing: .02em; }
.pf-table td small { display: block; margin: 0; }
.pf-tag { font-size: .65rem; font-weight: 700; text-transform: uppercase; color: var(--pf-gold); border: 1px solid currentColor; border-radius: 4px; padding: 0 .3rem; margin-left: .3rem; }
.pf-none { text-align: center !important; color: var(--pf-dim); font-style: italic; padding: 2rem .4rem !important; }

.pf-watch { list-style: none; margin: 0; padding: 0; max-height: 480px; overflow: auto; }
.pf-watch li { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--pf-line); font-variant-numeric: tabular-nums; }
.pf-watch li > span { display: flex; flex-direction: column; min-width: 0; }
.pf-watch li b { color: var(--pf-strong); font-weight: 800; letter-spacing: .02em; }
.pf-watch li small { margin: 0; color: var(--pf-dim); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12rem; }
.pf-watch .r { text-align: right; align-items: flex-end; font-weight: 700; }
.pf-foot { color: var(--pf-dim); font-size: .78rem; margin: 1.5rem 0 0; }

/* Profile menu */
.profile-btn { border: 0; background: transparent; padding: .15rem; border-radius: 50%; cursor: pointer; }
.profile-avatar {
    display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
    background: var(--ink); color: var(--accent-on-ink); font-weight: 800; font-size: .9rem;
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent);
}
.profile-btn:hover .profile-avatar { background: var(--ink-raised); }
.profile-menu { min-width: 240px; padding: .4rem; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); background: #fff; }
.profile-who { padding: .6rem .75rem .7rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.profile-label { display: block; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.profile-email { display: block; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.profile-menu form { margin: 0; }
.profile-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: .55rem .75rem; border-radius: 8px; font: inherit; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.profile-item:hover { background: var(--bg-alt); color: var(--ink); }
@media (max-width: 767.98px) { .profile { align-self: flex-start; } }

/* Settings modal */
.settings { border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem; background: #fff; color: var(--ink-soft); box-shadow: var(--shadow); }
.settings-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.settings-head h2 { font-size: 1.35rem; margin: 0; }
.settings-close { border: 0; background: transparent; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; }
.settings-close:hover { color: var(--ink); }
.settings-section { font-size: .72rem !important; letter-spacing: .16em; text-transform: uppercase; color: var(--muted) !important; margin: 1.25rem 0 .7rem !important; }
.theme-choice { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.theme-choice label { position: relative; display: flex; flex-direction: column; gap: .5rem; padding: .7rem; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 700; color: var(--ink); }
.theme-choice input { position: absolute; opacity: 0; pointer-events: none; }
.theme-choice label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168, 132, 63, .2); }
.theme-choice label:has(input:focus-visible) { outline: 3px solid rgba(168, 132, 63, .55); outline-offset: 2px; }
.theme-swatch { display: block; height: 56px; border-radius: 8px; border: 1px solid var(--line); }
.theme-swatch-light { background: linear-gradient(180deg, #fff 0 30%, var(--bg-alt) 30%); }
.theme-swatch-dark { background: linear-gradient(180deg, var(--ink) 0 30%, #121826 30%); border-color: rgba(217, 188, 122, .35); }
.settings-status { font-size: .82rem; color: var(--muted); min-height: 1.2em; margin: .5rem 0 0; }
.settings-alpaca { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.settings-key { font-family: var(--mono); color: var(--ink); }
.settings-link { margin-left: auto; font-weight: 700; color: var(--accent-dark); text-decoration: none; }
.settings-link:hover { color: var(--ink); }
.env-badge { padding: .2rem .6rem; border-radius: 999px; font-weight: 800; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; }
.env-paper { background: var(--accent-soft); color: var(--accent-dark); }
.env-live { background: #fef3f2; color: var(--danger); }

/* Dark theme: the navbar, menus, and modal (the portfolio sets its own colours above) */
[data-theme="dark"] body { background: var(--ink); }
[data-theme="dark"] .site-header { background: rgba(11, 15, 23, .92); border-bottom-color: rgba(255, 255, 255, .07); }
[data-theme="dark"] .brand, [data-theme="dark"] .brand:hover { color: #fff; }
[data-theme="dark"] .brand-mark .af-fg { fill: #fff; }
[data-theme="dark"] .brand-mark .af-ac { fill: var(--accent-on-ink); }
[data-theme="dark"] .site-header .nav-link { color: var(--mist); }
[data-theme="dark"] .site-header .nav-link:hover, [data-theme="dark"] .site-header .nav-link.active { color: #fff; background: rgba(255, 255, 255, .06); }
[data-theme="dark"] .navbar-toggler { filter: invert(1); }
[data-theme="dark"] .nav-actions { border-top-color: rgba(255, 255, 255, .07); }
[data-theme="dark"] .profile-avatar { background: #1c2230; box-shadow: 0 0 0 2px var(--ink), 0 0 0 3px var(--accent-on-ink); }
[data-theme="dark"] .profile-menu, [data-theme="dark"] .settings { background: #121826; border-color: rgba(255, 255, 255, .08); color: #c9ced8; }
[data-theme="dark"] .profile-who { border-bottom-color: rgba(255, 255, 255, .08); }
[data-theme="dark"] .profile-email, [data-theme="dark"] .settings-head h2, [data-theme="dark"] .theme-choice label, [data-theme="dark"] .settings-key { color: #fff; }
[data-theme="dark"] .profile-item { color: #c9ced8; }
[data-theme="dark"] .profile-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
[data-theme="dark"] .theme-choice label { border-color: rgba(255, 255, 255, .1); }
[data-theme="dark"] .settings-link { color: var(--accent-on-ink); }
[data-theme="dark"] .settings-link:hover, [data-theme="dark"] .settings-close:hover { color: #fff; }
[data-theme="dark"] .env-paper { background: rgba(217, 188, 122, .14); color: var(--accent-on-ink); }
[data-theme="dark"] .env-live { background: rgba(229, 72, 77, .15); color: #ff8589; }
[data-theme="dark"] .modal-backdrop.show { opacity: .7; }

/* Admin-only marker: shown next to anything only super admins can see */
.admin-badge {
    display: inline-flex; align-items: center; gap: .3rem; vertical-align: middle;
    padding: .1rem .45rem; border-radius: 999px; border: 1px solid rgba(168, 132, 63, .5);
    background: var(--accent-soft); color: var(--accent-dark);
    font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; line-height: 1.4; white-space: nowrap;
}
.admin-badge::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }
.hero .admin-badge, .cta-band .admin-badge, [data-theme="dark"] .admin-badge { background: rgba(217, 188, 122, .14); color: var(--accent-on-ink); border-color: rgba(217, 188, 122, .45); }

/* Dark theme for every other page: surfaces and text swap, obsidian bands and buttons stay as they are */
[data-theme="dark"] {
    --bg: #0b0f17; --bg-alt: #0f1420; --surface: #121826; --text-strong: #ffffff;
    --ink-soft: #c9ced8; --muted: #8a93a3; --line: rgba(255, 255, 255, .08); --field-line: rgba(255, 255, 255, .16);
    --accent-dark: #d9bc7a; --accent-soft: rgba(217, 188, 122, .14);
    --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 16px 40px rgba(0, 0, 0, .35);
}
[data-theme="dark"] .btn-ft-primary { background: var(--accent-on-ink); color: var(--ink); }
[data-theme="dark"] .btn-ft-primary:hover { background: #e6cf98; color: var(--ink); }
[data-theme="dark"] .prose pre { background: #070a10; border: 1px solid var(--line); }
[data-theme="dark"] .form-alert ul, [data-theme="dark"] .form-alert-box { background: rgba(229, 72, 77, .12); border-color: rgba(229, 72, 77, .35); color: #ff8589; }
[data-theme="dark"] .key-kind-live { background: rgba(229, 72, 77, .15); color: #ff8589; }
[data-theme="dark"] .step-num { background: var(--accent-soft); }
[data-theme="dark"] .hero, [data-theme="dark"] .cta-band { border-color: rgba(217, 188, 122, .2); }

/* Research (admin shell): reuses the portfolio panels and follows the site theme */
.rs-search { position: relative; display: flex; gap: .6rem; max-width: 760px; }
.rs-search-icon { position: absolute; left: 1rem; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--pf-dim); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.rs-input {
    flex: 1; min-width: 0; padding: .85rem 1rem .85rem 2.8rem; font: inherit; font-size: 1.05rem;
    border: 1px solid var(--pf-line); border-radius: 12px; background: var(--pf-panel); color: var(--pf-strong); box-shadow: var(--pf-shadow);
}
.rs-input:focus { outline: none; border-color: var(--pf-gold); box-shadow: 0 0 0 3px var(--pf-gold-soft); }
.rs-hint { color: var(--pf-dim); font-size: .85rem; margin: .6rem 0 1.75rem; }
.rs-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.25rem; }
@media (max-width: 991.98px) { .rs-grid { grid-template-columns: 1fr; } }
.rs-company { display: flex; align-items: baseline; gap: .8rem; margin-bottom: 1.25rem; }
.rs-ticker { font-size: 1.8rem; font-weight: 800; color: var(--pf-strong); letter-spacing: .02em; }
.rs-name { color: var(--pf-dim); }
.rs-kpis { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 575.98px) { .rs-kpis { grid-template-columns: 1fr 1fr; } }
.rs-metrics { margin: 0; }
.rs-metrics div { display: flex; justify-content: space-between; padding: .65rem 0; border-bottom: 1px solid var(--pf-line); }
.rs-metrics div:last-child { border-bottom: 0; }
.rs-metrics dt { font-weight: 500; color: var(--pf-text); }
.rs-metrics dd { margin: 0; font-weight: 700; color: var(--pf-strong); font-variant-numeric: tabular-nums; }

/* Research type-ahead (autoComplete.js: wraps the input in .autoComplete_wrapper) */
.rs-search .autoComplete_wrapper { position: relative; flex: 1; min-width: 0; display: flex; }
.rs-search .autoComplete_wrapper > .rs-input { width: 100%; }
.rs-search-icon { z-index: 1; }
.rs-suggest {
    position: absolute; top: calc(100% + .35rem); left: 0; right: 0; z-index: 20; list-style: none; margin: 0; padding: .35rem;
    background: var(--pf-panel); border: 1px solid var(--pf-line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
    max-height: 22rem; overflow-y: auto;
}
.rs-suggest[hidden] { display: none; }
.rs-suggest li { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: .75rem; align-items: baseline; padding: .55rem .7rem; border-radius: 8px; cursor: pointer; }
.rs-suggest li b { color: var(--pf-strong); font-weight: 800; }
.rs-suggest li span { color: var(--pf-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-suggest li small { color: var(--pf-dim); font-size: .72rem; letter-spacing: .08em; margin: 0; }
.rs-suggest li:hover, .rs-suggest li[aria-selected="true"] { background: var(--pf-gold-soft); }
.rs-suggest li.rs-suggest-empty { display: block; color: var(--pf-dim); cursor: default; font-style: italic; }
.rs-suggest li.rs-suggest-empty:hover { background: transparent; }

/* Research: write an analysis */
.rs-write { grid-column: 1 / -1; }
.rs-write form { display: flex; flex-direction: column; gap: .35rem; max-width: 860px; }
.rs-write .pf-label { margin-top: .9rem; }
.rs-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 575.98px) { .rs-form-row { grid-template-columns: 1fr; } }
.rs-field {
    width: 100%; padding: .7rem .85rem; font: inherit; border: 1px solid var(--pf-line); border-radius: 10px;
    background: var(--pf-inset); color: var(--pf-strong); resize: vertical;
}
.rs-field:focus { outline: none; border-color: var(--pf-gold); box-shadow: 0 0 0 3px var(--pf-gold-soft); }
.rs-money { display: flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--pf-dim); }
.rs-field-hint, .rs-count { display: block; font-size: .8rem; color: var(--pf-dim); margin-top: .25rem; }
.rs-count { text-align: right; font-variant-numeric: tabular-nums; }
.rs-visibility { border: 0; padding: 0; margin: .5rem 0 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.rs-visibility legend { grid-column: 1 / -1; }
.rs-visibility label { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem; border: 1px solid var(--pf-line); border-radius: 10px; cursor: pointer; color: var(--pf-dim); font-size: .88rem; }
.rs-visibility label:has(input:checked) { border-color: var(--pf-gold); background: var(--pf-gold-soft); }
.rs-visibility b { display: block; color: var(--pf-strong); }
.rs-visibility input { accent-color: var(--accent); margin-top: .25rem; }
.rs-write button[type="submit"] { align-self: flex-start; }

/* Analysis cards (Community Analysis and My analysis) */
.an-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.25rem; }
.an-mine { margin-top: 1.25rem; }
.an-mine .an-list { gap: 1rem; }
.an-mine .an-card { box-shadow: none; }
.an-mine [data-count-analyses] { opacity: .7; margin-left: .25rem; }
.an-card { display: flex; flex-direction: column; gap: .9rem; background: var(--pf-panel); border: 1px solid var(--pf-line); border-radius: 16px; padding: 1.3rem; box-shadow: var(--pf-shadow); height: 100%; }
.an-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.an-symbol { display: block; font-size: 1.5rem; font-weight: 800; letter-spacing: .02em; color: var(--pf-strong); text-decoration: none; }
.an-symbol:hover { color: var(--pf-gold); }
.an-by { display: block; font-size: .8rem; color: var(--pf-dim); }
.an-vis { font-size: .65rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: .2rem .55rem; border-radius: 999px; }
.an-public { background: var(--pf-gold-soft); color: var(--pf-gold); }
.an-private { background: var(--pf-inset); color: var(--pf-dim); border: 1px solid var(--pf-line); }
.an-prices { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0; padding: .8rem 0; border-top: 1px solid var(--pf-line); border-bottom: 1px solid var(--pf-line); }
.an-prices dt { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--pf-dim); font-weight: 700; }
.an-prices dd { margin: .15rem 0 0; font-weight: 800; color: var(--pf-strong); font-variant-numeric: tabular-nums; }
.an-prices small { display: block; margin: 0; font-size: .75rem; }
.an-conviction { margin: 0; color: var(--pf-strong); font-weight: 600; line-height: 1.55; }
.an-body summary { cursor: pointer; font-weight: 700; font-size: .85rem; color: var(--pf-gold); }
.an-text { margin-top: .75rem; color: var(--pf-text); white-space: pre-line; line-height: 1.65; font-size: .92rem; }
.an-empty h2 { font-size: 1.2rem; }
.an-empty p { color: var(--pf-dim); margin: 0; }
.an-filter { display: flex; align-items: center; gap: .6rem; }
.an-filter-input { padding-left: 1rem; width: 14rem; font-size: .95rem; }
.an-clear { color: var(--pf-gold); font-weight: 700; text-decoration: none; }

/* Settings: data tools */
.settings-sync { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.settings-sync b { display: block; color: var(--text-strong); }
.settings-sync .muted { display: block; font-size: .82rem; }
[data-theme="dark"] .settings .btn-ft-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .2); }

/* Mobile: the profile menu opens inline inside the collapsed navbar; Settings fits the screen */
.profile-btn-label { display: none; }
@media (max-width: 767.98px) {
    .profile { width: 100%; }
    .profile-btn {
        display: flex; align-items: center; gap: .75rem; width: 100%; padding: .5rem .8rem; border-radius: 10px;
        font: inherit; font-weight: 600; color: var(--ink-soft); text-align: left;
    }
    .profile-btn-label { display: inline; }
    .profile-btn[aria-expanded="true"] { background: var(--bg-alt); }
    .profile .profile-menu {
        position: static !important; transform: none !important; inset: auto !important;
        width: 100%; min-width: 0; margin-top: .35rem; box-shadow: none;
    }
    .profile-item { padding: .8rem .9rem; }

    #settingsModal .modal-dialog { margin: .75rem; }
    .settings { padding: 1.25rem; border-radius: 18px; }
    .settings-sync { flex-direction: column; align-items: stretch; }
    .settings-sync .btn-ft { width: 100%; }
    .settings-alpaca .settings-link { margin-left: 0; }
    .theme-swatch { height: 44px; }
}
[data-theme="dark"] .profile-btn { color: var(--mist); }
@media (max-width: 767.98px) {
    [data-theme="dark"] .profile-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .06); color: #fff; }
}

/* Onboarding: step indicator, Alpaca help link and instructions */
.onboard-steps { display: flex; gap: .4rem; list-style: none; padding: 0; margin: 0 0 1.25rem; counter-reset: step; }
.onboard-steps li {
    flex: 1; counter-increment: step; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted); padding-top: .55rem; border-top: 3px solid var(--line);
}
.onboard-steps li::before { content: counter(step) ". "; }
.onboard-steps li.done { color: var(--accent-dark); border-top-color: var(--accent); }
.onboard-steps li.current { color: var(--text-strong); border-top-color: var(--text-strong); }
.alpaca-help { display: flex; flex-direction: column; align-items: center; gap: .5rem; margin: 0 0 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.alpaca-help-link { border: 0; background: transparent; padding: 0; font: inherit; font-size: .9rem; font-weight: 700; color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.alpaca-help-link:hover { color: var(--text-strong); }
.help-steps { padding-left: 1.2rem; margin: 0; color: var(--ink-soft); font-size: .92rem; }
.help-steps li { margin-bottom: .45rem; }
.help-steps b { color: var(--text-strong); }
.help-note { margin: 1rem 0 0; padding: .75rem .9rem; border-radius: 10px; background: var(--accent-soft); color: var(--text-strong); font-size: .85rem; }
[data-theme="dark"] .help-steps { color: #c9ced8; }
[data-theme="dark"] .help-steps b, [data-theme="dark"] .help-note { color: #fff; }

/* Busy buttons: a spinner before the label; the button ignores presses until the next page loads */
.is-busy { pointer-events: none; cursor: progress; opacity: .85; }
.is-busy::before {
    content: ""; display: inline-block; width: 1em; height: 1em; margin-right: .5em; vertical-align: -.15em;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: busy-spin .7s linear infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .is-busy::before { animation-duration: 2s; } }

/* Edit analysis: the fields that are final at posting */
.an-fixed { grid-template-columns: repeat(4, 1fr); margin-bottom: 1rem; }
@media (max-width: 575.98px) { .an-fixed { grid-template-columns: 1fr 1fr; } }
.an-lock a { color: var(--pf-gold); font-weight: 700; }
.an-untracked { background: transparent; color: var(--pf-dim); border: 1px dashed var(--pf-line); }

/* Roadmap features: navbar dropdown and preview pages */
.nav-menu-btn { border: 0; background: transparent; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.nav-menu-btn::after { content: ""; width: .4rem; height: .4rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: .2rem; opacity: .7; }
.nav-menu-list { min-width: 280px; right: auto; left: 0; max-height: 70vh; overflow-y: auto; }
.nav-menu-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-decoration: none; }
.nav-menu-all { text-decoration: none; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: .3rem; color: var(--accent-dark) !important; font-weight: 700; }
[data-theme="dark"] .nav-menu-all { border-top-color: rgba(255, 255, 255, .08); color: var(--accent-on-ink) !important; }
@media (max-width: 767.98px) {
    .nav-menu { width: 100%; }
    .nav-menu-btn { width: 100%; justify-content: flex-start; }
    .nav-menu .nav-menu-list { position: static !important; transform: none !important; inset: auto !important; width: 100%; min-width: 0; box-shadow: none; max-height: none; }
}
.rm-status { font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 999px; white-space: nowrap; }
.rm-live { background: rgba(63, 182, 139, .15); color: #0f7a55; }
.rm-next { background: var(--accent-soft); color: var(--accent-dark); }
.rm-planned { background: transparent; color: var(--muted); border: 1px solid var(--line); }
[data-theme="dark"] .rm-live { color: #3fb68b; }
[data-theme="dark"] .rm-next { color: var(--accent-on-ink); }
.rm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.rm-card { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; text-decoration: none; color: var(--pf-text); transition: border-color .15s; }
.rm-card:hover { border-color: var(--pf-gold); color: var(--pf-text); }
.rm-card h2 { font-size: 1.2rem; margin: 0; }
.rm-card p { margin: 0; color: var(--pf-dim); font-size: .92rem; }
.rm-detail { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.25rem; }
@media (max-width: 991.98px) { .rm-detail { grid-template-columns: 1fr; } }
.rm-side { display: flex; flex-direction: column; gap: 1.25rem; }
.rm-summary { font-size: 1.15rem; color: var(--pf-strong); font-weight: 600; margin: .9rem 0 1.5rem; }
.rm-list { margin: 0; padding-left: 1.1rem; color: var(--pf-text); }
.rm-list li { margin-bottom: .5rem; }
.rm-inspo { margin: 0; color: var(--pf-text); }

/* Strategies: cards, detail modal, and the create/edit form */
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.st-card {
    display: flex; flex-direction: column; gap: .45rem; width: 100%; text-align: left; font: inherit; cursor: pointer;
    background: var(--pf-panel); color: var(--pf-text); border: 1px solid var(--pf-line); border-radius: 14px; padding: 1.1rem 1.2rem;
    transition: border-color .15s, transform .15s;
}
.st-card:hover, .st-card:focus-visible { border-color: var(--pf-gold); transform: translateY(-1px); }
.st-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.st-card-name { font-weight: 800; font-size: 1.05rem; color: var(--pf-strong); }
.st-card-desc { color: var(--pf-dim); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-card-meta { display: flex; flex-wrap: wrap; gap: .3rem; font-size: .78rem; color: var(--pf-dim); }
.st-count { opacity: .7; margin-left: .25rem; }
.st-modal-desc { margin: 0 0 .5rem; color: var(--ink-soft); }
.st-cond-list { margin: 0; padding-left: 1.2rem; color: var(--text-strong); font-weight: 600; }
.st-cond-list li { margin-bottom: .35rem; }
.st-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin: 1rem 0 0; padding: .9rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (max-width: 575.98px) { .st-facts { grid-template-columns: 1fr 1fr; } }
.st-facts dt { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.st-facts dd { margin: .15rem 0 0; font-weight: 700; color: var(--text-strong); }
.st-muted { color: var(--muted); margin: 0; }
.st-run { margin: 0; padding: .75rem .9rem; border-radius: 10px; font-size: .88rem; color: var(--ink-soft); background: var(--bg-alt); }
.st-run b { color: var(--text-strong); }
.st-run-unavailable { background: var(--accent-soft); }
.st-run-failed { background: rgba(229, 72, 77, .1); }
.st-picks { list-style: none; padding: 0; margin: .75rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .4rem; }
.st-picks li { display: flex; gap: .5rem; align-items: baseline; font-size: .88rem; }
.st-picks a { text-decoration: none; color: var(--text-strong); }
.st-picks span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-modal-actions { display: flex; gap: .75rem; align-items: center; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.st-modal-actions form { margin: 0; }
[data-theme="dark"] .st-modal-desc, [data-theme="dark"] .st-run { color: #c9ced8; }
[data-theme="dark"] .st-cond-list, [data-theme="dark"] .st-facts dd, [data-theme="dark"] .st-run b, [data-theme="dark"] .st-picks a { color: #fff; }
[data-theme="dark"] .st-facts { border-color: rgba(255, 255, 255, .08); }
[data-theme="dark"] .st-modal-actions { border-top-color: rgba(255, 255, 255, .08); }

.st-form { display: flex; flex-direction: column; gap: 1.25rem; max-width: 900px; }
.st-form .pf-label { margin-top: .9rem; display: block; }
.st-form .pf-title + .pf-label { margin-top: 0; }
.st-name { font-size: 1.15rem; font-weight: 700; }
.st-optional { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: .8; }
.st-help { color: var(--pf-dim); font-size: .88rem; margin: 0 0 1rem; }
.st-help b { color: var(--pf-strong); }
.st-rules { display: flex; flex-direction: column; gap: .6rem; }
.st-rule { display: grid; grid-template-columns: 3.5rem minmax(0, 2.2fr) minmax(0, 1.3fr) minmax(0, 1.2fr) 2.2rem; gap: .5rem; align-items: center; padding: .6rem; border: 1px solid var(--pf-line); border-radius: 12px; background: var(--pf-inset); }
.st-rule-num { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--pf-gold); text-align: center; }
.st-rule .rs-field { background: var(--pf-panel); padding: .55rem .6rem; }
.st-value { display: flex; align-items: center; gap: .35rem; font-weight: 700; color: var(--pf-dim); }
.st-remove { border: 0; background: transparent; color: var(--pf-dim); font-size: 1.4rem; line-height: 1; cursor: pointer; border-radius: 8px; height: 2.2rem; }
.st-remove:hover { color: var(--pf-down); background: var(--pf-hover); }
.st-hint { grid-column: 2 / -1; color: var(--pf-dim); font-size: .75rem; margin-top: -.2rem; }
.st-empty { color: var(--pf-dim); font-style: italic; margin: 0; }
.st-add { align-self: flex-start; margin-top: .75rem; border: 1px dashed var(--pf-gold); background: transparent; color: var(--pf-gold); font: inherit; font-weight: 700; padding: .5rem 1rem; border-radius: 10px; cursor: pointer; }
.st-add:hover { background: var(--pf-gold-soft); }
.st-rank { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; margin-top: .5rem; padding-top: .75rem; border-top: 1px solid var(--pf-line); }
.st-limit { display: flex; align-items: center; gap: .5rem; color: var(--pf-dim); }
.st-json { margin-top: 1rem; }
.st-json summary { cursor: pointer; font-size: .8rem; font-weight: 700; color: var(--pf-dim); }
.st-json pre { margin: .5rem 0 0; padding: .8rem 1rem; border-radius: 10px; background: var(--pf-inset); color: var(--pf-text); font-size: .8rem; max-height: 16rem; overflow: auto; }
.st-schedule { display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem; }
.st-schedule label { position: relative; }
.st-schedule input { position: absolute; opacity: 0; pointer-events: none; }
.st-schedule span { display: block; text-align: center; padding: .65rem .4rem; border: 1px solid var(--pf-line); border-radius: 10px; font-weight: 700; font-size: .85rem; color: var(--pf-dim); cursor: pointer; }
.st-schedule input:checked + span { border-color: var(--pf-gold); background: var(--pf-gold-soft); color: var(--pf-gold); }
.st-schedule input:focus-visible + span { outline: 3px solid rgba(168, 132, 63, .55); outline-offset: 2px; }
@media (max-width: 767.98px) {
    .st-schedule { grid-template-columns: repeat(3, 1fr); }
    .st-rank { grid-template-columns: 1fr 1fr; }
    .st-rank > :first-child { grid-column: 1 / -1; }
    .st-rule { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 2.2rem; }
    .st-rule-num { grid-column: 1 / -1; text-align: left; }
    .st-rule [data-field="metric"] { grid-column: 1 / -1; }
    .st-hint { grid-column: 1 / -1; }
}

/* Portfolio value card: KPIs beside the My holdings doughnut */
.pf-value-grid { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 1.25rem; align-items: center; }
/* Size by the card, not the viewport: on desktop the card is half-width, so stack before the numbers run into the doughnut */
.pf-card:has(> .pf-value-grid) { container-type: inline-size; }
.pf-value-grid .pf-kpis > div { min-width: 0; }
.pf-value-grid .pf-big, .pf-value-grid .pf-mid { overflow-wrap: anywhere; }
@container (max-width: 640px) { .pf-value-grid { grid-template-columns: 1fr; } }
.pf-holdings-chart { position: relative; width: 180px; height: 180px; margin: 0 auto; }
.pf-holdings-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.pf-holdings-center b { font-size: 1.6rem; font-weight: 800; color: var(--pf-strong); line-height: 1; }
.pf-holdings-center small { margin: .2rem 0 0; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--pf-dim); font-weight: 700; }

/* Pies: cards, builder, and deploy modal */
.pie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.pie-card { display: flex; flex-direction: column; background: var(--pf-panel); border: 1px solid var(--pf-line); border-radius: 14px; overflow: hidden; transition: border-color .15s; }
.pie-card:hover { border-color: var(--pf-gold); }
.pie-card-open { display: flex; flex-direction: column; gap: .35rem; padding: 1.05rem 1.1rem .5rem; border: 0; background: transparent; text-align: left; font: inherit; color: var(--pf-text); cursor: pointer; }
.pie-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.pie-card-tickers { font-size: .8rem; font-weight: 700; color: var(--pf-gold); }
.pie-card-tickers em { color: var(--pf-dim); font-style: normal; font-weight: 500; }
.pie-card-chart { display: block; width: 130px; height: 130px; margin: .5rem auto 0; }
.pie-card-actions { display: flex; gap: .5rem; padding: .75rem 1.1rem 1.1rem; }
.pie-card-actions .btn-ft-primary { flex: 1; }
.pie-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c, var(--pf-gold)); flex: 0 0 auto; }

.pie-builder { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.25rem; margin-bottom: 1.25rem; }
@media (max-width: 991.98px) { .pie-builder { grid-template-columns: 1fr; } }
.pie-desc-input { width: 100%; resize: vertical; min-height: 4.5rem; }
.pie-desc-count { display: block; text-align: right; font-size: .75rem; color: var(--pf-dim); margin-top: .25rem; }
.pie-view-desc { margin: 0; padding: 1rem 1.5rem; border-bottom: 1px solid var(--pf-line); color: var(--pf-text); white-space: pre-line; overflow-wrap: anywhere; }
.pie-add-label { margin-top: 1.1rem !important; }
.pie-search .autoComplete_wrapper { position: relative; display: block; }
.pie-search .rs-input { width: 100%; padding-left: 1rem; }
.pie-search .rs-suggest { right: 0; }
.pie-rows { display: flex; flex-direction: column; gap: .5rem; margin-top: .9rem; }
.pie-row { display: grid; grid-template-columns: .6rem 4.5rem minmax(0, 1fr) 6.5rem 2.2rem; gap: .6rem; align-items: center; padding: .55rem .7rem; border: 1px solid var(--pf-line); border-left: 3px solid var(--c); border-radius: 10px; background: var(--pf-inset); }
.pie-row b { color: var(--pf-strong); font-weight: 800; }
.pie-row-name { color: var(--pf-dim); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pie-pct { display: flex; align-items: center; gap: .3rem; color: var(--pf-dim); font-weight: 700; }
.pie-pct .rs-field { padding: .45rem .5rem; text-align: right; background: var(--pf-panel); }
.pie-total { margin-top: 1.1rem; }
.pie-total-head { display: flex; justify-content: space-between; align-items: center; color: var(--pf-text); font-size: .9rem; }
.pie-total-head b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.pie-even { margin-left: .5rem; border: 1px solid var(--pf-line); background: transparent; color: var(--pf-gold); font: inherit; font-size: .75rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; cursor: pointer; }
.pie-bar { height: 6px; border-radius: 999px; background: var(--pf-line); margin: .5rem 0 .35rem; overflow: hidden; }
.pie-bar span { display: block; height: 100%; width: 0; background: var(--pf-gold); border-radius: 999px; transition: width .2s; }
.pie-bar span.ok { background: var(--pf-up); }
.pie-bar span.over { background: var(--pf-down); }
.pie-total-note { display: block; text-align: right; font-size: .78rem; color: var(--pf-dim); }
.pie-preview { display: flex; flex-direction: column; }
.pie-chart { position: relative; height: 260px; margin-bottom: 1rem; }
.pie-legend { list-style: none; margin: 0; padding: 0; }
.pie-legend li, .pd-list li { display: grid; grid-template-columns: .6rem 4rem minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .35rem 0; font-size: .88rem; }
.pie-legend b, .pd-list b { color: var(--pf-strong); }
.pie-legend span, .pd-list span { color: var(--pf-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pie-legend em, .pd-list em { font-style: normal; font-weight: 700; color: var(--pf-strong); font-variant-numeric: tabular-nums; }
.pie-delete { margin-top: 1.5rem; }
.pie-delete-btn { border: 0; background: transparent; padding: 0; color: var(--pf-down) !important; cursor: pointer; font: inherit; font-weight: 700; }

.pd-name { color: var(--accent-dark); }
[data-theme="dark"] .pd-name { color: var(--accent-on-ink); }
.pd-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: 1rem; }
.pd-kpis > div { padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 12px; }
.pd-kpis b { display: block; font-size: 1.15rem; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.pd-funding { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.pd-funding .pf-tabs button { color: var(--muted); }
.pd-funding .pf-tabs button.active { background: var(--accent-soft); color: var(--accent-dark); }
.pd-option { display: flex; flex-direction: column; gap: .3rem; width: 100%; text-align: left; font: inherit; color: var(--ink-soft); background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; margin: .5rem 0; cursor: pointer; }
.pd-option > b { color: var(--text-strong); }
.pd-option > span { font-size: .85rem; }
.pd-option.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168, 132, 63, .2); }
.pd-danger.selected { border-color: #e5484d; box-shadow: 0 0 0 3px rgba(229, 72, 77, .18); }
.pd-list { list-style: none; margin: .5rem 0 0; padding: .4rem .8rem; border-radius: 10px; background: var(--bg-alt); }
.pd-list li { grid-template-columns: .6rem 4rem minmax(0, 1fr) 3rem 6.5rem; }
.pd-list strong { text-align: right; font-variant-numeric: tabular-nums; }
.pd-list strong.up { color: #0f7a55; }
.pd-list strong.gold { color: var(--accent-dark); }
.pie-view-list li { grid-template-columns: .6rem 4rem minmax(0, 1fr) auto; }
.pd-live { margin: 1rem 0 0; padding: .75rem .9rem; border-radius: 10px; background: rgba(229, 72, 77, .1); }
.pd-note { font-size: .78rem; color: var(--muted); margin: .9rem 0 0; }
.pd-working { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text-strong); }
.pd-result { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem; border-radius: 12px; }
.pd-result.ok { background: rgba(63, 182, 139, .12); color: #0f7a55; }
.pd-result.bad { background: rgba(229, 72, 77, .1); color: #c2362f; }
.pd-orders { list-style: none; margin: .75rem 0 0; padding: 0; }
.pd-orders li { display: grid; grid-template-columns: 4.5rem 1fr; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.pd-orders li.up b { color: #0f7a55; }
.pd-orders li.down b { color: #c2362f; }
.pd-orders li span { color: var(--ink-soft); }
@media (max-width: 575.98px) {
    .pd-kpis { grid-template-columns: 1fr; }
    .pd-list li { grid-template-columns: .6rem 3.5rem minmax(0, 1fr) 5.5rem; }
    .pd-list li em { display: none; }
    .pie-row { grid-template-columns: .6rem 4rem minmax(0, 1fr) 5.5rem 2rem; }
    .pie-row-name { display: none; }
}
[data-theme="dark"] .pd-kpis > div, [data-theme="dark"] .pd-option { border-color: rgba(255, 255, 255, .1); }
[data-theme="dark"] .pd-kpis b, [data-theme="dark"] .pd-option > b, [data-theme="dark"] .pd-working { color: #fff; }
[data-theme="dark"] .pd-option { color: #c9ced8; }
[data-theme="dark"] .pd-list { background: rgba(0, 0, 0, .25); }
[data-theme="dark"] .pd-list b, [data-theme="dark"] .pd-list em { color: #fff; }
[data-theme="dark"] .pd-list span { color: #8a93a3; }
[data-theme="dark"] .pd-list strong.up, [data-theme="dark"] .pd-result.ok, [data-theme="dark"] .pd-orders li.up b { color: #3fb68b; }
[data-theme="dark"] .pd-list strong.gold { color: var(--accent-on-ink); }
[data-theme="dark"] .pd-result.bad, [data-theme="dark"] .pd-orders li.down b { color: #ff8589; }
[data-theme="dark"] .pd-orders li { border-bottom-color: rgba(255, 255, 255, .08); }
[data-theme="dark"] .pd-orders li span { color: #c9ced8; }
[data-theme="dark"] .pd-funding .pf-tabs button.active { background: rgba(217, 188, 122, .16); color: var(--accent-on-ink); }

/* Signed-out theme switch: a small round button, bottom right. Shows the sun in dark mode (click
   for light) and the moon in light mode (click for dark). */
.theme-fab {
    position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 60; width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center; cursor: pointer;
    background: var(--surface); color: var(--accent-dark); border: 1px solid var(--line); box-shadow: var(--shadow);
    transition: transform .15s, border-color .15s;
}
.theme-fab:hover { transform: translateY(-2px); border-color: var(--accent); }
.theme-fab svg { width: 20px; height: 20px; }
.theme-fab-sun { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-fab-sun circle { fill: currentColor; }
.theme-fab-moon { fill: currentColor; }
.theme-fab-sun { display: none; }
[data-theme="dark"] .theme-fab { color: var(--accent-on-ink); border-color: rgba(217, 188, 122, .35); }
[data-theme="dark"] .theme-fab-sun { display: block; }
[data-theme="dark"] .theme-fab-moon { display: none; }
@media (max-width: 575.98px) { .theme-fab { right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); } }

/* Earnings calendar */
.ec-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.ec-bar-2 { margin: 1rem 0 .5rem; }
.ec-seg { margin-top: 0; }
.ec-times { margin-left: auto; }
.ec-dates { display: inline-flex; align-items: center; gap: .4rem; }
.ec-dates[hidden] { display: none; }
.ec-date { min-width: 9.5rem; color-scheme: light dark; }
.ec-nav { border: 1px solid var(--pf-line); background: var(--pf-inset); color: var(--pf-text); border-radius: 8px; width: 2rem; height: 2rem; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.ec-nav:hover { color: var(--pf-gold); border-color: var(--pf-gold); }
.ec-today { border: 0; background: none; font-size: .85rem; padding: 0 .2rem; cursor: pointer; }
.ec-search { flex: 1 1 16rem; max-width: 22rem; padding-left: 1rem; }
.ec-range { color: var(--pf-dim); font-size: .85rem; font-weight: 600; }
.ec-refresh { margin-left: auto; }
.ec-state { display: flex; align-items: center; justify-content: center; gap: .75rem; padding: 3rem 0; color: var(--pf-dim); }
.ec-state[hidden] { display: none; }
.ec-table-wrap { max-height: none; }
.ec-table .ec-row { cursor: pointer; }
.ec-table .ec-row:focus-visible td { outline: 2px solid var(--pf-gold); outline-offset: -2px; }
.ec-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.ec-sort:hover { color: var(--pf-strong); }
.ec-sort span { color: var(--pf-gold); }
.ec-company { display: flex; align-items: center; gap: .6rem; }
.ec-name { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; color: var(--pf-dim); font-weight: 500; }
.ec-logo { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: 8px; background: var(--pf-inset); border: 1px solid var(--pf-line); overflow: hidden; font-weight: 800; font-size: .8rem; color: var(--pf-dim); }
.ec-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.ec-logo-lg { width: 2.8rem; height: 2.8rem; font-size: 1.1rem; }
.ec-time, .ec-status { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.ec-bmo { background: rgba(240, 162, 75, .16); color: #d98a2b; }
.ec-amc { background: rgba(108, 140, 255, .16); color: #6c8cff; }
.ec-dmh, .ec-tbd { background: var(--pf-inset); color: var(--pf-dim); }
.ec-reported { background: rgba(63, 182, 139, .16); color: var(--pf-up); }
.ec-upcoming { background: var(--pf-gold-soft); color: var(--pf-gold); }
.ec-missed { background: rgba(229, 72, 77, .14); color: var(--pf-down); }
.ec-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; font-size: .83rem; }
.ec-pager { display: inline-flex; gap: .3rem; }
.ec-page { min-width: 2rem; height: 2rem; border: 1px solid var(--pf-line); background: var(--pf-inset); color: var(--pf-dim); border-radius: 8px; font-weight: 700; font-size: .8rem; cursor: pointer; }
.ec-page.active { background: var(--pf-gold-soft); color: var(--pf-gold); border-color: var(--pf-gold); }
.ec-page:disabled { opacity: .4; cursor: default; }
.ec-modal-head { display: flex; align-items: center; gap: .8rem; }
.ec-modal-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 1.25rem; margin-bottom: 1.5rem; }
.ec-modal-kpis .pf-mid { font-size: 1rem; }
.ec-modal-kpis .pf-mid span { font-size: .8rem; margin-left: .25rem; }
.ec-modal-sub { margin-bottom: .5rem; }
@media (max-width: 767.98px) {
    .ec-times { margin-left: 0; }
    .ec-search { max-width: none; }
    .ec-modal-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* SEC integration plan */
.sp-lede { max-width: 52rem; color: var(--pf-dim); margin: .75rem 0 0; }
.sp-toc { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; padding: .9rem 1.4rem; margin-bottom: 1.25rem; font-size: .85rem; font-weight: 700; }
.sp-toc a { color: var(--pf-gold); text-decoration: none; }
.sp-card { margin-bottom: 1.25rem; scroll-margin-top: 5rem; }
.sp-card h2, .sp-h2 { font-size: 1.3rem; margin: 0 0 .8rem; color: var(--pf-strong); }
.sp-h2 { margin: 2rem 0 1rem; scroll-margin-top: 5rem; }
.sp-card h3 { font-size: 1.02rem; margin: 1.2rem 0 .5rem; color: var(--pf-strong); }
.sp-card h4 { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--pf-dim); margin: 1rem 0 .35rem; }
.sp-card p, .sp-card li { color: var(--pf-text); line-height: 1.6; }
.sp-card ul, .sp-card ol { padding-left: 1.2rem; margin: 0 0 .5rem; }
.sp-card li { margin-bottom: .3rem; }
.sp-card code { font-size: .82em; overflow-wrap: anywhere; }
.sp-callout { border-left: 4px solid var(--pf-gold); }
.sp-note { font-size: .88rem; color: var(--pf-dim) !important; margin: .75rem 0 0; }
.sp-table-wrap { max-height: none; margin-bottom: .5rem; }
.sp-table td { white-space: normal; vertical-align: top; min-width: 8rem; line-height: 1.45; }
.sp-matrix td:first-child { font-weight: 700; color: var(--pf-strong); }
.sp-good { color: var(--pf-up); }
.sp-ok { color: #d98a2b; }
.sp-bad { color: var(--pf-down); }
.sp-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.sp-option { position: relative; margin: 0; }
.sp-option h3 { margin-top: .2rem; padding-right: 2.5rem; font-size: 1.1rem; }
.sp-option h3 small { margin-left: .4rem; padding: .15rem .55rem; border-radius: 999px; background: var(--pf-gold-soft); color: var(--pf-gold); font-size: .7rem; }
.sp-pick { border-color: var(--pf-gold); }
.sp-tag { position: absolute; top: 1.2rem; right: 1.2rem; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--pf-inset); border: 1px solid var(--pf-line); font-weight: 800; color: var(--pf-gold); }
.sp-diagram { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: .5rem 0; font-size: .78rem; font-weight: 700; }
.sp-diagram span { padding: .3rem .6rem; border: 1px solid var(--pf-line); border-radius: 8px; background: var(--pf-inset); color: var(--pf-strong); }
.sp-diagram i { font-style: normal; color: var(--pf-dim); font-weight: 600; }
.sp-diagram .sp-ext, .sp-box.sp-ext { border-style: dashed; }
.sp-arch { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.sp-lane { display: flex; flex-direction: column; gap: .6rem; padding: .9rem; border-radius: 12px; background: var(--pf-inset); }
.sp-lane-label { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--pf-gold); }
.sp-box { padding: .6rem .75rem; border: 1px solid var(--pf-line); border-radius: 10px; background: var(--pf-panel); font-weight: 700; font-size: .88rem; color: var(--pf-strong); }
.sp-box small { display: block; margin: .2rem 0 0 !important; font-weight: 500; font-size: .76rem !important; color: var(--pf-dim); overflow-wrap: anywhere; }
.sp-phases { list-style: none; padding: 0 !important; counter-reset: phase; }
.sp-phases > li { position: relative; padding: 0 0 .5rem 1.4rem; border-left: 2px solid var(--pf-line); margin-left: .4rem; }
.sp-phases > li::before { content: ""; position: absolute; left: -.45rem; top: .35rem; width: .8rem; height: .8rem; border-radius: 50%; background: var(--pf-gold); }
.sp-phases h3 { margin-top: 0; }
.sp-phases h3 span { margin-left: .5rem; font-size: .78rem; font-weight: 600; color: var(--pf-dim); }
@media (max-width: 991.98px) {
    .sp-options { grid-template-columns: 1fr; }
    .sp-arch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575.98px) { .sp-arch { grid-template-columns: 1fr; } }
