:root {
  --agent-blue: #7dd3fc;
  --agent-blue-soft: rgba(125, 211, 252, 0.12);
  --agent-ink: #08090b;
  --agent-panel: rgba(10, 11, 14, 0.985);
  --agent-surface: #121317;
  --agent-surface-raised: #191a1f;
  --agent-line: rgba(255, 255, 255, 0.09);
  --agent-muted: rgba(244, 244, 245, 0.5);
  --agent-text: #f4f4f5;
}

.agent-side-tab svg {
  width: 24px;
  height: 24px;
  color: var(--agent-blue);
  filter: drop-shadow(0 0 8px rgba(118, 182, 210, 0.2));
}

.agent-side-page.is-active {
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.agent-workbench,
.agent-panel,
.agent-panel-body,
.agent-chat-view,
.agent-history-view,
.agent-skills-view {
  min-height: 0;
}

.agent-workbench,
.agent-panel {
  height: 100%;
}

.agent-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  color: var(--agent-text);
  background: var(--agent-panel);
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 12px;
}

.agent-panel button,
.agent-panel select,
.agent-panel input,
.agent-panel textarea {
  border: 1px solid var(--agent-line);
  color: inherit;
  background: var(--agent-surface);
}

.agent-panel button {
  cursor: pointer;
}

.agent-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.agent-panel button:focus-visible,
.agent-panel select:focus-visible,
.agent-panel input:focus-visible,
.agent-panel textarea:focus-visible {
  outline: 2px solid rgba(125, 211, 252, 0.58);
  outline-offset: 2px;
}

.agent-panel-head {
  min-height: 52px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--agent-line);
  user-select: none;
}

.agent-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.agent-title > i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--agent-blue);
  box-shadow: 0 0 14px rgba(125, 211, 252, 0.7);
}

.agent-title div {
  min-width: 0;
  display: grid;
}

.agent-title span,
.agent-section-heading span {
  color: rgba(244, 244, 245, 0.42);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.agent-title strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.agent-window-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.agent-window-actions button {
  min-width: 30px;
  min-height: 30px;
  padding: 0 8px;
  border-color: transparent;
  border-radius: 5px;
  color: rgba(244, 244, 245, 0.62);
  background: transparent;
  font-size: 11px;
}

.agent-window-actions button:hover {
  color: white;
  background: rgba(255, 255, 255, 0.07);
}

.agent-model-line {
  min-height: 44px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--agent-line);
  background: #0d0e11;
}

.agent-model-line label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.agent-model-line label > span {
  color: var(--agent-muted);
  font-size: 10px;
}

.agent-model-line select {
  min-width: 0;
  max-width: 158px;
  height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 11px;
  text-overflow: ellipsis;
}

.agent-live-status {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: var(--agent-muted);
  font-size: 10px;
}

.agent-live-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--agent-blue);
}

