/* ===== Ventriloc-inspired parchment analytics system ===== */
:root {
    --color-signal-orange: #ff682c;
    --color-sienna-bronze: #816729;
    --color-carbon: #202020;
    --color-graphite: #4d4d4d;
    --color-slate: #828282;
    --color-fog: #f5f5f5;
    --color-mist: #efefef;
    --color-chalk: #e8e8e8;
    --color-paper: #ffffff;

    --bg-primary: var(--color-mist);
    --bg-secondary: var(--color-paper);
    --bg-card: var(--color-paper);
    --bg-hover: var(--color-fog);
    --text-primary: var(--color-carbon);
    --text-secondary: var(--color-graphite);
    --text-muted: var(--color-slate);
    --accent: var(--color-signal-orange);
    --accent-primary: var(--color-signal-orange);
    --accent-secondary: var(--color-sienna-bronze);
    --border: rgba(32, 32, 32, 0.12);
    --border-strong: rgba(32, 32, 32, 0.28);

    --bullish: #2f7d55;
    --bullish-bg: rgba(47, 125, 85, 0.1);
    --bearish: #9b3a34;
    --bearish-bg: rgba(155, 58, 52, 0.1);
    --neutral: var(--color-sienna-bronze);
    --neutral-bg: rgba(129, 103, 41, 0.1);

    --font-polysans: "Space Grotesk", "DM Sans", "General Sans", Arial, sans-serif;
    --font-inter: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --radius-card: 8px;
    --radius-input: 8px;
    --radius-pill: 20px;
    --radius-nav: 200px;
    --shadow-soft: 0 1px 3px rgba(32, 32, 32, 0.04), 0 4px 12px rgba(32, 32, 32, 0.03);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background: var(--color-mist);
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 6%, rgba(255, 104, 44, 0.06), transparent 34rem),
        linear-gradient(180deg, var(--color-mist) 0%, var(--color-fog) 100%);
    color: var(--text-primary);
    font-family: var(--font-inter);
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

a {
    color: inherit;
}

::selection {
    background: rgba(255, 104, 44, 0.18);
}

/* ===== Shell ===== */
.app-container {
    width: min(1200px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 20px 0 28px;
    display: flex;
    flex-direction: column;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 38px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    font-family: var(--font-polysans);
    font-size: 1.02rem;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--color-carbon);
    white-space: nowrap;
}

.brand-accent {
    width: 18px;
    height: 12px;
    margin: 2px 1px 0;
    border-top: 3px solid var(--color-signal-orange);
    border-radius: 999px;
    transform: rotate(-15deg);
}


/* ===== Hero ===== */
.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(440px, 1.05fr);
    gap: 44px;
    align-items: center;
    padding-bottom: 78px;
}

.hero-copy {
    max-width: 560px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--color-graphite);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-signal-orange);
}

.hero-copy h1,
.section-heading h2,
.sidebar-header h3,
.holding-symbol,
.summary-item .value,
.donut-card strong {
    font-family: var(--font-polysans);
    font-weight: 400;
    letter-spacing: -0.02em;
}

.hero-copy h1 {
    max-width: 11ch;
    color: var(--color-carbon);
    font-size: clamp(3.5rem, 7.1vw, 5rem);
    line-height: 0.91;
}

.hero-lede {
    max-width: 510px;
    margin-top: 24px;
    color: var(--color-graphite);
    font-size: 1.05rem;
    line-height: 1.5;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.pill-button,
.add-stock-form button,
.ai-analyze-btn,
.edit-save-btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-carbon);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.pill-button.filled,
.add-stock-form button,
.ai-analyze-btn,
.edit-save-btn {
    background: var(--color-carbon);
    color: var(--color-paper);
}

.pill-button.outlined {
    background: transparent;
    color: var(--color-carbon);
}

.pill-button:hover,
.add-stock-form button:hover,
.ai-analyze-btn:hover,
.edit-save-btn:hover {
    transform: translateY(-1px);
}

.partner-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 26px;
    margin-top: 40px;
    color: var(--color-slate);
    font-size: 0.82rem;
    font-weight: 600;
}

