:root {
    --bg-main: #f8f9fb;
    --bg-sidebar: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.85);
    --text-primary: #1a1d24;
    --text-secondary: #6b7280;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.1);
    --border: #e5e7eb;
    --sidebar-width: 260px;
    --agent-panel-width: 660px;
    --agent-panel-wide-width: 940px;
    --agent-panel-min-width: 360px;
    --agent-panel-narrow-width: 600px;
    --prd-drawer-width: 760px;
    --prd-drawer-min-width: 320px;
    --prd-drawer-collapsed-width: 520px;
    --annotation-drawer-width: 360px;
    --viewport-min-width: 440px;
    --resize-breakpoint-width: 860px;
    --header-height: 70px;
    --status-height: 30px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

body.is-resizing-agent {
    cursor: col-resize;
    user-select: none;
}

body.is-resizing-prd-drawer {
    cursor: col-resize;
    user-select: none;
}

body.is-resizing-prd-drawer iframe,
body.is-resizing-agent iframe {
    pointer-events: none !important;
}

body.is-resizing-agent .sidebar {
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

body.is-resizing-prd-drawer .annotation-drawer {
    transition: opacity 0.18s ease, border-color 0.18s ease;
}

.shell-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

body.is-share-mode .sidebar,
body.is-share-mode .agent-workbench {
    display: none !important;
}

body.is-share-mode .main-content {
    width: 100vw;
    flex: 1 1 auto;
}

body.is-share-mode .content-header {
    padding: 0 24px;
}

body.is-share-mode .version-row__actions,
body.is-share-mode .version-panel__footer {
    display: none;
}

body.is-share-mode #annotatorBtn,
body.is-share-mode #shareMenuWrapper,
body.is-share-mode #prdAiBtn,
body.is-share-mode #prdEditBtn,
body.is-share-mode #prdSaveBtn,
body.is-share-mode #prdCancelEditBtn {
    display: none !important;
}

/* Sidebar Styling */
.sidebar {
    position: relative;
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar.is-agent-open {
    width: var(--agent-panel-width);
    flex-basis: var(--agent-panel-width);
    background-color: #070b16;
    border-right-color: rgba(15, 23, 42, 0.24);
}

.sidebar.is-agent-open.is-agent-session-open {
    width: var(--agent-panel-width);
    flex-basis: var(--agent-panel-width);
}

.sidebar.is-agent-open .page-nav,
.sidebar.is-agent-open .sidebar-footer {
    display: none;
}

.sidebar.is-agent-open .sidebar-header {
    background: transparent;
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

.sidebar-agent-controls {
    display: none;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-end;
}

.sidebar.is-agent-open .sidebar-agent-controls {
    display: flex;
}

.agent-resize-handle {
    position: absolute;
    top: 0;
    right: -5px;
    bottom: 0;
    width: 10px;
    z-index: 220;
    display: none;
    cursor: col-resize;
}

.sidebar.is-agent-open .agent-resize-handle {
    display: block;
}

.agent-resize-handle::after {
    content: '';
    position: absolute;
    top: 0;
    right: 4px;
    width: 2px;
    height: 100%;
    background: transparent;
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.agent-resize-handle:hover::after,
body.is-resizing-agent .agent-resize-handle::after {
    background: rgba(125, 211, 252, 0.72);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.16);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Logo text color spans removed in HTML */

.page-nav {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 12px 12px;
}

.nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    font-weight: 600;
}

.nav-action-btn {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.16s ease;
    flex: 0 0 auto;
}

.nav-action-btn:hover {
    color: var(--accent);
    border-color: rgba(99, 102, 241, 0.24);
    background: rgba(99, 102, 241, 0.08);
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
    position: relative;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    padding-right: 40px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-link__label {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.nav-link__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-link__badge {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.nav-item__delete {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.16s ease;
    opacity: 0;
}

.nav-item:hover .nav-item__delete,
.nav-link.active .nav-item__delete {
    opacity: 1;
}

.nav-item__delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.nav-item__more {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.16s ease;
    opacity: 0;
}

.nav-item:hover .nav-item__more,
.nav-link.active + .nav-item__more,
.nav-item.is-menu-open .nav-item__more {
    opacity: 1;
}

.nav-item__more:hover,
.nav-item.is-menu-open .nav-item__more {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text-primary);
}

.nav-item__menu {
    position: absolute;
    top: calc(100% - 2px);
    right: 10px;
    min-width: 132px;
    padding: 6px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
    z-index: 6;
}

.nav-item.is-menu-open .nav-item__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-item__menu-btn {
    width: 100%;
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #dc2626;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.nav-item__menu-btn:hover {
    background: rgba(239, 68, 68, 0.08);
}

.nav-item__menu-btn.nav-item__menu-btn--rename {
    color: var(--text-primary);
}

.nav-item__menu-btn.nav-item__menu-btn--rename:hover {
    background: rgba(15, 23, 42, 0.06);
}

.nav-link.is-deleted {
    color: #9ca3af;
    background: rgba(0, 0, 0, 0.03);
}

.nav-link.is-deleted.active {
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
}

.nav-link:hover {
    background-color: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: var(--accent-glow);
    color: var(--accent);
}

.nav-trash-toggle,
.nav-footer-btn {
    width: 100%;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
}

.nav-trash-toggle:hover,
.nav-trash-toggle.is-open,
.nav-footer-btn:hover,
.nav-footer-btn.is-open {
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-primary);
}

.nav-trash-toggle__label,
.nav-footer-btn__label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-trash-toggle__count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
}

.nav-footer-btn__arrow {
    display: inline-flex;
    align-items: center;
    opacity: 0.4;
    transition: transform 0.16s ease;
}

.nav-footer-btn:hover .nav-footer-btn__arrow {
    opacity: 0.8;
    transform: translateX(2px);
}

.nav-trash-empty {
    padding: 10px 12px;
    color: #9ca3af;
    font-size: 0.8rem;
    line-height: 1.5;
}

.nav-trash-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-trash-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.04);
}

.nav-trash-item__meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-trash-item__name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-trash-item__desc {
    font-size: 0.74rem;
    color: #9ca3af;
}

.nav-trash-item__restore {
    border: none;
    border-radius: 8px;
    padding: 7px 10px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.16s ease;
    flex: 0 0 auto;
}

.nav-trash-item__restore:hover {
    background: rgba(99, 102, 241, 0.16);
}

.nav-trash-item__force-delete {
    border: none;
    border-radius: 8px;
    padding: 7px 10px;
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.16s ease;
    flex: 0 0 auto;
}

.nav-trash-item__force-delete:hover {
    background: rgba(239, 68, 68, 0.16);
}

.nav-trash-item__actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex: 0 0 auto;
}


.trash-modal {
    position: fixed;
    inset: 0;
    z-index: 210;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.trash-modal__scrim {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.52);
    backdrop-filter: blur(8px);
}

.trash-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    overflow: auto;
    border-radius: 22px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 36px 90px rgba(15, 23, 42, 0.22);
}

.trash-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.trash-modal__title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.04rem;
    font-weight: 600;
    color: var(--text-primary);
}

.trash-modal__body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: confirm-modal-in 0.18s ease-out;
}

@keyframes confirm-modal-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.confirm-modal__scrim {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(6px);
}

.confirm-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(400px, calc(100vw - 48px));
    padding: 28px 28px 24px;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.2);
    text-align: center;
    animation: confirm-modal-dialog-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes confirm-modal-dialog-in {
    from { transform: scale(0.92) translateY(8px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.confirm-modal__icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    border-radius: 50%;
}

.confirm-modal__title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.08rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-modal__message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.confirm-modal__actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-modal__btn {
    padding: 9px 22px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s;
}

.confirm-modal__btn:active {
    transform: scale(0.97);
}

.confirm-modal__btn--cancel {
    background: #f3f4f6;
    color: var(--text-secondary);
}

.confirm-modal__btn--cancel:hover {
    background: #e5e7eb;
}

.confirm-modal__btn--danger {
    background: #ef4444;
    color: #fff;
}

.confirm-modal__btn--danger:hover {
    background: #dc2626;
}

.sidebar-footer {
    padding: 16px 12px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Share Settings Modal & Form styling */
.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 210;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.settings-modal__scrim {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.52);
    backdrop-filter: blur(8px);
}

.settings-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    width: 920px;
    max-width: calc(100vw - 32px);
    height: min(680px, calc(100vh - 48px));
    border-radius: 22px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 36px 90px rgba(15, 23, 42, 0.22);
    overflow: hidden;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-modal__dialog.is-collapsed {
    width: 480px;
}

.settings-modal__pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.settings-modal__pane--form {
    flex: 1;
    min-width: 440px;
    border-right: 1px solid rgba(15, 23, 42, 0.06);
}

.settings-modal__dialog.is-collapsed .settings-modal__pane--form {
    border-right: none;
}

.settings-modal__pane--help {
    width: 440px;
    background: rgba(15, 23, 42, 0.01);
    transition: opacity 0.2s ease, width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    flex-shrink: 0;
    border-left: 1px solid rgba(15, 23, 42, 0.06);
}

.settings-modal__dialog.is-collapsed .settings-modal__pane--help {
    width: 0;
    opacity: 0;
    border-left: none;
}

.settings-modal__help-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.settings-modal__help-content h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 8px;
    margin-bottom: 2px;
}

.settings-modal__help-content p {
    margin: 0;
}

.settings-modal__help-content ol,
.settings-modal__help-content ul {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-modal__help-content li strong {
    color: var(--text-primary);
}

.settings-modal__help-content code {
    font-family: Menlo, Monaco, Consolas, Courier New, monospace;
    font-size: 0.76rem;
    background: rgba(15, 23, 42, 0.06);
    padding: 2px 4px;
    border-radius: 4px;
    color: #0f172a;
}

.settings-modal__help-content a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.settings-modal__help-content a:hover {
    text-decoration: underline;
}

.settings-form__help-link-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent);
    font-weight: 600;
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.settings-form__help-link-btn:hover {
    color: var(--accent-hover, #1d4ed8);
}

.settings-modal__help-alert {
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.05);
    border-left: 3px solid #ef4444;
    font-size: 0.78rem;
    color: #b91c1c;
    line-height: 1.5;
    margin: 6px 0;
}

.settings-modal__help-alert--info {
    background: rgba(37, 99, 235, 0.05);
    border-left: 3px solid #2563eb;
    color: #1d4ed8;
}

.settings-modal__help-section {
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    padding-bottom: 16px;
    margin-bottom: 12px;
}

.settings-modal__help-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.settings-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 20px;
    height: 56px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    box-sizing: border-box;
}

.settings-modal__title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.04rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-modal__body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
    overflow-y: auto;
}

.settings-form__group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-form__group--checkbox {
    flex-direction: column;
    margin-top: 4px;
}

.settings-form__label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-form__input {
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.settings-form__input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.settings-form__checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.settings-form__checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    border-radius: 4px;
    border: 1px solid var(--border);
    accent-color: var(--accent);
    cursor: pointer;
}

.settings-form__hint {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.settings-form__help-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.04);
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.settings-form__help-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s;
}

