/* Scoped styles: inherits the parent application's light/dark theme tokens. */
.tb-builder { text-align: left; }
.tb-builder [hidden] { display: none !important; }
.tb-controls { border: 0; padding: 0; margin: 0; min-width: 0; }
.tb-panel, .tb-results {
    background: linear-gradient(145deg, var(--card-bg), var(--surface));
    border: 1px solid var(--border-soft);
    border-radius: 1rem;
    padding: 1.25rem;
    margin: 1.25rem 0;
    text-align: left;
    overflow-wrap: anywhere;
}
.tb-menu-card { border-top: 4px solid var(--primary); }
.tb-builder h2, .tb-builder h3, .tb-results h3 { color: var(--heading); }
.tb-help { color: var(--muted-text); font-size: .95rem; line-height: 1.55; }
.tb-builder label { display: block; font-weight: 700; margin: .75rem 0 .35rem; }
.tb-builder input, .tb-builder textarea, .tb-builder select {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    font: inherit;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: .65rem;
    padding: .75rem;
}
.tb-builder input[type="file"] { font-size: .9rem; }
.tb-builder textarea { line-height: 1.6; resize: vertical; min-height: 10rem; }
.tb-builder form > .btn { margin-top: 1rem; }
.tb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem 1rem; }
.tb-grid > * { min-width: 0; }
.tb-actions, .tb-section-heading { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.tb-section-heading { justify-content: space-between; }
.tb-actions .btn, .tb-section-heading .btn, .tb-list .btn, .tb-source .btn { width: auto; margin: 0; }
.tb-builder .btn, .tb-results .btn, .tb-source .btn, .tb-actions .btn { min-height: 44px; white-space: normal; }
.tb-list { list-style: none; padding: 0; margin: 0; }
.tb-list-item { display: flex; gap: 1rem; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-soft); padding: 1rem 0; }
.tb-list-item > div { min-width: 0; }
.tb-list-item .tb-help { margin: .3rem 0 0; }
.tb-page { border: 1px solid var(--border-soft); border-radius: .75rem; padding: 1rem; margin: 1rem 0; background: var(--surface-strong); }
.tb-page summary, .tb-results summary { cursor: pointer; font-weight: 700; min-height: 32px; padding: .35rem 0; }
.tb-builder .tb-check { display: flex; gap: .7rem; align-items: flex-start; font-weight: 400; line-height: 1.5; }
.tb-builder .tb-check input { width: 22px; height: 22px; flex: 0 0 22px; margin: 0; accent-color: var(--primary); }
.tb-uncertainty { border-left: 3px solid var(--warning); padding-left: .75rem; white-space: pre-wrap; }
#tb-status { min-height: 1.6em; color: var(--heading); line-height: 1.5; }
#tb-status.tb-error { color: var(--wrong); }
.tb-builder[aria-busy="true"] #tb-status { border-left: 3px solid var(--primary); padding-left: .7rem; }
.tb-builder :disabled, .tb-actions :disabled { opacity: .6; cursor: not-allowed; }
.tb-builder :focus-visible, .tb-results :focus-visible, .tb-source :focus-visible, .tb-actions :focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.tb-source { margin: .6rem 0; font-size: .9rem; overflow-wrap: anywhere; }
.tb-source blockquote { margin: .6rem 0; padding: .5rem .9rem; border-left: 3px solid var(--border-soft); color: var(--muted-text); white-space: pre-wrap; }
.tb-results details { margin-top: 1rem; }
@media (max-width: 560px) {
    .tb-grid { grid-template-columns: 1fr; }
    .tb-panel, .tb-results { padding: .85rem; }
    .tb-list-item { align-items: stretch; flex-direction: column; gap: .5rem; }
    .tb-actions { align-items: stretch; flex-direction: column; }
    .tb-actions .btn, .tb-list-item .btn { width: 100%; }
    .tb-page { padding: .7rem; }
}