.partner-strip span {
    filter: grayscale(1);
}

/* ===== Dashboard Preview ===== */
.dashboard-preview {
    position: relative;
    padding: 20px;
    background: var(--color-paper);
    border: 1px solid rgba(32, 32, 32, 0.08);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
}


.preview-topbar,
.chart-heading,
.chart-axis,
.preview-widgets {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-topbar {
    margin-bottom: 18px;
}

.preview-kicker,
.widget-label,
.chart-heading,
.chart-axis {
    color: var(--color-slate);
    font-size: 0.75rem;
    font-weight: 500;
}

.preview-topbar strong {
    display: block;
    margin-top: 2px;
    color: var(--color-carbon);
    font-family: var(--font-polysans);
    font-size: 1.45rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1;
}

.live-pill {
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: var(--color-fog);
    color: var(--color-graphite);
    font-size: 0.78rem;
    font-weight: 600;
}

.live-pill::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: var(--color-signal-orange);
}

.portfolio-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.summary-item {
    min-width: 0;
    padding: 18px;
    background: var(--color-fog);
    border: 1px solid rgba(32, 32, 32, 0.06);
    border-radius: var(--radius-card);
}

.summary-item .label {
    display: block;
    margin-bottom: 10px;
    color: var(--color-slate);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
}

.summary-item .value {
    min-width: 0;
    display: grid;
    gap: 4px;
    color: var(--color-carbon);
    font-size: clamp(1.22rem, 2vw, 1.75rem);
    line-height: 1;
    white-space: normal;
    overflow-wrap: anywhere;
}

.summary-amount {
    min-width: 0;
}

.summary-percent {
    min-width: 0;
    color: inherit;
    font-family: var(--font-inter);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.15;
}

.preview-allocation-card {
    margin-top: 12px;
    padding: 18px;
    background: var(--color-paper);
    border: 1px solid var(--color-chalk);
    border-radius: var(--radius-card);
}

.chart-heading {
    margin-bottom: 12px;
}

.preview-widgets {
    gap: 12px;
    margin-top: 12px;
}

.allocation-list {
    display: grid;
    gap: 12px;
    min-height: 205px;
}

.allocation-empty {
    min-height: 205px;
    display: grid;
    place-items: center;
    padding: 24px;
    color: var(--color-slate);
    background: var(--color-fog);
    border: 1px dashed rgba(32, 32, 32, 0.16);
    border-radius: var(--radius-card);
    text-align: center;
}

.allocation-row {
    display: grid;
    grid-template-columns: minmax(96px, 1fr) minmax(120px, 2fr) 52px;
    gap: 12px;
    align-items: center;
}

.allocation-label {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.allocation-label span {
    color: var(--color-carbon);
    font-weight: 700;
    line-height: 1.15;
}

.allocation-label small {
    color: var(--color-slate);
    font-size: 0.72rem;
    white-space: nowrap;
}

.allocation-track,
.health-track {
    height: 12px;
    overflow: hidden;
    background: var(--color-fog);
    border-radius: 999px;
}

.allocation-track span,
.health-track span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--color-signal-orange);
    border-radius: inherit;
    transition: width 0.24s ease;
}

.allocation-row strong {
    color: var(--color-graphite);
    font-size: 0.8rem;
    text-align: right;
}

.concentration-card,
.position-health-card {
    flex: 1;
    min-height: 126px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--color-fog);
    border-radius: var(--radius-card);
}

.donut-ring {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: conic-gradient(var(--color-signal-orange) 0 var(--donut-angle, 0deg), var(--color-chalk) var(--donut-angle, 0deg) 360deg);
    position: relative;
    flex-shrink: 0;
}

.donut-ring::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: var(--color-fog);
}

.concentration-card strong {
    display: block;
    margin-top: 3px;
    color: var(--color-carbon);
    font-size: 2rem;
    line-height: 1;
}

.widget-note {
    display: block;
    margin-top: 4px;
    color: var(--color-slate);
    font-size: 0.72rem;
    font-weight: 600;
}

.position-health-card {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
}

.health-bars {
    display: grid;
    gap: 9px;
    margin-top: 10px;
}

