/* ==========================================================================
   StatementIQ — Institutional Research Workspace
   A restrained, editorial visual system for dense financial information.
   ========================================================================== */

html[data-theme="dark"] {
    color-scheme: dark;
    --bg-main: #0b0e0c;
    --bg-grid: rgba(226, 237, 222, 0.032);
    --card-bg: #151a16;
    --card-bg-solid: #151a16;
    --card-raised: #1a201b;
    --card-soft: #111512;
    --card-border: rgba(226, 237, 222, 0.1);
    --card-hover-border: rgba(200, 245, 108, 0.34);
    --card-shadow: 0 22px 60px -44px rgba(0, 0, 0, 0.95);
    --input-bg: #0f1310;
    --input-border: rgba(226, 237, 222, 0.13);
    --text-main: #f2f4ec;
    --text-muted: #a0a89f;
    --text-dark: #717a71;
    --accent-cyan: #c8f56c;
    --accent-blue: #9cbfff;
    --accent-indigo: #b1c69a;
    --accent-purple: #c5adff;
    --accent-green: #83dca5;
    --accent-amber: #e7c26f;
    --accent-red: #ed8d87;
    --primary-fill: #c8f56c;
    --primary-ink: #18210f;
    --hero-bg: #172119;
    --hero-ink: #f5f7ef;
    --hero-muted: #aab5aa;
    --table-header-bg: #101411;
    --table-hover-bg: rgba(200, 245, 108, 0.045);
}

html[data-theme="light"] {
    color-scheme: light;
    --bg-main: #efefe8;
    --bg-grid: rgba(23, 29, 24, 0.04);
    --card-bg: #fbfbf6;
    --card-bg-solid: #fbfbf6;
    --card-raised: #ffffff;
    --card-soft: #f3f3ec;
    --card-border: rgba(24, 31, 25, 0.12);
    --card-hover-border: rgba(75, 106, 23, 0.42);
    --card-shadow: 0 24px 60px -46px rgba(30, 39, 31, 0.45);
    --input-bg: #f6f6f0;
    --input-border: rgba(24, 31, 25, 0.16);
    --text-main: #171b18;
    --text-muted: #5f685f;
    --text-dark: #7c847c;
    --accent-cyan: #557a17;
    --accent-blue: #315f9f;
    --accent-indigo: #536a3f;
    --accent-purple: #70559c;
    --accent-green: #247947;
    --accent-amber: #9a6a13;
    --accent-red: #b54842;
    --primary-fill: #1c251e;
    --primary-ink: #f4f7ee;
    --hero-bg: #19211b;
    --hero-ink: #f5f7ef;
    --hero-muted: #aeb9ae;
    --table-header-bg: #f2f2eb;
    --table-hover-bg: rgba(85, 122, 23, 0.05);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background:
        linear-gradient(var(--bg-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
        var(--bg-main);
    background-size: 42px 42px;
    color: var(--text-main);
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    letter-spacing: -0.01em;
    transition: background-color 180ms ease, color 180ms ease;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    background:
        radial-gradient(circle at 84% -12%, rgba(200, 245, 108, 0.08), transparent 32%),
        radial-gradient(circle at -8% 35%, rgba(156, 191, 255, 0.05), transparent 28%);
    content: "";
    pointer-events: none;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

::selection {
    background: var(--accent-cyan);
    color: #17200f;
}

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    border: 3px solid var(--bg-main);
    border-radius: 999px;
    background: var(--text-dark);
}

.app-layout {
    width: min(100%, 1540px);
    margin: 0 auto;
    padding: 18px clamp(18px, 3vw, 48px) 72px;
}

/* Header and research command bar */
.top-navbar {
    position: sticky;
    z-index: 30;
    top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    min-height: 76px;
    margin-bottom: 14px;
    padding: 13px 15px 13px 18px;
    border: 1px solid var(--card-border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--card-bg) 91%, transparent);
    box-shadow: 0 18px 48px -38px rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(22px) saturate(130%);
    -webkit-backdrop-filter: blur(22px) saturate(130%);
}

.brand-container {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
}

.brand-logo-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 12px;
    background: transparent;
    box-shadow: 0 8px 22px -12px rgba(0, 0, 0, 0.75);
}

.brand-logo-icon::after {
    display: none;
}

.brand-logo-icon img {
    display: block;
    width: 44px;
    height: 44px;
}

.brand-title {
    color: var(--text-main);
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.1;
}

.brand-title .accent-cyan {
    margin-left: 1px;
}

.brand-subtitle {
    margin-top: 5px;
    color: var(--text-dark);
    font-size: 0.59rem;
    font-weight: 700;
    letter-spacing: 0.115em;
}

.pro-tag {
    display: none;
}

.accent-cyan { color: var(--accent-cyan); }
.accent-green { color: var(--accent-green); }
.accent-red { color: var(--accent-red); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }

.search-controls {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.search-input-wrapper {
    display: grid;
    flex: 0 1 420px;
    grid-template-columns: 18px minmax(90px, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 280px;
    padding: 4px 4px 4px 12px;
    border: 1px solid var(--input-border);
    border-radius: 13px;
    background: var(--input-bg);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-input-wrapper:focus-within {
    border-color: var(--card-hover-border);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-cyan) 10%, transparent);
}

.search-icon {
    position: static;
    width: 16px;
    height: 16px;
    color: var(--text-dark);
}

.search-input-wrapper input {
    width: 100%;
    min-width: 0;
    padding: 9px 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-main);
    font-family: "DM Mono", monospace;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

input::placeholder {
    color: var(--text-dark);
    opacity: 1;
    text-transform: none;
}

.btn-search {
    min-height: 38px;
    padding: 0 17px;
    border: 0;
    border-radius: 9px;
    background: var(--primary-fill);
    color: var(--primary-ink);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    transition: transform 150ms ease, opacity 150ms ease, box-shadow 150ms ease;
}

.btn-search:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px -12px var(--accent-cyan);
}

.btn-search:disabled {
    cursor: wait;
    opacity: 0.58;
}

.api-key-wrapper {
    position: relative;
    display: flex;
    flex: 0 1 178px;
    align-items: center;
}

.key-icon {
    position: absolute;
    left: 12px;
    width: 14px;
    height: 14px;
    color: var(--text-dark);
    pointer-events: none;
}

.api-key-wrapper input {
    width: 100%;
    height: 48px;
    padding: 0 12px 0 35px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    outline: 0;
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 0.76rem;
}

.api-key-wrapper input:focus {
    border-color: var(--card-hover-border);
}

.btn-theme-toggle {
    display: grid;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.btn-theme-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--card-hover-border);
    color: var(--accent-cyan);
}

.btn-theme-toggle svg {
    width: 17px;
    height: 17px;
}

/* Coverage selector */
.ticker-ribbon {
    display: flex;
    align-items: center;
    gap: 7px;
    overflow-x: auto;
    margin-bottom: 18px;
    padding: 4px 2px;
    scrollbar-width: none;
}

.ticker-ribbon::-webkit-scrollbar {
    display: none;
}

.ribbon-label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-right: 4px;
    color: var(--text-dark);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

.inline-icon {
    width: 14px;
    height: 14px;
}