.settings-form__help-link:hover {
    color: var(--accent-hover, #1d4ed8);
    text-decoration: underline;
}

.settings-modal__form-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.settings-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.98);
}

/* Main Content Styling */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.content-header {
    height: var(--header-height);
    background-color: var(--bg-header);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

#currentPageName {
    font-family: 'Outfit', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
}

/* Version Selector Wrap & Refresh Button */
.version-selector-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-sidebar);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    outline: none;
}

.version-refresh-btn:hover {
    border-color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--accent);
}

.version-refresh-btn:active {
    transform: scale(0.92);
}

.version-refresh-btn svg {
    display: block;
}

@keyframes refresh-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.version-refresh-btn.spinning svg {
    animation: refresh-spin 0.6s ease-in-out;
}

/* Version Panel */
.version-panel-wrapper {
    position: relative;
}

.version-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-sidebar);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.version-trigger:hover {
    border-color: var(--text-secondary);
    background-color: rgba(0, 0, 0, 0.03);
}

.version-trigger svg {
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.version-panel-wrapper.is-open .version-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.version-panel-wrapper.is-open .version-trigger svg {
    transform: rotate(180deg);
}

.version-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 100;
    overflow: hidden;
}

.version-panel-wrapper.is-open .version-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.version-panel__list {
    padding: 4px;
    max-height: 280px;
    overflow-y: auto;
}

.version-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease;
    gap: 8px;
}

.version-row:hover {
    background: rgba(0, 0, 0, 0.04);
}

.version-row.is-active {
    background: var(--accent-glow);
}

.version-row__label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.version-row__meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.version-row.is-active .version-row__label {
    color: var(--accent);
    font-weight: 600;
}

.version-row__badge {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 600;
    opacity: 0;
}

.version-row.is-active .version-row__badge {
    opacity: 1;
}

.version-row__actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.version-row:hover .version-row__actions {
    opacity: 1;
}

.version-row.is-active .version-row__actions {
    opacity: 0.4;
}

.version-row:hover.is-active .version-row__actions {
    opacity: 1;
}

.version-row__btn {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s ease;
    padding: 0;
}

.version-row__btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
}

.version-row__btn--delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.version-row__btn--fork:hover {
    background: var(--accent-glow);
    color: var(--accent);
}

.version-row__btn svg {
    width: 14px;
    height: 14px;
}

.version-panel__footer {
    border-top: 1px solid var(--border);
    padding: 4px;
}

.version-panel__action {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--accent);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s ease;
}

.version-panel__action:hover {
    background: var(--accent-glow);
}

.version-panel__action svg {
    flex-shrink: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.share-menu-wrapper {
    position: relative;
}

.share-trigger {
    color: var(--text-primary);
}

.share-trigger[aria-expanded="true"] {
    background: rgba(0, 0, 0, 0.05);
}

.share-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 292px;
    padding: 6px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
    z-index: 120;
}

.share-menu[hidden] {
    display: none;
}

.share-menu__divider {
    height: 1px;
    background-color: var(--border);
    margin: 6px 12px;
    opacity: 0.6;
}

.share-menu__item {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease;
}

.share-menu__item:hover,
.share-menu__item:focus-visible {
    background: rgba(0, 0, 0, 0.045);
    outline: none;
}

.share-menu__item:disabled {
    cursor: wait;
    opacity: 0.62;
}

.share-menu__icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}

.share-menu__item strong {
    display: block;
    font-size: 0.84rem;
    font-weight: 650;
    line-height: 1.25;
}

.share-menu__item small {
    display: block;
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1.35;
}

/* Viewport Area */
.viewport-container {
    flex: 1;
    background-color: #f5f5f5;
    position: relative;
    overflow: hidden;
    display: flex;
    min-height: 0;
}

.viewport-stage {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    transition: flex 0.24s ease, opacity 0.18s ease, width 0.24s ease;
}

.viewport-container:has(.annotation-drawer.is-visible.is-prd-mode.is-fullscreen) .viewport-stage {
    width: 0;
    flex: 0 0 0px;
    opacity: 0;
    pointer-events: none;
}

#mainIframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Status Bar */
.status-bar {
    height: var(--status-height);
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.isolation-badge {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    outline: none;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
}

.btn-primary:hover {
    background-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: rgba(0, 0, 0, 0.04);
    border-color: var(--text-secondary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.04);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(16, 185, 129, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.3s;
    opacity: 0;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-error {
    background: rgba(239, 68, 68, 0.95);
}
.btn-danger {
    color: #ef4444;
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.btn-danger:active {
    background-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    color: var(--text-secondary);
    border-color: var(--border);
}

/* ── Annotation Mode ──────────────────────────────────── */

#annotatorBtn.is-active,
#docVisibilityBtn.is-active {
    background-color: var(--accent-glow);
    color: var(--accent);
    border-color: var(--accent);
}

.shell-container.is-annotating .viewport-container::before {
    content: '标注模式';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(99, 102, 241, 0.9);
    color: white;
    padding: 4px 16px;
    border-radius: 0 0 8px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 150;
    letter-spacing: 0.5px;
}

.annotation-marker-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 80;
}

.annotation-marker {
    position: absolute;
    pointer-events: none;
}

.annotation-marker__badge {
    position: absolute;
    top: 0;
    left: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.66);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.18);
    backdrop-filter: blur(8px);
    opacity: 0.78;
    transition: opacity 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.annotation-marker__badge:hover,
.annotation-marker__badge:focus-visible {
    outline: none;
    opacity: 0.96;
    background: rgba(67, 56, 202, 0.88);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14), 0 10px 20px rgba(79, 70, 229, 0.22);
    transform: translateY(-1px);
}

.annotation-marker.is-active .annotation-marker__badge {
    opacity: 0.94;
    background: rgba(245, 158, 11, 0.86);
    box-shadow: 0 8px 18px rgba(245, 158, 11, 0.24);
}

.annotation-hover-box {
    position: absolute;
    display: none;
    border: 2px solid rgba(99, 102, 241, 0.95);
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16), 0 12px 28px rgba(79, 70, 229, 0.18);
    pointer-events: none;
    z-index: 190;
}

.annotation-hover-box__label {
    position: absolute;
    left: -2px;
    bottom: calc(100% + 6px);
    max-width: min(360px, calc(100vw - 48px));
    padding: 5px 8px;
    border-radius: 7px;
    background: rgba(67, 56, 202, 0.96);
    color: #fff;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 8px 18px rgba(67, 56, 202, 0.22);
}

.annotation-dialog {
    position: absolute;
    width: min(320px, calc(100% - 32px));
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(229, 231, 235, 0.7);
    border-radius: 14px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.03), 
        0 12px 30px -4px rgba(0, 0, 0, 0.08),
        0 20px 40px -8px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.6);
    z-index: 200;
    display: none;
    flex-direction: column;
    padding: 12px;
    gap: 8px;
    animation: annotationDialogFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.annotation-dialog:focus-within {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 
        0 0 0 3px var(--accent-glow),
        0 12px 30px -4px rgba(0, 0, 0, 0.08),
        0 20px 40px -8px rgba(0, 0, 0, 0.12);
}

@keyframes annotationDialogFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.annotation-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.annotation-dialog__target-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.12);
    padding: 3px 8px;
    border-radius: 6px;
    color: var(--accent);
    max-width: calc(100% - 28px);
    overflow: hidden;
    min-width: 0;
}

.annotation-dialog__target-icon {
    flex-shrink: 0;
    opacity: 0.85;
}

.annotation-dialog__selector {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    font-weight: 550;
    word-break: break-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    user-select: none;
    min-width: 0;
}

.annotation-dialog__selector:hover {
    text-decoration: underline;
    opacity: 0.9;
}

.annotation-dialog__close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.annotation-dialog__close-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
}

.annotation-dialog__textarea {
    width: 100%;
    border: none !important;
    background: transparent !important;
    padding: 2px 0 !important;
    font-family: inherit;
    font-size: 0.84rem;
    line-height: 1.5;
    resize: none;
    min-height: 72px;
    outline: none !important;
    box-shadow: none !important;
}

.annotation-dialog__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.annotation-dialog__footer .btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 28px !important;
    padding: 0 12px !important;
    font-size: 0.78rem !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    line-height: 1 !important;
}

.annotation-dialog__add-feedback {
    background: transparent !important;
    border: 1px solid var(--accent) !important;
    color: var(--accent) !important;
    transition: all 0.15s ease !important;
}

.annotation-dialog__add-feedback:hover {
    background: var(--accent-glow) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 10px var(--accent-glow) !important;
}

.annotation-dialog__save {
    background: var(--accent) !important;
    color: #fff !important;
    font-weight: 600 !important;
    transition: all 0.15s ease !important;
}

.annotation-dialog__save:hover {
    background: #4f46e5 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 10px var(--accent-glow) !important;
}

/* ── Annotation Drawer ────────────────────────────────── */

.annotation-drawer {
    position: relative;
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    border-left: 0 solid var(--border);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.98)),
        radial-gradient(circle at top right, rgba(99, 102, 241, 0.14), transparent 38%);
    overflow: hidden;
    transition: width 0.24s ease, min-width 0.24s ease, opacity 0.18s ease, border-color 0.18s ease;
    display: flex;
    flex-direction: column;
}

.annotation-drawer.is-visible {
    width: 360px;
    min-width: 360px;
    opacity: 1;
    pointer-events: auto;
    border-left-width: 1px;
}

/* ── PRD Drawer Mode, Editor & Markdown Typography moved to modules/prd/prd.css ── */

.annotation-card {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(229, 231, 235, 0.9);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.annotation-card:hover,
.annotation-card:focus-visible {
    border-color: rgba(79, 70, 229, 0.22);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.1);
    transform: translateY(-1px);
    outline: none;
}

.annotation-card.is-active {
    border-color: rgba(245, 158, 11, 0.42);
    background: rgba(255, 251, 235, 0.88);
    box-shadow: 0 14px 32px rgba(245, 158, 11, 0.16);
}

.annotation-card.is-out-of-view .annotation-card__index {
    background: rgba(100, 116, 139, 0.92);
}

.annotation-card.is-unresolved {
    border-style: dashed;
}

.annotation-card__index {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    margin-top: 2px;
}

.annotation-card__content {
    min-width: 0;
}

.annotation-card__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.annotation-card__title {
    flex: 1;
    min-width: 0;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.annotation-card__menu {
    display: flex;
    flex-shrink: 0;
    opacity: 0;
    transform: translateX(4px);
    transition: all 0.2s ease;
}

.annotation-card__more {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.annotation-card__more:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text-primary);
}

