/* Trellis Admin — app-level styles layered on top of tokens.css + console.css */

/* Full-viewport pages (e.g. Playground) — override base.html main constraints. */
main.app-full-bleed {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Settings cockpit ----------------------------------------- */
.settings-page {
    max-width: 1280px;
}

.settings-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: end;
    margin-bottom: 18px;
}

.settings-hero-main h1 {
    margin: 4px 0 0;
    font-size: 28px;
    letter-spacing: 0;
}

.settings-hero-main p {
    max-width: 760px;
    margin: 8px 0 0;
    color: var(--fg-3);
    font: 13px/1.5 var(--font-sans);
}

.settings-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.settings-command {
    display: inline-flex;
    max-width: 360px;
    overflow-wrap: anywhere;
    border: 1px solid var(--border-1);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--fg-2);
    padding: 6px 8px;
    font: 11px/1.35 var(--font-mono);
}

.settings-readiness-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.settings-readiness-card {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    min-width: 0;
    min-height: 92px;
    padding: 14px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface);
}

.settings-readiness-card span,
.settings-mini-stat span {
    display: block;
    color: var(--fg-4);
    font: 600 10px/1.2 var(--font-sans);
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.settings-readiness-card strong {
    display: block;
    min-width: 0;
    margin-top: 5px;
    color: var(--fg-1);
    font: 650 18px/1.1 var(--font-sans);
    overflow-wrap: anywhere;
}

.settings-readiness-card p {
    margin: 6px 0 0;
    color: var(--fg-3);
    font: 12px/1.35 var(--font-sans);
}

.settings-card-icon,
.settings-route-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-1);
    border-radius: 7px;
    background: var(--bg-surface-2);
    color: var(--fg-3);
}

.settings-readiness-card.is-ready .settings-card-icon {
    color: var(--status-success-fg);
    background: var(--status-success-tint);
}

.settings-readiness-card.is-warning .settings-card-icon {
    color: var(--status-warning-fg);
    background: var(--status-warning-tint);
}

.settings-readiness-card.is-info .settings-card-icon {
    color: var(--status-info-fg);
    background: var(--status-info-tint);
}

.settings-tabs {
    position: sticky;
    top: 0;
    z-index: 9;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 18px;
    padding: 6px;
    overflow-x: auto;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-base) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.settings-tabs button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--fg-3);
    cursor: pointer;
    font: 600 12px/1 var(--font-sans);
    padding: 8px 11px;
}

.settings-tabs button:hover {
    background: var(--bg-surface-2);
    color: var(--fg-1);
}

.settings-tabs button.is-active {
    border-color: rgba(18, 141, 139, 0.34);
    background: var(--brand-teal-tint);
    color: var(--accent-tag-fg);
}

.settings-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.16);
    color: var(--status-warning-fg);
    font: 600 10.5px/1 var(--font-mono);
}

.settings-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.settings-panel-head h2 {
    margin: 0;
    color: var(--fg-1);
    font: 650 18px/1.25 var(--font-sans);
    letter-spacing: 0;
}

.settings-panel-head p,
.settings-card-head p,
.settings-card-block > p {
    max-width: 760px;
    margin: 5px 0 0;
    color: var(--fg-3);
    font: 12.5px/1.45 var(--font-sans);
}

.settings-overview-layout,
.settings-artifact-layout,
.settings-runtime-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
    gap: 16px;
    align-items: start;
}

.settings-card-block {
    padding: 20px;
}

.settings-card-block h3,
.settings-card-head h3 {
    margin: 0;
    color: var(--fg-1);
    font: 650 16px/1.25 var(--font-sans);
    letter-spacing: 0;
}

.settings-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
}

.settings-health-list {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin-top: 16px;
}

.settings-route-stack,
.settings-side-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-route-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 70px;
    padding: 12px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface);
    color: inherit;
    text-decoration: none;
}

.settings-route-card:hover {
    border-color: var(--border-2);
    background: var(--bg-surface-2);
}

.settings-route-card strong {
    display: block;
    color: var(--fg-1);
    font: 650 13px/1.25 var(--font-sans);
}

.settings-route-card small {
    display: block;
    margin-top: 3px;
    color: var(--fg-3);
    font: 12px/1.35 var(--font-sans);
    overflow-wrap: anywhere;
}

.settings-provider-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.settings-provider-summary.is-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 16px;
}

.settings-mini-stat {
    min-width: 0;
    min-height: 70px;
    padding: 12px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface);
}

.settings-mini-stat strong {
    display: block;
    margin-top: 7px;
    color: var(--fg-1);
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.settings-attention-card {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(245, 158, 11, 0.32);
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.06);
}

.settings-attention-card.is-inline {
    display: block;
    margin-top: 12px;
    color: var(--status-warning-fg);
    font: 12.5px/1.4 var(--font-sans);
}

.settings-attention-body h3 {
    margin: 0;
    color: var(--fg-1);
    font: 650 14px/1.25 var(--font-sans);
}

.settings-attention-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.settings-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.settings-provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 16px;
    align-items: start;
}

.settings-provider-card {
    padding: 20px;
}

.settings-provider-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.settings-provider-card-head h3 {
    margin: 0;
    color: var(--fg-1);
    font: 650 16px/1.25 var(--font-sans);
}

.settings-provider-card-head p {
    margin: 6px 0 0;
    color: var(--fg-3);
    font: 12.5px/1.45 var(--font-sans);
}

.settings-secret-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.settings-secret-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface-2);
}

.settings-secret-meta {
    min-width: 0;
}

.settings-secret-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    margin: 0;
}

.settings-subsection {
    margin-top: 20px;
}

.settings-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.settings-probe-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.settings-probe-result {
    flex: 1 1 260px;
}

.settings-kv {
    grid-template-columns: 110px minmax(0, 1fr);
    margin-top: 14px;
}

.settings-kv .mono {
    overflow-wrap: anywhere;
}

.settings-kv .trl-dot {
    margin-right: 6px;
}

.settings-command-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.settings-command-stack code,
.settings-pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.settings-pre {
    margin-top: 14px;
}

.settings-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 180px;
    padding: 32px;
    text-align: center;
    color: var(--fg-3);
}

.settings-empty p {
    margin: 0;
    font-size: var(--text-sm);
}

@media (max-width: 1080px) {
    .settings-hero,
    .settings-overview-layout,
    .settings-artifact-layout,
    .settings-runtime-layout {
        grid-template-columns: 1fr;
    }

    .settings-hero-actions {
        justify-content: flex-start;
    }

    .settings-readiness-grid,
    .settings-provider-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .settings-page {
        padding-bottom: 88px;
    }

    .settings-hero {
        gap: 14px;
        margin-bottom: 14px;
    }

    .settings-hero-main h1 {
        font-size: 24px;
    }

    .settings-command {
        width: 100%;
        max-width: none;
    }

    .settings-readiness-grid,
    .settings-provider-summary,
    .settings-provider-summary.is-compact,
    .settings-check-grid {
        grid-template-columns: 1fr;
    }

    .settings-readiness-card {
        min-height: 78px;
    }

    .settings-tabs {
        margin-inline: -4px;
        border-radius: 7px;
    }

    .settings-tabs button {
        min-height: 32px;
        padding: 7px 9px;
        font-size: 11.5px;
    }

    .settings-panel-head,
    .settings-provider-card-head,
    .settings-card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .settings-card-block,
    .settings-provider-card {
        padding: 16px;
    }

    .settings-secret-form {
        grid-template-columns: 1fr;
    }

    .settings-secret-form .trl-btn {
        justify-content: center;
        width: 100%;
    }

    .settings-kv {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* App detail tabs ----------------------------------------- */
.appD-tabs {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.appD-tabbar {
    display: flex;
    gap: 6px;
    align-items: center;
    overflow-x: auto;
    padding: 4px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface);
}

.appD-tabbar button {
    min-width: 0;
    flex: 0 0 auto;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--fg-3);
    cursor: pointer;
    font: 600 12px/1 var(--font-sans);
    padding: 9px 12px;
}

.appD-tabbar button:hover {
    background: var(--bg-surface-2);
    color: var(--fg-1);
}

.appD-tabbar button.is-active {
    border-color: rgba(18, 141, 139, 0.34);
    background: var(--brand-teal-tint);
    color: var(--accent-tag-fg);
}

.appD-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.appD-panel-secondary {
    margin-top: -4px;
}

.appD-panel .appI-status-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1120px) {
    .appD-panel .appI-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .appD-tabbar {
        gap: 4px;
        padding: 3px;
    }

    .appD-tabbar button {
        padding: 8px 10px;
        font-size: 11.5px;
    }

    .appD-panel .appI-status-grid {
        grid-template-columns: 1fr;
    }
}

/* App integrations cockpit -------------------------------- */
.appI-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.appI-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.appI-head h3,
.appI-workflow-card h4 {
    margin: 0;
}

.appI-head p,
.appI-workflow-card p,
.appI-helper {
    margin: 4px 0 0;
    color: var(--fg-3);
    font: 12.5px/1.45 var(--font-sans);
}

.appI-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.appI-setup-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.appI-setup-grid.is-secondary {
    margin-top: 2px;
}

.appI-setup-grid.is-recipes {
    grid-template-columns: repeat(2, minmax(360px, 1fr));
}

.appI-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-top: 4px;
    padding-top: 4px;
}

.appI-section-head h4 {
    margin: 4px 0 0;
    color: var(--fg-1);
    font: 650 16px/1.25 var(--font-sans);
}

.appI-section-head p {
    margin: 4px 0 0;
    max-width: 620px;
    color: var(--fg-3);
    font: 12.5px/1.45 var(--font-sans);
}