.ticker-pill {
    position: relative;
    padding: 6px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: "DM Mono", monospace;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.035em;
    white-space: nowrap;
    transition: background 150ms ease, color 150ms ease;
}

.ticker-pill:hover {
    background: var(--card-bg);
    color: var(--text-main);
}

.ticker-pill.active {
    background: var(--card-raised);
    color: var(--accent-cyan);
    box-shadow: inset 0 0 0 1px var(--card-border);
}

.ticker-pill.active::before {
    position: absolute;
    top: 50%;
    left: 3px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--accent-cyan);
    content: "";
}

/* Company context */
.hero-card {
    position: relative;
    display: flex;
    min-height: 184px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    overflow: hidden;
    margin-bottom: 14px;
    padding: 32px 34px 30px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 22px;
    background:
        linear-gradient(116deg, rgba(200, 245, 108, 0.055), transparent 44%),
        var(--hero-bg);
    box-shadow: var(--card-shadow);
    color: var(--hero-ink);
}

.hero-card::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    background: var(--accent-cyan);
    content: "";
}

.hero-card::after {
    position: absolute;
    top: -150px;
    right: -90px;
    width: 380px;
    height: 380px;
    border: 1px solid rgba(200, 245, 108, 0.1);
    border-radius: 50%;
    box-shadow:
        0 0 0 42px rgba(200, 245, 108, 0.018),
        0 0 0 88px rgba(200, 245, 108, 0.012);
    content: "";
    pointer-events: none;
}

.hero-header-left,
.hero-actions {
    position: relative;
    z-index: 1;
}

.hero-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    color: var(--hero-muted);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.115em;
    text-transform: uppercase;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 0 4px rgba(200, 245, 108, 0.11);
}

.company-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.company-name {
    color: var(--hero-ink);
    font-size: clamp(2.25rem, 4vw, 3.35rem);
    font-weight: 600;
    letter-spacing: -0.065em;
    line-height: 0.98;
}

.symbol-badge,
.exchange-badge {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 0 9px;
    border-radius: 7px;
    font-family: "DM Mono", monospace;
    font-size: 0.67rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.symbol-badge {
    background: var(--accent-cyan);
    color: #17200f;
}

.exchange-badge {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.035);
    color: var(--hero-muted);
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
    color: var(--hero-muted);
    font-size: 0.77rem;
}

.meta-row b {
    margin-left: 4px;
    color: var(--hero-ink);
    font-weight: 600;
}

.meta-row .accent-cyan {
    color: var(--accent-cyan);
}

.source-row {
    margin-top: 10px;
    color: var(--text-dark);
    font-family: "DM Mono", monospace;
    font-size: 0.59rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.dot-separator {
    color: rgba(255, 255, 255, 0.2);
}

.btn-export-pdf {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 9px;
    padding: 0 17px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--hero-ink);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.btn-export-pdf:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(200, 245, 108, 0.4);
    background: rgba(200, 245, 108, 0.09);
}

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

.btn-export-pdf svg {
    width: 16px;
    height: 16px;
}

/* Cohesive KPI ledger */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    margin-bottom: 18px;
    border: 1px solid var(--card-border);
    border-radius: 18px;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
}

.kpi-card {
    position: relative;
    min-width: 0;
    padding: 19px 20px 18px;
    border-right: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
    background: transparent;
    transition: background 150ms ease;
}

.kpi-card:nth-child(4n) {
    border-right: 0;
}

.kpi-card:nth-last-child(-n + 4) {
    border-bottom: 0;
}

.kpi-card:hover {
    background: var(--card-raised);
}

.kpi-card:first-child {
    background: color-mix(in srgb, var(--accent-cyan) 7%, transparent);
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.kpi-label {
    overflow: hidden;
    color: var(--text-dark);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kpi-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: var(--text-dark);
    stroke-width: 1.6;
}

.kpi-value,
.kpi-value-sm {
    overflow: hidden;
    color: var(--text-main);
    font-family: "DM Mono", monospace;
    font-size: clamp(1.15rem, 1.5vw, 1.5rem);
    font-weight: 500;
    letter-spacing: -0.045em;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kpi-value-sm {
    padding-top: 3px;
    font-size: clamp(0.82rem, 1vw, 1rem);
}

.kpi-value.accent-cyan { color: var(--accent-cyan); }
.kpi-value.accent-green { color: var(--accent-green); }

html[data-theme="dark"] .kpi-value.accent-cyan,
html[data-theme="dark"] .kpi-value.accent-green {
    text-shadow: 0 0 22px color-mix(in srgb, currentColor 22%, transparent);
}

/* Section navigation */
.dashboard-tabs-nav {
    position: sticky;
    z-index: 20;
    top: 102px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 22px;
    padding: 5px;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
    box-shadow: 0 16px 42px -38px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.tab-btn {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.tab-btn:hover {
    background: var(--card-soft);
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--card-raised);
    box-shadow: inset 0 0 0 1px var(--card-border), 0 8px 18px -18px rgba(0, 0, 0, 0.7);
    color: var(--text-main);
}

.tab-btn svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: var(--text-dark);
    stroke-width: 1.7;
}

.tab-btn.active svg {
    color: var(--accent-cyan);
}

.tab-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.tab-copy strong {
    overflow: hidden;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab-copy small {
    overflow: hidden;
    margin-top: 1px;
    color: var(--text-dark);
    font-size: 0.62rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: reveal 220ms ease both;
}

@keyframes reveal {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Research panels */
.glass-card,
.ratio-card {
    border: 1px solid var(--card-border);
    border-radius: 18px;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
}

.glass-card {
    margin-bottom: 18px;
    padding: 24px;
}

.card-title,
.section-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    font-weight: 700;
    letter-spacing: -0.035em;
}

.card-title {
    margin-bottom: 16px;
    font-size: 1rem;
}

.card-title svg,
.section-heading svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.7;
}

.card-title.text-green svg { color: var(--accent-green); }
.card-title.text-red svg { color: var(--accent-red); }

.card-subtitle {
    margin-bottom: 6px;
    color: var(--text-dark);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-align: center;
}

.ai-overview-grid {
    display: grid;
    grid-template-columns: minmax(310px, 0.74fr) minmax(0, 1.45fr);
    gap: 18px;
}

.score-panel {
    position: relative;
    overflow: hidden;
}

.score-panel::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-cyan), transparent 72%);
    content: "";
}

.gauge-container {
    height: 195px;
}

.health-status-badge {
    margin: 2px auto 0;
    font-family: "DM Mono", monospace;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.035em;
    text-align: center;
}

.pillars-container {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin-top: 17px;
}

.pillar-item {
    display: grid;
    grid-template-columns: 92px minmax(60px, 1fr) 58px;
    align-items: center;
    gap: 12px;
    font-size: 0.73rem;
}

.pillar-name {
    color: var(--text-muted);
    font-weight: 600;
}

.pillar-track,
.progress-track {
    overflow: hidden;
    height: 4px;
    border-radius: 999px;
    background: var(--card-soft);
}

.pillar-fill,
.progress-fill {
    height: 100%;
    border-radius: inherit;
}

.pillar-val {
    color: var(--text-muted);
    font-family: "DM Mono", monospace;
    font-size: 0.67rem;
    font-weight: 500;
    text-align: right;
}

