/* Investment Thesis section + dialog (#521, redesigned per design 5A "Debate").
   Apple-minimal: no borders, no shadows — the 2px bull/bear accent top-rules
   are the design's one deliberate exception. */

/* --- Section --- */

.ij-thesis-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 4px 0 8px;
}

/* --- Judgment strip: verdict chip · $target · review chip --- */

.ij-thesis-verdict-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: var(--ij-ts-footnote, 0.75rem);
    font-weight: 600;
}

.ij-thesis-verdict-chip--green {
    background: color-mix(in srgb, var(--mud-palette-success) 14%, transparent);
    color: var(--mud-palette-success);
}

.ij-thesis-verdict-chip--neutral {
    background: color-mix(in srgb, var(--mud-palette-text-secondary) 14%, transparent);
    color: var(--mud-palette-text-secondary);
}

.ij-thesis-verdict-chip--red {
    background: color-mix(in srgb, var(--mud-palette-error) 14%, transparent);
    color: var(--mud-palette-error);
}

.ij-thesis-review-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 980px;
    font-size: var(--ij-ts-footnote, 12px);
    font-weight: 600;
}

.ij-thesis-review-chip--neutral {
    color: var(--mud-palette-text-secondary);
    background: color-mix(in srgb, var(--mud-palette-text-secondary) 12%, transparent);
}

.ij-thesis-review-chip--warning {
    color: var(--ij-warning-text);
    background: color-mix(in srgb, var(--mud-palette-warning) 15%, transparent);
}

.ij-thesis-review-chip--overdue {
    color: var(--mud-palette-error);
    background: color-mix(in srgb, var(--mud-palette-error) 14%, transparent);
}

.ij-thesis-review-icon {
    font-size: var(--ij-ts-footnote, 12px);
    width: 12px;
    height: 12px;
}

/* --- Price → target rail --- */

/* --- Bull vs bear, facing columns --- */

/* Thesis prose sits on the body token (15px) — it is the user's own long-form
   argument and was rendering 1.5px smaller than the stock comments beneath it. */
.ij-thesis-prose {
    font-size: var(--ij-font-size-body, 15px);
    line-height: 1.6;
    color: var(--mud-palette-text-primary);
}

.ij-thesis-prose > :first-child {
    margin-top: 0;
}

.ij-thesis-prose > :last-child {
    margin-bottom: 0;
}

.ij-thesis-prose p {
    margin: 0 0 12px;
}

