/* ==============================================
   GWS Stock Insights & Market View Styles
   ============================================== */

/* ── Stock Insights: Card Grid ─────────────── */
.gws-insight-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.gws-insight-card {
    background: var(--gws-card);
    border: 1px solid var(--gws-border);
    border-radius: var(--gws-radius);
    padding: 1.1rem;
    cursor: pointer;
    transition: all var(--gws-transition);
    box-shadow: var(--gws-shadow);
    position: relative;
}
.gws-insight-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    border-color: var(--gws-accent);
}
.gws-insight-card.active {
    border-color: var(--gws-accent);
    box-shadow: 0 4px 14px rgba(44, 62, 80, 0.2);
}

.gws-insight-card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.6rem;
}
.gws-insight-ticker {
    font-size: 1rem; font-weight: 800; color: var(--gws-accent);
    letter-spacing: 0.02em;
}
.gws-insight-date {
    font-size: 0.68rem; font-weight: 600; color: var(--gws-text-muted);
    background: #f1f5f9; padding: 0.15rem 0.5rem; border-radius: 10px;
}

.gws-insight-name {
    font-size: 0.82rem; font-weight: 600; color: var(--gws-text);
    margin-bottom: 0.5rem; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.gws-insight-meta {
    display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
    margin-bottom: 0.55rem;
}
.gws-insight-sector {
    font-size: 0.68rem; font-weight: 700; color: white;
    padding: 0.15rem 0.5rem; border-radius: 4px;
    white-space: nowrap;
    background: #94a3b8; /* fallback */
}
/* GICS sector colors. Aliases for yfinance's taxonomy variants are included
   so unknown/variant industry labels still land on the right color. */
.gws-insight-sector[data-sector="consumer-staples"],
.gws-insight-sector[data-sector="consumer-defensive"]      { background: #10B981; }
.gws-insight-sector[data-sector="consumer-discretionary"],
.gws-insight-sector[data-sector="consumer-cyclical"]       { background: #F59E0B; }
.gws-insight-sector[data-sector="information-technology"],
.gws-insight-sector[data-sector="technology"]              { background: #3b82f6; }
.gws-insight-sector[data-sector="energy"]                  { background: #EF4444; }
.gws-insight-sector[data-sector="industrials"]             { background: #8b5cf6; }
.gws-insight-sector[data-sector="health-care"],
.gws-insight-sector[data-sector="healthcare"]              { background: #06b6d4; }
.gws-insight-sector[data-sector="financials"],
.gws-insight-sector[data-sector="financial-services"]      { background: #2C3E50; }
.gws-insight-sector[data-sector="materials"],
.gws-insight-sector[data-sector="basic-materials"]         { background: #d97706; }
.gws-insight-sector[data-sector="communication-services"],
.gws-insight-sector[data-sector="communications"]          { background: #ec4899; }
.gws-insight-sector[data-sector="utilities"]               { background: #6b7280; }
.gws-insight-sector[data-sector="real-estate"]             { background: #14b8a6; }

/* Report button in header — sits next to close button */
.gws-insight-exp-actions {
    display: flex; align-items: center; gap: 0.35rem;
}
.gws-insight-exp-report {
    display: flex; align-items: center; gap: 0.35rem;
    padding: 0.35rem 0.65rem; border-radius: 8px;
    border: 1.5px solid var(--gws-border);
    font-size: 0.75rem; font-weight: 600; color: var(--gws-text-muted);
    text-decoration: none; transition: all 0.15s ease;
    position: relative;
}
.gws-insight-exp-report i { font-size: 0.8rem; }
.gws-insight-exp-report span { letter-spacing: 0.02em; }
.gws-insight-exp-report:hover {
    border-color: var(--gws-accent); color: var(--gws-accent);
    background: rgba(44, 62, 80, 0.04);
}
/* exp-preview replaced by shared .mv-report-eye */
.gws-insight-exp-preview-unused {
    display: none; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    border: 1.5px solid var(--gws-border);
    color: var(--gws-text-muted); text-decoration: none;
    transition: all 0.15s ease;
}
.gws-insight-exp-preview:hover {
    border-color: var(--gws-accent); color: var(--gws-accent);
    background: rgba(44, 62, 80, 0.04);
}
.gws-insight-exp-actions:hover .gws-insight-exp-preview { display: flex; }

/* Live-data status banner (stale / watchlist / unavailable) */
.gws-insight-banner {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.78rem; font-weight: 600;
    margin-bottom: 1rem;
    border: 1px solid;
}
.gws-insight-banner i { font-size: 0.95rem; flex-shrink: 0; }
.gws-insight-banner-stale {
    background: rgba(245, 158, 11, 0.08);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.25);
}
.gws-insight-banner-watchlist {
    background: rgba(59, 130, 246, 0.08);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.25);
}
.gws-insight-banner-unavailable {
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.25);
}

/* Sub-title inside Business & Financials revenue section */
.gws-rev-sub-title {
    font-size: 0.72rem; font-weight: 700; color: var(--gws-text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.gws-insight-country {
    font-size: 0.68rem; color: var(--gws-text-muted); font-weight: 500;
}
.gws-insight-bottom {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 0.55rem; border-top: 1px solid #f1f5f9;
}
.gws-insight-price {
    font-size: 0.78rem; font-weight: 700; color: var(--gws-text);
}
.gws-insight-ytd {
    font-size: 0.72rem; font-weight: 700;
    padding: 0.1rem 0.35rem; border-radius: 4px;
}
.gws-insight-ytd-pos { color: var(--gws-positive); background: var(--gws-positive-bg); }
.gws-insight-ytd-neg { color: var(--gws-negative); background: var(--gws-negative-bg); }

/* ── Stock Insights: Expanded View ─────────── */
.gws-insight-expanded {
    background: var(--gws-card);
    border: 1px solid var(--gws-border);
    border-radius: var(--gws-radius);
    box-shadow: var(--gws-shadow-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    animation: gws-expand-in 0.25s ease;
    min-width: 0;
    overflow: hidden;
}
.gws-insight-exp-content {
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
@keyframes gws-expand-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.gws-insight-exp-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem; padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gws-border);
}
.gws-insight-exp-title {
    display: flex; align-items: center; gap: 0.75rem;
}
.gws-insight-exp-title h4 {
    margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--gws-accent);
}
.gws-insight-exp-title span {
    font-size: 0.85rem; color: var(--gws-text-muted); font-weight: 500;
}
.gws-insight-exp-close {
    background: transparent; border: 1.5px solid var(--gws-border);
    width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--gws-text-muted); transition: all var(--gws-transition);
}
.gws-insight-exp-close:hover {
    border-color: var(--gws-negative); color: var(--gws-negative);
    background: var(--gws-negative-bg);
}

.gws-insight-exp-tabs {
    display: flex; gap: 0.35rem; margin-bottom: 1.25rem;
}
.gws-insight-exp-tab {
    padding: 0.45rem 1rem; border: 1.5px solid var(--gws-border);
    background: var(--gws-card); border-radius: 8px;
    font-size: 0.82rem; font-weight: 600; color: var(--gws-text-muted);
    cursor: pointer; transition: all var(--gws-transition);
}
.gws-insight-exp-tab:hover { border-color: var(--gws-accent); color: var(--gws-accent); }
.gws-insight-exp-tab.active {
    background: var(--gws-accent); color: white; border-color: var(--gws-accent);
}

.gws-insight-exp-content { display: none; }
.gws-insight-exp-content.active { display: block; }

/* Overview tab */
.gws-insight-desc {
    font-size: 0.88rem; color: var(--gws-text); line-height: 1.65;
    margin-bottom: 1.25rem;
}

.gws-insight-ratings {
    display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.gws-insight-rating-badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.3rem 0.65rem; border-radius: 6px;
    font-size: 0.75rem; font-weight: 700; color: white;
}
.gws-insight-rating-label {
    opacity: 0.8; font-weight: 500; font-size: 0.68rem;
}

.gws-insight-metrics-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
}
.gws-insight-metric {
    padding: 0.65rem 0.75rem; background: #f8fafc;
    border-radius: 8px; border: 1px solid #f1f5f9;
}
.gws-insight-metric .label {
    font-size: 0.68rem; color: var(--gws-text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.15rem;
}
.gws-insight-metric .value {
    font-size: 1rem; font-weight: 700; color: var(--gws-text);
}

/* Thesis tab */
.gws-insight-thesis {
    font-size: 0.9rem; color: var(--gws-text); line-height: 1.75;
}

/* Valuation tab */
.gws-insight-val-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem;
}
.gws-insight-val-card {
    background: #f8fafc; border: 1px solid #f1f5f9;
    border-radius: var(--gws-radius); padding: 1rem;
    text-align: center;
}
.gws-insight-val-card .label {
    font-size: 0.72rem; color: var(--gws-text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}
.gws-insight-val-card .value {
    font-size: 1.35rem; font-weight: 800; color: var(--gws-accent);
}

/* ── Market View: Sub-tabs ─────────────────── */
.gws-mv-tabs {
    display: flex; gap: 0.35rem; margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.gws-mv-tab {
    padding: 0.55rem 1.2rem; background: var(--gws-card);
    border: 1.5px solid var(--gws-border); border-radius: var(--gws-radius);
    font-size: 0.85rem; font-weight: 600; color: var(--gws-text-muted);
    cursor: pointer; transition: all var(--gws-transition);
}
.gws-mv-tab:hover { border-color: var(--gws-accent); color: var(--gws-accent); }
.gws-mv-tab.active {
    background: var(--gws-accent); color: white; border-color: var(--gws-accent);
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.25);
}

.gws-mv-content { display: none; }
.gws-mv-content.active { display: block; }

/* Market View header */
.gws-mv-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem;
}
.gws-mv-title {
    font-size: 1.1rem; font-weight: 800; color: var(--gws-accent);
}
.gws-mv-issue {
    font-size: 0.78rem; color: var(--gws-text-muted); font-weight: 600;
}
.gws-mv-date {
    font-size: 0.78rem; font-weight: 600; color: var(--gws-text-muted);
    background: #f1f5f9; padding: 0.2rem 0.65rem; border-radius: 10px;
}

/* Summary section */
.gws-mv-summary-card {
    background: var(--gws-card); border: 1px solid var(--gws-border);
    border-radius: var(--gws-radius); padding: 1.25rem;
    box-shadow: var(--gws-shadow); margin-bottom: 1rem;
}
.gws-mv-summary-card h6 {
    font-size: 0.78rem; font-weight: 700; color: var(--gws-accent);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 0.65rem; display: flex; align-items: center; gap: 0.4rem;
}
.gws-mv-summary-card p {
    font-size: 0.88rem; color: var(--gws-text); line-height: 1.7; margin: 0;
}

/* ── OW/N/UW Table ─────────────────────────── */
.gws-ow-table {
    background: var(--gws-card); border: 1px solid var(--gws-border);
    border-radius: var(--gws-radius); overflow: hidden;
    box-shadow: var(--gws-shadow); margin-bottom: 1.25rem;
}
.gws-ow-table-title {
    font-size: 0.78rem; font-weight: 700; color: var(--gws-accent);
    text-transform: uppercase; letter-spacing: 0.06em;
    padding: 0.85rem 1rem 0.5rem; display: flex; align-items: center; gap: 0.4rem;
}
.gws-ow-header {
    display: grid; grid-template-columns: 1fr 180px;
    padding: 0 1rem 0.5rem; align-items: center;
}
.gws-ow-header-labels {
    display: flex; justify-content: space-between;
    font-size: 0.62rem; font-weight: 700; color: var(--gws-text-muted);
    text-transform: uppercase; letter-spacing: 0.06em;
}

.gws-ow-row {
    display: grid; grid-template-columns: 1fr 180px;
    padding: 0.55rem 1rem; align-items: center;
    border-top: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}
.gws-ow-row:hover { background: #f8fafc; }
.gws-ow-name {
    font-size: 0.82rem; font-weight: 600; color: var(--gws-text);
}

/* The 3-position rail indicator */
.gws-ow-indicator {
    position: relative; height: 20px; width: 100%;
}
.gws-ow-track {
    position: absolute; top: 50%; left: 10%; right: 10%;
    height: 3px; background: #e2e8f0; border-radius: 2px;
    transform: translateY(-50%);
}
.gws-ow-dot {
    position: absolute; top: 50%; width: 14px; height: 14px;
    border-radius: 50%; transform: translate(-50%, -50%);
    transition: left 0.3s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.gws-ow-dot-uw { left: 10%; background: var(--gws-negative); }
.gws-ow-dot-n  { left: 50%; background: #94a3b8; }
.gws-ow-dot-ow { left: 90%; background: var(--gws-positive); }

/* Position labels on the track */
.gws-ow-label-uw, .gws-ow-label-n, .gws-ow-label-ow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 6px; height: 6px; border-radius: 50%; background: #e2e8f0;
}
.gws-ow-label-uw { left: 10%; }
.gws-ow-label-n  { left: 50%; }
.gws-ow-label-ow { left: 90%; }

/* Commentary card */
.gws-mv-commentary {
    background: var(--gws-card); border: 1px solid var(--gws-border);
    border-radius: var(--gws-radius); padding: 1.1rem;
    box-shadow: var(--gws-shadow); margin-bottom: 1.25rem;
}
.gws-mv-commentary h6 {
    font-size: 0.78rem; font-weight: 700; color: var(--gws-accent);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.4rem;
}
.gws-mv-commentary p {
    font-size: 0.88rem; color: var(--gws-text); line-height: 1.7; margin: 0;
}

/* ── Macro Sections ────────────────────────── */
.gws-macro-section {
    background: var(--gws-card); border: 1px solid var(--gws-border);
    border-radius: var(--gws-radius); padding: 1.1rem;
    box-shadow: var(--gws-shadow); margin-bottom: 1rem;
}
.gws-macro-section h6 {
    font-size: 0.85rem; font-weight: 700; color: var(--gws-accent);
    margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.5rem;
}
.gws-macro-section h6 i { font-size: 0.9rem; opacity: 0.7; }
.gws-macro-section p {
    font-size: 0.88rem; color: var(--gws-text); line-height: 1.7; margin: 0;
}

/* ── Rating Outlook ───────────────────────── */
.gws-rating-outlook {
    font-size: 0.58rem; opacity: 0.7; font-weight: 400; text-transform: uppercase;
}

/* ── Section Titles ──────────────────────── */
.gws-fin-section-title {
    font-size: 0.82rem; font-weight: 700; color: var(--gws-accent);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin: 1.25rem 0 0.65rem; display: flex; align-items: center; gap: 0.4rem;
}
.gws-fin-section-title i { font-size: 0.85rem; opacity: 0.7; }

/* ── Valuation Compare Cards ─────────────── */
.gws-val-compare-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6rem; margin-bottom: 1rem;
}
.gws-val-compare-card {
    background: #f8fafc; border: 1px solid #f1f5f9;
    border-radius: var(--gws-radius); padding: 0.75rem; text-align: center;
}
.gws-val-compare-label {
    font-size: 0.68rem; font-weight: 700; color: var(--gws-text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.35rem;
}
.gws-val-compare-stock {
    font-size: 1.15rem; font-weight: 800; color: var(--gws-accent); margin-bottom: 0.15rem;
}
.gws-val-compare-vs {
    font-size: 0.6rem; color: var(--gws-text-muted); text-transform: uppercase; margin-bottom: 0.1rem;
}
.gws-val-compare-industry {
    font-size: 0.88rem; font-weight: 600; color: var(--gws-text-muted);
}
.gws-val-compare-tag {
    font-size: 0.58rem; color: var(--gws-text-muted); text-transform: uppercase;
}
.gws-val-compare-card.gws-val-above .gws-val-compare-stock { color: var(--gws-negative); }
.gws-val-compare-card.gws-val-below .gws-val-compare-stock { color: var(--gws-positive); }

/* ── Revenue Charts Row ──────────────────── */
.gws-rev-charts-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem;
}
.gws-rev-chart-wrap {
    background: #f8fafc; border: 1px solid #f1f5f9;
    border-radius: var(--gws-radius); padding: 1rem;
    min-height: 160px; max-height: 340px;
}
.gws-rev-na {
    color: var(--gws-text-muted); font-size: 0.85rem; text-align: center;
    padding: 2rem; font-style: italic;
}

/* ── Narrative Text ──────────────────────── */
.gws-insight-narrative { margin-bottom: 1rem; }
.gws-insight-narrative p {
    font-size: 0.88rem; color: var(--gws-text); line-height: 1.75;
    margin-bottom: 0.75rem;
}

/* ── Financial Table ─────────────────────── */
.gws-fin-table-wrap {
    overflow-x: auto; margin-bottom: 1.25rem;
    border: 1px solid var(--gws-border); border-radius: var(--gws-radius);
    box-shadow: var(--gws-shadow);
}
.gws-fin-table {
    width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.gws-fin-table thead th {
    background: var(--gws-accent); color: white;
    padding: 0.6rem 0.75rem; text-align: right; font-weight: 700;
    font-size: 0.78rem; white-space: nowrap;
}
.gws-fin-table thead th:first-child { text-align: left; }
.gws-fin-table tr.gws-fin-section td {
    background: #f1f5f9; font-weight: 700; color: var(--gws-accent);
    padding: 0.5rem 0.75rem; font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 0.04em;
}
.gws-fin-table td {
    padding: 0.4rem 0.75rem; border-bottom: 1px solid #f8fafc;
}
.gws-fin-label {
    font-weight: 600; color: var(--gws-text); white-space: nowrap;
}
.gws-fin-val { text-align: right; color: var(--gws-text); font-variant-numeric: tabular-nums; }
.gws-fin-growth td { font-size: 0.72rem; font-style: italic; }
.gws-fin-pos { color: var(--gws-positive) !important; }
.gws-fin-neg { color: var(--gws-negative) !important; }

/* ── Financial Charts Row ────────────────── */
.gws-fin-charts-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 1rem;
}
.gws-fin-chart-wrap {
    background: #f8fafc; border: 1px solid #f1f5f9;
    border-radius: var(--gws-radius); padding: 1rem;
    min-height: 260px;
}

/* ── Valuation Bars ──────────────────────── */
.gws-val-bars { margin-bottom: 1.5rem; }
.gws-val-bar-legend {
    display: flex; gap: 1.25rem; margin-bottom: 0.75rem; padding-left: 90px;
    font-size: 0.72rem; font-weight: 600;
}
.gws-val-bar-legend span { display: flex; align-items: center; gap: 0.35rem; }
.gws-val-bar-legend-dot {
    width: 10px; height: 10px; border-radius: 3px; display: inline-block;
}
.gws-val-bar-row {
    display: grid; grid-template-columns: 80px 1fr;
    gap: 0.75rem; align-items: center; margin-bottom: 0.6rem;
}
.gws-val-bar-label {
    font-size: 0.78rem; font-weight: 700; color: var(--gws-text);
    text-align: right;
}
.gws-val-bar-tracks { display: flex; flex-direction: column; gap: 3px; }
.gws-val-bar-track {
    display: flex; align-items: center; gap: 0.5rem; height: 20px;
}
.gws-val-bar-fill-wrap {
    flex: 1; height: 100%; background: #f1f5f9; border-radius: 4px;
    position: relative;
}
.gws-val-bar-fill {
    height: 100%; border-radius: 4px; transition: width 0.5s ease;
}
.gws-val-bar-stock { background: var(--gws-accent); }
.gws-val-bar-industry { background: #94a3b8; }
.gws-val-bar-num {
    font-size: 0.72rem; font-weight: 700; color: var(--gws-text);
    white-space: nowrap; min-width: 50px;
}
.gws-val-bar-ind-track .gws-val-bar-num { color: var(--gws-text-muted); }

/* ── Price Chart ─────────────────────────── */
.gws-price-chart-wrap {
    background: #f8fafc; border: 1px solid #f1f5f9;
    border-radius: var(--gws-radius); padding: 1rem;
    min-height: 320px; margin-bottom: 1.25rem;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 1200px) {
    .gws-insight-grid { grid-template-columns: repeat(3, 1fr); }
    .gws-insight-val-grid { grid-template-columns: repeat(2, 1fr); }
    .gws-val-compare-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 992px) {
    .gws-insight-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .gws-insight-grid { grid-template-columns: 1fr; }
    .gws-insight-val-grid { grid-template-columns: repeat(2, 1fr); }
    .gws-mv-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.3rem; }
    .gws-mv-tab { flex: 0 0 auto; font-size: 0.78rem; padding: 0.45rem 0.85rem; }
    .gws-ow-row { grid-template-columns: 1fr 140px; }
    .gws-insight-exp-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .gws-mv-header { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
    .gws-val-compare-grid { grid-template-columns: repeat(2, 1fr); }
    .gws-rev-charts-row { grid-template-columns: 1fr; }
    .gws-fin-charts-row { grid-template-columns: 1fr; }
    .gws-val-bar-row { grid-template-columns: 60px 1fr; }
}
@media (max-width: 576px) {
    .gws-insight-val-grid { grid-template-columns: 1fr 1fr; }
    .gws-ow-header { grid-template-columns: 1fr 120px; }
    .gws-ow-row { grid-template-columns: 1fr 120px; }
}

/* Phone (≤480px): tighten the expanded-card chrome — title + action
   buttons (Report PDF / Close) and the section tab pills all overflow
   their row at this width. Stack the header so actions get their own
   line, and shrink the tab pills so the horizontal-scroll strip (set
   at 768px above) isn't overly stretched. */
@media (max-width: 480px) {
    .gws-insight-exp-header {
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: flex-start;
    }
    .gws-insight-exp-title { flex: 1 1 auto; min-width: 0; }
    .gws-insight-exp-title h4 { font-size: 1rem; }
    .gws-insight-exp-actions { flex-wrap: wrap; gap: 0.3rem; }
    .gws-insight-exp-report {
        padding: 0.3rem 0.55rem;
        font-size: 0.7rem;
    }
    .gws-insight-exp-tab {
        padding: 0.4rem 0.7rem;
        font-size: 0.74rem;
    }
    .gws-insights-head .gws-btn { font-size: 0.72rem; padding: 0.35rem 0.7rem; }
}

/* Small phone (≤400px): the manage-panel header [Title | Back | Add]
   doesn't fit on one row at this width. Promote the title to its own
   full-width first row (centered with cog icon) and let Back + Add
   share row two evenly. The longer half of each button label ("to
   Insights" / "Stock Insight") collapses so the buttons stay compact.
   PC/tablet (>400px) keeps the original single-row layout untouched. */
@media (max-width: 400px) {
    .gws-insight-mgr-wrap { padding: 1rem 0.9rem 1.1rem; }
    .gws-insight-mgr-head {
        flex-wrap: wrap;
        gap: 0.85rem 0.6rem;
        margin-bottom: 1rem;
        padding-bottom: 0.9rem;
    }
    .gws-insight-mgr-head h5 {
        flex: 0 0 100%;
        justify-content: center;
        font-size: 1rem;
        gap: 0.45rem;
    }
    .gws-insight-mgr-head > .gws-btn {
        flex: 1 1 0;
        min-width: 0;
        justify-content: center;
        font-size: 0.82rem;
        padding: 0.55rem 0.75rem;
        gap: 0.4rem;
        white-space: nowrap;
    }
    .gws-mgr-btn-long { display: none; }
}

/* ══════════ Power-user manage dashboard ══════════════════════ */

/* Single Manage button floating above the card grid */
.gws-insights-head {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.85rem;
}

.gws-insight-mgr-wrap {
    background: var(--gws-card);
    border: 1px solid var(--gws-border);
    border-radius: var(--gws-radius);
    box-shadow: var(--gws-shadow);
    padding: 1.25rem 1.5rem;
}
.gws-insight-mgr-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gws-border);
}
.gws-insight-mgr-head h5 {
    margin: 0; font-size: 1rem; font-weight: 700;
    color: var(--gws-accent);
    display: inline-flex; align-items: center; gap: 0.5rem;
    /* Natural width — the title sits on the left and the rule below
       pulls Back + Add to the right edge. The phone breakpoint above
       promotes this h5 to a full-width centered first row instead. */
}

/* Desktop/tablet (>400px): cluster the action buttons on the right.
   margin-left:auto on the first button after the title consumes all the
   free space between them, dragging Add along with it. The phone
   breakpoint (≤400px) wraps the head to two rows where this rule has
   no effect anyway. */
@media (min-width: 401px) {
    .gws-insight-mgr-head h5 + .gws-btn {
        margin-left: auto;
    }
}

/* Add flow, step 1: ticker input + Fetch button */
.gws-insight-mgr-add-step {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.gws-insight-mgr-ticker-entry {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    background: #f8fafc;
    border: 1px solid var(--gws-border);
    border-radius: 10px;
    align-items: center;
}
.gws-insight-mgr-ticker-entry input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--gws-border);
    border-radius: 8px;
    background: #fff;
    color: var(--gws-accent);
}
.gws-insight-mgr-ticker-entry input:focus {
    outline: none;
    border-color: var(--gws-accent);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

/* Add flow, step 2: preview */
.gws-insight-mgr-preview {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.gws-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem 1rem;
}
.gws-preview-kv {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.55rem 0.7rem;
    background: #fff;
    border: 1px solid var(--gws-border);
    border-radius: 6px;
}
.gws-preview-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--gws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.gws-preview-value {
    font-size: 0.85rem;
    color: var(--gws-text);
    font-weight: 600;
    word-break: break-word;
}
.gws-insight-mgr-preview-text {
    padding: 0.85rem 1rem;
    background: #fff;
    border: 1px solid var(--gws-border);
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--gws-text);
    line-height: 1.55;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}
.gws-insight-mgr-subhead {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0.85rem 0 0.4rem;
}
.gws-insight-mgr-subhead:first-child { margin-top: 0; }
.gws-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fff;
    border: 1px solid var(--gws-border);
    border-radius: 6px;
    overflow: hidden;
}
.gws-preview-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
    border-bottom: 1px solid #f1f5f9;
}
.gws-preview-list li:last-child { border-bottom: none; }
.gws-preview-list li > span:last-child {
    font-weight: 700;
    color: var(--gws-accent);
}
.gws-insight-mgr-next-steps p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--gws-text-muted);
    line-height: 1.5;
}

/* API info panel — read-only auto-fetched data at top of add-form step 2 */
.gws-insight-mgr-api-info {
    background: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%);
    border: 1px solid var(--gws-border);
    border-radius: 10px;
    padding: 1rem 1.15rem;
}
.gws-insight-mgr-api-info-head {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gws-accent);
    margin-bottom: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.gws-insight-mgr-api-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.55rem 0.9rem;
}
.gws-insight-mgr-api-info-kv {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.35rem 0;
    border-bottom: 1px dashed #e2e8f0;
}
.gws-insight-mgr-api-info-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--gws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.gws-insight-mgr-api-info-value {
    font-size: 0.82rem;
    color: var(--gws-text);
    font-weight: 600;
    word-break: break-word;
}
.gws-insight-mgr-api-info-desc {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--gws-border);
    font-size: 0.78rem;
    color: var(--gws-text);
    line-height: 1.55;
    max-height: 120px;
    overflow-y: auto;
}

