/* ==================== Variables ==================== */
:root {
    --primary-color: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-subtle: #eff6ff;
    --secondary-color: #0f172a;
    --text-dark: #0f172a;
    --text-medium: #475569;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --bg-page: #f8fafc;
    --bg-white: #ffffff;
    --success-color: #059669;
    --success-light: #ecfdf5;
    --warning-color: #d97706;
    --warning-light: #fffbeb;
    --danger-color: #dc2626;
    --danger-light: #fef2f2;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 100px;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ==================== Global Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    color: var(--text-dark);
    background-color: var(--bg-page);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
}

/* ==================== Container ==================== */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ==================== Data Quality Banner ==================== */
.data-quality-banner {
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.data-quality-medium {
    background: #fefce8;
    border-color: #eab308;
    color: #854d0e;
}

.data-quality-low {
    background: #fff7ed;
    border-color: #f97316;
    color: #9a3412;
}

/* ==================== Chart Tooltip ==================== */
.chart-tooltip {
    position: absolute;
    background: var(--bg-dark, #1e293b);
    color: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm, 6px);
    font-size: 0.78rem;
    line-height: 1.5;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* ==================== Page Loading Overlay ==================== */
.page-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.page-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.page-loading-text {
    font-size: 1rem;
    color: var(--text-medium);
    font-weight: 500;
}

/* ==================== Navbar ==================== */
.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 0;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.logo {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.logo:hover {
    color: var(--primary-color);
}

.navbar-menu {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    padding: 0.5rem 0.875rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    min-width: 220px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg-page);
    color: var(--text-dark);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    background: var(--bg-white);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    padding: 0.5rem 1.25rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-sans);
    transition: background 0.2s, box-shadow 0.2s;
}

.search-btn:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

/* ==================== Hero Section ==================== */
.hero {
    background: var(--secondary-color);
    color: white;
    padding: 4.5rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(29, 78, 216, 0.3) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.hero .container {
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-subtitle {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1rem;
}

.hero h1 {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    line-height: 1.15;
}

.hero p {
    font-size: 1.125rem;
    margin-bottom: 2.25rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.main-search-form {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 520px;
    margin: 0 auto;
}

.ticker-input {
    padding: 0.875rem 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--font-sans);
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transition: border-color 0.2s, background 0.2s;
}

.ticker-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.ticker-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.12);
}

.search-button {
    padding: 0.875rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

.search-button:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.search-button:active {
    transform: translateY(0);
}

.error-message {
    color: #fca5a5;
    text-align: center;
    margin-top: 1rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 1rem;
    font-size: 0.95rem;
}

/* ==================== Trust Banner ==================== */
.trust-banner {
    text-align: center;
    padding: 1.25rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.trust-banner span {
    margin: 0 0.75rem;
    opacity: 0.6;
}

/* ==================== Sections ==================== */
.info-section,
.popular-section {
    margin-bottom: 3.5rem;
}

.section-header {
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-dark);
}

.section-header p {
    color: var(--text-light);
    margin-top: 0.25rem;
    font-size: 0.95rem;
}

.info-section h2,
.popular-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
    color: var(--text-dark);
}

/* ==================== Grid Layouts ==================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.875rem;
}

.stock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

/* ==================== Cards ==================== */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-xs);
    transition: box-shadow 0.2s;
}

.card h2 {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin-bottom: 1.25rem;
    color: var(--text-dark);
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.info-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-xs);
}

.info-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.info-card .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--primary-subtle);
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.info-card h3 {
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.info-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
}

.stock-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem 1rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
}

.stock-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stock-ticker {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.stock-name {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ==================== Frameworks Grid ==================== */
.frameworks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.framework-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-xs);
}