.ai-briefing-card {
    position: relative;
    display: flex;
    min-height: 100%;
    flex-direction: column;
    justify-content: center;
    padding: clamp(26px, 3vw, 42px);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent-cyan) 4%, transparent), transparent 45%),
        var(--card-bg);
}

.ai-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 6px 9px;
    border: 1px solid color-mix(in srgb, var(--accent-cyan) 22%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent-cyan) 7%, transparent);
    color: var(--accent-cyan);
    font-family: "DM Mono", monospace;
    font-size: 0.63rem;
    font-weight: 500;
    letter-spacing: 0.07em;
}

.ai-chip svg {
    width: 13px;
    height: 13px;
}

.ai-summary-text {
    max-width: 920px;
    margin-top: 23px;
    color: var(--text-main);
    font-size: clamp(1.05rem, 1.35vw, 1.27rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.67;
}

.card-divider {
    margin: 24px 0 18px;
    border: 0;
    border-top: 1px solid var(--card-border);
}

.ai-section-title {
    margin-bottom: 8px;
    color: var(--text-dark);
    font-size: 0.61rem;
    font-weight: 800;
    letter-spacing: 0.11em;
}

.ai-rationale-text {
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.7;
}

.strengths-risks-grid,
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.strength-item-card,
.weakness-item-card {
    position: relative;
    margin-bottom: 8px;
    padding: 12px 12px 12px 28px;
    border: 1px solid var(--card-border);
    border-radius: 11px;
    background: var(--card-soft);
    color: var(--text-muted);
    font-size: 0.79rem;
    line-height: 1.6;
}

.strength-item-card:last-child,
.weakness-item-card:last-child {
    margin-bottom: 0;
}

.strength-item-card b,
.weakness-item-card b {
    position: absolute;
    top: 12px;
    left: 13px;
}

.strength-item-card b { color: var(--accent-green); }
.weakness-item-card b { color: var(--accent-red); }

.section-heading {
    margin: 8px 0 5px;
    font-size: 1.28rem;
}

.section-subheading {
    max-width: 680px;
    margin: 8px 0 20px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.charts-grid {
    margin-top: 18px;
}

.charts-grid-single {
    display: grid;
}

.chart-card {
    overflow: hidden;
    padding: 14px 14px 8px;
}

.plotly-chart {
    height: 350px;
}

/* Ratio diagnostics */
.section-header-row {
    margin-bottom: 22px;
    padding: 6px 2px 0;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 26px 0 11px;
    color: var(--text-dark);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.category-title::before {
    width: 20px;
    height: 1px;
    background: var(--accent-cyan);
    content: "";
}

.ratio-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.ratio-card {
    padding: 20px;
    transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}

.ratio-card:hover {
    transform: translateY(-2px);
    border-color: var(--card-hover-border);
    background: var(--card-raised);
}

.ratio-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
}

.ratio-cat-tag {
    color: var(--text-dark);
    font-size: 0.59rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--card-border);
    border-radius: 7px;
    font-family: "DM Mono", monospace;
    font-size: 0.58rem;
    font-weight: 500;
    letter-spacing: 0.035em;
    white-space: nowrap;
}

.status-pill.healthy {
    border-color: color-mix(in srgb, var(--accent-green) 24%, transparent);
    background: color-mix(in srgb, var(--accent-green) 7%, transparent);
    color: var(--accent-green);
}

.status-pill.caution,
.status-pill.nm {
    border-color: color-mix(in srgb, var(--accent-amber) 24%, transparent);
    background: color-mix(in srgb, var(--accent-amber) 7%, transparent);
    color: var(--accent-amber);
}

.status-pill.warning {
    border-color: color-mix(in srgb, var(--accent-red) 24%, transparent);
    background: color-mix(in srgb, var(--accent-red) 7%, transparent);
    color: var(--accent-red);
}

.status-pill.na {
    color: var(--text-dark);
}

.ratio-name {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 600;
}

.ratio-val-large {
    margin-top: 7px;
    color: var(--text-main);
    font-family: "DM Mono", monospace;
    font-size: 1.65rem;
    font-weight: 500;
    letter-spacing: -0.05em;
}

.progress-track {
    margin-top: 17px;
}

.progress-fill.green { background: var(--accent-green); }
.progress-fill.amber { background: var(--accent-amber); }
.progress-fill.red { background: var(--accent-red); }
.progress-fill.muted { background: var(--text-dark); }

.ratio-target-caption {
    margin-top: 10px;
    color: var(--text-dark);
    font-size: 0.66rem;
    line-height: 1.45;
}

/* Financial statements */
.statements-controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 15px;
}

.statement-selector {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    background: var(--input-bg);
}

.stmt-btn {
    min-height: 36px;
    padding: 0 13px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    transition: background 150ms ease, color 150ms ease;
}

.stmt-btn:hover {
    color: var(--text-main);
}

.stmt-btn.active {
    background: var(--card-raised);
    box-shadow: inset 0 0 0 1px var(--card-border);
    color: var(--text-main);
}

.statement-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-search-input {
    position: relative;
    display: flex;
    align-items: center;
}

.table-search-input .inline-icon {
    position: absolute;
    left: 12px;
    color: var(--text-dark);
    pointer-events: none;
}

.table-search-input input {
    width: min(310px, 34vw);
    height: 42px;
    padding: 0 13px 0 36px;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    outline: 0;
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 0.74rem;
}

.table-search-input input:focus {
    border-color: var(--card-hover-border);
}

.btn-csv-export {
    display: inline-flex;
    height: 42px;
    align-items: center;
    gap: 7px;
    padding: 0 13px;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    transition: border-color 150ms ease, color 150ms ease;
}

.btn-csv-export:hover {
    border-color: var(--card-hover-border);
    color: var(--accent-cyan);
}

.btn-csv-export svg {
    width: 15px;
    height: 15px;
}

.table-card {
    padding: 0;
}

.table-responsive {
    max-height: 620px;
    overflow: auto;
    border-radius: 18px;
}

.financial-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text-main);
    font-size: 0.78rem;
    text-align: right;
}