.health-row {
    display: grid;
    grid-template-columns: 70px minmax(70px, 1fr) 22px;
    gap: 8px;
    align-items: center;
    color: var(--color-graphite);
    font-size: 0.72rem;
    font-weight: 600;
}

.health-row b {
    color: var(--color-carbon);
    font-size: 0.72rem;
    text-align: right;
}

#previewDownBar {
    background: var(--bearish);
}

#previewFlatBar {
    background: var(--color-sienna-bronze);
}

/* ===== Layout and sections ===== */
.content-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
    align-items: start;
    flex: 1;
}

.main-content {
    min-width: 0;
    display: grid;
    gap: 20px;
}

.surface-panel,
.sidebar-section {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(32, 32, 32, 0.08);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
}

.surface-panel {
    padding: 32px;
}

.section-heading h2 {
    color: var(--color-carbon);
    font-size: clamp(1.85rem, 3.2vw, 2.5rem);
    line-height: 1;
}

.section-heading .eyebrow {
    margin-bottom: 8px;
}

/* ===== Add Stock ===== */
.add-stock-section {
    scroll-margin-top: 24px;
}

.add-stock-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 130px 140px auto;
    gap: 12px;
    margin-top: 22px;
}

.add-stock-form input,
.edit-input {
    width: 100%;
    min-height: 42px;
    padding: 11px 13px;
    background: var(--color-fog);
    border: 1px solid var(--color-chalk);
    border-radius: var(--radius-input);
    color: var(--color-carbon);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.add-stock-form input::placeholder,
.edit-input::placeholder {
    color: var(--color-slate);
}

.add-stock-form input:focus,
.edit-input:focus {
    background: var(--color-paper);
    border-color: rgba(255, 104, 44, 0.6);
    box-shadow: 0 0 0 3px rgba(255, 104, 44, 0.13);
}

/* ===== Holdings ===== */
.holdings-section {
    scroll-margin-top: 24px;
}

.holdings-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.ai-analyze-btn {
    flex-shrink: 0;
}

.ai-analysis-container {
    margin-bottom: 18px;
    overflow: hidden;
    background: var(--color-paper);
    border: 1px solid rgba(255, 104, 44, 0.35);
    border-radius: var(--radius-card);
}

.ai-analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(90deg, rgba(255, 104, 44, 0.1), transparent);
    border-bottom: 1px solid var(--color-chalk);
    color: var(--color-carbon);
    font-weight: 600;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--color-chalk);
    border-radius: 50%;
    background: var(--color-paper);
    color: var(--color-slate);
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.close-btn:hover {
    color: var(--color-carbon);
    border-color: var(--color-carbon);
}

.ai-analysis-content {
    padding: 20px;
    color: var(--color-graphite);
    font-size: 0.95rem;
    line-height: 1.6;
}

.ai-analysis-content p:not(:last-child) {
    margin-bottom: 12px;
}

.ai-analysis-content strong {
    color: var(--color-carbon);
}

.analysis-loading,
.analysis-error,
.feed-loading,
.feed-empty,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    color: var(--color-slate);
}

.analysis-loading,
.analysis-error {
    padding: 24px;
}

.analysis-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--color-chalk);
    color: var(--color-slate);
    font-size: 0.78rem;
}

.holdings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.empty-state {
    grid-column: 1 / -1;
    min-height: 220px;
    padding: 34px;
    background: var(--color-fog);
    border: 1px dashed rgba(32, 32, 32, 0.18);
    border-radius: var(--radius-card);
}

.empty-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--color-chalk);
    border-radius: 50%;
    color: var(--color-signal-orange);
    font-size: 1.4rem;
}

.empty-state p:first-of-type {
    color: var(--color-carbon);
    font-family: var(--font-polysans);
    font-size: 1.65rem;
    line-height: 1;
    letter-spacing: -0.02em;
}

.hint {
    color: var(--color-slate);
    font-size: 0.86rem;
}

.holding-card {
    position: relative;
    min-height: 320px;
    padding: 20px;
    background: var(--color-paper);
    border: 1px solid rgba(32, 32, 32, 0.09);
    border-radius: var(--radius-card);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.holding-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--color-chalk);
    transition: background 0.18s ease;
}