/* WYSIWYG preview wrapper (add-form step 3) */
.gws-insight-mgr-preview-wrap {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.gws-insight-mgr-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    background: #f8fafc;
    border: 1px solid var(--gws-border);
    border-radius: 10px;
    position: sticky;
    top: 0;
    z-index: 5;
}
.gws-insight-mgr-preview-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gws-accent);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}
#gwsInsightMgrPreviewContent {
    /* Scope the expanded detail view to look like it's inside the manage panel */
}
#gwsInsightMgrPreviewContent .gws-insight-expanded {
    margin: 0;
    box-shadow: var(--gws-shadow);
}
/* The detail-view close X doesn't make sense inside the editor preview —
   there's nothing to close back to. Hide it. */
#gwsInsightMgrPreviewContent .gws-insight-exp-close {
    display: none;
}
/* Images in the preview should behave like previews, not links. The shared
   detail renderer wraps each figure in <a href target=_blank>; block click
   navigation inside the editor preview wrapper. */
#gwsInsightMgrPreviewContent .gws-insight-image-figure a {
    pointer-events: none;
    cursor: default;
}

/* List view */
.gws-insight-mgr-list-wrap {
    overflow-x: auto;
}
.gws-insight-mgr-list {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}
.gws-insight-mgr-list thead th {
    background: #f8fafc;
    color: var(--gws-text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.55rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--gws-border);
}
.gws-insight-mgr-list tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.15s ease;
}
.gws-insight-mgr-list tbody tr:hover { background: #f8fafc; }
.gws-insight-mgr-list td {
    padding: 0.6rem 0.85rem;
    color: var(--gws-text);
    vertical-align: middle;
}
.gws-insight-mgr-ticker {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--gws-accent);
}
.gws-insight-mgr-actions {
    text-align: right;
    white-space: nowrap;
}
.gws-insight-mgr-draft-badge,
.gws-insight-mgr-pub-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 4px;
}
.gws-insight-mgr-draft-badge {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.gws-insight-mgr-pub-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.gws-insight-mgr-row-draft { background: rgba(245, 158, 11, 0.04); }
.gws-insight-mgr-actions .gws-btn {
    margin-left: 0.3rem;
}

/* Form */
.gws-insight-mgr-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.gws-insight-mgr-form-head {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gws-border);
}
.gws-insight-mgr-form-head h6 {
    margin: 0; font-size: 0.95rem; font-weight: 700;
    color: var(--gws-accent);
}
.gws-insight-mgr-form-actions {
    display: flex; gap: 0.5rem;
}