.financial-table th {
    position: sticky;
    z-index: 2;
    top: 0;
    padding: 15px 17px;
    border-bottom: 1px solid var(--card-border);
    background: var(--table-header-bg);
    color: var(--text-dark);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.financial-table th:first-child,
.financial-table td:first-child {
    position: sticky;
    z-index: 1;
    left: 0;
    min-width: 230px;
    border-right: 1px solid var(--card-border);
    background: var(--card-bg-solid);
    color: var(--text-main);
    font-family: "Manrope", sans-serif;
    font-weight: 600;
    text-align: left;
}

.financial-table th:first-child {
    z-index: 3;
    background: var(--table-header-bg);
}

.financial-table td {
    padding: 13px 17px;
    border-bottom: 1px solid var(--card-border);
    font-family: "DM Mono", monospace;
    white-space: nowrap;
}

.financial-table tbody tr:last-child td {
    border-bottom: 0;
}

.financial-table tr:hover td {
    background: var(--table-hover-bg);
}

.val-positive { color: var(--accent-green); }
.val-negative { color: var(--accent-red); }

.spin {
    animation: spin 800ms linear infinite;
}

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

/* Responsive hierarchy */
@media (max-width: 1120px) {
    .top-navbar {
        position: relative;
        top: 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .search-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .search-input-wrapper {
        flex: 1 1 420px;
    }

    .dashboard-tabs-nav {
        top: 12px;
    }

    .ai-overview-grid {
        grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
    }

    .ratio-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .app-layout {
        padding: 12px 14px 48px;
    }

    .search-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 48px;
    }

    .search-input-wrapper {
        width: 100%;
        min-width: 0;
    }

    .api-key-wrapper {
        grid-column: 1 / -1;
        grid-row: 2;
        max-width: none;
    }

    .api-key-wrapper input {
        height: 42px;
    }

    .hero-card {
        min-height: 0;
        align-items: flex-start;
        flex-direction: column;
        padding: 27px 24px;
    }

    .hero-actions {
        width: 100%;
    }

    .btn-export-pdf {
        justify-content: center;
        width: 100%;
    }

    .company-name {
        flex-basis: 100%;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kpi-card:nth-child(4n) {
        border-right: 1px solid var(--card-border);
    }

    .kpi-card:nth-child(2n) {
        border-right: 0;
    }

    .kpi-card:nth-last-child(-n + 4) {
        border-bottom: 1px solid var(--card-border);
    }

    .kpi-card:nth-last-child(-n + 2) {
        border-bottom: 0;
    }

    .dashboard-tabs-nav {
        overflow-x: auto;
        grid-template-columns: repeat(3, minmax(190px, 1fr));
        scrollbar-width: none;
    }

    .dashboard-tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .ai-overview-grid,
    .strengths-risks-grid,
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .statement-selector {
        width: 100%;
        overflow-x: auto;
    }

    .stmt-btn {
        flex: 1 0 auto;
    }

    .statements-controls-bar,
    .statement-right-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .table-search-input input {
        width: 100%;
    }

    .btn-csv-export {
        justify-content: center;
    }
}

@media (max-width: 560px) {
    body {
        background-size: 30px 30px;
    }

    .top-navbar {
        border-radius: 15px;
    }

    .brand-subtitle {
        display: none;
    }

    .search-input-wrapper {
        grid-template-columns: 16px minmax(58px, 1fr) auto;
        padding-left: 9px;
    }

    .btn-search {
        padding: 0 12px;
    }

    .ticker-ribbon {
        margin-bottom: 12px;
    }

    .hero-card {
        border-radius: 17px;
        padding: 24px 20px;
    }

    .company-name {
        font-size: 2.15rem;
    }

    .meta-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .meta-row .dot-separator {
        display: none;
    }

    .kpi-card {
        padding: 16px 14px;
    }

    .kpi-label {
        font-size: 0.56rem;
    }

    .glass-card {
        padding: 19px;
    }

    .ai-briefing-card {
        padding: 24px 20px;
    }

    .ratio-cards-grid {
        grid-template-columns: 1fr;
    }

    .pillar-item {
        grid-template-columns: 78px minmax(50px, 1fr) 54px;
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================================================== 
   Editorial research edition
   Quiet surfaces, typographic hierarchy, and report-like composition.
   ========================================================================== */

html[data-theme="light"] {
    --bg-main: #eeeae0;
    --bg-grid: transparent;
    --card-bg: #f9f7f0;
    --card-bg-solid: #f9f7f0;
    --card-raised: #fffef9;
    --card-soft: #e8e4d9;
    --card-border: rgba(31, 34, 28, 0.14);
    --card-hover-border: rgba(76, 96, 52, 0.55);
    --card-shadow: none;
    --input-bg: #f7f4eb;
    --input-border: rgba(31, 34, 28, 0.18);
    --text-main: #1e201c;
    --text-muted: #62655b;
    --text-dark: #686b62;
    --accent-cyan: #4f7127;
    --accent-blue: #2f6fa3;
    --accent-indigo: #5e743c;
    --accent-purple: #76519d;
    --accent-green: #167a48;
    --accent-amber: #a96f12;
    --accent-red: #be463e;
    --gauge-risk: #df5149;
    --gauge-caution: #ee8418;
    --gauge-healthy: #1fac63;
    --chart-crosshair: rgba(31, 34, 28, 0.32);
    --primary-fill: #20251f;
    --primary-ink: #fbfaf4;
    --hero-bg: transparent;
    --hero-ink: #1e201c;
    --hero-muted: #686b61;
    --table-header-bg: #e9e5da;
    --table-hover-bg: rgba(95, 112, 74, 0.06);
}

html[data-theme="dark"] {
    --bg-main: #131410;
    --bg-grid: transparent;
    --card-bg: #191a16;
    --card-bg-solid: #191a16;
    --card-raised: #20211c;
    --card-soft: #24251f;
    --card-border: rgba(238, 234, 224, 0.13);
    --card-hover-border: rgba(165, 181, 137, 0.48);
    --card-shadow: none;
    --input-bg: #181914;
    --input-border: rgba(238, 234, 224, 0.17);
    --text-main: #eeeae0;
    --text-muted: #aaa99f;
    --text-dark: #95978d;
    --accent-cyan: #b4dc72;
    --accent-blue: #64ace8;
    --accent-indigo: #94bd62;
    --accent-purple: #bb82df;
    --accent-green: #47c77b;
    --accent-amber: #e5aa43;
    --accent-red: #e66b63;
    --gauge-risk: #f05e58;
    --gauge-caution: #ff982b;
    --gauge-healthy: #2ed477;
    --chart-crosshair: rgba(238, 234, 224, 0.34);
    --primary-fill: #eeeae0;
    --primary-ink: #1c1e1a;
    --hero-bg: transparent;
    --hero-ink: #eeeae0;
    --hero-muted: #9a9b91;
    --table-header-bg: #20211c;
    --table-hover-bg: rgba(165, 181, 137, 0.055);
}

body {
    background:
        radial-gradient(circle at 12% 2%, color-mix(in srgb, var(--accent-cyan) 6%, transparent), transparent 28%),
        var(--bg-main);
    background-size: auto;
    letter-spacing: -0.014em;
}

body::before {
    background: none;
}

.app-layout {
    width: min(100%, 1440px);
    padding: 0 clamp(20px, 4vw, 64px) 84px;
}

.top-navbar {
    top: 0;
    min-height: 82px;
    margin-bottom: 0;
    padding: 17px 4px;
    border: 0;
    border-bottom: 1px solid var(--card-border);
    border-radius: 0;
    background: color-mix(in srgb, var(--bg-main) 91%, transparent);
    box-shadow: none;
}

.brand-container {
    gap: 11px;
}

.brand-logo-icon {
    width: 39px;
    height: 39px;
    border-radius: 2px;
    background: var(--text-main);
    color: var(--bg-main);
}

.brand-logo-icon::after {
    display: none;
}

.brand-logo-icon svg {
    width: 19px;
    height: 19px;
}

.brand-title {
    font-family: "Inter Tight", "Manrope", sans-serif;
    font-size: 1.28rem;
    font-weight: 600;
    letter-spacing: -0.035em;
}

.brand-title .accent-cyan {
    color: var(--text-main);
}

.brand-subtitle {
    margin-top: 3px;
    font-size: 0.54rem;
    letter-spacing: 0.14em;
}

.search-input-wrapper,
.api-key-wrapper input,
.btn-theme-toggle {
    border-radius: 3px;
}

.search-input-wrapper {
    flex-basis: 390px;
    background: transparent;
}

.btn-search {
    border-radius: 2px;
    box-shadow: none;
    font-weight: 700;
}

.btn-search:hover:not(:disabled) {
    box-shadow: none;
}

/* Adaptive analysis progress — time-aware without pretending to know an ETA. */
.analysis-progress {
    display: grid;
    grid-template-rows: auto 3px auto;
    gap: 8px;
    max-height: 0;
    padding: 0 4px;
    overflow: hidden;
    border-bottom: 1px solid transparent;
    opacity: 0;
    transform: translateY(-5px);
    transition:
        max-height 260ms ease,
        padding 260ms ease,
        border-color 260ms ease,
        opacity 180ms ease,
        transform 260ms ease;
}

.analysis-progress.is-visible {
    max-height: 104px;
    padding-top: 13px;
    padding-bottom: 14px;
    border-bottom-color: var(--card-border);
    opacity: 1;
    transform: translateY(0);
}

.analysis-progress-header,
.analysis-progress-title-row {
    display: flex;
    align-items: center;
}

.analysis-progress-header {
    justify-content: space-between;
    gap: 18px;
}

.analysis-progress-title-row {
    min-width: 0;
    gap: 9px;
}

.analysis-progress-pulse {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-cyan) 34%, transparent);
    animation: analysis-pulse 1.8s ease-out infinite;
}

.analysis-progress-title {
    overflow: hidden;
    color: var(--text-main);
    font-family: "Inter Tight", "Manrope", sans-serif;
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analysis-progress-elapsed {
    flex: 0 0 auto;
    color: var(--text-dark);
    font-family: "DM Mono", monospace;
    font-size: 0.61rem;
    letter-spacing: 0.025em;
}

.analysis-progress-track {
    position: relative;
    height: 3px;
    overflow: hidden;
    background: var(--card-soft);
}

.analysis-progress-fill {
    position: relative;
    display: block;
    width: 0;
    height: 100%;
    overflow: hidden;
    background: var(--accent-cyan);
    transition: width 850ms cubic-bezier(0.22, 1, 0.36, 1), background-color 180ms ease;
}

.analysis-progress-fill::after {
    position: absolute;
    inset: 0;
    width: 44%;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, white 48%, transparent), transparent);
    content: "";
    transform: translateX(-120%);
    animation: analysis-sheen 1.6s ease-in-out infinite;
}

.analysis-progress-status {
    min-height: 1em;
    color: var(--text-muted);
    font-size: 0.66rem;
    line-height: 1.35;
}

.analysis-progress.is-complete .analysis-progress-pulse,
.analysis-progress.is-complete .analysis-progress-fill {
    background: var(--accent-green);
}

.analysis-progress.is-complete .analysis-progress-pulse {
    animation: none;
    box-shadow: none;
}

.analysis-progress.is-error .analysis-progress-pulse,
.analysis-progress.is-error .analysis-progress-fill {
    background: var(--accent-red);
}

.analysis-progress.is-error .analysis-progress-pulse {
    animation: none;
    box-shadow: none;
}

.analysis-progress.is-error .analysis-progress-status {
    color: var(--accent-red);
}

@keyframes analysis-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-cyan) 36%, transparent); }
    70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