.annotation-card__menu-popover {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    z-index: 10;
    min-width: 100px;
    padding: 4px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 10px;
    box-shadow: 
        0 10px 25px -5px rgba(15, 23, 42, 0.1),
        0 8px 10px -6px rgba(15, 23, 42, 0.1);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.annotation-card__menu:hover .annotation-card__menu-popover,
.annotation-card__menu:focus-within .annotation-card__menu-popover {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.annotation-card__delete {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #ef4444;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.annotation-card:hover .annotation-card__menu,
.annotation-card:focus-visible .annotation-card__menu,
.annotation-card:focus-within .annotation-card__menu {
    opacity: 1;
    transform: translateX(0);
}

.annotation-card__delete:hover {
    background: #fef2f2;
}

.annotation-card__description {
    margin-top: 8px;
    font-size: 0.86rem;
    line-height: 1.72;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

@media (max-width: 1100px) {
    .annotation-drawer.is-visible {
        width: 320px;
        min-width: 320px;
    }

    .annotation-drawer.is-visible.is-prd-mode,
    .annotation-drawer.is-visible.is-prd-mode.is-expanded {
        width: min(460px, 46vw);
        min-width: 360px;
    }

    .annotation-drawer.is-visible.is-prd-mode.is-fullscreen {
        width: 100%;
        min-width: 100%;
    }

    .annotation-drawer.is-visible.is-prd-mode.is-fullscreen .prd-drawer-resize-handle {
        display: none !important;
    }

    .annotation-drawer.is-visible.is-prd-mode.is-user-sized {
        width: var(--prd-drawer-width);
        min-width: var(--prd-drawer-width);
    }
}

@media (max-width: 860px) {
    .viewport-container.has-drawer {
        flex-direction: column;
    }

    .annotation-drawer.is-visible {
        width: 100%;
        min-width: 100%;
        max-height: 42vh;
        border-left-width: 0;
        border-top: 1px solid var(--border);
    }

    .annotation-drawer.is-visible.is-prd-mode,
    .annotation-drawer.is-visible.is-prd-mode.is-expanded,
    .annotation-drawer.is-visible.is-prd-mode.is-user-sized {
        width: 100%;
        min-width: 100%;
    }

    .prd-drawer-resize-handle {
        display: none !important;
    }

    .annotation-dialog {
        width: calc(100% - 32px);
    }
}

/* ── Agent Workbench ─────────────────────────────────── */

.agent-entry-btn {
    display: inline-flex;
    align-items: center;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.sidebar-header .agent-entry-btn {
    width: 100%;
    min-height: 48px;
    flex: 1 1 auto;
}

.sidebar.is-agent-open .sidebar-header .agent-entry-btn {
    width: auto;
    min-width: 140px;
    min-height: auto;
    margin-left: 0;
    flex: 0 0 auto;
}

.agent-entry-btn:hover {
    background: transparent;
}

/* Tech frame inside button */
.agent-entry-btn__tech-frame {
    position: relative;
    display: block; /* Stack background terminal and foreground branding */
    width: 100%;
    height: 48px;
    padding: 0;
    background-color: rgba(15, 17, 23, 0.94); /* Flat dark glass card */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none; /* No outer border line */
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Soft natural shadow */
    transition: opacity 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}

/* Faint center glow grid */
.agent-entry-btn__tech-frame::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.01), transparent 70%);
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.agent-entry-btn:hover .agent-entry-btn__tech-frame {
    background-color: rgba(20, 22, 30, 0.98);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.agent-entry-btn:hover .agent-entry-btn__tech-frame::before {
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.02), transparent 70%);
}

/* Reset tech frame when agent is expanded */
.sidebar.is-agent-open .agent-entry-btn__tech-frame {
    height: auto !important;
    padding: 0 !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background-image: none !important;
    overflow: visible !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

.sidebar.is-agent-open .agent-entry-btn:hover .agent-entry-btn__tech-frame {
    background-color: transparent !important;
    border-color: transparent !important;
}

.sidebar.is-agent-open .agent-entry-btn__tech-frame::before {
    display: none;
}

/* Remove all box styling when collapsed to prevent boxes on the sidebar header */
.sidebar:not(.is-agent-open) .agent-entry-btn__tech-frame {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.sidebar:not(.is-agent-open) .agent-entry-btn:hover .agent-entry-btn__tech-frame {
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Corner HUD Brackets - Hidden to avoid boxy clutter */
.tech-corner {
    display: none !important;
}

/* Internal Layouts */
.agent-entry-btn__left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.sidebar:not(.is-agent-open) .agent-entry-btn__left {
    position: absolute !important;
    inset: 0 !important;
    z-index: 3 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 8px !important;          /* 8px padding + 16px header padding = 24px total left offset to align with page items */
    background: transparent !important; /* Fully transparent sidebar backdrop */
    box-sizing: border-box !important;
    border: none !important;
    pointer-events: none;
}

.sidebar:not(.is-agent-open) .agent-entry-btn__identity {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0 !important;
}

/* Prota Brand Label - Styled consistently in both states, with larger size and text gradient for brand presence */
.agent-entry-btn__label {
    font-family: 'Outfit', sans-serif !important;
    font-size: 1.35rem !important; /* Enlarged for brand presence */
    font-weight: 700 !important;
    letter-spacing: -0.02em !important;
    line-height: 1.2 !important;
    text-transform: none !important; /* camelcase Prota */
    /* Fallback gradient so Prota is always visible regardless of data-state */
    background: linear-gradient(120deg, #94a3b8 0%, #cbd5e1 50%, #e2e8f0 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    transition: none !important;
}

/* State colors mapping with text linear gradients to imply status (consistent in both collapsed & expanded) */
.sidebar.is-agent-open .agent-entry-btn__left {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex: none;
    position: relative !important;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    background: none !important;
}

.agent-entry-btn__identity {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}



.agent-entry-btn__sub-label {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 7.5px;
    font-weight: 600;
    color: rgba(99, 102, 241, 0.55);
    letter-spacing: 0.04em;
    line-height: 1.1;
    text-transform: uppercase;
    transition: opacity 0.2s ease;
}

.sidebar.is-agent-open .agent-entry-btn__sub-label {
    display: none !important;
}

/* Right Section: Mini Terminal Console */
.agent-entry-btn__terminal {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    left: 95px !important;           /* Clear space for Prota brand */
    width: 110px !important;          /* Controlled, narrower width */
    height: 24px !important;          /* Exactly 3 lines (3 * 8px) */
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;            /* Remove padding to ensure exact centering */
    overflow: hidden !important;
    display: none !important;         /* Hidden by default when idle */
    flex-direction: column !important;
    justify-content: center !important; /* Centered when < 3 lines */
    box-shadow: none !important;
    transition: opacity 0.3s ease !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    z-index: 1 !important;
    opacity: 0.85 !important;
    pointer-events: none !important;
}

/* Show terminal only when actively running or waiting */
.agent-entry-btn[data-state="running"] .agent-entry-btn__terminal,
.agent-entry-btn[data-state="testing_connection"] .agent-entry-btn__terminal,
.agent-entry-btn[data-state="waiting_approval"] .agent-entry-btn__terminal,
.agent-entry-btn[data-state="waiting_user_answer"] .agent-entry-btn__terminal {
    display: flex !important;
}

/* Always hide when sidebar is expanded (workbench open) */
.sidebar.is-agent-open .agent-entry-btn__terminal {
    display: none !important;
}

/* Terminal scanline effect */
.agent-entry-btn__terminal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        0deg,
        rgba(52, 211, 153, 0) 0%,
        rgba(52, 211, 153, 0.03) 10%,
        rgba(52, 211, 153, 0.06) 50%,
        rgba(52, 211, 153, 0.03) 90%,
        rgba(52, 211, 153, 0) 100%
    );
    background-size: 100% 4px;
    pointer-events: none;
    opacity: 0.45;
    z-index: 2;
}

.agent-entry-btn__terminal-scroll {
    /* Plain flex column — outer container handles overflow & masking */
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    gap: 1px !important;
    width: 100% !important;
    /* No overflow here — outer clips it */
    overflow: visible !important;
}

/* No separate scrollbar rule needed */



/* ── Mini Terminal: base line ─────────────────────────────── */
.agent-terminal-line {
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace !important;
    font-size: 6px !important;
    line-height: 8px !important;
    height: 8px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    margin: 0 !important;
    text-align: left !important;
    /* Default: raw output — bright white */
    color: rgba(226, 232, 240, 0.95) !important;
    text-shadow: none !important;
    animation: agent-terminal-line-in 0.06s ease-out both !important;
}

/* Spaceship-style color map --------------------------------- */

/* sys: cyan — system events like ▶ run started, ⚙ init */
.agent-terminal-line--sys {
    color: #67e8f9 !important;
    opacity: 1 !important;
}

/* prompt: dim teal — thinking / awaiting */
.agent-terminal-line--prompt {
    color: #2dd4bf !important;
    opacity: 0.85 !important;
}

/* tool: bold yellow — tool call name  ❯ tool_name */
.agent-terminal-line--tool {
    color: #fde047 !important;
    opacity: 1 !important;
    text-shadow: 0 0 6px rgba(253, 224, 71, 0.3) !important;
}

/* arg: pale lavender — argument preview */
.agent-terminal-line--arg {
    color: #c4b5fd !important;
    opacity: 0.9 !important;
}

/* ai: soft warm white — assistant text tokens */
.agent-terminal-line--ai {
    color: #f1f5f9 !important;
    opacity: 1 !important;
}

/* output: green — raw tool stdout / file content */
.agent-terminal-line--output {
    color: #86efac !important;
    opacity: 0.95 !important;
}

/* success: bright green + subtle glow */
.agent-terminal-line--success {
    color: #4ade80 !important;
    opacity: 1 !important;
    text-shadow: 0 0 5px rgba(74, 222, 128, 0.35) !important;
}

/* err: rose red */
.agent-terminal-line--err {
    color: #fb7185 !important;
    opacity: 1 !important;
}

/* Dark-sidebar override: keep colors vivid (no forced grey) */
.sidebar:not(.is-agent-open) .agent-terminal-line {
    /* inherits typed color — no override needed */
}

.sidebar:not(.is-agent-open) .agent-entry-btn__terminal::after {
    display: none !important;
}

@keyframes agent-terminal-line-in {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;   /* typed color rule controls actual opacity */
        transform: translateY(0);
    }
}

.agent-entry-btn[data-state="running"]:not(.is-open) .agent-entry-btn__tech-frame {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.12), inset 0 0 8px rgba(245, 158, 11, 0.04);
    animation: agent-tech-pulse-border 2s ease-in-out infinite;
}

@keyframes agent-tech-pulse-border {
    0%, 100% {
        border-color: rgba(245, 158, 11, 0.25);
        box-shadow: 0 0 6px rgba(245, 158, 11, 0.08), inset 0 0 6px rgba(245, 158, 11, 0.02);
    }
    50% {
        border-color: rgba(245, 158, 11, 0.55);
        box-shadow: 0 0 12px rgba(245, 158, 11, 0.22), inset 0 0 10px rgba(245, 158, 11, 0.08);
    }
}

.agent-entry-btn.is-open {
    color: #f8fafc;
}

.sidebar.is-agent-open .agent-entry-btn {
    color: #f8fafc;
}

.sidebar.is-agent-open .agent-entry-btn:hover {
    background: transparent;
}

.agent-workbench {
    position: relative;
    display: none;
    flex: 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
    padding: 0;
    z-index: 160;
    pointer-events: none;
    opacity: 0;
    transform: translate3d(-10px, 0, 0) scale(0.992);
    transform-origin: left center;
    will-change: opacity, transform;
    contain: layout paint;
    overflow: hidden;
}

.agent-workbench.is-sidebar-open {
    width: 100%;
}

.agent-workbench.is-open {
    display: flex;
    pointer-events: auto;
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    animation: agent-workbench-in 0.14s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes agent-workbench-in {
    from {
        opacity: 0.72;
        transform: translate3d(-6px, 0, 0) scale(0.996);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

.agent-workbench__surface {
    flex: 1;
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    overflow: hidden;
    color: #e2e8f0;
    background:
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.16), transparent 30%),
        radial-gradient(circle at left center, rgba(34, 197, 94, 0.08), transparent 36%),
        linear-gradient(180deg, rgba(4, 7, 17, 0.98), rgba(10, 14, 24, 0.98));
    border: 0;
    box-shadow: none;
    backdrop-filter: blur(20px);
}

.agent-workbench__main {
    position: relative;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 0 minmax(0, 1fr);
    transition: grid-template-columns 0.16s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.agent-workbench__main.is-sidebar-open {
    grid-template-columns: 280px minmax(0, 1fr);
}

.agent-workbench__panel {
    grid-column: 2;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-left: 0 solid rgba(148, 163, 184, 0.1);
    transition: border-left-width 0.22s ease;
}

.agent-workbench__main.is-sidebar-open .agent-workbench__panel {
    border-left-width: 1px;
}

.agent-workbench__header {
    display: none;
}

.agent-workbench__title {
    display: none;
}

.agent-workbench__header-spacer {
    display: none;
    min-width: 0;
}

.agent-status-context {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    color: #94a3b8;
    font-size: 0.72rem;
    line-height: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
}

.agent-timer {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.agent-header-new-session {
    height: 36px !important;
    width: 36px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    color: #dbeafe;
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(125, 211, 252, 0.18);
    flex: 0 0 auto;
}

.agent-header-new-session:hover:not(:disabled) {
    color: #f8fafc;
    background: rgba(14, 165, 233, 0.2);
    border-color: rgba(125, 211, 252, 0.3);
}

.agent-header-new-session svg {
    flex: 0 0 16px;
}

.agent-workbench__header-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.agent-session-sidebar {
    grid-column: 1;
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    width: 280px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(8, 13, 24, 0.76);
    border-right: 1px solid rgba(94, 234, 212, 0.12);
    border-radius: 0;
    box-shadow: none;
    transform: translate3d(-8px, 0, 0);
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.12s ease-out,
        transform 0.16s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
    backdrop-filter: blur(20px);
}

.agent-session-sidebar.is-open {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
}

.agent-session-sidebar > * {
    min-width: 0;
}

.agent-session-sidebar__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.agent-session-sidebar__drawer-toggle {
    display: inline-flex;
}

.agent-history-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 10px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
}

.sidebar.is-agent-open .agent-history-btn {
    display: inline-flex;
}

.agent-session-sidebar__title-wrap {
    min-width: 0;
    flex: 1;
}

.agent-session-sidebar__title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #f8fafc;
}

.agent-session-sidebar__new {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 8px !important;
}

.agent-session-sidebar__new svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.agent-session-sidebar__search {
    padding: 12px 14px 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.agent-session-sidebar__search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.54);
    color: #e2e8f0;
    font: inherit;
    outline: none;
}

.agent-session-sidebar__search input:focus {
    border-color: rgba(56, 189, 248, 0.32);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.agent-session-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.agent-session-group__label {
    padding: 0 6px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.agent-session-group__items {
    display: flex;
    flex-direction: column;
    margin-top: 8px;
}

.agent-session-item {
    position: relative;
    border: 0;
    border-radius: 0;
    background: transparent;
    transition: background-color 0.16s ease;
}

.agent-session-item + .agent-session-item {
}

.agent-session-item:hover {
    background: rgba(15, 23, 42, 0.28);
}

.agent-session-item.is-active {
    background: rgba(8, 47, 73, 0.36);
}

.agent-session-item.is-menu-open {
    z-index: 30;
}

.agent-session-item__main {
    width: 100%;
    padding: 12px 44px 12px 12px;
    border: 0;
    background: transparent;
    color: #e2e8f0;
    text-align: left;
    cursor: pointer;
}

.agent-session-item__main:not(:has(.agent-session-item__meta)) {
    padding-top: 10px;
    padding-bottom: 10px;
}

.agent-session-item__title {
    display: block;
    width: 100%;
    min-width: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-session-item__meta {
    display: block;
    width: 100%;
    min-width: 0;
    margin-top: 2px;
    font-size: 0.68rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-session-item__more {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.agent-session-item:hover .agent-session-item__more,
.agent-session-item.is-active .agent-session-item__more {
    opacity: 1;
}

.agent-session-item__more:hover {
    background: rgba(15, 23, 42, 0.8);
    color: #e2e8f0;
}

.agent-session-item__dropdown {
    position: absolute;
    top: 36px;
    right: 8px;
    z-index: 20;
    min-width: 100px;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(10, 14, 24, 0.98);
    box-shadow: 0 12px 32px rgba(2, 6, 23, 0.48);
}

.agent-session-item__dropdown-item {
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fca5a5;
    font-size: 0.76rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}

.agent-session-item__dropdown-item:hover {
    background: rgba(239, 68, 68, 0.12);
}

.agent-session-list__empty {
    margin: auto 0;
    padding: 18px 14px;
    border: 1px dashed rgba(148, 163, 184, 0.14);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.34);
    color: #94a3b8;
    font-size: 0.78rem;
    line-height: 1.6;
}

.agent-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
}

.agent-status-pill[data-state="ready"],
.agent-status-pill[data-state="succeeded"] {
    background: rgba(34, 197, 94, 0.14);
    color: #bbf7d0;
}

.agent-status-pill[data-state="running"],
.agent-status-pill[data-state="testing_connection"] {
    background: rgba(245, 158, 11, 0.18);
    color: #fde68a;
}

.agent-status-pill[data-state="waiting_approval"],
.agent-status-pill[data-state="waiting_user_answer"] {
    background: rgba(244, 63, 94, 0.18);
    color: #fecdd3;
}

.agent-status-pill[data-state="failed"],
.agent-status-pill[data-state="interrupted"] {
    background: rgba(239, 68, 68, 0.18);
    color: #fecaca;
}

.agent-config-panel__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.agent-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-field span {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.agent-field input,
.agent-field select,
.agent-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: rgba(4, 7, 17, 0.82);
    color: #f8fafc;
    font: inherit;
    outline: none;
}

.agent-field select {
    min-height: 40px;
    cursor: pointer;
}

.agent-field input:focus,
.agent-field select:focus,
.agent-field textarea:focus {
    border-color: rgba(34, 211, 238, 0.42);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.agent-field textarea {
    min-height: 164px;
    resize: vertical;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.76rem;
    line-height: 1.55;
}

.agent-field--sdk-options {
    margin-top: 4px;
}

.agent-sdk-options-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: -4px;
}

.agent-sdk-options-toolbar .agent-config-panel__hint {
    min-height: 20px;
}

.agent-config-panel__actions {
    margin-top: 14px;
    display: grid;
    grid-template-columns: auto auto auto auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.agent-config-panel__hint {
    grid-column: 1 / -1;
    min-width: 0;
    font-size: 0.76rem;
    line-height: 1.6;
    color: #94a3b8;
}

.agent-secondary-btn,
.agent-primary-btn,
.agent-icon-btn {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    font: inherit;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.agent-secondary-btn,
.agent-icon-btn {
    background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0;
}

.agent-secondary-btn:hover,
.agent-icon-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(125, 211, 252, 0.3);
    box-shadow: 0 12px 24px rgba(2, 6, 23, 0.18);
}

.agent-secondary-btn {
    height: 38px;
    padding: 0 14px;
    font-size: 0.78rem;
    font-weight: 600;
}

.agent-primary-btn {
    height: 40px;
    padding: 0 16px;
    border-color: rgba(14, 165, 233, 0.5);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.86), rgba(45, 212, 191, 0.82));
    color: #ecfeff;
    font-size: 0.8rem;
    font-weight: 700;
}

.agent-primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 30px rgba(14, 165, 233, 0.18);
}

.agent-secondary-btn:disabled,
.agent-primary-btn:disabled,
.agent-icon-btn:disabled {
    cursor: not-allowed;
    opacity: 0.48;
    transform: none;
    box-shadow: none;
}

.agent-icon-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex: 0 0 auto;
    white-space: nowrap;
}

.agent-history-btn {
    display: none;
}

[hidden] {
    display: none !important;
}

.agent-config-modal {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.agent-config-modal__scrim {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.58);
    backdrop-filter: blur(10px);
}

.agent-config-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(620px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid rgba(125, 211, 252, 0.16);
    background:
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(4, 7, 17, 0.98), rgba(10, 14, 24, 0.98));
    box-shadow: 0 40px 100px rgba(2, 6, 23, 0.46);
}

.agent-config-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 20px 14px;
}