.gws-insight-mgr-section {
    background: #f8fafc;
    border: 1px solid var(--gws-border);
    border-radius: 10px;
    padding: 0.95rem 1.1rem 1.1rem;
}
.gws-insight-mgr-section > h6 {
    margin: 0 0 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gws-accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gws-insight-mgr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem 1rem;
}
.gws-insight-mgr-field {
    display: flex; flex-direction: column; gap: 0.3rem;
}
.gws-insight-mgr-field-full {
    grid-column: 1 / -1;
}
.gws-insight-mgr-field label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.gws-insight-mgr-field input,
.gws-insight-mgr-field select,
.gws-insight-mgr-field textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
    color: var(--gws-text);
    background: #fff;
    border: 1px solid var(--gws-border);
    border-radius: 6px;
    font-family: inherit;
    transition: border-color 0.15s ease;
}
.gws-insight-mgr-field input:focus,
.gws-insight-mgr-field select:focus,
.gws-insight-mgr-field textarea:focus {
    outline: none;
    border-color: var(--gws-accent);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.08);
}
.gws-insight-mgr-field textarea {
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}
.gws-insight-mgr-field-full {
    margin-top: 0.85rem;
}
.gws-insight-mgr-rating-pair {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0.4rem;
}

/* Revenue segment/geography editor */
.gws-insight-mgr-segments { }
.gws-insight-segment-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.6rem;
}
.gws-insight-segment-table thead th {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--gws-border);
}
.gws-insight-segment-table thead th:nth-child(2) { width: 120px; }
.gws-insight-segment-table thead th:nth-child(3) { width: 40px; }
.gws-insight-segment-table td {
    padding: 0.35rem 0.5rem;
}
.gws-insight-segment-table input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    font-size: 0.82rem;
    border: 1px solid var(--gws-border);
    border-radius: 5px;
    background: #fff;
}
.gws-insight-segment-table input:focus {
    outline: none; border-color: var(--gws-accent);
}
.gws-btn-icon-danger {
    width: 28px; height: 28px;
    background: transparent;
    border: 1px solid var(--gws-border);
    border-radius: 5px;
    color: var(--gws-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}
.gws-btn-icon-danger:hover {
    color: #fff;
    background: var(--gws-negative);
    border-color: var(--gws-negative);
}

/* ── Manage form subtitle + narrative block ── */
.gws-insight-mgr-form-sub {
    font-size: 0.78rem;
    color: var(--gws-text-muted);
    margin-top: 0.25rem;
}
.gws-insight-mgr-status-pill {
    display: inline-block;
    padding: 0.08rem 0.5rem;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 4px;
    vertical-align: middle;
}
.gws-insight-mgr-status-draft {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.gws-insight-mgr-status-live {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.gws-insight-mgr-section-sub {
    font-size: 0.75rem;
    color: var(--gws-text-muted);
    margin: -0.35rem 0 0.7rem;
}
.gws-insight-mgr-narrative-block {
    padding-bottom: 1.1rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--gws-border);
}
.gws-insight-mgr-narrative-block:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}
.gws-insight-mgr-narrative-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}
.gws-insight-mgr-suggest-btn {
    background: transparent;
    border: 1px solid var(--gws-border);
    color: var(--gws-text-muted);
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.12s ease, color 0.12s ease;
}
.gws-insight-mgr-suggest-btn:hover {
    background: var(--gws-accent);
    color: #fff;
    border-color: var(--gws-accent);
}
.gws-insight-mgr-suggest-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ── Image uploader (manage form) ── */
.gws-insight-mgr-images {
    margin-top: 0.85rem;
}
.gws-insight-mgr-image-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.55rem;
}
.gws-insight-mgr-image-head > label:not(.gws-insight-mgr-upload-btn) {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
/* Upload button — keep the white text regardless of which ancestor label
   rule would otherwise override it. */
.gws-insight-mgr-image-head > label.gws-insight-mgr-upload-btn,
.gws-insight-mgr-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--gws-accent);
    color: #ffffff;
    border: 1px solid var(--gws-accent);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.gws-insight-mgr-upload-btn:hover { opacity: 0.9; }