.ij-thesis-prose ul,
.ij-thesis-prose ol {
    margin: 0 0 12px;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ij-thesis-prose li {
    padding-left: 2px;
}

/* A loose list ("- one\n\n- two") makes Markdig wrap each item's text in its
   own <p>. Without this, the <ul>'s 8px flex gap stacks on top of that <p>'s
   12px bottom margin, giving 20px between loose items vs 8px between tight
   ones (which have no <p>). Zeroing the <li>'s own paragraph margins lets the
   flex gap be the only spacer, so loose and tight lists read the same — and,
   as a side effect, this also fixes a trailing <p> in the LAST <li> of the
   whole prose block, which `.ij-thesis-prose > :last-child` can't reach
   because it only matches direct children of the prose container. */
.ij-thesis-prose li > p:first-child {
    margin-top: 0;
}

.ij-thesis-prose li > p:last-child {
    margin-bottom: 0;
}

.ij-thesis-prose strong {
    font-weight: 600;
}

.ij-thesis-prose em {
    font-style: italic;
}

.ij-thesis-prose a {
    color: var(--mud-palette-primary);
    text-decoration: none;
}

.ij-thesis-prose a:hover {
    text-decoration: underline;
}

/* Inline code only — a block <code> inside <pre> gets its own treatment
   below so the pill background/padding doesn't apply there. */
.ij-thesis-prose code {
    font-size: var(--ij-ts-subhead, 13.5px);
    background: var(--mud-palette-background-grey);
    padding: 1px 5px;
    border-radius: 4px;
}

.ij-thesis-prose h1,
.ij-thesis-prose h2,
.ij-thesis-prose h3,
.ij-thesis-prose h4,
.ij-thesis-prose h5,
.ij-thesis-prose h6 {
    margin: 14px 0 6px;
    font-weight: 700;
    line-height: 1.3;
}

.ij-thesis-prose h1 {
    font-size: var(--ij-ts-title2, 20.5px);
}

.ij-thesis-prose h2 {
    font-size: var(--ij-ts-title3, 18.5px);
}

.ij-thesis-prose h3 {
    font-size: var(--ij-ts-title3, 17px);
}

.ij-thesis-prose h4,
.ij-thesis-prose h5,
.ij-thesis-prose h6 {
    font-size: var(--ij-ts-body, 15px);
}

.ij-thesis-prose hr {
    margin: 14px 0;
    border: none;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.ij-thesis-prose img,
.ij-thesis-prose video {
    max-width: 100%;
    height: auto;
}

.ij-thesis-prose iframe {
    max-width: 100%;
}

/* A 4-space-indented line (or a fenced block) can be arbitrarily wide with no
   wrap points — scroll it inside its own container rather than blowing out
   the narrow two-column facts grid or the page. */
.ij-thesis-prose pre {
    margin: 0 0 10px;
    padding: 8px 10px;
    max-width: 100%;
    overflow-x: auto;
    border-radius: 6px;
    background: var(--mud-palette-background-grey);
}

.ij-thesis-prose pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.ij-thesis-prose blockquote {
    margin: 0 0 10px;
    padding-left: 12px;
    border-left: 2px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
}

.ij-thesis-prose table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: var(--ij-ts-subhead, 13.5px);
    margin: 0 0 10px;
}

.ij-thesis-prose th,
.ij-thesis-prose td {
    border: 1px solid var(--mud-palette-lines-default);
    padding: 4px 8px;
    text-align: left;
}

/* --- Assumptions + catalysts --- */

.ij-thesis-delete-btn {
    color: var(--mud-palette-error);
}

.ij-thesis-history-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
}

/* --- Revision timeline --- */

.ij-thesis-revisions {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
}

.ij-thesis-revision {
    display: flex;
    gap: 12px;
}

.ij-thesis-rev-gutter {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: none;
    width: 10px;
}

.ij-thesis-rev-node {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
    margin-top: 4px;
}

.ij-thesis-rev-node--green {
    background: var(--mud-palette-success);
}

.ij-thesis-rev-node--neutral {
    background: var(--mud-palette-text-secondary);
}

.ij-thesis-rev-node--red {
    background: var(--mud-palette-error);
}

.ij-thesis-rev-node--none {
    background: var(--mud-palette-text-disabled);
}

.ij-thesis-rev-rail {
    width: 1px;
    flex: 1;
    background: var(--mud-palette-lines-default);
}

.ij-thesis-rev-body {
    flex: 1;
    min-width: 0;
    padding-bottom: 14px;
}

.ij-thesis-revision:last-child .ij-thesis-rev-body {
    padding-bottom: 0;
}

.ij-thesis-rev-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 2px;
}

.ij-thesis-rev-date {
    font-size: var(--ij-ts-footnote, 12px);
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
}

.ij-thesis-rev-current {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 980px;
    font-size: var(--ij-ts-caption2, 10px);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent);
}

.ij-thesis-revision .ij-thesis-verdict-chip {
    padding: 1px 9px;
    font-size: var(--ij-ts-caption1, 10.5px);
}

.ij-thesis-rev-target {
    font-size: var(--ij-ts-footnote, 12px);
    color: var(--mud-palette-text-secondary);
}

.ij-thesis-rev-delta {
    font-size: var(--ij-ts-caption1, 11px);
    font-weight: 700;
}

.ij-thesis-rev-delta--up {
    color: var(--mud-palette-success);
}

.ij-thesis-rev-delta--down {
    color: var(--mud-palette-error);
}