.appI-provider-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.appI-provider-strip span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid var(--border-1);
    border-radius: 999px;
    background: var(--bg-surface-2);
    color: var(--fg-3);
    font: 600 11px/1 var(--font-sans);
}

.appI-provider-strip span.is-ready {
    border-color: rgba(34, 197, 94, 0.24);
    background: rgba(34, 197, 94, 0.08);
    color: var(--status-success);
}

.appI-provider-strip span.is-missing {
    border-color: rgba(148, 163, 184, 0.22);
}

.appI-setup-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface-2);
}

.appI-setup-card.is-compact {
    background: var(--bg-surface);
}

.appI-setup-card-head {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
}

.appI-setup-card-head h4 {
    margin: 0;
    color: var(--fg-1);
    font: 650 14px/1.25 var(--font-sans);
}

.appI-setup-card-head p {
    margin: 4px 0 0;
    color: var(--fg-3);
    font: 12px/1.4 var(--font-sans);
}

.appI-setup-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-1);
    border-radius: 7px;
    background: var(--bg-base);
    color: var(--accent);
}

.appI-checklist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.appI-checklist li {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    min-width: 0;
    padding: 9px;
    border: 1px solid var(--border-subtle);
    border-radius: 7px;
    background: var(--bg-base);
}

.appI-checklist li > span {
    width: 8px;
    height: 8px;
    margin: 5px auto 0;
    border-radius: 999px;
    background: var(--zinc-500);
}

.appI-checklist li.is-done > span {
    background: var(--status-success);
}

.appI-checklist li.is-warning > span {
    background: var(--status-warning);
}

.appI-checklist li.is-pending > span {
    background: var(--status-neutral-fg);
}

.appI-recipe-flow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
    padding: 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--bg-base);
}

.appI-recipe-flow > div {
    min-width: 0;
    padding: 8px;
    border-left: 2px solid var(--border-1);
}

.appI-recipe-flow > div.is-done {
    border-left-color: var(--status-success);
}

.appI-recipe-flow > div.is-warning {
    border-left-color: var(--status-warning);
}

.appI-recipe-flow > div.is-pending {
    border-left-color: var(--status-neutral-fg);
}

.appI-recipe-flow span {
    display: block;
    margin-bottom: 5px;
    color: var(--fg-4);
    font: 700 10px/1 var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.appI-recipe-flow strong {
    display: block;
    overflow: hidden;
    color: var(--fg-1);
    font: 600 11.5px/1.25 var(--font-sans);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appI-checklist strong {
    display: block;
    color: var(--fg-1);
    font: 600 12.5px/1.25 var(--font-sans);
}

.appI-checklist small {
    display: block;
    margin-top: 3px;
    color: var(--fg-3);
    font: 11.5px/1.35 var(--font-sans);
    overflow-wrap: anywhere;
}

.appI-status-card {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface-2);
}

.appI-status-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.appI-status-title {
    color: var(--fg-2);
    font: 600 12px/1.2 var(--font-sans);
}

.appI-status-detail {
    margin-top: 8px;
    color: var(--fg-3);
    font: 12px/1.4 var(--font-sans);
    word-break: break-word;
}

.appI-workflow-card {
    padding: 12px;
    border: 1px solid rgba(18, 141, 139, 0.26);
    border-radius: 8px;
    background: linear-gradient(180deg, var(--bg-surface-2), var(--bg-surface));
}

.appI-workflow-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.appI-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.appI-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 4px 7px;
    border: 1px solid var(--border-1);
    border-radius: 999px;
    background: var(--bg-base);
    color: var(--fg-2);
    font: 11px/1.2 var(--font-mono);
}

.appI-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.appI-test-result {
    margin-top: 10px;
}

.appI-test-result > div,
.appI-test-result .is-success,
.appI-test-result .is-error {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 9px 10px;
    border-radius: 7px;
    font: 12px/1.35 var(--font-sans);
    overflow-wrap: anywhere;
}

.appI-test-result .is-success {
    border: 1px solid rgba(34, 197, 94, 0.24);
    background: rgba(34, 197, 94, 0.08);
    color: var(--status-success-fg);
}

.appI-test-result .is-error {
    border: 1px solid rgba(239, 68, 68, 0.24);
    background: rgba(239, 68, 68, 0.08);
    color: var(--status-danger-fg);
}

.appI-url-list {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}

.appI-url-list summary {
    cursor: pointer;
    color: var(--fg-2);
    font: 600 12px/1.3 var(--font-sans);
}

.appI-url-list .appI-detail-list {
    margin-top: 10px;
    padding-top: 10px;
}

.appI-url-list .appI-detail-row {
    grid-template-columns: 96px minmax(0, 1fr);
}

.appI-url-list .mono,
.appI-detail-row .mono {
    overflow-wrap: anywhere;
}

.appI-failure-list {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid rgba(245, 158, 11, 0.24);
    border-radius: 7px;
    background: rgba(245, 158, 11, 0.06);
}

.appI-failure-list ul {
    margin: 8px 0 0 18px;
    padding: 0;
    color: var(--fg-3);
    font-size: var(--text-xs);
}

.appI-repo-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.appI-repo-summary span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    padding: 3px 7px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    background: var(--bg-base);
    color: var(--fg-3);
    font: 11px/1.2 var(--font-sans);
}

.appI-repo-summary strong {
    color: var(--fg-1);
    font-family: var(--font-mono);
}

.appI-smoke-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 96px auto;
    gap: 8px;
    align-items: end;
    margin-top: 12px;
}

.appI-detail-list {
    display: grid;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.appI-detail-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
    font-size: 11.5px;
}

.appI-detail-row span:first-child {
    color: var(--fg-4);
}

.appI-detail-row span:last-child {
    color: var(--fg-2);
}

.appI-delivery-list {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.appI-delivery-row {
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr) minmax(120px, 1.4fr) minmax(150px, 1fr);
    gap: 8px;
    align-items: center;
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: var(--bg-base);
    color: var(--fg-3);
    font-size: 11.5px;
}

.appI-delivery-row > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.appI-builder {
    width: min(980px, calc(100vw - 48px));
}

.docA-modal-panel.appI-builder {
    width: min(980px, calc(100vw - 48px));
}

.appI-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

.appI-form-grid > .is-wide,
.appI-repo-picker,
.appI-selected-repos,
.appI-toggle-grid,
.appI-review {
    grid-column: 1 / -1;
}

.appI-form-grid label > span,
.appI-field-label {
    display: block;
    margin-bottom: 6px;
    color: var(--fg-3);
    font: 600 11px/1 var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.appI-decision-panel {
    display: grid;
    gap: 12px;
}

.appI-decision-head {
    min-width: 0;
}

.appI-decision-head h4 {
    margin: 3px 0 0;
    color: var(--fg-1);
    font: 650 16px/1.25 var(--font-sans);
}

.appI-decision-head p {
    margin: 5px 0 0;
    color: var(--fg-3);
    font: 12.5px/1.45 var(--font-sans);
}

.appI-provider-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.appI-provider-cards > div {
    display: grid;
    gap: 7px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface-2);
}

.appI-provider-cards > div.is-ready {
    border-color: rgba(34, 197, 94, 0.24);
    background: rgba(34, 197, 94, 0.07);
}

.appI-provider-cards > div.is-warning {
    border-color: rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.07);
}

.appI-provider-cards strong {
    color: var(--fg-1);
    font: 650 13px/1.2 var(--font-sans);
}

.appI-provider-cards span {
    color: var(--fg-3);
    font: 12px/1.4 var(--font-sans);
}

.appI-provider-cards a {
    justify-self: start;
    color: var(--accent);
    font: 600 12px/1.2 var(--font-sans);
    text-decoration: none;
}

.appI-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.appI-toggle {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    min-width: 0;
    padding: 9px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface-2);
    color: var(--fg-2);
    font: 12px/1.35 var(--font-sans);
}

.appI-toggle input {
    margin-top: 1px;
}

.appI-toggle.is-active {
    border-color: rgba(18, 141, 139, 0.32);
    background: rgba(18, 141, 139, 0.08);
}

.appI-repo-picker {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 12px;
}

.appI-repo-panel {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface-2);
}

.appI-repo-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.appI-repo-list,
.appI-selected-list {
    display: grid;
    gap: 6px;
    max-height: 280px;
    overflow: auto;
}

.appI-repo-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-1);
    border-radius: 6px;
    background: var(--bg-base);
    color: var(--fg-1);
    text-align: left;
}

.appI-repo-row:hover {
    border-color: var(--border-2);
    background: var(--bg-surface-3);
}

.appI-repo-main {
    min-width: 0;
}

.appI-repo-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 12px/1.25 var(--font-mono);
}

.appI-repo-meta {
    margin-top: 3px;
    color: var(--fg-4);
    font: 11px/1.2 var(--font-sans);
}

.appI-empty {
    padding: 12px;
    border: 1px dashed var(--border-1);
    border-radius: 8px;
    color: var(--fg-4);
    font: 12px/1.45 var(--font-sans);
}

.appI-manual-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 8px;
}

.appI-review {
    display: grid;
    gap: 10px;
}

.appI-review-card {
    padding: 10px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface-2);
}

.appI-review-card h5 {
    margin: 0 0 6px;
    color: var(--fg-2);
    font: 600 12px/1.2 var(--font-sans);
}

.appI-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-1);
}

