/* ==========================================================
   Stock Financial Dashboard — Valuation / DCF pane
   ========================================================== */

/* ── Section wrapper ──────────────────────────────────────── */
.sfd-dcf-section {
    background: #161b22;
    border: 1px solid rgba(48,54,61,0.7);
    border-radius: 8px;
    padding: 18px 20px;
    margin: 12px 16px;
}
.sfd-dcf-section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #6e7681;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Input grid ───────────────────────────────────────────── */
.sfd-dcf-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
@media (max-width: 900px) {
    .sfd-dcf-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .sfd-dcf-grid { grid-template-columns: 1fr; }
}

.sfd-dcf-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sfd-dcf-field label {
    font-size: 11px;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.sfd-dcf-val {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 18px;
    font-weight: 600;
    color: #e6edf3;
    padding: 6px 0 2px;
}
.sfd-dcf-hint {
    font-size: 10.5px;
    color: #484f58;
}
.sfd-dcf-implied-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 8px;
    padding: 2px 8px;
    background: rgba(79, 126, 207, 0.15);
    border: 1px solid rgba(79, 126, 207, 0.35);
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 400;
    color: #7da8e8;
    letter-spacing: 0;
    text-transform: none;
    vertical-align: middle;
}
.sfd-dcf-implied-badge strong {
    font-weight: 700;
    color: #4f7ecf;
}
html[data-theme="light"] .sfd-dcf-implied-badge {
    background: rgba(79, 126, 207, 0.08);
    border-color: rgba(79, 126, 207, 0.3);
    color: #4a6fa5;
}
html[data-theme="light"] .sfd-dcf-implied-badge strong {
    color: #3060a8;
}