.holding-card:hover {
    transform: translateY(-2px);
    border-color: rgba(32, 32, 32, 0.22);
}

.holding-card:hover::before,
.holding-card.selected::before {
    background: var(--color-signal-orange);
}

.holding-card.selected {
    border-color: rgba(255, 104, 44, 0.55);
    background: linear-gradient(180deg, var(--color-paper), rgba(255, 104, 44, 0.035));
}

.holding-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.holding-symbol {
    color: var(--color-carbon);
    font-size: 2.2rem;
    line-height: 0.95;
}

.holding-name {
    margin-top: 6px;
    color: var(--color-slate);
    font-size: 0.86rem;
    line-height: 1.25;
}

.holding-remove {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--color-chalk);
    border-radius: 50%;
    background: var(--color-fog);
    color: var(--color-slate);
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.holding-remove:hover {
    background: var(--bearish-bg);
    border-color: rgba(155, 58, 52, 0.2);
    color: var(--bearish);
}

.holding-price {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
}

.holding-current-price {
    font-family: var(--font-polysans);
    font-size: 2rem;
    line-height: 1;
    letter-spacing: -0.02em;
}

.holding-change,
.sentiment-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.holding-change.positive,
.metric-box.positive .metric-value,
.holding-pl.positive,
.news-sentiment.bullish {
    color: var(--bullish);
}

.holding-change.positive,
.sentiment-badge.bullish {
    background: var(--bullish-bg);
}

.holding-change.negative,
.metric-box.negative .metric-value,
.holding-pl.negative,
.news-sentiment.bearish {
    color: var(--bearish);
}

.holding-change.negative,
.sentiment-badge.bearish {
    background: var(--bearish-bg);
}

.sentiment-badge.neutral,
.news-sentiment.neutral {
    color: var(--neutral);
}

.sentiment-badge.neutral {
    background: var(--neutral-bg);
}

.holding-details,
.holding-cost-basis {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-chalk);
    color: var(--color-graphite);
    font-size: 0.86rem;
}

.holding-cost-basis {
    margin-top: 10px;
    align-items: center;
    color: var(--color-slate);
}

.holding-cost-basis.no-cost {
    justify-content: flex-start;
}

.holding-pl {
    font-weight: 600;
}

.edit-holding-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--color-chalk);
}

.edit-field {
    display: grid;
    gap: 5px;
}

.edit-field label {
    color: var(--color-slate);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.edit-input {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.86rem;
}

.edit-save-btn {
    min-height: 38px;
    padding: 8px 13px;
    font-size: 0.84rem;
}

/* ===== Sidebar ===== */
.main-sidebar {
    position: sticky;
    top: 20px;
    display: grid;
    gap: 20px;
}

.sidebar-section {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    scroll-margin-top: 24px;
}

.news-section-sidebar {
    min-height: 360px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding: 20px;
    border-bottom: 1px solid var(--color-chalk);
    background: rgba(245, 245, 245, 0.72);
}

.sidebar-header h3 {
    color: var(--color-carbon);
    font-size: 1.65rem;
    line-height: 1;
}

.sidebar-header .eyebrow {
    margin-bottom: 7px;
    font-size: 0.68rem;
}

.refresh-btn {
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid var(--color-carbon);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--color-carbon);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.refresh-btn:hover {
    background: var(--color-carbon);
    color: var(--color-paper);
    transform: translateY(-1px);
}

.sectors-scroll,
.news-scroll {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-slate) transparent;
}

.sectors-scroll {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 12px;
    max-height: 550px;
}