@media (max-width: 860px) {
    .appI-status-grid,
    .appI-setup-grid,
    .appI-repo-picker,
    .appI-form-grid,
    .appI-toggle-grid,
    .appI-smoke-form {
        grid-template-columns: 1fr;
    }

    .appI-section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .appI-provider-strip {
        justify-content: flex-start;
    }

    .appI-recipe-flow,
    .appI-provider-cards {
        grid-template-columns: 1fr;
    }

    .appI-setup-card-head {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .appI-setup-card-head > .trl-badge {
        grid-column: 2;
        justify-self: start;
    }

    .appI-builder {
        width: min(720px, calc(100vw - 32px));
    }

    .appI-delivery-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Task detail document view -------------------------------- */
.docA-pageheader.taskD-pageheader .right form {
    margin: 0;
}

.docA-pageheader.taskD-pageheader .right .trl-btn-md {
    min-height: 28px;
    padding: 5px 9px;
    font-size: 12px;
}

.docA-shell.taskD-shell {
    grid-template-columns: 220px minmax(0, 860px) 180px;
    max-width: 1380px;
    gap: 32px;
}

.docA-article.taskD-article {
    max-width: none;
}

.taskD-meta-rail dd {
    overflow-wrap: anywhere;
}

.taskD-rail-link {
    color: var(--fg-1);
    text-decoration: none;
}

.taskD-rail-link:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.taskD-accent {
    color: var(--accent) !important;
}

.taskD-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: 12px/1.4 var(--font-mono);
    color: var(--fg-2);
}

.taskD-status.is-completed { color: var(--status-success-fg); }
.taskD-status.is-failed { color: var(--status-danger-fg); }
.taskD-status.is-cancelled,
.taskD-status.is-replaced { color: var(--fg-4); }
.taskD-status.is-running,
.taskD-status.is-executing,
.taskD-status.is-queued { color: var(--status-info-fg); }

.taskD-copy-link {
    display: inline;
    margin-left: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: 11px/1 var(--font-sans);
    cursor: pointer;
}

.taskD-copy-link:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.taskD-hero {
    border-bottom: 1px solid var(--border-1);
    padding-bottom: 24px;
}

.taskD-hero code {
    font: 12px/1 var(--font-mono);
    color: var(--fg-1);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-1);
    border-radius: 3px;
    padding: 1px 5px;
}

.taskD-stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--border-1);
    margin-top: 18px;
}

.taskD-stat-grid > div {
    min-width: 0;
    background: var(--bg-surface);
    padding: 11px 12px;
}

.taskD-stat-grid span {
    display: block;
    color: var(--fg-4);
    font: 500 10px/1 var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.taskD-stat-grid strong {
    display: block;
    color: var(--fg-1);
    font: 600 14px/1.2 var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.taskD-section {
    scroll-margin-top: 88px;
}

.taskD-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.taskD-section-head .docA-h2 {
    flex: 1;
}

.taskD-section-head > span {
    color: var(--fg-4);
    font: 12px/1 var(--font-mono);
}

.taskD-prose-block {
    width: 100%;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--border-1);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--fg-2);
    font: 12.5px/1.65 var(--font-mono);
    white-space: pre-wrap;
    overflow-x: auto;
}

.taskD-prose-block.is-result {
    background: var(--bg-surface-2);
    color: var(--fg-1);
    font-family: var(--font-sans);
    font-size: 14px;
}

.taskD-callout {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    padding: 14px;
    background: var(--bg-surface);
}

.taskD-callout.is-danger {
    border-color: rgba(239, 68, 68, 0.32);
    background: var(--status-danger-tint);
}

.taskD-callout-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    color: var(--status-danger-fg);
    background: rgba(239, 68, 68, 0.12);
}

.taskD-callout pre {
    margin: 0;
    color: var(--status-danger-fg);
    font: 12.5px/1.6 var(--font-mono);
    white-space: pre-wrap;
    overflow-x: auto;
}

.taskD-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.taskD-file-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface);
    padding: 12px;
}

.taskD-file-preview {
    display: block;
    overflow: hidden;
    border: 1px solid var(--border-1);
    border-radius: 6px;
    background: var(--bg-surface-2);
}

.taskD-file-preview img {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    background: var(--bg-surface-2);
}

.taskD-file-missing {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-1);
    border-radius: 6px;
    background: var(--bg-surface-2);
    color: var(--fg-4);
    font-size: 13px;
}

.taskD-file-title,
.taskD-artifact-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.taskD-file-title > div,
.taskD-artifact-title > div:last-child {
    min-width: 0;
    flex: 1;
}

.taskD-file-title p,
.taskD-artifact-title p {
    margin: 0;
    color: var(--fg-1);
    font: 500 13px/1.35 var(--font-sans);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.taskD-file-title small,
.taskD-artifact-title small {
    display: block;
    margin-top: 4px;
    color: var(--fg-4);
    font: 11px/1.35 var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.taskD-file-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--fg-4);
    font: 11px/1.4 var(--font-mono);
    min-width: 0;
}

.taskD-file-meta > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.taskD-file-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.taskD-artifacts-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.taskD-artifact-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.taskD-artifact-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border: 1px solid var(--border-1);
    border-radius: 6px;
    color: var(--accent);
    background: var(--bg-surface-2);
}

.taskD-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.taskD-preview-card {
    overflow: hidden;
    min-height: 520px;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface);
}

.taskD-preview-head {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-1);
    background: var(--bg-surface-2);
}

.taskD-preview-head span {
    min-width: 0;
    color: var(--fg-3);
    font: 11px/1 var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.taskD-preview-head .trl-link {
    flex: 0 0 auto;
    font-size: 11px;
}

.taskD-preview-card iframe {
    display: block;
    width: 100%;
    height: min(72vh, 720px);
    border: 0;
    background: var(--bg-base);
}

.taskD-conversation {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 16px;
}

.taskD-conversation::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: var(--border-1);
}

.taskD-conversation-row {
    position: relative;
    min-width: 0;
}

.taskD-conversation-row > a,
.taskD-conversation-row > div {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    text-decoration: none;
}

.taskD-conversation-row.is-current > div {
    border: 1px solid rgba(18, 141, 139, 0.32);
    background: var(--accent-tint);
}

.taskD-conversation-row p {
    margin: 0;
    color: var(--fg-1);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.taskD-conversation-row small {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    color: var(--fg-4);
    font: 11px/1.4 var(--font-mono);
}

.taskD-conversation-dot {
    position: absolute;
    left: -17px;
    top: 18px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--fg-4);
}

.taskD-conversation-dot.is-completed { background: var(--status-success); }
.taskD-conversation-dot.is-failed { background: var(--status-danger); }
.taskD-conversation-dot.is-running,
.taskD-conversation-dot.is-executing { background: var(--status-info); }

.taskD-show-more {
    width: max-content;
    max-width: 100%;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 12px;
    cursor: pointer;
}

.taskD-live-log {
    max-height: 32rem;
    overflow-y: auto;
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface-2);
    padding: 14px;
}

.taskD-live-log p {
    margin: 0;
    color: var(--fg-4);
    font: 12px/1.6 var(--font-mono);
}

.taskD-trace-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.taskD-trace-card {
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface);
    padding: 10px 14px;
}

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

.taskD-trace-head > div {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.taskD-trace-head time,
.taskD-tool-name {
    color: var(--fg-4);
    font: 11px/1.4 var(--font-mono);
}

.taskD-trace-head time {
    flex: 0 0 auto;
}

.taskD-trace-card summary {
    color: var(--fg-3);
    font-size: 12px;
    cursor: pointer;
}

.taskD-trace-card details .taskD-prose-block {
    margin-top: 8px;
}

.taskD-eval-card {
    border: 1px solid var(--border-1);
    border-radius: 8px;
    background: var(--bg-surface);
    padding: 18px;
}

.taskD-eval-card p {
    margin: 0 0 14px;
    color: var(--fg-3);
    font-size: 13px;
    line-height: 1.5;
}

.taskD-eval-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.taskD-eval-form label > span {
    display: block;
    margin-bottom: 6px;
    color: var(--fg-4);
    font: 500 10px/1 var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.taskD-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.taskD-checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fg-2);
    font-size: 13px;
}

.taskD-checkline input {
    flex: 0 0 auto;
}

.taskD-empty {
    color: var(--fg-4) !important;
}

@media (max-width: 1100px) {
    .docA-shell.taskD-shell {
        grid-template-columns: 200px minmax(0, 1fr);
        gap: 32px;
    }
}

@media (max-width: 860px) {
    .taskD-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .taskD-stat-grid > div:last-child {
        grid-column: 1 / -1;
    }

    .taskD-artifacts-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .docA-shell.taskD-shell {
        grid-template-columns: 1fr;
        padding: 20px 16px 64px;
        gap: 24px;
    }

    .taskD-stat-grid {
        grid-template-columns: 1fr;
    }

    .taskD-stat-grid > div:last-child {
        grid-column: auto;
    }

    .taskD-file-meta,
    .taskD-trace-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .taskD-file-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Log container — smooth scroll + bottom-anchored autoscroll */
.log-container { scroll-behavior: smooth; }
.log-container[data-autoscroll="true"] { overflow-anchor: auto; }

/* SSE message fade-in (design: one-shot 250ms fade + 4px translate) */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.event-enter { animation: fadeIn 250ms var(--ease-out); }

/* Three-dot opacity pulse for streaming assistant text. No rotation. */
@keyframes pulse {
    0%, 80%, 100% { opacity: 0.3; }
    40%           { opacity: 1; }
}
.thinking-dot            { animation: pulse 1.4s infinite ease-in-out; background: var(--fg-3); }
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

@media (prefers-reduced-motion: reduce) {
    .event-enter,
    .thinking-dot { animation: none !important; }
}

/* ================================================================
   Status badges — semantic colors, token-driven.
   Used by tasks, dashboard, triggers. Pair with .trl-badge base class.
   ================================================================ */
.badge-running,
.badge-plan_submitted,
.badge-executing { background: var(--status-info-tint);    color: var(--status-info-fg); }

.badge-completed { background: var(--status-success-tint); color: var(--status-success-fg); }
.badge-failed,
.badge-error     { background: var(--status-danger-tint);  color: var(--status-danger-fg); }
.badge-cancelled,
.badge-replaced  { background: var(--status-warning-tint); color: var(--status-warning-fg); }
.badge-pending,
.badge-queued    { background: var(--status-neutral-tint); color: var(--status-neutral-fg); }

/* Shared badge geometry (used where templates don't use .trl-badge directly). */
.status-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 7px; border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
    line-height: 1.4;
}