.framework-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.framework-icon {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.framework-card h3 {
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.framework-card p {
    color: var(--text-light);
    font-size: 0.85rem;
    line-height: 1.55;
}

/* ==================== Quote Banner ==================== */
.quote-banner {
    text-align: center;
    padding: 2.5rem 2rem;
    margin-bottom: 3.5rem;
    background: var(--primary-subtle);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.quote-banner blockquote {
    font-size: 1.25rem;
    font-weight: 500;
    font-style: italic;
    color: var(--text-dark);
    margin: 0;
    letter-spacing: -0.01em;
}

.quote-banner cite {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-style: normal;
    color: var(--text-light);
    font-weight: 500;
}

.info-item {
    padding: 1rem;
    background: var(--bg-page);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    min-width: 0;
    overflow: hidden;
}

.info-item label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.info-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.info-item .value a {
    font-size: 0.9rem;
    font-weight: 600;
}

/* ==================== Stock Detail Page ==================== */
.stock-header {
    padding-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.back-link {
    margin-bottom: 1rem;
}

.back-link a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.back-link a:hover {
    color: var(--primary-color);
}

.stock-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.stock-header h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-dark);
    line-height: 1.2;
    margin: 0;
}

.ticker-badge {
    display: inline-block;
    background: var(--primary-subtle);
    color: var(--primary-color);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
}

/* External Links Bar */
.external-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.external-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-medium);
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.external-links a:hover {
    color: var(--primary-color);
    border-color: var(--primary-light);
    background: var(--primary-subtle);
}

.external-links a .ext-icon {
    font-size: 0.7rem;
    opacity: 0.5;
}

/* Full-width layout (no sidebar) */
.stock-content {
    display: block;
    margin-bottom: 2rem;
}

.main-panel {
    min-width: 0;
}

.company-description {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    color: var(--text-medium);
    line-height: 1.7;
    font-size: 0.9rem;
}

/* ==================== Buttons ==================== */
.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    text-align: center;
    font-family: var(--font-sans);
}

.button.primary {
    background: var(--primary-color);
    color: white;
}

.button.primary:hover {
    background: var(--primary-light);
}

.link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.link:hover {
    color: var(--primary-light);
}

/* ==================== Error Page ==================== */
.error-container {
    text-align: center;
    padding: 4rem 1.5rem;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    margin: 2rem auto;
    max-width: 480px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.error-ticker {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--danger-color);
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.75rem;
    margin-bottom: 1rem;
}

.error-container h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.error-message {
    color: var(--text-light);
    margin-bottom: 1.25rem;
}

.error-reasons {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    text-align: left;
    display: inline-block;
}

.error-reasons li {
    color: var(--text-light);
    font-size: 0.9rem;
    padding: 0.3rem 0;
    padding-left: 1.25rem;
    position: relative;
}

.error-reasons li::before {
    content: '\2022';
    position: absolute;
    left: 0;
    color: var(--danger-color);
    font-weight: 700;
}

/* Error Page — Suggestions */
.error-suggestions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1.25rem 0 1.5rem;
    text-align: left;
}

.suggestion-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.suggestion-link:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.suggestion-symbol {
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    color: var(--primary-color);
    min-width: 4rem;
}

