:root {
    --bg-start: #f6efe4;
    --bg-end: #deebff;
    --card-bg: rgba(255, 255, 255, 0.9);
    --panel-bg: #fbfdff;
    --border: #d7e1ee;
    --text: #17304f;
    --muted: #5f6f83;
    --accent: #2368c4;
    --accent-dark: #184f98;
    --positive: #15815f;
    --negative: #c14646;
    --neutral: #8c6c1f;
    --shadow: 0 20px 55px rgba(23, 48, 79, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(35, 104, 196, 0.14), transparent 34%),
        linear-gradient(135deg, var(--bg-start), var(--bg-end));
}

.page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.card {
    width: min(760px, 100%);
    padding: 32px;
    border: 1px solid rgba(215, 225, 238, 0.9);
    border-radius: 24px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.eyebrow {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 700;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.05;
}

.description {
    margin: 14px 0 28px;
    max-width: 60ch;
    color: var(--muted);
    line-height: 1.6;
}

.predict-form label,
.metrics h3,
.results-label {
    display: block;
    font-weight: 700;
}

.input-row {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

input {
    flex: 1;
    padding: 15px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: #ffffff;
}

input:focus {
    outline: 3px solid rgba(35, 104, 196, 0.16);
    border-color: var(--accent);
}

button {
    padding: 15px 22px;
    border: 0;
    border-radius: 14px;
    font: inherit;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.78;
    cursor: wait;
}

.hint,
.panel-note,
.summary,
.data-note {
    color: var(--muted);
    line-height: 1.55;
}

.hint {
    margin: 10px 0 0;
    font-size: 0.92rem;
}

.panel {
    margin-top: 22px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel-bg);
}

.hidden {
    display: none;
}

.status-row,
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.status-title {
    font-weight: 700;
}

.progress-track {
    height: 12px;
    margin-top: 14px;
    border-radius: 999px;
    background: #e7eef6;
    overflow: hidden;
}

.progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2d7ef5, #4ab8ff);
    transition: width 0.22s ease;
}

.panel-note,
.data-note {
    margin-bottom: 0;
}

.panel-error {
    border-color: #f1caca;
    background: #fff5f5;
    color: #942f2f;
    font-weight: 600;
}

.results-label {
    margin: 0 0 8px;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
}

.results-header h2 {
    margin: 0;
    font-size: 1.7rem;
}

.summary {
    margin: 10px 0 0;
}

.outlook-badge {
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}

.outlook-positive {
    background: #e8f7f1;
    color: var(--positive);
}

.outlook-negative {
    background: #fff0f0;
    color: var(--negative);
}

.outlook-neutral {
    background: #fff7df;
    color: var(--neutral);
}

.results-grid,
.metrics-grid {
    display: grid;
    gap: 12px;
}

.results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 20px;
}

.metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 12px;
}

.result-box,
.metric-box {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #ffffff;
}

.box-label,
.metric-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.88rem;
}

.result-box strong,
.metric-box strong {
    font-size: 1.08rem;
}

.metrics {
    margin-top: 22px;
}

.metrics h3 {
    margin: 0;
}

.value-positive {
    color: var(--positive);
}

.value-negative {
    color: var(--negative);
}

.value-neutral {
    color: var(--neutral);
}