/* Compact field-label help tooltip. */
.trl-field-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.trl-help-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--fg-4);
    cursor: help;
}

.trl-help-tip:hover,
.trl-help-tip:focus-visible {
    color: var(--fg-1);
    outline: none;
}

.trl-help-tip svg {
    width: 13px;
    height: 13px;
}

.trl-help-tip::after {
    content: attr(data-tip);
    position: absolute;
    z-index: 30;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(2px);
    width: min(260px, calc(100vw - 48px));
    padding: 8px 10px;
    border: 1px solid var(--border-1);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--fg-2);
    box-shadow: var(--shadow-lg, 0 12px 30px rgba(0,0,0,.22));
    font: 12px/1.45 var(--font-sans);
    letter-spacing: 0;
    text-transform: none;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity var(--dur-fast, 120ms),
        transform var(--dur-fast, 120ms);
    transition-delay: 0ms;
}

.trl-help-tip:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.trl-help-tip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    transition-delay: 450ms;
}

.trl-form-card {
    padding: 20px;
}

.trl-form-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.trl-form-card-head h2 {
    margin: 0;
    color: var(--fg-1);
    font: 600 var(--text-sm)/1.2 var(--font-sans);
}

.trl-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.trl-form-grid.is-compact {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.trl-form-grid-wide {
    grid-column: 1 / -1;
}

.trl-segmented-control {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    width: min(100%, 320px);
    min-height: 36px;
    padding: 3px;
    border: 1px solid var(--border-1);
    border-radius: var(--radius-sm);
    background: var(--bg-surface-2);
}

.trl-segmented-control label {
    min-width: 0;
}

.trl-segmented-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.trl-segmented-control span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: calc(var(--radius-sm) - 1px);
    color: var(--fg-3);
    font: 500 12px/1 var(--font-sans);
    white-space: nowrap;
    cursor: pointer;
}

.trl-segmented-control input:checked + span {
    border-color: var(--border-2);
    background: var(--bg-surface);
    color: var(--fg-1);
    box-shadow: var(--shadow-xs, 0 1px 2px rgba(0,0,0,.08));
}

.trl-segmented-control input:focus-visible + span {
    box-shadow: var(--focus-ring);
}

.trl-schedule-mode-panel[hidden] {
    display: none !important;
}

/* ================================================================
   Agent creation builder
   ================================================================ */
.agentB-page {
    width: min(100%, 1500px);
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0 clamp(16px, 2vw, 28px) 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.agentB-head {
    align-items: flex-start;
}

.agentB-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.agentB-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-1);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
}

.agentB-alert.is-warning {
    border-color: rgba(245, 158, 11, 0.32);
    background: var(--status-warning-tint);
    color: var(--status-warning-fg);
}

.agentB-alert.is-danger {
    border-color: rgba(239, 68, 68, 0.32);
    background: var(--status-danger-tint);
    color: var(--status-danger-fg);
}

.agentB-alert.is-info {
    border-color: rgba(59, 130, 246, 0.32);
    background: var(--status-info-tint);
    color: var(--status-info-fg);
}

.agentB-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
    gap: 16px;
    align-items: start;
}

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

.agentB-wizard,
.agentB-preview {
    border: 1px solid var(--border-1);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
}

.agentB-wizard {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.agentB-stepper {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border-bottom: 1px solid var(--border-1);
    background: var(--bg-surface-2);
}

.agentB-stepper-item {
    min-width: 0;
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    border: 0;
    border-right: 1px solid var(--border-1);
    appearance: none;
    background: transparent;
    color: var(--fg-3);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.agentB-stepper-item:last-child {
    border-right: 0;
}

.agentB-stepper-item:hover:not(:disabled) {
    background: var(--bg-surface-3);
    color: var(--fg-1);
}

.agentB-stepper-item:focus-visible {
    position: relative;
    z-index: 1;
    outline: none;
    box-shadow: inset 0 0 0 2px var(--accent);
}

.agentB-stepper-item:disabled {
    cursor: default;
    opacity: 0.58;
}

.agentB-stepper-item.is-current {
    background: var(--bg-surface);
    color: var(--fg-1);
}

.agentB-stepper-item.is-complete {
    color: var(--fg-2);
}

.agentB-stepper-index {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-2);
    border-radius: 999px;
    color: var(--fg-4);
    background: var(--bg-surface);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1;
}

.agentB-stepper-item.is-current .agentB-stepper-index {
    border-color: var(--accent);
    color: var(--accent);
}

.agentB-stepper-item.is-complete .agentB-stepper-index {
    border-color: rgba(18, 141, 139, 0.34);
    background: rgba(18, 141, 139, 0.12);
    color: var(--accent);
}

.agentB-stepper-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.agentB-stepper-copy > span {
    overflow: hidden;
    color: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agentB-stepper-copy > small {
    min-height: 14px;
    color: var(--fg-4);
    font-size: 11px;
    line-height: 1.2;
}

.agentB-step-body {
    min-height: 360px;
    padding: 18px;
}

.agentB-section {
    min-height: 324px;
}

.agentB-section-head,
.agentB-preview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.agentB-section-head h2,
.agentB-preview-head h2 {
    margin: 0;
    color: var(--fg-1);
    font: 600 var(--text-lg)/1.25 var(--font-sans);
}

.agentB-step {
    margin-bottom: 3px;
    color: var(--fg-4);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.agentB-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.agentB-grid.is-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.agentB-grid-wide {
    grid-column: 1 / -1;
}

.agentB-grid label,
.agentB-section > label,
.agentB-prompt-label {
    min-width: 0;
}

.agentB-grid label > span,
.agentB-section > label > span,
.agentB-prompt-label > span {
    display: block;
    margin-bottom: 6px;
    color: var(--fg-3);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
}

.agentB-prompt-label {
    display: block;
}

.agentB-purpose,
.agentB-prompt-input {
    width: 100%;
    resize: vertical;
}

.agentB-purpose {
    min-height: 176px;
}

.agentB-prompt-input {
    min-height: 280px;
    line-height: 1.45;
}

.agentB-model-docs {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.agentB-meter {
    flex-shrink: 0;
    color: var(--fg-4);
    font-size: var(--text-xs);
}

.agentB-preview {
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 92px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.agentB-preview-head {
    margin: 0;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border-1);
}

.agentB-preview pre {
    flex: 1;
    min-height: 396px;
    max-height: calc(100vh - 180px);
    margin: 0;
    padding: 14px;
    overflow: auto;
    color: var(--fg-2);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: 12px/1.5 var(--font-mono);
}

.agentB-errors {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 18px 12px;
}

.agentB-errors > div {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--status-danger-fg);
    font-size: var(--text-sm);
}

.agentB-review-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.agentB-review-grid > div {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-1);
    border-radius: var(--radius-md);
    background: var(--bg-surface-2);
}

.agentB-review-grid dt {
    margin-bottom: 4px;
    color: var(--fg-4);
    font-size: var(--text-xs);
}

.agentB-review-grid dd {
    margin: 0;
    overflow: hidden;
    color: var(--fg-1);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agentB-actions,
.agentB-wizard-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.agentB-wizard-actions {
    min-height: 66px;
    margin-top: 0;
    padding: 12px 18px;
    border-top: 1px solid var(--border-1);
    background: var(--bg-surface-2);
}

@media (max-width: 1100px) {
    .agentB-layout {
        grid-template-columns: 1fr;
    }

    .agentB-preview {
        position: static;
        max-height: none;
    }

    .agentB-preview pre {
        min-height: 280px;
        max-height: 460px;
    }

    .agentB-step-body {
        min-height: 340px;
    }

    .agentB-section {
        min-height: 304px;
    }
}

@media (max-width: 720px) {
    .agentB-page {
        padding-inline: 14px;
        padding-bottom: 32px;
    }

    .agentB-stepper {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .agentB-stepper-item {
        min-height: 58px;
        padding: 10px 8px;
    }

    .agentB-stepper-index {
        width: 26px;
        height: 26px;
        font-size: 10px;
    }

    .agentB-step-body {
        min-height: 0;
        padding: 14px;
    }

    .agentB-section {
        min-height: 0;
    }

    .agentB-grid,
    .agentB-grid.is-three,
    .agentB-review-grid {
        grid-template-columns: 1fr;
    }

    .agentB-section-head,
    .agentB-preview-head,
    .agentB-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .agentB-wizard-actions {
        justify-content: stretch;
        padding: 12px 14px;
    }

    .agentB-actions .trl-btn,
    .agentB-wizard-actions .trl-btn {
        flex: 1 1 0;
        justify-content: center;
    }
}

/* ================================================================
   Automations schedules — registry table with upcoming-run agenda.
   ================================================================ */
.trl-schedule-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    align-items: start;
    gap: 16px;
}

.trl-schedule-main {
    min-width: 0;
}

.trl-schedule-agenda {
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 92px);
    overflow: auto;
}

.trl-schedule-agenda-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border-1);
}

