/* ==============================================
   Stock Financial Dashboard — Design 1 Dark Glass
   Default: dark. Light overrides at bottom.
   ============================================== */

/* ── Base ─────────────────────────────────── */
.sfd-dashboard-wrapper {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    max-width: 1260px;
    margin: 0 auto;
    padding: 12px;
    font-size: 13px;
    color: #c9d1d9;
    background: #0d1117;
    border-radius: 8px;
}

/* ── Tab bar ─────────────────────────────── */
.sfd-tab-bar {
    display: flex;
    border-bottom: 1px solid rgba(48,54,61,0.8);
    background: rgba(13,17,23,0.6);
    overflow-x: auto;
    flex-shrink: 0;
}
.sfd-tab-bar::-webkit-scrollbar { display: none; }
.sfd-tab {
    padding: 11px 18px;
    font-size: 12px;
    font-weight: 500;
    color: #6e7681;
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    white-space: nowrap;
    transition: color .15s, background .15s, border-color .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: .01em;
    font-family: inherit;
    text-decoration: none;
}
.sfd-tab:hover { color: #c9d1d9; background: rgba(255,255,255,.02); }
.sfd-tab.sfd-tab-active { color: #58a6ff; border-bottom-color: #58a6ff; background: rgba(88,166,255,.04); }
.sfd-tab-link { text-decoration: none !important; }

/* Tab panes */
.sfd-tab-pane { display: none; }
.sfd-tab-pane.sfd-tab-pane-active { display: block; }

/* ── Hero strip ──────────────────────────── */
.sfd-hero-strip {
    display: block;
    padding: 14px 16px;
    background: #0d1117;
    border-bottom: 1px solid rgba(48,54,61,0.6);
}
.sfd-hero-card {
    background: rgba(22,27,34,0.75);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 14px 16px;
    position: relative;
    overflow: hidden;
    transition: border-color .2s, transform .2s;
}
.sfd-hero-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    border-radius: 10px 10px 0 0;
}
.sfd-hero-card:hover { border-color: rgba(88,166,255,.2); transform: translateY(-1px); }
.sfd-hero-blue::after   { background: linear-gradient(90deg,#2563eb,#0ea5e9); }
.sfd-hero-green::after  { background: linear-gradient(90deg,#16a34a,#22c55e); }
.sfd-hero-amber::after  { background: linear-gradient(90deg,#b45309,#f59e0b); }
.sfd-hero-purple::after { background: linear-gradient(90deg,#7c3aed,#a78bfa); }
.sfd-hero-label { font-size: 10px; color: #6e7681; margin-bottom: 6px; letter-spacing: .03em; text-transform: uppercase; font-weight: 600; }
.sfd-hero-value { font-family: 'JetBrains Mono','Fira Code',monospace; font-size: 20px; font-weight: 600; color: #e6edf3; }
.sfd-hero-sub   { font-size: 10.5px; margin-top: 5px; color: #6e7681; }
.sfd-hero-sub.pos { color: #3fb950; }
.sfd-hero-sub.neg { color: #f85149; }

/* ── Description strip ───────────────────── */
.sfd-desc-strip {
    padding: 14px 18px;
    background: #0d1117;
    border-bottom: 1px solid rgba(48,54,61,0.6);
}
.sfd-desc-text {
    font-size: 13px;
    line-height: 1.65;
    color: #8b949e;
}
.sfd-desc-full { display: none; }
.sfd-desc-toggle {
    display: inline;
    margin-left: 6px;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    color: #58a6ff;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}
.sfd-desc-toggle:hover { color: #79c0ff; }

html[data-theme="light"] .sfd-desc-strip { background: #f0f4f8; border-color: #e2e8f0; }
html[data-theme="light"] .sfd-desc-text { color: #4a5568; }
html[data-theme="light"] .sfd-desc-toggle { color: #2563eb; }
html[data-theme="light"] .sfd-desc-toggle:hover { color: #1d4ed8; }

/* ── Custom Metrics pane ─────────────────── */
.sfd-cm-pane-header {
    padding: 16px 16px 10px;
    border-bottom: 1px solid rgba(48,54,61,0.5);
}
.sfd-cm-pane-title {
    font-size: 14px;
    font-weight: 700;
    color: #e6edf3;
    margin: 0 0 4px;
}
.sfd-cm-pane-desc {
    font-size: 12px;
    color: #8b949e;
    margin: 0;
    line-height: 1.5;
}
.sfd-col-header-table-wrap { overflow-x: auto; }

/* How-it-works steps strip */
.sfd-cm-how-it-works {
    display: flex;
    gap: 0;
    padding: 12px 16px;
    border-top: 1px solid rgba(48,54,61,0.5);
    flex-wrap: wrap;
    gap: 10px;
}
.sfd-cm-step {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 1 1 200px;
    font-size: 11px;
    color: #8b949e;
    line-height: 1.5;
}
.sfd-cm-step strong { color: #c9d1d9; }
.sfd-cm-step-num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(163,113,247,0.15);
    border: 1px solid rgba(163,113,247,0.35);
    color: #a371f7;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ── Theme toggle ────────────────────────── */
.sfd-theme-toggle {
    display: inline-flex;
    border: 1px solid rgba(48,54,61,0.8);
    border-radius: 6px;
    overflow: hidden;
    background: #161b22;
}
.sfd-theme-btn {
    padding: 5px 11px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: #8b949e;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.sfd-theme-btn:hover { background: rgba(255,255,255,0.06); color: #c9d1d9; }
.sfd-theme-btn.sfd-theme-active { background: #21262d; color: #e6edf3; }
.sfd-theme-btn + .sfd-theme-btn { border-left: 1px solid rgba(48,54,61,0.8); }

/* ── Search Bar ─────────────────────────── */
.sfd-search-bar {
    position: relative;
    margin-bottom: 16px;
}
.sfd-search-inner {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

#sfd-search-input {
    flex: 1;
    max-width: 380px;
    padding: 9px 14px;
    font-size: 14px;
    border: 1px solid rgba(48,54,61,0.8);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #161b22;
    color: #c9d1d9;
}
#sfd-search-input::placeholder { color: #484f58; }
#sfd-search-input:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}

.sfd-btn-primary {
    padding: 9px 22px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #1f6feb;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.sfd-btn-primary:hover { background: #388bfd; }

/* Autocomplete */
.sfd-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    max-width: 380px;
    width: 100%;
    background: #1c2128;
    border: 1px solid rgba(48,54,61,0.8);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 200;
}
.sfd-autocomplete-item {
    padding: 7px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(48,54,61,0.5);
    font-size: 13px;
    color: #c9d1d9;
}
.sfd-autocomplete-item:hover { background: rgba(88,166,255,0.08); }
.sfd-autocomplete-item strong { margin-right: 8px; color: #58a6ff; }

/* Loading */
.sfd-loading { text-align: center; padding: 40px; color: #8b949e; }
.sfd-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(48,54,61,0.8);
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: sfd-spin 0.75s linear infinite;
    margin: 0 auto 14px;
}
@keyframes sfd-spin { to { transform: rotate(360deg); } }

/* Error */
.sfd-error {
    background: rgba(248,81,73,0.1);
    border: 1px solid rgba(248,81,73,0.4);
    color: #ffa198;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 14px;
}

/* ── Dashboard Frame ────────────────────── */
.sfd-dashboard {
    border: 1px solid rgba(48,54,61,0.8);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    background: #161b22;
}

/* ── Header ─────────────────────────────── */
.sfd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #1c2128;
    color: #e6edf3;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 1px solid rgba(48,54,61,0.8);
}
.sfd-header-left { display: flex; flex-direction: column; gap: 2px; }
.sfd-fiscal-date { font-size: 11px; color: #8b949e; letter-spacing: 0.3px; }
.sfd-company-title { margin: 0; font-size: 15px; font-weight: 700; color: #e6edf3; }

/* Feature 1 — Year selector */
.sfd-year-select-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
}
.sfd-year-select-wrap label { font-size: 15px !important; color: #8b949e; white-space: nowrap; }
#sfd-year-select {
    padding: 4px 7px;
    border: 1px solid rgba(48,54,61,0.8);
    border-radius: 4px;
    font-size: 15px !important;
    background: #21262d;
    color: #c9d1d9;
    cursor: pointer;
}

.sfd-period-subtitle { font-size: 11px; color: #58a6ff; font-style: italic; display: none; }
#sfd-period-subtitle { display: none; }

/* ── Main Grid ──────────────────────────── */
.sfd-grid {
    display: grid;
    grid-template-columns: 288px 1fr;
    border-top: none;
}
.sfd-left-col {
    border-right: 1px solid rgba(48,54,61,0.8);
    background: #161b22;
}
.sfd-right-col {
    background: #161b22;
    overflow-x: auto;
}

/* ── Column header table ─────────────────── */
.sfd-col-header-table {
    width: 100%;
    border-collapse: collapse;
    background: #1c2128 !important;
}
.sfd-col-header-table th {
    background: #1c2128 !important;
    color: #c9d1d9 !important;
    border: none !important;
    border-bottom: none !important;
}
.sfd-col-header-table th.sfd-col-hdr-label {
    text-align: left !important;
    padding: 8px 12px !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.9px !important;
    color: #e6edf3 !important;
    background: #1c2128 !important;
    width: 188px;
    min-width: 188px;
}
.sfd-col-header-table th.sfd-col-hdr-val {
    text-align: right !important;
    padding: 8px 10px !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    color: #8b949e !important;
    background: #1c2128 !important;
    min-width: 76px;
    border-left: 1px solid rgba(48,54,61,0.6) !important;
    letter-spacing: 0.3px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Section Titles ─────────────────────── */
.sfd-section-title,
.sfd-dashboard-wrapper .sfd-section-title {
    background: #1c2128 !important;
    color: #e6edf3 !important;
    padding: 7px 12px !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.9px !important;
    border: none !important;
    border-bottom: 1px solid rgba(48,54,61,0.6) !important;
    display: block !important;
    box-shadow: none !important;
}
.sfd-section-subtitle,
.sfd-dashboard-wrapper .sfd-section-subtitle {
    background: #21262d !important;
    color: #8b949e !important;
    padding: 4px 12px !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    letter-spacing: 0.3px !important;
    border: none !important;
    border-bottom: 1px solid rgba(48,54,61,0.5) !important;
    display: block !important;
    box-shadow: none !important;
}

/* ── Category Headers ───────────────────── */
/* Design 1: colored left-border, dark background — no full color fill */
.sfd-category-header {
    padding: 6px 12px;
    font-weight: 700;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: #e6edf3 !important;
    border-top: none;
    border-bottom: 1px solid rgba(48,54,61,0.6);
    display: block;
    background: #1c2128 !important;
}

.sfd-cat-moat      { border-left: 3px solid #3fb950 !important; color: #3fb950 !important; }
.sfd-cat-capital   { border-left: 3px solid #f0883e !important; color: #f0883e !important; }
.sfd-cat-profit    { border-left: 3px solid #3fb950 !important; color: #3fb950 !important; }
.sfd-cat-tailwinds { border-left: 3px solid #58a6ff !important; color: #58a6ff !important; }
.sfd-cat-intensive { border-left: 3px solid #f85149 !important; color: #f85149 !important; }
.sfd-cat-cashflow  { border-left: 3px solid #3fb950 !important; color: #3fb950 !important; }
.sfd-cat-custom {
    border-left: 3px solid #a371f7 !important;
    color: #a371f7 !important;
    background: #1c2128 !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
}

.sfd-save-all-btn {
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #a371f7;
    background: rgba(163,113,247,0.12);
    border: 1px solid rgba(163,113,247,0.35);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.sfd-save-all-btn:hover  { background: rgba(163,113,247,0.22); }
.sfd-save-all-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Tables ─────────────────────────────── */
.sfd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.sfd-table td {
    padding: 4px 10px;
    border-bottom: 1px solid rgba(48,54,61,0.5);
    white-space: nowrap;
    color: #c9d1d9;
}

/* ── Left column — TTM Table ─────────────── */
.sfd-ttm-table tr.sfd-ttm-group td {
    background: #21262d;
    color: #8b949e;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px 12px 3px;
    border-bottom: 1px solid rgba(48,54,61,0.6);
    border-top: 1px solid rgba(48,54,61,0.6);
}
.sfd-ttm-table td:first-child { color: #8b949e; font-weight: 400; padding-left: 14px; }
.sfd-ttm-table td:not(:first-child) {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding-right: 14px;
    color: #c9d1d9;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.sfd-ttm-val-col {
    min-width: 80px;
    text-align: right !important;
    font-size: 11px;
    font-weight: 700;
    color: #8b949e;
    padding: 4px 14px !important;
    background: #21262d;
    border-bottom: 1px solid rgba(48,54,61,0.6);
}

/* ── Right column — Metrics Table ───────── */
.sfd-metrics-table td:first-child {
    color: #8b949e;
    font-weight: 400;
    width: 188px;
    min-width: 188px;
    padding-left: 12px;
}
.sfd-metrics-table td {
    text-align: right;
    font-weight: 600;
    min-width: 76px;
    font-variant-numeric: tabular-nums;
    padding-right: 10px;
    color: #c9d1d9;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Color coding — text only (Design 1) ── */
.sfd-green {
    background-color: transparent !important;
    color: #3fb950 !important;
}
.sfd-yellow {
    background-color: transparent !important;
    color: #f59e0b !important;
}
.sfd-red {
    background-color: transparent !important;
    color: #f85149 !important;
}

/* Legacy aliases */
.sfd-light-green  { background-color: transparent; color: #3fb950; }
.sfd-light-yellow { background-color: transparent; color: #f59e0b; }
.sfd-light-red    { background-color: transparent; color: #f85149; }
.sfd-neutral      { background-color: transparent; }

/* TTM threshold text */
.sfd-ttm-green  { color: #3fb950; font-weight: 700; }
.sfd-ttm-yellow { color: #f59e0b; font-weight: 700; }
.sfd-ttm-red    { color: #f85149; font-weight: 700; }

/* Row hover */
.sfd-table tr:hover { background-color: rgba(255,255,255,0.03) !important; }

/* NA */
.sfd-na { color: #484f58; font-style: italic; font-weight: 400 !important; }

/* Section */
.sfd-section { border-bottom: 1px solid rgba(48,54,61,0.5); }
.sfd-section:last-child { border-bottom: none; }

/* ── Custom Metrics (Feature 2) ─────────── */
.sfd-custom-row { margin-bottom: 0; border-bottom: 1px solid rgba(48,54,61,0.5); }
.sfd-custom-table { width: 100%; }
.sfd-custom-inputs-row td { padding: 5px 4px; vertical-align: middle; }
.sfd-custom-label-cell { width: 112px; padding-left: 12px !important; }
.sfd-custom-label {
    width: 100%;
    padding: 4px 7px;
    font-size: 12px;
    border: 1px solid rgba(48,54,61,0.8);
    border-radius: 3px;
    box-sizing: border-box;
    background: #21262d;
    color: #c9d1d9;
}
.sfd-custom-m1-cell { padding: 5px 4px 5px 6px !important; vertical-align: middle; }
.sfd-custom-op-cell { width: 80px; padding: 5px 4px !important; vertical-align: middle; text-align: center; }
.sfd-custom-m2-cell { padding: 5px 4px !important; vertical-align: middle; }
.sfd-custom-calc-cell { width: 90px; padding: 5px 6px !important; vertical-align: middle; white-space: nowrap; text-align: center; }

.sfd-typeahead-wrap { position: relative; flex: 1 1 140px; }
.sfd-metric-input {
    width: 100%;
    padding: 4px 7px;
    font-size: 12px;
    border: 1px solid rgba(48,54,61,0.8);
    border-radius: 3px;
    box-sizing: border-box;
    background: #21262d;
    color: #c9d1d9;
}
.sfd-typeahead-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1c2128;
    border: 1px solid rgba(48,54,61,0.8);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.sfd-typeahead-item { padding: 5px 9px; font-size: 12px; cursor: pointer; color: #c9d1d9; }
.sfd-typeahead-item:hover { background: rgba(88,166,255,0.08); }

.sfd-operator-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 4px 8px;
    font-size: 15px !important;
    font-weight: 700;
    border: 1px solid rgba(48,54,61,0.8) !important;
    border-radius: 3px;
    width: 72px !important;
    min-width: 72px !important;
    background: #21262d !important;
    color: #c9d1d9 !important;
    text-align: center;
    text-align-last: center;
    cursor: pointer;
    display: block !important;
    box-sizing: border-box !important;
}

.sfd-calc-radio { display: block; font-size: 11px; font-weight: 500; color: #8b949e; cursor: pointer; line-height: 1.6; white-space: nowrap; }
.sfd-calc-radio input[type="radio"] { margin-right: 3px; vertical-align: middle; accent-color: #a371f7; }

.sfd-custom-login-msg { font-size: 11px; color: #484f58; white-space: nowrap; }
.sfd-custom-metric-name { font-size: 12px; color: #8b949e; padding-left: 14px !important; font-weight: 400; }

/* Add metric button */
.sfd-add-metric-wrap { padding: 8px 12px 10px; border-top: 1px solid rgba(48,54,61,0.5); }
.sfd-add-metric-btn {
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #a371f7;
    background: rgba(163,113,247,0.1);
    border: 1px solid rgba(163,113,247,0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.sfd-add-metric-btn:hover { background: rgba(163,113,247,0.2); }

/* ── Insider Transactions ────────────────── */
.sfd-cat-insider {
    background: #1c2128 !important;
    border-left: 3px solid #79c0ff !important;
    color: #79c0ff !important;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.sfd-insider-summary-badges { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.sfd-insider-refresh-btn {
    margin-left: auto;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #8b949e !important;
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(48,54,61,0.8) !important;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: .3px;
    transition: background .15s;
}
.sfd-insider-refresh-btn:hover:not(:disabled) { background: rgba(255,255,255,0.12) !important; color: #c9d1d9 !important; }
.sfd-insider-refresh-btn:disabled { opacity: 0.5; cursor: default; }

/* Info bubble button — sits inside the Type column <th> */
.sfd-insider-info-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 16px !important;
    height: 16px !important;
    padding: 0 !important;
    margin-left: 4px !important;
    vertical-align: middle !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    font-family: inherit;
    line-height: 1 !important;
    color: #fff !important;
    background: #4f7ecf !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    box-shadow: none !important;
    outline: none;
    text-transform: none !important;
    letter-spacing: 0 !important;
    transition: background 0.15s;
    flex-shrink: 0;
}
.sfd-insider-info-btn:hover { background: #3461b5 !important; color: #fff !important; }

/* Legend overlay */
.sfd-insider-legend-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sfd-insider-legend-box {
    background: #161b22;
    border: 1px solid rgba(48,54,61,0.9);
    border-radius: 10px;
    padding: 24px 28px;
    max-width: 560px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.sfd-insider-legend-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: none;
    color: #8b949e;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.sfd-insider-legend-close:hover { color: #c9d1d9; }
.sfd-insider-legend-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 700;
    color: #e6edf3;
}
.sfd-insider-legend-intro {
    margin: 0 0 14px;
    font-size: 12px;
    color: #8b949e;
    line-height: 1.5;
}
.sfd-insider-legend-table {
    width: 100%;
    border-collapse: collapse;
}
.sfd-insider-legend-table td {
    padding: 5px 8px;
    font-size: 12px;
    color: #c9d1d9;
    border-bottom: 1px solid rgba(48,54,61,0.5);
    vertical-align: top;
}
.sfd-insider-legend-table tr:last-child td { border-bottom: none; }
.sfd-ilc {
    font-weight: 700;
    color: #79c0ff;
    width: 28px;
    white-space: nowrap;
}

/* Light theme overrides for legend */
html[data-theme="light"] .sfd-insider-legend-box { background: #fff; border-color: #d0d5e5; }
html[data-theme="light"] .sfd-insider-legend-title { color: #1a1a2e; }
html[data-theme="light"] .sfd-insider-legend-table td { color: #1a1a2e; border-color: #e8ecf5; }
html[data-theme="light"] .sfd-ilc { color: #1e40af; }
html[data-theme="light"] .sfd-insider-info-btn { background: #4f7ecf !important; color: #fff !important; }

.sfd-insider-body { padding: 0; overflow-x: auto; }
.sfd-insider-loading,
.sfd-insider-empty,
.sfd-insider-placeholder { padding: 12px 16px; font-size: 12px; color: #484f58; font-style: italic; }

.sfd-insider-table { font-size: 12px; border-top: 1px solid rgba(48,54,61,0.5); }
.sfd-insider-table thead th {
    background: #21262d !important;
    color: #8b949e !important;
    border-bottom: 1px solid rgba(48,54,61,0.8) !important;
}

/* Insider badges */
.sfd-ins-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.sfd-ins-buy   { background: rgba(63,185,80,0.15);  color: #3fb950; }
.sfd-ins-sell  { background: rgba(248,81,73,0.15);  color: #f85149; }
.sfd-ins-award { background: rgba(88,166,255,0.15); color: #58a6ff; }

/* Insider sort */
.sfd-insider-th[data-sort] { cursor: pointer; user-select: none; transition: background 0.12s; }
.sfd-insider-th[data-sort]:hover { background: rgba(255,255,255,0.05) !important; }
.sfd-sort-idle { opacity: 0.35; font-size: 10px; }

/* Insider filter row */
.sfd-insider-filter-row td { background: #1c2128; border-bottom: 1px solid rgba(48,54,61,0.8); padding: 3px 6px !important; }
.sfd-insider-filter-input,
.sfd-insider-filter-select {
    width: 100%;
    font-size: 11px;
    padding: 2px 5px;
    border: 1px solid rgba(48,54,61,0.8);
    border-radius: 3px;
    box-sizing: border-box;
    background: #21262d;
    color: #c9d1d9;
}
.sfd-insider-filter-input:focus,
.sfd-insider-filter-select:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88,166,255,0.18);
}

/* Insider pagination */
.sfd-insider-more-wrap { padding: 12px 16px; text-align: center; border-top: 1px solid rgba(48,54,61,0.5); }
.sfd-more-btn {
    display: inline-block;
    padding: 6px 24px;
    background: #21262d;
    color: #8b949e;
    border: 1px solid rgba(48,54,61,0.8);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.sfd-more-btn:hover { background: rgba(255,255,255,0.06); border-color: #58a6ff; color: #c9d1d9; }
.sfd-insider-no-more { font-size: 11px; color: #484f58; font-style: italic; margin: 0; }
.sfd-insider-error { font-size: 12px; color: #f85149; margin: 0; }

/* ── View links ──────────────────────────── */
.sfd-view-trend-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(31,111,235,0.2);
    color: #58a6ff !important;
    border: 1px solid rgba(31,111,235,0.4);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background .15s;
}
.sfd-view-trend-link:hover { background: rgba(31,111,235,0.35); }

.sfd-view-kpi-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(63,185,80,0.15);
    color: #3fb950 !important;
    border: 1px solid rgba(63,185,80,0.3);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background .15s;
}
.sfd-view-kpi-link:hover { background: rgba(63,185,80,0.25); }

/* ── Responsive ──────────────────────────── */
@media (max-width: 860px) {
    .sfd-grid { grid-template-columns: 1fr; }
    .sfd-left-col { border-right: none; border-bottom: 1px solid rgba(48,54,61,0.8); }
    .sfd-header { flex-direction: column; align-items: flex-start; }
    .sfd-header-right { align-items: flex-start; }
}

/* =====================================================
   LIGHT MODE OVERRIDES
   Applied when JS sets html[data-theme="light"]
   ===================================================== */
html[data-theme="light"] .sfd-dashboard-wrapper { background: #f0f4f8; color: #1a1a2e; }
html[data-theme="light"] .sfd-theme-toggle { background: #fff; border-color: #c9d0e0; }
html[data-theme="light"] .sfd-theme-btn { color: #64748b; }
html[data-theme="light"] .sfd-theme-btn:hover { background: #f0f5ff; color: #1a2940; }
html[data-theme="light"] .sfd-theme-btn.sfd-theme-active { background: #e8f0fe; color: #1a2940; }
html[data-theme="light"] .sfd-theme-btn + .sfd-theme-btn { border-color: #c9d0e0; }

html[data-theme="light"] #sfd-search-input { background: #fff; border-color: #c9d0e0; color: #1a1a2e; }
html[data-theme="light"] #sfd-search-input::placeholder { color: #94a3b8; }
html[data-theme="light"] #sfd-search-input:focus { border-color: #2271b1; box-shadow: 0 0 0 3px rgba(34,113,177,0.15); }
html[data-theme="light"] .sfd-btn-primary { background: #1a2940; }
html[data-theme="light"] .sfd-btn-primary:hover { background: #2d3f5c; }
html[data-theme="light"] .sfd-autocomplete { background: #fff; border-color: #c9d0e0; box-shadow: 0 6px 16px rgba(0,0,0,0.12); }
html[data-theme="light"] .sfd-autocomplete-item { color: #1a1a2e; border-color: #f0f2f8; }
html[data-theme="light"] .sfd-autocomplete-item:hover { background: #f0f5ff; }
html[data-theme="light"] .sfd-autocomplete-item strong { color: #1a2940; }
html[data-theme="light"] .sfd-spinner { border-color: #e0e4ee; border-top-color: #2271b1; }
html[data-theme="light"] .sfd-loading { color: #64748b; }
html[data-theme="light"] .sfd-error { background: #fef0f0; border-color: #f5c6cb; color: #721c24; }
html[data-theme="light"] .sfd-dashboard { background: #fff; border-color: #d0d5e5; box-shadow: 0 2px 12px rgba(0,0,0,0.07); }
html[data-theme="light"] .sfd-header { background: #1a2940; border-color: transparent; }
html[data-theme="light"] .sfd-fiscal-date { color: #8fa3c0; }
html[data-theme="light"] .sfd-company-title { color: #fff; }
html[data-theme="light"] #sfd-year-select { background: #fff; border-color: #c9d0e0; color: #1a2940; }
html[data-theme="light"] .sfd-year-select-wrap label { color: #3a4e72; }
html[data-theme="light"] .sfd-left-col { background: #f7f9fc; border-color: #d0d5e5; }
html[data-theme="light"] .sfd-right-col { background: #fff; }
html[data-theme="light"] .sfd-col-header-table,
html[data-theme="light"] .sfd-col-header-table th { background: #1a2940 !important; }
html[data-theme="light"] .sfd-col-header-table th.sfd-col-hdr-label { color: #fff !important; background: #1a2940 !important; }
html[data-theme="light"] .sfd-col-header-table th.sfd-col-hdr-val { color: #c8d3e6 !important; background: #1a2940 !important; border-color: #2d4060 !important; font-family: inherit; }
html[data-theme="light"] .sfd-section-title,
html[data-theme="light"] .sfd-dashboard-wrapper .sfd-section-title { background: #1a2940 !important; color: #fff !important; border-color: transparent !important; }
html[data-theme="light"] .sfd-section-subtitle,
html[data-theme="light"] .sfd-dashboard-wrapper .sfd-section-subtitle { background: #2d4060 !important; color: #b0c4de !important; border-color: transparent !important; }
html[data-theme="light"] .sfd-category-header { background: #1a2940 !important; color: #fff !important; border-bottom-color: transparent !important; }
html[data-theme="light"] .sfd-cat-moat      { background: #1a5c38 !important; border-left: none !important; color: #fff !important; }
html[data-theme="light"] .sfd-cat-capital   { background: #7c4f00 !important; border-left: none !important; color: #fff !important; }
html[data-theme="light"] .sfd-cat-profit    { background: #1a5c38 !important; border-left: none !important; color: #fff !important; }
html[data-theme="light"] .sfd-cat-tailwinds { background: #003d7a !important; border-left: none !important; color: #fff !important; }
html[data-theme="light"] .sfd-cat-intensive { background: #7a1c1c !important; border-left: none !important; color: #fff !important; }
html[data-theme="light"] .sfd-cat-cashflow  { background: #1a5c38 !important; border-left: none !important; color: #fff !important; }
html[data-theme="light"] .sfd-cat-custom    { background: #3d2b8a !important; border-left: none !important; color: #fff !important; }
html[data-theme="light"] .sfd-cat-insider   { background: #2d4060 !important; border-left: none !important; color: #fff !important; }
html[data-theme="light"] .sfd-table td { border-color: #edf0f8; color: #1a1a2e; }
html[data-theme="light"] .sfd-ttm-table tr.sfd-ttm-group td { background: #edf1f9; color: #3a4e72; border-color: #d2d9ea; }
html[data-theme="light"] .sfd-ttm-table td:first-child { color: #3a4a68; }
html[data-theme="light"] .sfd-ttm-table td:not(:first-child) { color: #1a1a2e; font-family: inherit; }
html[data-theme="light"] .sfd-ttm-val-col { color: #3a4e72; background: #edf1f9; border-color: #d2d9ea; }
html[data-theme="light"] .sfd-metrics-table td:first-child { color: #3a4a68; }
html[data-theme="light"] .sfd-metrics-table td { color: #1a1a2e; font-family: inherit; }
html[data-theme="light"] .sfd-green { background-color: #e6f4ea !important; color: #137333 !important; }
html[data-theme="light"] .sfd-yellow { background-color: #fef9e7 !important; color: #b45309 !important; }
html[data-theme="light"] .sfd-red { background-color: #fce8e6 !important; color: #c5221f !important; }
html[data-theme="light"] .sfd-light-green  { background-color: #e6f4ea; color: #137333; }
html[data-theme="light"] .sfd-light-yellow { background-color: #fef9e7; color: #b45309; }
html[data-theme="light"] .sfd-light-red    { background-color: #fce8e6; color: #c5221f; }
html[data-theme="light"] .sfd-ttm-green  { color: #137333; }
html[data-theme="light"] .sfd-ttm-yellow { color: #b45309; }
html[data-theme="light"] .sfd-ttm-red    { color: #c5221f; }
html[data-theme="light"] .sfd-table tr:hover { background-color: #f5f7ff !important; }
html[data-theme="light"] .sfd-na { color: #a0a8c0; }
html[data-theme="light"] .sfd-section { border-color: #e8ecf5; }
html[data-theme="light"] .sfd-custom-row { border-color: #e8ecf5; }
html[data-theme="light"] .sfd-custom-label { background: #fff; border-color: #c9d0e0; color: #1a1a2e; }
html[data-theme="light"] .sfd-metric-input { background: #fff; border-color: #c9d0e0; color: #1a1a2e; }
html[data-theme="light"] .sfd-typeahead-dropdown { background: #fff; border-color: #c9d0e0; box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
html[data-theme="light"] .sfd-typeahead-item { color: #1a1a2e; }
html[data-theme="light"] .sfd-typeahead-item:hover { background: #f0f5ff; }
html[data-theme="light"] .sfd-operator-select { background: #f7f9fc !important; border-color: #c9d0e0; color: #1a1a2e !important; }
html[data-theme="light"] .sfd-calc-radio { color: #3a4a68; }
html[data-theme="light"] .sfd-custom-login-msg { color: #8fa3c0; }
html[data-theme="light"] .sfd-custom-metric-name { color: #3a4a68; }
html[data-theme="light"] .sfd-add-metric-wrap { border-color: #edf0f8; }
html[data-theme="light"] .sfd-add-metric-btn { color: #3d2b8a; background: #f0ecff; border-color: #c9bef5; }
html[data-theme="light"] .sfd-add-metric-btn:hover { background: #e0d8ff; }
html[data-theme="light"] .sfd-save-all-btn { color: #3d2b8a; background: #e8e0ff; border-color: #b5a4f5; }
html[data-theme="light"] .sfd-save-all-btn:hover { background: #d5c8ff; }
html[data-theme="light"] .sfd-insider-loading,
html[data-theme="light"] .sfd-insider-empty,
html[data-theme="light"] .sfd-insider-placeholder { color: #8fa3c0; }
html[data-theme="light"] .sfd-insider-table { border-color: #edf0f8; }
html[data-theme="light"] .sfd-insider-table thead th { background: #edf1f9 !important; color: #3a4e72 !important; border-color: #d2d9ea !important; }
html[data-theme="light"] .sfd-ins-buy   { background: #e6f4ea; color: #137333; }
html[data-theme="light"] .sfd-ins-sell  { background: #fce8e6; color: #c5221f; }
html[data-theme="light"] .sfd-ins-award { background: #e8f0fe; color: #1a73e8; }
html[data-theme="light"] .sfd-insider-th[data-sort]:hover { background: #dde4f5 !important; }
html[data-theme="light"] .sfd-insider-filter-row td { background: #f5f7fc; border-color: #d2d9ea; }
html[data-theme="light"] .sfd-insider-filter-input,
html[data-theme="light"] .sfd-insider-filter-select { background: #fff; border-color: #cdd5e8; color: #3a4e72; }
html[data-theme="light"] .sfd-insider-more-wrap { border-color: #edf0f8; }
html[data-theme="light"] .sfd-more-btn { background: #fff; color: #3a4e72; border-color: #b0bdd8; }
html[data-theme="light"] .sfd-more-btn:hover { background: #edf1f9; border-color: #7a96c8; }
html[data-theme="light"] .sfd-insider-no-more { color: #8fa3c0; }
html[data-theme="light"] .sfd-insider-refresh-btn { color: #c8d8f0 !important; background: rgba(255,255,255,0.12) !important; border-color: rgba(200,216,240,0.35) !important; }
html[data-theme="light"] .sfd-view-trend-link { background: #1e40af; color: #fff !important; border-color: transparent; }
html[data-theme="light"] .sfd-view-trend-link:hover { background: #1d4ed8; }
html[data-theme="light"] .sfd-view-kpi-link { background: #065f46; color: #fff !important; border-color: transparent; }
html[data-theme="light"] .sfd-view-kpi-link:hover { background: #047857; }

/* Custom Metrics pane light */
html[data-theme="light"] .sfd-cm-pane-header { border-color: #e2e8f0; }
html[data-theme="light"] .sfd-cm-pane-title { color: #0f172a; }
html[data-theme="light"] .sfd-cm-pane-desc { color: #64748b; }
html[data-theme="light"] .sfd-cm-how-it-works { border-color: #e2e8f0; }
html[data-theme="light"] .sfd-cm-step { color: #64748b; }
html[data-theme="light"] .sfd-cm-step strong { color: #0f172a; }
html[data-theme="light"] .sfd-cm-step-num { background: rgba(61,43,138,0.08); border-color: rgba(61,43,138,0.2); color: #3d2b8a; }

/* Tab bar light */
html[data-theme="light"] .sfd-tab-bar { background: rgba(255,255,255,.97); border-color: #e2e8f0; }
html[data-theme="light"] .sfd-tab { color: #64748b; }
html[data-theme="light"] .sfd-tab:hover { color: #0f172a; background: #f8fafc; }
html[data-theme="light"] .sfd-tab.sfd-tab-active { color: #2563eb; border-color: #2563eb; background: rgba(37,99,235,.04); }

/* Hero strip light */
html[data-theme="light"] .sfd-hero-strip { background: #f0f4f8; border-color: #e2e8f0; }
html[data-theme="light"] .sfd-hero-card { background: #fff; border-color: #e2e8f0; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
html[data-theme="light"] .sfd-hero-card:hover { border-color: #bfdbfe; }
html[data-theme="light"] .sfd-hero-label { color: #64748b; }
html[data-theme="light"] .sfd-hero-value { color: #0f172a; }
html[data-theme="light"] .sfd-hero-sub { color: #94a3b8; }
