.stock-m-scene {
    --stock-m-ink: #233b32;
    --stock-m-muted: #4b6256;
    --stock-m-line: #bdcbb7;
    --stock-m-paper: #fffdf7;
    --stock-m-cash: #357258;
    --stock-m-green: #dfefd9;
    --stock-m-price: #9c512a;
    --stock-m-warm: #f5e0c7;
    padding: clamp(10px, 2vw, 22px);
    color: var(--stock-m-ink);
}

.stock-m-content {
    display: grid;
    gap: 9px;
    width: min(100%, 744px);
    min-width: 0;
    font-variant-numeric: tabular-nums;
}

.stock-m-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 10px;
    font-size: clamp(13px, 1.8vw, 16px);
}

.stock-m-head > span, .stock-m-note {
    color: var(--stock-m-muted);
    font-size: clamp(11px, 1.65vw, 13px);
    line-height: 1.45;
}

.stock-m-note { margin: 0; }
.stock-m-tag {
    border-radius: 999px;
    background: var(--stock-m-green);
    padding: 2px 7px;
    font-weight: 730;
}
.stock-m-tag.is-assumption { background: var(--stock-m-warm); color: #734625; }

.stock-m-chain {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.stock-m-chain > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2px 8px;
    min-width: 0;
    border-radius: 7px;
    background: #e4eddf;
    padding: 7px 9px;
    font-size: clamp(11px, 1.7vw, 14px);
}

.stock-m-chain span { color: var(--stock-m-muted); }
.stock-m-bridge, .stock-m-quote, .stock-m-assumption-cards {
    display: grid;
    gap: clamp(3px, 1.3vw, 9px);
    align-items: stretch;
}
.stock-m-bridge { grid-template-columns: repeat(3, minmax(0, 1fr) auto) minmax(0, 1fr); }
.stock-m-quote { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); }
.stock-m-assumption-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stock-m-op {
    align-self: center;
    font-weight: 750;
    font-style: normal;
    font-size: clamp(13px, 2.2vw, 19px);
}
.stock-m-tile, .stock-m-input, .stock-m-row {
    min-width: 0;
    border: 1px solid var(--stock-m-line);
    border-radius: 8px;
    background: var(--stock-m-paper);
}
.stock-m-tile {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 4px;
    padding: clamp(6px, 1.5vw, 12px) 3px;
    text-align: center;
    animation: stock-m-enter .35s ease-out both;
}
.stock-m-tile:nth-of-type(2) { animation-delay: .08s; }
.stock-m-tile:nth-of-type(3) { animation-delay: .16s; }
.stock-m-tile:nth-of-type(4) { animation-delay: .24s; }
.stock-m-tile.is-result, .stock-m-result {
    background: var(--stock-m-green);
    border-color: #87a68d;
}
.stock-m-tile > span {
    color: var(--stock-m-muted);
    font-size: clamp(10px, 1.65vw, 13px);
    line-height: 1.3;
}
.stock-m-tile > strong {
    font-size: clamp(12px, 2.2vw, 20px);
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.stock-m-ledger { display: grid; gap: 4px; }
.stock-m-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 2px 8px;
    padding: 5px 8px;
    font-size: clamp(12px, 1.75vw, 14px);
    animation: stock-m-enter .35s ease-out both;
}
.stock-m-row:nth-child(2) { animation-delay: .07s; }
.stock-m-row:nth-child(3) { animation-delay: .14s; }
.stock-m-row:nth-child(4) { animation-delay: .21s; }
.stock-m-result {
    display: grid;
    justify-items: center;
    gap: 3px;
    border: 1px solid #a3b8a5;
    border-radius: 8px;
    padding: 7px;
    text-align: center;
    animation: stock-m-enter .4s .2s ease-out both;
}
.stock-m-result span { color: var(--stock-m-muted); font-size: 12px; }
.stock-m-result strong { font-size: clamp(14px, 2.1vw, 18px); }

.stock-m-sources {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 11px;
    font-size: 12px;
}
.stock-m-sources a {
    color: #285d45;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.stock-m-sources a:hover { color: #172f23; }

.stock-m-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}
.stock-m-input {
    display: grid;
    gap: 3px;
    align-items: start;
    padding: 6px 8px 4px;
}
.stock-m-input > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1px 5px;
    color: var(--stock-m-muted);
    font-size: clamp(11px, 1.65vw, 13px);
}
.stock-m-input output { font-weight: 780; color: var(--stock-m-ink); }
.stock-m-input input {
    min-width: 0;
    width: 100%;
    min-height: 24px;
    margin: 0;
    accent-color: var(--stock-m-cash);
    cursor: pointer;
}
.stock-m-basis {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 10px;
    margin: 0;
    color: var(--stock-m-muted);
    font-size: clamp(11px, 1.65vw, 13px);
}
.stock-m-basis b { color: var(--stock-m-ink); }
.stock-m-bar {
    display: grid;
    grid-template-columns: minmax(55px, 5em) minmax(0, 1fr) minmax(72px, auto);
    align-items: center;
    gap: 6px;
    font-size: clamp(11px, 1.75vw, 14px);
}
.stock-m-bar + .stock-m-bar { margin-top: 4px; }
.stock-m-bar b { text-align: end; }
.stock-m-track {
    display: block;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #dbdbcc;
}
.stock-m-track > i {
    display: block;
    width: var(--stock-m-width);
    height: 100%;
    border-radius: inherit;
    background: var(--stock-m-cash);
    animation: stock-m-fill .4s ease-out both;
    transition: width .22s ease-out;
}
.stock-m-track .is-price { background: var(--stock-m-price); }
.stock-m-outcome {
    margin: 0;
    border-radius: 6px;
    padding: 6px 8px;
    background: var(--stock-m-green);
    font-size: clamp(12px, 1.85vw, 15px);
    font-weight: 720;
}
.stock-m-outcome[data-state="low"], .stock-m-outcome[data-state="invalid"] { background: var(--stock-m-warm); }
.stock-m-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 8px;
}
.stock-m-actions button {
    min-height: 33px;
    padding: 4px 8px;
    border: 1px solid var(--stock-m-line);
    border-radius: 6px;
    background: var(--stock-m-paper);
    color: var(--stock-m-ink);
    font: inherit;
    font-size: 12px;
    font-weight: 720;
    cursor: pointer;
}
.stock-m-actions button:hover { background: var(--stock-m-green); }

.stock-m-review {
    border-top: 1px solid var(--stock-m-line);
    padding-top: 5px;
    font-size: clamp(11px, 1.65vw, 13px);
}
.stock-m-review > summary { width: fit-content; cursor: pointer; font-weight: 720; }
.stock-m-review > summary:focus-visible { outline: 2px solid var(--stock-m-cash); outline-offset: 2px; }
.stock-m-review table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.stock-m-review :is(th, td) {
    border-bottom: 1px solid var(--stock-m-line);
    padding: 4px 4px;
    text-align: end;
}
.stock-m-review th:first-child { text-align: start; }
.stock-m-review p, .stock-m-review nav { margin-top: 5px; }

@keyframes stock-m-enter {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes stock-m-fill {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0); }
}

@media (max-width: 420px) {
    .stock-m-content { gap: 7px; }
    .stock-m-chain > div { padding: 5px 6px; }
    .stock-m-input { padding: 5px 5px 3px; }
}
@media (prefers-reduced-motion: reduce) {
    .stock-m-scene * { animation: none !important; transition: none !important; }
}