.gws-insight-mgr-upload-btn i { color: #ffffff; }
.gws-insight-mgr-image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}
.gws-insight-mgr-image-empty {
    grid-column: 1 / -1;
    padding: 1rem;
    background: #fff;
    border: 1px dashed var(--gws-border);
    border-radius: 8px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--gws-text-muted);
}
.gws-insight-mgr-image-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--gws-border);
    border-radius: 8px;
    padding: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.gws-insight-mgr-image-section-tag {
    align-self: flex-start;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gws-accent);
    background: rgba(44, 62, 80, 0.08);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}
.gws-insight-mgr-image-thumb {
    width: 100%;
    height: 110px;
    border-radius: 4px;
    overflow: hidden;
    background: #f1f5f9;
    cursor: pointer;
}
.gws-insight-mgr-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gws-insight-mgr-img-caption,
.gws-insight-mgr-img-title,
.gws-insight-mgr-img-source {
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--gws-border);
    border-radius: 4px;
    background: #fff;
}
.gws-insight-mgr-img-caption:focus,
.gws-insight-mgr-img-title:focus,
.gws-insight-mgr-img-source:focus {
    outline: none;
    border-color: var(--gws-accent);
}
.gws-insight-mgr-img-source {
    font-style: italic;
    color: var(--gws-text-muted);
}
.gws-insight-mgr-img-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.2rem;
}
.gws-insight-mgr-img-spacer { flex: 1; }