@keyframes analysis-sheen {
    0% { transform: translateX(-120%); }
    65%, 100% { transform: translateX(320%); }
}

@media (prefers-reduced-motion: reduce) {
    .analysis-progress,
    .analysis-progress-fill {
        transition-duration: 1ms;
    }

    .analysis-progress-pulse,
    .analysis-progress-fill::after {
        animation: none;
    }
}

.ticker-ribbon {
    margin-bottom: 0;
    padding: 15px 4px 16px;
    border-bottom: 1px solid var(--card-border);
}

.ribbon-label {
    margin-right: 10px;
    font-size: 0.57rem;
}

.ticker-pill {
    padding: 5px 9px;
    border-radius: 2px;
    font-size: 0.68rem;
}

.ticker-pill:hover,
.ticker-pill.active {
    background: transparent;
    box-shadow: none;
}

.ticker-pill.active {
    color: var(--text-main);
    text-decoration: underline;
    text-decoration-color: var(--accent-cyan);
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
}

.ticker-pill.active::before {
    display: none;
}

.hero-card {
    min-height: 270px;
    margin-bottom: 0;
    padding: 58px 4px 42px;
    border: 0;
    border-bottom: 1px solid var(--card-border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--hero-ink);
}

.hero-card::before {
    top: 38px;
    bottom: auto;
    left: 4px;
    width: 38px;
    height: 1px;
    background: var(--accent-cyan);
}

.hero-card::after {
    top: 44px;
    right: 4px;
    width: auto;
    height: auto;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--text-dark);
    content: "EQUITY RESEARCH  /  SNAPSHOT";
    font-family: "DM Mono", monospace;
    font-size: 0.58rem;
    letter-spacing: 0.12em;
}

.hero-eyebrow {
    margin-bottom: 21px;
    color: var(--text-dark);
    font-size: 0.59rem;
}

.live-dot {
    width: 4px;
    height: 4px;
    background: var(--accent-cyan);
    box-shadow: none;
}

.company-title-row {
    gap: 13px;
}

.company-name {
    color: var(--text-main);
    font-family: "Inter Tight", "Manrope", sans-serif;
    font-size: clamp(3.45rem, 6.6vw, 5.55rem);
    font-weight: 600;
    letter-spacing: -0.068em;
    line-height: 0.9;
}

.symbol-badge,
.exchange-badge {
    min-height: 25px;
    border-radius: 2px;
}

.symbol-badge {
    background: var(--accent-cyan);
    color: var(--primary-ink);
}

html[data-theme="light"] .symbol-badge {
    color: #f9f7f0;
}

.exchange-badge {
    border-color: var(--card-border);
    background: transparent;
    color: var(--text-dark);
}

.meta-row {
    margin-top: 24px;
    color: var(--text-muted);
}

.meta-row b {
    color: var(--text-main);
}

.dot-separator {
    color: var(--text-dark);
}

.btn-export-pdf {
    min-height: 45px;
    padding: 0 18px;
    border: 1px solid var(--text-main);
    border-radius: 2px;
    background: var(--text-main);
    color: var(--bg-main);
}

.btn-export-pdf:hover:not(:disabled) {
    border-color: var(--accent-cyan);
    background: var(--accent-cyan);
    color: var(--primary-ink);
}

.kpi-grid {
    margin-bottom: 30px;
    border: 0;
    border-bottom: 1px solid var(--card-border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.kpi-card {
    padding: 22px 18px 23px;
    background: transparent;
}

.kpi-card:first-child {
    padding-left: 4px;
    background: transparent;
}

.kpi-card:hover {
    background: transparent;
}

.kpi-label {
    font-size: 0.57rem;
    letter-spacing: 0.13em;
}

.kpi-value,
.kpi-value-sm {
    font-size: clamp(1.08rem, 1.45vw, 1.42rem);
    letter-spacing: -0.035em;
}

.dashboard-tabs-nav {
    top: 81px;
    gap: 30px;
    margin-bottom: 42px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--card-border);
    border-radius: 0;
    background: color-mix(in srgb, var(--bg-main) 94%, transparent);
    box-shadow: none;
}

.tab-btn {
    position: relative;
    justify-content: flex-start;
    padding: 14px 4px 13px;
    border-radius: 0;
}

.tab-btn:hover,
.tab-btn.active {
    background: transparent;
    box-shadow: none;
}

.tab-btn.active::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--accent-cyan);
    content: "";
}