.trl-schedule-agenda-head h2 {
    margin-top: 3px;
    font-size: var(--text-lg);
    letter-spacing: 0;
}

.trl-schedule-agenda-icon {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    color: var(--fg-4);
    flex-shrink: 0;
}

.trl-agenda-groups {
    display: flex;
    flex-direction: column;
}

.trl-agenda-day {
    padding: 12px 14px 14px;
    border-bottom: 1px solid var(--border-1);
}

.trl-agenda-day:last-child {
    border-bottom: 0;
}

.trl-agenda-date {
    margin-bottom: 8px;
    color: var(--fg-3);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
}

.trl-agenda-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trl-agenda-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
    padding: 8px;
    border-radius: var(--radius-md);
    color: inherit;
    text-decoration: none;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.trl-agenda-item:hover {
    background: var(--bg-surface-2);
}

.trl-agenda-time {
    padding-top: 1px;
    color: var(--accent-tag-fg);
    font-size: var(--text-xs);
    line-height: 1.35;
    white-space: nowrap;
}

.trl-agenda-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.trl-agenda-title {
    color: var(--fg-1);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trl-agenda-meta,
.trl-agenda-cron {
    color: var(--fg-3);
    font-size: var(--text-xs);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trl-agenda-cron {
    color: var(--fg-4);
    white-space: normal;
    overflow-wrap: anywhere;
}

.trl-agenda-empty {
    padding: 18px 14px;
}

.trl-agenda-empty p {
    margin: 0;
    font-size: var(--text-sm);
    line-height: 1.5;
}

.trl-agenda-empty p + p {
    margin-top: 6px;
    color: var(--fg-4);
    font-size: var(--text-xs);
}

/* ================================================================
   Dashboard command center — summary-first operator surface.
   ================================================================ */
.trl-dashboard-page {
    max-width: 1440px;
}

.trl-dashboard-head {
    margin-bottom: 16px;
}

.trl-dashboard-status {
    margin-bottom: 12px;
}

.trl-dashboard-app {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 16px;
    border: 1px solid var(--border-1);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
}

.trl-dashboard-app-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.trl-dashboard-app-row,
.trl-dashboard-health-flags {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.trl-dashboard-app-name {
    color: var(--fg-1);
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
}

.trl-dashboard-app-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--fg-3);
    font-size: var(--text-xs);
    line-height: 1.4;
}

.trl-dashboard-health-flags {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.trl-dashboard-health-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--fg-2);
    font-size: var(--text-xs);
}

.trl-dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.trl-dashboard-kpi {
    display: flex;
    min-height: 92px;
    min-width: 0;
    flex-direction: column;
    justify-content: space-between;
    gap: 4px;
    padding: 13px 14px;
    border: 1px solid var(--border-1);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    color: inherit;
    text-decoration: none;
    transition: background var(--dur-fast), border-color var(--dur-fast);
}

.trl-dashboard-kpi:hover {
    border-color: var(--border-2);
    background: var(--bg-surface-2);
}

.trl-dashboard-kpi.is-attention {
    border-color: rgba(239, 68, 68, 0.32);
    background: var(--status-danger-tint);
}

.trl-dashboard-kpi-label {
    color: var(--fg-3);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
}

.trl-dashboard-kpi-value {
    color: var(--fg-1);
    font-size: var(--text-2xl);
    font-weight: var(--weight-semibold);
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.trl-dashboard-kpi-meta {
    color: var(--fg-3);
    font-size: var(--text-xs);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.trl-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.9fr);
    align-items: start;
    gap: 14px;
    margin-bottom: 14px;
}

.trl-dashboard-main,
.trl-dashboard-side {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 14px;
}

.trl-dashboard-panel .trl-section-head {
    margin-bottom: 10px;
}

.trl-section-count {
    margin-left: 6px;
    color: var(--fg-3);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
}

.trl-dashboard-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 82px;
    color: var(--fg-4);
    font-size: var(--text-sm);
}

.trl-attention-list,
.trl-active-list,
.trl-upcoming-list,
.trl-activity-list {
    display: flex;
    flex-direction: column;
}

.trl-attention-row,
.trl-active-row,
.trl-upcoming-row,
.trl-activity-row {
    color: inherit;
    text-decoration: none;
    transition: background var(--dur-fast);
}

.trl-attention-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border-1);
}

.trl-attention-row:last-child,
.trl-active-row:last-child,
.trl-upcoming-row:last-child,
.trl-activity-row:last-child {
    border-bottom: 0;
}

.trl-attention-row:hover,
.trl-active-row:hover,
.trl-upcoming-row:hover,
.trl-activity-row:hover {
    background: var(--bg-surface-2);
}

.trl-attention-icon,
.trl-activity-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
}

.trl-attention-icon.is-danger,
.trl-activity-icon.is-danger {
    background: var(--status-danger-tint);
    color: var(--status-danger-fg);
}

.trl-attention-icon.is-warning,
.trl-activity-icon.is-warning {
    background: var(--status-warning-tint);
    color: var(--status-warning-fg);
}

.trl-attention-icon.is-info,
.trl-activity-icon.is-info {
    background: var(--status-info-tint);
    color: var(--status-info-fg);
}

.trl-attention-icon.is-success,
.trl-activity-icon.is-success {
    background: var(--status-success-tint);
    color: var(--status-success-fg);
}

.trl-attention-icon.is-neutral,
.trl-activity-icon.is-neutral {
    background: var(--status-neutral-tint);
    color: var(--status-neutral-fg);
}

.trl-attention-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.trl-attention-title {
    color: var(--fg-1);
    font-size: var(--text-base);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trl-attention-meta {
    color: var(--fg-3);
    font-size: var(--text-xs);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trl-attention-action {
    color: var(--accent);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.trl-active-row {
    display: grid;
    grid-template-columns: 88px 84px minmax(120px, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border-1);
    font-size: var(--text-sm);
}

.trl-active-id,
.trl-active-meta,
.trl-active-time {
    color: var(--fg-3);
    font-size: var(--text-xs);
}

.trl-active-title {
    min-width: 0;
    overflow: hidden;
    color: var(--fg-1);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trl-active-time {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trl-upcoming-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border-1);
}

.trl-upcoming-time {
    color: var(--accent-tag-fg);
    font-size: var(--text-xs);
    line-height: 1.35;
}

.trl-upcoming-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.trl-upcoming-title {
    color: var(--fg-1);
    font-size: var(--text-sm);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trl-upcoming-meta {
    color: var(--fg-3);
    font-size: var(--text-xs);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.trl-cost-windows {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.trl-cost-label {
    color: var(--fg-3);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
}

.trl-cost-value {
    margin-top: 4px;
    color: var(--fg-1);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    line-height: 1.15;
}

.trl-cost-meta {
    margin-top: 3px;
    color: var(--fg-3);
    font-size: var(--text-xs);
    line-height: 1.35;
}

.trl-cost-failed {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-1);
    color: var(--fg-3);
    font-size: var(--text-xs);
}

.trl-cost-failed span:last-child {
    color: var(--status-danger-fg);
}

.trl-dashboard-activity {
    margin-top: 0;
}

.trl-activity-row {
    display: grid;
    grid-template-columns: 22px 140px minmax(0, 1fr) minmax(150px, auto);
    gap: 12px;
    align-items: center;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border-1);
    font-size: var(--text-sm);
}

.trl-activity-time,
.trl-activity-meta {
    color: var(--fg-3);
    font-size: var(--text-xs);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trl-activity-title {
    min-width: 0;
    overflow: hidden;
    color: var(--fg-2);
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1180px) {
    .trl-dashboard-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .trl-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .trl-dashboard-page {
        padding: 16px;
    }

    .trl-dashboard-head {
        align-items: flex-start;
    }

    .trl-dashboard-app {
        align-items: flex-start;
        flex-direction: column;
    }

    .trl-dashboard-health-flags {
        justify-content: flex-start;
    }

    .trl-dashboard-kpis,
    .trl-cost-windows {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .trl-dashboard-kpi {
        min-height: 86px;
    }

    .trl-dashboard-kpi-value {
        font-size: var(--text-xl);
    }

    .trl-attention-row,
    .trl-active-row,
    .trl-upcoming-row,
    .trl-activity-row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 12px 2px;
    }

    .trl-attention-icon,
    .trl-activity-icon {
        display: none;
    }

    .trl-active-row .trl-badge {
        width: max-content;
    }

    .trl-active-time,
    .trl-activity-meta {
        max-width: none;
        white-space: normal;
    }
}

/* ================================================================
   Knowledge-doc prose — dark-mode tuned via design tokens.
   ================================================================ */
.knowledge-doc {
    color: var(--fg-2);
    line-height: 1.75;
}
.knowledge-doc > :first-child { margin-top: 0; }
.knowledge-doc > :last-child  { margin-bottom: 0; }

.knowledge-doc h1,
.knowledge-doc h2,
.knowledge-doc h3,
.knowledge-doc h4 {
    color: var(--fg-1);
    font-weight: 600;
    line-height: 1.25;
    scroll-margin-top: 5rem;
}
.knowledge-doc h1 { font-size: 1.875rem; margin: 0 0 1rem; }
.knowledge-doc h2 {
    font-size: 1.375rem;
    margin: 2.5rem 0 0.875rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-1);
}
.knowledge-doc h3 { font-size: 1.125rem; margin: 2rem 0 0.75rem; }
.knowledge-doc h4 { font-size: 1rem;     margin: 1.5rem 0 0.5rem; }

.knowledge-doc p,
.knowledge-doc ul,
.knowledge-doc ol,
.knowledge-doc blockquote,
.knowledge-doc table,
.knowledge-doc pre { margin: 1rem 0; }

.knowledge-doc ul,
.knowledge-doc ol { padding-left: 1.5rem; }
.knowledge-doc li + li { margin-top: 0.35rem; }

.knowledge-doc a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.knowledge-doc a:hover { color: var(--accent-hover); }

.knowledge-doc code {
    font-family: var(--font-mono);
    font-size: 0.875em;
}
.knowledge-doc :not(pre) > code {
    background: var(--bg-surface-2);
    color: var(--fg-1);
    padding: 0.15rem 0.35rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-1);
}

.knowledge-doc pre {
    background: var(--bg-surface-2);
    color: var(--fg-1);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-md);
    padding: 1rem 1.125rem;
    overflow-x: auto;
}
.knowledge-doc pre code {
    color: inherit;
    background: transparent;
    padding: 0;
    border: 0;
}

.knowledge-doc blockquote {
    border-left: 2px solid var(--accent);
    background: var(--accent-tint);
    color: var(--fg-1);
    padding: 0.875rem 1rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.knowledge-doc table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-1);
}
.knowledge-doc th,
.knowledge-doc td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--border-1);
    text-align: left;
    vertical-align: top;
    font-size: var(--text-sm);
}
.knowledge-doc th {
    background: var(--bg-surface-2);
    color: var(--fg-3);
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
}
.knowledge-doc tr:last-child td { border-bottom: 0; }

