@layer reset, base, shell, tools, workspace, overlays, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, h4, p { margin: 0; }
  fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
  button, input, textarea, select { font: inherit; color: inherit; }
  button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; }
  button { border: 0; background: none; }
  a { color: inherit; text-decoration: none; }
  button:disabled{ cursor:not-allowed; opacity: .42; }
  svg { display: block; flex-shrink: 0; }
}

@layer base {
  :root {
    color-scheme: light;
    --bg: #f5f5f5; --surface: #fff; --sidebar: #fff; --text: #262626;
    --muted: #737373; --secondary: #595959; --border: #e8e8e8;
    --subtle: #f5f5f5; --surface-muted: #fafafa; --line: #d9d9d9; --port: #bfbfbf;
    --accent: #007aff; --accent-hover: #0069df; --accent-soft: #eaf3ff;
    --accent-line: #9ac9ff; --accent-text: #0066cc; --on-accent: #fff;
    --node-top: #f4f4f5; --node-bottom: #e2e2e4; --node-selected-top: #edf2ff; --node-selected-bottom: #c6d9ff;
    --dependency-strong: #00a63c; --dependency-weak: #2f76ff; --tool-purple: #8555ad; --node-bg: #f0f0f2;
    --brand-blue: #0068b5; --message-blue: #e2edff;
    --danger: #cf1322; --danger-soft: #fff1f0; --danger-border: #ffccc7;
    --success: #27833e; --success-soft: #e5f8e9; --success-border: #afe2bb;
    --warning: #d97c16; --warning-soft: #fff3e3;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    --sidebar-default: 222px; --tool-detail-default: 19rem; --execution-default: 350px;
    --sidebar-size: clamp(180px, var(--sidebar-width, var(--sidebar-default)), min(45vw, 640px));
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-family: var(--font); font-size: var(--ui-font-size, 18px); color: var(--text); font-synthesis: none;
    text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #141414; --surface: #1f1f1f; --sidebar: #1b1b1b; --text: #ededed;
    --muted: #a6a6a6; --secondary: #c4c4c4; --border: #3a3a3a;
    --subtle: #292929; --surface-muted: #242424; --line: #4a4a4a; --port: #737373;
    --accent: #4096ff; --accent-hover: #69b1ff; --accent-soft: #152d48;
    --accent-line: #305e91; --accent-text: #91caff;
    --message-blue: #183451;
    --node-top: #373739; --node-bottom: #29292c; --node-selected-top: #254464; --node-selected-bottom: #183451;
    --dependency-strong: #63d88e; --dependency-weak: #79aaff; --tool-purple: #c193e9; --node-bg: #303033;
    --danger: #ffaaa6; --danger-soft: #402321; --danger-border: #733c38;
    --success: #85d79a; --success-soft: #193c29; --success-border: #346746;
    --warning: #ffbb70; --warning-soft: #422f1e;
  }
  body { background: var(--bg); line-height: 1.5; }
  ::selection { background: var(--accent-soft); color: var(--text); }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
  input:focus-visible, textarea:focus-visible, select:focus-visible{ outline: none; }
  input:focus, textarea:focus, select:focus{ border-color: var(--accent); box-shadow: none; }
  input::placeholder, textarea::placeholder{ color: var(--muted); }
  code, pre { font-family: var(--mono); font-size: 0.9375rem; }
  pre { overflow: auto; tab-size: 2; }
  .icon { width: 19px; height: 19px; }
  .icon-button { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 4px; color: var(--secondary); transition: background .15s, color .15s; }
  .icon-button:hover{ background: var(--subtle); color: var(--text); }
  .icon-button .icon { width: 17px; height: 17px; }
  .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 8px 14px; font-size: 0.9375rem; line-height: 1.5; font-weight: 500; white-space: nowrap; border: 1px solid transparent; border-radius: 4px; transition: background .15s, border-color .15s; }
  .button .icon { width: 16px; height: 16px; }
  .button.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); box-shadow: none; }
  .button.primary:hover:not(:disabled){ background: var(--accent-hover); border-color: var(--accent-hover); }
  .button.secondary { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: none; }
  .button.secondary:hover:not(:disabled){ background: var(--surface-muted); border-color: var(--border); }
  .button.destructive { background: var(--danger); color: var(--on-accent); }
  .text-button { display: inline-flex; align-items: center; gap: 6px; padding: 3px 0; color: var(--secondary); font-size: 0.9375rem; }
  .text-button:hover{ color: var(--accent); }
  .text-button .icon { width: 14px; height: 14px; }
  .full-width { width: 100%; }
  .danger, .error-text { color: var(--danger) !important; }
  .muted { color: var(--muted); font-size: 0.9375rem; }
  .live-dot, .demo-dot { background: var(--success); }
  .demo-dot { background: var(--warning); }
  .select-control { max-width: 100%; min-height: 32px; padding: 6px 28px 6px 10px; border: 1px solid var(--border); border-radius: 4px; background-color: var(--surface); font-size: 0.9375rem; cursor: pointer; }
  .spinner { display: inline-block; width: 15px; height: 15px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
  * { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
}

@layer shell {
  .panel-resizer { position: absolute; inset: 0 auto 0 0; width: 8px; z-index: 5; cursor: col-resize; touch-action: none; outline-offset: -2px; }
  .panel-resizer::before { content: ''; position: absolute; top: 0; bottom: 0; left: 2px; width: 2px; background: transparent; }
  .panel-resizer::after { content: ''; position: absolute; top: 50%; left: 2px; width: 3px; height: 28px; border-radius: 2px; background: var(--line); }
  .panel-resizer:hover::before, .panel-resizer:focus-visible::before { background: var(--accent); }
  .sidebar-resizer { position: fixed; left: calc(var(--sidebar-size) - 4px); z-index: 45; }
  .resizing-panels, .resizing-panels * { cursor: col-resize !important; user-select: none !important; }
  .app-shell { min-height: 100dvh; }
  .sidebar { width: var(--sidebar-size); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--border); padding: 20px 12px 0; z-index: 40; overflow-y: auto; }
  .brand { display: flex; align-items: center; gap: 7px; padding: 0 10px; font-size: 1.5rem; font-weight: 600; line-height: 1.6; }
  .brand > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .brand-symbol { width: 36px; height: 36px; border-radius: 8px; background: var(--brand-blue); color: var(--on-accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .brand-symbol .icon { width: 21px; height: 21px; }
  .primary-nav { margin-top: 28px; display: flex; flex-direction: column; gap: 5px; }
  .nav-item { display: flex; align-items: center; width: 100%; padding: 11px 12px; gap: 11px; text-align: left; white-space: nowrap; color: var(--secondary); border-radius: 4px; font-size: 0.9375rem; }
  .nav-item:hover{ background: var(--surface-muted); }
  .nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
  .nav-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .nav-item .icon { width: 18px; height: 18px; }
  .nav-item .nav-arrow { margin-left: auto; width: 13px; height: 13px; opacity: 0; }
  .nav-item.active .nav-arrow { opacity: .8; }
  .sidebar-section-head { display: flex; align-items: center; justify-content: space-between; margin: 25px 8px 7px 12px; color: var(--secondary); font-size: 0.875rem; letter-spacing: .5px; }
  .sidebar-section-head .icon-button { width: 24px; height: 24px; }
  .sidebar-section-head .icon { width: 14px; height: 14px; }
  .toolset-nav { display: flex; flex-direction: column; gap: 4px; }
  .toolset-item { padding: 9px 12px; display: flex; align-items: center; gap: 10px; width: 100%; font-size: 0.9375rem; border-radius: 4px; color: var(--secondary); text-align: left; }
  .toolset-item:hover{ background: var(--surface-muted); }
  .toolset-item.selected { background: var(--accent-soft); color: var(--text); }
  .toolset-item > span:nth-child(2){ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .toolset-icon { color: var(--tool-purple); }
  .toolset-icon .icon { width: 17px; height: 17px; }
  .toolset-icon.music { color: var(--tool-purple); }
  .toolset-count { margin-left: auto; font-size: 0.875rem; color: var(--muted); font-family: var(--mono); }
  .sidebar-divider { border-top: 1px solid var(--border); margin: 24px 12px 0; }
  .sidebar-divider + .sidebar-section-head { margin-top: 12px; }
  .task-nav-row { display: flex; align-items: center; border-radius: 4px; background: var(--subtle); margin-bottom: 5px; }
  .task-nav-row:hover, .task-nav-row.selected{ background: var(--message-blue); }
  .sidebar-new-task { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px; margin-top: 18px; background: var(--accent-soft); color: var(--accent-text); border-radius: 5px; font-size: .9375rem; text-align: left; }
  .sidebar-new-task > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-new-task:hover { background: var(--message-blue); }
  .task-link { display: flex; align-items: center; gap: 9px; padding: 10px 5px 10px 12px; width: calc(100% - 28px); color: var(--secondary); font-size: 0.875rem; text-align: left; }
  .task-link .icon { width: 14px; height: 14px; color: var(--secondary); }
  .task-link span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .task-menu-button { width: 24px; height: 24px; opacity: 0; }
  .task-nav-row:hover .task-menu-button, .task-menu-button:focus-visible{ opacity: 1; }
  .task-menu-button .icon { width: 15px; height: 15px; }
  .sidebar-empty { padding: 8px 12px; color: var(--muted); font-size: 0.875rem; }
  .sidebar-bottom { margin-top: auto; padding-top: 32px; padding-bottom: 18px; }
  .sidebar-bottom > .nav-item { padding-bottom: 17px; }
  .application { margin-left: var(--sidebar-size); height: 100dvh; display: flex; flex-direction: column; }
  .workspace-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .mobile-menu { display: none; }
  .page-content { padding: 12px 16px; flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .page-heading { min-height: 36px; display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
  .page-heading h1 { font-size: 1.625rem; letter-spacing: 0; font-weight: 600; line-height: 1.5; }
  .heading-title { display: flex; align-items: center; gap: 17px; flex-wrap: wrap; min-width: 0; }
  .heading-count { font-size: 0.875rem; color: var(--secondary); border-left: 1px solid var(--border); padding-left: 16px; }
  .heading-actions { display: flex; gap: 8px; flex-wrap: wrap; max-width: 100%; }
  .empty-state { flex: 1; border: 1px solid var(--border); background: var(--surface); border-radius: 4px; min-height: calc(100dvh - 212px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; }
  .empty-state h2 { font-size: 1.5rem; margin-top: 28px; font-weight: 600; }
  .empty-state p { margin: 12px 0 27px; color: var(--secondary); font-size: 0.9375rem; text-align: center; }
  .empty-state .text-button { margin-top: 18px; font-size: 0.875rem; }
  .loading-state, .load-error { min-height: 65dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--secondary); }
  .loading-state { flex-direction: row; }
  .load-error > .icon { color: var(--danger); width: 32px; height: 32px; }
  .load-error h1 { font-size: 1.5rem; font-weight: 600; color: var(--text); }
  .load-error p { max-width: 520px; text-align: center; }
  .load-error > div { display: flex; gap: 8px; margin-top: 10px; }
}

@layer tools {
  .tools-surface { border: 1px solid var(--border); background: var(--surface); border-radius: 0; box-shadow: none; overflow: hidden; flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .tools-surface-top { display: flex; align-items: center; justify-content: space-between; padding: 17px 23px 13px; min-height: 66px; }
  .current-toolset { display: flex; gap: 11px; align-items: center; min-width: 0; }
  .collection-symbol { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; color: var(--tool-purple); background: var(--accent-soft); border-radius: 4px; flex-shrink: 0; }
  .collection-symbol .icon { width: 17px; height: 17px; }
  .collection-symbol.music { color: var(--tool-purple); background: var(--accent-soft); }
  .current-toolset h2 { flex-shrink: 0; font-size: 1.125rem; font-weight: 620; letter-spacing: -.2px; white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
  .collection-description { font-size: 0.875rem; color: var(--secondary); margin-left: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 400px; }
  .tabs-row { display: flex; align-items: stretch; justify-content: space-between; border-bottom: 1px solid var(--border); padding: 0 16px; min-height: 49px; overflow-x: auto; gap: 20px; }
  .tabs { display: flex; flex-shrink: 0; align-items: stretch; gap: 29px; }
  .tab { display: flex; white-space: nowrap; flex-shrink: 0; align-items: center; gap: 7px; position: relative; color: var(--secondary); font-size: 0.875rem; padding: 0 1px 13px; }
  .tab > .icon { width: 15px; height: 15px; }
  .tab:hover{ color: var(--accent); }
  .tab.active { color: var(--accent); font-weight: 550; }
  .tab.active::after{ content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--accent); }
  .tab-count { font-family: var(--mono); font-size: 0.875rem; padding: 0 5px; line-height: 1.5; border-radius: 3px; background: var(--surface-muted); color: var(--secondary); margin-left: -1px; }
  .version-indicator { display: flex; flex-shrink: 0; align-items: center; gap: 6px; padding-bottom: 13px; font-family: var(--mono); font-size: 0.875rem; color: var(--secondary); }
  .version-indicator .live-dot { width: 5px; height: 5px; }
  .tools-body { display: flex; flex: 1; min-height: 0; }
  .main-tool-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .graph-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; min-height: 66px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
  .search-input { display: flex; max-width: 100%; align-items: center; gap: 8px; width: 223px; border: 1px solid var(--border); padding: 7px 9px; border-radius: 4px; color: var(--muted); height: 2.35rem; background: var(--surface); }
  .search-input:focus-within{ border-color: var(--border); box-shadow: none; }
  .search-input > .icon { width: 14px; height: 14px; }
  .search-input input { font-size: 0.875rem; width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; outline: none; box-shadow: none; }
  .search-shortcut { display: grid; place-items: center; width: 16px; height: 17px; font-size: 0.875rem; color: var(--muted); border: 1px solid var(--border); border-radius: 3px; }
  .edge-filters { display: flex; align-items: center; gap: 15px; }
  .edge-filter { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; color: var(--muted); white-space: nowrap; padding: 6px 0; }
  .edge-filter { padding: 3px 8px; border-radius: 14px; }
  .edge-filter.enabled[data-action="toggle-strong"] { color: var(--dependency-strong); background: var(--success-soft); }
  .edge-filter.enabled[data-action="toggle-weak"] { color: var(--dependency-weak); background: var(--accent-soft); }
  .legend-line { width: 20px; height: 1px; border-top: 1.5px solid var(--border); position: relative; opacity: .4; }
  .edge-filter.enabled .legend-line { opacity: 1; }
  .legend-line::after{ content: ''; position: absolute; right: -1px; top: -3px; width: 4px; height: 4px; border-top: 1px solid currentColor; border-right: 1px solid currentColor; transform: rotate(45deg); }
  .legend-line.strong { border-color: var(--dependency-strong); color: var(--dependency-strong); }
  .legend-line.weak { border-color: var(--dependency-weak); border-top-style: dashed; color: var(--dependency-weak); }
  .graph-canvas { position: relative; flex: 1; min-height: 0; background-color: var(--surface); border-radius: 16px; background-image: none; background-size: 17px 17px; overflow: hidden; }
  .graph-svg { display: block; width: 100%; height: 100%; min-height: 375px; cursor: grab; user-select: none; touch-action: none; }
  .graph-svg.panning { cursor: grabbing; }
  .graph-edge { fill: none; stroke-width: 2.5; }
  .graph-edge.strong { stroke: var(--dependency-strong); opacity: .9; }
  .graph-edge.weak { stroke: var(--dependency-weak); stroke-dasharray: 8 6; opacity: .9; }
  .graph-edge.related { opacity: 1; stroke-width: 2.5; }
  .graph-edge.strong.related { stroke: var(--dependency-strong); }
  .graph-edge.weak.related { stroke: var(--dependency-weak); }
  .graph-edge.changed { stroke-width: 2.3; }
  .graph-node { cursor: pointer; outline: none; }
  .node-shadow { fill: transparent; }
  .node-body { fill: url(#node-gray); stroke: transparent; stroke-width: 2; transition: fill .15s, stroke .15s; }
  .node-port { fill: var(--port); }
  .node-name { font-size: 30px; font-family: var(--font); font-weight: 700; font-synthesis: weight; fill: var(--text); }
  .node-id { font-family: var(--mono); font-size: 0.8125rem; fill: var(--muted); }
  .graph-node:hover .node-body, .graph-node:focus-visible .node-body{ stroke: var(--accent-line); fill: url(#node-gray); }
  .graph-node:focus-visible .node-body{ stroke-width: 2; }
  .graph-node.selected .node-body { fill: url(#node-blue); stroke: #b7ccff; stroke-width: 2; }
  .graph-node.selected .node-name { fill: var(--text); font-weight: 650; }
  .graph-title { font-size: 40px; font-weight: 700; font-synthesis: weight; fill: var(--text); }
  .graph-legend { cursor: pointer; outline: none; opacity: .4; }
  .graph-legend.enabled { opacity: 1; }
  .graph-legend text { font-size: 28px; font-weight: 600; fill: currentColor; }
  .graph-legend.strong { color: var(--dependency-strong); }
  .graph-legend.weak { color: var(--dependency-weak); }
  .legend-body { fill: var(--surface); stroke: currentColor; stroke-opacity: .12; stroke-width: 2; }
  .legend-label-bg { fill: currentColor; fill-opacity: .14; }
  .legend-arrow { stroke: currentColor; stroke-width: 3; }
  .graph-legend.weak .legend-arrow { stroke-dasharray: 8 6; }
  .graph-legend:focus-visible .legend-body { stroke-opacity: 1; }
  .graph-canvas .zoom-controls { opacity: 0; transition: opacity .15s; }
  .graph-canvas:hover .zoom-controls, .graph-canvas:focus-within .zoom-controls { opacity: 1; }
  .graph-node.selected .node-id { fill: var(--secondary); }
  .graph-node.selected .node-port { fill: var(--accent); }
  .node-selected-dot { fill: var(--accent); }
  .graph-node.filtered { opacity: .22; }
  .graph-caption { position: absolute; top: 17px; left: 20px; display: flex; align-items: center; gap: 7px; font-size: 0.875rem; color: var(--muted); pointer-events: none; }
  .graph-caption .live-dot { width: 4px; height: 4px; }
  .caption-separator { color: var(--muted); margin: 0 2px; }
  .zoom-controls { position: absolute; bottom: 18px; left: 20px; display: flex; align-items: center; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); padding: 2px; box-shadow: none; }
  .zoom-controls .icon-button { width: 28px; height: 27px; color: var(--secondary); }
  .zoom-controls .icon { width: 14px; height: 14px; }
  .zoom-controls > span { height: 14px; border-left: 1px solid var(--border); margin: 0 3px; }
  .zoom-value { width: 39px; font-family: var(--mono); font-size: 0.875rem; color: var(--secondary); padding: 5px 0; }
  .graph-minimap { position: absolute; bottom: 18px; right: 18px; width: 100px; height: 79px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); padding: 6px; pointer-events: none; }
  .graph-minimap svg { width: 100%; height: 100%; }
  .minimap-viewport { stroke: var(--port); stroke-width: 5px; fill: none; }
  .tool-detail { position: relative; border-left: 1px solid var(--border); width: clamp(220px, var(--tool-detail-width, var(--tool-detail-default)), max(220px, min(1000px, calc(100% - 280px)))); flex-shrink: 0; background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
  .panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; min-height: 66px; border-bottom: 1px solid var(--border); }
  .panel-heading h2 { font-size: 1rem; font-weight: 550; }
  .panel-heading .icon-button { width: 23px; height: 23px; color: var(--muted); }
  .panel-heading .icon { width: 15px; height: 15px; }
  .tool-detail-scroll { overflow-y: auto; flex: 1; min-height: 0; padding: 22px 20px 20px; }
  .detail-name { padding: 8px 10px; background: var(--accent-soft); border-radius: 5px; font-size: 1.25rem; letter-spacing: -.3px; font-weight: 600; margin-bottom: 4px; overflow-wrap: anywhere; }
  .detail-operation { color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }
  .endpoint { display: flex; align-items: start; gap: 8px; padding: 10px 0; margin-top: 12px; border-bottom: 1px solid var(--border); }
  .endpoint code { font-size: 0.875rem; color: var(--secondary); line-height: 1.65; overflow-wrap: anywhere; }
  .method { display: inline-flex; align-items: center; padding: 0 4px; font-size: 0.8125rem; font-family: var(--mono); font-weight: 500; line-height: 1.6; color: var(--success); background: var(--success-soft); border-radius: 2px; }
  .method.post { color: var(--accent-text); background: var(--accent-soft); }
  .method.delete { color: var(--danger); background: var(--danger-soft); }
  .method.put, .method.patch { color: var(--warning); background: var(--warning-soft); }
  .detail-tabs { display: flex; align-items: center; gap: 21px; margin-top: 22px; border-bottom: 1px solid var(--border); }
  .detail-tabs button { display: flex; align-items: center; gap: 5px; font-size: 0.875rem; color: var(--muted); padding: 0 0 10px; border-bottom: 1.5px solid transparent; }
  .detail-tabs button.active { color: var(--text); border-color: var(--border); }
  .detail-tabs .icon { width: 12px; height: 12px; }
  .tool-description { font-size: 0.9375rem; color: var(--secondary); line-height: 1.9; padding-top: 18px; }
  .detail-section { margin-top: 25px; }
  .detail-section h4 { font-size: 0.9375rem; font-weight: 550; display: flex; align-items: center; gap: 7px; margin-bottom: 12px; color: var(--text); }
  .detail-section h4 > span { color: var(--muted); font-family: var(--mono); font-size: 0.875rem; font-weight: 400; }
  .parameter-table { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .parameter-head { display: flex; justify-content: space-between; background: var(--surface-muted); color: var(--secondary); font-size: 0.875rem; padding: 7px 9px; border-bottom: 1px solid var(--border); }
  .parameter-row > div { min-width: 0; }
  .parameter-row { display: flex; align-items: start; justify-content: space-between; padding: 10px 9px; gap: 5px; border-bottom: 1px solid var(--border); }
  .parameter-row:last-child{ border-bottom: 0; }
  .parameter-row code { color: var(--secondary); font-size: 0.875rem; display: inline-block; overflow-wrap: anywhere; }
  .field-type { font-size: 0.875rem; font-family: var(--mono); color: var(--muted); margin-left: 7px; }
  .parameter-row p { font-size: 0.875rem; margin-top: 4px; color: var(--muted); }
  .required-tag { flex-shrink: 0; font-size: 0.875rem; color: var(--muted); padding: 1px 4px; line-height: 1.5; }
  .required-tag.yes { color: var(--success); background: var(--success-soft); border-radius: 12px; padding: 1px 7px; }
  .output-field { position: relative; padding-left: 12px; margin: 12px 0 14px; }
  .output-field::before { content: ""; position: absolute; left: 0; top: .65em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
  .output-field code { color: var(--secondary); font-size: 0.875rem; }
  .output-field > div { display: flex; align-items: center; }
  .output-field p { font-size: 0.875rem; color: var(--muted); margin-top: 4px; line-height: 1.7; }
  .relations { padding-top: 19px; border-top: 1px solid var(--border); }
  .relation-group { margin-top: 17px; }
  .relation-label { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; color: var(--secondary); margin-bottom: 7px; }
  .relation-label > .icon { width: 12px; height: 12px; }
  .relation-label > span:last-child{ margin-left: auto; font-size: 0.875rem; font-family: var(--mono); color: var(--muted); }
  .relation-link { padding: 6px 0 6px 18px; display: flex; align-items: center; gap: 7px; font-size: 0.875rem; color: var(--secondary); width: 100%; text-align: left; }
  .relation-group:first-of-type .relation-label .icon { color: var(--dependency-strong); }
  .relation-group:last-of-type .relation-label .icon { color: var(--dependency-weak); }
  .relation-link:hover{ color: var(--accent); }
  .relation-link .icon { margin-left: auto; width: 11px; height: 11px; color: var(--muted); }
  .relation-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text); }
  .relation-dot.weak { background: #f0f0f0; }
  .relation-empty { padding-left: 18px; font-size: 0.875rem; }
  .detail-footer { padding: 14px 17px; border-top: 1px solid var(--border); }
  .detail-footer .button { font-size: 0.875rem; min-height: 33px; padding: 7px 10px; color: var(--secondary); border-color: var(--border); }
  .detail-footer .icon { width: 13px; height: 13px; }
  .detail-footer .icon:last-child{ margin-left: auto; }
  .schema-block { margin: 18px 0; padding: 12px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 4px; color: var(--secondary); max-height: 70dvh; }
  .schema-block code { font-size: 0.875rem; line-height: 1.8; }
  .detail-placeholder { color: var(--muted); font-size: 0.875rem; padding: 60px 20px; text-align: center; }
  .api-list-scroll { overflow: auto; flex: 1; min-height: 0; }
  .api-table { border-collapse: collapse; width: 100%; text-align: left; }
  .api-table thead { position: sticky; top: 0; z-index: 1; background: var(--surface-muted); }
  .api-table th { height: 38px; padding: 0 20px; font-size: 0.875rem; font-weight: 400; color: var(--secondary); border-bottom: 1px solid var(--border); white-space: nowrap; }
  .api-table td { padding: 0 20px; border-bottom: 1px solid var(--border); height: 70px; }
  .api-table tr:hover td{ background: var(--surface-muted); }
  .api-table tr.selected td { background: var(--accent-soft); }
  .api-name-button { display: flex; flex-direction: column; text-align: left; width: 100%; padding: 12px 0; gap: 4px; min-width: 115px; }
  .api-name-button span { font-size: 0.875rem; font-weight: 500; color: var(--secondary); }
  .api-name-button code { font-size: 0.875rem; color: var(--muted); }
  .api-table td:nth-child(2){ min-width: 160px; padding-left: 4px; }
  .api-table th:nth-child(2){ padding-left: 4px; }
  .api-path { color: var(--secondary); font-size: 0.875rem; display: block; margin-top: 5px; overflow-wrap: anywhere; }
  .api-params { color: var(--muted); font-size: 0.875rem; font-family: var(--mono); }
  .api-table td:last-child, .api-table th:last-child{ width: 35px; padding: 0 7px; }
  .api-table .icon { width: 13px; height: 13px; }
  .table-footer { padding: 16px 20px; font-size: 0.875rem; color: var(--muted); }
  .list-empty { text-align: center; padding: 60px 15px; font-size: 0.9375rem; color: var(--muted); }
  .evolution-layout { display: flex; flex: 1; min-height: 0; }
  .version-list { width: 210px; flex-shrink: 0; border-right: 1px solid var(--border); padding: 21px 15px; overflow: auto; }
  .version-list-title { display: flex; justify-content: space-between; font-size: 0.875rem; color: var(--secondary); padding: 0 5px 21px; }
  .version-card { display: flex; flex-direction: column; position: relative; width: 100%; padding: 13px 12px 14px 20px; text-align: left; border-left: 1px solid var(--border); margin-left: 5px; }
  .version-card.active { background: var(--accent-soft); border-radius: 0 4px 4px 0; }
  .version-card:hover{ background: var(--surface-muted); }
  .version-timeline-dot { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface); position: absolute; left: -4px; top: 20px; }
  .version-card.active .version-timeline-dot { background: var(--accent); border-color: var(--border); box-shadow: none; }
  .version-card-top { width: 100%; display: flex; align-items: center; justify-content: space-between; }
  .version-card-top strong { font-size: 0.9375rem; font-family: var(--mono); font-weight: 500; color: var(--secondary); }
  .version-card-top > span { font-size: 0.875rem; color: var(--muted); }
  .version-title { font-size: 0.875rem; color: var(--secondary); margin: 7px 0; }
  .version-card time { font-size: 0.875rem; color: var(--muted); font-family: var(--mono); }
  .evolution-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
  .evolution-summary { display: flex; align-items: center; justify-content: space-between; padding: 20px 23px; gap: 15px; border-bottom: 1px solid var(--border); }
  .evolution-summary h3 { font-size: 0.9375rem; font-weight: 550; color: var(--secondary); }
  .evolution-summary > div > span { font-size: 0.875rem; color: var(--muted); display: block; margin-top: 4px; }
  .checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; color: var(--muted); cursor: pointer; }
  input[type="checkbox"] { accent-color: var(--accent); }
  .graph-canvas.compact { min-height: 300px; }
  .graph-canvas.compact .graph-svg { min-height: 300px; }
  .change-list { padding: 18px 23px; border-top: 1px solid var(--border); background: var(--surface); flex-shrink: 0; max-height: 160px; overflow: auto; }
  .change-list-title { display: flex; gap: 8px; color: var(--secondary); font-size: 0.875rem; margin-bottom: 10px; }
  .change-list-title span { color: var(--muted); font-family: var(--mono); font-size: 0.875rem; }
  .change-row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; font-size: 0.875rem; color: var(--secondary); padding: 5px 0; }
  .change-row > .icon { width: 12px; height: 12px; color: var(--muted); }
  .change-tag { font-size: 0.875rem; padding: 1px 5px; color: var(--warning); background: var(--warning-soft); border-radius: 2px; }
  .change-tag.removed { color: var(--secondary); background: var(--surface-muted); border-color: var(--border); }
  .change-reason { color: var(--muted); margin-left: 7px; font-size: 0.875rem; }
  .initial-version-note { color: var(--muted); font-size: 0.875rem; }
}

@layer workspace {
  .chat-layout { display: flex; gap: 18px; height: calc(100dvh - 183px); min-height: 600px; }
  .workspace-page .chat-layout { height: auto; min-height: 0; flex: 1; }
  .conversation-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
  .conversation-heading { flex-wrap: wrap; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 18px 23px; min-height: 67px; border-bottom: 1px solid var(--border); }
  .conversation-heading > div:first-child { flex: 1 1 240px; align-items: flex-start; }
  .conversation-heading > div { display: flex; align-items: center; gap: 9px; min-width: 0; }
  .conversation-heading h2 { font-size: 1.1rem; font-weight: 550; white-space: normal; overflow-wrap: anywhere; min-width: 0; line-height: 1.5; }
  .task-heading-icon { color: var(--muted); }
  .task-heading-icon .icon { width: 16px; height: 16px; }
  .conversation-actions .icon { width: 15px; height: 15px; }
  .conversation-actions { flex-shrink: 0; margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .toolset-badge { color: var(--accent); background: var(--accent-soft); border-radius: 16px; padding: 2px 10px; font-size: .875rem; }
  .messages { flex: 1; min-height: 0; overflow-y: auto; padding: 30px 27px; }
  .message { display: flex; align-items: start; gap: 12px; padding-bottom: 34px; animation: enter .2s ease; }
  .message-main { min-width: 0; flex: 1; }
  .message-author { font-size: 0.9375rem; font-weight: 600; color: var(--text); margin: 3px 0 10px; }
  .message.user .message-author { color: var(--secondary); }
  .message-content { font-size: 1rem; color: var(--text); line-height: 1.9; overflow-wrap: anywhere; }
  .message.user .message-content { background: var(--message-blue); border-radius: 8px; padding: 11px 15px; color: var(--text); display: inline-block; max-width: 100%; }
  .message.assistant .message-content { background: var(--subtle); border-radius: 8px; padding: 12px 16px; }
  .message-actions { display: flex; align-items: center; gap: 14px; margin-top: 15px; }
  .message-actions .text-button { font-size: 0.875rem; color: var(--secondary); }
  .message-actions .text-button > .icon { width: 12px; height: 12px; }
  .message-actions .icon-button { width: 24px; height: 24px; color: var(--muted); }
  .message-actions .icon-button .icon { width: 12px; height: 12px; }
  .pending-content { font-size: 0.875rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
  .pending-content .spinner { width: 12px; height: 12px; }
  .conversation-welcome { min-height: 250px; display: flex; flex-direction: column; align-items: flex-start; padding-top: 16px; }
  .conversation-welcome h2 { font-size: 1.25rem; color: var(--text); font-weight: 500; }
  .task-suggestions { margin-top: 18px; display: flex; flex-direction: column; gap: 0; width: min(360px, 100%); }
  .task-suggestions button { display: flex; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); color: var(--secondary); font-size: 0.9375rem; text-align: left; }
  .task-suggestions button:hover{ background: var(--surface-muted); border-color: var(--border); }
  .task-suggestions .icon { width: 13px; height: 13px; }
  .composer { margin: 0 20px 20px; border: 1px solid var(--border); border-radius: 4px; box-shadow: none; background: var(--surface); }
  .composer:focus-within{ border-color: var(--border); box-shadow: none; }
  .composer textarea { background: var(--surface); display: block; width: 100%; resize: none; padding: 15px 16px 4px; border: 0; outline: none; border-radius: 4px; box-shadow: none; font-size: 0.9375rem; min-height: 89px; line-height: 1.8; }
  .composer textarea::placeholder{ color: var(--muted); }
  .composer-bottom { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px 11px; }
  .composer-toolset { display: flex; align-items: center; gap: 7px; color: var(--secondary); font-size: 0.875rem; border-radius: 4px; padding: 5px; }
  .composer-toolset:hover{ background: var(--surface-muted); }
  .composer-toolset .icon { width: 13px; height: 13px; }
  .composer-toolset .icon:last-child{ width: 11px; height: 11px; color: var(--muted); margin-left: 3px; }
  .send-button { width: 31px; height: 31px; display: grid; place-items: center; background: var(--accent); border-radius: 4px; color: var(--on-accent); }
  .send-button:hover:not(:disabled){ background: var(--accent-hover); }
  .send-button .icon { width: 17px; height: 17px; }
  .send-button:disabled{ opacity: .35; }
  .stop-button .icon { width: 14px; height: 14px; }
  .run-notice { display: flex; gap: 8px; font-size: 0.875rem; color: var(--muted); padding: 12px; border: 1px solid var(--border); background: var(--surface-muted); border-radius: 4px; line-height: 1.8; }
  .run-notice.error { color: var(--secondary); background: var(--surface-muted); border-color: var(--border); }
  .run-notice > .icon { width: 15px; height: 15px; margin-top: 2px; }
  .execution-panel { position: relative; width: clamp(220px, var(--execution-width, var(--execution-default)), max(220px, min(1000px, calc(100% - 338px)))); flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; display: flex; flex-direction: column; }
  .execution-heading { flex-wrap: wrap; gap: 8px; display: flex; align-items: center; justify-content: space-between; padding: 20px 21px; min-height: 67px; border-bottom: 1px solid var(--border); }
  .execution-heading h2 { font-size: 1rem; font-weight: 550; }
  .status-tag { display: flex; align-items: center; gap: 5px; font-size: 0.875rem; color: var(--muted); border-radius: 16px; padding: 1px 9px; white-space: nowrap; }
  .status-tag > span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
  .status-tag.success { color: var(--success); background: var(--success-soft); }
  .status-tag.failed { color: var(--danger); background: var(--danger-soft); }
  .status-tag.running { color: var(--accent); background: var(--accent-soft); }
  .execution-content { padding: 17px 20px; overflow-y: auto; flex: 1; min-height: 0; }
  .run-select-row { margin-bottom: 24px; }
  .run-select-row select { width: 100%; color: var(--muted); border-color: var(--border); background-color: var(--surface-muted); font-size: 0.875rem; }
  .execution-timeline { display: flex; flex-direction: column; }
  .execution-step { display: flex; gap: 11px; position: relative; padding-bottom: 27px; }
  .execution-step:not(:last-child)::before{ content: ''; position: absolute; top: 24px; bottom: 0; left: 10px; border-left: 1px solid var(--border); }
  .step-rail { flex-shrink: 0; width: 22px; }
  .step-number { display: grid; place-items: center; width: 22px; height: 22px; border: 0; background: transparent; border-radius: 0; font-family: var(--mono); font-size: 0.875rem; color: var(--muted); }
  .step-number .icon { width: 11px; height: 11px; stroke-width: 1.7; }
  .execution-step.complete .step-number { color: var(--success); background: transparent; border: 0; }
  .execution-step.current .step-number { color: var(--accent); background: transparent; border: 0; }
  .step-main { flex: 1; min-width: 0; }
  .step-main h3 { font-size: 1rem; color: var(--secondary); font-weight: 550; padding: 2px 0 14px; }
  .execution-toolset { display: flex; align-items: center; gap: 9px; }
  .collection-symbol.small { width: 27px; height: 27px; background: var(--surface-muted); color: var(--muted); border-radius: 4px; }
  .collection-symbol.small .icon { width: 15px; height: 15px; }
  .execution-toolset strong { display: block; color: var(--text); font-size: 0.875rem; font-weight: 500; }
  .execution-toolset > div > span { display: block; color: var(--muted); font-size: 0.875rem; margin-top: 2px; }
  .execution-toolset > .subtle-badge { margin-left: auto; }
  .subtle-badge { font-size: 0.875rem; font-family: var(--font); line-height: 1.5; padding: 0 8px; color: var(--muted); background: var(--surface-muted); border-radius: 14px; white-space: nowrap; flex-shrink: 0; }
  .subtle-badge.retained { background: var(--accent-soft); color: var(--accent); }
  .subtle-badge.added { background: var(--warning-soft); color: var(--warning); }
  .subtle-badge.loaded { background: var(--success-soft); color: var(--success); }
  .code-list { display: flex; flex-direction: column; gap: 6px; }
  .code-list > div { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
  .code-list code { color: var(--text); font-size: 0.875rem; overflow-wrap: anywhere; min-width: 0; }
  .removed-tools { font-size: 0.875rem; color: var(--muted); margin-top: 9px; line-height: 1.8; }
  .removed-tools > span { margin-right: 7px; }
  .removed-tools code { font-size: 0.875rem; }
  .topology-reason { margin-top: 11px; }
  .topology-reason summary { font-size: 0.875rem; color: var(--muted); cursor: pointer; }
  .topology-reason p { color: var(--muted); font-size: 0.875rem; line-height: 1.8; margin-top: 8px; padding: 8px 10px; background: var(--surface-muted); border-radius: 4px; }
  .step-waiting { font-size: 0.875rem; color: var(--muted); }
  .tool-call-list { display: flex; flex-direction: column; gap: 9px; }
  .tool-call { border: 1px solid var(--border); border-radius: 4px; padding: 10px; background: var(--surface); }
  .tool-call-heading { display: flex; align-items: center; gap: 5px; justify-content: space-between; }
  .tool-call-heading > code { color: var(--text); font-size: 0.875rem; overflow-wrap: anywhere; min-width: 0; }
  .call-status { flex-shrink: 0; color: var(--muted); }
  .call-status .icon, .call-status .spinner { width: 12px; height: 12px; }
  .call-status.success { color: var(--success); background: var(--success-soft); border-radius: 16px; padding: 1px 8px; font-size: .8125rem; }
  .call-status.failed { color: var(--danger); background: var(--danger-soft); border-radius: 16px; padding: 1px 8px; }
  .tool-call-name { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 0.875rem; margin-top: 5px; }
  .tool-call-name > span { font-family: var(--mono); color: var(--muted); font-size: 0.875rem; }
  .call-input { display: flex; align-items: start; gap: 7px; font-size: 0.875rem; color: var(--muted); margin-top: 11px; }
  .call-input > span { flex-shrink: 0; }
  .call-input > code { overflow-wrap: anywhere; font-size: 0.875rem; }
  .call-result { margin-top: 10px; }
  .call-result summary { color: var(--accent); font-size: 0.875rem; display: flex; align-items: center; gap: 5px; cursor: pointer; }
  .call-result summary .icon { width: 10px; height: 10px; }
  .call-result[open] summary .icon { transform: rotate(180deg); }
  .call-result pre { margin: 10px 0 0; padding: 8px; border-radius: 4px; background: var(--surface-muted); color: var(--muted); max-height: 220px; }
  .call-result code { font-size: 0.875rem; line-height: 1.7; }
  .execution-finish { display: flex; gap: 7px; align-items: center; font-size: 0.875rem; color: var(--success); border-top: 1px solid var(--border); padding-top: 14px; margin-left: 33px; }
  .execution-finish .icon { width: 12px; height: 12px; }
  .execution-finish > span { margin-left: auto; font-family: var(--mono); color: var(--muted); }
  .execution-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; gap: 13px; color: var(--muted); }
  .execution-empty > .icon { width: 26px; height: 26px; stroke-width: 1.25; }
  .execution-empty p { font-size: 0.875rem; text-align: center; }
}

@layer overlays {
  .modal-backdrop { position: fixed; inset: 0; z-index: 100; background: #00000050; backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; }
  .modal { font-size: clamp(16px, var(--ui-font-size, 18px), 24px); background: var(--surface); width: 460px; max-width: 100%; max-height: calc(100dvh - 48px); border: 1px solid var(--border); border-radius: 4px; box-shadow: none; display: flex; flex-direction: column; animation: enter .15s ease; outline: none; }
  .modal .button, .modal .text-button { font-size: .9375em; }
  .modal-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
  .modal-heading h2 { font-size: 1.0625em; font-weight: 600; }
  .modal-heading .icon-button { width: 25px; height: 25px; color: var(--muted); }
  .modal-body { padding: 23px; overflow-y: auto; }
  .modal-footer { padding: 16px 22px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--border); }
  .form-label { display: block; font-size: 0.875em; font-weight: 500; color: var(--secondary); margin-bottom: 8px; }
  .form-input { display: block; width: 100%; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); padding: 10px 12px; font-size: 0.9375em; outline: none; }
  .form-input::placeholder{ color: var(--muted); }
  .form-group { margin-bottom: 20px; }
  .settings-modal { width: 520px; }
  .settings-section + .settings-section { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border); }
  .settings-section legend { float: left; width: 100%; font-size: 1em; font-weight: 600; margin-bottom: 16px; }
  .settings-section legend + * { clear: both; }
  .appearance-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .appearance-controls .form-group { min-width: 0; margin-bottom: 0; }
  .font-size-input { position: relative; }
  .font-size-input input { padding-right: 46px; }
  .font-size-input > span { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .8em; pointer-events: none; }
  .font-size-range { width: 100%; margin: 20px 0 14px; accent-color: var(--accent); cursor: pointer; }
  .font-presets { display: flex; gap: 6px; flex-wrap: wrap; }
  .font-presets button { flex: 1; padding: 6px 7px; border: 1px solid var(--border); border-radius: 4px; color: var(--secondary); font-size: .8em; white-space: nowrap; }
  .font-presets button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
  .file-drop { border: 1px dashed var(--border); border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-top: 21px; background: var(--surface-muted); min-height: 180px; padding: 22px; cursor: pointer; gap: 8px; transition: background .15s, border-color .15s; }
  .file-drop:hover, .file-drop.dragging{ background: var(--surface-muted); border-color: var(--border); }
  .file-drop-icon { width: 36px; height: 36px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; display: grid; place-items: center; color: var(--muted); margin-bottom: 5px; }
  .file-drop strong { font-size: 0.9375em; font-weight: 500; color: var(--muted); overflow-wrap: anywhere; max-width: 100%; text-align: center; }
  .file-drop > span:last-of-type{ font-size: 0.875em; color: var(--muted); }
  .file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
  .file-drop:focus-within{ outline: 2px solid var(--accent); outline-offset: 3px; }
  .sample-download { margin-top: 15px; color: var(--muted); font-size: 0.875em; }
  .sample-download .icon { width: 13px; height: 13px; }
  .form-error, .connection-result { padding: 10px 11px; display: flex; align-items: start; gap: 7px; margin-top: 13px; font-size: 0.9375em; line-height: 1.7; color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger-border); border-radius: 4px; }
  .form-error .icon, .connection-result .icon { width: 14px; height: 14px; margin-top: 2px; }
  .connection-result.ok { background: var(--success-soft); border-color: var(--success-border); color: var(--success); }
  .test-connection { margin-top: 4px; font-size: 0.875em; }
  .connection-result + .test-connection { margin-top: 14px; }
  .settings-data { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--border); }
  .settings-data h3 { font-size: 0.875em; font-weight: 550; margin-bottom: 12px; color: var(--muted); }
  .settings-data-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 0; font-size: 0.875em; color: var(--muted); gap: 16px; text-align: left; }
  .settings-data-row:hover{ color: var(--accent); }
  .settings-data-row .icon { width: 14px; height: 14px; }
  .confirm-description { color: var(--muted); font-size: 0.9375em; line-height: 1.8; padding: 3px 0 9px; }
  .delete-task-button { margin-top: 25px; font-size: 0.875em; }
  .manage-toolset-name { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; margin-bottom: 7px; border-bottom: 1px solid var(--border); }
  .manage-toolset-name strong { font-size: 1em; font-weight: 550; overflow-wrap: anywhere; }
  .choose-toolsets { display: flex; flex-direction: column; gap: 9px; }
  .choose-toolset { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 4px; }
  .choose-toolset:hover{ background: var(--surface-muted); border-color: var(--border); }
  .choose-toolset strong { font-size: 0.9375em; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .choose-toolset > span:last-of-type{ margin-left: auto; font-size: 0.875em; color: var(--muted); }
  .choose-toolset > .icon { width: 13px; height: 13px; color: var(--muted); }
  #notifications { position: fixed; bottom: 25px; left: calc(50% + var(--sidebar-size) / 2); transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; width: max-content; max-width: calc(100vw - 40px); }
  .toast { padding: 11px 17px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); box-shadow: none; display: flex; align-items: center; gap: 8px; color: var(--secondary); font-size: 0.9375em; animation: enter .15s ease; }
  .toast.error { color: var(--secondary); border-color: var(--border); }
  .toast .icon { width: 16px; height: 16px; }
}

@layer responsive {
  @media (min-width: 1680px){
    :root { --sidebar-default: 238px; --tool-detail-default: 20rem; --execution-default: 390px; }
    .sidebar { padding-left: 20px; padding-right: 20px; }
    .page-content { padding: 12px 16px; }
    .tool-detail-scroll { padding-left: 25px; padding-right: 25px; }
  }
  @media (max-width: 1240px){
    :root { --sidebar-default: 222px; --tool-detail-default: 300px; --execution-default: 310px; }
    .sidebar { padding-left: 10px; padding-right: 10px; }
    .page-content { padding: 12px 16px; }
    .graph-toolbar { padding: 13px; gap: 8px; }
    .edge-filters { gap: 10px; }
    .search-input { width: 185px; }
    .edge-filter { font-size: 0.875rem; gap: 5px; }
    .legend-line { width: 15px; }
    .collection-description { max-width: 200px; }
    .chat-layout { gap: 14px; }
    .messages { padding: 24px 20px; }
    .composer { margin: 0 16px 16px; }
    .execution-content { padding-left: 15px; padding-right: 15px; }
    .api-table th, .api-table td { padding-left: 13px; padding-right: 13px; }
    .version-list { width: 180px; }
    #notifications { left: calc(50% + var(--sidebar-size) / 2); }
  }
  @media (max-width: 1050px){
    :root { --tool-detail-default: 280px; --execution-default: 285px; }
    .brand { font-size: 1.375rem; padding-left: 5px; }
    .page-content { padding: 12px 16px; }
    .page-heading h1 { font-size: 1.5rem; }
    .tool-detail-scroll { padding: 18px 15px; }
    .panel-heading { padding-left: 15px; padding-right: 15px; }
    .graph-toolbar { flex-wrap: wrap; gap: 9px; }
    .search-input { width: 100%; }
    .edge-filters { margin-left: auto; }
    .graph-svg { min-height: 320px; }
    .message { gap: 9px; }
    .messages { padding: 24px 17px; }
    .message-content { font-size: 0.9375rem; }
    .version-list { width: 165px; }
    .evolution-summary { flex-wrap: wrap; padding: 15px 18px; }
  }
  @media (max-width: 860px){
    :root { --execution-default: 300px; }
    .sidebar-resizer { display: none; }
    .sidebar { transform: translateX(-100%); transition: transform .18s ease; width: min(var(--sidebar-width, var(--sidebar-default)), calc(100vw - 32px)); padding: 25px 15px 0; }
    .sidebar.is-open { transform: translateX(0); z-index: 60; box-shadow: none; }
    .sidebar-scrim { position: fixed; inset: 0; z-index: 50; background: #00000040; cursor: default; }
    .application { margin-left: 0; }
    .mobile-menu { display: inline-flex; position: fixed; top: 8px; left: 12px; z-index: 35; background: var(--surface); border: 1px solid var(--border); }
    .page-content { padding: 48px 12px 10px; }
    .graph-toolbar { flex-wrap: nowrap; }
    .search-input { width: 190px; }
    .collection-description { max-width: 260px; }
    #notifications { left: 50%; }
  }
  @media (max-width: 680px){
    .application:has(.workspace-page) { height: auto; min-height: 100dvh; }
    .workspace-page .chat-layout { flex: none; }
    .panel-resizer { display: none; }
    .application { height: auto; min-height: 100dvh; }
    .page-content { padding: 48px 10px 10px; display: block; }
    .page-heading { margin-bottom: 10px; gap: 10px; flex-wrap: wrap; }
    .page-heading h1 { font-size: 1.375rem; letter-spacing: -.5px; }
    .heading-count { display: none; }
    .heading-actions { gap: 6px; margin-left: auto; }
    .button { font-size: 0.875rem; padding: 7px 11px; min-height: 33px; gap: 6px; }
    .heading-actions .button .icon { width: 14px; height: 14px; }
    .tools-surface { height: auto; min-height: 0; }
    .tools-surface-top { padding: 15px; }
    .collection-description { display: none; }
    .tabs-row { padding: 0 15px; gap: 20px; overflow-x: auto; }
    .tabs { gap: 20px; flex-shrink: 0; }
    .tab { font-size: 0.875rem; gap: 5px; white-space: nowrap; flex-shrink: 0; }
    .version-indicator { flex-shrink: 0; }
    .tab > .icon { width: 14px; height: 14px; }
    .tools-body { flex-direction: column; }
    .main-tool-panel { flex: none; }
    .graph-toolbar { padding: 12px; min-height: 58px; }
    .search-input { width: min(50%, 210px); }
    .edge-filters { gap: 10px; }
    .edge-filter { font-size: 0.875rem; }
    .legend-line { width: 14px; }
    .graph-canvas { height: 440px; min-height: 440px; flex: none; }
    .graph-svg { width: 760px; height: 500px; min-height: 0; position: absolute; top: -25px; left: 50%; transform: translateX(-50%); }
    .graph-caption { top: 13px; left: 13px; font-size: 0.875rem; }
    .graph-minimap { width: 72px; height: 56px; bottom: 12px; right: 12px; }
    .zoom-controls { bottom: 12px; left: 12px; }
    .zoom-controls .icon-button { width: 25px; height: 26px; }
    .tool-detail { width: 100%; border-left: 0; border-top: 1px solid var(--border); flex: none; }
    .panel-heading { min-height: 54px; padding: 12px 18px; }
    .tool-detail-scroll { max-height: 520px; padding: 20px; }
    .detail-section { margin-top: 21px; }
    .detail-footer { padding: 13px 18px; }
    .detail-name { font-size: 1.25rem; }
    .tool-description { font-size: 0.9375rem; }
    .parameter-row p, .output-field p, .relation-link { font-size: 0.875rem; }
    .api-list-scroll { max-height: 560px; }
    .api-table th { font-size: 0.875rem; }
    .api-table th, .api-table td { padding-left: 12px; padding-right: 12px; }
    .api-table td:nth-child(2){ min-width: 110px; }
    .api-table th:nth-child(3), .api-table td:nth-child(3){ display: none; }
    .api-name-button { min-width: 105px; }
    .api-name-button span { font-size: 0.875rem; }
    .api-name-button code { font-size: 0.875rem; }
    .api-path { font-size: 0.875rem; }
    .chat-layout { flex-direction: column; height: auto; min-height: 0; gap: 16px; }
    .conversation-panel { flex: none; min-height: 540px; height: calc(100dvh - 174px); }
    .conversation-heading { padding: 14px 17px; min-height: 57px; }
    .conversation-heading h2 { font-size: 1.1rem; }
    .messages { padding: 24px 17px; }
    .composer { margin: 0 13px 13px; }
    .composer textarea { min-height: 78px; padding: 12px 12px 4px; }
    .execution-panel { width: 100%; max-height: 750px; }
    .execution-content { padding: 20px; }
    .execution-empty { min-height: 180px; }
    .execution-heading { min-height: 58px; padding: 17px 20px; }
    .execution-step { padding-bottom: 25px; }
    .step-main h3 { font-size: 0.9375rem; }
    .code-list code, .tool-call-heading > code { font-size: 0.875rem; }
    .evolution-layout { flex-direction: column; }
    .version-list { width: 100%; padding: 14px 15px; border-right: 0; border-bottom: 1px solid var(--border); display: flex; gap: 8px; overflow-x: auto; }
    .version-list-title { display: none; }
    .version-card { min-width: 145px; width: auto; border: 1px solid var(--border); border-radius: 4px; margin-left: 0; padding: 11px 13px; }
    .version-card.active { border-color: var(--border); border-radius: 4px; }
    .version-timeline-dot { display: none; }
    .version-card-top { gap: 15px; }
    .evolution-main { min-height: 540px; }
    .evolution-summary { padding: 17px; }
    .graph-canvas.compact { height: 420px; }
    .graph-canvas.compact .graph-svg { min-height: 0; }
    .change-list { padding: 18px; max-height: none; }
    .change-reason { width: 100%; margin: 0; line-height: 1.8; }
    .empty-state { min-height: 65dvh; }
    .empty-state h2 { font-size: 1.375rem; }
    .empty-state p { font-size: 0.9375rem; }
    .modal-backdrop { padding: 15px; }
    .modal { max-height: calc(100dvh - 30px); }
    .modal-body { padding: 20px; }
    .modal .button { font-size: .875em; }
    .modal-heading, .modal-footer { padding-left: 20px; padding-right: 20px; }
    .toast { font-size: 0.875rem; padding: 10px 13px; }
    .task-menu-button { opacity: 1; }
  }
  @media (prefers-reduced-motion: reduce){
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .spinner { animation-duration: 2s !important; }
  }
}

@layer tools {
  .graph-heading { position: absolute; top: 16px; left: 20px; z-index: 3; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
  .graph-heading h3 { margin: 0; color: var(--text); font-size: 1.25rem; font-weight: 700; line-height: 1.4; }
  .graph-heading .edge-filters { margin: 0; }
  .graph-heading .edge-filter { font-size: .875rem; }
}
