:root {
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  font-synthesis: none;
  --theme-bg: #f5f6f7;
  --theme-surface: #fff;
  --theme-panel: #f0f2f5;
  --theme-text: #303b45;
  --theme-muted: #687582;
  --theme-border: #dce1e6;
  --theme-accent: #506f91;
  --theme-selected: #e5edf5;
  color: var(--theme-text);
  background: var(--theme-bg);
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--theme-text);
  background: var(--theme-bg);
}
button,
input,
textarea,
select {
  font: inherit;
}
[hidden] {
  display: none !important;
}
button:disabled {
  cursor: not-allowed;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}
button {
  cursor: pointer;
}
.host-bar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--theme-border);
  background: var(--theme-surface);
}
.host-bar > div {
  display: flex;
  gap: 18px;
  align-items: center;
}
#connection {
  font-size: 11px;
  color: var(--theme-muted);
}
#manage-plugins {
  border: 1px solid var(--theme-border);
  background: var(--theme-panel);
  color: var(--theme-text);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
}
#manage-plugins:hover {
  background: var(--theme-selected);
}
#app-placeholder {
  margin: 100px auto;
  padding: 32px;
  max-width: 580px;
  text-align: center;
  font-size: 15px;
  line-height: 2;
  color: var(--theme-muted);
}
dialog {
  color: var(--theme-text);
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 13px;
  box-shadow: 0 24px 90px #0003;
  margin: auto;
}
dialog::backdrop {
  background: #16202066;
  backdrop-filter: blur(4px);
}
#plugin-manager {
  width: min(1060px, 94vw);
  max-height: 90dvh;
  padding: 28px;
  overflow: auto;
}
#plugin-manager .manager-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
}
#plugin-manager .manager-header h2 {
  font-size: 25px;
  margin: 6px 0;
  font-weight: 600;
}
#plugin-manager .manager-header p {
  font-size: 12px;
  color: var(--theme-muted);
  margin-bottom: 18px;
}
#plugin-manager .manager-header button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--theme-muted);
}
#plugin-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 0;
}
.plugin-card {
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
  background: var(--theme-surface);
}
.plugin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.plugin-heading strong {
  font-size: 15px;
  font-weight: 600;
}
.plugin-status {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 4px;
  color: var(--theme-muted);
  background: var(--theme-panel);
  white-space: nowrap;
}
.plugin-status.enabled {
  background: var(--theme-selected);
  color: var(--theme-accent);
}
.plugin-status.failed,
.plugin-error {
  color: #bb5145;
}
.plugin-status.waiting {
  color: #a77730;
}
.plugin-card p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--theme-muted);
  margin: 12px 0;
}
.plugin-card small {
  display: block;
  color: var(--theme-muted);
  font-size: 11px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}