@media (max-width: 700px) {
    .results-grid,
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .card {
        padding: 24px;
    }

    .input-row,
    .results-header {
        flex-direction: column;
        align-items: stretch;
    }

    button {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .results-grid,
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Navigation bar
   ========================================================================== */

.main-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 6px;
}

.nav-link {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
}

.nav-link:hover {
    background: rgba(35, 104, 196, 0.08);
    color: var(--accent);
}

.nav-link.active {
    background: rgba(35, 104, 196, 0.12);
    color: var(--accent);
}

@media (max-width: 640px) {
    .nav-inner {
        flex-direction: column;
        gap: 8px;
    }
    .nav-links {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   Data tables (watchlist, predictions)
   ========================================================================== */

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
}

.data-table thead th {
    font-weight: 700;
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--border);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.12s ease;
}

.data-table tbody tr:hover {
    background: rgba(35, 104, 196, 0.04);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.action-cell {
    display: flex;
    gap: 6px;
}

/* ==========================================================================
   Buttons – variants
   ========================================================================== */

.btn-small {
    padding: 6px 12px;
    border: 0;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    color: #ffffff;
    transition: opacity 0.15s ease;
}

.btn-small:hover:not(:disabled) {
    opacity: 0.88;
}

.btn-small:disabled {
    opacity: 0.6;
    cursor: wait;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.btn-danger {
    background: linear-gradient(135deg, #d14545, #a93333);
}

.btn-secondary {
    padding: 12px 20px;
    border: 2px solid var(--accent);
    border-radius: 12px;
    font: inherit;
    font-weight: 700;
    color: var(--accent);
    background: transparent;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--accent);
    color: #ffffff;
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ==========================================================================
   Badges (owned, direction, status, result)
   ========================================================================== */

.badge-btn {
    padding: 5px 10px;
    border: 0;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.badge-btn:hover {
    opacity: 0.85;
}

.badge-owned {
    background: #e8f7f1;
    color: var(--positive);
}

.badge-not-owned {
    background: #f0f3f7;
    color: var(--muted);
}

.dir-badge,
.status-badge,
.result-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: capitalize;
}

.badge-up {
    background: #e8f7f1;
    color: var(--positive);
}

.badge-down {
    background: #fff0f0;
    color: var(--negative);
}

.badge-neutral {
    background: #fff7df;
    color: var(--neutral);
}

.badge-pending {
    background: #eef3ff;
    color: var(--accent);
}

.badge-completed {
    background: #e8f7f1;
    color: var(--positive);
}

.badge-correct {
    background: #e8f7f1;
    color: var(--positive);
}

.badge-incorrect {
    background: #fff0f0;
    color: var(--negative);
}

/* ==========================================================================
   Overlay (prediction result pop-up on watchlist page)
   ========================================================================== */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(23, 48, 79, 0.35);
    backdrop-filter: blur(4px);
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    width: min(560px, 92vw);
    max-height: 85vh;
    overflow-y: auto;
}

.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.overlay-header h3 {
    margin: 0;
}

.close-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   Feedback panels
   ========================================================================== */

.panel-success {
    border-color: #b5e6cd;
    background: #edfbf3;
    color: var(--positive);
    font-weight: 600;
}

/* ==========================================================================
   Empty state
   ========================================================================== */

.empty-state {
    padding: 20px 0;
    color: var(--muted);
    text-align: center;
    font-size: 0.95rem;
}

/* ==========================================================================
   Filters
   ========================================================================== */

.filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.filter-select,
.filter-input {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: #ffffff;
}

.filter-select:focus,
.filter-input:focus {
    outline: 3px solid rgba(35, 104, 196, 0.16);
    border-color: var(--accent);
}

/* ==========================================================================
   Evaluate row
   ========================================================================== */

.evaluate-row {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================================================
   Performance grid override
   ========================================================================== */

.perf-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (max-width: 700px) {
    .perf-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 520px) {
    .perf-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   Saved-note on predict page
   ========================================================================== */

.saved-note {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #edfbf3;
    color: var(--positive);
    font-weight: 600;
    font-size: 0.92rem;
}

.saved-note a {
    color: var(--positive);
}

/* ==========================================================================
   Link styling inside descriptions
   ========================================================================== */

.description a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.description a:hover {
    color: var(--accent-dark);
}

/* ==========================================================================
   Form select (model selector on predict page)
   ========================================================================== */

.form-field {
    margin-bottom: 16px;
}

.form-field label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

.form-select {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: #ffffff;
    cursor: pointer;
    appearance: auto;
}

.form-select:focus {
    outline: 3px solid rgba(35, 104, 196, 0.16);
    border-color: var(--accent);
}

/* ==========================================================================
   Section header (heading + inline control, e.g. watchlist + model select)
   ========================================================================== */

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

/* ==========================================================================
   Model badges (predictions table)
   ========================================================================== */

.model-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-model1 {
    background: #eef3ff;
    color: var(--accent);
}

.badge-model2 {
    background: #f3eeff;
    color: #6b3fa0;
}

.badge-model3 {
    background: #fef3e5;
    color: #a86c1f;
}

.badge-model4 {
    background: #e5f8f3;
    color: #1a7a5c;
}

.badge-model5 {
    background: #fce5ec;
    color: #a3324b;
}

/* ==========================================================================
   Performance comparison cards (predictions page – one card per model)
   ========================================================================== */

.perf-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.perf-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #ffffff;
}

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

.perf-card-header h4 {
    margin: 0;
    font-size: 1.08rem;
}

.perf-card-accuracy {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
    background: #eef3ff;
    color: var(--accent);
}

.perf-card-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.perf-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(215, 225, 238, 0.5);
    font-size: 0.9rem;
}

.perf-row:last-child {
    border-bottom: none;
}

.perf-row span {
    color: var(--muted);
}

@media (max-width: 520px) {
    .perf-comparison {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Comparison layout (predict page – side by side models)
   ========================================================================== */

.shared-close {
    text-align: right;
}

.shared-close .box-label {
    margin-bottom: 4px;
}

.shared-close strong {
    font-size: 1.3rem;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
}

.model-column {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #ffffff;
}

.model-column-header {
    margin-bottom: 14px;
}

.model-column-header h3 {
    margin: 0;
    font-size: 1.15rem;
}

.model-subtitle {
    font-size: 0.82rem;
    color: var(--muted);
}

.model-column .outlook-badge {
    display: inline-block;
    margin-bottom: 8px;
}

.compare-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.compare-stat {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-bg);
}

.compare-stat .box-label {
    margin-bottom: 4px;
}

.compare-stat strong {
    font-size: 1.05rem;
}

.mini-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    background: var(--panel-bg);
    font-size: 0.88rem;
}

.mini-metrics div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
}

.mini-metrics .metric-label {
    margin-bottom: 0;
    font-size: 0.82rem;
}

.mini-metrics strong {
    font-size: 0.9rem;
}

.model-column .data-note {
    margin-top: 10px;
    font-size: 0.82rem;
}

.model-column .panel-error {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 0.88rem;
}

@media (max-width: 700px) {
    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .shared-close {
        text-align: left;
    }
}

/* ==========================================================================
   Accordion (predictions page – grouped by ticker)
   ========================================================================== */

.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.accordion-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
}

.accordion-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: none;
    border-radius: 0;
    background: #ffffff;
    color: var(--text);
    font-size: 0.94rem;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

.accordion-header:hover {
    background: rgba(35, 104, 196, 0.04);
}

.accordion-chevron {
    font-size: 0.7rem;
    color: var(--muted);
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}

.accordion-ticker {
    font-size: 1.02rem;
}

.accordion-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.accordion-meta {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--muted);
    white-space: nowrap;
}