.knowledge-toc ul {
    list-style: none;
    margin: 0;
    padding-left: 0;
}
.knowledge-toc ul ul {
    margin-top: 0.5rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border-1);
}
.knowledge-toc li + li { margin-top: 0.5rem; }
.knowledge-toc a { color: var(--fg-3); text-decoration: none; }
.knowledge-toc a:hover { color: var(--fg-1); }

/* ================================================================
   Live log / tasks detail — monospace rows, level-colored lvl column.
   Mirrors .trl-log from console.css but scoped for template reuse.
   ================================================================ */
.log-details summary { list-style: none; cursor: pointer; color: var(--fg-3); }
.log-details summary::-webkit-details-marker { display: none; }
.log-details summary::before {
    content: "+ ";
    font-family: var(--font-mono);
    color: var(--fg-4);
}
.log-details[open] summary::before { content: "- "; }

/* ================================================================
   Flash — top-of-page notice. Token-colored, no Tailwind deps.
   ================================================================ */
.flash {
    padding: var(--space-3) var(--space-4);
    background: var(--status-success-tint);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-md);
    color: var(--status-success-fg);
    font-size: var(--text-sm);
}

/* ================================================================
   Login — 1px-dot noise backdrop at 4% alpha (design spec).
   ================================================================ */
.login-noise {
    position: relative;
    min-height: 100vh;
    background-color: var(--bg-base);
    background-image: radial-gradient(circle at 1px 1px, var(--noise-dot) 1px, transparent 0);
    background-size: 24px 24px;
}

/* ================================================================
   Utility shims — accept a few Tailwind-ish classes that templates
   still reach for (layout only). Color classes live in console.css.
   ================================================================ */
.hide-scrollbar::-webkit-scrollbar { width: 0; height: 0; }

.m-mobile-only,
.m-table-cards,
.m-bottom-nav,
.m-app-sheet-trigger,
.m-sheet-overlay {
    display: none;
}

/* Desktop normalization for mobile classes attached to shared playground markup. */
.trl-composer-box.m-composer {
    display: block;
}

.trl-composer-box textarea.m-composer-input {
    min-height: 44px;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    color: var(--fg-1);
    font: 13.5px/1.5 var(--font-sans);
}

.trl-pg-empty-mobile {
    display: none;
}

/* Keep the desktop nav usable at tablet portrait widths without switching the
   whole admin shell to the mobile bottom-nav treatment. */