.agent-config-modal__eyebrow {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #67e8f9;
    margin-bottom: 6px;
}

.agent-config-modal__title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.06rem;
    font-weight: 600;
    color: #f8fafc;
}

.agent-config-panel {
    padding: 0 20px 20px;
}

.agent-config-modal__dialog--wide {
    width: min(980px, calc(100vw - 32px));
    height: min(780px, calc(100vh - 64px));
}

/* ── Two-panel provider layout ────────────────────────── */

.agent-config-panel--split {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    gap: 0;
    padding: 0;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.provider-list-panel {
    border-right: 1px solid rgba(148, 163, 184, 0.14);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.6), rgba(2, 6, 23, 0.28));
}

.provider-list-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 8px;
}

.provider-list-panel__section-title {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #67e8f9;
    font-weight: 600;
}

.provider-list-panel__add-btn {
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    border-radius: 8px !important;
}

.provider-list-panel__divider {
    height: 1px;
    background: rgba(148, 163, 184, 0.1);
    margin: 4px 12px;
}

.provider-list-panel__list {
    padding: 4px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.provider-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.provider-list-item:hover {
    background: rgba(15, 23, 42, 0.7);
    border-color: rgba(148, 163, 184, 0.16);
}

.provider-list-item.is-selected {
    background: rgba(8, 47, 73, 0.62);
    border-color: rgba(45, 212, 191, 0.38);
    color: #f8fafc;
}

.provider-list-item.is-active:not(.is-selected) {
    background: rgba(15, 23, 42, 0.56);
    border-color: rgba(34, 197, 94, 0.24);
}

.provider-list-item--preset {
    color: #9ca3af;
    background: rgba(15, 23, 42, 0.3);
}

.provider-list-item--preset:hover {
    color: #e5e7eb;
}

.provider-list-item--preset.is-added {
    color: #94a3b8;
}

.provider-list-item__indicator {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: transparent;
    flex-shrink: 0;
}

.provider-list-item.is-active .provider-list-item__indicator {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}

.provider-list-item__main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.provider-list-item__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.provider-list-item__meta {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 400;
}

.provider-list-item__badge {
    font-size: 0.58rem;
    color: #67e8f9;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.provider-list-item__state,
.provider-list-item__switch {
    flex-shrink: 0;
    border-radius: 999px;
    padding: 3px 7px;
    font-size: 0.64rem;
    line-height: 1;
}

.provider-list-item__state {
    color: #86efac;
    background: rgba(34, 197, 94, 0.12);
}

.provider-list-item__switch {
    color: #bae6fd;
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.18);
}

.provider-list-item__switch:hover {
    color: #f0f9ff;
    background: rgba(14, 165, 233, 0.22);
}

.provider-list-empty {
    padding: 12px 10px;
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.45;
}

.provider-detail-panel {
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
    overflow-y: auto;
}

.provider-detail-panel__content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.provider-detail-panel__empty {
    margin: auto 0;
    color: #475569;
    font-size: 0.82rem;
    text-align: center;
    padding: 60px 20px;
}

.provider-setup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 2px;
}