.tab-copy strong {
    font-size: 0.74rem;
}

.glass-card,
.ratio-card {
    border-radius: 4px;
    box-shadow: none;
}

.glass-card {
    padding: 27px;
}

.card-title,
.section-heading {
    font-family: "Inter Tight", "Manrope", sans-serif;
    font-weight: 600;
}

.card-title {
    font-size: 1.32rem;
}

.ai-overview-grid {
    grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.5fr);
    gap: 42px;
    align-items: stretch;
}

.score-panel {
    border-color: var(--card-border);
    background: var(--card-bg);
}

.score-panel::before {
    right: 68%;
    height: 1px;
    background: var(--accent-cyan);
}

.ai-briefing-card {
    justify-content: flex-start;
    padding: 22px 8px 22px 34px;
    border: 0;
    border-left: 1px solid var(--card-border);
    background: transparent;
    box-shadow: none;
}

.ai-chip {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--accent-cyan);
    font-size: 0.6rem;
    letter-spacing: 0.11em;
}

.ai-summary-text {
    max-width: 72ch;
    margin-top: 22px;
    font-family: "Manrope", sans-serif;
    font-size: clamp(0.96rem, 1.18vw, 1.08rem);
    font-weight: 500;
    letter-spacing: -0.017em;
    line-height: 1.78;
}

.ai-briefing-card .card-divider {
    max-width: 72ch;
    margin: 22px 0 16px;
}

.ai-briefing-card .ai-section-title {
    font-size: 0.56rem;
    letter-spacing: 0.14em;
}

.ai-rationale-text {
    max-width: 920px;
    max-width: 72ch;
    color: var(--text-dark);
    font-size: 0.74rem;
    line-height: 1.7;
}

.strengths-risks-grid {
    gap: 24px;
    margin-top: 24px;
}

.strengths-risks-grid > .glass-card {
    padding: 25px 27px 18px;
}

.strength-item-card,
.weakness-item-card {
    margin: 0;
    padding: 14px 0 14px 18px;
    border: 0;
    border-bottom: 1px solid var(--card-border);
    border-radius: 0;
    background: transparent;
}

.strength-item-card:last-child,
.weakness-item-card:last-child {
    border-bottom: 0;
}

.strength-item-card b,
.weakness-item-card b {
    left: 0;
}

.section-heading {
    margin-top: 26px;
    font-size: clamp(1.75rem, 2.5vw, 2.25rem);
    letter-spacing: -0.035em;
}

.charts-grid {
    gap: 20px;
    margin-top: 24px;
}

.chart-card {
    padding: 20px 20px 8px;
    border-radius: 4px;
    background: var(--card-bg);
}

.chart-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    min-height: 58px;
    padding: 0 2px 10px;
}

.chart-card-header h3 {
    color: var(--text-main);
    font-family: "Inter Tight", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.chart-card-header p {
    margin-top: 6px;
    color: var(--text-dark);
    font-family: "DM Mono", monospace;
    font-size: 0.58rem;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.chart-inspector {
    display: flex;
    align-items: stretch;
    min-height: 42px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--card-soft);
    box-shadow: 0 12px 30px -24px rgba(0, 0, 0, 0.8);
}

.inspector-year {
    display: grid;
    place-items: center;
    padding: 0 12px;
    border-right: 1px solid var(--card-border);
    color: var(--text-main);
    font-family: "DM Mono", monospace;
    font-size: 0.72rem;
    font-weight: 500;
}

.inspector-metric {
    display: grid;
    grid-template-columns: 7px auto;
    grid-template-rows: auto auto;
    column-gap: 7px;
    align-content: center;
    min-width: 100px;
    padding: 6px 11px;
    border-right: 1px solid var(--card-border);
    color: var(--text-dark);
    font-size: 0.56rem;
    line-height: 1.15;
}

.inspector-metric:last-child { border-right: 0; }

.inspector-metric strong {
    grid-column: 2;
    margin-top: 3px;
    color: var(--text-main);
    font-family: "DM Mono", monospace;
    font-size: 0.76rem;
    font-weight: 500;
}

.inspector-dot {
    grid-row: 1 / span 2;
    align-self: center;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-dark);
}

.inspector-dot.blue { background: var(--accent-blue); }
.inspector-dot.green { background: var(--accent-green); }
.inspector-dot.red { background: var(--accent-red); }
.inspector-dot.purple { background: var(--accent-purple); }
.inspector-dot.amber { background: var(--accent-amber); }

.plotly-chart { height: 300px; }

.section-header-row {
    margin-bottom: 34px;
}

.ratio-category-section {
    --section-accent: var(--accent-cyan);
    margin-top: 22px;
    padding: 18px;
    border: 1px solid color-mix(in srgb, var(--section-accent) 22%, var(--card-border));
    border-radius: 14px;
    background: color-mix(in srgb, var(--section-accent) 4%, var(--card-bg));
}

.ratio-category-section[data-category="liquidity"] { --section-accent: var(--accent-blue); }
.ratio-category-section[data-category="leverage"] { --section-accent: var(--accent-purple); }
.ratio-category-section[data-category="profitability"] { --section-accent: var(--accent-green); }
.ratio-category-section[data-category="efficiency"] { --section-accent: var(--accent-amber); }
.ratio-category-section[data-category="valuation"] { --section-accent: var(--accent-red); }

.category-title {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    margin: 0 0 14px;
    padding: 0 0 4px;
    color: var(--text-main);
    letter-spacing: 0;
}

.category-title::before { display: none; }

.category-index {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--section-accent);
    color: var(--bg-main);
    font-family: "DM Mono", monospace;
    font-size: 0.72rem;
    font-weight: 500;
}

.category-copy {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.category-copy strong {
    font-family: "Inter Tight", sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.category-copy small,
.category-count {
    color: var(--text-dark);
    font-family: "Manrope", sans-serif;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.category-count {
    color: var(--section-accent);
    font-family: "DM Mono", monospace;
    white-space: nowrap;
}

.ratio-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ratio-card {
    padding: 18px 19px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--card-bg);
}

.ratio-card:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--section-accent) 52%, var(--card-border));
    background: var(--card-raised);
}

.ratio-card-header {
    justify-content: flex-end;
    margin-bottom: 13px;
}

.ratio-val-large {
    font-size: 1.75rem;
}

.status-pill {
    padding: 5px 8px;
    border: 0 !important;
    border-radius: 999px;
}

.status-pill.healthy { background: color-mix(in srgb, var(--accent-green) 12%, transparent) !important; }
.status-pill.caution,
.status-pill.nm { background: color-mix(in srgb, var(--accent-amber) 12%, transparent) !important; }
.status-pill.warning { background: color-mix(in srgb, var(--accent-red) 12%, transparent) !important; }
.status-pill.na { background: color-mix(in srgb, var(--text-dark) 10%, transparent) !important; }