.ij-thesis-rev-excerpt {
    margin: 0;
    font-size: var(--ij-ts-subhead, 13px);
    line-height: 1.5;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Dialog (mirrors the published layout — design 5A) --- */

.ij-thesis-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.ij-thesis-dialog-title {
    font-size: var(--ij-ts-title3, 17px);
    font-weight: 700;
    letter-spacing: -0.015em;
}

.ij-thesis-dialog-close {
    border: none;
    background: transparent;
    padding: 2px;
    cursor: pointer;
    color: var(--mud-palette-text-secondary);
    display: inline-flex;
}

.ij-thesis-dialog-hint {
    margin: 0 0 18px;
    font-size: var(--ij-ts-subhead, 12.5px);
    color: var(--ij-text-tertiary);
}

.ij-thesis-editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.ij-thesis-field-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
}

.ij-thesis-field-caps {
    font-size: var(--ij-ts-caption1, 11px);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ij-thesis-field-caps--bull {
    color: var(--mud-palette-success);
}

.ij-thesis-field-caps--bear {
    color: var(--mud-palette-error);
}

.ij-thesis-field-caps--assumptions {
    color: var(--mud-palette-secondary);
}

.ij-thesis-field-caps--catalysts {
    color: var(--mud-palette-primary);
}

.ij-thesis-field-prompt {
    font-size: var(--ij-ts-footnote, 11.5px);
    color: var(--ij-text-tertiary);
    text-align: right;
}

.ij-thesis-field-prompt--lower {
    text-transform: lowercase;
}

.ij-thesis-field {
    margin-bottom: 14px;
}

.ij-thesis-textarea {
    width: 100%;
    resize: vertical;
    border: none;
    border-radius: 10px;
    padding: 11px 13px;
    font: inherit;
    font-size: var(--ij-ts-callout, 0.875rem);
    line-height: 1.55;
    color: var(--mud-palette-text-primary);
    background: color-mix(in srgb, var(--mud-palette-text-primary) 5%, transparent);
    outline: none;
    /* Auto-grow with the content (Chromium 123+); resize: vertical is the fallback. */
    field-sizing: content;
    min-height: 120px;
    max-height: 40vh;
}

.ij-thesis-textarea:focus {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 8%, transparent);
}

/* The bull/bear accent rules run into the field: rule on top, rounded bottom only. */
.ij-thesis-textarea--bull {
    border-top: 2px solid var(--mud-palette-success);
    border-radius: 0 0 10px 10px;
}

.ij-thesis-textarea--bear {
    border-top: 2px solid var(--mud-palette-error);
    border-radius: 0 0 10px 10px;
}

.ij-thesis-textarea--short {
    min-height: 88px;
}

/* --- Judgment panel --- */

.ij-thesis-judgment {
    background: var(--mud-palette-background-gray);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.ij-thesis-judgment-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.ij-thesis-judgment-label {
    font-size: var(--ij-ts-caption1, 11px);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ij-text-tertiary);
}

.ij-thesis-publishes {
    font-size: var(--ij-ts-footnote, 12px);
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
}

.ij-thesis-publishes-verdict--green {
    color: var(--mud-palette-success);
}

.ij-thesis-publishes-verdict--neutral {
    color: var(--mud-palette-text-secondary);
}

.ij-thesis-publishes-verdict--red {
    color: var(--mud-palette-error);
}

.ij-thesis-judgment-row {
    display: flex;
    align-items: flex-end;
    gap: 22px;
    flex-wrap: wrap;
}

.ij-thesis-cluster-label {
    font-size: var(--ij-ts-footnote, 11.5px);
    font-weight: 600;
    color: var(--ij-text-tertiary);
    margin-bottom: 6px;
}

.ij-thesis-upside-caption {
    font-weight: 700;
    color: var(--mud-palette-success);
}

.ij-thesis-upside-caption--down {
    color: var(--mud-palette-error);
}

.ij-thesis-review-caption {
    color: var(--mud-palette-text-secondary);
}

.ij-thesis-price-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 10px;
    /* #1774: vertical padding gives way to a real min-height on the input below,
       exactly as §2 did for .ij-dcf-input. The capsule ends up 44pt instead of
       40, so the visible field grows 4px and the tinted shape stays put.
       The input cannot borrow an ::after hit area (it needs a real caret and
       selection surface), and it cannot borrow its <label> either: the label is
       a sibling up in .ij-thesis-cluster-label, so `for=` gives it an accessible
       NAME but no contiguous touch target. */
    padding: 0 12px;
    background: color-mix(in srgb, var(--mud-palette-text-primary) 5%, transparent);
}