@media (min-width: 768px) and (max-width: 900px) {
    .trl-nav {
        gap: 0;
        padding: 0 10px;
    }

    .trl-brand {
        margin-right: 6px;
    }

    .trl-nav-items {
        min-width: 0;
    }

    .trl-nav-item {
        padding: 7px 4px;
        font-size: 11.5px;
    }

    .trl-nav-right {
        gap: 6px;
    }

    .trl-kbd-btn {
        display: none;
    }

    .trl-app-switcher-eyebrow {
        display: none;
    }

    .trl-app-switcher-name {
        max-width: 48px;
    }

    .trl-nav-right > .trl-btn {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* ================================================================
   Mobile admin layer — below tablet width only.
   768px portrait remains desktop/tablet per the implementation brief.
   ================================================================ */
@media (max-width: 767.98px) {
    html,
    body {
        min-height: 100%;
        overflow-x: hidden;
    }

    body {
        background: var(--m-bg-base);
        padding-bottom: calc(78px + env(safe-area-inset-bottom));
    }

    main {
        background: var(--m-bg-base);
        max-width: none;
        min-height: calc(100vh - 56px - env(safe-area-inset-top) - 58px - env(safe-area-inset-bottom));
        width: 100%;
    }

    .trl-nav {
        position: sticky;
        top: 0;
        z-index: 70;
        height: calc(56px + env(safe-area-inset-top));
        padding: env(safe-area-inset-top) 14px 0;
        background: color-mix(in srgb, var(--m-bg-surface) 92%, transparent);
        border-bottom: 0.5px solid var(--m-border);
        backdrop-filter: blur(20px);
    }

    .trl-brand {
        flex: 1;
        min-width: 0;
        margin-right: 8px;
    }

    .trl-brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .trl-nav-items,
    .trl-kbd-btn,
    .trl-app-switcher,
    .trl-nav-right > .trl-btn {
        display: none !important;
    }

    .trl-nav-right {
        margin-left: 0;
        gap: 8px;
    }

    .trl-nav .trl-icon-btn {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }

    .m-app-sheet-trigger {
        display: inline-flex;
        min-height: 44px;
        max-width: 46vw;
        padding: 0 12px;
        font-size: 13px;
        border-radius: 10px;
    }

    .m-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 80;
        display: grid;
        height: calc(58px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: color-mix(in srgb, var(--m-bg-surface) 92%, transparent);
        backdrop-filter: blur(22px);
    }

    .m-bottom-nav a,
    .m-bottom-nav button {
        text-decoration: none;
        min-width: 0;
    }

    .m-bottom-nav .m-tab {
        color: var(--m-fg-3);
        min-height: 58px;
    }

    .m-bottom-nav .m-tab.is-active {
        color: var(--accent);
    }

    .m-bottom-nav .m-tab-label {
        font-size: 11.5px;
        font-weight: 600;
    }

    .m-sheet-overlay {
        position: fixed;
        inset: 0;
        z-index: 110;
        display: flex;
        align-items: flex-end;
        background: var(--bg-overlay);
        backdrop-filter: blur(2px);
    }

    .m-sheet {
        width: 100%;
        max-height: min(78vh, 720px);
        overflow-y: auto;
        background: var(--m-bg-base);
        border-radius: 24px 24px 0 0;
        padding: 8px 0 calc(18px + env(safe-area-inset-bottom));
        box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.35);
    }

    .m-sheet-handle {
        width: 38px;
        height: 4px;
        border-radius: 999px;
        background: var(--m-fg-4);
        margin: 4px auto 14px;
    }

    .m-sheet-title {
        padding: 0 20px 12px;
        color: var(--m-fg-1);
        font-size: var(--m-text-xl);
        font-weight: 700;
    }

    .m-sheet-group {
        margin: 0 12px;
    }

    .m-sheet .m-row {
        text-decoration: none;
        border: 0;
    }

    .m-sheet .m-row.is-active .m-row-title,
    .m-sheet .m-row.is-active .m-chev {
        color: var(--accent);
    }

    .m-sheet .m-row-icon {
        background: var(--accent);
    }

    .m-sheet form.m-group {
        display: block;
    }

    .m-sheet form .m-row {
        width: 100%;
        background: transparent;
        font: inherit;
        text-align: left;
    }

    .m-sheet-empty {
        margin: 0 12px;
    }

    .m-sheet-logout {
        width: calc(100% - 24px);
        margin: 12px;
    }

    .trl-overlay,
    .trl-palette {
        display: none !important;
    }

    .trl-page {
        background: var(--m-bg-base);
        padding: 18px 16px 20px;
        max-width: none !important;
    }

    .trl-page-head {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 18px;
    }

    .trl-page-head h1 {
        font-size: var(--m-text-large-title);
        line-height: 1.12;
        letter-spacing: 0;
        overflow-wrap: anywhere;
    }

    .trl-page-head .trl-row-gap {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: center;
        gap: 8px;
        max-width: 100%;
    }

    .trl-page-head .trl-row-gap form {
        display: inline-flex;
        max-width: 100%;
    }

    .trl-page-head .trl-row-gap .trl-link,
    .trl-page-head .trl-row-gap .trl-btn {
        max-width: 100%;
    }

    .trl-page-head [style*="display:flex"] {
        flex-wrap: wrap;
    }

    .trl-back {
        min-height: 36px;
        color: var(--m-fg-2);
        font-size: var(--m-text-sm);
    }

    .trl-btn {
        min-height: 40px;
        align-items: center;
        justify-content: center;
        white-space: normal;
    }

    .trl-btn-sm,
    .trl-btn-md {
        padding: 8px 12px;
        font-size: var(--m-text-sm);
    }

    .trl-badge,
    .status-pill {
        min-height: 24px;
        padding: 3px 8px;
        border-radius: 999px;
        font-size: 11.5px;
        line-height: 1.3;
        white-space: normal;
    }

    .trl-input,
    .trl-select {
        min-height: 44px;
        font-size: 16px;
        line-height: 1.35;
    }

    textarea.trl-input {
        min-height: 128px;
    }

    .trl-card {
        border-color: var(--m-border);
        border-radius: var(--m-radius-lg);
    }

    .trl-card.is-pad {
        padding: 16px !important;
    }

    .trl-page [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .trl-page .trl-grid-4[style*="grid-template-columns"],
    .trl-page section[style*="grid-template-columns:repeat(4"],
    .trl-page div[style*="grid-template-columns:repeat(4"],
    .trl-page div[style*="grid-template-columns:repeat(3"] {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .trl-detail-grid,
    .trl-grid-3 {
        grid-template-columns: 1fr !important;
    }

    .trl-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .trl-grid-2,
    .trl-grid-auto,
    .trl-console-hero,
    .trl-console-kpis,
    .trl-app-card-grid,
    .trl-app-card-meta {
        grid-template-columns: 1fr !important;
    }

    .trl-console-panel,
    .trl-create-app-card,
    .trl-command-card,
    .trl-record-card,
    .trl-app-card {
        padding: 14px;
    }

    .trl-command-card,
    .trl-create-app-card {
        max-width: none;
    }

    .trl-console-panel-head,
    .trl-action-panel,
    .trl-app-card-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .trl-create-app-main,
    .trl-create-app-control,
    .trl-command-grid,
    .trl-record-grid,
    .trl-record-meta,
    .trl-key-panel {
        grid-template-columns: 1fr;
    }

    .trl-key-panel .trl-btn,
    .trl-command-grid .trl-btn,
    .trl-create-app-control .trl-btn {
        width: 100%;
    }

    .trl-command-card-head,
    .trl-record-card-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .trl-create-advanced-summary {
        width: 100%;
    }

    .trl-section-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .trl-section-head .trl-link,
    .trl-section-head .trl-btn {
        align-self: flex-start;
    }

    .trl-meta-strip {
        display: grid;
        grid-auto-flow: row;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0;
        padding: 0;
        overflow: hidden;
        background: var(--m-bg-surface);
        border-color: var(--m-border);
        border-radius: var(--m-radius-lg);
    }

    .trl-meta-strip > div {
        min-width: 0;
        padding: 14px;
        border-right: 0;
        border-bottom: 0.5px solid var(--m-border);
    }

    .trl-meta-strip > div:nth-child(odd) {
        border-right: 0.5px solid var(--m-border);
    }

    .trl-meta-strip > div:nth-last-child(-n + 2) {
        border-bottom: 0;
    }

    .trl-meta-k {
        color: var(--m-fg-3);
        font-size: 11.5px;
        line-height: 1.25;
    }

    .trl-meta-v,
    .trl-meta-strip .mono,
    .trl-meta-strip .trl-tag {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .trl-meta-v {
        font-size: var(--m-text-sm);
        line-height: 1.35;
    }

    .trl-kv {
        grid-template-columns: 1fr !important;
        gap: 4px;
        font-size: var(--m-text-sm);
    }

    .trl-kv > :nth-child(odd) {
        margin-top: 8px;
    }

    .trl-kv > :first-child {
        margin-top: 0;
    }

    .trl-inline-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
        padding: 10px 0;
        font-size: var(--m-text-sm);
    }

    .trl-inline-row > * {
        min-width: 0 !important;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .trl-inline-row > .fg-3:first-child {
        color: var(--m-fg-3);
        font-size: 11.5px;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }

    .trl-table-wrap {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-color: var(--m-border);
        border-radius: var(--m-radius-lg);
    }

    .trl-table {
        min-width: 680px;
    }

    .trl-table th,
    .trl-table td {
        padding: 10px 12px;
        font-size: 12.5px;
        line-height: 1.4;
    }

    .trl-pre,
    pre.trl-pre,
    .knowledge-doc pre {
        max-width: 100%;
        overflow-x: auto;
        white-space: pre-wrap !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        font-size: 12.5px !important;
        line-height: 1.55;
        border-radius: var(--m-radius-lg);
    }

    .knowledge-doc {
        font-size: var(--m-text-md);
        line-height: 1.7;
    }

    .knowledge-doc h1 {
        font-size: 1.65rem;
    }

    .knowledge-doc h2 {
        font-size: 1.25rem;
    }

    .knowledge-doc table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .login-noise {
        padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)) !important;
    }

    @media (max-width: 430px) {
        .trl-meta-strip {
            grid-template-columns: 1fr;
        }

        .trl-meta-strip > div,
        .trl-meta-strip > div:nth-child(odd) {
            border-right: 0;
        }

        .trl-meta-strip > div:nth-last-child(-n + 2) {
            border-bottom: 0.5px solid var(--m-border);
        }

        .trl-meta-strip > div:last-child {
            border-bottom: 0;
        }
    }

    .trl-eyebrow,
    .label-eyebrow {
        font-size: var(--m-text-xs);
    }

    .trl-section {
        margin-top: 22px;
    }

    .trl-section-title {
        color: var(--m-fg-3);
        font-size: var(--m-text-xs);
        padding-left: 2px;
    }

    .trl-section-head {
        margin-bottom: 8px;
    }

    .m-mobile-only {
        display: block;
    }

    .m-mobile-only.m-pill {
        display: inline-flex;
    }

    .m-table-cards,
    .m-card-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .m-data-card {
        display: block;
        min-width: 0;
        color: inherit;
        text-decoration: none;
        background: var(--m-bg-surface);
        border: 0.5px solid var(--m-border);
        border-radius: var(--m-radius-lg);
        padding: 14px;
    }

    .m-data-card:active {
        transform: translateY(1px);
    }

    .m-card-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        min-width: 0;
    }

    .m-card-title {
        min-width: 0;
        color: var(--m-fg-1);
        font-size: var(--m-text-md);
        font-weight: 650;
        line-height: 1.28;
        overflow-wrap: anywhere;
    }

    .m-card-subtitle {
        margin-top: 3px;
        color: var(--m-fg-2);
        font-size: var(--m-text-sm);
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .m-card-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 6px 10px;
        margin-top: 10px;
        color: var(--m-fg-2);
        font-size: var(--m-text-sm);
        line-height: 1.4;
    }

    .m-card-meta .mono,
    .m-card-meta.mono {
        overflow-wrap: anywhere;
    }

    .trl-schedule-layout {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .trl-schedule-agenda {
        position: static;
        order: -1;
        max-height: none;
        overflow: visible;
        background: var(--m-bg-surface);
        border-color: var(--m-border);
        border-radius: var(--m-radius-lg);
    }

    .trl-schedule-agenda-head {
        padding: 14px;
        border-bottom-color: var(--m-border);
    }

    .trl-schedule-agenda-head h2 {
        font-size: var(--m-text-md);
    }

    .trl-agenda-day {
        padding: 12px 14px;
        border-bottom-color: var(--m-border);
    }

    .trl-agenda-item {
        grid-template-columns: 76px minmax(0, 1fr);
        min-height: 44px;
        padding: 8px 0;
    }

    .trl-agenda-item:hover {
        background: transparent;
    }

    .trl-agenda-title,
    .trl-agenda-meta,
    .trl-agenda-cron {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .m-card-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-top: 12px;
    }

    .m-card-field {
        min-width: 0;
    }

    .m-card-label {
        color: var(--m-fg-3);
        font-size: 11px;
        font-weight: 600;
        line-height: 1.25;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .m-card-value {
        margin-top: 3px;
        color: var(--m-fg-1);
        font-size: var(--m-text-sm);
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .m-card-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 12px;
    }

    .m-empty {
        background: var(--m-bg-surface);
        border: 0.5px solid var(--m-border);
        border-radius: var(--m-radius-lg);
        padding: 28px 18px;
        color: var(--m-fg-2);
        font-size: var(--m-text-sm);
        text-align: center;
    }

    .m-desktop-only {
        display: none !important;
    }

    .m-kpi-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 10px;
    }

    .m-health-block {
        margin-top: 10px;
    }

    .m-health-card {
        background: var(--m-bg-surface);
        border: 0.5px solid var(--m-border);
        border-radius: var(--m-radius-xl);
        padding: 16px;
    }

    .m-health-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        margin-bottom: 4px;
    }

    .m-health-list {
        display: block !important;
    }

    .m-health-list .trl-health {
        border: 0;
        border-radius: 0;
        background: transparent;
        padding: 12px 0;
    }

    .m-health-list .trl-health + .trl-health {
        border-top: 0.5px solid var(--m-border);
    }

    .m-health-list .trl-health-label {
        font-size: var(--m-text-md);
    }

    .m-health-list .trl-health-detail {
        font-size: var(--m-text-sm);
        color: var(--m-fg-3);
    }

    .trl-run-card {
        border: 0;
        border-radius: var(--m-radius-lg);
        background: var(--m-bg-surface);
    }

    .trl-toolbar {
        display: block;
        overflow-x: auto;
        margin: 0 -16px 14px;
        padding: 0 16px;
        scrollbar-width: none;
    }

    .trl-toolbar::-webkit-scrollbar {
        display: none;
    }

    .trl-seg {
        min-width: max-content;
        border-radius: 999px;
        background: var(--m-bg-surface);
        border-color: var(--m-border);
    }

    .trl-seg-item {
        color: var(--m-fg-2);
        font-size: 12.5px;
        min-height: 34px;
        border-radius: 999px;
    }

    .trl-filter-form {
        align-items: stretch;
        margin-bottom: 12px;
    }

    .trl-filter-form .trl-search,
    .trl-filter-form .trl-select,
    .trl-filter-form .trl-btn {
        width: 100%;
        max-width: none;
    }

    .trl-filter-form .trl-search input {
        width: 100%;
    }

    .trl-filter-chips {
        margin-bottom: 12px;
    }

    .m-runs-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .m-run {
        color: inherit;
        text-decoration: none;
    }

    .m-run-id,
    .m-run-meta {
        color: var(--m-fg-2);
    }

    .m-run-title {
        font-size: 17px;
        line-height: 1.3;
    }

    .m-run:active,
    .m-row:active {
        transform: translateY(1px);
    }

    .m-run-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .m-group {
        margin-left: 0;
        margin-right: 0;
    }

    .m-group-header {
        color: var(--m-fg-2);
        font-size: 12.5px;
        padding-left: 32px;
    }

    .m-row-sub,
    .m-row-value {
        color: var(--m-fg-2);
    }

    .m-pill {
        font-size: 12px;
    }

    .m-group .m-row {
        text-decoration: none;
    }

    .m-group .m-row-icon {
        background: var(--accent);
    }

    .m-pill-executing,
    .m-pill-plan_submitted {
        background: rgba(59,130,246,.14);
        color: var(--status-info-fg);
    }

    .m-pill-cancelled,
    .m-pill-replaced {
        background: rgba(245,158,11,.14);
        color: var(--status-warning-fg);
    }

    .m-pill-pending {
        background: rgba(113,113,122,.14);
        color: var(--status-neutral-fg);
    }

    .m-dot-executing,
    .m-dot-plan_submitted {
        background: var(--status-info);
    }

    .m-dot-cancelled,
    .m-dot-replaced {
        background: var(--status-warning);
    }

    .m-dot-pending {
        background: var(--status-neutral);
    }

    .trl-pg {
        display: flex;
        height: calc(100dvh - 56px - env(safe-area-inset-top) - 58px - env(safe-area-inset-bottom));
        min-height: 0;
    }

    .trl-pg-sidebar {
        display: none !important;
    }

    .trl-pg-main {
        width: 100%;
        min-height: 0;
        background: var(--m-bg-base);
    }

    .trl-pg-header {
        min-height: 58px;
        padding: 9px 12px 9px 14px;
        gap: 10px;
        background: var(--m-bg-surface);
        border-bottom: 0.5px solid var(--m-border);
    }

    .trl-pg-sidebar-toggle {
        display: none;
    }

    .trl-pg-head-main {
        flex: 1;
        min-width: 0;
        gap: 0;
    }

    .trl-pg-head-actions {
        gap: 6px;
    }

    .trl-pg-mobile-sessions-btn {
        display: inline-flex;
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .trl-pg-online {
        display: none;
    }

    .trl-pg-title {
        max-width: calc(100vw - 84px);
        font-size: var(--m-text-md);
        flex-wrap: wrap;
        row-gap: 5px;
    }

    .trl-pg-title-text {
        max-width: calc(100vw - 170px);
        min-width: 0;
        line-height: 1.25;
    }

    .trl-chip {
        font-size: 11.5px;
        max-width: 100%;
    }

    .trl-pg-transcript {
        align-items: stretch;
        padding: 16px 14px;
        gap: 0;
        background: var(--m-bg-base);
    }

    .trl-pg-alert {
        margin: 10px 14px 0;
        padding: 10px 12px;
        border-radius: var(--m-radius-md);
        font-size: var(--m-text-sm);
    }

    .trl-pg-empty {
        max-width: 310px !important;
        padding: 18px 20px;
        background: var(--m-bg-surface);
        border: 0.5px solid var(--m-border);
        border-radius: var(--m-radius-xl);
        text-align: left !important;
    }

    .trl-pg-empty-mobile {
        display: block;
    }

    .trl-pg-empty-logo,
    .trl-pg-empty-status,
    .trl-pg-empty-help {
        display: none;
    }

    .trl-pg-empty-mobile-title {
        margin-bottom: 10px;
        color: var(--m-fg-1);
        font-size: var(--m-text-xl);
        font-weight: 700;
        line-height: 1.2;
    }

    .trl-pg-empty-mobile-status {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        color: var(--status-success-fg);
        font-size: var(--m-text-md);
        font-weight: 600;
    }

    .trl-pg-empty-mobile p {
        margin-top: 14px;
        color: var(--m-fg-2);
        font-family: var(--font-sans);
        font-size: var(--m-text-md);
        line-height: 1.45;
    }

    .trl-msg.m-msg,
    .trl-msg {
        display: flex;
        grid-template-columns: none;
        gap: 8px;
        width: 100%;
        margin-bottom: 14px;
    }

    .trl-msg-role {
        display: none;
    }

    .trl-msg-user {
        justify-content: flex-end;
    }

    .trl-msg-assistant,
    .trl-msg-error {
        justify-content: flex-start;
    }

    .trl-msg-text {
        max-width: 100%;
        padding: 9px 14px;
        border-radius: 20px;
        font-size: var(--m-text-md);
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .trl-msg-user .trl-msg-text {
        max-width: 86%;
        background: var(--accent);
        color: #fff;
        border-bottom-right-radius: 6px;
        white-space: pre-wrap;
    }

    .trl-msg-assistant .trl-msg-text {
        max-width: min(100%, 680px);
        background: var(--m-bg-surface);
        color: var(--m-fg-1);
        border-bottom-left-radius: 6px;
    }

    .trl-msg-error .trl-msg-text {
        max-width: 100%;
        background: var(--status-danger-tint);
        border: 0.5px solid rgba(239,68,68,0.28);
        color: var(--status-danger-fg);
    }

    .trl-msg-thinking {
        color: var(--m-fg-3);
    }

    .trl-msg-text.trl-prose p {
        margin-bottom: 8px;
    }

    .trl-msg-text.trl-prose > *:last-child {
        margin-bottom: 0;
    }

    .trl-msg-text.trl-prose ul,
    .trl-msg-text.trl-prose ol {
        padding-left: 20px;
    }

    .trl-msg-text.trl-prose pre {
        max-width: 100%;
        font-size: 12px;
        line-height: 1.45;
        -webkit-overflow-scrolling: touch;
    }

    .trl-msg-text.trl-prose table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .trl-pg-composer {
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: var(--m-bg-surface);
        border-top: 0.5px solid var(--m-border);
    }

    .trl-pg-composer-form {
        width: 100%;
        gap: 8px;
    }

    .trl-pg-composer form {
        gap: 8px !important;
    }

    .trl-pg-controls {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .trl-pg-composer .trl-select {
        min-height: 44px;
        width: 100%;
        max-width: 100%;
        font-size: 14px;
    }

    .trl-pg-direct-note {
        margin-left: 0;
        padding: 0 2px;
        color: var(--m-fg-3);
        font-size: var(--m-text-xs);
    }

    .trl-command-menu {
        max-height: min(44vh, 300px);
        margin-bottom: 10px;
        border-color: var(--m-border);
        border-radius: 16px;
    }

    .trl-command-menu-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .trl-command-menu-help {
        display: none;
    }

    .trl-command-menu .trl-palette-item {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
        min-height: 52px;
        padding: 10px 12px;
    }

    .trl-skill-list {
        flex-wrap: nowrap;
        gap: 6px;
        margin: 0 -12px;
        padding: 0 12px 2px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .trl-skill-list::-webkit-scrollbar {
        display: none;
    }

    .trl-skill-chip {
        flex: 0 0 auto;
        max-width: 78vw;
        min-height: 32px;
        border-radius: 999px;
    }

    .trl-composer-box.m-composer {
        display: flex;
        align-items: flex-end;
        gap: 8px;
        background: transparent;
        border: 0;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }

    .trl-composer-box.m-composer:focus-within {
        box-shadow: none;
    }

    .trl-composer-box.m-composer textarea.m-composer-input {
        flex: 1;
        min-height: 44px;
        max-height: 140px;
        background: var(--m-bg-surface-2);
        border: 0.5px solid var(--m-border);
        border-radius: 20px;
        padding: 10px 16px;
        color: var(--m-fg-1);
        font-size: var(--m-text-md);
        line-height: 1.3;
    }

    .trl-composer-foot {
        margin-top: 0;
        flex-shrink: 0;
    }

    .trl-composer-foot > div {
        display: none !important;
    }

    .trl-composer-foot .trl-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
    }

    .trl-composer-foot .trl-btn i {
        width: 16px !important;
        height: 16px !important;
    }

    .trl-pg-session-sheet {
        display: flex;
    }

    .trl-pg-session-panel {
        max-height: min(78vh, 620px);
    }

    .trl-pg-sheet-head {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 0 20px 8px;
    }

    .trl-pg-sheet-head .m-sheet-title {
        padding: 2px 0 0;
    }

    .trl-pg-sheet-sessions {
        max-height: 50vh;
        padding: 4px 12px 0;
    }

    .trl-pg-sheet-sessions .trl-pg-session {
        min-height: 58px;
        padding: 11px 12px;
        border-radius: 12px;
    }

    .trl-pg-sheet-sessions .trl-pg-session + .trl-pg-session {
        margin-top: 4px;
    }

    .trl-pg-sheet-sessions .trl-pg-session-title {
        font-size: var(--m-text-md);
    }

    .trl-pg-sheet-sessions .trl-pg-session-meta {
        font-size: var(--m-text-xs);
    }
}
