:root {
    color-scheme: dark;
    --bg: #07111f;
    --bg-accent: #0d1d34;
    --surface: rgba(11, 22, 39, 0.88);
    --surface-strong: #0f1b2d;
    --surface-dark: #06101d;
    --text: #e7eef9;
    --muted: #8fa3bf;
    --line: rgba(152, 176, 209, 0.14);
    --line-strong: rgba(152, 176, 209, 0.28);
    --accent: #19a974;
    --accent-deep: #0d7f57;
    --buy: #2fd39a;
    --hold: #f1bc4d;
    --sell: #ff7b7b;
    --shadow: 0 22px 44px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(25, 169, 116, 0.18), transparent 24%),
        radial-gradient(circle at top right, rgba(58, 126, 255, 0.16), transparent 22%),
        linear-gradient(180deg, #050d18 0%, #091425 48%, #040a14 100%);
}

body {
    padding: 24px;
}

button,
input {
    font: inherit;
}

.app-shell {
    max-width: 1180px;
    margin: 0 auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 28px 32px;
    border-radius: 28px;
    color: #eff7ff;
    background:
        linear-gradient(135deg, rgba(4, 14, 26, 0.98), rgba(11, 31, 54, 0.96)),
        var(--surface-dark);
    border: 1px solid rgba(115, 154, 207, 0.14);
    box-shadow: var(--shadow);
}

.eyebrow,
.section-kicker,
.stat-label,
.report-label,
.selected-tickers-header,
.market-pill,
.ticker-count {
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.eyebrow,
.section-kicker {
    margin: 0 0 8px;
    font-size: 0.76rem;
    font-weight: 700;
    color: #63d8b2;
}

.topbar h1,
.hero-copy h2,
.panel-heading h3,
.output-header h3 {
    margin: 0;
    font-family: 'Manrope', sans-serif;
}

.topbar h1 {
    font-size: clamp(1.9rem, 3vw, 2.7rem);
    font-weight: 800;
}

.market-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    color: #d4f7ed;
    background: rgba(111, 180, 255, 0.06);
}

.market-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.16);
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 24px;
}

.hero-card,
.panel {
    border: 1px solid rgba(130, 162, 209, 0.12);
    border-radius: 28px;
    background: var(--surface);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.hero-card {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 24px;
    padding: 32px;
}

.hero-copy h2 {
    font-size: clamp(1.8rem, 3vw, 3rem);
    line-height: 1.05;
}

.hero-text,
.panel-copy,
.insight-list p,
#api-message,
#report-reasoning,
#report-risk,
.empty-state,
footer {
    color: var(--muted);
}

.hero-text {
    max-width: 58ch;
    margin: 16px 0 0;
    font-size: 1rem;
    line-height: 1.7;
}

.hero-stats {
    display: grid;
    gap: 16px;
}

.stat-card,
.report-card,
.insight-list article {
    padding: 20px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: rgba(15, 27, 45, 0.92);
}

.stat-card strong,
.report-card strong {
    display: block;
    margin-top: 8px;
    font-family: 'Manrope', sans-serif;
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text);
}

.stat-label,
.report-label,
.ticker-count,
.selected-tickers-header {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
}

.stat-meta {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.92rem;
    color: var(--muted);
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 24px;
}

.panel {
    padding: 28px;
}

.panel-heading {
    margin-bottom: 24px;
}

.panel-heading h3,
.output-header h3 {
    font-size: 1.55rem;
    font-weight: 800;
}

.panel-copy {
    margin: 12px 0 0;
    line-height: 1.6;
}

.ticker-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#ticker-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.form-input-control {
    display: flex;
    gap: 12px;
}

input[type="text"] {
    width: 100%;
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    color: var(--text);
    background: var(--surface-strong);
    outline: none;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

input[type="text"]:focus {
    border-color: rgba(43, 185, 133, 0.55);
    box-shadow: 0 0 0 4px rgba(25, 169, 116, 0.15);
    transform: translateY(-1px);
}

.add-ticker-btn,
.generate-report-btn {
    border: none;
    transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.add-ticker-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    border-radius: 18px;
    background: linear-gradient(180deg, #183b63, #0c213a);
    box-shadow: 0 14px 24px rgba(3, 10, 19, 0.4);
    cursor: pointer;
}

.add-ticker-btn:hover,
.generate-report-btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.add-ticker-svg {
    width: 15px;
    filter: brightness(0) invert(1);
}

.selected-tickers {
    margin-top: 24px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: rgba(9, 19, 34, 0.94);
}

.selected-tickers-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.ticker-choice-display {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 44px;
}

.empty-state {
    margin: 0;
}

.ticker {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 700;
    color: #dceeff;
    background: linear-gradient(180deg, #17304c, #0f2339);
    border: 1px solid rgba(95, 152, 219, 0.18);
}

.generate-report-btn {
    width: 100%;
    margin-top: 24px;
    padding: 17px 20px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: #f5fffb;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 16px 28px rgba(6, 106, 85, 0.32);
}

.generate-report-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.insight-panel {
    background:
        linear-gradient(180deg, rgba(16, 29, 49, 0.94), rgba(9, 19, 34, 0.96)),
        var(--surface);
}

.insight-list {
    display: grid;
    gap: 14px;
}

.insight-list article span {
    display: inline-block;
    margin-bottom: 8px;
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    font-weight: 800;
}

.insight-list article p,
.report-card p {
    margin: 0;
    line-height: 1.65;
}

.loading-panel,
.output-panel {
    display: none;
}

.loading-panel {
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 44px 28px;
    text-align: center;
}

.loading-panel img {
    width: 70px;
}

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

.recommendation-badge {
    padding: 11px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(14, 26, 43, 0.88);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
}

.recommendation-badge.buy,
.emphasis-card.buy strong {
    color: var(--buy);
}

.recommendation-badge.hold,
.emphasis-card.hold strong {
    color: var(--hold);
}

.recommendation-badge.sell,
.emphasis-card.sell strong {
    color: var(--sell);
}

.recommendation-badge.buy {
    border-color: rgba(12, 143, 112, 0.25);
    background: rgba(12, 143, 112, 0.16);
}

.recommendation-badge.hold {
    border-color: rgba(212, 157, 31, 0.25);
    background: rgba(212, 157, 31, 0.16);
}

.recommendation-badge.sell {
    border-color: rgba(214, 82, 82, 0.24);
    background: rgba(214, 82, 82, 0.16);
}

.report-grid {
    display: grid;
    grid-template-columns: minmax(220px, 0.65fr) minmax(0, 1fr);
    gap: 18px;
}

.report-grid .report-card:last-child {
    grid-column: 1 / -1;
}

.emphasis-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(25, 169, 116, 0.12), rgba(15, 27, 45, 0.96));
}

.footer-note {
    padding: 20px 0 8px;
    text-align: center;
    font-size: 0.92rem;
}

@media (max-width: 920px) {
    body {
        padding: 16px;
    }

    .topbar,
    .hero-card,
    .workspace-grid,
    .output-header,
    .report-grid {
        grid-template-columns: 1fr;
    }

    .topbar,
    .hero-card,
    .output-header {
        display: grid;
    }

    .market-pill {
        justify-self: start;
    }
}

@media (max-width: 640px) {
    .topbar,
    .hero-card,
    .panel {
        padding: 22px;
        border-radius: 24px;
    }

    .hero-copy h2 {
        font-size: 1.9rem;
    }

    .form-input-control {
        flex-direction: column;
    }

    .add-ticker-btn {
        min-height: 54px;
    }
}