.suggestion-name {
    color: var(--text-light);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== Footer ==================== */
.footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

.footer .container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.footer-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0.5rem auto 0;
    line-height: 1.5;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .hero {
        padding: 3rem 1.5rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .main-search-form {
        flex-direction: column;
    }

    .ticker-input,
    .search-button {
        width: 100%;
    }

    .navbar .container {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .navbar-menu {
        justify-content: stretch;
    }

    .search-form {
        flex-direction: column;
    }

    .search-input {
        min-width: unset;
        width: 100%;
        font-size: 16px;
    }

    .stock-header h1 {
        font-size: 1.5rem;
    }

    .stock-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

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

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

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

    .external-links {
        gap: 0.375rem;
    }

    .card h2 {
        font-size: 1rem;
    }

    .insider-table th,
    .insider-table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.78rem;
    }

    .insider-name {
        max-width: 120px;
    }

    .insider-signal {
        font-size: 0.82rem;
    }

    .power-header {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 2.5rem 1rem;
    }

    .hero h1 {
        font-size: 1.625rem;
    }

    .ticker-input {
        font-size: 16px;
    }

    .card {
        padding: 1.25rem;
    }

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

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

    .quote-banner blockquote {
        font-size: 1.1rem;
    }

    .info-item .value {
        font-size: 1.05rem;
    }

    .power-score-detail {
        padding-left: 0;
    }

    .power-score-label {
        min-width: 0;
    }

    .safety-assessment {
        padding: 0.75rem;
    }

    .assessment-text p {
        font-size: 0.82rem;
    }

    .status-badge {
        font-size: 0.68rem;
        padding: 0.3rem 0.625rem;
    }

    .metric-item {
        padding: 0.875rem;
    }

    .metric-value {
        font-size: 1.35rem;
    }

    .metric-details div {
        font-size: 0.78rem;
    }

    .piotroski-item {
        font-size: 0.75rem;
    }

    .piotroski-detail {
        font-size: 0.7rem;
    }

    .health-card-header h3 {
        font-size: 0.85rem;
    }

    .insider-table th,
    .insider-table td {
        padding: 0.35rem 0.375rem;
        font-size: 0.85rem;
    }

    .insider-table {
        font-size: 0.82rem;
    }

    .insider-name {
        max-width: 90px;
    }

    .roic-wacc-details {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .dcf-details-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dcf-controls {
        grid-template-columns: 1fr;
    }

    .dcf-implied-rate {
        padding: 1rem;
    }

    .dcf-rate-value {
        font-size: 1.625rem;
    }

    .compact-breakdown {
        flex-direction: column;
        gap: 0.25rem;
    }

    .mos-slider-ticks {
        font-size: 0.65rem;
    }

    .cap-alloc-chart {
        height: 160px;
    }

    .ca-bar-total {
        font-size: 0.55rem;
    }

    .ca-bar-label {
        font-size: 0.6rem;
    }
}

/* ==================== Stock Page In-page Navigation ==================== */
.stock-tabs {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 1.5rem;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 56px;
    z-index: 90;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.stock-tabs::-webkit-scrollbar {
    display: none;
}

.stock-tabs a {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 0;
    margin-bottom: -1px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-medium);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.stock-tabs a:hover,
.stock-tabs a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

@media (max-width: 768px) {
    .stock-tabs {
        padding: 0 1rem;
        top: 52px;
    }

    .stock-tabs a {
        font-size: 0.78rem;
    }
}

/* ==================== Graham Margin of Safety Analysis ==================== */
.graham-analysis {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
}

.graham-analysis h2 {
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
}

.safety-assessment {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-page);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.assessment-status {
    flex-shrink: 0;
}

.status-badge {
    padding: 0.4rem 0.875rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.graham-score {
    font-weight: 600;
    font-size: 0.85em;
    opacity: 0.8;
}

.status-good {
    background-color: var(--success-light);
    color: var(--success-color);
}

.status-moderate {
    background-color: var(--warning-light);
    color: var(--warning-color);
}

.status-risk {
    background-color: var(--danger-light);
    color: var(--danger-color);
}

.assessment-text {
    flex: 1;
}

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

.graham-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.875rem;
    margin-bottom: 1.5rem;
}

.metric-item {
    background: var(--bg-page);
    padding: 1.125rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    transition: box-shadow 0.2s;
}

.metric-item:hover {
    box-shadow: var(--shadow-sm);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.625rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.metric-header label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-medium);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.metric-status {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-weight: 600;
    color: var(--text-medium);
    letter-spacing: 0.01em;
}

.metric-value {
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0.25rem 0;
    letter-spacing: -0.03em;
}

.metric-details {
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0.5rem 0;
    color: var(--text-medium);
}

.metric-details div {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
}

.metric-details .metric-note {
    display: block;
    justify-content: initial;
}

.metric-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.625rem;
    line-height: 1.5;
    font-style: normal;
    border-top: 1px solid var(--border-light);
    padding-top: 0.625rem;
}

.risk-section {
    background: var(--danger-light);
    padding: 1.125rem;
    border-radius: var(--radius-md);
    border: 1px solid #fecaca;
    margin-bottom: 1.25rem;
}

.risk-section h3 {
    color: var(--danger-color);
    margin-bottom: 0.625rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.risk-list {
    list-style: none;
    padding: 0;
}

.risk-list li {
    padding: 0.375rem 0;
    color: var(--text-medium);
    border-bottom: 1px solid #fecaca;
    padding-left: 1.375rem;
    position: relative;
    font-size: 0.875rem;
}

.risk-list li:last-child {
    border-bottom: none;
}

.risk-list li:before {
    content: "✕";
    position: absolute;
    left: 0;
    color: var(--danger-color);
    font-weight: bold;
    font-size: 0.75rem;
}

.graham-note {
    background: var(--primary-subtle);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid #dbeafe;
    font-size: 0.85rem;
    color: var(--text-medium);
}

.graham-note p {
    margin: 0;
    line-height: 1.6;
}

/* ==================== Margin of Safety Slider ==================== */
.mos-slider-section .section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.mos-valuation-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.875rem;
    margin-bottom: 1.75rem;
}

.mos-val-card {
    text-align: center;
    padding: 1.125rem 0.75rem;
    background: var(--bg-page);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.mos-val-card label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.mos-val-price {
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.03em;
}

.mos-val-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.mos-overvalued { color: var(--danger-color); font-weight: 600; }
.mos-undervalued { color: var(--success-color); font-weight: 600; }

.mos-target-card {
    border: 2px solid var(--primary-color);
    background: var(--primary-subtle);
}

.mos-target-card .mos-val-price {
    color: var(--primary-color);
}

.mos-target-buy {
    border-color: var(--success-color) !important;
    background: #f0fdf4 !important;
}

.mos-target-buy .mos-val-price {
    color: var(--success-color) !important;
}

.mos-target-wait .mos-val-price {
    color: var(--primary-color);
}

/* Slider */
.mos-slider-wrap {
    margin-bottom: 1.5rem;
    padding: 0 0.25rem;
}

.mos-slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.mos-slider-current-label {
    font-size: 0.85rem;
    color: var(--text-dark);
}

.mos-slider-current-label strong {
    color: var(--primary-color);
    font-size: 1rem;
}

.mos-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--primary-color) var(--pct, 50%), var(--border-light) var(--pct, 50%));
    outline: none;
    cursor: pointer;
}