.ratio-target-caption {
    margin-top: 16px;
    padding: 9px 10px;
    border: 0;
    border-radius: 7px;
    background: var(--card-soft);
    line-height: 1.5;
}

.statements-controls-bar {
    margin-bottom: 20px;
}

.statement-selector,
.table-search-input input,
.btn-csv-export {
    border-radius: 2px;
}

.stmt-btn {
    border-radius: 1px;
}

.table-card,
.table-responsive {
    border-radius: 4px;
}

@media (max-width: 1120px) {
    .top-navbar {
        top: 0;
        padding: 17px 4px;
    }

    .dashboard-tabs-nav {
        top: 0;
    }

    .ai-overview-grid {
        gap: 24px;
    }
}

@media (max-width: 820px) {
    .app-layout {
        padding: 0 16px 56px;
    }

    .hero-card {
        padding: 52px 3px 34px;
    }

    .hero-card::after {
        display: none;
    }

    .company-name {
        font-size: clamp(3.2rem, 13vw, 4.7rem);
    }

    .kpi-card:first-child {
        padding-left: 14px;
    }

    .dashboard-tabs-nav {
        gap: 4px;
        margin-bottom: 30px;
    }

    .ai-briefing-card {
        padding: 24px 2px;
        border-left: 0;
        border-top: 1px solid var(--card-border);
    }
}

@media (max-width: 560px) {
    .top-navbar {
        border-radius: 0;
    }

    .hero-card {
        border-radius: 0;
        padding: 48px 2px 30px;
    }

    .company-name {
        font-size: 3.15rem;
    }

    .symbol-badge,
    .exchange-badge {
        margin-top: 3px;
    }

    .glass-card {
        padding: 21px;
    }
}

@media (max-width: 820px) {
    .ratio-cards-grid { grid-template-columns: 1fr; }
    .ratio-category-section { padding: 15px; }
    .category-copy small { display: none; }
}

@media (max-width: 620px) {
    .chart-card-header {
        align-items: stretch;
        flex-direction: column;
    }

    .chart-inspector { width: 100%; }
    .inspector-metric { flex: 1; min-width: 0; }

    .category-title {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .category-count {
        grid-column: 2;
    }
}

/* ==========================================================================
   Introduction experience and header precision fixes
   ========================================================================== */

[hidden] {
    display: none !important;
}

.brand-logo-icon {
    width: 40px;
    height: 40px;
    overflow: hidden;
    border-radius: 9px;
    background: #171c18;
    box-shadow: none;
}

.brand-logo-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.search-input-wrapper {
    overflow: hidden;
    border-radius: 9px;
    background: var(--input-bg);
    isolation: isolate;
}

.search-input-wrapper input {
    border-radius: 0;
}

.btn-search {
    border-radius: 7px;
}

.btn-theme-toggle {
    border-radius: 9px;
}

body.intro-active {
    min-height: 100vh;
}

.intro-page {
    min-height: 100svh;
    background:
        radial-gradient(circle at 72% 18%, color-mix(in srgb, var(--accent-cyan) 9%, transparent), transparent 30%),
        linear-gradient(var(--bg-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
        var(--bg-main);
    background-size: auto, 42px 42px, 42px 42px, auto;
}

.intro-shell {
    display: grid;
    width: min(100%, 1440px);
    min-height: 100svh;
    margin: 0 auto;
    padding: 0 clamp(20px, 4vw, 64px);
    grid-template-rows: auto 1fr auto;
}

.intro-nav {
    display: flex;
    min-height: 88px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--card-border);
}

.intro-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.intro-brand img {
    display: block;
    width: 42px;
    height: 42px;
    border-radius: 10px;
}

.intro-brand-name {
    color: var(--text-main);
    font-family: "Inter Tight", "Manrope", sans-serif;
    font-size: 1.28rem;
    font-weight: 650;
    letter-spacing: -0.04em;
    line-height: 1;
}

.intro-brand-name span {
    color: var(--accent-cyan);
}

.intro-brand-subtitle {
    margin-top: 5px;
    color: var(--text-dark);
    font-family: "Manrope", sans-serif;
    font-size: 0.54rem;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.intro-nav-cta,
.intro-primary-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    cursor: pointer;
    font-weight: 750;
    transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.intro-nav-cta {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--card-border);
    border-radius: 9px;
    background: color-mix(in srgb, var(--card-bg) 68%, transparent);
    color: var(--text-main);
    font-size: 0.72rem;
}

.intro-nav-cta svg,
.intro-primary-cta svg {
    width: 16px;
    height: 16px;
}

.intro-nav-cta:hover,
.intro-primary-cta:hover {
    transform: translateY(-1px);
}

.intro-main {
    display: grid;
    align-items: center;
    gap: clamp(52px, 7vw, 110px);
    padding: clamp(40px, 5vh, 72px) 0;
    grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.88fr);
}

.intro-copy {
    max-width: 760px;
    animation: intro-rise 620ms cubic-bezier(.2, .75, .2, 1) both;
}

.intro-kicker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    color: var(--text-dark);
    font-family: "DM Mono", monospace;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.1em;
}

.intro-kicker span {
    width: 30px;
    height: 1px;
    background: var(--accent-cyan);
}

.intro-copy h1 {
    max-width: 800px;
    margin: 0;
    color: var(--text-main);
    font-family: "Inter Tight", "Manrope", sans-serif;
    font-size: clamp(3.8rem, 6.4vw, 6.5rem);
    font-weight: 600;
    letter-spacing: -0.072em;
    line-height: 0.92;
}

.intro-copy h1 em {
    color: var(--accent-cyan);
    font-style: normal;
}

.intro-copy > p {
    max-width: 660px;
    margin-top: 30px;
    color: var(--text-muted);
    font-size: clamp(1rem, 1.35vw, 1.14rem);
    line-height: 1.75;
}

.intro-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 34px;
}

.intro-primary-cta {
    min-height: 52px;
    padding: 0 21px;
    border-radius: 10px;
    background: var(--primary-fill);
    color: var(--primary-ink);
    font-size: 0.78rem;
}

.intro-actions > span {
    color: var(--text-dark);
    font-size: 0.72rem;
}

.intro-research-map {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
    box-shadow: 0 28px 70px -55px rgba(0, 0, 0, 0.78);
    animation: intro-rise 620ms 100ms cubic-bezier(.2, .75, .2, 1) both;
}

.intro-research-map::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 34%;
    height: 2px;
    background: var(--accent-cyan);
    content: "";
}

.intro-map-header,
.intro-map-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    color: var(--text-dark);
    font-family: "DM Mono", monospace;
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.09em;
}

.intro-map-header {
    border-bottom: 1px solid var(--card-border);
}

.intro-map-header svg {
    width: 17px;
    height: 17px;
    color: var(--accent-cyan);
}

.intro-map-step {
    display: grid;
    align-items: start;
    gap: 18px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--card-border);
    grid-template-columns: 38px minmax(0, 1fr);
}

.intro-step-index {
    color: var(--accent-cyan);
    font-family: "DM Mono", monospace;
    font-size: 0.69rem;
    line-height: 1.55;
}

.intro-map-step strong,
.intro-map-step small {
    display: block;
}