.sector-card {
    flex: 0 0 auto;
    position: relative;
    padding: 14px;
    background: var(--color-paper);
    border: 1px solid var(--color-chalk);
    border-left: 3px solid var(--color-chalk);
    border-radius: var(--radius-card);
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.sector-card:hover {
    transform: translateY(-1px);
    background: var(--color-fog);
}

.sector-card.positive {
    border-left-color: rgba(47, 125, 85, 0.42);
}

.sector-card.negative {
    border-left-color: rgba(155, 58, 52, 0.42);
}

.sector-card.top-gainer {
    border-color: rgba(255, 104, 44, 0.38);
    border-left-color: var(--color-signal-orange);
}

.rank-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 9px;
    border-radius: var(--radius-pill);
    background: rgba(255, 104, 44, 0.13);
    color: var(--color-sienna-bronze);
    font-size: 0.72rem;
    font-weight: 700;
}

.sector-name {
    max-width: calc(100% - 46px);
    color: var(--color-carbon);
    font-weight: 600;
    font-size: 0.93rem;
    line-height: 1.22;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sector-symbol {
    margin-top: 3px;
    color: var(--color-slate);
    font-size: 0.76rem;
}

.sector-price {
    margin-top: 12px;
    color: var(--color-carbon);
    font-family: var(--font-polysans);
    font-size: 1.55rem;
    line-height: 1;
    letter-spacing: -0.02em;
}

.sector-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-top: 12px;
}

.metric-box {
    padding: 8px 5px;
    background: var(--color-fog);
    border-radius: var(--radius-card);
    text-align: center;
}

.metric-label {
    margin-bottom: 3px;
    color: var(--color-slate);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.metric-value {
    color: var(--color-graphite);
    font-size: 0.75rem;
    font-weight: 700;
}

/* ===== News ===== */
.news-scroll {
    padding: 8px;
    max-height: 500px;
}

.news-scroll .news-item {
    display: block;
    padding: 13px 12px;
    border: 1px solid transparent;
    border-bottom-color: var(--color-chalk);
    border-radius: var(--radius-card);
    color: var(--color-carbon);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.news-scroll .news-item:last-child {
    border-bottom-color: transparent;
}

.news-scroll .news-item:hover {
    background: var(--color-fog);
    border-color: var(--color-chalk);
}

.news-source {
    margin-bottom: 6px;
    color: var(--color-sienna-bronze);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.news-title,
.news-headline {
    color: var(--color-carbon);
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.35;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    color: var(--color-slate);
    font-size: 0.73rem;
}

.news-symbols {
    color: var(--color-graphite);
    font-weight: 600;
}

.news-section {
    margin-bottom: 0;
}

.news-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.news-list {
    display: grid;
    gap: 12px;
}

.news-list .news-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--color-fog);
    border: 1px solid var(--color-chalk);
    border-radius: var(--radius-card);
    transition: border-color 0.18s ease, background 0.18s ease;
}

.news-list .news-item:hover {
    background: var(--color-paper);
    border-color: rgba(255, 104, 44, 0.35);
}

.news-thumbnail {
    width: 104px;
    height: 74px;
    object-fit: cover;
    border-radius: var(--radius-card);
    background: var(--color-chalk);
    filter: grayscale(1);
}

.news-content {
    flex: 1;
    min-width: 0;
}

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

.news-title a:hover {
    color: var(--color-sienna-bronze);
}

.news-sentiment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
}

/* ===== Loading and feedback ===== */
.feed-loading,
.feed-empty {
    min-height: 160px;
    padding: 24px;
}

.spinner,
.spinner-small {
    border-radius: 50%;
    border-style: solid;
    border-color: var(--color-chalk);
    border-top-color: var(--color-signal-orange);
    animation: spin 0.9s linear infinite;
}