.mos-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--bg-white);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.15s;
}

.mos-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.mos-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--bg-white);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: pointer;
}

.mos-slider-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding: 0 2px;
}

.mos-slider-ticks span {
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
}

.mos-slider-ticks span:hover {
    color: var(--primary-color);
}

/* Context row */
.mos-context {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.875rem;
    background: var(--bg-page);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin-bottom: 1.25rem;
}

.mos-context-item {
    text-align: center;
}

.mos-context-item label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.125rem;
}

.mos-context-item span {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
}

@media (max-width: 768px) {
    .mos-valuation-row {
        grid-template-columns: 1fr;
    }

    .mos-context {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }
}

/* ==================== Reverse DCF Calculator ==================== */
.reverse-dcf .section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.dcf-implied-rate {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-page);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin-bottom: 1.5rem;
}

.dcf-rate-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.dcf-rate-value {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.dcf-aggressive { color: var(--danger-color); }
.dcf-high { color: #ea580c; }
.dcf-moderate { color: var(--warning-color); }
.dcf-conservative { color: var(--success-color); }
.dcf-decline { color: var(--danger-color); }

.dcf-verdict-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    letter-spacing: 0.04em;
    background: currentColor;
    color: white;
}

.dcf-aggressive .dcf-verdict-badge { background: var(--danger-color); }
.dcf-high .dcf-verdict-badge { background: #ea580c; }
.dcf-moderate .dcf-verdict-badge { background: var(--warning-color); }
.dcf-conservative .dcf-verdict-badge { background: var(--success-color); }
.dcf-decline .dcf-verdict-badge { background: var(--danger-color); }

.dcf-verdict-text {
    font-size: 0.88rem;
    color: var(--text-medium);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.dcf-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.875rem;
    margin-bottom: 1.5rem;
}

.dcf-detail {
    text-align: center;
    padding: 0.875rem;
    background: var(--bg-page);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.dcf-detail label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.dcf-detail .value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-dark);
}

.dcf-sensitivity {
    margin-bottom: 1.5rem;
}

.dcf-sensitivity-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.dcf-sensitivity-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dcf-sensitivity-table {
    width: 100%;
    min-width: 380px;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.dcf-sensitivity-table th,
.dcf-sensitivity-table td {
    padding: 0.4rem 0.75rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.dcf-sensitivity-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-medium);
}

.dcf-sensitivity-table .sens-current-row th,
.dcf-sensitivity-table .sens-current-col {
    background: var(--primary-subtle);
    color: var(--primary-color);
}

.dcf-sensitivity-table .sens-current-cell {
    background: var(--primary-subtle);
    font-weight: 700;
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.sens-aggressive { color: #ef4444; font-weight: 600; }
.sens-high       { color: #f97316; }
.sens-moderate   { color: #eab308; }
.sens-conservative { color: #22c55e; }
.sens-decline    { color: #3b82f6; }

.dcf-note {
    background: var(--primary-subtle);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid #dbeafe;
    font-size: 0.85rem;
    color: var(--text-medium);
}

.dcf-note p {
    margin: 0;
    line-height: 1.6;
}

/* DCF Interactive Controls */
.dcf-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-page);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.dcf-control-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.dcf-control-header label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.dcf-control-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.dcf-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--primary-color) var(--pct, 50%), var(--border-light) var(--pct, 50%));
    outline: none;
    cursor: pointer;
}

.dcf-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--bg-white);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.15s;
}

.dcf-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.dcf-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--bg-white);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: pointer;
}