.intro-map-step strong {
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 700;
}

.intro-map-step small {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.55;
}

.intro-map-footer {
    justify-content: flex-start;
    gap: 10px;
    padding-top: 16px;
    padding-bottom: 16px;
    font-size: 0.56rem;
}

.intro-map-footer span {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--accent-cyan);
}

.intro-footer {
    display: flex;
    min-height: 70px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-top: 1px solid var(--card-border);
    color: var(--text-dark);
    font-family: "DM Mono", monospace;
    font-size: 0.56rem;
    letter-spacing: 0.08em;
}

@keyframes intro-rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 960px) {
    .intro-main {
        grid-template-columns: 1fr;
        gap: 54px;
    }

    .intro-research-map {
        width: min(100%, 700px);
    }
}

@media (max-width: 620px) {
    .intro-shell {
        padding: 0 18px;
    }

    .intro-nav {
        min-height: 78px;
    }

    .intro-brand img {
        width: 38px;
        height: 38px;
    }

    .intro-brand-subtitle {
        display: none;
    }

    .intro-nav-cta {
        min-height: 38px;
        padding: 0 12px;
    }

    .intro-main {
        gap: 42px;
        padding: 58px 0 52px;
    }

    .intro-kicker {
        margin-bottom: 18px;
        font-size: 0.58rem;
    }

    .intro-copy h1 {
        font-size: clamp(3.25rem, 15.5vw, 4.75rem);
    }

    .intro-copy > p {
        margin-top: 24px;
    }

    .intro-actions {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        margin-top: 28px;
    }

    .intro-primary-cta {
        width: 100%;
    }

    .intro-map-step {
        padding: 20px 17px;
    }

    .intro-footer {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 7px;
        padding: 18px 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .intro-copy,
    .intro-research-map {
        animation: none;
    }
}

/* ==========================================================================
   Theme transition, restrained introduction copy, and contact details
   ========================================================================== */

.intro-nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.intro-theme-toggle {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    background: color-mix(in srgb, var(--card-bg) 68%, transparent);
}

.theme-icon-stage {
    position: relative;
    display: block;
    width: 19px;
    height: 19px;
}

.theme-icon {
    position: absolute;
    inset: 0;
    width: 19px;
    height: 19px;
    transform-origin: 50% 50%;
    stroke-width: 1.75;
    transition:
        opacity 260ms ease,
        transform 480ms cubic-bezier(.2, .78, .2, 1),
        color 320ms ease;
}

html[data-theme="light"] .theme-icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

html[data-theme="light"] .theme-icon-sun {
    opacity: 0;
    transform: rotate(-110deg) scale(.35);
}

html[data-theme="dark"] .theme-icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

html[data-theme="dark"] .theme-icon-moon {
    opacity: 0;
    transform: rotate(110deg) scale(.35);
}

.btn-theme-toggle.is-theme-animating .theme-icon-stage {
    animation: theme-icon-turn 500ms cubic-bezier(.2, .78, .2, 1);
}

@keyframes theme-icon-turn {
    0%, 100% { transform: rotate(0deg) scale(1); }
    48% { transform: rotate(70deg) scale(.78); }
}

.intro-copy h1 {
    font-size: clamp(3.2rem, 5.4vw, 5.65rem);
    letter-spacing: -0.058em;
    line-height: .96;
}

.intro-footer a,
.workspace-footer a {
    color: inherit;
    text-decoration: none;
    transition: color 160ms ease;
}

.intro-footer a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.intro-footer a strong {
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0;
}

.intro-footer a:hover,
.intro-footer a:hover strong,
.workspace-footer a:hover {
    color: var(--accent-cyan);
}

.workspace-footer {
    display: flex;
    min-height: 76px;
    margin-top: 36px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-top: 1px solid var(--card-border);
    color: var(--text-dark);
    font-family: "DM Mono", monospace;
    font-size: .58rem;
    letter-spacing: .08em;
}

html.theme-view-transition::view-transition-old(root),
html.theme-view-transition::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

html.theme-view-transition::view-transition-old(root) {
    z-index: 1;
}

html.theme-view-transition::view-transition-new(root) {
    z-index: 2;
    clip-path: circle(0 at var(--theme-switch-x) var(--theme-switch-y));
    animation: theme-surface-reveal 560ms cubic-bezier(.2, .72, .18, 1) forwards;
}

@keyframes theme-surface-reveal {
    to {
        clip-path: circle(var(--theme-switch-radius) at var(--theme-switch-x) var(--theme-switch-y));
    }
}

html.theme-color-transition * {
    transition-property: color, background-color, border-color, box-shadow, fill, stroke;
    transition-duration: 460ms;
    transition-timing-function: cubic-bezier(.2, .72, .18, 1);
}

html.theme-color-transition .theme-icon {
    transition:
        opacity 260ms ease,
        transform 480ms cubic-bezier(.2, .78, .2, 1),
        color 320ms ease;
}

@media (max-width: 620px) {
    .intro-nav-actions {
        gap: 7px;
    }

    .intro-theme-toggle {
        width: 38px;
        height: 38px;
    }

    .intro-nav-cta {
        min-width: 38px;
    }

    .intro-copy h1 {
        font-size: clamp(2.9rem, 13.8vw, 4.25rem);
        line-height: .98;
    }

    .intro-footer a {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .workspace-footer {
        min-height: 90px;
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .theme-icon,
    .btn-theme-toggle.is-theme-animating .theme-icon-stage {
        animation: none;
        transition: none;
    }

    html.theme-view-transition::view-transition-new(root) {
        animation-duration: 1ms;
    }
}

/* ==========================================================================
   Secondary-text readability
   Keeps supporting copy subordinate without reducing it to fine print.
   ========================================================================== */

.brand-subtitle,
.intro-brand-subtitle {
    font-size: .66rem;
    line-height: 1.35;
}

.analysis-progress-elapsed,
.analysis-progress-status {
    font-size: .7rem;
}

.ribbon-label,
.hero-card::after,
.hero-eyebrow,
.kpi-label {
    font-size: .66rem;
}

.source-row {
    font-size: .72rem;
    line-height: 1.55;
}

.tab-copy small {
    margin-top: 3px;
    font-size: .74rem;
    line-height: 1.35;
}

.card-subtitle,
.ai-chip,
.ai-briefing-card .ai-section-title {
    font-size: .7rem;
}

.ai-rationale-text {
    color: var(--text-muted);
    font-size: .82rem;
    line-height: 1.72;
}

.chart-card-header p {
    font-size: .68rem;
    line-height: 1.45;
}

.inspector-metric {
    font-size: .65rem;
}

.section-subheading {
    font-size: .86rem;
    line-height: 1.6;
}

.category-copy small,
.category-count,
.ratio-cat-tag,
.status-pill {
    font-size: .68rem;
}

.ratio-target-caption {
    font-size: .73rem;
    line-height: 1.55;
}

.intro-kicker,
.intro-map-header,
.intro-map-footer {
    font-size: .68rem;
}

.intro-actions > span,
.intro-map-step small {
    font-size: .76rem;
}

.intro-footer,
.workspace-footer {
    color: var(--text-dark);
    font-size: .74rem;
    line-height: 1.45;
}

.intro-footer a strong {
    color: var(--text-muted);
}