.ij-thesis-price-wrap:focus-within {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 8%, transparent);
}

.ij-thesis-price-prefix {
    color: var(--ij-text-tertiary);
    font-size: var(--ij-ts-subhead, 0.84375rem);
}

/* Single-line sibling of the textarea look — used by the price target. */
.ij-thesis-input {
    width: 160px;
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    font: inherit;
    font-size: var(--ij-ts-callout, 0.875rem);
    color: var(--mud-palette-text-primary);
    background: color-mix(in srgb, var(--mud-palette-text-primary) 5%, transparent);
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.ij-thesis-input:focus {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 8%, transparent);
}

/* Variant inside the $-prefixed wrapper: the wrapper carries the chrome. */
.ij-thesis-input--bare {
    width: 90px;
    padding: 0;
    /* #1774: was 24pt tall, under Apple's 28pt floor. See the capsule above —
       its vertical padding was removed to absorb this. */
    min-height: 44px;
    border-radius: 0;
    background: transparent;
    font-weight: 600;
}

.ij-thesis-input--bare:focus {
    background: transparent;
}

.ij-thesis-footer-note {
    font-size: var(--ij-ts-footnote, 12px);
    color: var(--ij-text-tertiary);
    margin-right: auto;
}

.ij-thesis-footer-actions {
    display: inline-flex;
    align-items: center;
    gap: 16px;
}

/* Shared with the MAUI head — stack the editor's two columns on narrow widths.
   Must stay after the grid's base 1fr 1fr rule: equal specificity, so source
   order is what lets this win inside the media query. */
@media (max-width: 640px) {
    .ij-thesis-editor-grid {
        grid-template-columns: 1fr;
    }
}

.ij-thesis-input::-webkit-outer-spin-button,
.ij-thesis-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ij-thesis-seg {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--mud-palette-text-primary) 5%, transparent);
}

.ij-thesis-seg-btn {
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: var(--ij-ts-subhead, 0.8125rem);
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
}

/* --- Mobile full-screen editor (design 6A) — scoped by the dialog variant class,
   set when the MAUI head opens the editor with ThesisVariant.Mobile. --- */

/* The nav bar owns the top edge; the body wrapper carries the padding. */
.ij-thesis-dialog--mobile .mud-dialog-content {
    padding: 0;
}

/* Cancel · title · Save nav bar declarations moved to form-dialog.css as
   .ij-form-nav / .ij-form-nav-cancel / .ij-form-nav-title / .ij-form-nav-save
   (16A) — shared with the transaction dialog. */

.ij-thesis-dialog--mobile .ij-thesis-dialog-body {
    padding: 16px 18px calc(env(safe-area-inset-bottom) + 16px);
}

/* Single column at phone width (the ≤640px query also applies — this keeps the
   layout correct even in wide simulators/iPads). */
.ij-thesis-dialog--mobile .ij-thesis-editor-grid {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 0;
}

/* 16px inputs prevent the iOS focus auto-zoom; 6A min-heights. */
.ij-thesis-dialog--mobile .ij-thesis-textarea {
    font-size: var(--ij-ts-body, 16px);
    min-height: 84px;
}

.ij-thesis-dialog--mobile .ij-thesis-textarea--bear {
    min-height: 66px;
}

.ij-thesis-dialog--mobile .ij-thesis-textarea--short {
    min-height: 48px;
}

.ij-thesis-dialog--mobile .ij-thesis-input {
    font-size: var(--ij-ts-body, 16px);
}

/* Judgment clusters stack full-width; segments become ≥44pt thumb targets. */
.ij-thesis-dialog--mobile .ij-thesis-judgment-row {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
}

.ij-thesis-dialog--mobile .ij-dcf-verdict-toggle,
.ij-thesis-dialog--mobile .ij-thesis-seg {
    display: flex;
    width: 100%;
}