.plugin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.plugin-actions button,
.dependency-controls button,
.manager-view-switch button,
.dependency-chips button {
  font-size: 12px;
  border: 1px solid var(--theme-border);
  border-radius: 5px;
  padding: 7px 10px;
  color: var(--theme-text);
  background: var(--theme-panel);
}
.plugin-actions button:hover {
  background: var(--theme-selected);
}
.plugin-actions button:disabled {
  opacity: 0.45;
}
.plugin-card pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 11px;
  max-height: 180px;
  overflow: auto;
}
.plugin-card summary {
  font-size: 12px;
  margin-top: 12px;
  cursor: pointer;
}
.manager-footer {
  font-size: 11px;
  color: var(--theme-muted);
  line-height: 1.8;
}
.theme-group {
  font-size: 12px;
  margin-top: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.theme-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.manager-viewbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
}
.manager-viewbar > span {
  font-size: 12px;
  color: var(--theme-muted);
}
.manager-view-switch {
  display: flex;
  gap: 4px;
}
.manager-view-switch button[aria-pressed='true'] {
  background: var(--theme-selected);
}
#dependency-view,
#react-dependency-view {
  padding: 15px 0;
}
#plugin-manager:has(#dependency-view:not([hidden])),
#plugin-manager:has([role='tabpanel'][data-state='active'] #react-dependency-view) {
  width: min(1440px, 96vw);
}
.dependency-controls {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}
.dependency-controls p {
  font-size: 12px;
  max-width: 480px;
  color: var(--theme-muted);
  line-height: 1.8;
}
.dependency-controls > div {
  display: flex;
  align-items: start;
  gap: 6px;
  flex-shrink: 0;
}
.dependency-legend {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--theme-muted);
  margin-bottom: 15px;
}
.dependency-legend > span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dependency-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 300px);
  gap: 20px;
  align-items: start;
}
.dependency-network {
  min-width: 0;
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--theme-bg);
}
.dependency-network-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 4px;
  font-size: 13px;
}
.dependency-network-heading > span { font-size: 11px; color: var(--theme-muted); }
.dependency-direction { padding: 0 18px; margin: 4px 0 10px; font-size: 11px; color: var(--theme-muted); }
.dependency-network-tools { display: flex; align-items: center; gap: 6px; padding: 0 14px 12px; flex-wrap: wrap; }
.dependency-network-tools button {
  border: 1px solid var(--theme-border); border-radius: 6px; padding: 5px 9px;
  color: var(--theme-text); background: var(--theme-panel); font-size: 11px;
}
.dependency-network-tools button:disabled { opacity: .4; }
.dependency-network-tools output { width: 42px; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--theme-muted); }
.dependency-viewport {
  position: relative; height: clamp(380px, 57vh, 640px); min-height: 300px; overflow: hidden;
  border-top: 1px solid var(--theme-border); border-bottom: 1px solid var(--theme-border);
  background-color: var(--theme-panel);
  background-image: radial-gradient(circle, var(--theme-border) 1px, transparent 1px);
  background-size: 20px 20px;
  cursor: grab; touch-action: none; user-select: none; overscroll-behavior: contain;
}
.dependency-viewport.panning { cursor: grabbing; }
.dependency-scene { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.dependency-lines { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.dependency-edge { outline: none; cursor: pointer; }
.dependency-edge-line { fill: none; stroke: var(--theme-muted); stroke-width: 1.2; pointer-events: none; vector-effect: non-scaling-stroke; }
.dependency-edge-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; }
.dependency-edge.candidate .dependency-edge-line { stroke-dasharray: 5 4; }
.dependency-edge.cycle .dependency-edge-line { stroke: #bb8436; }
.dependency-edge.active .dependency-edge-line,
.dependency-edge:hover .dependency-edge-line,
.dependency-edge:focus-visible .dependency-edge-line { stroke: var(--theme-accent); stroke-width: 2.5; }
.dependency-edge.chosen .dependency-edge-line { stroke-width: 3.5; }
.dependency-edge.dimmed { opacity: .13; }
.dependency-node {
  position: absolute; display: block; text-align: left; border: 1px solid var(--theme-border);
  border-radius: 9px; color: var(--theme-text); background: var(--theme-bg);
  box-shadow: 0 2px 6px #00000009; cursor: pointer; padding: 0;
}
.dependency-node .dependency-dot { position: absolute; left: 12px; top: 16px; }
.dependency-node .dependency-name {
  position: absolute; left: 25px; top: 10px; right: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 600;
}
.dependency-id { position: absolute; left: 12px; top: 38px; max-width: 108px; font-size: 10px; color: var(--theme-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dependency-node-hint { position: absolute; right: 10px; top: 38px; font-size: 10px; color: var(--theme-muted); }
.dependency-port { position: absolute; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--theme-muted); background: var(--theme-bg); top: calc(50% - 3.5px); }
.dependency-port.input { left: -4px; }
.dependency-port.output { right: -4px; }
.dependency-node:hover, .dependency-node.related { border-color: var(--theme-accent); }
.dependency-node[aria-pressed='true'] { border-color: var(--theme-accent); background: var(--theme-selected); box-shadow: 0 0 0 2px var(--theme-accent); }
.dependency-node[aria-pressed='true'] .dependency-port { background: var(--theme-accent); border-color: var(--theme-accent); }
.dependency-node.dimmed { opacity: .3; }
.dependency-node.cycle .dependency-node-hint { color: #bb8436; }
.dependency-node:focus-visible, .dependency-viewport:focus-visible { outline: 2px solid var(--theme-accent); outline-offset: -2px; }
.dependency-network-help { font-size: 10px; line-height: 1.8; padding: 10px 14px; margin: 0; color: var(--theme-muted); }
.dependency-empty { padding: 40px; text-align: center; font-size: 13px; color: var(--theme-muted); }
.dependency-cycle-notice { padding: 0 14px 12px; margin: 0; font-size: 11px; color: #bb8436; }
.dependency-search { position: relative; width: min(360px, 100%); }
.dependency-controls .dependency-search { display: block; flex-shrink: 1; }
.dependency-search input { box-sizing: border-box; width: 100%; border: 1px solid var(--theme-border); border-radius: 7px; background: var(--theme-bg); color: var(--theme-text); font: inherit; font-size: 12px; padding: 9px 12px; }
.dependency-search-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow: auto; z-index: 3; border: 1px solid var(--theme-border); border-radius: 8px; box-shadow: 0 8px 25px #0002; background: var(--theme-bg); padding: 5px; }
.dependency-search-results button { width: 100%; text-align: left; border: 0; background: transparent; }
.dependency-search-results button:hover, .dependency-search-results button:focus-visible { background: var(--theme-selected); }
.dependency-search-results p { padding: 8px; }
.dependency-legend { flex-wrap: wrap; }
.dependency-edge-legend::before { content: ''; width: 18px; border-top: 1px solid var(--theme-muted); }
.dependency-edge-legend.candidate::before { border-top-style: dashed; }
.dependency-detail { max-height: 690px; overflow: auto; min-width: 0; scrollbar-width: thin; }
.dependency-welcome { border: 1px solid var(--theme-border); border-radius: 12px; padding: 28px 22px; }
.dependency-welcome-symbol { display: inline-block; color: var(--theme-accent); font-size: 28px; margin-bottom: 12px; }
.dependency-welcome h3 { font-size: 15px; margin: 0 0 12px; }
.dependency-welcome p { font-size: 12px; line-height: 1.9; color: var(--theme-muted); }
.dependency-edge-detail { padding: 14px; margin-bottom: 14px; border: 1px solid var(--theme-accent); border-radius: 8px; background: var(--theme-selected); }
.dependency-edge-detail h3 { font-size: 13px; margin: 0 0 8px; }
.dependency-edge-detail p { font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.dependency-dot,
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--theme-muted);
  display: inline-block;
  flex-shrink: 0;
}
.dependency-dot.enabled,
.status-dot.enabled {
  background: var(--theme-accent);
}
.dependency-dot.failed,
.status-dot.failed {
  background: #c85b50;
}
.dependency-dot.waiting,
.status-dot.waiting {
  background: #c19b40;
}
.dependency-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dependency-relations {
  padding-top: 16px;
}
.dependency-relations h3 {
  font-size: 12px;
  margin-bottom: 8px;
}
.dependency-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
}
.dependency-impact {
  background: var(--theme-panel);
  padding: 14px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.9;
  margin-top: 16px;
  color: var(--theme-muted);
}
#plugin-settings {
  width: min(540px, 94vw);
  max-height: 88dvh;
  overflow: auto;
  padding: 28px;
}
#plugin-settings h2 {
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 12px;
}
#plugin-settings p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--theme-muted);
}
.settings-fields {
  display: grid;
  gap: 22px;
  margin: 24px 0;
}
.settings-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 9px;
  font-size: 14px;
}
.settings-field small {
  grid-column: 1/-1;
  color: var(--theme-muted);
  line-height: 1.7;
  font-size: 12px;
}
.settings-field input:not([type='checkbox']),
.settings-field select {
  max-width: 180px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  background: var(--theme-panel);
  color: var(--theme-text);
}
.settings-field input[type='checkbox'] {
  width: 19px;
  height: 19px;
  accent-color: var(--theme-accent);
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.settings-actions button {
  padding: 9px 12px;
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  background: var(--theme-panel);
  font-size: 13px;
  color: var(--theme-text);
}
.settings-actions button[type='submit'] {
  background: var(--theme-accent);
  color: #fff;
}
.settings-message {
  min-height: 24px;
  margin: 14px 0;
}
.settings-actions button:disabled {
  opacity: 0.45;
}
#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 110;
  background: var(--theme-text);
  color: var(--theme-surface);
  padding: 12px 18px;
  border-radius: 8px;
  max-width: 90vw;
  font-size: 13px;
  box-shadow: 0 5px 24px #0002;
}
#plugin-manager > #toast {
  position: sticky;
  left: auto;
  transform: none;
  max-width: none;
  margin-top: 12px;
}
#plugin-manager.enhanced {
  padding: 0;
}
#plugin-manager.enhanced > :not(.manager-react):not(#toast) {
  display: none !important;
}
@media (max-width: 760px) {
.dependency-columns {
    grid-template-columns: 1fr;
  }
.dependency-controls {
    flex-direction: column;
  }
.dependency-viewport {
    height: 380px;
  }
}
@media (max-width: 620px) {
.host-bar {
    padding: 0 16px;
  }
#connection {
    display: none;
  }