.provider-setup-header__eyebrow {
    color: #fbbf24;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.provider-setup-header h4 {
    margin: 0;
    color: #f8fafc;
    font-size: 1rem;
    font-weight: 700;
}

.provider-setup-header p {
    margin: 6px 0 0;
    color: #94a3b8;
    font-size: 0.78rem;
    line-height: 1.55;
}

.provider-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.provider-step {
    min-height: 48px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.42);
    padding: 9px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.provider-step span {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(45, 212, 191, 0.12);
    color: #5eead4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    flex: 0 0 auto;
}

.provider-step strong {
    min-width: 0;
    color: #e2e8f0;
    font-size: 0.76rem;
    line-height: 1.25;
}

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

.provider-field--preset,
.provider-field--key,
.provider-field--endpoint,
.provider-model-field {
    grid-column: 1 / -1;
}

.provider-model-select-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.provider-key-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.provider-docs-link-btn {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b; /* Lighter/softer color than standard label #94a3b8 */
    cursor: pointer;
    transition: color 0.15s ease;
}

.provider-docs-link-btn:hover {
    color: #22d3ee; /* Soft cyan color on hover */
    text-decoration: underline;
    text-underline-offset: 3px;
}

.provider-key-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
}

/* Custom Select Dropdown Widget */
.agent-custom-select {
    position: relative;
    width: 100%;
}

.agent-custom-select__trigger {
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: rgba(30, 41, 59, 0.48);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.8rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.agent-custom-select__trigger:hover {
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(30, 41, 59, 0.6);
}

.agent-custom-select__trigger:focus-visible {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.agent-custom-select__trigger-arrow {
    width: 10px;
    height: 6px;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.agent-custom-select.is-open .agent-custom-select__trigger-arrow {
    transform: rotate(180deg);
}

.agent-custom-select__options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 100;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(125, 211, 252, 0.16);
    background:
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.1), transparent 36%),
        linear-gradient(180deg, rgba(8, 12, 28, 0.98), rgba(12, 18, 36, 0.98));
    box-shadow: 0 16px 48px rgba(2, 6, 23, 0.5);
    backdrop-filter: blur(8px);
}

.agent-custom-select__option {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #e2e8f0;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.agent-custom-select__option:hover,
.agent-custom-select__option.is-active {
    border-color: rgba(56, 189, 248, 0.2);
    background: rgba(8, 47, 73, 0.45);
}

.agent-custom-select__option strong {
    font-size: 0.78rem;
    font-weight: 500;
}

.agent-custom-select__option span {
    font-size: 0.68rem;
    color: #64748b;
}

.agent-custom-select__option:hover span,
.agent-custom-select__option.is-active span {
    color: #94a3b8;
}

.provider-model-options {
    min-height: 18px;
    color: #64748b;
    font-size: 0.72rem;
    line-height: 1.4;
}

.provider-custom-model-input {
    margin-top: 0;
}

.provider-advanced {
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.24);
}

.provider-advanced summary {
    cursor: pointer;
    list-style: none;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.provider-advanced summary::-webkit-details-marker {
    display: none;
}

.provider-advanced summary span {
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 700;
}

.provider-advanced summary small {
    color: #64748b;
    font-size: 0.72rem;
}

.provider-advanced__body {
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    padding: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.provider-advanced__body .agent-field--sdk-options,
.provider-advanced__body .agent-sdk-options-toolbar {
    grid-column: 1 / -1;
}

.agent-connection-result {
    margin-top: 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(2, 6, 23, 0.5);
    padding: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}

.agent-connection-result__headline {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.agent-connection-result__headline strong {
    font-size: 0.82rem;
    color: #f8fafc;
}

.agent-connection-result__headline span {
    font-size: 0.74rem;
    color: #94a3b8;
}

.agent-connection-result__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agent-connection-result__item label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.agent-connection-result__item div {
    font-size: 0.8rem;
    line-height: 1.55;
    color: #e2e8f0;
    word-break: break-word;
}

.agent-connection-result__raw {
    grid-column: 1 / -1;
    padding-top: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    color: #94a3b8;
    font-size: 0.76rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-balance-result {
    margin-top: 14px;
    border-radius: 12px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.05);
    padding: 12px 14px;
    font-size: 0.8rem;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
    word-break: break-all;
}

.agent-balance-result.is-error {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.05);
    color: #ef4444;
}

.agent-debug-tools {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.agent-debug-tools__label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #67e8f9;
    margin-bottom: 10px;
}

.agent-debug-tools__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agent-workbench__body {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.agent-jump-latest {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 5;
    height: 34px;
    padding: 0 14px;
    border: 1px solid rgba(103, 232, 249, 0.24);
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.88);
    color: #ccfbf1;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 18px 32px rgba(2, 6, 23, 0.22);
}

.agent-timeline {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.agent-timeline__empty {
    margin: auto 0;
    padding: 18px;
    border-radius: 18px;
    border: 1px dashed rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.36);
    color: #94a3b8;
    font-size: 0.84rem;
    line-height: 1.72;
}

.agent-timeline__empty.is-loading {
    margin: 0;
    padding: 6px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #64748b;
    font-size: 0.74rem;
}

.agent-run-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.agent-timeline__spinner {
    display: none; /* Legacy — replaced by agent-timeline__active-status */
}

.agent-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(148, 163, 184, 0.2);
    border-top-color: #67e8f9;
    border-radius: 50%;
    animation: agent-spinner-rotate 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes agent-spinner-rotate {
    to { transform: rotate(360deg); }
}

.agent-timeline__spinner-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Active status row — inline spinner + stage message */
.agent-timeline__active-status .agent-timeline__body {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-timeline__active-status .agent-spinner {
    width: 12px;
    height: 12px;
    border-width: 1.5px;
    flex-shrink: 0;
}

.agent-timeline__status-text {
    color: #94a3b8;
    font-size: 0.76rem;
}

/* Streaming cursor for assistant messages */
.agent-timeline__row.is-streaming .agent-timeline__body::after {
    content: '▊';
    animation: agent-cursor-blink 0.6s step-end infinite;
    color: #67e8f9;
    margin-left: 2px;
    font-size: 0.8em;
}

@keyframes agent-cursor-blink {
    50% { opacity: 0; }
}

/* Entry button breathing pulse — running state */
@keyframes agent-pulse-dot {
    0%, 100% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18); }
    50% { box-shadow: 0 0 0 7px rgba(245, 158, 11, 0.08); }
}

@keyframes agent-pulse-ring {
    0%, 100% {
        border-color: rgba(245, 158, 11, 0.22);
        box-shadow: 0 2px 12px rgba(245, 158, 11, 0.06);
    }
    50% {
        border-color: rgba(245, 158, 11, 0.38);
        box-shadow: 0 2px 18px rgba(245, 158, 11, 0.12);
    }
}

/* Row appear animation */
.agent-timeline__row {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    animation: agent-row-appear 0.15s ease-out;
}

@keyframes agent-row-appear {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.agent-timeline__role {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    padding: 3px 10px 2px;
    font-weight: 700;
}

.agent-timeline__role::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #475569;
    box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.1);
}

.agent-timeline__row--user .agent-timeline__role {
    color: #7dd3fc;
}

