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

:root {
    --bg-page: #edf3f8;
    --bg-sidebar: #ffffff;
    --bg-workspace: #f7f9fc;
    --surface: #ffffff;
    --surface-muted: #f1f5f9;
    --surface-active: #eaf1ff;
    --line: #dbe4ee;
    --line-strong: #c8d3df;
    --text: #17202a;
    --text-muted: #667085;
    --text-soft: #8a97a8;
    --primary: #3157d5;
    --primary-hover: #2448b5;
    --primary-soft: #e9f0ff;
    --teal: #0f766e;
    --teal-soft: #e6f7f4;
    --violet: #6d4aff;
    --violet-soft: #f0edff;
    --amber: #b45309;
    --amber-soft: #fff5e7;
    --rose: #be3455;
    --rose-soft: #fff0f3;
    --green: #0f766e;
    --green-soft: #e6f6f3;
    --orange: #b45309;
    --orange-soft: #fff4e5;
    --red: #dc2626;
    --red-soft: #fef2f2;
    --code: #eef2f7;
    --shadow: 0 10px 30px rgba(16, 24, 40, 0.09);
    --radius: 8px;
    --radius-sm: 6px;
    --mobile-sidebar-width: min(88vw, 320px);
}

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg-page);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

button,
textarea,
select,
input {
    font: inherit;
}

button {
    color: inherit;
}