#plugin-manager {
    width: 96vw;
    max-height: 94dvh;
    padding: 20px;
  }
  #plugin-list {
    grid-template-columns: 1fr;
  }
  .settings-field {
    grid-template-columns: 1fr;
  }
.settings-field input:not([type='checkbox']),
.settings-field select {
    max-width: none;
  }
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

#application-picker { width: min(780px, 94vw); max-height: 90dvh; padding: 28px; overflow: auto; }
#application-picker .manager-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
#application-picker h2 { margin: 0; }
#application-picker .manager-header p { color: var(--theme-muted); margin-bottom: 0; }
#close-applications { border: 0; background: transparent; color: var(--theme-text); font-size: 22px; cursor: pointer; padding: 0 4px; }
#application-picker .manager-footer { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--theme-border); }
#application-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 24px; }
.application-recovery { grid-column: 1 / -1; padding: 16px 18px; border: 1px solid #d7b46a; border-radius: 12px; background: #fff8e7; }
.application-recovery strong { display: block; margin-bottom: 6px; }
.application-recovery p { margin: 0 0 12px; color: #72551d; line-height: 1.65; overflow-wrap: anywhere; }
.application-recovery button { border: 1px solid #aa7b16; border-radius: 6px; padding: 7px 12px; background: #9a6f16; color: white; }
.application-card { border: 1px solid var(--theme-border); border-radius: 12px; padding: 20px; }
.application-title { display: flex; align-items: center; gap: 10px; }
.application-title h3 { margin: 0; }
.application-card p { color: var(--theme-muted); line-height: 1.7; }
.application-card button, #manage-applications, #stop-application { border: 1px solid var(--theme-border); background: var(--theme-panel); color: var(--theme-text); border-radius: 6px; padding: 7px 12px; }
#application-error { color: #ad4538; white-space: pre-wrap; }
#current-application { font-weight: 600; }