.agent-timeline__row--user .agent-timeline__role::before {
    background: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.agent-timeline__row--assistant .agent-timeline__role {
    color: #5eead4;
}

.agent-timeline__row--assistant .agent-timeline__role::before {
    background: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.agent-timeline__content {
    min-width: 0;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.78rem;
    line-height: 1.55;
    border: 0;
    background: transparent;
}

.agent-timeline__row--user .agent-timeline__content {
    background: transparent;
}

.agent-timeline__row--command .agent-timeline__content {
    background: rgba(9, 20, 38, 0.48);
}

.agent-timeline__row--assistant .agent-timeline__content {
    background: transparent;
}

.agent-timeline__row--tool .agent-timeline__content,
.agent-timeline__row--status .agent-timeline__content {
    background: transparent;
    color: #94a3b8;
    font-size: 0.74rem;
}

.agent-timeline__row--approval .agent-timeline__content,
.agent-timeline__row--question .agent-timeline__content {
    background: transparent;
    color: #c4b5fd;
}

.agent-timeline__row--artifact .agent-timeline__content {
    background: transparent;
    color: #5eead4;
}

.agent-timeline__row--failed .agent-timeline__content {
    background: transparent;
    color: #fca5a5;
}

.agent-timeline__body {
    font-size: 0.78rem;
    line-height: 1.55;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-timeline__row--user .agent-timeline__body,
.agent-timeline__row--command .agent-timeline__body,
.agent-timeline__row--assistant .agent-timeline__body {
    white-space: normal;
}

.agent-assistant-turn .agent-timeline__content {
    padding: 6px 10px 8px;
    border: 0;
    background: transparent;
}

.agent-assistant-turn__body {
    display: grid;
    gap: 14px;
    min-width: 0;
    white-space: normal;
}

.agent-assistant-message {
    min-width: 0;
}

.agent-assistant-message + .agent-assistant-message {
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.agent-assistant-message__body {
    color: #e2e8f0;
    white-space: normal;
    word-break: break-word;
}

.agent-assistant-message__body p,
.agent-result__body p {
    margin: 0;
}

.agent-assistant-message__body p + p,
.agent-result__body p + p {
    margin-top: 6px;
}

.agent-assistant-message__body strong {
    color: #f8fafc;
    font-weight: 700;
}

.agent-assistant-message.is-streaming .agent-assistant-message__body::after {
    content: '▊';
    animation: agent-cursor-blink 0.6s step-end infinite;
    color: #67e8f9;
    margin-left: 2px;
    font-size: 0.82em;
}

.agent-assistant-message__meta {
    margin: 0 0 4px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: #64748b;
    font-size: 0.68rem;
}

.agent-process {
    overflow: hidden;
    border: 1px solid rgba(51, 65, 85, 0.72);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(3, 7, 18, 0.64), rgba(8, 13, 26, 0.72));
    white-space: normal;
}

.agent-process[open] {
    border-color: rgba(103, 232, 249, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.agent-process__summary {
    min-height: 36px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    color: #cbd5e1;
    cursor: pointer;
    list-style: none;
    white-space: nowrap;
}

.agent-process__summary::-webkit-details-marker {
    display: none;
}

.agent-process__chevron {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid #64748b;
    border-bottom: 1.5px solid #64748b;
    transform: rotate(-45deg);
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.agent-process[open] .agent-process__chevron {
    transform: rotate(45deg);
    border-color: #67e8f9;
}

.agent-process__pulse {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #475569;
    box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.12);
    justify-self: center;
}

.agent-process:not(.is-active) .agent-spinner {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border: 0;
    border-radius: 999px;
    background: #475569;
    box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.12);
    animation: none;
    justify-self: center;
}

.agent-process__count {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.1);
    color: #5eead4;
    font-size: 0.66rem;
    font-weight: 700;
    white-space: nowrap;
}

.agent-process__headline {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    color: #cbd5e1;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.agent-process__status {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: #94a3b8;
    font-size: 0.72rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.agent-process.is-active .agent-process__status {
    color: #a5f3fc;
    font-weight: 650;
}

.agent-process__items {
    max-height: min(360px, 42vh);
    overflow: auto;
    padding: 8px;
    border-top: 1px solid rgba(51, 65, 85, 0.64);
    display: grid;
    gap: 8px;
}

.agent-run-group:not(.is-active) .agent-process__items {
    max-height: 260px;
}

.agent-process-event {
    min-width: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.agent-process-event__head {
    min-width: 0;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 8px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.agent-process-event__dot {
    width: 7px;
    height: 7px;
    margin-top: 0;
    border-radius: 999px;
    background: #64748b;
}

.agent-process-event--success .agent-process-event__dot {
    background: #22c55e;
}

.agent-process-event--warning .agent-process-event__dot {
    background: #f59e0b;
}

.agent-process-event--danger .agent-process-event__dot {
    background: #fb7185;
}

.agent-process-event__title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e2e8f0;
    font-size: 0.72rem;
    font-weight: 700;
    overflow: hidden;
    white-space: nowrap;
}

.agent-process-event__title-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-process-event__time {
    color: #64748b;
    font-size: 0.66rem;
    white-space: nowrap;
}

.agent-process-event__summary {
    min-width: 0;
    color: #94a3b8;
    font-size: 0.7rem;
    line-height: 1.5;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-process-event__blocks {
    display: grid;
    gap: 6px;
    padding: 0 8px 8px;
}

.agent-process-event .agent-inline-actions {
    padding: 0 8px 8px;
}

.agent-result {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(45, 212, 191, 0.16);
    background: rgba(6, 78, 59, 0.18);
    color: #ccfbf1;
    white-space: normal;
}

.agent-result--failed {
    padding: 2px 2px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fecaca;
}

.agent-result--failed .agent-result__meta {
    margin: 0 0 4px;
    color: #64748b;
}

.agent-result--done {
    padding: 2px 2px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #94a3b8;
}

.agent-result__body {
    font-size: 0.76rem;
    line-height: 1.58;
}

.agent-result__meta {
    margin-top: 5px;
    color: #64748b;
    font-size: 0.66rem;
}

.agent-result--done .agent-result__body {
    min-width: 0;
    color: #cbd5e1;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.agent-result--done .agent-result__meta {
    margin: 0 0 4px;
    font-size: 0.66rem;
}

.agent-inline-code {
    padding: 1px 5px;
    border: 1px solid rgba(103, 232, 249, 0.14);
    border-radius: 5px;
    background: rgba(2, 6, 23, 0.68);
    color: #a5f3fc;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.92em;
}

.agent-code-frame {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(30, 41, 59, 0.92);
    border-radius: 7px;
    background: #050b16;
}

.agent-timeline__row--user .agent-code-frame,
.agent-assistant-message__body .agent-code-frame,
.agent-result__body .agent-code-frame {
    margin: 6px 0;
}

.agent-code-frame__header {
    min-height: 24px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.92);
    background:
        linear-gradient(90deg, rgba(103, 232, 249, 0.08), transparent 42%),
        rgba(15, 23, 42, 0.74);
    color: #64748b;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
}

.agent-code-block {
    margin: 0;
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 10px;
    color: #dbeafe;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.68rem;
    line-height: 1.5;
    tab-size: 2;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.42) transparent;
}

.agent-code-block::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.agent-code-block::-webkit-scrollbar-track {
    background: transparent;
}

.agent-code-block::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.42);
}

.agent-code-block::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.52);
}

.agent-markdown-table-wrap {
    max-width: 100%;
    margin: 6px 0;
    overflow-x: auto;
    border: 1px solid rgba(51, 65, 85, 0.86);
    border-radius: 7px;
    background: rgba(2, 6, 23, 0.36);
}

.agent-markdown-table {
    width: 100%;
    min-width: 360px;
    border-collapse: collapse;
    color: #dbeafe;
    font-size: 0.72rem;
    line-height: 1.45;
}

.agent-markdown-table th,
.agent-markdown-table td {
    padding: 6px 8px;
    border-right: 1px solid rgba(51, 65, 85, 0.72);
    border-bottom: 1px solid rgba(51, 65, 85, 0.72);
    text-align: left;
    vertical-align: top;
    word-break: break-word;
}

.agent-markdown-table th:last-child,
.agent-markdown-table td:last-child {
    border-right: 0;
}

.agent-markdown-table tbody tr:last-child td {
    border-bottom: 0;
}

.agent-markdown-table th {
    background: rgba(15, 23, 42, 0.72);
    color: #f8fafc;
    font-weight: 700;
}

.agent-workbench,
.agent-workbench * {
    scrollbar-width: thin;
    scrollbar-color: rgba(71, 85, 105, 0.5) transparent;
}

.agent-workbench *::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.agent-workbench *::-webkit-scrollbar-track {
    background: transparent;
}

.agent-workbench *::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(71, 85, 105, 0.5);
}

.agent-workbench *::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.68);
}

.agent-token-property,
.agent-token-tag {
    color: #7dd3fc;
}

.agent-token-string {
    color: #86efac;
}

.agent-token-number,
.agent-token-color {
    color: #fbbf24;
}

.agent-token-boolean,
.agent-token-null,
.agent-token-keyword {
    color: #c084fc;
}

.agent-token-comment {
    color: #64748b;
    font-style: italic;
}

.agent-token-punctuation {
    color: #94a3b8;
}

.agent-timeline__meta {
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.72rem;
    color: #94a3b8;
}

.agent-timeline__details {
    margin-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    padding-top: 10px;
}

.agent-timeline__details summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: #67e8f9;
}

.agent-timeline__details pre {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.68);
    color: #cbd5e1;
    font-size: 0.74rem;
    line-height: 1.55;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-inline-actions {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.agent-inline-actions button {
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(196, 181, 253, 0.22);
    background: rgba(2, 6, 23, 0.7);
    color: #f8fafc;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.agent-inline-actions button:hover {
    border-color: rgba(125, 211, 252, 0.3);
}

.agent-inline-actions__resolved {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
}

.agent-artifact-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agent-artifact-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #ccfbf1;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.agent-artifact-link:hover {
    text-decoration: underline;
}

.agent-composer {
    padding: 16px 18px 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(2, 6, 23, 0.76);
}

.agent-composer__skillbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.agent-composer__prd-context-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.agent-active-prd-context {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    min-height: 32px;
    padding: 4px 8px 4px 10px;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.32);
    background: rgba(139, 92, 246, 0.12);
    color: #c084fc;
    font-size: 0.76rem;
}

.agent-active-prd-context__icon {
    display: inline-flex;
    align-items: center;
    color: #a78bfa;
}

.agent-active-prd-context__meta {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.agent-active-prd-context__label {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.agent-active-prd-context__type {
    font-size: 0.68rem;
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.2);
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}

.agent-active-prd-context__clear {
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.52);
    color: #a78bfa;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.76rem;
    line-height: 1;
    transition: all 0.12s ease;
    flex: 0 0 auto;
}

.agent-active-prd-context__clear:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* ── Feedback Collection Bar ──────────────────────────── */

.agent-composer__feedbackbar {
    margin-bottom: 10px;
}

.agent-attachment-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.agent-attachment-chip {
    position: relative;
    width: 78px;
    height: 78px;
    border: 1px solid rgba(125, 211, 252, 0.18);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.72);
}

.agent-attachment-chip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.agent-attachment-chip__name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px 6px 5px;
    background: linear-gradient(180deg, transparent, rgba(2, 6, 23, 0.86));
    color: #e2e8f0;
    font-size: 0.64rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-attachment-chip__remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.78);
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.agent-attachment-chip__remove:hover {
    background: rgba(239, 68, 68, 0.86);
}

.agent-feedback-collection {
    border: 1px solid rgba(129, 140, 248, 0.18);
    background: rgba(129, 140, 248, 0.05);
    border-radius: 10px;
    padding: 8px 10px;
}

.agent-feedback-collection__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.agent-feedback-collection__title {
    font-size: 0.72rem;
    font-weight: 600;
    color: #a5b4fc;
    letter-spacing: 0.2px;
}

.agent-feedback-collection__clear {
    font-size: 0.68rem;
    color: #64748b;
    background: none;
    border: none;
    cursor: pointer;
    padding: 1px 5px;
    border-radius: 3px;
    transition: color 0.15s;
}

.agent-feedback-collection__clear:hover {
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.04);
}

.agent-feedback-collection__items {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.agent-feedback-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(129, 140, 248, 0.12);
    border-radius: 6px;
    font-size: 0.7rem;
    max-width: 220px;
    line-height: 1.3;
}

.agent-feedback-chip__tag {
    background: rgba(129, 140, 248, 0.14);
    color: #c7d2fe;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 600;
    flex-shrink: 0;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.64rem;
}

.agent-feedback-chip__text {
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-feedback-chip__remove {
    width: 14px;
    height: 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    line-height: 1;
    transition: all 0.15s;
}

.agent-feedback-chip__remove:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

.agent-active-skill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    min-height: 38px;
    padding: 6px 8px 6px 12px;
    border-radius: 14px;
    border: 1px solid rgba(45, 212, 191, 0.18);
    background: rgba(6, 95, 70, 0.18);
    color: #ccfbf1;
}

.agent-active-skill__meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.agent-active-skill__label {
    font-size: 0.78rem;
    font-weight: 700;
}

.agent-active-skill__description {
    font-size: 0.72rem;
    line-height: 1.5;
    color: rgba(204, 251, 241, 0.84);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-active-skill__clear {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.52);
    color: inherit;
    cursor: pointer;
    flex: 0 0 auto;
}

.agent-active-skill__clear:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.agent-composer__input-shell {
    position: relative;
}

.agent-command-menu-anchor {
    position: relative;
    min-width: 0;
    container: agent-composer-controls / inline-size;
    padding: 10px 10px 7px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.82);
}

.agent-composer__input-inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 0;
    pointer-events: none;
}

.agent-composer__input-inner > * {
    pointer-events: auto;
}