.dcf-slider-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 0.375rem;
    padding: 0 2px;
}

.dcf-slider-ticks span {
    font-size: 0.65rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.125rem 0.25rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
}

.dcf-slider-ticks span:hover {
    color: var(--primary-color);
}

/* ==================== Capital Allocation ==================== */
.cap-alloc-section .section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.cap-alloc-red-flag {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    margin-bottom: 1.5rem;
}

.cap-alloc-red-flag .red-flag-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.cap-alloc-red-flag p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--danger-color);
    line-height: 1.5;
    font-weight: 500;
}

.cap-alloc-chart-wrap {
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.cap-alloc-chart-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0.75rem;
    width: 32px;
    background: linear-gradient(to right, transparent, rgba(248, 250, 252, 0.85));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.cap-alloc-chart-wrap.is-scrollable::after {
    opacity: 1;
}

.cap-alloc-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    height: 240px;
    padding: 0 0.5rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 0.75rem;
    min-width: max(100%, calc(var(--year-count, 5) * 52px));
}

.ca-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    min-width: 0;
}

.ca-bar-total {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-medium);
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

.ca-bar-stack {
    width: 100%;
    max-width: 72px;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    overflow: hidden;
    cursor: default;
    transition: opacity 0.15s;
}

.ca-bar-stack:hover {
    opacity: 0.85;
}

.ca-bar-seg {
    width: 100%;
    min-height: 2px;
}

