﻿:root {
      --bg: #f4f6fa;
      --page: #ffffff;
      --panel: #ffffff;
      --soft: #f8fafd;
      --soft-2: #eef3fa;
      --ink: #111827;
      --muted: #64748b;
      --line: #dce3ee;
      --blue: #145ee8;
      --blue-2: #eaf1ff;
      --green: #129174;
      --green-2: #e8f6f1;
      --orange: #bd6b00;
      --orange-2: #fff4df;
      --red: #cf2e2e;
      --red-2: #fff0f0;
      --shadow: 0 8px 24px rgba(15, 23, 42, .08);
    }

    body.dark {
      --bg: #0f172a;
      --page: #1e293b;
      --panel: #1e293b;
      --soft: #111827;
      --soft-2: #263449;
      --ink: #f8fafc;
      --muted: #cbd5e1;
      --line: #41516a;
      --blue: #7db2ff;
      --blue-2: #17365f;
      --green: #6ee7c8;
      --green-2: #123f35;
      --orange: #ffd58a;
      --orange-2: #4a3214;
      --red: #ff9d9d;
      --red-2: #4a1f1f;
      --shadow: 0 10px 28px rgba(0, 0, 0, .36);
    }

    * { box-sizing: border-box; }
    body {
      margin: 0;
      min-height: 100vh;
      background: var(--bg);
      color: var(--ink);
      font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
      font-size: 14px;
    }
    button, input, select, textarea { font: inherit; }
    button { cursor: pointer; }

    .shell {
      min-height: 100vh;
      display: grid;
      grid-template-columns: 132px minmax(0, 1fr);
    }

    .side {
      background: #f0f3f8;
      border-right: 1px solid var(--line);
      padding: 12px 6px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    body.dark .side { background: #111a2b; }
    body.dark .logo { color: #dbe8ff; }
    body.dark .logo i { background: #6aa4ff; color: #0b1220; }
    .logo {
      height: 42px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      font-weight: 800;
      color: #0f2f5f;
    }
    .logo i {
      width: 22px;
      height: 22px;
      border-radius: 6px;
      display: grid;
      place-items: center;
      background: #0f2f5f;
      color: #fff;
      font-style: normal;
      font-size: 12px;
    }
    .nav { display: grid; gap: 6px; }
    .nav button {
      border: 0;
      background: transparent;
      color: #1f2937;
      padding: 10px 8px;
      border-radius: 7px;
      text-align: left;
      display: flex;
      align-items: center;
      gap: 8px;
      min-height: 38px;
    }
    body.dark .nav button { color: #d5deeb; }
    body.dark .nav button.active,
    body.dark .module-tabs button.active {
      background: #263449;
      color: #dbeafe;
      border-color: #53657f;
    }
    body.dark .top,
    body.dark .chat-title,
    body.dark .composer {
      background: #1e293b;
    }
    .nav button.active {
      background: var(--page);
      color: var(--blue);
      font-weight: 700;
      box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
    }

    .main {
      display: grid;
      grid-template-rows: 52px 1fr;
      min-width: 0;
    }
    .top {
      background: var(--page);
      border-bottom: 1px solid var(--line);
      display: grid;
      grid-template-columns: 1fr auto;
      align-items: center;
      gap: 16px;
      padding: 0 14px;
    }
    .module-tabs {
      display: flex;
      justify-content: center;
      gap: 10px;
      min-width: 0;
    }
    .module-tabs button {
      border: 1px solid transparent;
      background: transparent;
      color: var(--muted);
      border-radius: 7px;
      padding: 7px 18px;
      min-width: 92px;
    }
    .module-tabs button.active {
      background: var(--page);
      border-color: var(--line);
      color: var(--blue);
      box-shadow: 0 3px 10px rgba(15, 23, 42, .06);
      font-weight: 700;
    }
    .top-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--muted);
      white-space: nowrap;
    }

    .role-select {
      border: 1px solid var(--line);
      background: #fff;
      border-radius: 7px;
      padding: 7px 10px;
      color: var(--ink);
    }
    .avatar {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: var(--blue-2);
      color: var(--blue);
      display: grid;
      place-items: center;
      font-weight: 700;
    }

    .content {
      padding: 14px;
      min-width: 0;
    }
    .view { display: none; }
    .view.active { display: block; }
    .view-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 12px;
    }
    h1, h2, h3, p { margin-top: 0; }
    h1 { font-size: 20px; margin-bottom: 4px; }
    h2 { font-size: 15px; margin-bottom: 10px; }
    h3 { font-size: 13px; margin-bottom: 8px; }
    .hint { color: var(--muted); line-height: 1.6; margin: 0; }

    .btn {
      border: 1px solid var(--line);
      background: #fff;
      border-radius: 7px;
      color: var(--ink);
      padding: 8px 12px;
      min-height: 34px;
    }
    .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
    .btn.dark { background: #111827; border-color: #111827; color: #fff; }
    .btn.ghost { background: transparent; }
    .btn.danger { color: var(--red); }
    body.dark .btn {
      background: #263449;
      color: #f8fafc;
      border-color: #53657f;
    }
    body.dark .btn.primary {
      background: #3b82f6;
      border-color: #60a5fa;
      color: #ffffff;
    }
    body.dark .btn.ghost {
      background: #1e293b;
      color: #e2e8f0;
    }
    .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

    .panel {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 14px;
      box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
    }
    .assistant-layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 342px;
      gap: 12px;
      height: calc(100vh - 80px);
      min-height: 620px;
    }

    .chat-panel {
      display: grid;
      grid-template-rows: auto 1fr auto;
      min-height: 0;
      padding: 0;
      overflow: hidden;
    }
    .chat-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 14px 16px;
      border-bottom: 1px solid var(--line);
      background: #fff;
    }
    .conversation {
      min-height: 0;
      overflow: auto;
      background: #fbfcfe;
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    body.dark .conversation {
      background: #111827;
    }
    .msg {
      max-width: 82%;
      padding: 11px 13px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: #fff;
      line-height: 1.65;
    }
    body.dark .msg {
      background: #253247;
      color: #f8fafc;
      border-color: #53657f;
    }
    .msg.user {
      margin-left: auto;
      background: var(--green-2);
      border-color: #bfe7dc;
    }
    body.dark .msg.user {
      background: #0f4b3f;
      color: #f8fafc;
      border-color: #2dd4bf;
    }
    .msg.system {
      align-self: center;
      max-width: 90%;
      background: var(--soft-2);
      color: var(--muted);
      font-size: 12px;
    }
    .refs {
      margin-top: 8px;
      color: var(--muted);
      font-size: 12px;
    }
    .composer {
      border-top: 1px solid var(--line);
      padding: 12px;
      background: #fff;
      display: grid;
      gap: 10px;
    }
    .quick {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }
    .chat-input {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 8px;
      align-items: end;
    }
    textarea {
      border: 1px solid var(--line);
      border-radius: 7px;
      min-height: 46px;
      resize: vertical;
      padding: 10px;
      outline: none;
      color: var(--ink);
    }

    .capability-panel {
      display: grid;
      grid-template-rows: auto auto 1fr;
      min-height: 0;
      gap: 12px;
    }
    .cap-tabs {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 6px;
      background: var(--soft);
      padding: 4px;
      border-radius: 8px;
      border: 1px solid var(--line);
    }
    .cap-tabs button {
      border: 0;
      border-radius: 6px;
      background: transparent;
      padding: 7px;
      color: var(--muted);
    }
    .cap-tabs button.active { background: #fff; color: var(--blue); font-weight: 700; box-shadow: 0 1px 5px rgba(15,23,42,.07); }
    .cap-section { display: none; min-height: 0; overflow: auto; }
    .cap-section.active { display: block; }
    .cap-list {
      display: grid;
      gap: 8px;
    }
    .cap-item {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 11px;
      background: #fff;
      display: grid;
      gap: 8px;
    }
    body.dark .cap-item,
    body.dark .step {
      background: #253247;
      border-color: #53657f;
    }
    .cap-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .toggle {
      position: relative;
      width: 38px;
      height: 22px;
      border: 0;
      border-radius: 999px;
      background: #ccd5e1;
      padding: 0;
    }
    .toggle:before {
      content: "";
      position: absolute;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: #fff;
      left: 2px;
      top: 2px;
      transition: .18s;
      box-shadow: 0 1px 4px rgba(15,23,42,.18);
    }
    .toggle.on { background: var(--blue); }
    .toggle.on:before { transform: translateX(16px); }

    .tag {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 999px;
      padding: 3px 8px;
      font-size: 12px;
      color: var(--muted);
      background: #f1f4f8;
      border: 1px solid #e1e7f0;
      white-space: nowrap;
    }
    .tag.ok { color: var(--green); background: var(--green-2); border-color: #bfe7dc; }
    .tag.warn { color: var(--orange); background: var(--orange-2); border-color: #f1d49c; }
    .tag.blue { color: var(--blue); background: var(--blue-2); border-color: #c9dafb; }
    .tag.bad { color: var(--red); background: var(--red-2); border-color: #ffd0d0; }

    .field {
      border: 1px solid var(--line);
      border-radius: 7px;
      padding: 8px 10px;
      outline: none;
      background: #fff;
      color: var(--ink);
      min-height: 34px;
    }
    body.dark .field,
    body.dark textarea,
    body.dark select,
    body.dark input {
      background: #111a2b;
      color: var(--ink);
      border-color: var(--line);
    }
    .field.full { width: 100%; }
    .mini-form {
      display: grid;
      gap: 8px;
    }
    .form-row {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 8px;
      align-items: center;
    }
    .stack { display: grid; gap: 12px; align-content: start; }
    .search-shell { width: min(980px, 100%); margin: 0 auto; display: grid; gap: 12px; }
    .search-hero { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
    .search-results { display: grid; gap: 10px; }
    .search-result { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 7px; }
    .search-result:first-child { border-top: 0; padding-top: 0; }
    .search-result h3 { font-size: 14px; margin: 0; }
    .result-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
    .ops-data-layout { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 12px; align-items: start; }
    .model-role-list, .segment-list { display: grid; gap: 8px; }
    .model-role-item, .segment-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--panel); display: grid; gap: 5px; }
    .model-role-item strong, .segment-item strong { font-size: 13px; }
    .annotation-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr) 310px; gap: 12px; align-items: start; }
    .segment-item { cursor: pointer; }
    .segment-item.active { border-color: var(--blue); background: var(--blue-2); }
    .editor-panel label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
    .editor-textarea { min-height: 230px; font-size: 14px; line-height: 1.8; }
    .equal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .check-row { display: flex !important; grid-template-columns: none !important; flex-direction: row; align-items: center; gap: 8px !important; margin-top: 14px; }
    .check-row input { width: 16px; height: 16px; }
    .config-form { display: grid; gap: 10px; }
    .config-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
    .code-field { font-family: Consolas, monospace; font-size: 12px; }

    .grid-2 {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 360px;
      gap: 12px;
      align-items: start;
    }
    .grid-2.equal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
    }
    table {
      width: 100%;
      border-collapse: collapse;
      table-layout: fixed;
      font-size: 13px;
    }
    th, td {
      border-bottom: 1px solid var(--line);
      padding: 10px;
      text-align: left;
      vertical-align: middle;
      word-break: break-word;
    }
    th { color: #475569; font-weight: 700; background: #fbfcfe; }
    body.dark th { color: #b8c6d8; background: #111a2b; }
    body.dark td { color: #f1f5f9; }
    tr.clickable { cursor: pointer; }
    tr.clickable:hover td { background: #f7fbff; }
    body.dark tr.clickable:hover td { background: #263449; }
    .metric {
      padding: 14px;
      background: #fff;
      border: 1px solid var(--line);
      border-radius: 8px;
    }
    body.dark .metric,
    body.dark .modal {
      background: #1e293b;
      border-color: #53657f;
      color: #f8fafc;
    }
    .metric span { color: var(--muted); font-size: 12px; }
    .metric strong { display: block; font-size: 24px; margin: 7px 0; }
    .progress {
      height: 8px;
      border-radius: 999px;
      background: #e8edf5;
      overflow: hidden;
    }
    .progress i { display: block; width: var(--v); height: 100%; background: var(--blue); }
    .detail {
      display: grid;
      gap: 10px;
      margin: 0;
    }
    .detail div { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }
    .detail dt { color: var(--muted); }
    .detail dd { margin: 0; line-height: 1.55; }
    .trace {
      display: grid;
      gap: 9px;
    }
    .step {
      display: grid;
      grid-template-columns: 22px 1fr auto;
      gap: 10px;
      align-items: center;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px;
      background: #fff;
    }
    .dot {
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: #cbd5e1;
    }
    .step.done .dot { background: var(--green); }
    .step.running .dot { background: var(--blue); box-shadow: 0 0 0 5px rgba(20,94,232,.12); }
    .compact-head { margin: -2px 0 12px; }
    .compact-head h2 { margin: 0 0 4px; }
    .policy-list { display: grid; gap: 8px; margin-top: 12px; }
    .policy-list > div { display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding-top: 9px; }
    .live-status { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 12px; font-weight: 700; }
    .live-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(24,167,122,.35); animation: livePulse 1.8s infinite; }
    .image-metric { position: relative; overflow: hidden; animation: metricEnter .42s both; }
    .image-metric:nth-child(2) { animation-delay: .08s; }
    .image-metric:nth-child(3) { animation-delay: .16s; }
    .image-metric::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--blue); }
    .image-metric.risk-metric::before { background: var(--orange); }
    .image-metric.success-metric::before { background: var(--green); }
    .metric-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
    .trend { font-size: 11px; padding: 3px 6px; border-radius: 999px; font-weight: 700; }
    .trend.up { color: var(--green); background: var(--green-2); }
    .trend.down { color: var(--blue); background: var(--blue-2); }
    .image-dashboard { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .8fr); gap: 28px; align-items: center; }
    .trend-chart { height: 180px; display: grid; grid-template-columns: repeat(7, minmax(26px, 1fr)); gap: 12px; align-items: end; padding: 14px 4px 24px; border-bottom: 1px solid var(--line); position: relative; }
    .trend-column { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; position: relative; }
    .trend-column strong { font-size: 11px; color: var(--muted); }
    .trend-bar { width: min(34px, 70%); height: var(--h); min-height: 20px; border-radius: 5px 5px 2px 2px; background: var(--blue); transform-origin: bottom; animation: barRise .7s cubic-bezier(.2,.75,.25,1) both; animation-delay: var(--delay); }
    .trend-bar::after { content: ""; display: block; width: 100%; height: var(--risk); background: var(--orange); border-radius: 5px 5px 0 0; opacity: .9; }
    .trend-column span { position: absolute; bottom: -22px; font-size: 11px; color: var(--muted); }
    .ring-wrap { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 14px; }
    .bar-chart { display: grid; gap: 11px; }
    .bar-row { display: grid; grid-template-columns: 112px 1fr 52px; gap: 8px; align-items: center; font-size: 12px; }
    .bar-track { height: 10px; background: #e8edf5; border-radius: 999px; overflow: hidden; }
    .bar-track i { display: block; height: 100%; background: var(--blue); border-radius: 999px; transform-origin: left; animation: barGrow .65s ease-out both; }
    .bar-row:nth-child(2) .bar-track i { background: #18a77a; }
    .bar-row:nth-child(3) .bar-track i { background: #f59e0b; }
    .bar-row:nth-child(4) .bar-track i { background: #8b5cf6; }
    .image-ring { width: 150px; height: 150px; border-radius: 50%; margin: 0 auto; background: conic-gradient(#145ee8 0 25.5%, #18a77a 25.5% 48.1%, #f59e0b 48.1% 61.5%, #8b5cf6 61.5% 100%); display: grid; place-items: center; animation: ringEnter .7s cubic-bezier(.2,.75,.25,1) both; }
    .image-ring::after { content: "多模态\A 资产分布"; white-space: pre; text-align: center; width: 94px; height: 94px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; color: var(--ink); font-weight: 700; font-size: 12px; }
    .ring-legend { display: grid; gap: 9px; font-size: 11px; color: var(--muted); }
    .ring-legend span { display: flex; align-items: center; gap: 7px; }
    .ring-legend i { width: 8px; height: 8px; border-radius: 50%; }
    .blue-dot { background: #145ee8; } .green-dot { background: #18a77a; } .orange-dot { background: #f59e0b; } .purple-dot { background: #8b5cf6; }
    @keyframes livePulse { 70% { box-shadow: 0 0 0 7px rgba(24,167,122,0); } 100% { box-shadow: 0 0 0 0 rgba(24,167,122,0); } }
    @keyframes metricEnter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes barRise { from { transform: scaleY(0); opacity: .2; } to { transform: scaleY(1); opacity: 1; } }
    @keyframes barGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
    @keyframes ringEnter { from { opacity: 0; transform: scale(.82) rotate(-16deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
    @media (prefers-reduced-motion: reduce) {
      .live-status i, .image-metric, .trend-bar, .bar-track i, .image-ring { animation: none; }
    }
    .image-samples { display: grid; gap: 9px; }
    .sample-card { display: grid; grid-template-columns: 60px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--panel); }
    .sample-thumb { height: 52px; border-radius: 6px; background: #dbeafe; border: 1px solid #bfdbfe; display: grid; place-items: center; color: var(--blue); font-size: 11px; font-weight: 700; }
    .sample-card:nth-child(2) .sample-thumb { background: #dcfce7; border-color: #bbf7d0; color: var(--green); }
    .sample-card:nth-child(3) .sample-thumb { background: #fef3c7; border-color: #fde68a; color: var(--orange); }
    .sample-card strong { display: block; font-size: 12px; margin-bottom: 3px; }
    .sample-card .hint { display: block; font-size: 11px; }
    body.dark .bar-track { background: #334155; }
    body.dark .image-ring::after { background: #1e293b; }
    body.dark .sample-thumb { background: #1e3a5f; border-color: #3b82f6; }
    body.dark .sample-card:nth-child(2) .sample-thumb { background: #164e3b; border-color: #2dd4bf; }
    body.dark .sample-card:nth-child(3) .sample-thumb { background: #5b4512; border-color: #f59e0b; }

    .modal-mask {
      position: fixed;
      inset: 0;
      background: rgba(17,24,39,.48);
      display: none;
      place-items: center;
      z-index: 40;
      padding: 18px;
    }
    .modal-mask.open { display: grid; }
    .modal {
      width: min(720px, 96vw);
      max-height: 90vh;
      overflow: auto;
      background: #fff;
      border-radius: 9px;
      border: 1px solid var(--line);
      box-shadow: var(--shadow);
      padding: 18px;
    }
    .modal-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 12px;
    }
    .modal form { display: grid; gap: 10px; }
    label { color: var(--muted); font-size: 12px; display: grid; gap: 6px; }

    .toast {
      position: fixed;
      right: 20px;
      bottom: 20px;
      background: #111827;
      color: #fff;
      padding: 11px 14px;
      border-radius: 8px;
      box-shadow: var(--shadow);
      display: none;
      z-index: 50;
    }
    .toast.show { display: block; }

    @media (max-width: 1180px) {
      .assistant-layout { grid-template-columns: 1fr; height: auto; }
      .capability-panel { grid-template-rows: auto auto; }
      .grid-2, .grid-3 { grid-template-columns: 1fr; }
      .image-dashboard { grid-template-columns: 1fr; }
      .ring-wrap { grid-template-columns: 150px 1fr; }
      .policy-list > div { grid-template-columns: 1fr; gap: 4px; }
      .ops-data-layout, .annotation-layout { grid-template-columns: 1fr; }
    }
    @media (max-width: 760px) {
      .shell { grid-template-columns: 1fr; }
      .side { position: sticky; top: 0; z-index: 20; }
      .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .top { grid-template-columns: 1fr; height: auto; padding: 10px; }
      .module-tabs { justify-content: flex-start; overflow: auto; }
      .assistant-layout { grid-template-columns: 1fr; min-height: 0; }
      .msg { max-width: 96%; }
    }