.agent-composer__left-actions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.agent-skill-menu-anchor {
    position: relative;
}

.agent-skill-menu-toggle,
.agent-image-upload-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    color: #ccfbf1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.agent-skill-menu-toggle:hover,
.agent-skill-menu-toggle.is-open,
.agent-image-upload-btn:hover,
.agent-image-upload-btn.is-active {
    background: rgba(15, 23, 42, 0.9);
    color: #67e8f9;
}

.agent-image-upload-btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.agent-model-selector-anchor {
    position: relative;
    min-width: 0;
}

.agent-model-toggle {
    height: 28px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    color: #ccfbf1;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.16s ease, color 0.16s ease;
    white-space: nowrap;
    max-width: 118px;
    overflow: hidden;
}

.agent-model-toggle:hover {
    background: rgba(15, 23, 42, 0.9);
    color: #67e8f9;
}

.agent-model-toggle__label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-model-dropdown {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    min-width: 200px;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid rgba(125, 211, 252, 0.16);
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(4, 7, 17, 0.98), rgba(10, 14, 24, 0.98));
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.42);
    z-index: 10;
}

.agent-model-dropdown__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    margin-bottom: 3px;
}

.agent-model-dropdown__item:last-child {
    margin-bottom: 0;
}

.agent-model-dropdown__item:hover {
    background: rgba(14, 165, 233, 0.08);
    color: #67e8f9;
}

.agent-model-dropdown__item.is-active {
    color: #7dd3fc;
    background: rgba(14, 165, 233, 0.05);
}

.agent-model-dropdown__item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-model-dropdown__item-model {
    font-size: 0.7rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.agent-model-dropdown__divider {
    height: 1px;
    background: rgba(148, 163, 184, 0.1);
    margin: 4px 8px;
}

.agent-model-dropdown__item--settings {
    color: #94a3b8;
}

/* Plan Mode & Permission Selector Styles */
.agent-plan-mode-toggle {
    height: 28px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #ccfbf1;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.16s ease;
    white-space: nowrap;
}

.agent-plan-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #67e8f9;
}

.agent-plan-mode-toggle.is-active {
    border-color: transparent;
    color: #67e8f9;
    background: transparent;
    text-shadow: 0 0 8px rgba(103, 232, 249, 0.4);
    box-shadow: none;
}

.agent-plan-mode-toggle::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(204, 251, 241, 0.35);
    margin-right: 4px;
    transition: all 0.16s ease;
}

.agent-plan-mode-toggle.is-active::before {
    background: #67e8f9;
    box-shadow: 0 0 6px #67e8f9;
}

.agent-permission-toggle {
    height: 28px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    color: #ccfbf1;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.16s ease;
    white-space: nowrap;
}

.agent-permission-toggle:hover {
    background: rgba(15, 23, 42, 0.9);
    color: #67e8f9;
}

.agent-permission-selector-anchor {
    position: relative;
    min-width: 0;
}

.agent-permission-dropdown {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    min-width: 220px;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid rgba(125, 211, 252, 0.16);
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(4, 7, 17, 0.98), rgba(10, 14, 24, 0.98));
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.42);
    z-index: 10;
}

.agent-permission-dropdown__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    margin-bottom: 3px;
}

.agent-permission-dropdown__item:last-child {
    margin-bottom: 0;
}

.agent-permission-dropdown__item:hover {
    background: rgba(14, 165, 233, 0.08);
    color: #67e8f9;
}

.agent-permission-dropdown__item.is-active {
    color: #7dd3fc;
    background: rgba(14, 165, 233, 0.05);
}

.agent-composer.is-dragging-image .agent-composer__input {
    box-shadow: none;
}

.agent-composer.is-dragging-image .agent-command-menu-anchor {
    border-color: rgba(45, 212, 191, 0.62);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}

.agent-skill-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 44px);
    width: min(340px, calc(100vw - 48px));
    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(125, 211, 252, 0.16);
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(4, 7, 17, 0.98), rgba(10, 14, 24, 0.98));
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.42);
}

.agent-command-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 12px);
    z-index: 12;
    max-height: min(360px, 48vh);
    overflow-y: auto;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(125, 211, 252, 0.16);
    background:
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 36%),
        linear-gradient(180deg, rgba(4, 7, 17, 0.98), rgba(10, 14, 24, 0.98));
    box-shadow: 0 30px 64px rgba(2, 6, 23, 0.42);
}

.agent-command-menu__empty {
    padding: 14px;
    color: #94a3b8;
    font-size: 0.78rem;
    line-height: 1.6;
}

.agent-command-menu__section + .agent-command-menu__section {
    margin-top: 10px;
}

.agent-command-menu__label {
    padding: 0 8px 6px;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
}

.agent-command-menu__item {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: #e2e8f0;
    text-align: left;
    cursor: pointer;
}

.agent-command-menu__item:hover,
.agent-command-menu__item.is-active {
    border-color: rgba(56, 189, 248, 0.22);
    background: rgba(8, 47, 73, 0.36);
}

.agent-command-menu__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(14, 165, 233, 0.12);
    color: #67e8f9;
    font-size: 0.72rem;
    font-weight: 700;
}

.agent-command-menu__content {
    min-width: 0;
    flex: 1;
}

.agent-command-menu__title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    font-weight: 700;
    color: #f8fafc;
}

.agent-command-menu__usage {
    color: #67e8f9;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
}

.agent-command-menu__description {
    margin-top: 4px;
    font-size: 0.74rem;
    line-height: 1.55;
    color: #94a3b8;
}

.agent-command-menu__meta {
    margin-top: 6px;
    font-size: 0.68rem;
    color: #64748b;
}

.agent-command-chip {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    min-height: 0;
    padding: 8px 10px;
    border-radius: 7px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(103, 232, 249, 0.14);
    color: #ccfbf1;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: normal;
}

.agent-command-chip > span:first-child {
    color: #67e8f9;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
    white-space: nowrap;
    word-break: keep-all;
}

.agent-command-chip__usage {
    min-width: 0;
    color: #cbd5e1;
    font-family: inherit;
    font-weight: 600;
    line-height: 1.55;
    overflow-wrap: break-word;
    white-space: normal;
    word-break: normal;
}

.agent-skill-menu__empty {
    padding: 12px;
    color: #94a3b8;
    font-size: 0.78rem;
    line-height: 1.6;
}

.agent-skill-menu__item {
    width: 100%;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #e2e8f0;
    text-align: left;
    cursor: pointer;
}

.agent-skill-menu__item:hover,
.agent-skill-menu__item.is-active {
    background: rgba(15, 23, 42, 0.72);
}

.agent-skill-menu__icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(14, 165, 233, 0.14);
    color: #a5f3fc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.agent-skill-menu__content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.agent-skill-menu__label {
    font-size: 0.79rem;
    font-weight: 700;
    color: #f8fafc;
}

.agent-skill-menu__description {
    font-size: 0.74rem;
    line-height: 1.55;
    color: #94a3b8;
}

.agent-composer__input {
    width: 100%;
    min-height: 74px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #f8fafc;
    padding: 4px 4px 0;
    scroll-padding: 8px 0;
    font-family: inherit;
    font-size: 0.84rem;
    line-height: 1.7;
    resize: none;
    outline: none;
    overflow-y: hidden;
}

.agent-composer__input:focus {
    box-shadow: none;
}

.agent-command-menu-anchor:focus-within {
    border-color: rgba(125, 211, 252, 0.32);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}

.agent-send-btn {
    width: 28px;
    min-width: 28px;
    height: 28px;
    justify-self: end;
    position: relative;
    z-index: 2;
    border: 0;
    border-radius: 8px;
    background: rgba(14, 165, 233, 0.28);
    color: #67e8f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

@container agent-composer-controls (max-width: 360px) {
    .agent-composer__left-actions {
        gap: 5px;
    }

    .agent-permission-selector-anchor {
        display: none;
    }

    .agent-model-toggle {
        max-width: 74px;
    }
}

@container agent-composer-controls (max-width: 300px) {
    .agent-plan-mode-toggle {
        display: none;
    }
}

@container agent-composer-controls (max-width: 250px) {
    .agent-model-selector-anchor {
        display: none;
    }
}

@container agent-composer-controls (max-width: 210px) {
    .agent-image-upload-btn {
        display: none;
    }
}

@container agent-composer-controls (max-width: 170px) {
    .agent-skill-menu-toggle {
        display: none;
    }
}

.agent-send-btn:hover:not(:disabled) {
    background: rgba(14, 165, 233, 0.48);
    color: #e0f2fe;
}

.agent-send-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.agent-send-btn__icon-stop {
    display: none;
}

.agent-send-btn.is-running .agent-send-btn__icon-send {
    display: none;
}

.agent-send-btn.is-running .agent-send-btn__icon-stop {
    display: inline-flex;
}

.agent-send-btn.is-running {
    background: rgba(239, 68, 68, 0.28);
    color: #fca5a5;
}

.agent-send-btn.is-running:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.48);
    color: #fecaca;
}

.agent-secondary-btn:disabled,
.agent-primary-btn:disabled,
.agent-icon-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media (max-width: 1180px) {
    .sidebar.is-agent-open {
        width: min(var(--agent-panel-width), calc(100vw - 240px));
        flex-basis: min(var(--agent-panel-width), calc(100vw - 240px));
    }

    .sidebar.is-agent-open.is-agent-session-open {
        width: min(var(--agent-panel-width), calc(100vw - 120px));
        flex-basis: min(var(--agent-panel-width), calc(100vw - 120px));
    }
}