.accordion-body {
    display: none;
    border-top: 1px solid var(--border);
    padding: 4px 0;
}

.accordion-item.open .accordion-body {
    display: block;
}

.accordion-body .data-table {
    font-size: 0.86rem;
}

.accordion-body .data-table th {
    font-size: 0.76rem;
}

@media (max-width: 640px) {
    .accordion-header {
        flex-wrap: wrap;
    }

    .accordion-meta {
        width: 100%;
        margin-left: 24px;
        margin-top: 2px;
    }
}

/* ==========================================================================
   Run-All progress panel (watchlist page)
   ========================================================================== */

.section-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.run-all-panel {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel-bg);
}

.run-all-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.94rem;
}

.run-all-counter {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 400;
}

.run-all-log {
    margin-top: 12px;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.run-all-log-entry {
    font-size: 0.88rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(215, 225, 238, 0.4);
}

.run-all-log-entry:last-child {
    border-bottom: none;
}

.log-success {
    color: var(--positive);
    font-weight: 700;
}

.log-fail {
    color: var(--negative);
    font-weight: 700;
}

.log-skip {
    color: var(--muted);
    font-weight: 700;
}

.value-muted {
    color: var(--muted);
}

/* ==========================================================================
   Recommendations page
   ========================================================================== */

.rec-filter-form {
    margin-top: 20px;
}

.rec-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    align-items: end;
}

.rec-filter-field label {
    display: block;
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 5px;
}

.rec-filter-field .filter-select {
    width: 100%;
}

.rec-filter-checkbox {
    display: flex;
    align-items: center;
}

.rec-filter-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    margin-bottom: 0;
}

.rec-filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex: none;
    accent-color: var(--accent);
    cursor: pointer;
}

.rec-filter-actions {
    margin-top: 16px;
}

.rec-score-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
}

.rec-score-high {
    background: #e8f7f1;
    color: var(--positive);
}

.rec-score-mid {
    background: #fff7df;
    color: var(--neutral);
}

.rec-score-low {
    background: #fff0f0;
    color: var(--negative);
}

.rec-reasons-cell {
    white-space: normal;
    max-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rec-reason-tag {
    display: block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    background: #eef3ff;
    color: var(--accent);
    width: fit-content;
}

.rec-reason-more {
    background: #f0f3f7;
    color: var(--muted);
}

.rec-company-cell {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rec-reasons-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
    color: var(--text);
    font-size: 0.92rem;
}

.rec-reasons-list li {
    padding: 2px 0;
}

@keyframes rec-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.rec-news-section {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rec-news-item {
    padding: 8px 10px;
    border-radius: 10px;
    transition: background 0.12s ease;
}

.rec-news-item:hover {
    background: rgba(35, 104, 196, 0.04);
}

.rec-news-title {
    font-size: 0.9rem;
    line-height: 1.4;
}

.rec-news-title a {
    color: var(--text);
    text-decoration: none;
}

.rec-news-title a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.rec-news-meta {
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--muted);
}

.rec-news-source {
    font-weight: 600;
}

/* ---------- Sentiment word (table score column) ---------- */

.sentiment-word {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: capitalize;
    vertical-align: middle;
    cursor: help;
}

.sentiment-word.sentiment-positive { color: var(--positive); }
.sentiment-word.sentiment-neutral  { color: var(--neutral); }
.sentiment-word.sentiment-negative { color: var(--negative); }

/* ---------- Sentiment badge (overlay & analysis section) ---------- */

.sentiment-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
}