.bar-dividends    { background: #3b82f6; }
.bar-buybacks     { background: #f59e0b; }
.bar-acquisitions { background: #8b5cf6; }
.bar-capex        { background: #10b981; }

.ca-bar-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.cap-alloc-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding-top: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-medium);
}

.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-dividends    { background: #3b82f6; }
.legend-buybacks     { background: #f59e0b; }
.legend-acquisitions { background: #8b5cf6; }
.legend-capex        { background: #10b981; }

@media (max-width: 768px) {
    .cap-alloc-chart {
        height: 180px;
        gap: 0.5rem;
    }

    .ca-bar-total {
        font-size: 0.6rem;
    }

    .cap-alloc-legend {
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    .graham-metrics {
        grid-template-columns: 1fr;
    }

    .safety-assessment {
        flex-direction: column;
        align-items: flex-start;
    }

    .metric-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dcf-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dcf-controls {
        grid-template-columns: 1fr;
    }

    .dcf-rate-value {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ── ROIC vs WACC Section ── */
.roic-wacc-section .section-subtitle {
    color: #6b7280;
    margin-top: -0.25rem;
    margin-bottom: 1.5rem;
}

.roic-verdict-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
    line-height: 1.55;
}

.roic-verdict-banner .verdict-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    margin-top: 0.05rem;
}

.roic-verdict-creator {
    background: #ecfdf5;
    border-left: 4px solid #10b981;
    color: #065f46;
}

.roic-verdict-destroyer {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.roic-verdict-neutral {
    background: #fefce8;
    border-left: 4px solid #eab308;
    color: #713f12;
}

.roic-chart-wrap {
    margin-bottom: 1.25rem;
}

.roic-chart {
    width: 100%;
    min-height: 260px;
}

.roic-svg {
    overflow: visible;
}

.roic-grid-line {
    stroke: #e5e7eb;
    stroke-width: 1;
}

.roic-y-label {
    font-size: 11px;
    fill: #9ca3af;
    text-anchor: end;
    font-family: 'Inter', sans-serif;
}

.roic-x-label {
    font-size: 12px;
    fill: #6b7280;
    text-anchor: middle;
    font-family: 'Inter', sans-serif;
}

.roic-wacc-line {
    stroke: #ef4444;
    stroke-width: 2;
    stroke-dasharray: 8 4;
}

.roic-wacc-label {
    font-size: 11px;
    fill: #ef4444;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.roic-line {
    fill: none;
    stroke: #2563eb;
    stroke-width: 2.5;
    stroke-linejoin: round;
}

.roic-area-above {
    fill: rgba(16, 185, 129, 0.12);
}

.roic-area-below {
    fill: rgba(239, 68, 68, 0.10);
}

.roic-dot-above {
    fill: #10b981;
    stroke: #fff;
    stroke-width: 2;
}

.roic-dot-below {
    fill: #ef4444;
    stroke: #fff;
    stroke-width: 2;
}

.roic-val-label {
    font-size: 12px;
    fill: #1e293b;
    text-anchor: middle;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.roic-wacc-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.rw-detail {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.rw-label {
    font-size: 0.78rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rw-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

@media (max-width: 768px) {
    .roic-wacc-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== 7 Powers Analysis ==================== */
.seven-powers-section .section-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

/* Moat banner */
.powers-moat-banner {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.moat-icon {
    font-size: 1.1rem;
}

.powers-moat-wide {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.powers-moat-narrow {
    background: #fefce8;
    border: 1px solid #fde68a;
    color: #78350f;
}

.powers-moat-none {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* Powers grid */
.powers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Powers grouping (Quantitative / Qualitative) */
.powers-group {
    margin-bottom: 1.5rem;
}

.powers-group:last-of-type {
    margin-bottom: 1rem;
}

.powers-group-header {
    margin-bottom: 0.75rem;
}

.powers-group-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 0.15rem 0;
}

.powers-group-header p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

/* Power card score rows (Quantitative + Qualitative) */
.power-scores {
    margin-top: 0.5rem;
}

.power-score-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.power-score-row:first-child {
    margin-top: 0;
}

.power-score-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 7rem;
    flex-shrink: 0;
}

.power-score-detail {
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0.15rem 0 0 0;
    padding-left: 7.5rem;
}

.power-qual-text {
    font-style: italic;
    color: var(--text-muted);
}

.power-badge-sm {
    font-size: 0.62rem;
    padding: 0.1rem 0.4rem;
}

/* Overall signal source label */
.powers-signal-source {
    font-size: 0.78rem;
    font-weight: 500;
    color: inherit;
    opacity: 0.7;
    margin-left: 0.25rem;
}

.powers-signal-detail {
    font-weight: 400;
    font-size: 0.88rem;
}

.power-card {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--bg-page);
    transition: box-shadow 0.15s;
}

.power-card:hover {
    box-shadow: var(--shadow-sm);
}

.power-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.power-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.power-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-dark);
    flex: 1;
}

.power-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.power-badge-strong {
    background: #d1fae5;
    color: #065f46;
}

.power-badge-moderate {
    background: #fef3c7;
    color: #78350f;
}

.power-badge-weak {
    background: #fee2e2;
    color: #991b1b;
}

.power-badge-na {
    background: #f1f5f9;
    color: #64748b;
}

.power-badge-absent {
    background: #fef2f2;
    color: #7f1d1d;
}

.power-detail {
    font-size: 0.82rem;
    color: var(--text-light);
    line-height: 1.55;
    margin: 0;
}

/* Left accent on scored cards */
.power-card.power-strong {
    border-left: 3px solid #10b981;
}

.power-card.power-moderate {
    border-left: 3px solid #f59e0b;
}

.power-card.power-weak {
    border-left: 3px solid #ef4444;
}

.power-card.power-na {
    border-left: 3px solid #cbd5e1;
    opacity: 0.75;
}

.power-card.power-absent {
    border-left: 3px solid #dc2626;
    opacity: 0.7;
}

/* ==================== AI Qualitative Analysis ==================== */
.ai-analysis-section {
    margin-top: 1.5rem;
}

/* Paywall */
.ai-paywall {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
}

.ai-paywall-inner {
    max-width: 480px;
    margin: 0 auto;
}

.ai-paywall-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.ai-paywall h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.ai-paywall p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.ai-paywall-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem 0;
    text-align: left;
    display: inline-block;
}

.ai-paywall-features li {
    font-size: 0.85rem;
    color: var(--text-light);
    padding: 0.3rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.ai-paywall-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: 700;
}

.ai-unlock-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ai-unlock-btn:hover {
    background: var(--primary-light);
}

.ai-unlock-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-paywall-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* Loading spinner */
.ai-analysis-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.ai-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
}

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

.ai-error {
    color: #ef4444;
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.ai-refund-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    color: var(--text-dark);
}

.ai-refund-notice p {
    margin: 0.25rem 0 0 0;
    font-size: 0.82rem;
    color: var(--text-light);
}

.ai-refund-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

/* AI insight injected into power cards */
.ai-insight {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
}

.ai-insight-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.ai-insight-text {
    font-size: 0.82rem;
    color: var(--text-light);
    line-height: 1.55;
    margin: 0.35rem 0 0 0;
    font-style: italic;
}

/* AI banner */
.ai-analysis-banner {
    padding: 0.875rem 1.125rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    color: var(--text-dark);
}

.ai-analysis-icon {
    font-size: 1.1rem;
}

/* Uncertain badge */
.power-badge-uncertain {
    background: #fef9c3;
    color: #854d0e;
}

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

/* ==================== Financial Health & Signals ==================== */
.financial-health-section .section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.health-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.health-card {
    background: var(--bg-page);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.health-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.health-card-header h3 {
    margin: 0;
    font-size: 0.95rem;
}

.health-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.8rem;
}

.health-assessment {
    color: var(--text-medium);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.piotroski-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.piotroski-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    padding: 0.2rem 0;
    color: var(--text-medium);
}

.piotroski-icon {
    font-weight: 700;
    font-size: 0.85rem;
    width: 1.1rem;
    flex-shrink: 0;
}

.piotroski-pass .piotroski-icon {
    color: var(--success-color);
}

.piotroski-fail .piotroski-icon {
    color: var(--danger-color);
}

.piotroski-na {
    opacity: 0.55;
}

.piotroski-na .piotroski-icon {
    color: var(--text-light);
}

.piotroski-name {
    font-weight: 600;
    min-width: 0;
}

.piotroski-detail {
    color: var(--text-light);
    font-size: 0.75rem;
    margin-left: auto;
    text-align: right;
    flex-shrink: 0;
}

/* Compact metrics column */
.health-compact {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.compact-metric h3 {
    font-size: 0.9rem;
    margin-bottom: 0.375rem;
}

.compact-year {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.compact-value {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compact-sublabel {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.compact-breakdown {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.compact-detail {
    font-size: 0.82rem;
    color: var(--text-medium);
    line-height: 1.5;
    margin: 0.25rem 0 0;
}

.text-positive {
    color: var(--success-color);
}

.text-negative {
    color: var(--danger-color);
}

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

    .piotroski-item {
        flex-wrap: wrap;
    }

    .piotroski-detail {
        margin-left: 1.5rem;
        text-align: left;
        flex-basis: 100%;
    }

    .health-card {
        padding: 1rem;
    }

    .compact-value {
        font-size: 1rem;
    }
}

/* ==================== Historical Valuation ==================== */
.valuation-range-section .section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.valuation-gauges {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.valuation-gauge {
    padding: 0;
}

.gauge-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.gauge-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.gauge-current {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-dark);
}

.gauge-bar {
    position: relative;
    height: 10px;
    background: var(--border-light);
    border-radius: var(--radius-full);
    overflow: visible;
}

.gauge-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--success-color), var(--warning-color), var(--danger-color));
    transition: width 0.5s ease;
}

.gauge-marker {
    position: absolute;
    top: -3px;
    width: 4px;
    height: 16px;
    background: var(--text-dark);
    border-radius: 2px;
    transform: translateX(-50%);
}

.gauge-range {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.gauge-percentile {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-medium);
}

/* ==================== Insider Transactions ==================== */
.insider-section .section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.no-data-message {
    color: var(--text-muted);
    font-style: italic;
    padding: 1rem 0;
}

.insider-signal {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.insider-signal-icon {
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}

.insider-signal-bullish {
    background: var(--success-light);
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.insider-signal-bearish {
    background: var(--danger-light);
    border: 1px solid #fecaca;
    color: #991b1b;
}

.insider-signal-neutral {
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    color: var(--text-medium);
}

.insider-counts {
    font-weight: 400;
    font-size: 0.82rem;
    color: inherit;
    opacity: 0.8;
}

.insider-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.25rem;
    position: relative;
}

.insider-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.insider-table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.insider-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-medium);
}

.insider-table .text-right {
    text-align: right;
}

.insider-table th.text-right {
    text-align: right;
}

.insider-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.insider-type {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.insider-type-buy {
    background: #d1fae5;
    color: #065f46;
}

.insider-type-sell {
    background: #fee2e2;
    color: #991b1b;
}


/* ==================== Investability Score Banner ==================== */

.investability-banner {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.75rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-xs);
}

.investability-title {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 1rem 0;
}

.investability-main {
    display: flex;
    align-items: center;
    gap: 40px;
}

.investability-gauge {
    flex-shrink: 0;
    text-align: center;
    min-width: 140px;
}

.gauge-circle {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.gauge-circle svg {
    transform: rotate(-90deg);
    width: 120px;
    height: 120px;
}

.gauge-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 10;
}

.gauge-fg {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dasharray 0.8s ease;
}

.investability-green .gauge-fg    { stroke: var(--success-color); }
.investability-yellow-green .gauge-fg { stroke: #65a30d; }
.investability-amber .gauge-fg    { stroke: var(--warning-color); }
.investability-orange .gauge-fg   { stroke: #ea580c; }
.investability-red .gauge-fg      { stroke: var(--danger-color); }
.investability-gray .gauge-fg     { stroke: var(--text-muted); }

.gauge-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

.gauge-label-text {
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.investability-label-green       { color: var(--success-color); }
.investability-label-yellow-green { color: #65a30d; }
.investability-label-amber       { color: var(--warning-color); }
.investability-label-orange      { color: #ea580c; }
.investability-label-red         { color: var(--danger-color); }
.investability-label-gray        { color: var(--text-muted); }

.investability-pillars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.investability-pillar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pillar-header {
    display: flex;
    justify-content: space-between;
    min-width: 200px;
}

.pillar-name {
    font-size: 0.82rem;
    color: var(--text-medium);
}

.pillar-pct {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dark);
    min-width: 24px;
    text-align: right;
}

.pillar-bar {
    flex: 1;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.pillar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.pillar-good  { background: var(--success-color); }
.pillar-mixed { background: var(--warning-color); }
.pillar-weak  { background: var(--danger-color); }

.pillar-weight {
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 60px;
    text-align: right;
}

.investability-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.875rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.investability-coverage {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.investability-ai-badge {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 500;
}

.investability-weaknesses {
    padding: 0.5rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: baseline;
}

.investability-weaknesses-label {
    font-weight: 600;
    color: var(--text-medium);
    margin-right: 0.25rem;
}

.investability-weakness-item {
    color: var(--warning-color);
}

.weakness-pillar {
    color: var(--text-light);
    font-style: italic;
}

.investability-disclaimer {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
    font-style: italic;
}

.investability-no-data {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.investability-insufficient {
    opacity: 0.7;
}

/* Responsive: Investability Banner */
@media (max-width: 768px) {
    .investability-main {
        flex-direction: column;
        gap: 20px;
    }
    .investability-gauge {
        min-width: auto;
    }
    .pillar-header {
        min-width: 140px;
    }
    .investability-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .investability-disclaimer {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .investability-banner {
        padding: 1.25rem 1rem 0.875rem;
        border-radius: var(--radius-md);
    }
    .investability-main {
        gap: 1rem;
    }
    .gauge-circle {
        width: 100px;
        height: 100px;
    }
    .gauge-circle svg {
        width: 100px;
        height: 100px;
    }
    .gauge-number {
        font-size: 1.8rem;
    }
    .gauge-label-text {
        font-size: 0.78rem;
    }
    .investability-pillar {
        flex-wrap: wrap;
        gap: 4px 8px;
    }
    .pillar-header {
        min-width: 0;
        flex: 1 1 auto;
    }
    .pillar-pct {
        font-size: 0.78rem;
    }
    .pillar-bar {
        flex: 1 1 auto;
        min-width: 60px;
        order: 0;
    }
    .pillar-weight {
        font-size: 0.65rem;
        min-width: auto;
    }
    .pillar-name {
        font-size: 0.76rem;
    }
}

/* ==================== Touch-device enhancements ==================== */
@media (hover: none) and (pointer: coarse) {
    .external-links a {
        min-height: 44px;
        padding: 0.625rem 1rem;
        align-items: center;
    }

    .back-link a {
        min-height: 44px;
        padding: 0.5rem 0;
        display: inline-flex;
        align-items: center;
    }

    .suggestion-link {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    .search-btn {
        min-height: 44px;
    }

    .ai-unlock-btn {
        min-height: 44px;
    }

    .mos-slider::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }

    .mos-slider::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }

    .dcf-slider::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }

    .dcf-slider::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }
}

/* Acronym tooltip bubbles */
abbr.acronym-tip {
    position: relative;
    text-decoration: underline dotted var(--text-light);
    text-underline-offset: 2px;
    cursor: help;
}

abbr.acronym-tip::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--text-color, #1a1a2e);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0.01em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
    margin-bottom: 4px;
}

abbr.acronym-tip:hover::after,
abbr.acronym-tip:focus::after {
    opacity: 1;
}

abbr.acronym-tip:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
    border-radius: 2px;
}

@media (max-width: 768px) {
    abbr.acronym-tip::after {
        white-space: normal;
        max-width: 200px;
        text-align: center;
    }
}