.spinner-small {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

.spinner {
    width: 52px;
    height: 52px;
    border-width: 4px;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: rgba(239, 239, 239, 0.86);
    color: var(--color-carbon);
    backdrop-filter: blur(10px);
}

.loading-overlay.active {
    display: flex;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Legacy optional surfaces kept styled if reintroduced ===== */
.market-feed,
.twitter-embeds,
.twitter-profiles {
    overflow-y: auto;
}

.profile-card,
.tweet-item,
.twitter-link,
.quick-link {
    display: block;
    padding: 14px;
    background: var(--color-paper);
    border: 1px solid var(--color-chalk);
    border-radius: var(--radius-card);
    color: var(--color-carbon);
    text-decoration: none;
}

/* ===== Footer ===== */
.footer {
    margin-top: 36px;
    padding: 22px 0 4px;
    color: var(--color-slate);
    font-size: 0.86rem;
    text-align: center;
}

/* ===== Portfolio Chart Card ===== */
.preview-chart-card {
    background: var(--color-paper);
    border: 1px solid rgba(32, 32, 32, 0.08);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.chart-title-area {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chart-label {
    color: var(--color-slate);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chart-metrics {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.chart-change {
    font-size: 1.45rem;
    font-weight: 600;
    font-family: var(--font-polysans);
}

.chart-change.positive {
    color: var(--bullish);
}

.chart-change.negative {
    color: var(--bearish);
}

.chart-timeframe-selectors {
    display: flex;
    gap: 4px;
    background: var(--color-fog);
    padding: 3px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(32, 32, 32, 0.04);
}

.timeframe-btn {
    border: none;
    background: transparent;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-slate);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.timeframe-btn:hover {
    color: var(--color-carbon);
}

.timeframe-btn.active {
    background: var(--color-paper);
    color: var(--color-carbon);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chart-content {
    position: relative;
    width: 100%;
    height: 220px;
    min-height: 220px;
}

.chart-canvas-container {
    width: 100%;
    height: 100%;
}

.chart-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-card);
    color: var(--color-slate);
    font-size: 0.88rem;
    font-weight: 500;
    border: 1px dashed rgba(32, 32, 32, 0.12);
}


/* ===== Responsive ===== */
@media (max-width: 1120px) {
    .hero-panel {
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .hero-copy {
        max-width: 740px;
    }

    .hero-copy h1 {
        max-width: 12ch;
    }

    .content-layout {
        grid-template-columns: 1fr;
    }

    .main-sidebar {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sectors-scroll,
    .news-scroll {
        max-height: 470px;
    }
}

@media (max-width: 820px) {
    .app-container {
        width: min(100% - 28px, 1200px);
        padding-top: 14px;
    }


    .hero-panel {
        padding-bottom: 50px;
    }

    .hero-copy h1 {
        font-size: clamp(3.1rem, 13vw, 4.4rem);
    }

    .dashboard-preview {
        padding: 14px;
    }

    .portfolio-summary,
    .main-sidebar {
        grid-template-columns: 1fr;
    }

    .preview-widgets {
        flex-direction: column;
    }

    .allocation-row {
        grid-template-columns: minmax(72px, 0.8fr) minmax(96px, 1.5fr) 48px;
    }

    .add-stock-form {
        grid-template-columns: 1fr 1fr;
    }

    .add-stock-form input:first-child,
    .add-stock-form button {
        grid-column: 1 / -1;
    }

    .surface-panel {
        padding: 24px;
    }

    .holdings-header,
    .news-header {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-analyze-btn,
    .sentiment-badge {
        width: fit-content;
    }
}

@media (max-width: 540px) {
    .app-header {
        justify-content: center;
    }

    .hero-actions,
    .partner-strip {
        flex-direction: column;
        align-items: stretch;
    }

    .pill-button {
        width: 100%;
    }

    .add-stock-form,
    .edit-holding-row {
        grid-template-columns: 1fr;
    }

    .holdings-grid {
        grid-template-columns: 1fr;
    }

    .holding-price,
    .holding-details,
    .holding-cost-basis,
    .news-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .news-list .news-item {
        flex-direction: column;
    }

    .news-thumbnail {
        width: 100%;
        height: 150px;
    }
}

/* Custom Sector Exposure & Tabs Styles */
.allocation-toggle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.allocation-tabs {
    display: flex;
    gap: 4px;
    background: var(--color-fog);
    padding: 3px;
    border-radius: 6px;
    border: 1px solid rgba(32, 32, 32, 0.05);
}

.alloc-tab-btn {
    border: none;
    background: none;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-slate);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.alloc-tab-btn.active {
    background: var(--color-paper);
    color: var(--color-carbon);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.holding-sector-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 6px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--color-slate);
    background: var(--color-fog);
    border: 1px solid rgba(32, 32, 32, 0.05);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    width: fit-content;
}