.sentiment-badge-positive {
    background: #e8f7f1;
    color: var(--positive);
}

.sentiment-badge-neutral {
    background: #fff7df;
    color: var(--neutral);
}

.sentiment-badge-negative {
    background: #fff0f0;
    color: var(--negative);
}

/* ---------- Score breakdown (overlay) ---------- */

.score-breakdown {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-bg);
    font-size: 0.88rem;
}

.score-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.score-part .box-label {
    margin-bottom: 0;
    font-size: 0.76rem;
}

.score-op {
    font-weight: 700;
    color: var(--muted);
    font-size: 1rem;
}

/* ---------- News analysis section (overlay) ---------- */

.news-analysis-section {
    margin: 0 0 8px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel-bg);
}

.news-summary {
    margin: 10px 0 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text);
}

.news-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.news-flag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
}

.flag-risk {
    background: #fff0f0;
    color: var(--negative);
}

.flag-catalyst {
    background: #e8f7f1;
    color: var(--positive);
}

@media (max-width: 900px) {
    .rec-filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .rec-filter-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Recommendations tabs (Gainers / Decliners)
   ========================================================================== */

.rec-tabs {
    display: flex;
    gap: 4px;
    margin-top: 22px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel-bg);
    width: fit-content;
}

.rec-tab {
    padding: 9px 18px;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.rec-tab:hover {
    color: var(--text);
    background: rgba(35, 104, 196, 0.06);
}

.rec-tab.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.rec-pane {
    margin-top: 4px;
}

/* ==========================================================================
   Likely Decliners – card grid + risk badges
   ========================================================================== */

.dec-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 14px;
    margin-top: 6px;
}

.dec-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #ffffff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dec-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(23, 48, 79, 0.08);
}

.dec-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dec-card-rank {
    flex: none;
    min-width: 34px;
    padding: 4px 8px;
    border-radius: 8px;
    background: var(--panel-bg);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.82rem;
    text-align: center;
}

.dec-card-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    overflow: hidden;
}

.dec-ticker {
    font-size: 1.1rem;
    color: var(--text);
}

.dec-company {
    font-size: 0.82rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dec-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
}

.dec-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.dec-stat .box-label {
    margin-bottom: 0;
    font-size: 0.72rem;
}

.dec-stat strong {
    font-size: 0.9rem;
}

.dec-card-reasons {
    font-size: 0.86rem;
    color: var(--text);
}

.dec-card-reasons .box-label {
    margin-bottom: 4px;
}

.dec-card-reasons ul {
    margin: 0;
    padding-left: 18px;
    line-height: 1.5;
}

.dec-card-reasons li {
    padding: 1px 0;
}

.dec-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* Inline secondary button (smaller version of btn-secondary) */
.btn-secondary-small {
    padding: 6px 12px;
    border: 1.5px solid var(--accent);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-secondary-small:hover:not(:disabled) {
    background: var(--accent);
    color: #ffffff;
}

.btn-secondary-small:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   Risk-level badges (Low / Medium / High)
   ========================================================================== */

.risk-level-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.risk-level-low {
    background: #e8f7f1;
    color: var(--positive);
}

.risk-level-medium {
    background: #fff7df;
    color: var(--neutral);
}

.risk-level-high {
    background: #fff0f0;
    color: var(--negative);
}

/* ==========================================================================
   News sentiment indicator dot (green / yellow / red)
   ========================================================================== */

.sentiment-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7) inset;
    cursor: help;
}

.sentiment-dot-green {
    background: #1ea76d;
    box-shadow: 0 0 0 1px rgba(21, 129, 95, 0.55);
}

.sentiment-dot-yellow {
    background: #e9c451;
    box-shadow: 0 0 0 1px rgba(140, 108, 31, 0.55);
}

.sentiment-dot-red {
    background: #d75555;
    box-shadow: 0 0 0 1px rgba(193, 70, 70, 0.55);
}

/* ==========================================================================
   Decliner overlay extras
   ========================================================================== */

.dec-summary-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 18px;
    align-items: start;
    padding: 14px;
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-bg);
}

.dec-summary-row > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dec-news-blurb p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
}

@media (max-width: 640px) {
    .dec-summary-row {
        grid-template-columns: 1fr;
    }

    .dec-card-stats {
        grid-template-columns: 1fr 1fr;
    }
}