/* Yellow-highlighted user input fields */
.sfd-dcf-input-field label { color: #c9d1d9; }
.sfd-dcf-input {
    background: #f5c518 !important;
    color: #0d1117 !important;
    border: 1px solid #d4a908 !important;
    border-radius: 4px;
    padding: 7px 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}
.sfd-dcf-input:focus {
    border-color: #f5c518 !important;
    box-shadow: 0 0 0 2px rgba(245,197,24,.25);
}
.sfd-dcf-input::placeholder { color: rgba(13,17,23,.5); }

/* Inline input (dilution field inside results grid) */
.sfd-dcf-inline-input {
    width: 90px !important;
    padding: 4px 8px !important;
    font-size: 13px !important;
    text-align: right;
}

/* ── CAGR reference bar ───────────────────────────────────── */
.sfd-dcf-refs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-top: 14px;
    padding: 10px 12px;
    background: rgba(13,17,23,.5);
    border-radius: 6px;
    border: 1px solid rgba(48,54,61,.5);
    font-size: 12px;
    color: #8b949e;
}
.sfd-dcf-refs-label { font-weight: 600; color: #6e7681; }
.sfd-dcf-ref-item   { color: #c9d1d9; }
.sfd-dcf-ref-item strong { color: #58a6ff; }
.sfd-dcf-ref-sep    { color: rgba(48,54,61,.8); font-size: 16px; }
.sfd-dcf-analyst-source { font-size: 10px; color: #484f58; margin-left: 4px; }
.sfd-dcf-na         { font-size: 11px; color: #484f58; font-style: italic; }

/* ── Results grid ─────────────────────────────────────────── */
.sfd-dcf-results-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.sfd-dcf-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(48,54,61,.4);
}
.sfd-dcf-result-row:last-child { border-bottom: none; }

.sfd-dcf-result-label {
    font-size: 13px;
    color: #8b949e;
}
.sfd-dcf-result-val {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 15px;
    font-weight: 700;
    color: #e6edf3;
    text-align: right;
}

/* Intrinsic value highlighted row */
.sfd-dcf-intrinsic .sfd-dcf-result-label { color: #c9d1d9; font-weight: 600; }
.sfd-dcf-intrinsic .sfd-dcf-result-val   { color: #3fb950; font-size: 18px; }

/* Over / under valuation colours */
.sfd-dcf-pos { color: #f85149 !important; }  /* overvalued = red  */
.sfd-dcf-neg { color: #3fb950 !important; }  /* undervalued = green */

/* ── Notes ────────────────────────────────────────────────── */
.sfd-dcf-notes {
    width: 100%;
    box-sizing: border-box;
    background: #0d1117;
    color: #c9d1d9;
    border: 1px solid rgba(48,54,61,.8);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    outline: none;
}
.sfd-dcf-notes:focus { border-color: #58a6ff; }
.sfd-dcf-word-count {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 400;
    color: #484f58;
    text-transform: none;
    letter-spacing: 0;
}
.sfd-dcf-word-over { color: #f85149 !important; }

/* ── Actions bar ──────────────────────────────────────────── */
.sfd-dcf-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px 16px;
}
.sfd-dcf-save-btn {
    padding: 9px 24px;
    font-size: 13px;
    font-weight: 700;
    color: #0d1117;
    background: #3fb950;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}
.sfd-dcf-save-btn:hover:not(:disabled) { background: #2ea043; }
.sfd-dcf-save-btn:disabled { opacity: .45; cursor: default; }
.sfd-dcf-login-msg { font-size: 12px; color: #8b949e; font-style: italic; }
.sfd-dcf-status { font-size: 12px; }
.sfd-dcf-status-ok  { color: #3fb950; }
.sfd-dcf-status-err { color: #f85149; }

/* ── History table ────────────────────────────────────────── */
.sfd-dcf-history-wrap { overflow-x: auto; }
.sfd-dcf-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.sfd-dcf-history-table th {
    background: #0d1117;
    color: #6e7681;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(48,54,61,.6);
    white-space: nowrap;
}
.sfd-dcf-history-table td {
    padding: 8px 10px;
    color: #c9d1d9;
    border-bottom: 1px solid rgba(48,54,61,.3);
    font-family: 'JetBrains Mono', monospace;
    vertical-align: top;
}
.sfd-dcf-history-table tr:last-child td { border-bottom: none; }
.sfd-dcf-history-table tr:hover td { background: rgba(88,166,255,.04); }
.sfd-dcf-history-notes {
    font-family: inherit !important;
    font-size: 11px !important;
    color: #8b949e !important;
    max-width: 220px;
}

/* ── Loading / error ──────────────────────────────────────── */
.sfd-dcf-loading {
    text-align: center;
    padding: 24px;
    font-size: 13px;
    color: #8b949e;
}
.sfd-dcf-error {
    margin: 10px 16px;
    padding: 10px 14px;
    background: rgba(248,81,73,.1);
    border: 1px solid rgba(248,81,73,.3);
    border-radius: 6px;
    color: #f85149;
    font-size: 13px;
}

/* ── Light theme overrides ────────────────────────────────── */
html[data-theme="light"] .sfd-dcf-section           { background: #fff; border-color: #e2e8f0; }
html[data-theme="light"] .sfd-dcf-section-title      { color: #64748b; }
html[data-theme="light"] .sfd-dcf-val                { color: #0f172a; }
html[data-theme="light"] .sfd-dcf-hint               { color: #94a3b8; }
html[data-theme="light"] .sfd-dcf-field label        { color: #475569; }
html[data-theme="light"] .sfd-dcf-refs               { background: #f8fafc; border-color: #e2e8f0; }
html[data-theme="light"] .sfd-dcf-refs-label         { color: #64748b; }
html[data-theme="light"] .sfd-dcf-ref-item           { color: #334155; }
html[data-theme="light"] .sfd-dcf-na                 { color: #94a3b8; }
html[data-theme="light"] .sfd-dcf-result-label       { color: #475569; }
html[data-theme="light"] .sfd-dcf-result-val         { color: #0f172a; }
html[data-theme="light"] .sfd-dcf-result-row         { border-color: #e2e8f0; }
html[data-theme="light"] .sfd-dcf-notes              { background: #f8fafc; color: #1e293b; border-color: #cbd5e1; }
html[data-theme="light"] .sfd-dcf-history-table th   { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
html[data-theme="light"] .sfd-dcf-history-table td   { color: #334155; border-color: #e2e8f0; }
html[data-theme="light"] .sfd-dcf-history-notes      { color: #64748b !important; }
html[data-theme="light"] .sfd-dcf-history-table tr:hover td { background: rgba(37,99,235,.03); }
html[data-theme="light"] .sfd-dcf-error              { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
html[data-theme="light"] .sfd-dcf-word-count         { color: #94a3b8; }
