/* V3 legal workspace polish: token-based so both theme palettes stay in step. */
body {
    font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
    line-height: 1.48;
    letter-spacing: 0.005em;
}

.topbar,
.bottombar {
    background: var(--bg-secondary);
}

.topbar { padding-inline: clamp(10px, 1.5vw, 20px); }
.topbar-right { gap: 7px; }
.logo { letter-spacing: 0.015em; }

.panel,
.panel-left,
.panel-right,
.tab-pane,
.main-body { min-width: 0; min-height: 0; }
.panel { overflow: hidden; }
.tab-bar {
    gap: 2px;
    padding-inline: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.tab-btn {
    flex: 0 0 auto;
    padding: 9px 14px;
    font-weight: 550;
}
.tab-pane.active { min-height: 0; }

.mindmap-toolbar,
.fm-toolbar,
.dict-toolbar {
    gap: 8px;
    padding: 9px 12px;
}
.mindmap-toolbar { flex-wrap: wrap; }
.mindmap-toolbar-left,
.net-view-btns,
.chat-actions,
.action-row { flex-wrap: wrap; }
.mindmap-toolbar > div { min-width: 0; }
.net-legend {
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}
.net-legend-item { border-radius: 999px; padding: 3px 9px; }
.network-canvas,
.mindmap-canvas { min-height: 0; }

.btn,
.graph-mode-btn,
.theme-btn,
.send-btn,
.attach-btn {
    transition: color 0.16s ease, background-color 0.16s ease,
        border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}
.btn:hover:not(:disabled),
.graph-mode-btn:hover,
.theme-btn:hover,
.attach-btn:hover { box-shadow: 0 1px 5px var(--shadow); }
.btn:focus-visible,
.graph-mode-btn:focus-visible,
.theme-btn:focus-visible,
.send-btn:focus-visible,
.attach-btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.tab-btn:focus-visible,
.dict-filter-btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

input,
textarea,
select { accent-color: var(--accent-blue); }

.section-block,
.file-item,
.cc-card,
.tool-call-card,
.stream-tools {
    border-color: var(--border);
}
.section-block {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-secondary);
}
.section-head {
    margin-bottom: 9px;
    color: var(--text-primary);
    letter-spacing: 0.015em;
}
.file-list { max-height: min(32vh, 300px); padding: 2px; }
.file-item {
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 7px 9px;
}
.file-item:hover { border-color: var(--border); }
.fm-list { padding: 8px 10px; }
.fm-directory-help {
    padding: 7px 10px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.fm-item { border: 1px solid transparent; }
.fm-item:hover { border-color: var(--border); }

.chat-header,
.mindmap-toolbar,
.fm-toolbar,
.dict-toolbar { background: var(--bg-secondary); }
.message-list,
.center-pane,
.desens-content,
.fm-list,
.dict-list { overscroll-behavior: contain; }
.chat-header-title,
.section-head,
.center-pane .sec-title { letter-spacing: 0.01em; }
.center-pane .sec-title {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 14px;
}
.cc-card {
    box-shadow: 0 1px 2px var(--shadow);
    transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.cc-card:hover { transform: translateY(-1px); box-shadow: 0 3px 10px var(--shadow); }
.tool-call-card { line-height: 1.55; }
.stream-tools { padding: 2px 0; }

.msg-bubble table,
.fm-preview-body table,
.orig-doc table,
.modal-box table,
#pane-dict table {
    border-collapse: collapse;
    border-color: var(--border);
    line-height: 1.5;
}
.msg-bubble th,
.fm-preview-body th,
.orig-doc th,
.modal-box th,
#pane-dict th {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    font-weight: 600;
}
.msg-bubble td,
.msg-bubble th,
.fm-preview-body td,
.fm-preview-body th,
.orig-doc td,
.orig-doc th,
.modal-box td,
.modal-box th,
#pane-dict td,
#pane-dict th { border-color: var(--border); }
.msg-bubble td,
.fm-preview-body td,
.orig-doc td,
.modal-box td,
#pane-dict td { color: var(--text-primary); }

.node-detail {
    border-top-color: var(--border);
    background: var(--bg-secondary);
}
.detail-chip { line-height: 1.45; }
.vis-tooltip { line-height: 1.55; }

@media (max-width: 760px) {
    .topbar {
        overflow-x: auto;
        overflow-y: hidden;
        gap: 12px;
    }
    .topbar-left,
    .topbar-right { flex: 0 0 auto; }
    .topbar-right { padding-right: 2px; }
    .main-body {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
    }
    .sess-sidebar {
        width: auto;
        min-width: 0;
        height: 160px;
        flex: 0 0 160px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .panel-left,
    .panel-right,
    .main-body.graph-mode .panel-left,
    .main-body.graph-mode .panel-right,
    body:not(.graph-mode) .panel-left,
    body:not(.graph-mode) .panel-right {
        width: 100%;
        min-width: 0;
        min-height: 420px;
        height: min(72vh, 720px);
        flex: 0 0 min(72vh, 720px);
        border-left: 0;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .main-body.graph-mode .sess-sidebar { display: none; }
    .tab-bar { padding-inline: 6px; }
    .tab-btn { padding-inline: 11px; }
    .mindmap-toolbar { align-items: flex-start; }
    .mindmap-toolbar > div { flex-wrap: wrap; }
    .net-legend { max-height: 72px; overflow: auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
