/* Chat Page Styles */
:root {
    --inspector-expanded-width: 360px;
    --inspector-collapsed-width: 64px;
    --chat-header-height: 64px;
}

.thread-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.artifact-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background-color: #fff;
}

.artifact-page-label {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
}

.artifact-page-title {
    margin: 0.2rem 0 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.artifact-page-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Mobile breadcrumb navigation */
.artifact-breadcrumb-nav {
    display: none;
    align-items: center;
    gap: 0.5rem;
}

.artifact-breadcrumb-button {
    border: none;
    background: transparent;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: #475569;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.artifact-breadcrumb-button:hover,
.artifact-breadcrumb-button:focus-visible {
    background-color: #f1f5f9;
    color: #0f172a;
}

.artifact-breadcrumb-separator {
    color: #cbd5e1;
    font-size: 1.25rem;
}

/* Inspector Panel */
.inspector-panel {
    flex: 0 0 var(--inspector-expanded-width);
    width: var(--inspector-expanded-width);
    max-width: var(--inspector-expanded-width);
    background-color: #ffffff;
    border-left: 1px solid #e5e7eb;
    padding: 0 1.25rem 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    row-gap: .5rem;
    transition: width 0.2s ease;
    position: relative;
}

.inspector-panel.collapsed {
    flex: 0 0 var(--inspector-collapsed-width);
    width: var(--inspector-collapsed-width);
    max-width: var(--inspector-collapsed-width);
    min-width: var(--inspector-collapsed-width);
    padding: 0 0.5rem 0.75rem;
    overflow: hidden;
    align-items: center;
}

.inspector-panel.expanded {
    min-width: 320px;
}

.inspector-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.inspector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 64px;
    padding: 0;
}

.inspector-header-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.inspector-header p {
    margin: 0.15rem 0 0;
    color: #6b7280;
    font-size: 0.75rem;
}

.inspector-collapse-toggle {
    left: 0px;
    right: initial;
    top: 35px;
}


.inspector-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.inspector-section {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background-color: #f9fafb;
    overflow: hidden;
}

.inspector-section-header {
    width: 100%;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.inspector-section-header:hover,
.inspector-section-header:focus-visible {
    background-color: #eef2ff;
}

.inspector-section-text h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #0f172a;
}

.inspector-section-text p {
    margin: 0.15rem 0 0;
    color: #6b7280;
    font-size: 0.8rem;
}


.inspector-section-body {
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
}

/* Shimmer overlay for refreshing state */
.inspector-section-body.shimmer-overlay {
    pointer-events: none;
}

.inspector-section-body.shimmer-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: inspector-shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

@keyframes inspector-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Section refreshing state */
.inspector-section.is-refreshing {
    opacity: 0.7;
}

.inspector-section-refreshing-indicator {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.85rem;
    color: #6366f1;
    animation: inspector-spin 1s linear infinite;
}

@keyframes inspector-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.inspector-debug-card {
    border: 1px solid #a78bfa;
    border-radius: 0.9rem;
    padding: 1rem;
    background: linear-gradient(145deg, #312e81, #1e1b4b);
    color: #f8fafc;
    box-shadow: 0 15px 35px rgba(49, 46, 129, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.inspector-debug-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.debug-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inspector-debug-card-header h4 {
    margin: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #c7d2fe;
}

.inspector-debug-card-header p {
    margin: 0.2rem 0 0;
    color: #e0e7ff;
    font-size: 0.85rem;
}

.debug-json-preview {
    background-color: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(199, 210, 254, 0.35);
    border-radius: 0.65rem;
    padding: 0.75rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    max-height: 260px;
    overflow: auto;
    color: #f8fafc;
}

.debug-json-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #e0e7ff;
}

.debug-json-error {
    padding: 0.65rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(248, 113, 113, 0.8);
    background-color: rgba(127, 29, 29, 0.4);
    color: #fecaca;
    font-size: 0.82rem;
}

.debug-follow-button,
.debug-copy-button {
    border: 1px solid rgba(196, 181, 253, 0.6);
    color: #ede9fe;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.debug-follow-button {
    background-color: rgba(79, 70, 229, 0.2);
}

.debug-copy-button {
    background-color: rgba(15, 23, 42, 0.55);
}

.debug-follow-button:hover,
.debug-follow-button:focus-visible,
.debug-copy-button:hover,
.debug-copy-button:focus-visible {
    border-color: #c084fc;
    background-color: rgba(129, 140, 248, 0.45);
}

.inspector-panel.collapsed .inspector-header-text,
.inspector-panel.collapsed .inspector-body {
    display: none;
}

.inspector-panel.collapsed .inspector-debug-card {
    display: none;
}

.inspector-collapsed-label {
    display: none;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.35em;
}

.inspector-panel.collapsed .inspector-collapsed-label {
    display: block;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-weight: 600;
}

@media (max-width: 1200px) {
    .thread-layout {
        gap: 0;
    }

    .inspector-panel {
        flex: 0 0 var(--inspector-collapsed-width);
        width: var(--inspector-collapsed-width);
        max-width: var(--inspector-collapsed-width);
        min-width: var(--inspector-collapsed-width);
    }

    .inspector-panel.expanded {
        flex: 0 0 300px;
        width: 300px;
        max-width: 300px;
        min-width: 300px;
    }
}

@media (max-width: 1024px) {
    .thread-layout {
        flex-direction: column;
    }

    .inspector-collapse-toggle {
        display: none;
    }

    .chat-container {
        width: 100%;
    }

    .inspector-panel,
    .inspector-panel.collapsed,
    .inspector-panel.expanded {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        flex: 0 0 auto;
        width: min(90vw, 360px);
        max-width: 90vw;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        box-shadow: none;
        z-index: 1100;
        pointer-events: none;
        padding: 1.25rem;
    }

    body.inspector-drawer-open .inspector-panel {
        transform: translateX(0);
        pointer-events: auto;
        box-shadow: -25px 0 45px rgba(15, 23, 42, 0.25);
    }

    body.inspector-drawer-open .inspector-panel.collapsed {
        align-items: stretch;
    }

    body.inspector-drawer-open .inspector-panel.collapsed .inspector-header-text,
    body.inspector-drawer-open .inspector-panel.collapsed .inspector-body {
        display: flex;
        flex-direction: column;
    }

    .inspector-collapsed-label,
    .inspector-panel.collapsed .inspector-collapsed-label {
        display: none !important;
    }
}

.thread-layout {
    flex: 1;
    display: flex;
    min-height: 0;
    min-width: 0;
    background-color: #f8fafc;
}

.chat-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.dictation-error-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid #f77171;
    background-color: #fff6f6;
    color: #b42318;
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

.dictation-error-dismiss {
    border: none;
    background: transparent;
    color: inherit;
    font-weight: 600;
    cursor: pointer;
}

.execution-error-banner {
    margin: 0.5rem 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #fca5a5;
    background-color: #fef2f2;
    color: #991b1b;
    font-size: 0.875rem;
    line-height: 1.4;
}

.execution-error-banner strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
}

.chat-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    min-height: var(--chat-header-height);
    padding: 0 1rem;
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    .chat-header {
        padding: 0 0.5rem;
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 0 0.4rem;
        min-height: 44px;
    }
}

.thread-settings-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 12;
}