@media (max-width: 860px) {
    .sidebar.is-agent-open,
    .sidebar.is-agent-open.is-agent-session-open {
        position: fixed;
        inset: 0 auto 0 0;
        width: 100vw;
        flex-basis: 100vw;
        z-index: 180;
    }

    .agent-resize-handle {
        display: none !important;
    }

    .agent-workbench {
        width: 100%;
        min-width: 0;
        padding: 0;
        transform: none;
    }

    .agent-workbench__surface {
        border-radius: 0;
    }

    .agent-workbench__main {
        display: block;
    }

    .agent-session-sidebar {
        position: absolute;
        inset: 0 auto 0 0;
        width: min(320px, calc(100vw - 48px));
        z-index: 4;
        transform: translateX(-100%);
        opacity: 1;
        pointer-events: auto;
        transition: transform 0.2s ease;
        border-right: 1px solid rgba(148, 163, 184, 0.12);
        box-shadow: 0 24px 44px rgba(2, 6, 23, 0.32);
        border-radius: 0 18px 18px 0;
    }

    .agent-session-sidebar.is-open {
        transform: translateX(0);
    }

    .agent-session-sidebar__drawer-toggle {
        display: inline-flex;
    }

    .agent-workbench__panel {
        border-left: 0;
    }

    .agent-config-modal {
        padding: 0;
    }

    .agent-config-modal__dialog {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        overflow: auto;
    }

    .agent-config-panel--split {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
        flex: none;
        height: auto;
    }

    .provider-list-panel {
        height: auto;
        max-height: 180px;
        border-right: none;
        border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    }

    .provider-detail-panel {
        height: auto;
        max-height: none;
        padding: 18px 16px 24px;
    }

    .provider-setup-header {
        flex-direction: column;
        gap: 12px;
    }

    .provider-steps,
    .provider-config-grid,
    .provider-advanced__body,
    .agent-config-panel__actions {
        grid-template-columns: 1fr;
    }

    .provider-model-select-row {
        grid-template-columns: 1fr;
    }

    .trash-modal {
        padding: 0;
    }

    .trash-modal__dialog {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    .agent-config-panel__grid,
    .agent-connection-result {
        grid-template-columns: 1fr;
    }

    .agent-workbench__header {
        flex-wrap: wrap;
    }

    .agent-status-context {
        display: none;
    }

    .agent-skill-menu {
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: 16px;
        width: auto;
    }

    .agent-command-menu {
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: 92px;
    }

    .agent-timeline__row {
        flex-direction: column;
    }
}

/* ── PRD Table of Contents (TOC) ──────────────────────── */

.annotation-drawer:not(.is-prd-mode) .prd-toc-floating {
    display: none !important;
}

.prd-toc-floating {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.prd-toc-floating * {
    pointer-events: auto;
}

.prd-toc-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: #475569;
    box-shadow: 
        0 8px 30px rgba(15, 23, 42, 0.12), 
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.prd-toc-toggle:hover {
    color: var(--accent);
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.16);
    background: #fff;
}

.prd-toc-card {
    position: absolute;
    bottom: 48px;
    right: 0;
    width: 260px;
    max-height: 380px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px) saturate(190%);
    -webkit-backdrop-filter: blur(20px) saturate(190%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    box-shadow: 
        0 20px 48px rgba(15, 23, 42, 0.16), 
        0 4px 12px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.prd-toc-floating--expanded .prd-toc-card {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.prd-toc-floating--expanded .prd-toc-toggle {
    color: var(--accent);
    background: #fff;
    transform: rotate(90deg);
}

.prd-toc-card__header {
    padding: 14px 16px 10px;
    font-size: 0.76rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.prd-toc-card__body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 8px;
}

.prd-toc-card__body::-webkit-scrollbar {
    width: 4px;
}
.prd-toc-card__body::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.08);
    border-radius: 99px;
}

.prd-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.prd-toc-item {
    position: relative;
    border-radius: 8px;
    transition: all 0.16s ease;
}

.prd-toc-item--level-1 { padding-left: 10px; }
.prd-toc-item--level-2 { padding-left: 20px; }
.prd-toc-item--level-3 { padding-left: 30px; }
.prd-toc-item--level-4 { padding-left: 40px; }

.prd-toc-link {
    display: block;
    padding: 6px 12px;
    font-size: 0.78rem;
    color: #64748b;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    border: 0 !important;
    transition: all 0.16s ease;
}

.prd-toc-link:hover {
    color: #0f172a;
    background: rgba(15, 23, 42, 0.03);
    border-radius: 6px;
}

.prd-toc-item.is-active .prd-toc-link {
    color: var(--accent) !important;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 6px;
}

.prd-toc-item.is-active::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
}

/* ── Pinned TOC Mode Styles ────────────────────────── */

/* Expand drawer width to make room for pinned TOC */
.annotation-drawer.is-visible.is-prd-mode.has-pinned-toc:not(.is-fullscreen):not(.is-user-sized) {
    width: min(740px, 58vw) !important;
    min-width: 640px !important;
}

.annotation-drawer.is-visible.is-prd-mode.is-expanded.has-pinned-toc:not(.is-fullscreen):not(.is-user-sized) {
    width: min(980px, 75vw) !important;
    min-width: 780px !important;
}

/* Shift drawer body so pinned TOC does not cover content */
.annotation-drawer.has-pinned-toc:not(.is-fullscreen) .annotation-drawer__body {
    margin-right: 220px;
    transition: margin-right 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Pinned TOC Sidebar Placement */
.prd-toc-floating.is-pinned {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 220px;
    margin: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.72) !important;
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    border-left: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    transition: width 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.prd-toc-floating.is-pinned .prd-toc-toggle {
    display: none;
}

.prd-toc-floating.is-pinned .prd-toc-card {
    position: relative;
    bottom: auto;
    right: auto;
    width: 100%;
    height: 100%;
    max-height: none;
    opacity: 1;
    pointer-events: auto;
    transform: none !important;
    background: transparent;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.prd-toc-floating.is-pinned .prd-toc-card__body {
    max-height: none;
}

/* Pin Toggle Button in Header */
.prd-toc-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.prd-toc-pin-btn {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    padding: 0;
}

.prd-toc-pin-btn:hover {
    color: var(--accent);
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.12);
}

.prd-toc-pin-btn.is-pinned-active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.prd-toc-pin-btn.is-pinned-active svg {
    transform: rotate(45deg);
}

/* ── Prota Panel Header and Autocomplete Menu Styles ── */
.agent-workbench__panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(10, 14, 24, 0.72);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    backdrop-filter: blur(12px);
    flex-shrink: 0;
}

.agent-workbench__panel-status {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    min-height: 22px;
}

.agent-status-context {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    min-width: 0;
    max-width: 100%;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-status-context.is-clickable {
    cursor: pointer;
    color: #7dd3fc;
}

.agent-status-context.is-clickable:hover {
    color: #7dd3fc;
}

.agent-status-context__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 22px;
    outline: none;
}

.agent-status-context__label[role="button"] {
    cursor: pointer;
}

.agent-status-context__clear {
    width: 14px;
    height: 22px;
    min-width: 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #7dd3fc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.16s ease, color 0.16s ease;
}

.agent-status-context__clear svg {
    width: 10px;
    height: 10px;
    display: block;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.agent-status-context__clear:hover {
    opacity: 1;
    color: #bae6fd;
}

.agent-workbench__panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.agent-run-timer {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.76rem;
    color: #fb7185;
    background: rgba(251, 113, 133, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(251, 113, 133, 0.2);
}

.agent-bind-page-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 8px;
    background: rgba(14, 165, 233, 0.12);
    color: #38bdf8;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.agent-bind-page-btn:hover {
    background: rgba(14, 165, 233, 0.22);
    border-color: rgba(56, 189, 248, 0.5);
    color: #f8fafc;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

/* Caret suggestion / autocomplete menu styling */
.agent-autocomplete-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 12px);
    z-index: 15;
    max-height: min(360px, 48vh);
    overflow-y: auto;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(125, 211, 252, 0.16);
    background:
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 36%),
        linear-gradient(180deg, rgba(4, 7, 17, 0.98), rgba(10, 14, 24, 0.98));
    box-shadow: 0 30px 64px rgba(2, 6, 23, 0.42);
    display: none;
    flex-direction: column;
    gap: 4px;
}

.agent-autocomplete-dropdown.is-open {
    display: flex;
}

.agent-autocomplete-group-title {
    padding: 6px 10px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    margin-bottom: 4px;
}

.agent-autocomplete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.agent-autocomplete-item:hover,
.agent-autocomplete-item.is-selected {
    background: rgba(14, 165, 233, 0.18);
    color: #38bdf8;
    outline: none;
}

.agent-autocomplete-item__meta {
    font-size: 0.72rem;
    color: #64748b;
}

.agent-autocomplete-item:hover .agent-autocomplete-item__meta,
.agent-autocomplete-item.is-selected .agent-autocomplete-item__meta {
    color: #7dd3fc;
}

/* ── PRD Skeleton Loading ───────────────────────────────── */
.prd-loading-skeleton {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 10px 4px;
    width: 100%;
}

.prd-skeleton-item {
    background: linear-gradient(90deg, rgba(229, 231, 235, 0.4) 25%, rgba(243, 244, 246, 0.7) 50%, rgba(229, 231, 235, 0.4) 75%);
    background-size: 200% 100%;
    animation: prd-skeleton-shimmer 1.5s infinite linear;
    border-radius: 6px;
}

@keyframes prd-skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.prd-skeleton-title {
    height: 28px;
    width: 60%;
    margin-bottom: 8px;
}

.prd-skeleton-meta {
    height: 16px;
    width: 35%;
    margin-bottom: 16px;
}

.prd-skeleton-line {
    height: 16px;
    width: 100%;
}

.prd-skeleton-line.short {
    width: 85%;
}

.prd-skeleton-line.very-short {
    width: 50%;
}

.prd-skeleton-block {
    height: 120px;
    width: 100%;
    margin-top: 8px;
    margin-bottom: 8px;
    border-radius: 8px;
}

/* ── Model Provider Add Dropdown ──────────────────────── */

.add-provider-wrapper {
    position: relative;
    display: inline-block;
}

.add-provider-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 220px;
    padding: 6px;
    background: rgba(10, 14, 24, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(2, 6, 23, 0.48);
    z-index: 150;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.add-provider-menu[hidden] {
    display: none;
}

.add-provider-menu__title {
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 6px 10px 4px;
    font-weight: 600;
}

.add-provider-menu__divider {
    height: 1px;
    background-color: rgba(148, 163, 184, 0.1);
    margin: 4px 8px;
}

.add-provider-menu__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #e2e8f0;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.add-provider-menu__item:hover {
    background: rgba(148, 163, 184, 0.1);
    color: #f8fafc;
}

.add-provider-menu__item strong {
    font-size: 0.78rem;
    font-weight: 600;
    color: #f8fafc;
}

.add-provider-menu__item span {
    font-size: 0.66rem;
    color: #64748b;
}

.add-provider-menu__item.is-added {
    opacity: 0.85;
}

.add-provider-menu__item.is-added strong {
    color: #94a3b8;
}

.add-provider-menu__item--custom {
    color: #67e8f9;
}

.add-provider-menu__item--custom strong {
    color: #67e8f9;
}

.add-provider-menu__item--custom:hover {
    background: rgba(103, 232, 249, 0.1);
}

/* Projects UI Custom Styles */
.nav-back-btn {
    background: none;
    border: none;
    padding: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-back-btn:hover {
    background: rgba(15, 23, 42, 0.08) !important;
    color: var(--accent) !important;
}

.nav-title-with-back {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Micro fade-in transition when switching nav sections */
.nav-section {
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}
.nav-section[hidden] {
    display: none !important;
    opacity: 0;
}
.nav-section:not([hidden]) {
    animation: navSectionFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes navSectionFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Narrow width floating session sidebar styles */
.agent-workbench.is-narrow .agent-workbench__main {
    grid-template-columns: minmax(0, 1fr) !important;
}

.agent-workbench.is-narrow .agent-workbench__panel {
    grid-column: 1 !important;
    border-left-width: 0 !important;
}


.agent-workbench.is-narrow .agent-session-sidebar {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 100 !important;
    height: 100% !important;
    width: 280px !important;
    transform: translate3d(-280px, 0, 0) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    box-shadow: 4px 0 24px rgba(2, 6, 23, 0.6) !important;
    border-right: 1px solid rgba(94, 234, 212, 0.2) !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease !important;
}

.agent-workbench.is-narrow .agent-session-sidebar.is-open {
    transform: translate3d(0, 0, 0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}