.ij-thesis-dialog--mobile .ij-dcf-verdict-btn,
.ij-thesis-dialog--mobile .ij-thesis-seg-btn {
    flex: 1;
    min-height: 44px;
}

.ij-thesis-dialog--mobile .ij-thesis-judgment-publishes {
    margin-top: 12px;
    line-height: 1.45;
}

.ij-thesis-footer-note--mobile {
    margin: 12px 2px 0;
}

/* 6A "Delete Contact" pattern — the destructive action at the editor's very
   bottom, full width, on an error wash. */
.ij-thesis-delete-row {
    display: block;
    width: 100%;
    min-height: 46px;
    margin-top: 16px;
    border: none;
    border-radius: 12px;
    font: inherit;
    font-size: var(--ij-ts-body, 15px);
    font-weight: 600;
    color: var(--mud-palette-error);
    background: color-mix(in srgb, var(--mud-palette-error) 10%, transparent);
    cursor: pointer;
}

.ij-thesis-seg-btn--active {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Share sheet (ShareThesisDialog) styles moved to share-thesis.css (1B redesign). */

/* #2254 — "Since you last revised your thesis" band (stock page, top of the main column). */
/* #2254 layout: headline + band sit between the hero and the price chart. */
.ij-since-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 4px 0 20px;
}

.ij-thesis-headline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.ij-thesis-headline-pill {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--ij-primary-tint);
    color: var(--ij-primary-text);
    font-size: var(--ij-ts-footnote, 13px);
    font-weight: 600;
    text-decoration: none;
}

.ij-thesis-headline-pill:hover {
    text-decoration: none;
}

.ij-thesis-headline-label {
    font-weight: 700;
}

.ij-thesis-headline-sep {
    opacity: 0.6;
}

.ij-thesis-headline-upside {
    font-size: var(--ij-ts-footnote, 13px);
    font-weight: 600;
    color: var(--ij-text-secondary);
    font-variant-numeric: tabular-nums;
}

.ij-thesis-headline-upside--down {
    color: var(--ij-loss-text);
}

.ij-thesis-headline-revise {
    margin-left: auto;
}

/* In-page section links under the price chart (web only). */
.ij-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 16px 0 4px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ij-divider);
}

.ij-section-nav-link {
    padding: 6px 12px;
    border-radius: 8px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    font-size: var(--ij-ts-footnote, 13px);
    font-weight: 600;
    color: var(--ij-text-primary);
    text-decoration: none;
}

.ij-section-nav-link:hover {
    background: var(--ij-bg-gray);
    text-decoration: none;
}

.ij-section-nav-link:focus-visible {
    outline: 2px solid var(--ij-focus-ring);
    outline-offset: 2px;
}

.ij-since {
    background: var(--ij-bg-gray);
    border-radius: 16px;
    padding: 14px 16px;
}

.ij-since-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-bottom: 8px;
}

.ij-since-title {
    margin: 0;
    font-size: var(--ij-ts-headline, 17px);
    font-weight: 700;
    color: var(--ij-text-primary);
}

.ij-since-date {
    font-size: var(--ij-ts-footnote, 13px);
    color: var(--ij-text-secondary);
}

.ij-since-rows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

/* A tile: kind eyebrow, title, one-line detail. The whole tile is the link. */
.ij-since-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 44px;
    padding: 12px;
    border-radius: 12px;
    background: var(--ij-surface);
    color: var(--ij-text-primary);
    text-decoration: none;
}

.ij-since-row:hover {
    text-decoration: none;
    background: color-mix(in srgb, var(--ij-surface) 92%, var(--ij-text-primary));
}

.ij-since-row:focus-visible {
    outline: 2px solid var(--ij-focus-ring);
    outline-offset: 2px;
}

.ij-since-kind {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--ij-ts-caption1, 11px);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ij-text-secondary);
}

.ij-since-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: none;
    background: var(--ij-text-secondary);
}

.ij-since-row--info .ij-since-dot { background: var(--ij-primary); }
.ij-since-row--warn .ij-since-dot { background: var(--ij-warning-text); }
.ij-since-row--alert .ij-since-dot { background: var(--ij-danger-fill); }
.ij-since-row--info .ij-since-kind { color: var(--ij-primary-text); }
.ij-since-row--warn .ij-since-kind { color: var(--ij-warning-text); }
.ij-since-row--alert .ij-since-kind { color: var(--ij-loss-text); }