/* Size preset row */
.gws-insight-mgr-size-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.2rem;
}
.gws-insight-mgr-size-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gws-text-muted);
}
.gws-insight-mgr-size-group {
    display: inline-flex;
    border: 1px solid var(--gws-border);
    border-radius: 5px;
    overflow: hidden;
}
.gws-insight-mgr-size-btn {
    width: 28px; height: 24px;
    padding: 0;
    background: #fff;
    color: var(--gws-text-muted);
    border: none;
    border-right: 1px solid var(--gws-border);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.gws-insight-mgr-size-btn:last-child { border-right: none; }
.gws-insight-mgr-size-btn:hover {
    background: #f1f5f9;
    color: var(--gws-accent);
}
.gws-insight-mgr-size-btn.active {
    background: var(--gws-accent);
    color: #fff;
}

/* Cross-section move dropdown (compact) */
.gws-insight-mgr-img-section-sel {
    flex: 1;
    min-width: 0;
    padding: 0.25rem 0.35rem;
    font-size: 0.68rem;
    border: 1px solid var(--gws-border);
    border-radius: 4px;
    background: #fff;
    color: var(--gws-text);
    cursor: pointer;
}
.gws-insight-mgr-img-section-sel:focus {
    outline: none;
    border-color: var(--gws-accent);
}
.gws-btn-icon {
    width: 26px; height: 26px;
    background: #f8fafc;
    border: 1px solid var(--gws-border);
    border-radius: 4px;
    color: var(--gws-text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.gws-btn-icon:hover:not(:disabled) {
    background: var(--gws-accent);
    color: #fff;
    border-color: var(--gws-accent);
}
.gws-btn-icon:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.gws-insight-mgr-image-card .gws-btn-icon-danger {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}
.gws-insight-mgr-image-hint {
    margin-top: 0.55rem;
    padding: 0.55rem 0.75rem;
    background: rgba(59, 130, 246, 0.08);
    color: #1d4ed8;
    border-radius: 6px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Detail view image gallery (per section, default stacked grid) ── */
.gws-insight-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 0.85rem;
}

/* 2-column grid: narrative text in the left column, chart images stacked
   in the right column. Predictable alignment, no float/clearfix gotchas.
   Collapses to a single column on narrow screens. */
.gws-insight-float-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1rem;
}
/* When the section has no sidebar images, collapse the reserved image column
   so the narrative spans the full width instead of leaving a wide gap on
   the right (the broken-looking layout from the first published insight). */
.gws-insight-float-wrap:not(:has(.gws-insight-gallery-float)) {
    grid-template-columns: minmax(0, 1fr);
}
.gws-insight-float-wrap > .gws-insight-image-gallery {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
}
.gws-insight-float-wrap > .gws-insight-image-gallery .gws-insight-image-figure {
    width: 100%;
    margin: 0;
}
.gws-insight-float-wrap > .gws-insight-desc,
.gws-insight-float-wrap > .gws-insight-narrative {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
}
/* When the narrative is missing, let the gallery span the full width */
.gws-insight-float-wrap > .gws-insight-image-gallery:only-child {
    grid-column: 1 / -1;
}

/* Per-image size presets inside the sidebar column. Small images shrink
   to half-width centered; medium fills the column. Large goes into a
   separate full-width gallery below the wrap (rendered by
   renderFullGallery, styled with .gws-insight-gallery-full). */
.gws-insight-gallery-float .gws-insight-image-figure[data-size="small"] {
    width: 60%;
    align-self: flex-end;
}
.gws-insight-gallery-float .gws-insight-image-figure[data-size="medium"] {
    width: 100%;
}
.gws-insight-gallery-full {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0 1.25rem;
}
.gws-insight-gallery-full .gws-insight-image-figure {
    width: 100%;
    margin: 0;
}
@media (max-width: 900px) {
    .gws-insight-float-wrap {
        grid-template-columns: 1fr;
    }
    .gws-insight-float-wrap > .gws-insight-image-gallery,
    .gws-insight-float-wrap > .gws-insight-desc,
    .gws-insight-float-wrap > .gws-insight-narrative {
        grid-column: 1;
        grid-row: auto;
    }
}
.gws-insight-image-figure {
    margin: 0;
    background: #fff;
    border: 1px solid var(--gws-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--gws-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gws-insight-image-figure:hover {
    transform: translateY(-2px);
    box-shadow: var(--gws-shadow-lg);
}
.gws-insight-image-figure a {
    display: block;
    text-decoration: none;
}
.gws-insight-image-figure img {
    width: 100%;
    height: auto;
    display: block;
    background: #f8fafc;
}
.gws-insight-image-figure figcaption {
    padding: 0.65rem 0.85rem;
    font-size: 0.78rem;
    color: var(--gws-text);
    border-top: 1px solid var(--gws-border);
    line-height: 1.4;
}
.gws-insight-image-title {
    padding: 0.6rem 0.85rem 0.4rem !important;
    font-weight: 700;
    color: var(--gws-accent) !important;
    border-top: none !important;
    border-bottom: 1px solid var(--gws-border);
    font-size: 0.82rem !important;
}
.gws-insight-image-source {
    padding: 0.4rem 0.85rem 0.6rem !important;
    font-size: 0.7rem !important;
    color: var(--gws-text-muted) !important;
    font-style: italic;
}