.thread-settings-layer .thread-settings-scrim {
    position: absolute;
    top: var(--chat-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.thread-settings-layer.open {
    pointer-events: auto;
}

.thread-settings-layer.open .thread-settings-scrim {
    opacity: 1;
}

.thread-settings-drawer {
    position: absolute;
    top: var(--chat-header-height);
    left: 0;
    right: 0;
    width: min(720px, calc(100% - 2rem));
    margin: 0 auto;
    background-color: #ffffff;
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
    border-top: 1px solid #e2e8f0;
    padding: 1.5rem;
    box-shadow: 0 35px 70px rgba(15, 23, 42, 0.25);
    transform: translate3d(0, -16px, 0);
    transition: transform 0.3s ease, opacity 0.2s ease;
    opacity: 0;
    will-change: transform, opacity;
    max-height: calc(100% - var(--chat-header-height));
    overflow-y: auto;
}

.thread-settings-layer.open .thread-settings-drawer {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

.thread-participants-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 13;
}

.thread-participants-layer .thread-participants-scrim {
    position: absolute;
    top: var(--chat-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.thread-participants-layer.open {
    pointer-events: auto;
}

.thread-participants-layer.open .thread-participants-scrim {
    opacity: 1;
}

.thread-participants-drawer {
    position: absolute;
    top: var(--chat-header-height);
    left: 0;
    right: 0;
    width: min(720px, calc(100% - 2rem));
    margin: 0 auto;
    background-color: #ffffff;
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
    border-top: 1px solid #e2e8f0;
    padding: 1.5rem;
    box-shadow: 0 35px 70px rgba(15, 23, 42, 0.25);
    transform: translate3d(0, -16px, 0);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.2s ease;
    max-height: calc(100% - var(--chat-header-height));
    overflow-y: auto;
}

.thread-participants-layer.open .thread-participants-drawer {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

.thread-participants-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.thread-participants-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #0f172a;
}

.thread-participants-header p {
    margin: 0.2rem 0 0;
    color: #64748b;
    font-size: 0.9rem;
}

.thread-participants-list {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.thread-participants-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.thread-participants-row:last-child {
    border-bottom: none;
}

.thread-participants-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #eef2ff;
    color: #1d4ed8;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.thread-participants-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.thread-participants-name {
    font-weight: 600;
    color: #0f172a;
}

.thread-participants-meta {
    font-size: 0.85rem;
    color: #64748b;
}

.participants-drawer-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 13;
}

.participants-drawer-layer .participants-drawer-scrim {
    position: absolute;
    top: var(--chat-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.25);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.participants-drawer-layer.open {
    pointer-events: auto;
}

.participants-drawer-layer.open .participants-drawer-scrim {
    opacity: 1;
}

.participants-drawer {
    position: absolute;
    top: var(--chat-header-height);
    right: 1rem;
    width: min(360px, calc(100% - 1.5rem));
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
    transform: translate3d(0, -16px, 0);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.participants-drawer-layer.open .participants-drawer {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

.participants-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.participants-drawer-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: #0f172a;
}

.participants-drawer-header p {
    margin: 0.2rem 0 0;
    color: #64748b;
    font-size: 0.9rem;
}

.participants-drawer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.participants-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.participants-row:last-child {
    border-bottom: none;
}

.participants-row-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #eef2ff;
    color: #1d4ed8;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.participants-row-details {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.participants-row-name {
    font-weight: 600;
    color: #0f172a;
}

.participants-row-attr {
    font-size: 0.85rem;
    color: #64748b;
}

.thread-settings-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.thread-settings-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #0f172a;
}

.thread-settings-header p {
    margin: 0.2rem 0 0;
    color: #64748b;
    font-size: 0.9rem;
}

.drawer-close {
    border: none;
    background: transparent;
    color: #475467;
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.drawer-close:hover,
.drawer-close:focus-visible {
    background-color: #eef2ff;
    color: #1f2937;
}

.drawer-close:focus-visible {
    outline: 2px solid #c7d2fe;
    outline-offset: 2px;
}

.thread-settings-body {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.thread-settings-empty {
    margin: 0;
    color: #475467;
    font-size: 0.95rem;
}

.drawer-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem 1.25rem;
}

.drawer-section.drawer-danger-zone {
    background: #fef2f2;
    border-color: #fecaca;
}

.drawer-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.drawer-section-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #0f172a;
}

.drawer-section-header p {
    margin: 0.2rem 0 0;
    font-size: 0.9rem;
    color: #64748b;
}

.drawer-chip {
    padding: 0.15rem 0.75rem;
    border-radius: 999px;
    background-color: #e0e7ff;
    color: #3730a3;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.read-only-execution {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.read-only-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.inline-edit-trigger {
    border: 1px solid #c7d2fe;
    background-color: #eef2ff;
    border-radius: 0.75rem;
    padding: 0.65rem 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: #1f2937;
    font-weight: 600;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.inline-edit-trigger:hover,
.inline-edit-trigger:focus-visible {
    background-color: #e0e7ff;
    border-color: #a5b4fc;
}

.inline-edit-trigger:focus-visible {
    outline: 2px solid #c7d2fe;
    outline-offset: 2px;
}

.inline-edit-icon {
    font-size: 0.85rem;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.inline-edit-trigger:hover .inline-edit-icon,
.inline-edit-trigger:focus-visible .inline-edit-icon {
    opacity: 1;
}

.drawer-help-text {
    margin: 0;
    font-size: 0.85rem;
    color: #475467;
}

/* Web Chat Link section in Thread Settings */
.web-chat-link-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.web-chat-url {
    flex: 1;
    font-size: 0.8rem;
    font-family: "JetBrains Mono", monospace;
    color: #475569;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: transparent;
    padding: 0;
}

.web-chat-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.web-chat-actions .icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
}

.web-chat-actions .icon-button:hover {
    background: #f1f5f9;
    color: #1d4ed8;
}

.web-chat-actions .icon-button .copy-success {
    color: #16a34a;
    font-weight: 600;
}

.drawer-guide-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #4f46e5;
    text-decoration: none;
    padding: 0.3rem 0;
    margin-top: 0.25rem;
    transition: opacity 0.15s;
}

.drawer-guide-link:hover {
    opacity: 0.75;
    text-decoration: none;
}

.drawer-danger-button {
    border: 1px solid #f87171;
    background-color: #dc2626;
    color: #ffffff;
    font-weight: 600;
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    align-self: flex-start;
}

/* Export section in Thread Settings */
.drawer-export-actions {
    display: flex;
    gap: 0.5rem;
}

.drawer-export-button {
    border: 1px solid #c7d2fe;
    background-color: #eef2ff;
    color: #3730a3;
    font-weight: 600;
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    align-self: flex-start;
}

.drawer-export-button:hover,
.drawer-export-button:focus-visible {
    background-color: #e0e7ff;
    border-color: #a5b4fc;
}

.drawer-export-button:focus-visible {
    outline: 2px solid #c7d2fe;
    outline-offset: 2px;
}

.drawer-export-button:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.button-spinner-export {
    border-color: rgba(55, 48, 163, 0.3);
    border-top-color: #3730a3;
}

.drawer-danger-button:hover,
.drawer-danger-button:focus-visible {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

.drawer-danger-button:focus-visible {
    outline: 2px solid #fecaca;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    /* Aggressive padding reduction for projects/threads page */
    .artifact-page-header {
        padding: 0.5rem 0.5rem;
        min-height: 48px;
    }
    
    /* Hide all text labels and titles, show only icon breadcrumb navigation */
    .artifact-page-label,
    .artifact-page-title,
    .artifact-page-actions {
        display: none !important;
    }
    
    .artifact-breadcrumb-nav {
        display: flex !important;
        width: 100%;
        justify-content: flex-start;
    }
    
    .artifact-breadcrumb-button {
        padding: 0.4rem 0.5rem;
        font-size: 1.4rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .artifact-breadcrumb-separator {
        font-size: 1rem;
        color: #cbd5e1;
    }
    
    /* Full-screen modal drawers on mobile */
    .thread-settings-layer .thread-settings-scrim,
    .thread-participants-layer .thread-participants-scrim,
    .participants-drawer-layer .participants-drawer-scrim {
        top: 0;
        background: rgba(15, 23, 42, 0.6);
    }
    
    .thread-settings-drawer,
    .thread-participants-drawer {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
        border: none;
        transform: translate3d(0, 100%, 0);
        z-index: 1200;
        padding: 1rem;
        overflow-y: auto;
    }
    
    .thread-settings-layer.open .thread-settings-drawer,
    .thread-participants-layer.open .thread-participants-drawer {
        transform: translate3d(0, 0, 0);
    }
    
    .participants-drawer-layer .participants-drawer {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
        transform: translate3d(0, 100%, 0);
        z-index: 1200;
        padding: 1rem;
    }
    
    .participants-drawer-layer.open .participants-drawer {
        transform: translate3d(0, 0, 0);
    }
    
    /* Simplify drawer content for mobile */
    .drawer-field-grid {
        grid-template-columns: 1fr;
    }
    
    .thread-participants-list,
    .participants-drawer-list {
        gap: 0.75rem;
    }
    
    .thread-participants-row,
    .participants-row {
        padding: 0.75rem;
        border-radius: 0.5rem;
        background-color: #f8fafc;
        border-bottom: none;
    }
    
    .thread-participants-avatar,
    .participants-row-avatar {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }
    
    .drawer-section {
        padding: 0.75rem 1rem 1rem;
    }
    
    /* Make cards in drawers full-width and more mobile-friendly */
    .canonical-state-grid,
    .artifact-metadata-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .canonical-meta,
    .canonical-flags {
        flex-wrap: wrap;
    }
    
    /* Ensure drawer headers have proper close buttons on mobile */
    .drawer-close {
        width: 44px;
        height: 44px;
        font-size: 1.4rem;
    }
    
    .thread-settings-header h2,
    .thread-participants-header h2,
    .participants-drawer-header h2 {
        font-size: 1.1rem;
    }
}

.drawer-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.drawer-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.drawer-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.loading {
    text-align: center;
    color: #666;
    font-size: 1rem;
}

/* Chat Window Container */
.chat-window {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    position: relative;
}

.chat-window-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.4s ease-out, flex 0.4s ease-out, max-height 0.4s ease-out;
}

/* ============================================
   FULLSCREEN INPUT MODE
   ============================================ */

/* When input is fullscreen, hide the message body */
.chat-window.input-fullscreen .chat-window-body {
    flex: 0;
    min-height: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Footer expands to fill the space */
.chat-window.input-fullscreen .chat-window-footer {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-top: none;
    padding: 1rem;
    transition: flex 0.4s ease-out;
}

/* Footer collapse transition (when exiting fullscreen) */
.chat-window-footer {
    transition: flex 0.4s ease-out, padding 0.3s ease-out;
}

@keyframes footer-expand {
    from {
        opacity: 0.9;
    }
    to {
        opacity: 1;
    }
}

/* Hide scroll-to-bottom button in fullscreen */
.chat-window.input-fullscreen .scroll-to-bottom-button {
    display: none;
}

/* Loading State */
.chat-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #555;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #999;
    font-size: 1rem;
}

/* Messages Area */
.messages-area,
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

/* Scroll-to-bottom button (ChatGPT-style) */
.scroll-to-bottom-button {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	bottom: 7.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    box-shadow: 0 10px 15px rgba(15, 23, 42, 0.15);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    z-index: 150;
}

.scroll-to-bottom-button:hover {
    background-color: #f3f4f6;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* Fullscreen editor: markdown toolbar + recipe selector             */
/* ═══════════════════════════════════════════════════════════════════ */

.markdown-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0.75rem 0.75rem 0 0;
    flex-wrap: wrap;
    min-height: 40px;
}

.md-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    background: transparent;
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.md-toolbar-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.md-toolbar-btn:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 1px;
}

.md-toolbar-btn.active {
    background: #e0e7ff;
    color: #4338ca;
    border-color: #c7d2fe;
}

.md-toolbar-separator {
    width: 1px;
    height: 20px;
    background: #d1d5db;
    margin: 0 0.25rem;
    flex-shrink: 0;
}

.md-toolbar-spacer {
    flex: 1;
    min-width: 0.25rem;
    border-right: 1px solid #d1d5db;
    margin-right: 0.25rem;
    padding-right: 0.25rem;
}

/* ── Right-side action buttons (uniform layout) ──────────── */
/* All 4 share: border, padding, gap, inline-flex, height */
.md-toolbar-btn.mode-toggle,
.md-toolbar-btn.recipe-toolbar-toggle,
.md-toolbar-btn.prompt-mode-btn,
.md-toolbar-btn.minimize-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    height: 30px;
    padding: 0 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Per-button color overrides */
.md-toolbar-btn.mode-toggle {
    color: #6b7280;
}

.md-toolbar-btn.mode-toggle.active {
    background: #1e293b;
    color: #f8fafc;
    border-color: #1e293b;
}

.md-toolbar-btn.prompt-mode-btn {
    color: #4f46e5;
    border-color: #e0e7ff;
}

.md-toolbar-btn.prompt-mode-btn:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.md-toolbar-btn.recipe-toolbar-toggle {
    color: #6b46c1;
    border-color: #e9d8fd;
}

.md-toolbar-btn.recipe-toolbar-toggle:hover {
    background: #faf5ff;
    border-color: #c4b5fd;
    color: #5b21b6;
}

.md-toolbar-btn.recipe-toolbar-toggle.recipe-active {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    border-color: #c4b5fd;
    color: #5b21b6;
}

.md-toolbar-btn.minimize-btn {
    color: #6b7280;
}

.md-toolbar-btn.minimize-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* ── Unified toolbar button internals ────────────────────── */
.toolbar-btn-emoji {
    font-size: 0.8125rem;
    line-height: 1;
}

.toolbar-btn-text {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.toolbar-btn-svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ── Formatting buttons: tighter on all screens ──────────── */
.markdown-toolbar {
    gap: 0.125rem;
    padding: 0.375rem 0.5rem;
}

.markdown-toolbar .md-toolbar-btn:not(.mode-toggle):not(.recipe-toolbar-toggle):not(.prompt-mode-btn):not(.minimize-btn) {
    width: 28px;
    min-width: 28px;
    height: 28px;
    padding: 0;
}

.md-toolbar-separator {
    margin: 0 0.1rem;
}

/* ── Mobile: emoji only, even tighter ────────────────────── */
@media (max-width: 640px) {
    .toolbar-label-desktop {
        display: none;
    }
    .markdown-toolbar {
        gap: 0.05rem;
        padding: 0.25rem 0.3rem;
    }
    .markdown-toolbar .md-toolbar-btn:not(.mode-toggle):not(.recipe-toolbar-toggle):not(.prompt-mode-btn):not(.minimize-btn) {
        width: 24px;
        min-width: 24px;
        height: 24px;
    }
    .md-toolbar-btn.mode-toggle,
    .md-toolbar-btn.recipe-toolbar-toggle,
    .md-toolbar-btn.prompt-mode-btn,
    .md-toolbar-btn.minimize-btn {
        height: 24px;
        padding: 0 0.25rem;
        gap: 0.1rem;
    }
    .md-toolbar-spacer {
        flex: 0;
        min-width: 0;
        border-right: 1px solid #d1d5db;
        margin-right: 0.15rem;
        padding-right: 0.15rem;
        align-self: stretch;
    }
    .md-toolbar-separator {
        display: none;
    }
}
/* ── Collapsed deep mode strip ─────────────────────────── */
.deep-mode-strip {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.625rem;
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    border: 1px solid #c4b5fd;
    border-radius: 0.5rem;
    animation: deep-strip-in 0.15s ease;
}

@keyframes deep-strip-in {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}

.deep-strip-summary {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    min-width: 0;
}

.deep-strip-icon {
    font-size: 0.8125rem;
    flex-shrink: 0;
}

.deep-strip-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #5b21b6;
    white-space: nowrap;
}

.deep-strip-detail {
    font-size: 0.6875rem;
    color: #7c3aed;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deep-strip-clear {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    background: transparent;
    color: #a78bfa;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.1s ease;
}

.deep-strip-clear:hover {
    border-color: #f87171;
    color: #ef4444;
    background: rgba(254, 242, 242, 0.8);
}

@media (max-width: 640px) {
    .deep-strip-detail {
        display: none;
    }
    .deep-mode-strip {
        flex-wrap: wrap;
    }
}

/* Retry banner — shown after a billing/credits error so the user can resubmit */
.chat-retry-banner {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0 0.75rem;
}

.chat-retry-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.chat-retry-button:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

.chat-retry-button:active {
    background-color: #e5e7eb;
}

/* Chat Message Styles - v0.3 with role support */
.chat-message {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    word-wrap: break-word;
    animation: fadeIn 0.2s ease-in;
    position: relative;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Message Avatar (U for user, A for assistant) */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background-color: #2563eb;
    color: white;
}

.assistant-message .message-avatar {
    background-color: #6b7280;
    color: white;
}

/* Message Bubble */
.message-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.2rem;
    min-width: 0;
}

.chat-message.user-message .message-body {
    align-items: flex-end;
}

.message-bubble {
    display: flex;
    flex-direction: column;
    padding: 0.65rem 0.95rem;
    border-radius: 1rem;
    flex: 1;
    border: 1px solid transparent;
}

/* User Message - Right aligned with blue bubble */
.chat-message.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
    max-width: 75%;
}

/* When editing, user message expands to full width for comfortable editing */
.chat-message.user-message.is-editing {
    max-width: 100%;
    align-self: stretch;
    margin-left: 0;
}

.user-message .message-bubble {
    background-color: #f3f4f6;
    color: #0f172a;
    border-color: #e5e7eb;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Recipe submission — user message that kicks off a multi-step reasoning run.
   Visually heavier than standard messages to mark a significant timeline event. */
.chat-message.user-message.recipe-submission {
    max-width: 85%;
}

.chat-message.user-message.recipe-submission .message-bubble {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 1.5px solid #c4b5fd;
    border-left: 4px solid #8b5cf6;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.10), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chat-message.user-message.recipe-submission .message-avatar {
    background: linear-gradient(135deg, #ede9fe 0%, #c4b5fd 100%);
    border-color: #a78bfa;
}

/* Assistant Message - Left aligned with gray bubble */
.chat-message.assistant-message {
    align-self: stretch;
    flex-direction: row;
    margin-right: auto;
    padding: 0.25rem 0;
    max-width: 85%;
}

.assistant-message .message-bubble {
    background-color: transparent;
    border-color: transparent;
    padding: 0;
    border-radius: 0;
    max-width: 100%;
    min-width: 0;
}
.assistant-message .message-content {
    font-size: 1rem;
    color: #0f172a;
    padding-right: 2rem;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

/* System Message - Left aligned with gray bubble like assistant */
.chat-message.system-message {
    align-self: stretch;
    flex-direction: row;
    margin-right: auto;
    padding: 0.25rem 0;
    max-width: 85%;
}

.system-message .message-avatar {
    background-color: #f59e0b;
    color: white;
    font-size: 0.875rem;
}

.system-message .message-bubble {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    padding: 0.65rem 0.95rem;
    border-radius: 1rem;
}

.system-message .message-content {
    font-size: 0.9rem;
    color: #0f172a;
}

.system-message .message-timestamp {
    color: #9ca3af;
    font-size: 0.75rem;
}

/* Notice Message - Centered, grey, no bubble */
.chat-message.notice-message {
    align-self: center;
    color: #6b7280;
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
    padding: 0.5rem;
    max-width: 100%;
}

/* Message Content */
.message-content {
    font-size: 0.95rem;
    line-height: 1.5;
}
    .message-content h3, .message-content h2, .message-content p {
        margin-block-start: 0em;
        margin-block-end: 0em;
    }

.message-content.message-markdown {
    white-space: normal;
}

.message-content.message-markdown pre {
    white-space: pre-wrap;
}

.message-content.message-ingestion {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.message-ingestion-blocks {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.message-ingestion-block {
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.message-ingestion-block ul {
    margin: 0;    
}

/* Nested list indentation */
.message-content ul,
.message-content ol {
    padding-left: 1.5em;
    margin: 0.25em 0;
}

.message-content li > ul,
.message-content li > ol {
    margin: 0.15em 0;
    padding-left: 1.5em;
}

.message-content li {
    margin: 0.15em 0;
}

/* Message Timestamp + Actions Row */
.message-meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.1rem;
}

.user-message .message-meta-row {
    justify-content: flex-end;
    flex-direction: row-reverse;
    align-self: flex-end;
}

.assistant-message .message-meta-row {
    justify-content: flex-start;
}

.message-timestamp {
    font-size: 0.75rem;
    opacity: 0.8;
}

.user-message .message-timestamp {
    color: #4b5563;
    text-align: right;
}

.assistant-message .message-timestamp {
    color: #9ca3af;
}

.system-message .message-timestamp {
    color: #6b7280;
    font-size: 0.65rem;
}

/* Message action bar */
.message-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(2px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.chat-message:hover .message-action-bar:not(.block-action-bar) {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.message-action {
    border: none;
    background: transparent;
    padding: 0.3rem;
    border-radius: 0.4rem;
    cursor: pointer;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.message-action:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.message-action.dev-debug-action {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.65rem;
    border: 1px dashed rgba(79, 70, 229, 0.5);
    border-radius: 999px;
    background-color: rgba(99, 102, 241, 0.08);
    color: #4338ca;
}

.message-action.dev-debug-action:hover {
    background-color: rgba(99, 102, 241, 0.18);
    border-color: rgba(67, 56, 202, 0.8);
    color: #312e81;
}

.message-action svg {
    width: 15px;
    height: 15px;
}

.message-action.prompt-input-toggle {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    min-width: 32px;
}

.message-action.prompt-input-toggle.active {
    background-color: #111827;
    color: #f9fafb;
}

.message-action.interpretation-toggle {
    border: 1px solid transparent;
}

.message-action.interpretation-toggle.active {
    background-color: #0f172a;
    color: #f8fafc;
    border-color: #0f172a;
}

.prompt-input-view {
    background-color: #0f172a;
    color: #f8fafc;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    border-radius: 0.75rem;
    padding: 0.75rem 0.95rem;
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.35);
}

/* Day Divider */
.day-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0 1rem 0;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    width: 100%;
}

.day-divider span {
    padding: 0 1rem;
    background-color: white;
    position: relative;
    z-index: 1;
}

.day-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #e5e7eb;
    top: 50%;
    transform: translateY(-50%);
}

/* Input Area */
.input-area,
.chat-window-footer {
    border-top: 1px solid #e5e7eb;
    padding: 1rem;
    background-color: white;
}

/* Input Bar Styling */
.input-bar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
}

.quoted-context-panel {
    width: 100%;
    border: 1px solid #dfe3f0;
    border-radius: 0.9rem;
    padding: 0.75rem 1rem;
    background: #f7f9ff;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
}

.quoted-context-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
}

.quoted-context-panel-count {
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-weight: 600;
    font-size: 0.7rem;
}

.quoted-context-list {
    list-style: none;
    padding: 0;
    margin: 0.6rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quoted-context-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.45rem 0.5rem;
    border-radius: 0.65rem;
    background: #fff;
    border: 1px solid #e4e7ee;
}

.quoted-context-body {
    flex: 1;
    min-width: 0;
}

.quoted-context-text {
    margin: 0;
    font-size: 0.9rem;
    color: #0f172a;
    font-style: italic;
    line-height: 1.4;
}

.quoted-context-meta {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: #64748b;
}

.quoted-context-dismiss {
    border: none;
    background: transparent;
    color: #94a3b8;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0.35rem;
    padding: 0.15rem 0.35rem;
    line-height: 1;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.quoted-context-dismiss:hover,
.quoted-context-dismiss:focus-visible {
    background-color: #e2e8f0;
    color: #0f172a;
}

.message-input-wrapper {
    position: relative;
    display: flex;
    flex: 1;
}

.message-input-wrapper.dictation-active .message-input {
    color: transparent;
    caret-color: transparent;
    pointer-events: none;
}

.message-input-wrapper.dictation-active .message-input::placeholder {
    color: transparent;
}

.message-input-wrapper.dictation-active {
    background: #f8fafc;
    border: 1px solid #e0e7ff;
    border-radius: 0.75rem;
    padding: 0.25rem 0.35rem;
}

.message-input-wrapper.dictation-active.dictation-error {
    background: #fef2f2;
    border-color: #fecdd3;
}

.message-input-wrapper.dictation-active .message-input {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0.65rem 0.9rem;
}

.message-input-wrapper.dictation-active .input-accessories {
    right: 0.55rem;
}

.message-input {
    flex: 1;
    padding: 0.75rem 1rem;
    padding-right: 7.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 260px;
    overflow-y: auto;
    transition: border-color 0.2s;
}

.message-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-accessories {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    z-index: 3;
}

/* When recording, stretch accessories across the full input width
   so the waveform fills available space alongside the buttons.
   Only apply when .recording-inline is present (Recording state). */
.dictation-active .input-accessories:has(.recording-inline) {
    left: 0.5rem;
}

.input-icon-button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    line-height: 0;
    flex: 0 0 36px;
    box-sizing: border-box;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.input-icon-button svg {
    width: 20px;
    height: 20px;
}

.input-icon-button:hover:not(:disabled) {
    background-color: #eef2ff;
    color: #111827;
}

.input-icon-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.input-icon-button.send-button {
    background-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 10px 15px rgba(37, 99, 235, 0.2);
}

.input-icon-button.send-button:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.input-icon-button.send-button:disabled {
    background-color: #9ab5ff;
    color: #f5f7ff;
    box-shadow: none;
    opacity: 0.7;
}

.chat-window-footer {
    flex-shrink: 0;
}

.dictation-error-overlay {
    position: absolute;
    top: 0.3rem;
    left: 0.9rem;
    z-index: 2;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.15);
    max-width: calc(100% - 1.8rem);
    pointer-events: auto;
}


.dictation-overlay {
    position: absolute;
    top: 0.25rem;
    bottom: 0.25rem;
    left: 0.4rem;
    right: 0.4rem;
    border-radius: 0.5rem;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0;
    z-index: 2;
    pointer-events: none;
}

.dictation-overlay.recording {
    right: 5.1rem;
    padding-right: 1rem;
}

/* Inline recording indicator — sits in the input-accessories flex flow
   so it dynamically shares space with the cancel/upload/stop buttons. */
.recording-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
}

.recording-inline .dictation-waveform {
    flex: 1 1 0;
    min-width: 40px;
    min-height: 28px;
}

.recording-inline .waveform-bars {
    width: 100%;
    height: 28px;
    display: flex;
    align-items: flex-end;
    gap: 1px;
}

.recording-inline .waveform-bar {
    flex: 1;
}

.recording-inline .dictation-timer {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.dictation-overlay.recording .dictation-waveform {
    flex: 1;
    width: 100%;
    min-height: 32px;
    transform: translateY(-1px);
}

.dictation-overlay.recording .waveform-bars {
    width: 100%;
    height: 32px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

.dictation-overlay.recording .waveform-bar {
    flex: 1;
}

.dictation-overlay.recording .dictation-timer {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.dictation-overlay.transcribing {
    justify-content: center;
    right: 5.1rem;
}

.dictation-status-inline {
    font-size: 0.88rem;
    color: #374151;
}

.dictation-overlay.error {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.25rem;
}

.dictation-error-content {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
}

.dictation-error-actions {
    display: flex;
    gap: 0.75rem;
    pointer-events: auto;
}

.dictation-action-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    border: none;
    background: transparent;
    color: #2563eb;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s ease;
}

.dictation-action-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.dictation-action-link svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Audio Recovery Banner - shown when there's pending audio from previous session */
.audio-recovery-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.audio-recovery-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.audio-recovery-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.audio-recovery-text {
    font-size: 0.85rem;
    color: #92400e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-recovery-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.audio-recovery-action {
    padding: 0.35rem 0.65rem;
    border: none;
    border-radius: 0.35rem;
    background: #f59e0b;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.audio-recovery-action:hover {
    background: #d97706;
}

.audio-recovery-action.secondary {
    background: transparent;
    color: #92400e;
    border: 1px solid #d97706;
}

.audio-recovery-action.secondary:hover {
    background: rgba(217, 119, 6, 0.1);
}

.audio-recovery-dismiss {
    padding: 0.25rem;
    border: none;
    background: transparent;
    color: #92400e;
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease;
    line-height: 1;
}

.audio-recovery-dismiss:hover {
    opacity: 1;
}

.button-spinner.overlay {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.input-icon-button.stop-button {
    position: relative;
    width: 36px;
    height: 36px;
    overflow: hidden;
}

.input-icon-button.stop-button.loading svg {
    opacity: 0.2;
}

.input-icon-button.stop-button.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    margin-left: -5px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    pointer-events: none;
}

.input-icon-button.stop-button.retry {
    background-color: #dc2626;
    color: #ffffff;
    box-shadow: 0 10px 15px rgba(220, 38, 38, 0.2);
    min-width: 36px;
    max-width: 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.input-icon-button.stop-button.retry:hover:not(:disabled) {
    background-color: #b91c1c;
    color: #ffffff;
}

.input-icon-button.stop-button.retry .retry-label {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}

.input-icon-button.stop-button.loading:disabled {
    opacity: 1;
    cursor: default;
}

/* Upload audio button (during recording) */
.input-icon-button.upload-audio-button {
    color: #6b7280;
    opacity: 1;
    transition: opacity 1s ease;
}

.input-icon-button.upload-audio-button:hover:not(:disabled) {
    background-color: #eef2ff;
    color: #4f46e5;
}

.input-icon-button.upload-audio-button.fading {
    opacity: 0;
    pointer-events: none;
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar,
.messages-area::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.messages-area::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.chat-messages::-webkit-scrollbar-thumb,
.messages-area::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.messages-area::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #f3f4f6;
    border-radius: 1rem;
    margin-right: auto;
    animation: fadeIn 0.2s ease-in;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #6b7280;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-text {
    font-size: 0.85rem;
    color: #6b7280;
    font-style: italic;
    margin-left: 0.25rem;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Disabled textarea styling */
.message-input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Responsive Design for Mobile Devices */
@media (max-width: 768px) {
    .thread-page {
        height: 100dvh;
        height: 100vh;
        overflow: hidden;
    }

    .chat-container {
        position: relative;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    /* Fixed translucent header - no border */
    .chat-container > .chat-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
        height: var(--chat-header-height);
        background: rgba(255, 255, 255, 0.65);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: none !important;
        padding-top: env(safe-area-inset-top);
    }

    /* Scrollable chat area spans full viewport; content passes under header/footer */
    .chat-window {
        position: absolute;
        inset: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 0;
    }

    .chat-window-body {
        display: flex;
        flex-direction: column;
        min-height: 100%;
        padding: 0;
    }

    /* Fixed translucent footer - no border */
    .chat-window-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: rgba(255, 255, 255, 0.65);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: none !important;
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .chat-messages {
        padding: 1rem 0.75rem;
        min-height: 100%;
        padding-bottom: 8rem; /* Extra padding for sticky footer + last message actions */
        padding-top: calc(var(--chat-header-height) + env(safe-area-inset-top) + 0.5rem); /* Account for fixed header + safe area + buffer */
    }

    /* Fade transition for accessory buttons on mobile */
    .input-accessories .expand-button,
    .input-accessories .input-actions {
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    /* Hide accessory buttons (except send and mic) when there's content on mobile */
    .message-input-wrapper.has-content .input-accessories .expand-button,
    .message-input-wrapper.has-content .input-accessories .input-actions {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
    
    /* Reduce right padding on input when content is present and buttons are hidden */
    .message-input-wrapper.has-content .message-input {
        padding-right: 5.5rem; /* Space for mic + send only */
    }

    /* FULLSCREEN INPUT MODE ON MOBILE */
    /* Override the fixed positioning when in fullscreen mode */
    .chat-window.input-fullscreen {
        display: flex;
        flex-direction: column;
    }

    .chat-window.input-fullscreen .chat-window-footer {
        position: relative !important;
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: auto;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        padding: 0;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        background: #ffffff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    /* Hide the header when in fullscreen mode on mobile */
    .chat-window.input-fullscreen ~ .chat-header,
    .chat-container:has(.chat-window.input-fullscreen) > .chat-header {
        display: none;
    }

/* Mobile drawers: full-screen overlays above sticky header/footer */
.thread-settings-layer,
.thread-participants-layer,
.participants-drawer-layer,
.thread-usage-layer {
    position: fixed;
    inset: 0;
    z-index: 200; /* Above sticky header/footer (z-index: 100) */
}

.thread-settings-layer .thread-settings-scrim,
.thread-participants-layer .thread-participants-scrim,
.participants-drawer-layer .participants-drawer-scrim,
.thread-usage-layer .thread-usage-scrim {
    top: 0;
}

.thread-settings-drawer,
.thread-participants-drawer,
.participants-drawer,
.thread-usage-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
    border: none;
}

/* Scroll-to-bottom button on mobile */
.scroll-to-bottom-button {
    bottom: 8rem; /* Higher to sit above footer */
    z-index: 150; /* Above header/footer to remain visible */
}

/* Tighter gap between avatar and message on mobile */
.chat-message {
    gap: 0.3rem;
}
    
.chat-message.user-message {
    max-width: 85%;
    font-size: 0.9rem;
}

.chat-message.user-message.is-editing {
    max-width: 100%;
}

/* Assistant messages use more width on mobile */
.chat-message.assistant-message {
    max-width: 95%;
}

.message-avatar {
    background-color: #2563eb;
    color: white;
}

.message-bubble {
    padding: 0.6rem 0.85rem;
}
    
.messages-area,
.chat-messages {
    gap: 0.75rem;
}
    
.message-content {
    font-size: 0.9rem;
}

/* Reduce right padding on assistant messages for mobile */
.assistant-message .message-content {
    padding-right: 0.5rem;
}

    .day-divider {
        margin: 1rem 0 0.75rem 0;
        font-size: 0.7rem;
    }
    
    .input-area,
    .chat-input {
        padding: 0.75rem;
    }
    
    .input-bar {
        gap: 0.5rem;
    }
    
    .message-input {
        padding: 0.6rem 0.85rem;
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    /* Bottom-align buttons with textarea on mobile */
    .input-accessories {
        top: auto;
        bottom: 0.25rem;
        transform: none;
    }
    
    .send-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .typing-indicator {
        max-width: 180px;
    }
    
    .typing-text {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
/* Minimal padding on smallest screens */
.artifact-page-header {
    padding: 0.4rem 0.4rem;
    min-height: 44px;
}

/* Adjust header height for smaller mobile screens */
.chat-container .chat-header {
    min-height: 44px;
}

/* Smaller padding on small screens - sticky positioning handles the rest */
.chat-messages {
    padding-bottom: 10rem !important; /* Extra padding for sticky footer */
}
    
.artifact-breadcrumb-button {
    padding: 0.3rem 0.4rem;
    font-size: 1.3rem;
    min-width: 40px;
    min-height: 40px;
}

.artifact-breadcrumb-separator {
    font-size: 0.9rem;
    margin: 0 0.15rem;
}
    
.chat-message.user-message {
    max-width: 90%;
    font-size: 0.85rem;
}

    /* Assistant messages use nearly full width on small phones */
    .chat-message.assistant-message {
        max-width: 98%;
    }

    .message-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }

    .message-bubble {
        padding: 0.6rem 0.85rem;
    }
    
    .message-content {
        font-size: 0.85rem;
    }

    /* Minimal right padding on assistant messages for small phones */
    .assistant-message .message-content {
        padding-right: 0.25rem;
    }
    
    .message-timestamp {
        font-size: 0.65rem;
    }

    .system-message {
        font-size: 0.8rem;
        padding: 0.5rem 0.65rem;
    }

    .notice-message {
        font-size: 0.8rem;
    }

    .day-divider {
        margin: 0.75rem 0 0.5rem 0;
        font-size: 0.65rem;
    }
    
    .messages-area,
    .chat-messages {
        gap: 0.6rem;
    }
    
    .input-area,
    .chat-input {
        padding: 0.6rem;
    }
    
    .input-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .message-input {
        width: 100%;
    }
    
    .send-button {
        width: 100%;
        padding: 0.75rem;
    }
    
    .chat-loading,
    .chat-empty {
        padding: 2rem 1rem;
        font-size: 0.9rem;
    }
    
    .typing-indicator {
        max-width: 150px;
        padding: 0.6rem 0.85rem;
    }
}

/* Quoted context preview */
.quoted-context-preview {
    align-self: flex-end;
    max-width: 70%;
    background-color: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 0.85rem;
    padding: 0.45rem 0.75rem;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    color: #1e293b;
    line-height: 1.35;
    box-shadow: 0 5px 12px rgba(99, 102, 241, 0.08);
}

.chat-message.assistant-message .quoted-context-preview {
    align-self: flex-start;
}

.quote-action-bubble {
    position: fixed;
    transform: translate(-50%, -140%);
    z-index: 1500;
    pointer-events: auto;
}

.quote-action-button {
    pointer-events: auto;
    border: none;
    border-radius: 999px;
    background: #111827;
    color: #f8fafc;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.25);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.quote-action-button:hover,
.quote-action-button:focus-visible {
    background: #1d4ed8;
    color: #ffffff;
    outline: none;
}

.quoted-context-label {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.65rem;
    color: #475569;
    margin-bottom: 0.15rem;
}

.interpretation-json-view {
    margin-top: 0.65rem;
    background-color: #0f172a;
    color: #f8fafc;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.45;
    white-space: pre-wrap;
    border-radius: 0.75rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    max-height: 320px;
    overflow-y: auto;
}

.interpretation-empty {
    margin-top: 0.65rem;
    font-size: 0.85rem;
    color: #475569;
    background-color: #f8fafc;
    border: 1px dashed #cbd5f5;
    border-radius: 0.75rem;
    padding: 0.6rem 0.85rem;
}

.m0-helper-text {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.4;
}

.m0-empty-state {
    border: 1px dashed #c7d2fe;
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    color: #475569;
    background-color: #f8fafc;
}

.m0-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.65rem;
    margin-bottom: 0.65rem;
}

.m0-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.m0-section h5 {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
}

.m0-field-value {
    font-size: 0.95rem;
    color: #0f172a;
}

.m0-tag-list {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.m0-tag {
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background-color: #eef2ff;
    color: #312e81;
    font-size: 0.75rem;
    font-weight: 600;
}

.m0-inline-muted {
    font-size: 0.75rem;
    color: #94a3b8;
}

.m0-list {
    margin: 0;
    padding-left: 1rem;
    color: #27303f;
    font-size: 0.9rem;
}

.m0-raw-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.m0-raw-button,
.m0-copy-button {
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #1e1b4b;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.m0-raw-button:hover,
.m0-copy-button:hover,
.m0-raw-button:focus-visible,
.m0-copy-button:focus-visible {
    background-color: #e0e7ff;
    border-color: #a5b4fc;
}

.m0-raw-json {
    margin-top: 0.5rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    background-color: #0f172a;
    color: #f8fafc;
    border-radius: 0.75rem;
    padding: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    max-height: 240px;
    overflow-y: auto;
}

.inspector-section-body {
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.canonical-state-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.canonical-state-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.canonical-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.canonical-version-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background-color: #eef2ff;
    color: #312e81;
    font-size: 0.8rem;
    font-weight: 600;
}

.canonical-updated {
    font-size: 0.85rem;
    color: #475569;
}

.canonical-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.canonical-flag {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.canonical-flag.flag-positive {
    background-color: #ecfccb;
    border-color: #bef264;
    color: #3f6212;
}

.canonical-flag.flag-warning {
    background-color: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.canonical-flag.flag-neutral {
    background-color: #f1f5f9;
    border-color: #cbd5f5;
    color: #475569;
}

.canonical-state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.canonical-field {
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    padding: 0.6rem 0.75rem;
    background-color: #ffffff;
}

.canonical-field-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.canonical-field-value {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    color: #0f172a;
    word-break: break-word;
}

.canonical-arrays {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.canonical-array {
    border: 1px solid #e5e7eb;
    border-radius: 0.65rem;
    padding: 0.6rem 0.75rem;
    background-color: #ffffff;
}

.canonical-array-list {
    margin: 0.35rem 0 0 1.25rem;
    padding: 0;
    color: #0f172a;
    font-size: 0.92rem;
    list-style: disc;
}

.canonical-array-empty {
    margin-top: 0.35rem;
    font-size: 0.88rem;
    color: #94a3b8;
    font-style: italic;
}

.canonical-raw-toggle-row {
    display: flex;
    justify-content: flex-end;
}

.canonical-raw-toggle {
    border: 1px solid #cbd5f5;
    background-color: #eef2ff;
    color: #312e81;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.canonical-raw-toggle:hover,
.canonical-raw-toggle:focus-visible {
    background-color: #e0e7ff;
    border-color: #a5b4fc;
}

.canonical-raw-json {
    margin: 0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    background-color: #0f172a;
    color: #f8fafc;
    border-radius: 0.75rem;
    padding: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    max-height: 240px;
    overflow: auto;
}

.canonical-empty-state {
    font-size: 0.85rem; 
    color: #475569;
    background-color: #f8fafc;
    border: 1px dashed #cbd5f5;
}

.artifact-composer-panel {
    width: 100%;
    margin-bottom: 0.85rem;
    padding: 1rem;
    border: 1px solid #dfe3f0;
    border-radius: 0.9rem;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.artifact-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.artifact-field:last-of-type {
    margin-bottom: 0.5rem;
}

.artifact-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.artifact-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.55rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.artifact-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.artifact-select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%),
                      linear-gradient(135deg, #94a3b8 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.artifact-textarea {
    min-height: 64px;
    resize: vertical;
}

.artifact-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.artifact-action {
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.artifact-action.secondary {
    background: #f1f5f9;
    color: #475569;
}

.artifact-action.secondary:hover {
    background: #e2e8f0;
}

.artifact-action.primary {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.artifact-action.primary:disabled {
    background: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
}

.artifact-error {
    margin-bottom: 0.5rem;
    color: #b91c1c;
    font-size: 0.85rem;
}

/* Mobile full-screen modal for artifact composer */
@media (max-width: 640px) {
    .artifact-composer-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 1rem;
        padding-top: env(safe-area-inset-top, 1rem);
        padding-bottom: env(safe-area-inset-bottom, 1rem);
        border: none;
        border-radius: 0;
        box-shadow: none;
        z-index: 1000;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .artifact-composer-panel .artifact-field {
        flex-shrink: 0;
    }

    .artifact-composer-panel .artifact-profile-field {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .artifact-composer-panel .artifact-actions {
        flex-shrink: 0;
        padding-top: 0.75rem;
        border-top: 1px solid #e5e7eb;
        margin-top: auto;
    }
}

.input-icon-button.artifact-trigger.active {
    background-color: #eef2ff;
    color: #1d4ed8;
}

.artifact-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    border: 1px solid #c7d2fe;
    background-color: #eef2ff;
    color: #312e81;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.artifact-thread-callout {
    display: flex;
    gap: 0.75rem;
    border: 1px solid #e0e7ff;
    border-radius: 0.85rem;
    padding: 0.75rem 1rem;
    background: #f8f9ff;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.artifact-thread-title {
    margin: 0;
    font-weight: 600;
    color: #1e1b4b;
}

.artifact-thread-text {
    margin: 0.15rem 0 0;
    color: #475569;
    font-size: 0.85rem;
}

.related-artifacts-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.related-artifact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.75rem 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.related-artifact-row:hover,
.related-artifact-row:focus-visible {
    border-color: #c7d2fe;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.related-artifact-row-main {
    flex: 1;
    min-width: 0;
}

.related-artifact-row-title {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-artifact-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #475569;
}

.related-artifact-chevron {
    font-size: 1.25rem;
    color: #94a3b8;
}

.related-artifacts-loading,
.related-artifacts-empty,
.related-artifacts-error {
    padding: 0.75rem;
    border: 1px dashed #d1d5db;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.related-artifacts-error {
    border-color: #fecaca;
    color: #b91c1c;
    background-color: #fef2f2;
}

.artifact-state-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.artifact-state-badge.state-running {
    background-color: #e0f2fe;
    color: #0369a1;
}

.artifact-state-badge.state-complete {
    background-color: #dcfce7;
    color: #166534;
}

.artifact-state-badge.state-failed {
    background-color: #fee2e2;
    color: #b91c1c;
}

.artifact-state-badge.state-idle {
    background-color: #f3f4f6;
    color: #475569;
}

.artifact-viewer {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
}

.artifact-content-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.artifact-header-left {
    flex: 1 1 320px;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.artifact-header-right {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

@media (max-width: 640px) {
    .artifact-header-right {
        width: 100%;
        align-items: flex-start;
    }
}

.artifact-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.artifact-title-label-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.artifact-title-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    font-weight: 600;
}

.artifact-title-editor {
    display: flex;
    align-items: center;
    min-height: 52px;
}

.artifact-title-display {
    border: none;
    background: transparent;
    padding: 0.15rem 0.4rem;
    margin: -0.15rem -0.4rem;
    font-size: 1.85rem;
    font-weight: 700;
    color: #0f172a;
    text-align: left;
    width: 100%;
    border-radius: 0.65rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.artifact-title-display:hover,
.artifact-title-display:focus-visible {
    background-color: #f8fafc;
    color: #0f172a;
    outline: none;
}

.artifact-title-display:focus-visible {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35);
}

.artifact-title-input {
    width: 100%;
    border: none;
    border-bottom: 2px solid #4338ca;
    font-size: 1.85rem;
    font-weight: 700;
    padding: 0.2rem 0;
    background: transparent;
    color: #0f172a;
}

.artifact-title-input:focus {
    outline: none;
    border-bottom-color: #312e81;
}

.artifact-title-input:disabled {
    border-bottom-color: #cbd5f5;
    opacity: 0.7;
}

.artifact-actions-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.artifact-inline-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.artifact-inline-action.success {
    background-color: #dcfce7;
    color: #166534;
}

.artifact-inline-action.warning {
    background-color: #fef3c7;
    color: #92400e;
}

.artifact-inline-action.neutral {
    background-color: #f1f5f9;
    color: #475569;
}

.artifact-inline-action.danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.artifact-inline-action.success:hover,
.artifact-inline-action.warning:hover,
.artifact-inline-action.neutral:hover,
.artifact-inline-action.danger:hover {
    opacity: 0.85;
}

.artifact-inline-action:focus-visible {
    outline: 2px solid #c7d2fe;
    outline-offset: 2px;
}

.artifact-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid #cbd5f5;
    background-color: #f8faff;
    color: #312e81;
}

.artifact-badge.success {
    background-color: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.artifact-badge.warning {
    background-color: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.artifact-badge.neutral {
    background-color: #e2e8f0;
    border-color: #cbd5f5;
    color: #475569;
}

.artifact-inline-note {
    font-size: 0.8rem;
    color: #475467;
    background-color: #f8fafc;
    padding: 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.artifact-inline-note.success {
    border-color: #86efac;
    background-color: #dcfce7;
}

.artifact-inline-note.warning {
    border-color: #fcd34d;
    background-color: #fef3c7;
}

.artifact-inline-note.neutral {
    border-color: #cbd5f5;
    background-color: #f1f5f9;
}

.artifact-inline-note.danger {
    border-color: #fca5a5;
    background-color: #fee2e2;
}

.artifact-inline-note strong {
    font-weight: 700;
    color: inherit;
}

.artifact-inline-note svg {
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
}

.artifact-inline-note p {
    margin: 0;
    color: inherit;
    line-height: 1.4;
}

.artifact-inline-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.artifact-inline-action-group.success {
    background-color: #dcfce7;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.artifact-inline-action-group.warning {
    background-color: #fef3c7;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.artifact-inline-action-group.neutral {
    background-color: #f1f5f9;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.artifact-inline-action-group.danger {
    background-color: #fee2e2;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

/* Artifact Viewer scoped styles */
.artifact-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.artifact-viewer-body {
    flex: 1;
    padding: 1.5rem;
    background-color: #f8fafc;
    overflow: auto;
}

.artifact-state-card {
    border: 1px dashed #cbd5f5;
    border-radius: 1rem;
    background-color: #fff;
    padding: 2rem 1.5rem;
    text-align: center;
    color: #475467;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 220px;
    box-shadow: inset 0 0 0 2px rgba(148, 163, 184, 0.08);
}

    .artifact-state-card.artifact-error {
        border-color: #fecaca;
        color: #b42318;
        background-color: #fff5f5;
    }

    .artifact-state-card.artifact-empty {
        border-style: solid;
    }

.artifact-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.artifact-content-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 25px 45px rgba(15, 23, 42, 0.08);
}

.artifact-content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.5rem 1.75rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.artifact-header-left,
.artifact-header-right {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 240px;
}

.artifact-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.artifact-title-label-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.artifact-title-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    font-weight: 600;
}

.artifact-type-chip {
    padding: 0.1rem 0.65rem;
    border-radius: 999px;
    background-color: #eef2ff;
    color: #3730a3;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.artifact-title-editor {
    display: flex;
}

.artifact-title-display {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    font-size: 1.65rem;
    font-weight: 700;
    color: #0f172a;
    text-align: left;
    cursor: pointer;
}

    .artifact-title-display:hover,
    .artifact-title-display:focus-visible {
        color: #111827;
    }

.artifact-title-input {
    width: 100%;
    font-size: 1.65rem;
    font-weight: 600;
    border: 1px solid #cbd5f5;
    border-radius: 0.75rem;
    padding: 0.35rem 0.65rem;
}

.artifact-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
}

.artifact-inline-action {
    border: 1px solid #d0d7ec;
    border-radius: 999px;
    background-color: #ffffff;
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.45rem 1.15rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

    .artifact-inline-action:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

    .artifact-inline-action.primary {
        background-color: #111827;
        color: #f8fafc;
        border-color: #111827;
    }

    .artifact-inline-action.ghost {
        background-color: transparent;
    }

    .artifact-inline-action.danger {
        background-color: #fee2e2;
        border-color: #fecaca;
        color: #b42318;
    }

    .artifact-inline-action.success {
        background-color: #dcfce7;
        border-color: #86efac;
        color: #14532d;
    }

    .artifact-inline-action.warning {
        background-color: #fef3c7;
        border-color: #fde047;
        color: #92400e;
    }

    .artifact-inline-action.neutral {
        background-color: #f1f5f9;
        border-color: #e2e8f0;
        color: #475569;
    }

.artifact-inline-note {
    border-radius: 0.65rem;
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 500;
    background-color: #eef2ff;
    color: #3730a3;
}

    .artifact-inline-note.error {
        background-color: #fef2f2;
        color: #b42318;
    }

    .artifact-inline-note.warning {
        background-color: #fffbeb;
        color: #92400e;
    }

    .artifact-inline-note.success {
        background-color: #ecfdf5;
        color: #0f766e;
    }

.artifact-metadata-grid {
    padding: 1.5rem 1.75rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.artifact-meta-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    padding: 1.1rem 1.25rem;
    background-color: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 100%;
}

.artifact-meta-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

    .artifact-meta-card-header h3 {
        margin: 0;
        font-size: 1rem;
        color: #0f172a;
    }

    .artifact-meta-card-header p {
        margin: 0.1rem 0 0;
        color: #64748b;
        font-size: 0.85rem;
    }

.artifact-meta-list {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.artifact-meta-item {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.95rem;
}

    .artifact-meta-item dt {
        margin: 0;
        color: #64748b;
        font-weight: 500;
    }

    .artifact-meta-item dd {
        margin: 0;
        color: #0f172a;
        font-weight: 600;
    }

.artifact-meta-sub {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: #475569;
}

.artifact-code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    background-color: #0f172a;
    color: #f8fafc;
    padding: 0.2rem 0.5rem;
    border-radius: 0.4rem;
}

.artifact-badge {
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid transparent;
}

    .artifact-badge.success {
        background-color: #dcfce7;
        border-color: #86efac;
        color: #166534;
    }

    .artifact-badge.warning {
        background-color: #fef3c7;
        border-color: #fcd34d;
        color: #92400e;
    }

    .artifact-badge.neutral {
        background-color: #e2e8f0;
        border-color: #cbd5f5;
        color: #475569;
    }

.artifact-persistence-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

    .artifact-persistence-details > div {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
    }

.artifact-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    font-weight: 600;
}

.artifact-persistence-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.artifact-persist-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.artifact-field {
    flex: 1 1 220px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

    .artifact-field.full {
        flex-basis: 100%;
    }

    .artifact-field label {
        font-size: 0.85rem;
        font-weight: 600;
        color: #475467;
    }

        .artifact-field label .required {
            color: #b42318;
            font-weight: 700;
        }

    .artifact-field input {
        border: 1px solid #d0d7ec;
        border-radius: 0.65rem;
        padding: 0.5rem 0.75rem;
        font-size: 0.95rem;
    }

.artifact-persist-actions {
    display: flex;
    gap: 0.75rem;
}

.artifact-content-body {
    padding: 1.5rem 1.75rem 1.75rem;
    border-top: 1px solid #e2e8f0;
    min-height: 0;
    overflow: auto;
}

.artifact-raw-text {
    margin: 0;
    background-color: #0f172a;
    color: #f8fafc;
    border-radius: 0.85rem;
    padding: 1rem 1.25rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
}

.artifact-markdown {
    color: #0f172a;
    line-height: 1.65;
}

.artifact-status-control {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-end;
}

.artifact-status-chip {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #0f172a;
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.artifact-status-chip .artifact-status-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.68rem;
    color: #6b7280;
}

.artifact-status-chip .artifact-status-caret {
    font-size: 0.75rem;
    color: #94a3b8;
}

.artifact-status-chip.draft {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    color: #0f172a;
}

.artifact-status-chip.published {
    background-color: #ecfdf3;
    border-color: #bbf7d0;
    color: #166534;
}

.artifact-status-chip.archived {
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    color: #6b7280;
}

.artifact-status-chip.busy {
    opacity: 0.75;
    cursor: progress;
}

.artifact-status-menu {
    position: absolute;
    top: 110%;
    right: 0;
    min-width: 180px;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    padding: 0.35rem;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.artifact-status-option {
    border: none;
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.artifact-status-option:hover:not(:disabled),
.artifact-status-option:focus-visible:not(:disabled) {
    background-color: #eef2ff;
}

.artifact-status-option.active {
    background-color: #e0f2fe;
    color: #0ea5e9;
    cursor: default;
}

.artifact-status-option:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Thread Not Found State - Error Page Styling */
.thread-not-found-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 2rem;
}

.thread-not-found-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
    max-width: 400px;
    width: 100%;
}

.not-found-icon {
    width: 64px;
    height: 64px;
    color: #f87171;
}

.not-found-icon svg {
    width: 100%;
    height: 100%;
}

.thread-not-found-card h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.thread-not-found-card p {
    margin: 0;
    font-size: 1rem;
    color: #64748b;
    max-width: 320px;
}

.not-found-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
    justify-content: center;
}

.not-found-actions .primary-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    background: #2563eb;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.not-found-actions .primary-button:hover,
.not-found-actions .primary-button:focus-visible {
    background: #1d4ed8;
}

.not-found-actions .primary-button:active {
    transform: scale(0.98);
}

.not-found-actions .secondary-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: #ffffff;
    color: #374151;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.not-found-actions .secondary-button:hover,
.not-found-actions .secondary-button:focus-visible {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Mobile responsiveness for thread not found */
@media (max-width: 480px) {
    .thread-not-found-card {
        padding: 1.5rem;
    }

    .thread-not-found-card h2 {
        font-size: 1.25rem;
    }

    .not-found-icon {
        width: 48px;
        height: 48px;
    }
}

/* Thread intelligence row — mobile overflow fix */
@media (max-width: 640px) {
    .thread-intel-row {
        max-width: 100%;
        overflow: hidden;
    }

    .thread-intel-title {
        font-size: 0.95rem;
    }

    .thread-intel-secondary {
        flex-direction: column;
        gap: 4px;
    }

    .thread-secondary-stats {
        flex-wrap: wrap;
    }
}