.ij-since-row-title {
    font-size: var(--ij-ts-subhead, 15px);
    font-weight: 600;
    line-height: 1.3;
}

.ij-since-row-detail {
    font-size: var(--ij-ts-footnote, 13px);
    color: var(--ij-text-secondary);
}

/* #2254 — a long thesis part shows its first paragraph; the toggle reveals the rest. */
.ij-thesis-more {
    margin-top: 6px;
}

/* #2254 PR 3 — the Ratios / My data switch above the numbers section. */
.ij-numbers-switch {
    display: flex;
    margin-bottom: 12px;
}

/* Stock page redesign — "Your position" card at the top of the rail. */
.ij-position-line {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 0;
    border-top: 1px solid var(--ij-divider);
}

.sv-rail-card-title + .ij-position-line {
    border-top: 0;
    padding-top: 4px;
}

.ij-position-where {
    font-size: var(--ij-ts-footnote, 13px);
    color: var(--ij-text-secondary);
}

.ij-position-value {
    font-size: var(--ij-ts-title3, 20px);
    font-weight: 700;
    color: var(--ij-text-primary);
    font-variant-numeric: tabular-nums;
}

.ij-position-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    font-size: var(--ij-ts-footnote, 13px);
    color: var(--ij-text-secondary);
    font-variant-numeric: tabular-nums;
}

.ij-position-pnl {
    font-weight: 600;
}

.ij-position-note {
    margin: 8px 0 0;
    font-size: var(--ij-ts-footnote, 12px);
    color: var(--ij-text-secondary);
}

/* Stock page redesign — thesis meta line, three cells, and parts as rows. */
.ij-thesis-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin: -4px 0 14px;
    font-size: var(--ij-ts-footnote, 13px);
    color: var(--ij-text-secondary);
}

.ij-thesis-cells {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: 16px;
    border: 1px solid var(--ij-divider);
    border-radius: 14px;
    overflow: hidden;
    background: var(--ij-divider);
}

.ij-thesis-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    background: var(--ij-surface);
    min-width: 0;
}

.ij-thesis-cell-label {
    font-size: var(--ij-ts-footnote, 12px);
    color: var(--ij-text-secondary);
}

.ij-thesis-cell-value {
    font-size: var(--ij-ts-headline, 17px);
    font-weight: 700;
    color: var(--ij-text-primary);
    font-variant-numeric: tabular-nums;
}

.ij-thesis-cell-value--undervalued { color: var(--ij-verdict-under); }
.ij-thesis-cell-value--fairlyvalued { color: var(--ij-verdict-fair); }
.ij-thesis-cell-value--overvalued { color: var(--ij-verdict-over); }

.ij-thesis-cell-caption {
    font-size: var(--ij-ts-footnote, 12px);
    color: var(--ij-text-secondary);
}

.ij-thesis-upside .ij-thesis-cell-value {
    color: var(--ij-warning-text);
}

.ij-thesis-upside--down .ij-thesis-cell-value {
    color: var(--ij-loss-text);
}

.ij-thesis-parts {
    border-top: 1px solid var(--ij-divider);
    margin-bottom: 4px;
}

.ij-thesis-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--ij-divider);
}

.ij-thesis-row-label {
    padding-top: 3px;
    font-size: var(--ij-ts-caption1, 11px);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ij-text-secondary);
}

.ij-thesis-case--bull .ij-thesis-row-label { color: var(--ij-gain); }
.ij-thesis-case--bear .ij-thesis-row-label { color: var(--ij-loss-text); }
.ij-thesis-fact--catalysts .ij-thesis-row-label { color: var(--ij-primary-text); }

/* min-width 0: a long unbreakable line inside the prose must scroll in its own
   container, not floor the grid track and widen the page. */
.ij-thesis-row-body {
    min-width: 0;
}

.ij-thesis-row-foot {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 6px;
}