img,
video {
    max-width: 100%;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.app {
    display: flex;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.sidebar {
    width: 292px;
    min-width: 292px;
    display: flex;
    flex-direction: column;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 26px rgba(32, 44, 66, 0.04);
    transition: transform 0.2s ease, left 0.2s ease;
    overflow: hidden;
}

.sidebar.hidden {
    transform: translateX(-100%);
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 20;
}

.sidebar-backdrop {
    display: none;
}

.sidebar-backdrop[hidden] {
    display: none !important;
}

.sidebar-header {
    flex: 0 0 auto;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 28px;
    margin-bottom: 12px;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.logo-icon {
    color: var(--violet);
    flex: 0 0 auto;
}

.account-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 8px;
    align-items: center;
}

.account-select {
    min-width: 0;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-size: 12px;
    font-weight: 700;
}

.account-select:focus {
    border-color: var(--primary);
}

.account-add-button {
    width: 34px;
    height: 34px;
}

.btn-primary,
.btn-secondary,
.icon-button,
.btn-send {
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn-primary {
    width: 100%;
    min-height: 38px;
    padding: 0 14px;
    background: var(--violet);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
}

.btn-primary:hover {
    background: #5a3be0;
    box-shadow: 0 8px 18px rgba(109, 74, 255, 0.2);
}

.btn-secondary {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.btn-secondary:disabled,
.btn-primary:disabled,
.btn-send:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.link-button {
    text-decoration: none;
}

.workbench-nav {
    min-height: 0;
    display: grid;
    gap: 4px;
    padding: 0 10px 10px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.nav-item {
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 650;
    text-align: left;
}

.nav-item:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.nav-item.active {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #c6d8ff;
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav-group {
    display: grid;
    gap: 3px;
}

.nav-group-toggle {
    grid-template-columns: 18px minmax(0, 1fr) 16px;
}

.nav-group.active > .nav-group-toggle {
    color: var(--primary);
    background: #f5f8ff;
    border-color: #d7e3ff;
}

.nav-group-chevron {
    justify-self: end;
    transition: transform 0.15s ease;
}

.nav-group.collapsed .nav-group-chevron {
    transform: rotate(-90deg);
}

.nav-group.collapsed .nav-submenu {
    display: none;
}

.nav-submenu {
    display: grid;
    gap: 3px;
    padding: 2px 0 2px 16px;
}

.nav-subitem {
    min-height: 32px;
    padding-left: 9px;
    font-size: 12px;
}

.nav-external-link {
    text-decoration: none;
}

.nav-subitem.active {
    box-shadow: inset 2px 0 0 var(--primary);
}

.nav-item span:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-count {
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.sidebar-section {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.nav-section {
    flex: 0 1 auto;
    max-height: min(56vh, 520px);
    max-height: min(56dvh, 520px);
    border-bottom: 1px solid var(--line);
}

.conversations-section {
    flex: 1 1 0;
    min-height: 112px;
}

.pinned-section {
    flex: 0 1 auto;
    max-height: min(32vh, 220px);
    border-bottom: 1px solid var(--line);
}

.sidebar-section-toggle {
    width: 100%;
    min-height: 34px;
    padding: 8px 12px 6px 16px;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 16px;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
}

.sidebar-section-toggle:hover {
    color: var(--text);
    background: var(--surface-muted);
}

.sidebar-section-toggle span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-count {
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 18px;
}

.section-count:empty {
    display: none;
}

.section-chevron {
    justify-self: end;
    transition: transform 0.15s ease;
}

.sidebar-section.collapsed {
    flex: 0 0 auto;
    min-height: 0;
}

.sidebar-section.collapsed .section-chevron {
    transform: rotate(-90deg);
}

.sidebar-section.collapsed .workbench-nav,
.sidebar-section.collapsed .pinned-agent-list,
.sidebar-section.collapsed .todo-sidebar-list,
.sidebar-section.collapsed .project-sidebar-actions,
.sidebar-section.collapsed .project-list,
.sidebar-section.collapsed .conversation-list {
    display: none;
}

.conversation-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0 8px 12px;
    overscroll-behavior: contain;
}

.pinned-agent-list {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 5px;
    padding: 0 8px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.todo-section {
    flex: 0 1 210px;
    min-height: 96px;
    max-height: min(28vh, 230px);
    border-bottom: 1px solid var(--line);
}

.todo-sidebar-list {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 5px;
    padding: 0 8px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.todo-sidebar-item {
    min-width: 0;
    min-height: 34px;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    padding: 4px 7px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
}

.todo-sidebar-item:hover {
    border-color: var(--line);
    background: var(--surface-muted);
    color: var(--text);
}

.todo-sidebar-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 650;
}

.todo-check {
    width: 24px;
    height: 24px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.todo-check:hover:not(:disabled) {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green);
}

.todo-check.checked,
.todo-check:disabled {
    cursor: default;
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green);
}

.todo-check.checked:hover {
    cursor: pointer;
    border-color: var(--line-strong);
    background: var(--surface);
    color: var(--text-soft);
}

.projects-section {
    flex: 0 1 260px;
    min-height: 92px;
    max-height: min(34vh, 280px);
    border-bottom: 1px solid var(--line);
}

.project-sidebar-actions {
    padding: 0 8px 8px;
}

.project-sidebar-create {
    width: 100%;
    justify-content: center;
}

.project-list {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 176px;
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 0 8px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.project-item {
    width: 100%;
    min-height: 42px;
    padding: 5px 5px 5px 9px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
}

.project-item:hover,
.project-item.active {
    border-color: #c6d8ff;
    background: var(--primary-soft);
    color: var(--primary);
}

.project-item-main {
    min-width: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    display: grid;
    gap: 2px;
    text-align: left;
}

.drive-tree-item {
    padding-left: calc(9px + var(--drive-depth, 0) * 12px);
}

.drive-sidebar-root .project-item-main strong,
.drive-tree-item .project-item-main strong,
.project-document-main strong,
.project-source-item strong {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.drive-inline-icon {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    padding: 2px;
    border-radius: 5px;
    background: #f1f5f9;
    color: #64748b;
}

.drive-inline-icon-folder {
    background: var(--amber-soft);
    color: var(--amber);
}

.drive-inline-icon-image {
    background: var(--teal-soft);
    color: var(--teal);
}

.drive-inline-icon-pdf {
    background: var(--rose-soft);
    color: var(--rose);
}

.drive-inline-icon-sheet {
    background: var(--green-soft);
    color: var(--green);
}

.drive-inline-icon-slide {
    background: #fff7d6;
    color: #a16207;
}

.drive-inline-icon-document,
.drive-inline-icon-text,
.drive-inline-icon-markdown {
    background: var(--primary-soft);
    color: var(--primary);
}

.drive-inline-icon-code,
.drive-inline-icon-data {
    background: var(--violet-soft);
    color: var(--violet);
}

.drive-inline-icon-archive {
    background: var(--surface-muted);
    color: #475569;
}

.drive-inline-icon-audio {
    background: #fdf2f8;
    color: #be185d;
}

.message-artifacts {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.drive-artifact-card {
    width: 100%;
    min-height: 62px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 10px;
    text-align: left;
    cursor: pointer;
}

.drive-artifact-card:hover {
    border-color: #c6d8ff;
    background: var(--primary-soft);
    color: var(--primary);
}

.drive-artifact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.drive-artifact-main {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.drive-artifact-main strong {
    font-size: 13px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.drive-artifact-main small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.drive-inline-icon-video {
    background: #eef2ff;
    color: #4338ca;
}

.project-item-main strong,
.project-item-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-item-main strong {
    font-size: 12px;
}

.project-item-main small {
    color: var(--text-soft);
    font-size: 11px;
}

.project-item-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
}

.project-item:hover .project-item-actions,
.project-item.active .project-item-actions {
    opacity: 1;
}

.project-mini-button {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: currentColor;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.project-mini-button:hover:not(:disabled) {
    background: var(--surface);
}

.project-mini-button.danger:hover:not(:disabled) {
    color: var(--red);
    background: var(--red-soft);
}

.project-mini-button:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}

.pinned-agent-item {
    width: 100%;
    min-height: 44px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    text-align: left;
}

.pinned-agent-item:hover,
.pinned-agent-item.active {
    border-color: #c6d8ff;
    background: var(--primary-soft);
    color: var(--primary);
}

.pinned-agent-item:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.pinned-agent-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--violet);
    color: #ffffff;
    font-size: 12px;
    font-weight: 850;
}

.pinned-agent-body {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.pinned-agent-body strong,
.pinned-agent-body small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pinned-agent-body strong {
    font-size: 12px;
}

.pinned-agent-body small {
    color: var(--text-soft);
    font-size: 11px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    margin-bottom: 3px;
    padding: 0 8px 0 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
}

.conversation-item:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.conversation-item.active {
    background: var(--surface-active);
    color: var(--primary);
    font-weight: 700;
}

.conversation-item .title {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delete-btn {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    opacity: 0;
    line-height: 1;
    font-size: 18px;
}

.conversation-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: var(--red);
    background: var(--red-soft);
}

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
}

.model-picker {
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.model-select,
#agent-select,
.role-select {
    min-width: 0;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-size: 12px;
}

.model-select {
    flex: 1;
    padding: 0 8px;
}

.model-select:focus,
#agent-select:focus,
.role-select:focus {
    border-color: var(--primary);
}

.admin-link {
    min-height: 32px;
    margin-top: 8px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.admin-link:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.workspace {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-workspace);
}

.account-login {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(4px);
}

.account-login.hidden {
    display: none;
}

.account-login-panel {
    width: min(100%, 360px);
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: grid;
    gap: 12px;
}

.account-login-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.account-login-panel h2 {
    font-size: 18px;
    line-height: 1.2;
}

.account-login-close {
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.account-login-close:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}

.account-login:not(.dismissible) .account-login-close {
    display: none;
}

.account-login-field {
    display: grid;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.account-login-field select,
.account-login-field input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-size: 14px;
}

.account-login-field select:focus,
.account-login-field input:focus {
    border-color: var(--primary);
}

.account-guest-link {
    justify-self: center;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.account-guest-link:hover {
    text-decoration: underline;
}

.account-guest-link[aria-disabled="true"] {
    color: var(--text-muted);
    pointer-events: none;
}

.account-create-form {
    display: grid;
    gap: 10px;
    padding-top: 4px;
}

.account-login-error {
    min-height: 18px;
    color: var(--red);
    font-size: 12px;
    line-height: 1.4;
}

.topbar {
    min-height: 62px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.icon-button {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-muted);
}

.icon-button:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}

.language-toggle {
    width: 42px;
    height: 32px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 850;
}

.language-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}

.icon-button.spinning svg {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.topbar-title {
    min-width: 0;
    flex: 1;
}

.topbar-title h1 {
    color: var(--text);
    font-size: 17px;
    line-height: 1.2;
}

.topbar-title p {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-topic-button {
    flex: 0 0 auto;
    min-width: 88px;
    white-space: nowrap;
}

.role-picker {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.role-select {
    width: clamp(128px, 16vw, 190px);
    padding: 0 8px;
    font-size: 12px;
    font-weight: 750;
}

.role-memory-button {
    width: 34px;
    height: 34px;
}

.role-memory-button.active {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}

.role-memory-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 60;
    width: min(360px, calc(100vw - 32px));
    padding: 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.role-memory-popover.hidden {
    display: none;
}

.role-memory-head {
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 0 8px;
    color: var(--text);
    font-size: 12px;
    font-weight: 850;
}

.role-memory-close,
.role-memory-delete {
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.role-memory-close:hover,
.role-memory-delete:hover:not(:disabled) {
    border-color: var(--line);
    color: var(--red);
    background: var(--red-soft);
}

.role-memory-delete:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.role-memory-list {
    max-height: min(34vh, 280px);
    overflow-y: auto;
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.role-memory-item {
    min-width: 0;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 8px;
    align-items: start;
}

.role-memory-copy {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.role-memory-copy p {
    color: var(--text);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.role-memory-copy small,
.role-memory-empty,
.role-memory-status {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
}

.role-memory-empty {
    min-height: 38px;
    padding: 9px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
}

.role-memory-form {
    display: grid;
    gap: 8px;
}

.role-memory-form textarea {
    width: 100%;
    min-height: 82px;
    resize: vertical;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-size: 12px;
    line-height: 1.45;
}

.role-memory-form textarea:focus {
    border-color: var(--primary);
}

.role-memory-status {
    min-height: 16px;
}

.role-memory-status.error {
    color: var(--red);
}

.model-pill,
.status-chip,
.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-muted);
    color: var(--text-muted);
    padding: 0 8px;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.status-chip.ok {
    color: var(--green);
    background: var(--green-soft);
    border-color: #b7e4dc;
}

.status-chip.warn,
.status-chip.planned {
    color: var(--orange);
    background: var(--orange-soft);
    border-color: #fed7aa;
}

.status-chip.error {
    color: var(--red);
    background: var(--red-soft);
    border-color: #fecaca;
}

.status-chip.experiment,
.status-chip.neutral {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #c6d8ff;
}

.model-pill:empty {
    display: none;
}

.view {
    min-height: 0;
    flex: 1;
    display: none;
    overflow: hidden;
}

.view.active {
    display: flex;
}

#view-chat {
    flex-direction: column;
    position: relative;
}

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

.chat-history-tools {
    --chat-input-offset: 92px;
    position: absolute;
    right: 20px;
    bottom: calc(var(--chat-input-offset) + 16px);
    z-index: 8;
    display: grid;
    justify-items: end;
    gap: 8px;
    pointer-events: none;
}

.chat-history-tools[hidden] {
    display: none;
}

.chat-history-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.chat-float-button {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.chat-float-button:hover,
.chat-float-button:focus-visible {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
    transform: translateY(-1px);
}

.chat-float-button:disabled {
    cursor: default;
    opacity: 0.55;
    transform: none;
}

.chat-history-panel {
    width: min(380px, calc(100vw - 40px));
    max-height: min(420px, calc(100dvh - var(--chat-input-offset) - 112px));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    overflow: hidden;
    pointer-events: auto;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.chat-history-panel[hidden] {
    display: none;
}

.chat-history-head {
    min-height: 42px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chat-history-head strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.chat-history-head span {
    color: var(--text-soft);
    white-space: nowrap;
    font-size: 11px;
    font-weight: 700;
}

.chat-history-list {
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    padding: 6px;
    display: grid;
    gap: 4px;
}

.chat-history-item {
    width: 100%;
    min-height: 42px;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    text-align: left;
}

.chat-history-item:hover,
.chat-history-item:focus-visible,
.chat-history-item.active {
    border-color: #c6d8ff;
    background: var(--primary-soft);
}

.chat-history-index {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-muted);
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}

.chat-history-item.active .chat-history-index {
    background: var(--primary);
    color: #ffffff;
}

.chat-history-query {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
}

.chat-history-current {
    padding: 3px 6px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--primary);
    white-space: nowrap;
    font-size: 10px;
    font-weight: 800;
}

.chat-history-empty {
    padding: 14px 12px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.welcome-screen {
    width: min(640px, 100%);
    margin: auto;
    padding: 28px 18px;
    text-align: center;
}

.welcome-icon {
    margin-bottom: 16px;
    color: var(--primary);
}

.welcome-screen h2 {
    color: var(--text);
    font-size: 24px;
    line-height: 1.2;
}

.welcome-sub {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.quick-actions {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.quick-action {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.quick-action:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.message {
    width: min(880px, 100%);
    margin: 0 auto;
    display: flex;
    gap: 12px;
    animation: fadeIn 0.18s ease;
}

.message.jump-highlight .bubble {
    animation: jumpHighlight 1.5s ease;
}

@keyframes jumpHighlight {
    0% {
        border-color: var(--primary);
        box-shadow: 0 0 0 4px var(--primary-soft), 0 12px 28px rgba(49, 87, 213, 0.16);
    }
    100% {
        border-color: var(--line);
        box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
    }
}

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

.avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 800;
}

.message.user .avatar {
    background: var(--primary);
    color: #ffffff;
}

.message.assistant .avatar {
    color: var(--green);
    background: var(--green-soft);
}

.bubble {
    min-width: 0;
    flex: 1;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

.message.assistant .bubble {
    position: relative;
}

.message.user .bubble {
    position: relative;
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
}

.assistant-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.assistant-action-button {
    min-width: 30px;
    max-width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
    transition: max-width 0.18s ease, padding 0.18s ease, gap 0.18s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.assistant-action-button svg {
    flex: 0 0 auto;
}

.assistant-action-label {
    display: inline-block;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 650;
    line-height: 1;
    transition: max-width 0.18s ease, opacity 0.12s ease;
}

.assistant-action-button:hover,
.assistant-action-button:focus-visible {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}

.message.assistant .assistant-action-button:hover:not(:disabled),
.message.assistant .assistant-action-button:focus-visible:not(:disabled) {
    max-width: 158px;
    padding: 0 9px;
    gap: 6px;
    justify-content: flex-start;
}

.message.assistant .assistant-action-button:hover:not(:disabled) .assistant-action-label,
.message.assistant .assistant-action-button:focus-visible:not(:disabled) .assistant-action-label {
    max-width: 118px;
    opacity: 1;
}

.assistant-action-button:disabled {
    cursor: default;
    opacity: 0.55;
}

.message.user .user-message-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    margin-top: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px);
    transition: opacity 0.14s ease, transform 0.14s ease;
}

.message.user:hover .user-message-actions,
.message.user:focus-within .user-message-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.message.user .user-message-actions .assistant-action-button {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.86);
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 6px 16px rgba(22, 44, 110, 0.18);
    backdrop-filter: blur(8px);
}

.message.user .user-message-actions .assistant-action-button:hover,
.message.user .user-message-actions .assistant-action-button:focus-visible {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.18);
}

.assistant-trace {
    color: var(--primary);
}

.assistant-copy.copied {
    color: var(--green);
    border-color: #b7e4dc;
    background: var(--green-soft);
}

.assistant-copy.failed {
    color: var(--red);
    border-color: #fecaca;
    background: var(--red-soft);
}

.message.user .assistant-copy.copied {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.58);
    background: rgba(255, 255, 255, 0.24);
}

.message.user .assistant-copy.failed {
    color: #ffffff;
    border-color: rgba(254, 202, 202, 0.72);
    background: rgba(254, 202, 202, 0.26);
}

.follow-up-message {
    margin-top: -8px;
}

.follow-up-message + .follow-up-message {
    margin-top: -10px;
}

.follow-up-avatar {
    visibility: hidden;
}

.follow-up-question {
    appearance: none;
    min-height: 38px;
    padding: 9px 12px;
    border-color: #cde6e2;
    background: #fbfffe;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
    overflow-wrap: anywhere;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.38;
    box-shadow: 0 1px 4px rgba(15, 118, 110, 0.05);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.follow-up-question::before {
    content: "?";
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border-radius: 50%;
    background: var(--teal-soft);
    color: var(--teal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.follow-up-question:hover:not(:disabled) {
    border-color: var(--teal);
    background: var(--teal-soft);
    color: var(--teal);
    transform: translateY(-1px);
}

.follow-up-question:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.follow-up-question:disabled {
    cursor: default;
    opacity: 0.55;
    transform: none;
}

.input-meta {
    display: grid;
    gap: 5px;
    margin-bottom: 8px;
}

.input-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.input-meta-row span {
    min-height: 21px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
}

.input-meta-row small {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.8;
}

.message.assistant .input-meta-row span {
    background: var(--surface-muted);
    color: var(--text-muted);
}

.bubble p {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.65;
}

.bubble p:last-child {
    margin-bottom: 0;
}

.bubble h1,
.bubble h2,
.bubble h3,
.bubble h4,
.bubble h5,
.bubble h6 {
    margin: 14px 0 7px;
    color: var(--text);
    font-weight: 780;
    line-height: 1.3;
}

.bubble h1:first-child,
.bubble h2:first-child,
.bubble h3:first-child,
.bubble h4:first-child,
.bubble h5:first-child,
.bubble h6:first-child {
    margin-top: 0;
}

.bubble h1 { font-size: 20px; }
.bubble h2 { font-size: 18px; }
.bubble h3 { font-size: 16px; }
.bubble h4,
.bubble h5,
.bubble h6 { font-size: 14px; }

.bubble ul,
.bubble ol {
    margin: 8px 0 10px 22px;
    padding: 0;
    font-size: 14px;
    line-height: 1.65;
}

.bubble li {
    margin: 4px 0;
    padding-left: 2px;
}

.bubble blockquote {
    margin: 10px 0;
    padding: 8px 12px;
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--surface-muted);
    color: var(--text-muted);
}

.bubble blockquote p {
    margin-bottom: 6px;
}

.bubble hr {
    height: 1px;
    margin: 14px 0;
    border: 0;
    background: var(--line);
}

.bubble a {
    color: var(--primary);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.bubble a:hover {
    text-decoration: underline;
}

.code-block {
    position: relative;
    margin: 10px 0;
}

.bubble pre {
    margin: 10px 0;
    padding: 12px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--code);
    font-size: 12px;
    line-height: 1.5;
}

.code-block pre {
    margin: 0;
    padding-right: 48px;
}

.code-copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.82);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
    backdrop-filter: blur(8px);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.code-copy-button:hover,
.code-copy-button:focus-visible {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}

.bubble code {
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--code);
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
}

.bubble pre code {
    padding: 0;
    background: transparent;
}

.markdown-table-wrap {
    max-width: 100%;
    margin: 10px 0 12px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.markdown-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.45;
}

.markdown-table th,
.markdown-table td {
    max-width: 320px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    vertical-align: top;
    overflow-wrap: anywhere;
}

.markdown-table th {
    background: var(--surface-muted);
    color: var(--text);
    font-weight: 760;
    white-space: nowrap;
}

.markdown-table td {
    color: var(--text);
}

.inline-citation-link {
    display: inline-flex;
    align-items: center;
    min-height: 17px;
    margin: 0 1px;
    padding: 0 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #eef6ff;
    color: var(--primary);
    font-size: 11px;
    font-weight: 760;
    line-height: 1.2;
    text-decoration: none;
    vertical-align: baseline;
}

.inline-citation-link::before {
    content: "[";
}

.inline-citation-link::after {
    content: "]";
}

.inline-citation-link:hover {
    border-color: rgba(37, 99, 235, 0.38);
    background: #dbeafe;
    text-decoration: none;
}

.message.user .markdown-table-wrap {
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.08);
}

.message.user .markdown-table th,
.message.user .markdown-table td {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.22);
}

.message.user .markdown-table th {
    background: rgba(255, 255, 255, 0.14);
}

.message-media {
    margin: 12px 0;
}

.media-preview-trigger {
    max-width: 100%;
    display: block;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    cursor: zoom-in;
    text-align: left;
}

.media-preview-trigger:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.message-media img,
.message-media video {
    display: block;
    max-width: 100%;
    max-height: 420px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-muted);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.media-preview-trigger:hover img {
    border-color: var(--primary);
    box-shadow: 0 12px 28px rgba(49, 87, 213, 0.16);
    transform: translateY(-1px);
}

.message-media video {
    width: min(640px, 100%);
}

.message-media figcaption {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.message.user .bubble h1,
.message.user .bubble h2,
.message.user .bubble h3,
.message.user .bubble h4,
.message.user .bubble h5,
.message.user .bubble h6,
.message.user .bubble a {
    color: #ffffff;
}

.message.user .bubble blockquote,
.message.user .bubble hr {
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.12);
}

.message.user .bubble code,
.message.user .bubble pre {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.14);
}

.message.user .code-copy-button {
    color: rgba(255, 255, 255, 0.86);
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 6px 16px rgba(22, 44, 110, 0.16);
}

.message.user .code-copy-button:hover,
.message.user .code-copy-button:focus-visible {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.22);
}

.message-divider {
    height: 1px;
    margin: 14px 0;
    background: var(--line-strong);
    opacity: 0.85;
}

.citation-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    overflow: hidden;
}

.citation-summary {
    min-height: 34px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    list-style: none;
}

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

.citation-title {
    min-width: 0;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.citation-count {
    min-height: 19px;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    white-space: nowrap;
    font-size: 10px;
    font-weight: 700;
}

.citation-list {
    display: grid;
    gap: 7px;
    margin: 0 10px 10px;
    padding: 8px 0 0 18px;
    border-top: 1px solid var(--line);
}

.citation-item {
    min-width: 0;
    padding-left: 2px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.citation-item::marker {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.citation-link {
    width: 100%;
    max-width: 100%;
    min-height: 38px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    vertical-align: top;
}

.citation-item.has-image .citation-link {
    grid-template-columns: 72px minmax(0, 1fr);
}

.citation-link:hover,
.citation-link:focus-visible {
    background: var(--surface);
    text-decoration: none;
}

.citation-thumbnail-wrap {
    width: 72px;
    height: 52px;
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-muted);
}

.citation-thumbnail {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.citation-link-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.citation-link-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.citation-link-host {
    color: var(--text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 500;
}

.citation-link-snippet {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-muted);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.35;
}

.skill-badges,
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skill-badges {
    margin-top: 10px;
}

.skill-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border: 1px solid #b7e4dc;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 11px;
    font-weight: 750;
}

.mono {
    font-family: "SF Mono", Menlo, Consolas, monospace;
}

.trace-events {
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

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

.trace-dot {
    width: 8px;
    height: 8px;
    margin: 6px 0 0 2px;
    border-radius: 50%;
    background: var(--text-soft);
}

.trace-event.completed .trace-dot,
.status-dot.ok {
    background: var(--green);
}

.trace-event.running .trace-dot,
.status-dot.warn,
.status-dot.planned {
    background: var(--orange);
}

.trace-event.error .trace-dot,
.status-dot.error {
    background: var(--red);
}

.trace-body {
    min-width: 0;
    padding-left: 10px;
    border-left: 1px solid var(--line);
}

.trace-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.trace-type {
    color: var(--text);
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.trace-status,
.trace-duration,
.trace-id {
    min-height: 20px;
    padding: 0 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 10px;
    display: inline-flex;
    align-items: center;
}

.trace-id {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trace-title {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.trace-payload {
    max-height: 180px;
    margin-top: 6px;
    white-space: pre-wrap;
    overflow: auto;
}

.error-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
}

.error-banner.rate-limit {
    color: var(--orange);
    background: var(--orange-soft);
    border: 1px solid #fed7aa;
}

.error-banner.generic-error {
    color: var(--red);
    background: var(--red-soft);
    border: 1px solid #fecaca;
}

.error-icon {
    flex: 0 0 auto;
    margin-top: 1px;
}

.error-title {
    margin-bottom: 3px;
    font-size: 13px;
    font-weight: 800;
}

.error-detail {
    font-size: 12px;
}

.input-area {
    padding: 0 20px 20px;
}

.agent-command-bar {
    width: min(880px, 100%);
    margin: 0 auto 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.agent-command-bar[hidden] {
    display: none;
}

.agent-command {
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid #c8d8d0;
    border-radius: var(--radius-sm);
    background: #f4fbf6;
    color: #166534;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.agent-command:hover {
    border-color: #86c99c;
    background: #e8f7ed;
}

.mode-chips {
    width: min(880px, 100%);
    min-height: 26px;
    margin: 0 auto 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mode-chips[hidden] {
    display: none;
}

.mode-chip {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 9px;
    border: 1px solid #c6d8ff;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
}

button.mode-chip {
    cursor: pointer;
    font-family: inherit;
}

button.mode-chip:hover,
button.mode-chip:focus-visible {
    border-color: var(--primary);
    outline: none;
}

.mode-chip small {
    color: inherit;
    font-size: 10px;
    font-weight: 700;
    opacity: 0.75;
}

.drive-path-chip {
    border-color: #b9e4cd;
    background: #edf8f2;
    color: #17613a;
}

.attachment-chip {
    border-color: #d4dde9;
    background: #f8fafc;
    color: var(--text);
}

.drive-context-chip {
    border-color: #badbcc;
    background: #edf8f1;
    color: var(--green);
}

.drive-path-chip {
    max-width: min(420px, 100%);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-image-chip {
    min-height: 54px;
    max-width: min(320px, 100%);
    padding: 4px 28px 4px 4px;
    border-radius: var(--radius-sm);
    gap: 8px;
    position: relative;
}

.attachment-chip.ready {
    border-color: #b7e3c7;
    background: #effaf3;
    color: #166534;
}

.attachment-chip.reading {
    border-color: #c6d8ff;
    background: var(--primary-soft);
    color: var(--primary);
}

.attachment-chip.error {
    border-color: #fecaca;
    background: #fff1f2;
    color: #be123c;
}

.attachment-name {
    max-width: min(220px, 42vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.attachment-image-chip .attachment-name {
    max-width: min(190px, 44vw);
}

.attachment-thumb-button,
.attachment-thumb-placeholder {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(22, 101, 52, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.74);
}

.attachment-thumb-button {
    padding: 0;
    cursor: zoom-in;
}

.attachment-thumb-button:hover {
    border-color: #86c99c;
}

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

.attachment-remove {
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: currentColor;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
}

.attachment-remove:hover {
    background: rgba(15, 23, 42, 0.08);
}

.attachment-image-chip .attachment-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 255, 255, 0.72);
}

.attachment-image-chip .attachment-remove:hover {
    background: rgba(22, 101, 52, 0.14);
}

.input-container {
    width: min(880px, 100%);
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 8px 8px 8px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.input-container:focus-within {
    border-color: var(--primary);
}

.mode-menu {
    position: relative;
    flex: 0 0 auto;
}

.mode-toggle,
.attachment-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.mode-toggle:hover,
.mode-toggle.active,
.attachment-toggle:hover,
.attachment-toggle.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
}

.mode-count {
    position: absolute;
    right: -5px;
    top: -5px;
    min-width: 17px;
    height: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface);
    border-radius: 999px;
    background: var(--primary);
    color: #ffffff;
    font-size: 10px;
    font-weight: 850;
}

.mode-count:empty {
    display: none;
}

.mode-popover {
    position: absolute;
    left: 0;
    bottom: 46px;
    z-index: 50;
    width: min(320px, calc(100vw - 40px));
    padding: 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.mode-popover.hidden {
    display: none;
}

.mode-popover-head {
    padding: 2px 2px 8px;
    color: var(--text);
    font-size: 12px;
    font-weight: 850;
}

.mode-options {
    display: grid;
    gap: 6px;
}

.mode-option {
    min-height: 52px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.mode-option:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.mode-option input {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}

.mode-option-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.mode-option-copy strong {
    color: var(--text);
    font-size: 12px;
    line-height: 1.25;
}

.mode-option-copy small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
}

#message-input {
    width: 100%;
    border: 0;
    outline: none;
    resize: none;
    color: var(--text);
    background: transparent;
    line-height: 1.5;
}

#message-input {
    max-height: 150px;
    padding: 5px 0;
    font-size: 14px;
}

#message-input::placeholder {
    color: var(--text-soft);
}

.btn-send {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    background: var(--primary);
    color: #ffffff;
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-hover);
}

.loading-dots {
    display: inline-flex;
    gap: 5px;
    padding: 5px 0;
}

.loading-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }

.conversation-switch-loading {
    min-height: 180px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
}

.message.streaming .bubble {
    border-color: #c6d8ff;
}

.process-panel {
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    background: #fbfcfe;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.process-panel.live {
    border-color: #d6e2f2;
    background: #fbfcfe;
}

.process-summary {
    min-height: 28px;
    padding: 6px 9px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 12px;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    list-style: none;
    color: #8b96a6;
    font-size: 10px;
    line-height: 1.25;
}

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

.process-summary-title {
    grid-column: 1;
    color: #7a8696;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.process-summary-duration {
    grid-column: 2;
    color: #8b96a6;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 600;
}

.process-summary-arrow {
    grid-column: 3;
    color: #8b96a6;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
}

.process-summary-arrow::before {
    content: ">";
}

.process-panel[open] .process-summary-arrow::before {
    content: "⌄";
}

.process-list {
    max-height: 260px;
    margin: 0;
    padding: 6px 9px 9px;
    border-top: 1px solid rgba(200, 211, 223, 0.55);
    overflow-y: auto;
    display: grid;
    gap: 5px;
}

.process-item {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 7px;
}

.process-item-dot {
    width: 6px;
    height: 6px;
    margin-top: 8px;
    border-radius: 50%;
    background: #b8c2d1;
}

.process-item.completed .process-item-dot {
    background: var(--green);
}

.process-item.running .process-item-dot {
    background: var(--orange);
}

.process-item.error .process-item-dot {
    background: var(--red);
}

.process-item-body {
    min-width: 0;
    padding: 5px 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.62);
}

.process-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.process-item-head strong {
    min-width: 0;
    color: #768396;
    overflow-wrap: anywhere;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.35;
}

.process-item-head span {
    min-height: 16px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: #8b96a6;
    white-space: nowrap;
    font-size: 9px;
    font-weight: 600;
}

.process-item-detail {
    margin-top: 4px;
    color: #8b96a6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 10px;
    line-height: 1.4;
}

.process-item-links,
.process-item-meta {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.process-item-links a,
.process-item-meta span {
    min-height: 16px;
    padding: 0 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-muted);
    color: #8b96a6;
    text-decoration: none;
    font-size: 9px;
    font-weight: 600;
}

.process-item-links a:hover {
    color: var(--primary);
    border-color: #c6d8ff;
    background: var(--primary-soft);
}

.streaming-status {
    margin-bottom: 10px;
}

.message.has-final-content .streaming-trace:not(:empty) + .streaming-content,
.streaming-citations:not(:empty) {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line-strong);
}

.streaming-progress {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.streaming-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 5px;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    animation: pulse 1.2s ease-in-out infinite;
}

.streaming-progress-label {
    color: var(--text);
    font-weight: 650;
}

.streaming-progress-detail {
    margin-top: 2px;
    word-break: break-word;
}

.streaming-task-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.streaming-cancel-button {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

.streaming-cancelled {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.streaming-content:empty::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 18px;
    border-radius: 2px;
    background: var(--primary);
    vertical-align: -3px;
    animation: caretBlink 0.9s steps(2, start) infinite;
}

@keyframes pulse {
    0%, 80%, 100% { opacity: 0.35; transform: scale(0.65); }
    40% { opacity: 1; transform: scale(1); }
}

@keyframes caretBlink {
    50% { opacity: 0; }
}

#view-agents,
#view-tools,
#view-role,
#view-pulse,
#view-todos,
#view-developer,
#view-eval {
    overflow-y: auto;
    padding: 18px;
}

#view-todos {
    align-items: stretch;
    -webkit-overflow-scrolling: touch;
}

.content-grid {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.tools-grid,
.tools-workbench {
    width: min(1180px, 100%);
}

.tools-workbench {
    display: grid;
    gap: 12px;
}

.role-config-workbench {
    width: min(1180px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(230px, 0.72fr) minmax(0, 2fr);
    gap: 14px;
    align-items: start;
}

.role-config-list-panel,
.role-config-editor-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

.role-config-list-panel {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.role-config-panel-head,
.role-config-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.role-config-panel-head h2,
.role-config-section-head h2 {
    color: var(--text);
    font-size: 15px;
    line-height: 1.3;
}

.role-config-panel-head p,
.role-config-section-head p {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
}

.role-config-list {
    display: grid;
    gap: 6px;
}

.role-config-empty {
    padding: 24px 10px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.role-config-list-item {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}

.role-config-list-item.active {
    border-color: #b8cdfd;
    background: var(--primary-soft);
    box-shadow: inset 3px 0 0 var(--primary);
}

.role-config-list-select {
    min-width: 0;
    padding: 9px 10px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: grid;
    gap: 3px;
    text-align: left;
}

.role-config-list-select span,
.role-config-list-select small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-config-list-select span {
    font-size: 12px;
    font-weight: 800;
}

.role-config-list-select small {
    color: var(--text-muted);
    font-size: 10px;
}

.role-config-lock,
.role-config-list-delete {
    width: 28px;
    height: 28px;
    margin-right: 3px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.role-config-list-delete {
    cursor: pointer;
}

.role-config-list-delete:hover:not(:disabled) {
    color: var(--red);
    background: var(--red-soft);
}

.role-config-new {
    width: 100%;
}

.role-config-editor-panel {
    padding: 16px;
}

.role-config-templates {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.role-config-template-list {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.role-config-template {
    min-width: 0;
    min-height: 76px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
    display: grid;
    align-content: start;
    gap: 5px;
    text-align: left;
}

.role-config-template:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.role-config-template strong {
    font-size: 12px;
}

.role-config-template span {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-muted);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 11px;
    line-height: 1.4;
}

.role-config-form-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.role-config-field {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 6px;
}

.role-config-field-wide {
    grid-column: 1 / -1;
}

.role-config-field > span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.role-config-input {
    min-width: 0;
    width: 100%;
    min-height: 38px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text);
    outline: none;
    font: inherit;
    font-size: 12px;
}

.role-config-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(57, 106, 255, 0.1);
}

.role-config-input:disabled {
    cursor: not-allowed;
    opacity: 0.66;
}

.role-config-textarea {
    min-height: 116px;
    resize: vertical;
    line-height: 1.5;
}

.role-config-editor-hint {
    margin-top: 12px;
    padding: 9px 10px;
    border: 1px solid #d7e3ff;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
}

.role-config-editor-hint[hidden] {
    display: none;
}

.role-config-options,
.role-config-actions {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.role-config-options label {
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
}

.role-config-actions {
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.role-config-actions .btn-primary {
    width: auto;
}

.role-config-delete:not(:disabled) {
    color: var(--red);
    border-color: #fecaca;
}

.role-config-delete:hover:not(:disabled) {
    color: #fff;
    border-color: var(--red);
    background: var(--red);
}

.role-config-status {
    flex: 1 1 220px;
    min-width: 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.role-config-status.ok {
    color: var(--green);
}

.role-config-status.error {
    color: var(--red);
}

.tools-toolbar,
.tool-mcp-panel,
.tool-group {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

.tools-toolbar {
    min-height: 78px;
    padding: 12px;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 520px) auto;
    gap: 12px;
    align-items: center;
}

.tools-toolbar-copy {
    min-width: 0;
}

.tools-toolbar h2,
.tool-mcp-head h2,
.tool-group-head h2 {
    color: var(--text);
    font-size: 15px;
    line-height: 1.25;
}

.tools-toolbar p,
.tool-mcp-head p {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.tools-toolbar-controls {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(160px, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.tools-search {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text);
    outline: none;
    font-size: 12px;
    font-weight: 650;
}

.tools-search:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.1);
}

.segmented-control {
    min-height: 34px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.segmented-control button {
    min-width: 58px;
    min-height: 26px;
    padding: 0 8px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
}

.segmented-control button:hover,
.segmented-control button.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

.tool-mcp-panel {
    padding: 12px;
    display: grid;
    gap: 10px;
}

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

.tool-mcp-editor {
    display: grid;
    gap: 6px;
}

.tool-mcp-editor span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.tool-mcp-editor textarea {
    width: 100%;
    min-height: 112px;
    resize: vertical;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfdff;
    color: var(--text);
    outline: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.45;
}

.tool-mcp-editor textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.1);
}

.tool-mcp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tool-group {
    overflow: hidden;
}

.tool-group-head {
    min-height: 42px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tool-list {
    display: grid;
}

.tool-row {
    min-height: 66px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    border-bottom: 1px solid var(--line);
}

.tool-row:last-child {
    border-bottom: 0;
}

.tool-row.disabled {
    background: #fbfcfe;
}

.tool-row-main {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.tool-row-actions {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.tool-policy-control {
    display: grid;
    justify-items: end;
    gap: 3px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
}

.tool-policy-control select {
    min-width: 118px;
    height: 30px;
    padding: 0 26px 0 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
}

.tool-risk.medium {
    border-color: #f0c36d;
    color: #8a5a00;
}

.tool-risk.high {
    border-color: #ef9a9a;
    color: #a52828;
}

.tool-identity {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.tool-identity .mono {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.tool-row p {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-height: 20px;
    overflow: hidden;
}

.tool-meta-line {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
}

.tool-tags .chip {
    min-height: 20px;
    padding: 0 7px;
    font-size: 10px;
}

.tool-details {
    width: fit-content;
    max-width: 100%;
}

.tool-details[open] {
    width: 100%;
    flex-basis: 100%;
}

.tool-details summary {
    width: fit-content;
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

@media (max-width: 720px) {
    .tool-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .tool-row-actions,
    .tool-policy-control {
        justify-items: start;
    }
}

.tool-details[open] summary {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #c6d8ff;
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.toggle-switch input {
    appearance: none;
    width: 38px;
    height: 22px;
    padding: 2px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface-muted);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.toggle-switch input::before {
    content: "";
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.25);
    transition: transform 0.15s ease;
}

.toggle-switch input:checked {
    border-color: #8bd8cd;
    background: var(--green);
}

.toggle-switch input:checked::before {
    transform: translateX(16px);
}

.toggle-switch input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.tool-toggle {
    padding-top: 2px;
}

#agents-grid {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 18px;
}

.developer-workbench {
    width: min(1180px, 100%);
    display: grid;
    gap: 14px;
}

.developer-toolbar,
.developer-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

.developer-toolbar {
    min-height: 82px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.developer-toolbar h2,
.developer-panel-head h2 {
    color: var(--text);
    font-size: 16px;
    line-height: 1.25;
}

.developer-toolbar p,
.developer-panel-head p,
.developer-memory-type p {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.55;
}

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

.developer-summary-card {
    min-height: 82px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    display: grid;
    align-content: center;
    gap: 5px;
}

.developer-summary-card span,
.developer-summary-card small {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 750;
}

.developer-summary-card strong {
    color: var(--text);
    font-size: 19px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.developer-memory-model {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.developer-memory-type {
    min-height: 128px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    align-content: start;
    gap: 7px;
}

.developer-memory-type h3 {
    color: var(--text);
    font-size: 13px;
    line-height: 1.3;
}

.developer-panel {
    padding: 14px;
    display: grid;
    gap: 12px;
}

.developer-inventory-panel {
    align-content: start;
}

.developer-panel-head,
.developer-memory-group-head,
.developer-memory-record-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.developer-memory-record-subhead,
.developer-memory-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.developer-memory-record-subhead {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 750;
}

.developer-memory-controls {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(126px, 0.7fr)) auto auto;
    align-items: end;
    gap: 8px;
}

.developer-memory-control {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.developer-memory-control > span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
}

.developer-memory-control input,
.developer-memory-control select {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    padding: 0 9px;
    font-size: 12px;
    outline: none;
}

.developer-memory-control input:focus,
.developer-memory-control select:focus {
    border-color: var(--primary);
}

.developer-memory-count {
    align-content: end;
}

.developer-memory-bulk-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.developer-memory-selected-count {
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 800;
}

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

.developer-memory-inventory {
    grid-template-columns: 1fr;
}

.developer-memory-group {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.developer-memory-group-head {
    min-height: 28px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
}

.developer-memory-group-head h3 {
    color: var(--text);
    font-size: 13px;
}

.developer-memory-group-head span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.developer-memory-list {
    display: grid;
    gap: 9px;
}

.developer-memory-inventory .developer-memory-list {
    max-height: min(62vh, 680px);
    overflow-y: auto;
    padding-right: 4px;
}

.developer-memory-group-long_term .developer-memory-list {
    gap: 7px;
    max-height: calc(8 * 42px + 7 * 7px + 16px);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}

.developer-memory-no-results {
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.64);
    text-align: center;
}

.developer-memory-record {
    min-width: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    background: var(--surface);
    display: grid;
    gap: 0;
    overflow: hidden;
}

.developer-memory-record.long-term {
    border-left-color: var(--green);
}

.developer-memory-record.long-term.selected {
    border-color: rgba(40, 161, 107, 0.55);
    border-left-color: var(--green);
    box-shadow: inset 0 0 0 1px rgba(40, 161, 107, 0.12);
}

.developer-memory-record.long-term.compact {
    height: 42px;
}

.developer-memory-record.expanded {
    border-color: var(--line-strong);
}

.developer-memory-record .developer-memory-record-head {
    padding: 9px 10px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    justify-content: normal;
    gap: 9px;
}

.developer-memory-record.long-term .developer-memory-record-head {
    min-height: 40px;
    padding: 5px 10px;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
}

.developer-memory-toggle {
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.developer-memory-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.developer-memory-toggle-icon {
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid currentColor;
    transition: transform 0.16s ease;
}

.developer-memory-toggle[aria-expanded="true"] .developer-memory-toggle-icon {
    transform: rotate(90deg);
}

.developer-memory-select {
    width: 28px;
    min-height: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.developer-memory-select:hover {
    border-color: var(--green);
}

.developer-memory-select input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--green);
    cursor: pointer;
}

.developer-memory-select input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.developer-memory-record-main {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.developer-memory-record-line {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.developer-memory-record.expanded .developer-memory-record-line {
    display: grid;
    gap: 7px;
}

.developer-memory-record.long-term .developer-memory-record-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.developer-memory-preview {
    flex: 1 1 auto;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.developer-memory-record.long-term .developer-memory-preview {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.developer-memory-record.expanded .developer-memory-preview {
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: initial;
    overflow: visible;
    white-space: pre-wrap;
}

.developer-memory-record-badges {
    flex: 0 0 auto;
    max-width: 46%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 5px;
}

.developer-memory-record.expanded .developer-memory-record-badges {
    max-width: 100%;
    justify-content: flex-start;
}

.developer-memory-record.long-term .developer-memory-record-badges {
    max-width: min(46vw, 640px);
    flex-wrap: nowrap;
    overflow: hidden;
}

.developer-memory-record.long-term .developer-memory-record-badges .status-chip {
    flex: 0 0 auto;
}

.developer-memory-record.long-term .developer-memory-record-badges code {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.developer-memory-record.long-term .developer-memory-record-subhead {
    display: none;
}

.developer-memory-hover-card {
    position: fixed;
    z-index: 3000;
    width: min(760px, calc(100vw - 36px));
    max-height: min(42vh, 300px);
    overflow-y: auto;
    padding: 14px 16px;
    border: 1px solid var(--line-strong);
    border-left: 4px solid var(--green);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    pointer-events: auto;
}

.developer-memory-hover-card[hidden] {
    display: none;
}

.developer-memory-record code {
    min-height: 22px;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 10px;
}

.developer-memory-record p {
    color: var(--text);
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.developer-memory-detail {
    padding: 10px 11px 11px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    display: grid;
    gap: 9px;
}

.developer-memory-full {
    display: grid;
    gap: 5px;
}

.developer-memory-full > span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
}

.developer-memory-full p {
    white-space: pre-wrap;
}

.developer-memory-meta,
.developer-run-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.developer-memory-meta span {
    min-height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 750;
}

.developer-memory-metadata {
    border-top: 1px solid var(--line);
    padding-top: 7px;
}

.developer-memory-actions {
    padding-top: 2px;
}

.developer-memory-action {
    min-height: 28px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.developer-memory-action:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.developer-memory-action.danger:hover:not(:disabled) {
    border-color: var(--red);
    color: var(--red);
}

.developer-memory-action:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.developer-memory-metadata summary {
    cursor: pointer;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
}

.developer-memory-metadata pre {
    margin-top: 7px;
    max-height: 220px;
    overflow: auto;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--code);
    color: var(--text);
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.45;
}

.developer-banner {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.developer-banner.warn {
    border-color: #fed7aa;
    background: var(--orange-soft);
    color: var(--orange);
}

.developer-banner.error {
    border-color: #fecaca;
    background: var(--red-soft);
    color: var(--red);
}

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

.eval-run-button {
    width: auto;
}

.eval-scenario-control {
    min-height: 34px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: flex;
    align-items: center;
    gap: 7px;
}

.eval-scenario-control span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.eval-scenario-control select {
    min-width: 118px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    outline: none;
}

.eval-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    gap: 14px;
    align-items: start;
}

.eval-panel {
    min-width: 0;
}

.eval-panel-head {
    align-items: flex-start;
    flex-wrap: wrap;
}

.eval-panel-head > div:first-child {
    min-width: 0;
}

.eval-case-list {
    min-height: 0;
    overflow: visible;
    display: grid;
    gap: 10px;
}

.eval-case-list.approved {
    min-height: 0;
}

.eval-pagination {
    min-width: 0;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.eval-panel-head .eval-pagination,
.eval-section-head-row .eval-pagination {
    margin-left: auto;
    padding: 0;
    border: 0;
    background: transparent;
    justify-content: flex-end;
}

.eval-pagination > span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 750;
    line-height: 1.3;
    white-space: nowrap;
}

.eval-page-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.eval-page-actions strong {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 850;
    line-height: 1.3;
    white-space: nowrap;
}

.eval-case-card {
    min-width: 0;
    padding: 11px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--teal);
    border-radius: var(--radius-sm);
    background: var(--surface);
    display: grid;
    gap: 9px;
}

.eval-case-card.approved {
    border-left-color: var(--violet);
}

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

.eval-case-title {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.eval-case-title strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.eval-case-title span {
    color: var(--text-soft);
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 10px;
    overflow-wrap: anywhere;
}

.eval-case-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.eval-case-section {
    display: grid;
    gap: 7px;
}

.eval-case-section h3 {
    margin: 0;
    color: var(--text);
    font-size: 12px;
    font-weight: 850;
}

.eval-field {
    display: grid;
    gap: 5px;
}

.eval-field > span,
.eval-list-block > span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
}

.eval-field p {
    color: var(--text);
    font-size: 12px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

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

.eval-list-block {
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    gap: 5px;
}

.eval-list-block ul {
    margin: 0;
    padding-left: 16px;
    color: var(--text);
    font-size: 11px;
    line-height: 1.45;
}

.eval-list-block p {
    margin: 0;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.45;
}

.eval-dimension-list {
    display: grid;
    gap: 6px;
}

.eval-dimension-line {
    min-width: 0;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.eval-dimension-line > div {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.eval-dimension-line strong {
    color: var(--text);
    font-size: 11px;
    line-height: 1.25;
}

.eval-dimension-line p,
.eval-dimension-line ul {
    margin: 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.eval-dimension-line ul {
    padding-left: 16px;
}

.eval-dimension-line > span {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.25;
    text-align: right;
    white-space: nowrap;
}

.eval-report-panel {
    margin-bottom: 20px;
}

.eval-report-prominent {
    display: grid;
    gap: 12px;
}

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

.eval-report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.eval-report-meta span {
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
}

.eval-report-meta strong {
    margin-right: 5px;
    color: var(--text);
}

.eval-report-history-list {
    display: grid;
    gap: 8px;
}

.eval-report-entry {
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}

.eval-report-entry.error {
    border-color: rgba(220, 38, 38, 0.24);
}

.eval-report-entry summary {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    cursor: pointer;
    list-style: none;
}

.eval-report-entry summary::-webkit-details-marker {
    display: none;
}

.eval-report-entry-main {
    min-width: 0;
}

.eval-report-entry-main strong {
    display: block;
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
}

.eval-report-entry-main small {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.eval-report-entry-body {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
}

.eval-scorecard-section {
    display: grid;
    gap: 8px;
}

.eval-section-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.eval-section-head h3 {
    margin: 0;
    color: var(--text);
    font-size: 12px;
    font-weight: 850;
}

.eval-section-head p {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
}

.eval-dimension-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.eval-dimension-card {
    min-width: 0;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    gap: 7px;
}

.eval-dimension-card > div:first-child {
    min-width: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.eval-dimension-card strong {
    color: var(--text);
    font-size: 12px;
    line-height: 1.3;
}

.eval-dimension-card span,
.eval-dimension-card small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
}

.eval-score-meter {
    height: 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.eval-score-meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.eval-tag-slice-list {
    display: grid;
    gap: 6px;
}

.eval-tag-slice-row {
    min-width: 0;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, minmax(54px, auto));
    gap: 8px;
    align-items: center;
}

.eval-tag-slice-name {
    min-width: 0;
}

.eval-tag-slice-row strong {
    display: block;
    color: var(--text);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.eval-tag-slice-row small {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.eval-tag-slice-row span {
    color: var(--text-muted);
    font-size: 11px;
    text-align: right;
}

.eval-result-list {
    display: grid;
    gap: 7px;
}

.eval-result-row {
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}

.eval-result-row summary {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    cursor: pointer;
    list-style: none;
}

.eval-result-row summary::-webkit-details-marker {
    display: none;
}

.eval-result-row[open] {
    background: var(--surface);
}

.eval-result-row.error {
    border-color: rgba(220, 38, 38, 0.24);
}

.eval-result-row strong {
    display: block;
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
}

.eval-result-row small,
.eval-result-row p {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.eval-dimension-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.eval-dimension-chip {
    min-width: 0;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--text-muted);
    background: var(--surface);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
}

.eval-dimension-chip.pass {
    border-color: rgba(22, 163, 74, 0.24);
    color: #166534;
    background: rgba(22, 163, 74, 0.08);
}

.eval-dimension-chip.fail {
    border-color: rgba(220, 38, 38, 0.24);
    color: #991b1b;
    background: rgba(220, 38, 38, 0.08);
}

.eval-result-details {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.eval-detail-block {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.eval-detail-block-wide {
    grid-column: 1 / -1;
}

.eval-detail-block strong {
    color: var(--text);
    font-size: 11px;
    line-height: 1.3;
}

.eval-detail-block ul,
.eval-detail-block p {
    margin: 0;
    padding-left: 16px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.eval-detail-block p {
    padding-left: 0;
}

.eval-response-preview {
    max-height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.eval-trace-action {
    justify-self: start;
}

.eval-run-history-list {
    display: grid;
    gap: 6px;
}

.eval-run-history-row {
    min-width: 0;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, auto) minmax(70px, auto) minmax(54px, auto);
    gap: 8px;
    align-items: center;
}

.eval-run-history-row strong {
    color: var(--text);
    font-size: 12px;
}

.eval-run-history-row span {
    color: var(--text-muted);
    font-size: 11px;
    text-align: right;
}

.eval-edit-panel {
    width: min(920px, calc(100vw - 36px));
    max-height: min(86vh, 860px);
    overflow-y: auto;
}

.eval-edit-head {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.eval-edit-head span {
    color: var(--text-soft);
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 10px;
    overflow-wrap: anywhere;
}

.eval-edit-section {
    display: grid;
    gap: 9px;
}

.eval-edit-section h3 {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
}

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

.eval-edit-field {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.eval-edit-field.compact {
    max-width: 220px;
}

.eval-edit-field span,
.eval-edit-list-head span,
.eval-edit-dimension-row label span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
}

.eval-edit-field input,
.eval-edit-field textarea,
.eval-edit-list-row input,
.eval-edit-dimension-row input,
.eval-edit-dimension-row select,
.eval-edit-dimension-row textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
}

.eval-edit-field input,
.eval-edit-list-row input,
.eval-edit-dimension-row input,
.eval-edit-dimension-row select {
    height: 34px;
    padding: 0 9px;
}

.eval-edit-field textarea,
.eval-edit-dimension-row textarea {
    padding: 8px 9px;
    resize: vertical;
    line-height: 1.45;
}

.eval-edit-list-field {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.eval-edit-list-head {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.eval-edit-list-add {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--primary);
    font-size: 11px;
    font-weight: 850;
    cursor: pointer;
}

.eval-edit-list {
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
    list-style: none;
}

.eval-edit-list-row {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px;
    gap: 6px;
    align-items: center;
}

.eval-edit-list-remove {
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
}

.eval-edit-list-remove:hover {
    border-color: rgba(220, 38, 38, 0.24);
    color: #991b1b;
    background: rgba(220, 38, 38, 0.08);
}

.eval-edit-dimensions {
    display: grid;
    gap: 7px;
}

.eval-edit-dimension-row {
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    gap: 9px;
}

.eval-edit-dimension-top {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 8px;
    align-items: end;
}

.eval-edit-dimension-row strong {
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
}

.eval-edit-dimension-row label {
    display: grid;
    gap: 4px;
}

.data-card,
.run-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

.data-card {
    min-height: 210px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.data-card.compact-card {
    min-height: 150px;
}

.data-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.card-topline {
    min-height: 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 11px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-soft);
    flex: 0 0 auto;
}

.data-card h2,
.run-panel h2 {
    color: var(--text);
    font-size: 16px;
    line-height: 1.25;
}

.data-card p,
.run-panel p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.55;
}

.aigc-workbench {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.aigc-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

.aigc-form-panel {
    padding: 14px;
    display: grid;
    gap: 12px;
}

.aigc-results-panel {
    padding: 14px;
    display: grid;
    gap: 12px;
}

.todo-workbench {
    width: min(1180px, 100%);
    height: min(760px, calc(100vh - 136px));
    min-height: 520px;
    min-height: min(520px, calc(100dvh - 98px));
}

.todo-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 14px;
    align-items: stretch;
    height: 100%;
    min-height: 100%;
}

.todo-main-panel,
.todo-suggestion-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

.todo-main-panel {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow: hidden;
}

.todo-suggestion-panel {
    padding: 14px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
    position: sticky;
    top: 0;
    max-height: min(760px, calc(100vh - 136px));
    min-height: 0;
    overflow: hidden;
}

.todo-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

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

.todo-create-panel {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(132px, 150px) minmax(132px, 150px) 112px 94px;
    align-items: start;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}

.todo-create-panel label,
.todo-edit-card label,
.todo-field {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 4px;
}

.todo-create-panel label span,
.todo-edit-card label span,
.todo-field span {
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
}

.todo-create-panel input,
.todo-create-panel select {
    min-width: 0;
    height: 36px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-size: 13px;
}

.todo-date-summary {
    min-width: 0;
    height: 36px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 750;
}

.todo-edit-card .todo-date-summary {
    align-self: end;
}

.todo-create-panel input:focus,
.todo-create-panel select:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 2px rgba(49, 87, 213, 0.12);
}

.todo-add-button {
    height: 36px;
    min-height: 36px;
}

.todo-notes-input {
    grid-column: 1 / 5;
}

.todo-scope-hint {
    min-height: 28px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #f8fbff;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.todo-banner {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
}

.todo-banner.error {
    border: 1px solid #fecdd3;
    background: var(--red-soft);
    color: var(--red);
}

.todo-banner.notice {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.todo-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.todo-tab {
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.todo-tab:hover,
.todo-tab.active {
    border-color: #c6d8ff;
    background: var(--primary-soft);
    color: var(--primary);
}

.todo-tab strong {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--surface);
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.todo-list {
    display: grid;
    grid-auto-rows: max-content;
    align-content: start;
    gap: 8px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-right: 2px;
}

.todo-suggestion-list {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}

.todo-month-view {
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 10px;
}

.todo-month-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.todo-month-head strong {
    min-width: 116px;
    color: var(--text);
    font-size: 15px;
    font-weight: 850;
    text-align: center;
}

.todo-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.todo-month-weekday {
    min-height: 22px;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 850;
}

.todo-month-day {
    min-width: 0;
    min-height: 92px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 5px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.todo-month-day:hover {
    border-color: #b7c7ff;
    box-shadow: 0 5px 14px rgba(49, 87, 213, 0.08);
}

.todo-month-day.muted {
    background: var(--surface-muted);
    opacity: 0.66;
}

.todo-month-day.today {
    border-color: #c6d8ff;
    background: var(--primary-soft);
}

.todo-month-day.selected {
    border-color: var(--violet);
    box-shadow: inset 0 0 0 1px rgba(109, 74, 255, 0.35), 0 6px 18px rgba(109, 74, 255, 0.12);
}

.todo-month-day.expanded {
    min-height: 178px;
    background: #ffffff;
    z-index: 1;
}

.todo-month-date {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 850;
}

.todo-month-items {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 4px;
}

.todo-month-day.expanded .todo-month-items {
    max-height: 226px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
}

.todo-month-item {
    width: 100%;
    min-width: 0;
    min-height: 20px;
    padding: 2px 5px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--todo-soft, var(--surface));
    color: var(--todo-ink, var(--text));
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    font-size: 11px;
    font-weight: 750;
    border-left: 3px solid var(--todo-accent, #c6d8ff);
}

.todo-month-item:hover {
    border-color: #c6d8ff;
    color: var(--primary);
}

.todo-month-item.done {
    color: var(--text-soft);
    text-decoration: line-through;
    background: var(--surface-muted);
    border-left-color: var(--green);
}

.todo-month-more {
    width: fit-content;
    max-width: 100%;
    min-height: 20px;
    padding: 0 6px;
    border: 1px dashed var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.todo-month-more:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.todo-month-detail {
    min-width: 0;
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.todo-month-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.todo-month-detail-head div {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.todo-month-detail-head span {
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
}

.todo-month-detail-head strong {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--violet-soft);
    color: var(--violet);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.todo-month-detail-list {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.todo-item {
    --todo-accent: #3157d5;
    --todo-soft: #e9f0ff;
    --todo-ink: #2448b5;
    position: relative;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    padding: 11px 12px 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--todo-soft) 0, var(--surface) 28%);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
    overflow: hidden;
}

@media (min-width: 861px) {
    .todo-list > .todo-item:not(.todo-edit-card) {
        min-height: 72px;
    }
}

.todo-item::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--todo-accent);
}

.todo-item:hover {
    border-color: #c6d8ff;
    box-shadow: 0 6px 16px rgba(49, 87, 213, 0.08);
}

.todo-item.done {
    background: var(--surface-muted);
    color: var(--text-muted);
    box-shadow: none;
}

.todo-item.done::before {
    background: var(--green);
}

.todo-item.done .todo-item-title {
    text-decoration: line-through;
}

.todo-item-body {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.todo-item-title,
.todo-suggestion-title {
    color: var(--text);
    font-size: 14.5px;
    font-weight: 750;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.todo-item-notes,
.todo-suggestion-notes,
.todo-suggestion-card p {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.todo-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

.todo-item-meta span {
    min-height: 20px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--todo-soft);
    color: var(--todo-ink);
}

.todo-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.todo-priority.high {
    background: var(--rose-soft);
    color: var(--rose);
}

.todo-priority.low {
    background: var(--teal-soft);
    color: var(--teal);
}

.todo-tone-0 {
    --todo-accent: #3157d5;
    --todo-soft: #e9f0ff;
    --todo-ink: #2448b5;
}

.todo-tone-1 {
    --todo-accent: #0f766e;
    --todo-soft: #e6f7f4;
    --todo-ink: #0f766e;
}

.todo-tone-2 {
    --todo-accent: #b45309;
    --todo-soft: #fff5e7;
    --todo-ink: #92400e;
}

.todo-tone-3 {
    --todo-accent: #be3455;
    --todo-soft: #fff0f3;
    --todo-ink: #9f1239;
}

.todo-tone-4 {
    --todo-accent: #6d4aff;
    --todo-soft: #f0edff;
    --todo-ink: #5b35d5;
}

.todo-tone-5 {
    --todo-accent: #15803d;
    --todo-soft: #ecfdf3;
    --todo-ink: #166534;
}

.todo-tone-6 {
    --todo-accent: #2563eb;
    --todo-soft: #eff6ff;
    --todo-ink: #1d4ed8;
}

.todo-mini-button {
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.todo-edit-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    column-gap: 10px;
    row-gap: 10px;
    padding: 13px;
    background: linear-gradient(90deg, var(--todo-soft) 0, #ffffff 30%);
    scroll-margin-block: 8px;
}

.todo-edit-card::before {
    background: var(--todo-accent);
}

.todo-edit-card input,
.todo-edit-card select {
    min-width: 0;
    height: 36px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-size: 13px;
}

.todo-edit-card input:focus,
.todo-edit-card select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(49, 87, 213, 0.12);
}

.todo-edit-title-field,
.todo-edit-notes-field {
    grid-column: 1 / -1;
}

.todo-edit-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.todo-edit-actions .btn-secondary,
.todo-edit-actions .btn-primary {
    width: auto;
    min-width: 92px;
    white-space: nowrap;
}

@media (min-width: 1400px) {
    .todo-edit-card {
        grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(108px, 0.8fr));
    }
}

.todo-mini-button:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.todo-mini-button.danger:hover {
    background: var(--red-soft);
    color: var(--red);
}

.todo-create-toggle {
    min-height: 34px;
}

.todo-suggestion-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.todo-suggestion-head > div {
    min-width: 0;
}

.todo-suggestion-head .btn-secondary {
    flex: 0 0 auto;
    white-space: nowrap;
}

.todo-suggestion-head .btn-secondary span {
    white-space: nowrap;
}

.todo-suggestion-head h2 {
    color: var(--text);
    font-size: 16px;
    line-height: 1.25;
}

.todo-suggestion-head p {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.35;
}

.todo-suggestion-card {
    display: grid;
    gap: 7px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.todo-suggestion-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.pulse-workbench {
    width: min(1320px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 14px;
    align-items: start;
}

.pulse-topic-panel,
.pulse-feed {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

.pulse-topic-panel {
    padding: 14px;
    display: grid;
    gap: 12px;
    position: sticky;
    top: 0;
}

.pulse-panel-head,
.pulse-feed-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.pulse-panel-head h2,
.pulse-feed-toolbar h2 {
    color: var(--text);
    font-size: 16px;
    line-height: 1.25;
}

.pulse-panel-head p,
.pulse-feed-toolbar p {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.pulse-topic-form {
    display: grid;
    gap: 10px;
}

.pulse-topic-form label {
    display: grid;
    gap: 5px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 750;
}

.pulse-topic-form input {
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text);
    outline: none;
}

.pulse-topic-form input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 2px rgba(49, 87, 213, 0.12);
}

.pulse-submit {
    margin-top: 2px;
}

.pulse-topic-list {
    display: grid;
    gap: 8px;
}

.pulse-topic-item {
    min-height: 48px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px;
    align-items: center;
    gap: 8px;
}

.pulse-topic-item.muted {
    opacity: 0.62;
}

.pulse-topic-item.selected {
    border-color: #c6d8ff;
    background: var(--primary-soft);
}

.pulse-topic-select {
    min-width: 0;
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    display: grid;
    gap: 3px;
}

.pulse-topic-select strong {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 13px;
}

.pulse-topic-select span {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
}

.pulse-topic-delete {
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-soft);
}

.pulse-topic-delete:hover {
    color: var(--red);
    background: var(--red-soft);
    border-color: #fecaca;
}

.pulse-suggested-topic-section {
    display: grid;
    gap: 8px;
}

.pulse-suggested-topic-section h3 {
    color: var(--text);
    font-size: 12px;
    line-height: 1.25;
}

.pulse-suggested-topic-list {
    display: grid;
    gap: 8px;
}

.pulse-suggested-topic {
    width: 100%;
    min-height: 54px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.pulse-suggested-topic:hover {
    border-color: var(--primary);
    background: var(--surface);
}

.pulse-suggested-topic-main {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.pulse-suggested-topic-main strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.pulse-suggested-topic-main small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.pulse-suggested-topic-action {
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.pulse-feed {
    padding: 14px;
    display: grid;
    gap: 12px;
}

.pulse-topic-filter {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.pulse-filter-chip {
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
}

.pulse-filter-chip span {
    color: var(--text-subtle);
    font-size: 11px;
}

.pulse-filter-chip.active {
    border-color: #c6d8ff;
    background: var(--primary-soft);
    color: var(--primary);
}

.pulse-items {
    display: grid;
    gap: 10px;
}

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

.pulse-module {
    min-width: 0;
    display: grid;
    gap: 10px;
}

.pulse-module + .pulse-module {
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.pulse-module-head {
    min-height: 38px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.pulse-module-head h3 {
    color: var(--text);
    font-size: 15px;
    line-height: 1.25;
}

.pulse-module-head p {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.pulse-module-items {
    display: grid;
    gap: 10px;
}

.pulse-module-empty {
    min-height: 86px;
}

.pulse-card {
    min-width: 0;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    display: grid;
    gap: 8px;
}

.pulse-post-card {
    min-height: 190px;
}

.pulse-card:hover {
    border-color: #c6d8ff;
    box-shadow: 0 1px 6px rgba(16, 24, 40, 0.06);
}

.pulse-card.expanded {
    border-color: #c6d8ff;
    box-shadow: 0 0 0 2px rgba(49, 87, 213, 0.1);
}

.pulse-card-open {
    width: 100%;
    min-width: 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    display: grid;
    gap: 8px;
    text-align: left;
    cursor: pointer;
}

.pulse-card-topline {
    min-height: 22px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.pulse-heat {
    margin-left: auto;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 750;
}

.pulse-card h3 {
    color: var(--text);
    font-size: 15px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.pulse-card p {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pulse-card-sources {
    display: grid;
    gap: 5px;
}

.pulse-card-source {
    min-width: 0;
    padding: 6px 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: inherit;
    display: grid;
    gap: 2px;
    text-decoration: none;
}

.pulse-card-source:hover {
    border-color: var(--primary);
    background: var(--surface);
}

.pulse-card-source span {
    color: var(--text-subtle);
    font-size: 10px;
    line-height: 1.2;
}

.pulse-card-source strong {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 750;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.pulse-card-actions,
.pulse-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pulse-recommend-note {
    min-width: 0;
    flex: 1 1 120px;
    color: var(--text-subtle);
    font-size: 11px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-feedback-actions,
.pulse-post-feedback {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pulse-feedback-button {
    min-height: 28px;
    padding: 5px 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 750;
    line-height: 1;
}

.pulse-feedback-button:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.pulse-feedback-button.active {
    border-color: #b7ccff;
    color: var(--primary);
    background: var(--primary-soft);
}

.pulse-feedback-button small {
    color: var(--text-subtle);
    font-size: 10px;
}

.pulse-detail {
    padding-top: 10px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 12px;
}

.pulse-detail section {
    display: grid;
    gap: 6px;
}

.pulse-detail p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.pulse-detail h4 {
    color: var(--text);
    font-size: 12px;
    line-height: 1.25;
}

.pulse-detail ul {
    display: grid;
    gap: 6px;
    padding-left: 18px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.pulse-source-list {
    display: grid;
    gap: 8px;
}

.pulse-source-item {
    display: grid;
    gap: 4px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: inherit;
    text-decoration: none;
}

.pulse-source-item:hover {
    border-color: var(--primary);
    background: var(--surface);
}

.pulse-source-link {
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.pulse-source-meta {
    color: var(--text-subtle);
    font-size: 11px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.pulse-post-source-section {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.pulse-post-source-section h4 {
    color: var(--text);
    font-size: 12px;
    line-height: 1.25;
}

.pulse-question-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.pulse-question {
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
}

.pulse-question:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.pulse-related-list {
    display: grid;
    gap: 8px;
}

.pulse-related-item {
    width: 100%;
    min-height: 48px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: inherit;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-align: left;
}

.pulse-related-item:not(:disabled):hover {
    border-color: var(--primary);
    background: var(--surface);
}

.pulse-related-item:disabled {
    cursor: default;
    opacity: 0.62;
}

.pulse-related-main {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.pulse-related-main strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.pulse-related-main small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.pulse-related-action {
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.pulse-post-window.hidden {
    display: none;
}

body.pulse-post-open {
    overflow: hidden;
}

body.share-card-open {
    overflow: hidden;
}

.pulse-post-window {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
}

.pulse-post-backdrop {
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(2px);
    cursor: pointer;
}

.pulse-post-panel {
    position: relative;
    z-index: 1;
    width: min(760px, calc(100vw - 32px));
    max-height: min(82vh, 820px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
}

.pulse-post-head {
    min-width: 0;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    gap: 12px;
    align-items: start;
}

.pulse-post-note {
    display: block;
    max-width: 100%;
    margin-bottom: 7px;
    color: var(--text-subtle);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-post-head h2 {
    color: var(--text);
    font-size: 20px;
    line-height: 1.32;
    overflow-wrap: anywhere;
}

.pulse-post-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    background: var(--surface-muted);
}

.pulse-post-body {
    min-width: 0;
    padding: 16px 18px;
    display: grid;
    gap: 12px;
    overflow-y: auto;
}

.pulse-post-body p {
    color: var(--text);
    font-size: 14px;
    line-height: 1.72;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.pulse-post-cluster-content {
    display: grid;
    gap: 7px;
}

.pulse-post-cluster-content h3 {
    color: var(--text);
    font-size: 13px;
    line-height: 1.3;
}

.pulse-post-footer {
    padding: 12px 18px 16px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
    background: var(--surface-muted);
}

.pulse-post-footer .pulse-related-list {
    grid-template-columns: 1fr;
}

.pulse-ask-button {
    color: var(--text);
}

.aigc-panel-head {
    min-height: 42px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.aigc-panel-head h2 {
    color: var(--text);
    font-size: 16px;
    line-height: 1.25;
}

.aigc-panel-head p {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.aigc-field {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.aigc-field span,
.aigc-check span {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.aigc-field textarea,
.aigc-field select,
.aigc-field input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-size: 13px;
}

.aigc-field textarea {
    min-height: 180px;
    padding: 10px;
    resize: vertical;
    line-height: 1.55;
}

.aigc-field select,
.aigc-field input {
    height: 34px;
    padding: 0 9px;
}

.aigc-field textarea:focus,
.aigc-field select:focus,
.aigc-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(49, 87, 213, 0.1);
}

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

.aigc-check {
    min-height: 34px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.aigc-check input {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}

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

.aigc-actions .btn-primary {
    width: auto;
    min-width: 132px;
}

.aigc-status {
    min-width: 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.aigc-status.error {
    color: var(--red);
}

.aigc-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.aigc-result-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    display: grid;
}

.aigc-result-media {
    aspect-ratio: 1 / 1;
    background: var(--surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.aigc-result-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.aigc-result-body {
    padding: 10px;
    display: grid;
    gap: 8px;
}

.aigc-result-body h3 {
    color: var(--text);
    font-size: 13px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.aigc-result-body p {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.aigc-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.aigc-result-actions .btn-secondary {
    min-height: 30px;
}

.media-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 18px;
}

.media-lightbox.hidden {
    display: none;
}

.media-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.74);
    backdrop-filter: blur(6px);
}

.media-lightbox-panel {
    position: relative;
    width: min(1120px, calc(100vw - 36px));
    height: min(820px, calc(100vh - 36px));
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius);
    background: #0f172a;
    box-shadow: 0 24px 80px rgba(2, 6, 23, 0.46);
}

.media-lightbox-toolbar {
    min-width: 0;
    min-height: 56px;
    padding: 9px 10px 9px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.96);
    color: #ffffff;
}

.media-lightbox-title {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.92);
    font-size: 13px;
    font-weight: 760;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-lightbox-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.media-tool-button {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.media-tool-button:hover:not(:disabled),
.media-tool-button:focus-visible {
    border-color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.16);
}

.media-tool-button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.48);
    outline-offset: 2px;
}

.media-tool-button:active:not(:disabled) {
    transform: translateY(1px);
}

.media-tool-button:disabled {
    cursor: not-allowed;
    opacity: 0.38;
}

.media-lightbox-status {
    min-height: 32px;
    padding: 7px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.82);
    font-size: 12px;
    line-height: 1.45;
}

.media-lightbox-status[hidden] {
    display: none;
}

.media-lightbox-status.success {
    color: #bbf7d0;
}

.media-lightbox-status.error {
    color: #fecdd3;
}

.media-lightbox-stage {
    min-width: 0;
    min-height: 0;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background: #111827;
}

.media-lightbox-stage.is-zoomed {
    align-items: flex-start;
    justify-content: flex-start;
}

.media-lightbox-stage.is-rotated {
    align-items: center;
    justify-content: center;
}

.media-lightbox-stage.is-rotated.is-zoomed {
    align-items: flex-start;
    justify-content: flex-start;
}

.media-lightbox-image {
    --media-preview-width: auto;
    --media-preview-rotation: 0deg;
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: var(--media-preview-width);
    height: auto;
    border-radius: var(--radius-sm);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
    transform: rotate(var(--media-preview-rotation));
    transition: width 0.15s ease, transform 0.15s ease;
}

.media-lightbox-stage.is-zoomed .media-lightbox-image {
    max-width: none;
    max-height: none;
}

.share-card-dialog {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: grid;
    place-items: center;
    padding: 18px;
}

.share-card-dialog.hidden {
    display: none;
}

.share-card-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(7px);
    cursor: pointer;
}

.share-card-panel {
    position: relative;
    width: min(1040px, calc(100vw - 36px));
    height: min(860px, calc(100vh - 36px));
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    background: #101828;
    box-shadow: 0 28px 90px rgba(2, 6, 23, 0.48);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.share-card-head {
    min-width: 0;
    min-height: 76px;
    padding: 13px 14px 13px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(120deg, rgba(23, 37, 84, 0.98), rgba(49, 87, 213, 0.92));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.share-card-head > div {
    min-width: 0;
}

.share-card-kicker {
    display: block;
    margin-bottom: 3px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.share-card-head h2 {
    color: #ffffff;
    font-size: 17px;
    line-height: 1.25;
}

.share-card-head p {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    line-height: 1.35;
}

.share-card-close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    min-height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.share-card-close:hover,
.share-card-close:focus-visible {
    border-color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.share-card-stage {
    min-width: 0;
    min-height: 0;
    padding: 24px;
    overflow: auto;
    background:
        radial-gradient(circle at 50% 0, rgba(49, 87, 213, 0.19), transparent 44%),
        #111827;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.share-card-loading {
    align-self: center;
    min-height: 90px;
    padding: 20px 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 680;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.share-card-image {
    display: block;
    width: min(560px, 100%);
    height: auto;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.4);
}

.share-card-image:not([src]) {
    display: none;
}

.share-card-footer {
    min-width: 0;
    min-height: 66px;
    padding: 10px 12px 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.98);
    display: flex;
    align-items: center;
    gap: 14px;
}

.share-card-status {
    min-width: 0;
    flex: 1;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    line-height: 1.45;
}

.share-card-status.success {
    color: #a7f3d0;
}

.share-card-status.warning {
    color: #fde68a;
}

.share-card-status.error {
    color: #fecdd3;
}

.share-card-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-card-actions .btn-secondary,
.share-card-actions .btn-primary {
    width: auto;
    min-height: 40px;
    padding: 8px 13px;
}

.share-card-actions .btn-secondary {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.share-card-actions .btn-secondary:hover:not(:disabled),
.share-card-actions .btn-secondary:focus-visible {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.share-card-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.drive-save-dialog {
    position: fixed;
    inset: 0;
    z-index: 92;
    display: grid;
    place-items: center;
    padding: 18px;
}

.drive-save-dialog.hidden {
    display: none;
}

.app-confirm-dialog {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: grid;
    place-items: center;
    padding: 18px;
}

.app-confirm-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(5px);
    cursor: pointer;
}

.app-confirm-panel {
    position: relative;
    width: min(420px, calc(100vw - 36px));
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
    display: grid;
    gap: 12px;
}

.app-confirm-panel h2 {
    color: var(--text);
    font-size: 16px;
    line-height: 1.25;
}

.app-confirm-panel p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.app-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.app-confirm-primary.danger {
    border-color: var(--red);
    background: var(--red);
    color: #ffffff;
}

.app-confirm-primary.danger:hover:not(:disabled) {
    border-color: #b91c1c;
    background: #b91c1c;
    color: #ffffff;
}

.drive-save-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(5px);
    cursor: pointer;
}

.drive-save-panel {
    position: relative;
    width: min(520px, calc(100vw - 36px));
    max-height: min(680px, calc(100vh - 36px));
    min-width: 0;
    min-height: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    gap: 12px;
    overflow: hidden;
}

.drive-path-panel {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.drive-save-head {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.drive-save-head h2 {
    min-width: 0;
    color: var(--text);
    font-size: 17px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.drive-save-close {
    flex: 0 0 auto;
}

.drive-save-field {
    min-width: 0;
    display: grid;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 720;
}

.drive-save-field input {
    width: 100%;
    height: 38px;
    min-width: 0;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-size: 14px;
}

.drive-save-field input:focus {
    border-color: var(--primary);
}

.drive-save-path {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 7px;
}

.drive-save-path-head {
    min-width: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.drive-save-path-head span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 720;
}

.drive-save-path-head small {
    min-width: 0;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.35;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drive-save-tree {
    min-width: 0;
    min-height: 168px;
    max-height: min(42vh, 320px);
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    padding: 6px;
}

.drive-save-folder {
    width: 100%;
    min-height: 42px;
    padding: 7px 8px 7px calc(8px + var(--drive-depth, 0) * 16px);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    text-align: left;
}

.drive-save-folder:hover,
.drive-save-folder.active {
    border-color: #c6d8ff;
    background: var(--surface);
}

.drive-save-folder.active {
    color: var(--primary);
}

.drive-save-folder span {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.drive-save-folder strong {
    min-width: 0;
    color: inherit;
    font-size: 13px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drive-save-folder small {
    min-width: 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drive-save-check {
    color: var(--primary);
}

.drive-save-empty,
.drive-save-error {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.drive-save-empty {
    padding: 12px;
}

.drive-save-error {
    min-height: 18px;
}

.drive-save-error.visible {
    color: var(--red);
}

.drive-save-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.drive-preview-panel {
    position: relative;
    width: min(880px, calc(100vw - 36px));
    height: min(760px, calc(100vh - 36px));
    min-width: 0;
    min-height: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 12px;
    overflow: hidden;
}

.drive-save-head p {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.drive-preview-actions {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.drive-preview-status {
    min-height: 18px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.drive-preview-status[hidden] {
    display: none;
}

.drive-preview-status.error {
    color: var(--red);
}

.drive-preview-content {
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 14px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.drive-preview-content.binary {
    font-family: inherit;
    white-space: normal;
}

.drive-preview-content.markdown,
.project-file-detail-content.markdown {
    background: var(--surface);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.72;
    white-space: normal;
}

.drive-preview-content.markdown {
    padding: 22px 24px;
}

.drive-preview-media {
    min-width: 0;
    min-height: 0;
    display: grid;
    gap: 10px;
    place-items: center;
}

.drive-preview-media img,
.drive-preview-media video {
    max-width: 100%;
    max-height: min(58vh, 560px);
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.drive-preview-media audio {
    width: min(520px, 100%);
}

.drive-preview-media iframe {
    width: 100%;
    height: min(62vh, 560px);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.drive-preview-media p,
.drive-preview-media figcaption,
.drive-preview-binary-message {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.drive-preview-binary-message {
    min-height: 220px;
    display: grid;
    place-items: center;
}

.meta-row,
.run-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.meta-row span,
.run-facts div {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text-muted);
    padding: 0 8px;
    font-size: 12px;
    font-weight: 700;
}

.metadata-list {
    display: grid;
    gap: 8px;
    padding-top: 2px;
}

.metadata-list div {
    display: grid;
    gap: 3px;
}

.metadata-list dt,
.run-facts dt {
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.metadata-list dd,
.run-facts dd {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.agent-section {
    --section-accent: var(--primary);
    --section-soft: var(--primary-soft);
    display: grid;
    gap: 10px;
}

.agent-section-head {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--section-accent);
    border-radius: var(--radius);
    background: var(--section-soft);
}

.agent-section-head h2 {
    color: var(--text);
    font-size: 15px;
    line-height: 1.25;
}

.agent-section-head p {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.section-count {
    min-width: 28px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--section-accent);
    border-radius: 999px;
    background: var(--section-accent);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.agent-section.tone-blue {
    --section-accent: var(--primary);
    --section-soft: var(--primary-soft);
}

.agent-section.tone-teal {
    --section-accent: var(--teal);
    --section-soft: var(--teal-soft);
}

.agent-section.tone-rose {
    --section-accent: var(--rose);
    --section-soft: var(--rose-soft);
}

.agent-section.tone-amber {
    --section-accent: var(--amber);
    --section-soft: var(--amber-soft);
}

.agent-section.tone-slate {
    --section-accent: #526071;
    --section-soft: #eef2f7;
}

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

.agent-card {
    --agent-accent: var(--primary);
    --agent-soft: var(--primary-soft);
    min-height: 292px;
    padding: 14px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--agent-accent);
    border-left: 4px solid var(--agent-accent);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 9px rgba(16, 24, 40, 0.045);
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.agent-card.selected {
    border-color: var(--agent-accent);
    box-shadow: 0 0 0 2px rgba(49, 87, 213, 0.12), 0 8px 20px rgba(16, 24, 40, 0.06);
}

.agent-card-main {
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.agent-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--agent-accent);
    color: #ffffff;
    font-size: 13px;
    font-weight: 850;
}

.agent-copy {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.agent-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.agent-title-row h3 {
    color: var(--text);
    font-size: 15px;
    line-height: 1.25;
}

.agent-copy p {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.55;
}

.agent-type-badge {
    min-height: 21px;
    padding: 0 7px;
    border-radius: 999px;
    border: 1px solid var(--agent-accent);
    background: var(--agent-soft);
    color: var(--agent-accent);
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 850;
}

.agent-status-row {
    min-height: 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.agent-usecase {
    display: grid;
    gap: 4px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--agent-soft);
}

.agent-usecase span,
.agent-detail-grid span {
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
}

.agent-usecase strong,
.agent-detail-grid strong {
    color: var(--text);
    font-size: 12px;
    line-height: 1.45;
}

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

.agent-detail-grid div {
    min-height: 54px;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    align-content: center;
    gap: 3px;
}

.agent-note {
    padding: 9px 10px;
    border: 1px solid #fed7aa;
    border-radius: var(--radius-sm);
    background: var(--orange-soft);
    color: var(--orange);
    font-size: 12px;
    line-height: 1.45;
}

.agent-id-line {
    padding: 5px 7px;
    border-radius: var(--radius-sm);
    background: var(--code);
    color: var(--text-soft);
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 10px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.agent-card.tone-blue {
    --agent-accent: var(--primary);
    --agent-soft: var(--primary-soft);
}

.agent-card.tone-teal {
    --agent-accent: var(--teal);
    --agent-soft: var(--teal-soft);
}

.agent-card.tone-rose {
    --agent-accent: var(--rose);
    --agent-soft: var(--rose-soft);
}

.agent-card.tone-amber {
    --agent-accent: var(--amber);
    --agent-soft: var(--amber-soft);
}

.agent-card.tone-slate {
    --agent-accent: #526071;
    --agent-soft: #eef2f7;
}

.agent-card-actions,
.provider-card-actions {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.agent-card-actions .btn-secondary {
    margin-top: 0;
}

.provider-test-result {
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 750;
}

.provider-test-result.ok {
    color: var(--green);
}

.provider-test-result.error {
    color: var(--red);
}

.chip {
    background: var(--surface-muted);
    color: var(--text-muted);
}

.chip.muted {
    opacity: 0.7;
}

.param-list {
    display: grid;
    gap: 8px;
}

.param-list.compact {
    margin-top: 8px;
    gap: 6px;
}

.param-list.empty {
    min-height: 32px;
    align-items: center;
    color: var(--text-soft);
    font-size: 12px;
}

.param-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}

.param-list.compact .param-item {
    padding: 7px;
}

.param-name {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
}

.param-type,
.param-required {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
}

.param-required {
    color: var(--orange);
}

.param-item p {
    grid-column: 1 / -1;
    font-size: 12px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#view-trace {
    overflow: hidden;
    padding: 18px;
}

.project-workbench {
    flex: 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(460px, 1.35fr);
    gap: 12px;
    padding: 14px;
    overflow: hidden;
}

.project-panel {
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.project-panel-head {
    min-height: 58px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.project-panel-head h2,
.project-detail-head h2 {
    color: var(--text);
    font-size: 15px;
    line-height: 1.25;
}

.project-panel-head p,
.project-detail-head p {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.project-panel-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.drive-detail-head {
    min-height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    justify-content: normal;
    gap: 10px;
}

.drive-detail-title {
    min-width: 0;
}

.drive-detail-title h2,
.drive-detail-title p {
    overflow-wrap: anywhere;
}

.drive-detail-head .project-panel-actions {
    width: 100%;
    flex-wrap: wrap;
}

.drive-detail-head .project-path-jump {
    flex: 1 1 260px;
    max-width: none;
}

.drive-detail-head .btn-primary {
    flex: 1 1 260px;
    justify-content: center;
}

.drive-detail-head .btn-secondary {
    flex: 0 0 auto;
}

.project-path-jump {
    min-width: 190px;
    max-width: 300px;
}

.project-path-jump select {
    width: 100%;
    height: 32px;
    min-width: 0;
    padding: 0 30px 0 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-size: 12px;
}

.project-path-jump select:focus {
    border-color: var(--primary);
}

.project-panel-body {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.project-library-toolbar {
    display: grid;
    gap: 8px;
}

.project-search {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-size: 12px;
}

.project-search:focus {
    border-color: var(--primary);
}

.project-document-list,
.project-search-results,
.project-source-list {
    display: grid;
    gap: 8px;
}

.project-document-row {
    min-width: 0;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
}

.project-document-row[draggable="true"] {
    cursor: grab;
}

.project-document-row.dragging {
    opacity: 0.55;
    cursor: grabbing;
}

.drive-content-row {
    padding-left: calc(9px + var(--drive-depth, 0) * 18px);
}

.drive-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.drive-row-leading {
    width: 22px;
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.drive-tree-toggle,
.drive-tree-toggle-placeholder {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
}

.drive-tree-toggle {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.drive-tree-toggle:hover:not(:disabled) {
    background: var(--surface-muted);
    color: var(--primary);
}

.drive-tree-toggle:disabled {
    cursor: default;
    opacity: 0.35;
}

.drive-tree-toggle[aria-expanded="true"] svg {
    transform: rotate(90deg);
}

.project-document-row:hover,
.project-document-row.active {
    border-color: #c6d8ff;
    background: #f8fbff;
}

.project-document-row.selected {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: inset 3px 0 0 var(--primary);
}

.project-document-row.drive-drop-target,
.drive-drop-zone.drive-drop-target {
    border-color: var(--primary);
    background: #eef6ff;
    box-shadow: inset 0 0 0 1px var(--primary);
    outline: 2px solid rgba(49, 87, 213, 0.18);
    outline-offset: 2px;
}

.project-document-row.drive-drop-target-invalid,
.drive-drop-zone.drive-drop-target-invalid {
    border-color: #f1a7a7;
    background: #fff7f7;
    box-shadow: inset 0 0 0 1px #ef7777;
    outline: 2px solid rgba(239, 119, 119, 0.18);
    outline-offset: 2px;
}

.drive-selection-rect {
    position: fixed;
    z-index: 1200;
    pointer-events: none;
    border: 1px solid var(--primary);
    background: rgba(49, 87, 213, 0.12);
}

body.drive-selecting {
    user-select: none;
}

.project-document-main {
    min-width: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    display: grid;
    gap: 5px;
    text-align: left;
}

.project-document-main strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.project-document-main p,
.project-answer-body,
.project-doc-content {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.project-doc-content {
    white-space: pre-wrap;
}

.drive-share-menu-wrap {
    position: relative;
    display: inline-flex;
}

.drive-share-trigger[aria-expanded="true"] {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.drive-share-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    width: min(390px, calc(100vw - 32px));
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
    display: grid;
    gap: 6px;
}

.drive-share-menu::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 22px;
    width: 10px;
    height: 10px;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
    background: var(--surface);
    transform: rotate(45deg);
}

.drive-share-option {
    min-width: 0;
    width: 100%;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 8px;
    text-align: left;
}

.drive-share-option:hover:not(:disabled) {
    border-color: #c6d8ff;
    background: #f8fbff;
}

.drive-share-option.active {
    border-color: #c6d8ff;
    background: var(--primary-soft);
}

.drive-share-option:disabled {
    cursor: default;
}

.drive-share-option-check {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.drive-share-option-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.drive-share-option-copy strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.35;
}

.drive-share-option-copy small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.drive-share-link-row {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px;
    border-top: 1px solid var(--line);
}

.drive-share-link-row input {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    outline: none;
}

.drive-share-status {
    min-height: 18px;
    padding: 0 8px 2px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.5;
}

.drive-share-status.ok {
    color: var(--green);
}

.drive-share-status.error {
    color: var(--red);
}

.project-file-detail-content {
    min-width: 0;
    min-height: 100%;
    margin: 0;
    padding: 14px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.project-file-detail-content.binary {
    font-family: inherit;
    white-space: normal;
}

.drive-markdown-content {
    color: var(--text);
}

.drive-markdown-content > *:first-child {
    margin-top: 0;
}

.drive-markdown-content > *:last-child {
    margin-bottom: 0;
}

.drive-markdown-content h1,
.drive-markdown-content h2,
.drive-markdown-content h3,
.drive-markdown-content h4,
.drive-markdown-content h5,
.drive-markdown-content h6 {
    margin: 18px 0 10px;
    color: var(--text);
    font-weight: 820;
    line-height: 1.25;
}

.drive-markdown-content h1 {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
    font-size: 24px;
}

.drive-markdown-content h2 {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    font-size: 20px;
}

.drive-markdown-content h3 {
    font-size: 17px;
}

.drive-markdown-content h4,
.drive-markdown-content h5,
.drive-markdown-content h6 {
    font-size: 15px;
}

.drive-markdown-content p {
    margin: 0 0 12px;
}

.drive-markdown-content ul,
.drive-markdown-content ol {
    margin: 0 0 14px 24px;
    padding: 0;
}

.drive-markdown-content li {
    margin: 5px 0;
    padding-left: 2px;
}

.drive-markdown-content blockquote {
    margin: 14px 0;
    padding: 10px 13px;
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--surface-muted);
    color: var(--text-muted);
}

.drive-markdown-content hr {
    height: 1px;
    margin: 18px 0;
    border: 0;
    background: var(--line);
}

.drive-markdown-content a {
    color: var(--primary);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.drive-markdown-content a:hover {
    text-decoration: underline;
}

.drive-markdown-content code {
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--code);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
}

.drive-markdown-content pre {
    margin: 10px 0;
    padding: 12px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--code);
    font-size: 12px;
    line-height: 1.55;
}

.drive-markdown-content pre code {
    padding: 0;
    background: transparent;
    font-size: inherit;
}

.drive-markdown-content .code-block pre {
    margin: 0;
    padding-right: 48px;
}

.project-document-meta,
.project-map-meta,
.project-selection-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.project-map-wrap {
    min-height: 300px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    background: #f8fbff;
}

.drive-folder-wrap {
    min-height: 248px;
    background: #f6f8fb;
}

.current-folder-list {
    align-content: start;
}

.drive-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
    gap: 10px;
}

.drive-card {
    min-height: 104px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    display: grid;
    align-content: start;
    gap: 7px;
    text-align: left;
}

.drive-card:hover,
.drive-card.active {
    border-color: #c6d8ff;
    background: var(--primary-soft);
    color: var(--primary);
}

.drive-card-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.drive-card strong {
    color: inherit;
    font-size: 13px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.drive-card small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.3;
}

.project-map-stage {
    position: relative;
    width: 100%;
    min-height: 276px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.project-map-stage svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.project-map-edge {
    stroke: #9db4d3;
    stroke-width: 1.4;
    opacity: 0.82;
}

.project-map-node {
    position: absolute;
    width: 116px;
    min-height: 54px;
    padding: 7px;
    border: 1px solid #c6d8ff;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 8px 18px rgba(49, 87, 213, 0.12);
    cursor: pointer;
    transform: translate(-50%, -50%);
    display: grid;
    align-content: center;
    gap: 3px;
    text-align: left;
}

.project-map-node:hover,
.project-map-node.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
}

.project-map-node strong {
    font-size: 11px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-map-node small {
    color: var(--text-soft);
    font-size: 10px;
}

.project-detail-pane {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: grid;
    align-content: start;
    gap: 12px;
}

.project-detail-head {
    display: grid;
    gap: 8px;
}

.project-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.project-context-panel textarea {
    width: 100%;
    min-height: 116px;
    resize: vertical;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-size: 13px;
    line-height: 1.45;
}

.project-context-panel textarea:focus {
    border-color: var(--primary);
}

.project-context-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.project-selection-bar {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.project-answer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
}

.project-answer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.project-answer-head strong {
    color: var(--text);
    font-size: 13px;
}

.project-answer-body {
    max-height: 34vh;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    white-space: pre-wrap;
}

.project-status {
    min-height: 18px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.project-status.error {
    color: var(--red);
}

.project-status.ok {
    color: var(--green);
}

.project-source-item {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    display: grid;
    gap: 4px;
}

.project-source-item strong {
    color: var(--text);
    font-size: 12px;
}

.project-source-item small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
}

.project-empty-actions {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.runs-layout {
    width: min(1180px, 100%);
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
    gap: 14px;
}

.run-list {
    min-height: 0;
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 8px;
}

.run-item {
    width: 100%;
    min-height: 108px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    text-align: left;
}

.run-item:hover,
.run-item.active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.run-item-body {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.run-item-topline {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.run-scenario {
    min-width: 0;
    max-width: 100%;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.run-item .run-query {
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.run-meta {
    line-height: 1.35;
}

.run-id-line {
    display: flex;
}

.run-id-line code {
    max-width: 100%;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-soft);
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.run-meta,
.run-item small {
    color: var(--text-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.run-detail {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
}

.run-panel {
    padding: 16px;
}

.trace-page-panel {
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
}

.trace-run-summary,
.trace-tree-panel,
.trace-node-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

.trace-run-summary {
    padding: 14px;
}

.trace-run-summary .run-panel-head {
    margin-bottom: 12px;
}

.trace-run-id-copy {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.trace-run-id-copy .mono {
    overflow-wrap: anywhere;
}

.trace-copy-id-button {
    min-height: 28px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.trace-copy-id-button:hover,
.trace-copy-id-button:focus-visible {
    border-color: var(--primary);
    background: var(--primary-soft);
    outline: none;
}

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

.trace-return-button {
    white-space: nowrap;
}

.trace-workbench {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(260px, 34%) minmax(0, 1fr);
    gap: 12px;
}

.trace-tree-panel,
.trace-node-panel {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 12px;
}

.trace-section-title {
    margin-bottom: 10px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0;
    text-transform: uppercase;
}

.trace-tree {
    display: grid;
    gap: 4px;
}

.trace-tree-branch {
    min-width: 0;
}

.trace-tree-row {
    min-width: 0;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 4px;
    align-items: start;
}

.trace-node-toggle,
.trace-node-toggle-spacer {
    width: 22px;
    height: 42px;
}

.trace-node-toggle {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.trace-node-toggle:hover {
    border-color: var(--line);
    background: var(--surface-muted);
    color: var(--text);
}

.trace-node-toggle svg {
    transition: transform 0.15s ease;
}

.trace-node-toggle.collapsed svg {
    transform: rotate(-90deg);
}

.trace-node-children {
    margin-left: 28px;
    padding-left: 10px;
    border-left: 1px solid var(--line);
    display: grid;
    gap: 4px;
}

.trace-tree-node {
    width: 100%;
    min-height: 42px;
    padding: 8px 9px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
    text-align: left;
}

.trace-tree-node:hover,
.trace-tree-node.active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.trace-tree-node.context-node {
    border-left: 3px solid var(--green);
}

.trace-tree-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.trace-tree-copy strong {
    color: var(--text);
    font-size: 12px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.trace-tree-copy small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.trace-node-count {
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.trace-detail-head h3 {
    margin-top: 3px;
    color: var(--text);
    font-size: 18px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.trace-detail-head p {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.trace-kind {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0;
    text-transform: uppercase;
}

.trace-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.trace-detail-grid div {
    min-width: 0;
    padding: 9px;
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    gap: 4px;
}

.trace-detail-grid dt {
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
}

.trace-detail-grid dd {
    min-width: 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.trace-detail-grid code,
.trace-detail-events code {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    white-space: normal;
    overflow-wrap: anywhere;
}

.trace-detail-section {
    margin-top: 12px;
    display: grid;
    gap: 7px;
}

.trace-detail-section h4 {
    color: var(--text);
    font-size: 12px;
}

.trace-detail-text,
.trace-detail-pre {
    max-height: 360px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow: auto;
}

.trace-detail-pre {
    font-family: "SF Mono", Menlo, Consolas, monospace;
}

.trace-detail-disclosure {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
}

.trace-detail-disclosure.nested {
    background: var(--surface-muted);
}

.trace-detail-disclosure summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    cursor: pointer;
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
}

.trace-detail-disclosure summary small {
    color: var(--text-muted);
    font-weight: 500;
    overflow-wrap: anywhere;
}

.trace-detail-disclosure .trace-detail-pre,
.trace-detail-disclosure .trace-detail-text {
    max-height: 480px;
    margin: 0;
    border-width: 1px 0 0;
    border-radius: 0;
}

.trace-disclosure-stack {
    display: grid;
    gap: 8px;
}

.trace-detail-events,
.trace-detail-list {
    display: grid;
    gap: 6px;
    padding-left: 18px;
}

.trace-detail-events li,
.trace-detail-list li {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.trace-detail-events li {
    display: grid;
    gap: 3px;
}

.trace-detail-events li span,
.trace-detail-list li span {
    color: var(--text);
    margin-right: 6px;
}

.trace-detail-list li {
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}

.trace-detail-list li span {
    font-weight: 800;
}

.trace-detail-events li small,
.trace-detail-list li small {
    display: block;
    color: var(--text-muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.trace-detail-events li code {
    margin-right: 6px;
}

.run-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.run-facts {
    margin-bottom: 14px;
}

.run-facts div {
    display: grid;
    align-items: center;
    height: auto;
    min-height: 46px;
    padding: 7px 9px;
}

.run-io {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}

.run-io h3 {
    color: var(--text);
    font-size: 12px;
}

.run-io p {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.action-card {
    justify-content: space-between;
}

.empty-state,
.empty-inline {
    color: var(--text-muted);
}

.empty-state {
    min-height: 160px;
    padding: 18px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.6);
}

.empty-state strong {
    color: var(--text);
    font-size: 14px;
}

.empty-state span,
.empty-inline {
    font-size: 12px;
    line-height: 1.5;
}

.empty-state span {
    white-space: pre-line;
}

.empty-inline {
    padding: 14px 8px;
}

.conversation-list::-webkit-scrollbar,
.pinned-agent-list::-webkit-scrollbar,
.project-list::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.process-list::-webkit-scrollbar,
.run-list::-webkit-scrollbar,
.run-detail::-webkit-scrollbar,
.trace-tree::-webkit-scrollbar,
.trace-payload::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.conversation-list::-webkit-scrollbar-track,
.pinned-agent-list::-webkit-scrollbar-track,
.project-list::-webkit-scrollbar-track,
.messages::-webkit-scrollbar-track,
.process-list::-webkit-scrollbar-track,
.run-list::-webkit-scrollbar-track,
.run-detail::-webkit-scrollbar-track,
.trace-tree::-webkit-scrollbar-track,
.trace-payload::-webkit-scrollbar-track {
    background: transparent;
}

.conversation-list::-webkit-scrollbar-thumb,
.pinned-agent-list::-webkit-scrollbar-thumb,
.project-list::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.process-list::-webkit-scrollbar-thumb,
.run-list::-webkit-scrollbar-thumb,
.run-detail::-webkit-scrollbar-thumb,
.trace-tree::-webkit-scrollbar-thumb,
.trace-payload::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #c7d1dd;
}

.conversation-list::-webkit-scrollbar-thumb:hover,
.pinned-agent-list::-webkit-scrollbar-thumb:hover,
.project-list::-webkit-scrollbar-thumb:hover,
.messages::-webkit-scrollbar-thumb:hover,
.process-list::-webkit-scrollbar-thumb:hover,
.run-list::-webkit-scrollbar-thumb:hover,
.run-detail::-webkit-scrollbar-thumb:hover,
.trace-tree::-webkit-scrollbar-thumb:hover,
.trace-payload::-webkit-scrollbar-thumb:hover {
    background: #9aa8b8;
}

@media (max-width: 980px) {
    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .runs-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .runs-layout {
        overflow-y: auto;
    }

    .project-workbench {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .project-panel {
        min-height: 360px;
    }

    .project-context-panel {
        min-height: 420px;
    }

    .run-list {
        max-height: 260px;
    }

    .trace-workbench {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .trace-tree-panel {
        max-height: 360px;
    }

    .trace-detail-grid {
        grid-template-columns: 1fr;
    }

    .aigc-workbench {
        grid-template-columns: 1fr;
    }

    .pulse-workbench {
        grid-template-columns: 1fr;
    }

    .pulse-post-grid {
        grid-template-columns: 1fr;
    }

    .tools-toolbar {
        grid-template-columns: 1fr;
    }

    .tools-toolbar-controls {
        grid-template-columns: minmax(0, 1fr);
    }

    .tools-filter {
        width: fit-content;
    }

    .role-config-workbench {
        grid-template-columns: 1fr;
    }

    .role-config-list {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    }

    .eval-layout,
    .eval-report-summary,
    .eval-dimension-grid {
        grid-template-columns: 1fr;
    }

    .eval-case-list,
    .eval-case-list.approved {
        max-height: none;
    }

    .eval-panel-head .eval-pagination,
    .eval-section-head-row .eval-pagination {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
    }
}

@media (max-width: 720px) {
    body.mobile-sidebar-open {
        overflow: hidden;
    }

    .sidebar {
        position: absolute;
        inset: 0 auto 0 0;
        width: var(--mobile-sidebar-width);
        min-width: 0;
        max-width: calc(100vw - 28px);
        height: 100dvh;
        z-index: 20;
        box-shadow: var(--shadow);
    }

    .sidebar.hidden {
        left: calc(-1 * var(--mobile-sidebar-width));
        transform: none;
        box-shadow: none;
    }

    .tools-toolbar,
    .tool-mcp-panel {
        padding: 10px;
    }

    .tool-mcp-head,
    .tool-row {
        grid-template-columns: 1fr;
    }

    .tool-mcp-head {
        display: grid;
    }

    .tool-row {
        gap: 9px;
    }

    .project-panel-head,
    .project-answer-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .project-panel-actions,
    .project-context-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .project-path-jump {
        flex: 1 1 100%;
        max-width: none;
    }

    .drive-detail-head .project-path-jump,
    .drive-detail-head .btn-primary {
        flex-basis: 100%;
    }

    .drive-share-menu-wrap {
        width: 100%;
        display: grid;
    }

    .drive-share-trigger {
        width: 100%;
    }

    .drive-preview-actions .drive-share-menu-wrap {
        position: static;
        width: auto;
        display: inline-flex;
    }

    .drive-preview-actions .drive-share-trigger {
        width: auto;
    }

    .drive-preview-panel > .drive-save-head {
        position: relative;
    }

    .eval-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .eval-toolbar-actions {
        width: 100%;
        justify-content: stretch;
    }

    .eval-toolbar-actions .btn-secondary,
    .eval-toolbar-actions .btn-primary {
        flex: 1 1 100%;
        width: 100%;
    }

    .eval-scenario-control {
        width: 100%;
        justify-content: space-between;
    }

    .eval-scenario-control select {
        flex: 1 1 auto;
    }

    .eval-summary-grid,
    .eval-case-grid,
    .eval-dimension-grid,
    .eval-edit-grid {
        grid-template-columns: 1fr;
    }

    .eval-dimension-line {
        align-items: flex-start;
        grid-template-columns: 1fr;
    }

    .eval-dimension-line > span {
        text-align: left;
    }

    .eval-edit-dimension-top {
        grid-template-columns: 1fr;
    }

    .eval-tag-slice-row {
        grid-template-columns: minmax(0, 1fr) repeat(3, minmax(44px, auto));
    }

    .eval-case-head {
        grid-template-columns: 1fr;
    }

    .eval-pagination,
    .eval-page-actions {
        width: 100%;
    }

    .eval-pagination {
        align-items: stretch;
    }

    .eval-page-actions {
        justify-content: space-between;
    }

    .eval-page-actions .developer-memory-action {
        flex: 1 1 0;
    }

    .drive-share-menu {
        position: static;
        width: 100%;
        margin-top: 8px;
    }

    .drive-share-menu::before {
        display: none;
    }

    .drive-preview-actions .drive-share-menu {
        position: absolute;
        width: min(390px, 100%);
        margin-top: 0;
    }

    .drive-share-link-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .project-panel-actions .btn-secondary,
    .project-context-actions .btn-secondary,
    .project-context-actions .btn-primary {
        flex: 1 1 auto;
    }

    .project-document-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .drive-row-actions {
        grid-column: 2;
        justify-self: start;
    }

    .tool-toggle {
        width: fit-content;
        padding-top: 0;
    }

    body.mobile-sidebar-open .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 19;
        display: block;
        border: 0;
        background: rgba(15, 23, 42, 0.38);
        backdrop-filter: blur(2px);
        cursor: pointer;
    }

    .sidebar-footer {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .workspace {
        width: 100%;
    }

    .topbar {
        min-height: auto;
        padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .topbar-title h1 {
        font-size: 16px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-title p {
        display: none;
    }

    .topbar-actions {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        gap: 6px;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .topbar-actions::-webkit-scrollbar {
        display: none;
    }

    .topbar-actions .icon-button,
    .topbar-actions .language-toggle,
    .topbar-actions .btn-secondary {
        min-width: 38px;
        min-height: 38px;
    }

    .new-topic-button {
        width: 38px;
        min-width: 38px;
        padding: 0;
    }

    .new-topic-button span {
        display: none;
    }

    .role-select {
        width: min(44vw, 172px);
        height: 38px;
    }

    .role-memory-popover {
        position: fixed;
        left: 10px;
        right: 10px;
        top: calc(92px + env(safe-area-inset-top));
        width: auto;
        max-height: calc(100dvh - 112px - env(safe-area-inset-top));
        overflow-y: auto;
    }

    .model-pill {
        max-width: min(48vw, 220px);
        min-height: 28px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .messages,
    #view-agents,
    #view-tools,
    #view-role,
    #view-pulse,
    #view-trace,
    #view-developer,
    #view-eval {
        padding: 12px 10px;
        -webkit-overflow-scrolling: touch;
    }

    .role-config-template-list,
    .role-config-form-grid {
        grid-template-columns: 1fr;
    }

    .role-config-field-wide {
        grid-column: auto;
    }

    .chat-history-tools {
        right: 10px;
        bottom: calc(var(--chat-input-offset) + 10px);
    }

    .chat-float-button {
        width: 40px;
        height: 40px;
    }

    .chat-history-panel {
        width: calc(100vw - 20px);
        max-height: min(58vh, calc(100dvh - var(--chat-input-offset) - 82px));
    }

    .chat-history-item {
        min-height: 44px;
    }

    .input-area {
        padding: 0 10px calc(10px + env(safe-area-inset-bottom));
    }

    .input-container {
        gap: 6px;
        padding: 7px;
    }

    .process-summary {
        grid-template-columns: minmax(0, 1fr) auto 12px;
    }

    .mode-toggle,
    .attachment-toggle,
    .btn-send {
        width: 38px;
        height: 38px;
    }

    .mode-popover {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(72px + env(safe-area-inset-bottom));
        width: auto;
        max-height: min(58vh, 420px);
        overflow-y: auto;
    }

    #message-input,
    .account-select,
    .account-login-field select,
    .account-login-field input,
    .model-select,
    #agent-select,
    .role-select,
    .role-memory-form textarea,
    .developer-memory-control input,
    .developer-memory-control select,
    .pulse-topic-form input,
    .aigc-field textarea,
    .aigc-field select,
    .aigc-field input {
        font-size: 16px;
    }

    .message {
        gap: 8px;
    }

    .bubble {
        padding: 11px 12px;
    }

    .avatar {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .developer-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .developer-summary-grid,
    .developer-memory-model,
    .developer-memory-columns {
        grid-template-columns: 1fr;
    }

    .developer-memory-controls {
        grid-template-columns: 1fr;
    }

    .developer-memory-bulk-actions {
        justify-content: stretch;
    }

    .developer-memory-bulk-actions .developer-memory-action,
    .developer-memory-bulk-actions .developer-memory-selected-count {
        flex: 1 1 120px;
    }

    .developer-memory-record .developer-memory-record-head {
        grid-template-columns: 1fr;
    }

    .developer-memory-record-line {
        flex-direction: column;
    }

    .developer-memory-record-badges {
        max-width: 100%;
        justify-content: flex-start;
    }

    .developer-memory-record.long-term .developer-memory-record-head {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .developer-memory-record.long-term .developer-memory-record-line {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px;
    }

    .developer-memory-record.long-term .developer-memory-record-badges {
        max-width: 42vw;
        flex-wrap: nowrap;
    }

    .data-card {
        min-height: 0;
    }

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

    .agent-card-list,
    .agent-detail-grid {
        grid-template-columns: 1fr;
    }

    .agent-card {
        min-height: 0;
    }

    .quick-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .quick-action {
        width: 100%;
    }

    .pulse-feed-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .pulse-topic-panel {
        position: static;
    }

    .pulse-card-actions .btn-secondary,
    .pulse-feed-toolbar .btn-secondary,
    .pulse-question,
    .pulse-related-item,
    .pulse-suggested-topic {
        width: 100%;
        justify-content: center;
    }

    .pulse-heat {
        width: 100%;
        margin-left: 0;
    }

    .pulse-post-window {
        padding: 10px;
        place-items: stretch;
    }

    .pulse-post-panel {
        width: 100%;
        max-height: calc(100dvh - 20px);
        align-self: center;
    }

    .pulse-post-head {
        padding: 14px;
    }

    .pulse-post-head h2 {
        font-size: 17px;
    }

    .pulse-post-body {
        padding: 14px;
    }

    .pulse-post-footer {
        padding: 12px 14px;
    }

    .aigc-control-grid,
    .aigc-results {
        grid-template-columns: 1fr;
    }

    .aigc-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .aigc-actions .btn-primary,
    .aigc-result-actions .btn-secondary {
        width: 100%;
    }

    #view-trace {
        overflow-y: auto;
    }

    .runs-layout {
        width: 100%;
        gap: 10px;
        overflow: visible;
    }

    .run-list {
        max-height: 34vh;
        overflow-y: auto;
    }

    .run-detail {
        overflow: visible;
    }

    .trace-page-panel {
        height: auto;
        display: grid;
    }

    .trace-tree-panel {
        max-height: 36vh;
    }

    .trace-node-panel {
        max-height: none;
        overflow: visible;
    }

    .trace-detail-head,
    .run-panel-head {
        flex-direction: column;
    }

    .run-panel-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .trace-return-button {
        flex: 1 1 auto;
    }

    .media-lightbox {
        padding: 10px;
    }

    .media-lightbox-panel {
        width: calc(100vw - 20px);
        height: calc(100dvh - 20px);
    }

    .media-lightbox-toolbar {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 8px;
        padding: 9px;
    }

    .media-lightbox-title {
        flex-basis: 100%;
    }

    .media-lightbox-actions {
        width: 100%;
        justify-content: space-between;
    }

    .media-tool-button {
        width: 40px;
        height: 38px;
    }

    .media-lightbox-stage {
        padding: 10px;
    }
}

@media (max-width: 860px) {
    #view-todos {
        padding: 10px;
    }

    .todo-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .todo-suggestion-panel {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .todo-workbench {
        height: auto;
        min-height: calc(100dvh - 86px);
    }

    .todo-main-panel {
        overflow: visible;
    }

    .todo-list {
        overflow: visible;
    }

    .todo-create-panel,
    .todo-edit-card {
        grid-template-columns: minmax(0, 1fr) minmax(120px, 150px);
    }

    .todo-add-button,
    .todo-notes-input,
    .todo-edit-title-field,
    .todo-edit-notes-field,
    .todo-edit-actions {
        grid-column: 1 / -1;
    }

    .todo-edit-actions {
        justify-content: stretch;
    }

    .todo-edit-actions .btn-secondary,
    .todo-edit-actions .btn-primary {
        flex: 1 1 0;
    }

    .todo-suggestion-head {
        align-items: center;
    }

    .todo-month-grid {
        gap: 4px;
    }

    .todo-month-day {
        min-height: 74px;
        padding: 5px;
    }

    .todo-month-day.expanded {
        min-height: 150px;
    }

    .todo-month-day.expanded .todo-month-items {
        max-height: 190px;
    }

    .todo-month-item {
        min-height: 18px;
        font-size: 10px;
    }
}

@media (max-width: 420px) {
    .messages {
        padding-inline: 8px;
    }

    .message {
        gap: 6px;
    }

    .avatar {
        display: none;
    }

    .bubble p,
    .bubble ul,
    .bubble ol {
        font-size: 13px;
    }

    .attachment-name,
    .attachment-image-chip .attachment-name {
        max-width: 50vw;
    }

    .citation-item.has-image .citation-link {
        grid-template-columns: 58px minmax(0, 1fr);
    }

    .citation-thumbnail-wrap {
        width: 58px;
        height: 44px;
    }

    .topbar-actions .model-pill {
        max-width: 42vw;
    }
}

@media (max-width: 720px) {
    .share-card-dialog {
        padding: 8px;
    }

    .share-card-panel {
        width: calc(100vw - 16px);
        height: calc(100dvh - 16px);
        border-radius: 10px;
    }

    .share-card-head {
        min-height: 70px;
        padding: 11px 10px 11px 13px;
    }

    .share-card-head p {
        display: none;
    }

    .share-card-close {
        width: 42px;
        height: 42px;
        min-height: 42px;
    }

    .share-card-stage {
        padding: 12px;
    }

    .share-card-image {
        width: 100%;
    }

    .share-card-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
        padding: 9px;
    }

    .share-card-status {
        min-height: 18px;
        padding: 0 3px;
    }

    .share-card-actions {
        width: 100%;
    }

    .share-card-actions .btn-secondary,
    .share-card-actions .btn-primary {
        min-height: 44px;
        flex: 1 1 0;
        justify-content: center;
    }
}