.agent-live-status i[data-kind="busy"] { animation: agentPulse 0.7s ease-in-out infinite alternate; }
.agent-live-status i[data-kind="error"] { background: #f26f73; box-shadow: 0 0 9px rgba(242, 111, 115, 0.7); }
.agent-live-status span { max-width: 142px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-live-status b { padding: 2px 5px; border: 1px solid rgba(242, 178, 111, 0.25); border-radius: 4px; color: #e9b981; font-size: 9px; }

.agent-panel-body {
  overflow: hidden;
}

.agent-history-view,
.agent-skills-view,
.agent-chat-view {
  height: 100%;
  display: grid;
}

.agent-history-view {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 16px 12px 12px;
}

.agent-skills-view {
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 10px;
  padding: 16px 12px 12px;
}

.agent-skills-view.has-filters {
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
}

.agent-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.agent-section-heading div { display: grid; gap: 4px; }
.agent-section-heading h3 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.025em; }
.agent-section-heading button,
.agent-load-more { min-height: 32px; padding: 0 11px; border-radius: 8px; color: rgba(244, 244, 245, 0.72); font-size: 11px; }

.agent-search {
  min-height: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
}

.agent-search input { min-width: 0; padding: 0 11px; border-radius: 9px; font-size: 11px; }
.agent-search button { padding: 0 12px; border-radius: 9px; font-size: 11px; }

.agent-history-list,
.agent-skill-list,
.agent-message-list {
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(118, 182, 210, 0.28) transparent;
}

.agent-history-list,
.agent-skill-list { display: grid; align-content: start; gap: 8px; }

.agent-history-card {
  position: relative;
  min-height: 90px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border: 1px solid var(--agent-line);
  border-radius: 12px;
  background: var(--agent-surface);
}

.agent-history-card:hover { border-color: rgba(255, 255, 255, 0.2); background: var(--agent-surface-raised); }

.agent-history-open {
  min-width: 0;
  padding: 13px;
  display: grid;
  align-content: start;
  gap: 5px;
  border: 0 !important;
  text-align: left;
  background: transparent !important;
}

.agent-history-open strong { overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.agent-history-open span { overflow: hidden; color: rgba(244, 244, 245, 0.58); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.agent-history-open small { color: rgba(244, 244, 245, 0.38); font-size: 10px; }
.agent-history-actions { padding: 8px 7px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.agent-history-actions button { min-width: 42px; min-height: 27px; border-radius: 7px; color: rgba(244, 244, 245, 0.55); font-size: 10px; }
.agent-history-actions button:last-child:hover { border-color: rgba(242, 111, 115, 0.4); color: #f2989b; }

.agent-empty {
  min-height: 170px;
  padding: 20px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: rgba(221, 234, 238, 0.48);
  text-align: center;
}

.agent-empty > span { color: var(--agent-blue); font-size: 26px; text-shadow: 0 0 24px rgba(125, 211, 252, 0.32); }
.agent-empty strong { color: rgba(244, 244, 245, 0.82); font-size: 13px; }
.agent-empty p { margin: 0; font-size: 11px; line-height: 1.55; }

.agent-chat-view {
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.agent-chat-context {
  padding: 8px 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(157, 203, 219, 0.09);
}

.agent-chat-context button { min-height: 30px; padding: 0 9px; border-radius: 8px; font-size: 10px; }
.agent-chat-context div { min-width: 0; display: grid; gap: 2px; text-align: center; }
.agent-chat-context strong { font-size: 11px; font-weight: 650; }
.agent-chat-context small { color: rgba(244, 244, 245, 0.4); font-size: 9px; }

.agent-message-list { padding: 16px 12px 10px; display: flex; flex-direction: column; gap: 16px; }
.agent-chat-empty { margin: auto; }

.agent-message {
  max-width: 94%;
  display: grid;
  gap: 5px;
}

.agent-message.is-user { align-self: flex-end; }
.agent-message.is-assistant { align-self: flex-start; }
.agent-message header { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: rgba(244, 244, 245, 0.4); font-size: 9px; }
.agent-message.is-user header { flex-direction: row-reverse; }
.agent-message-body {
  padding: 10px 12px;
  border: 1px solid var(--agent-line);
  border-radius: 12px;
  color: rgba(250, 250, 250, 0.9);
  background: var(--agent-surface-raised);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.agent-message.is-assistant:not(.is-temporary):not(.is-failed) .agent-message-body { padding-inline: 2px; border-color: transparent; background: transparent; }
.agent-message.is-user .agent-message-body { border-color: rgba(255, 255, 255, 0.08); background: #202125; }
.agent-message.is-temporary .agent-message-body { border-color: rgba(125, 211, 252, 0.16); color: rgba(224, 242, 254, 0.86); background: rgba(14, 31, 42, 0.65); }
.agent-message.is-temporary[data-notice-kind="error"] .agent-message-body { border-color: rgba(248, 113, 113, 0.22); color: rgba(254, 226, 226, 0.86); background: rgba(55, 20, 24, 0.52); }
.agent-message.is-failed .agent-message-body { border-color: rgba(242, 111, 115, 0.24); color: #edb1b3; }
.agent-message-body p { margin: 0; }
.agent-message-body p + p { margin-top: 8px; }
.agent-message-body h2,
.agent-message-body h3,
.agent-message-body h4 { margin: 12px 0 6px; color: #fafafa; font-size: 14px; }
.agent-message-body code { padding: 1px 3px; border-radius: 3px; background: rgba(118, 182, 210, 0.1); }
.agent-message-body ul,
.agent-message-body ol { margin: 7px 0; padding-left: 18px; }
.agent-message-body li + li { margin-top: 3px; }
.agent-message-body blockquote { margin: 8px 0; padding: 6px 8px; border-left: 2px solid rgba(118,182,210,.45); color: rgba(229,239,242,.72); background: rgba(118,182,210,.055); }
.agent-message-body a { color: #8bc8e0; text-decoration: underline; text-underline-offset: 2px; }
.agent-table-wrap { max-width:100%; margin:8px 0; overflow:auto; border:1px solid rgba(118,182,210,.14); border-radius:6px; }
.agent-table-wrap table { width:100%; border-collapse:collapse; font-size:11px; }
.agent-table-wrap th,
.agent-table-wrap td { padding:5px 6px; border-bottom:1px solid rgba(118,182,210,.1); text-align:left; white-space:nowrap; }
.agent-table-wrap th { color:#eef6f7; background:rgba(118,182,210,.09); }
.agent-table-wrap [data-align="center"] { text-align:center; }
.agent-table-wrap [data-align="right"] { text-align:right; }
.agent-list-item { display: block; padding-left: 12px; position: relative; }
.agent-list-item::before { content: "·"; position: absolute; left: 2px; color: var(--agent-blue); }
.agent-message footer { min-height: 15px; }
.agent-message footer button { padding: 2px 6px; border: 0; color: rgba(244, 244, 245, 0.44); background: transparent; font-size: 9px; }
.agent-thinking { display: inline-flex; align-items: center; gap: 6px; color: rgba(244, 244, 245, 0.64); }
.agent-thinking span { color: var(--agent-blue); letter-spacing: 0.18em; animation: agentThinking 1.1s ease-in-out infinite alternate; }
.agent-message-attachments { display:grid; gap:5px; margin-top:5px; }
.agent-message-attachments article { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:6px 7px; border:1px solid rgba(118,182,210,.12); border-radius:6px; background:rgba(8,15,18,.34); }
.agent-message-attachments div { min-width:0; }
.agent-message-attachments strong,.agent-message-attachments small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.agent-message-attachments strong { color:rgba(244,244,245,.8); font-size:11px; }
.agent-message-attachments small { margin-top:2px; color:rgba(244,244,245,.4); font-size:9px; }
.agent-message-attachments footer { display:flex; gap:3px; flex:0 0 auto; }

.agent-code { position: relative; margin: 8px 0; }
.agent-code button { position: absolute; top: 5px; right: 5px; z-index: 1; min-height: 25px; padding: 0 7px; border-radius: 6px; font-size: 9px; }
.agent-code pre { max-width: 100%; margin: 0; padding: 28px 8px 8px; overflow: auto; border: 1px solid rgba(118, 182, 210, 0.12); border-radius: 6px; background: #05080c; }

.agent-map-draft,
.agent-map-undo {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid rgba(118, 182, 210, 0.1);
  color: rgba(220, 233, 237, 0.56);
  background: rgba(118, 182, 210, 0.045);
  font-size: 10px;
}

.agent-map-draft button,
.agent-map-undo button { min-height: 28px; padding: 0 9px; border-radius: 7px; font-size: 10px; }

.agent-composer {
  padding: 7px 10px 9px;
  display: grid;
  gap: 5px;
  border-top: 1px solid var(--agent-line);
  background: rgba(8, 9, 11, 0.98);
}

.agent-composer-meta {
  display: flex;
  align-items: center;
  gap: 4px;
}

.agent-composer-meta > span { margin-left: auto; color: rgba(244, 244, 245, 0.3); font-size: 9px; }
.agent-composer-meta button,
.agent-memory-toggle { min-height: 27px; padding: 0 8px; border: 1px solid var(--agent-line); border-radius: 7px; color: rgba(244, 244, 245, 0.62); background: transparent; font-size: 10px; }
.agent-memory-toggle { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.agent-memory-toggle input { width: 11px; height: 11px; margin: 0; accent-color: var(--agent-blue); }
.agent-composer-skills { color: rgba(224, 242, 254, 0.82) !important; border-color: rgba(125, 211, 252, 0.18) !important; background: rgba(125, 211, 252, 0.06) !important; }
.agent-composer-skills b { min-width: 16px; height: 16px; padding: 0 4px; display: inline-grid; place-items: center; border-radius: 999px; color: #07131a; background: var(--agent-blue); font-size: 9px; }

.agent-composer-box {
  min-height: 56px;
  padding: 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: end;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  background: #15161a;
}

.agent-composer-box:focus-within { border-color: rgba(125, 211, 252, 0.4); box-shadow: 0 0 0 2px rgba(125, 211, 252, 0.06); }
.agent-composer-box textarea { min-width: 0; width: 100%; height: 42px; padding: 3px 5px; resize: none; border: 0; outline: 0; background: transparent; font-size: 12px; line-height: 1.5; }
.agent-composer-box > button { width: 32px; height: 32px; border-radius: 7px; border-color: rgba(118, 182, 210, 0.25); color: #071015; background: var(--agent-blue); font-weight: 900; }
.agent-composer-box > button.is-stop { display: grid; place-items: center; color: white; border-color: rgba(255, 255, 255, 0.12); background: #2a2b30; }
.agent-stop-symbol { width: 11px; height: 11px; border-radius: 2px; background: currentColor; }

.agent-attachment-list { max-height: 120px; overflow: auto; display: grid; gap: 4px; }
.agent-attachment { padding: 6px 7px; display: flex; align-items: center; justify-content: space-between; gap: 6px; border: 1px solid rgba(157, 203, 219, 0.11); border-radius: 5px; background: rgba(255, 255, 255, 0.025); }
.agent-attachment[data-status="failed"] { border-color: rgba(242, 111, 115, 0.25); }
.agent-attachment div { min-width: 0; display: grid; gap: 1px; }
.agent-attachment strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.agent-attachment small { color: rgba(244, 244, 245, 0.4); font-size: 9px; }
.agent-attachment em { color: #ed999d; font-size: 9px; font-style: normal; }
.agent-attachment footer { display: flex; gap: 3px; }
.agent-attachment button { min-height: 26px; padding: 0 7px; border-radius: 6px; font-size: 9px; }

.agent-skill-upload {
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px dashed rgba(125, 211, 252, 0.24);
  border-radius: 10px;
  background: rgba(125, 211, 252, 0.035);
}
.agent-skill-tabs { display:flex; gap:4px; padding:4px; border-radius:9px; background:var(--agent-surface); }
.agent-skill-tabs button { min-height:31px; padding:0 10px; color:rgba(244,244,245,.5); border:0; border-radius:7px; background:transparent; font-size:11px; }
.agent-skill-tabs button.is-active { color:#fafafa; background:#27282d; box-shadow:inset 0 0 0 1px rgba(255,255,255,.06); }
.agent-skill-filters { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; }
.agent-skill-filters label { min-width:0; display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; gap:5px; color:rgba(244,244,245,.44); font-size:9px; }
.agent-skill-filters select { min-width:0; min-height:31px; padding:0 7px; border-radius:7px; color:rgba(244,244,245,.78); background:var(--agent-surface); font-size:10px; }
.agent-context-warning { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:7px; margin:8px 10px 0; padding:9px 10px; border:1px solid rgba(238,185,103,.2); border-radius:7px; background:rgba(122,84,37,.16); }
.agent-context-warning div { display:grid; gap:2px; min-width:0; }
.agent-context-warning strong { color:#f3d6a4; font-size:11px; }
.agent-context-warning span { color:rgba(239,221,190,.55); font-size:9px; }
.agent-context-warning button { min-height:28px; padding:0 8px; color:#f3dec0; border:1px solid rgba(238,185,103,.2); border-radius:7px; background:rgba(238,185,103,.08); font-size:9px; }

.agent-skill-upload div { min-width: 0; display: grid; gap: 2px; }
.agent-skill-upload strong { font-size: 12px; }
.agent-skill-upload small { color: rgba(244, 244, 245, 0.42); font-size: 9px; }
.agent-skill-upload button { min-height: 31px; padding: 0 9px; border-radius: 7px; font-size: 10px; }

.agent-skill-card {
  padding: 11px;
  display: grid;
  gap: 6px;
  border: 1px solid var(--agent-line);
  border-radius: 11px;
  background: var(--agent-surface);
}

.agent-skill-card header { display: flex; align-items: center; gap: 6px; }
.agent-skill-card header span { padding: 2px 5px; border: 1px solid rgba(125, 211, 252, 0.18); border-radius: 5px; color: var(--agent-blue); font-size: 9px; }
.agent-skill-card header strong { font-size: 13px; font-weight: 650; }
.agent-skill-card p { margin: 0; color: rgba(244, 244, 245, 0.62); font-size: 11px; line-height: 1.55; }
.agent-skill-card > small { color: rgba(244, 244, 245, 0.38); font-size: 9px; }
.agent-skill-card footer { display: flex; align-items: center; gap: 5px; }
.agent-skill-card footer button,
.agent-skill-card footer label { min-height: 28px; padding: 0 8px; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--agent-line); border-radius: 7px; color: rgba(244, 244, 245, 0.62); background: transparent; font-size: 10px; }
.agent-skill-card footer input { width: 10px; height: 10px; margin: 0; accent-color: var(--agent-blue); }

.agent-loading {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: rgba(222, 234, 238, 0.5);
  font-size: 11px;
}

.agent-loading i {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(118, 182, 210, 0.22);
  border-top-color: var(--agent-blue);
  border-radius: 50%;
  animation: agentSpin 0.8s linear infinite;
}

.agent-floating-window {
  position: fixed;
  z-index: 49;
  min-width: 360px;
  min-height: 520px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: hidden;
  resize: both;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  background: var(--agent-panel);
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.76), 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.agent-floating-window[hidden],
.agent-orb[hidden] { display: none; }
.agent-floating-body { width: 100%; height: 100%; }
.agent-floating-window .agent-panel-head { cursor: move; }

.agent-orb {
  position: fixed;
  right: 26px;
  bottom: 28px;
  z-index: 50;
  width: 86px;
  height: 86px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 28px;
  background: transparent;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.agent-orb:active { cursor: grabbing; }

.agent-orb canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
}

.agent-orb b { position: absolute; top: 2px; right: 3px; z-index: 2; width: 9px; height: 9px; border-radius: 50%; background: transparent; }
.agent-orb.has-unread b { background: #f4e6b4; box-shadow: 0 0 11px rgba(244, 230, 180, 0.9); }
.agent-orb[data-state="busy"] { animation: agentOrbBusy 1.2s ease-in-out infinite alternate; }

@keyframes agentPulse { to { transform: scale(1.6); box-shadow: 0 0 12px rgba(118, 182, 210, 0.8); } }
@keyframes agentSpin { to { transform: rotate(360deg); } }
@keyframes agentThinking { to { opacity: 0.35; transform: translateX(2px); } }
@keyframes agentOrbBusy { to { transform: scale(1.045); } }

@media (prefers-reduced-motion: reduce) {
  .agent-orb[data-state="busy"],
  .agent-live-status i,
  .agent-thinking span,
  .agent-loading i { animation: none !important; }
}