.ij-thesis-row-foot .ij-thesis-more {
    margin-top: 0;
}

.ij-thesis-row-meta {
    font-size: var(--ij-ts-footnote, 12px);
    color: var(--ij-text-secondary);
}

@media (max-width: 600px) {
    .ij-thesis-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }

    /* Three cells stay on one line on a phone (wrapping left an empty grey cell). */
    .ij-thesis-cell {
        padding: 10px 12px;
    }

    .ij-thesis-cell-value {
        font-size: var(--ij-ts-subhead, 15px);
    }
}

/* Stock page redesign — the ratios say when they predate a reported release. */
.ij-ratio-refresh-note {
    margin: 0 0 12px;
    font-size: var(--ij-ts-footnote, 13px);
    font-weight: 600;
    color: var(--ij-warning-text);
}

/* The stock page's by-year ratio tables keep the ratio name readable on a phone;
   the year columns scroll sideways inside the table instead. */
.ij-ratios-table--years .mud-table-body .mud-table-cell:first-child,
.ij-ratios-table--years .mud-table-head .mud-table-cell:first-child {
    min-width: 170px;
}

/* Stock page redesign — "Numbers": one heading with the source switch beside it. */
.ij-numbers-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 10px;
}

.ij-numbers-title {
    margin: 0;
}

/* The canvas year table: one table for the ratios and the growth rates, years oldest
   to newest, TTM last and bold; a value that misses its threshold is tinted. */
.ij-yt-wrap {
    overflow-x: auto;
    border: 1px solid var(--ij-divider);
    border-radius: 14px;
}

.ij-yt {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: var(--ij-ts-subhead, 14px);
    font-variant-numeric: tabular-nums;
}

.ij-yt th,
.ij-yt td {
    padding: 10px 12px;
    text-align: right;
    border-top: 1px solid var(--ij-divider);
    color: var(--ij-text-secondary);
    white-space: nowrap;
}

.ij-yt thead th {
    border-top: 0;
    font-size: var(--ij-ts-footnote, 12px);
    font-weight: 600;
}

.ij-yt .ij-yt-name {
    text-align: left;
    padding-left: 16px;
    font-weight: 500;
    color: var(--ij-text-primary);
    white-space: normal;
    min-width: 150px;
}

.ij-yt thead .ij-yt-name {
    font-weight: 600;
    color: var(--ij-text-secondary);
}

.ij-yt .ij-yt-ttm {
    font-weight: 700;
    color: var(--ij-text-primary);
    padding-right: 16px;
}

/* Option A (threshold colour): the value meets its threshold → green, misses it →
   red. Declared after .ij-yt-ttm so a TTM value keeps its colour as well as its weight. */
.ij-yt .ij-yt-ok {
    color: var(--ij-gain);
}

.ij-yt .ij-yt-miss {
    color: var(--ij-loss-text);
}

.ij-yt-cap {
    display: block;
    margin-top: 2px;
    font-size: var(--ij-ts-caption1, 11.5px);
    font-weight: 400;
    color: var(--ij-text-secondary);
}

.ij-yt-edit {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.ij-yt-edit:hover {
    text-decoration: underline;
}

.ij-yt-edit:focus-visible {
    outline: 2px solid var(--ij-focus-ring);
    outline-offset: 2px;
}

.ij-yt-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* On a phone the year table shows the newest fiscal year and TTM, like the canvas. */
@media (max-width: 600px) {
    .ij-yt {
        min-width: 0;
    }

    .ij-yt .ij-yt-old {
        display: none;
    }
}

/* Stock page actions, option A: the watchlist state in the page header. */
.sv-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.sv-hero-watchlist {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--ij-bg-gray);
    color: var(--ij-text-primary);
    font: inherit;
    font-size: var(--ij-ts-subhead, 14px);
    font-weight: 600;
    cursor: pointer;
}

.sv-hero-watchlist--on {
    background: var(--ij-primary-tint);
    color: var(--ij-primary-text);
}

.sv-hero-watchlist:hover {
    filter: brightness(0.97);
}

@media (max-width: 599.98px) {
    .sv-hero-watchlist {
        min-height: 44px;
    }
}
