/* 企業 AI Agent 概念展示（js/demos/agent.js） */
.dm-agent {
  --a-bg: #0f1419;
  --a-panel: #161d26;
  --a-panel2: #121821;
  --a-side: #0b1016;
  --a-line: #1d2632;
  --a-border: #253041;
  --a-text: #e6edf3;
  --a-soft: #c9d4de;
  --a-muted: #8b98a9;
  --a-faint: #5f6e80;
  --a-amber: #f5b544;
  --a-amber-d: rgba(245, 181, 68, 0.13);
  --a-teal: #2dd4bf;
  --a-teal-d: rgba(45, 212, 191, 0.13);
  --a-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 200px 1fr 300px;
  overflow: hidden;
  background: var(--a-bg);
  color: var(--a-text);
  font: 400 14px/1.55 "Noto Sans TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
}
.dm-agent.is-resetting,
.dm-agent.is-resetting * {
  transition: none !important;
}
.dm-agent p { margin: 0; }
.dm-agent b { font-weight: 600; }
.dm-agent small { font-size: inherit; }
.dm-agent em { font-style: normal; }
.dm-agent svg { display: block; flex: none; }

/* Sidebar */
.dm-agent .ag-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 12px 14px;
  background: var(--a-side);
  border-right: 1px solid var(--a-line);
}
.dm-agent .ag-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 18px;
}
.dm-agent .ag-brand b { display: block; font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.dm-agent .ag-brand small { display: block; font-size: 11.5px; color: var(--a-muted); line-height: 1.4; }
.dm-agent .ag-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(140deg, #f8c766, #e2891d);
  color: #2a1a05;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(245, 181, 68, 0.65);
}
.dm-agent .ag-mark.sm {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 13px;
}
.dm-agent .ag-sec {
  display: block;
  padding: 0 8px 7px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--a-faint);
}
.dm-agent .ag-nav { display: grid; gap: 2px; }
.dm-agent .ag-nav-i {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--a-muted);
  font-size: 14px;
  transition: background 0.25s, color 0.25s;
}
.dm-agent .ag-nav-i.on { background: #182230; color: var(--a-text); }
.dm-agent .ag-nav-i.on svg { color: var(--a-amber); }
.dm-agent .ag-nav-i em {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--a-amber-d);
  color: var(--a-amber);
  font-size: 11px;
  line-height: 1;
}
.dm-agent .ag-usage {
  margin-top: auto;
  padding: 11px 12px 12px;
  border: 1px solid var(--a-line);
  border-radius: 10px;
  background: var(--a-panel2);
}
.dm-agent .ag-usage > span { display: block; font-size: 11.5px; color: var(--a-muted); }
.dm-agent .ag-usage b { display: block; margin: 1px 0 8px; font-size: 15px; font-variant-numeric: tabular-nums; }
.dm-agent .ag-usage b small { font-size: 12px; font-weight: 400; color: var(--a-faint); }
.dm-agent .ag-usage i {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--a-border);
  overflow: hidden;
}
.dm-agent .ag-usage s { display: block; width: 26%; height: 100%; background: var(--a-amber); }
.dm-agent .ag-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 6px 0;
  border-top: 1px solid var(--a-line);
}
.dm-agent .ag-user b { display: block; font-size: 13.5px; line-height: 1.35; }
.dm-agent .ag-user small { display: block; font-size: 11.5px; color: var(--a-muted); }
.dm-agent .ag-av {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--a-teal-d);
  color: var(--a-teal);
  font-size: 13px;
  font-weight: 600;
}

/* Conversation */
.dm-agent .ag-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--a-line);
}
.dm-agent .ag-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 18px 0 20px;
  border-bottom: 1px solid var(--a-line);
}
.dm-agent .ag-head .ag-title { font-size: 15px; }
.dm-agent .ag-chip {
  padding: 0 8px;
  border: 1px solid var(--a-border);
  border-radius: 6px;
  color: var(--a-muted);
  font-size: 11.5px;
  line-height: 20px;
}
.dm-agent .ag-live {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: var(--a-muted);
  font-size: 12.5px;
}
.dm-agent .ag-live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--a-teal);
  box-shadow: 0 0 0 3px var(--a-teal-d);
}
.dm-agent .ag-more { color: var(--a-faint); margin-left: 6px; }

.dm-agent .ag-msgs {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 20px 4px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 40px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 40px);
}
.dm-agent .ag-m {
  flex: none;
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.55s var(--a-ease), opacity 0.4s 0.08s;
}
.dm-agent .ag-m.on { grid-template-rows: 1fr; opacity: 1; }
.dm-agent .ag-m > div { min-height: 0; overflow: hidden; }
.dm-agent .ag-ai {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-top: 14px;
}
.dm-agent .ag-ai .ag-mark.sm { margin-top: 2px; }
.dm-agent .ag-body { flex: 1; min-width: 0; }
.dm-agent .ag-who {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--a-muted);
  line-height: 1.4;
}
.dm-agent .ag-who::after {
  content: attr(data-t);
  margin-left: 7px;
  color: var(--a-faint);
  font-variant-numeric: tabular-nums;
}
.dm-agent .ag-card {
  display: inline-block;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 4px 12px 12px 12px;
  border: 1px solid var(--a-border);
  background: var(--a-panel);
}
.dm-agent .ag-card.wide { display: block; }
.dm-agent .ag-card .ag-sub { margin-top: 2px; font-size: 13px; color: var(--a-muted); }
.dm-agent .ag-hl { color: var(--a-amber); }
.dm-agent .ag-me {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-top: 14px;
}
.dm-agent .ag-bub {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 12px 4px 12px 12px;
  border: 1px solid #2e4361;
  background: #20304a;
}
.dm-agent .ag-sugs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.dm-agent .ag-sugs span {
  padding: 2px 10px;
  border: 1px solid var(--a-border);
  border-radius: 999px;
  color: var(--a-muted);
  font-size: 12px;
}
.dm-agent .ag-think {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--a-muted);
  font-size: 13px;
}
.dm-agent .ag-think i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--a-amber);
  animation: ag-dot 1.2s ease-in-out infinite;
}
.dm-agent .ag-think i:nth-child(2) { animation-delay: 0.15s; }
.dm-agent .ag-think i:nth-child(3) { animation-delay: 0.3s; }
.dm-agent .ag-think span { margin-left: 6px; }

.dm-agent .ag-table { display: grid; margin-top: 8px; font-size: 13px; }
.dm-agent .ag-tr {
  display: grid;
  grid-template-columns: 1.25fr 0.7fr 1fr 0.9fr;
  gap: 10px;
  padding: 4px 2px;
  border-top: 1px solid var(--a-line);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.35s, transform 0.45s var(--a-ease);
}
.dm-agent .ag-tr.on,
.dm-agent .ag-th { opacity: 1; transform: none; }
.dm-agent .ag-th { border-top: 0; color: var(--a-faint); font-size: 11.5px; }
.dm-agent .ag-tr > :nth-child(2),
.dm-agent .ag-tr > :nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
.dm-agent .ag-tr:not(.ag-th) > :nth-child(4) { color: var(--a-soft); }
.dm-agent .ag-nw { white-space: nowrap; }
.dm-agent .ag-warn { color: var(--a-amber); }

.dm-agent .ag-file {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 300px;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid var(--a-border);
  border-radius: 10px;
  background: var(--a-panel2);
}
.dm-agent .ag-file b { display: block; font-size: 13.5px; font-weight: 500; }
.dm-agent .ag-file small { display: block; font-size: 11.5px; color: var(--a-muted); }
.dm-agent .ag-file svg { margin-left: auto; color: var(--a-muted); }
.dm-agent .ag-xls,
.dm-agent .ag-fchip {
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #1d7a52;
  color: #eafff5;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.dm-agent .ag-xls { flex: none; width: 32px; height: 38px; font-size: 10px; }
.dm-agent .ag-fchip {
  display: inline-grid;
  height: 15px;
  margin-right: 5px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 9px;
  vertical-align: 1px;
}

.dm-agent .ag-pill {
  display: inline-flex;
  align-items: center;
  flex: none;
  margin-left: 6px;
  padding: 0 8px;
  border: 1px solid var(--a-border);
  border-radius: 999px;
  color: var(--a-muted);
  font-size: 11.5px;
  line-height: 19px;
  white-space: nowrap;
  vertical-align: 1px;
}
.dm-agent .ag-pill.wait {
  border-color: rgba(245, 181, 68, 0.45);
  background: var(--a-amber-d);
  color: var(--a-amber);
}

/* Approval card */
.dm-agent .ag-approve {
  padding: 13px 15px 12px;
  border: 1px solid rgba(245, 181, 68, 0.55);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(245, 181, 68, 0.09), rgba(245, 181, 68, 0.02) 45%), var(--a-panel);
  transition: border-color 0.45s, background 0.45s;
}
.dm-agent .ag-approve.ok {
  border-color: rgba(45, 212, 191, 0.5);
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.08), rgba(45, 212, 191, 0.01) 45%), var(--a-panel);
}
.dm-agent .ag-ap-head { display: flex; align-items: center; gap: 8px; }
.dm-agent .ag-ap-head svg { color: var(--a-amber); transition: color 0.4s; }
.dm-agent .ag-approve.ok .ag-ap-head svg { color: var(--a-teal); }
.dm-agent .ag-ap-head b { margin-right: auto; font-size: 14.5px; }
.dm-agent .ag-ap-head .ag-pill { margin-left: 0; }
.dm-agent .ag-draft {
  margin-top: 11px;
  padding: 9px 12px 10px;
  border: 1px solid var(--a-line);
  border-radius: 10px;
  background: var(--a-bg);
}
.dm-agent .ag-dr-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: var(--a-faint);
  font-size: 11.5px;
}
.dm-agent .ag-dr-meta {
  display: grid;
  gap: 1px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--a-line);
  font-size: 12.5px;
}
.dm-agent .ag-dr-meta em { display: inline-block; width: 50px; color: var(--a-faint); }
.dm-agent .ag-dr-body {
  padding-top: 7px;
  color: var(--a-soft);
  font-size: 12.5px;
  line-height: 1.65;
}
.dm-agent .ag-dr-body p { opacity: 0; transition: opacity 0.45s; }
.dm-agent .ag-dr-body p.on { opacity: 1; }
.dm-agent .ag-ap-foot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
}
.dm-agent .ag-ap-note { margin-right: auto; color: var(--a-faint); font-size: 11.5px; }
.dm-agent .ag-btn {
  display: inline-grid;
  place-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.25s, filter 0.25s, transform 0.2s;
}
.dm-agent .ag-btn.ghost { color: var(--a-muted); }
.dm-agent .ag-btn.line { border: 1px solid var(--a-border); color: var(--a-text); }
.dm-agent .ag-btn.line.hover { background: #1c2735; }
.dm-agent .ag-btn.amber { background: var(--a-amber); color: #2a1a05; font-weight: 600; }
.dm-agent .ag-btn.busy { filter: saturate(0.6) brightness(0.9); }
.dm-agent .ag-btn.sm { height: 30px; font-size: 12.5px; }
.dm-agent .ag-ap-foot > * { transition: opacity 0.3s; }
.dm-agent .ag-approve.ok .ag-ap-foot > * { opacity: 0; }
.dm-agent .ag-ap-done {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--a-teal);
  font-size: 13.5px;
  opacity: 0;
}
.dm-agent .ag-approve.ok .ag-ap-foot > .ag-ap-done { opacity: 1; transition-delay: 0.15s; }

/* Composer */
.dm-agent .ag-composer { flex: none; padding: 10px 20px 12px; }
.dm-agent .ag-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--a-border);
  border-radius: 12px;
  background: var(--a-panel);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.dm-agent .ag-box.focus {
  border-color: rgba(245, 181, 68, 0.55);
  box-shadow: 0 0 0 3px rgba(245, 181, 68, 0.12);
}
.dm-agent .ag-clip { color: var(--a-faint); }
.dm-agent .ag-ph,
.dm-agent .ag-in { flex: 1; min-width: 0; }
.dm-agent .ag-ph { color: var(--a-faint); }
.dm-agent .ag-in { color: var(--a-text); line-height: 1.5; }
.dm-agent .ag-box.has-text .ag-ph,
.dm-agent .ag-box:not(.has-text) .ag-in { display: none; }
.dm-agent .ag-send {
  display: grid;
  place-items: center;
  flex: none;
  align-self: flex-end;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--a-border);
  color: var(--a-faint);
  transition: background 0.25s, color 0.25s;
}
.dm-agent .ag-send.ready { background: var(--a-amber); color: #2a1a05; }
.dm-agent .ag-note {
  margin-top: 7px;
  color: var(--a-faint);
  font-size: 11.5px;
  text-align: center;
}

/* Plan panel */
.dm-agent .ag-plan {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 16px 14px;
  background: var(--a-panel2);
}
.dm-agent .ag-plan-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.dm-agent .ag-plan-head b { font-size: 14.5px; }
.dm-agent .ag-count { color: var(--a-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dm-agent .ag-bar {
  height: 4px;
  margin: 10px 0 14px;
  border-radius: 2px;
  background: var(--a-border);
  overflow: hidden;
}
.dm-agent .ag-bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--a-teal), #6ee7d8);
  transform: scaleX(var(--pp, 0));
  transform-origin: left;
  transition: transform 0.6s var(--a-ease);
}
.dm-agent .ag-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 26px 20px;
  border: 1px dashed var(--a-border);
  border-radius: 12px;
  color: var(--a-muted);
  font-size: 13px;
  text-align: center;
}
.dm-agent .ag-empty svg { color: var(--a-faint); }
.dm-agent .ag-plan.has-steps .ag-empty { display: none; }
.dm-agent .ag-steps { display: grid; gap: 8px; }
.dm-agent .ag-plan:not(.has-steps) .ag-steps { display: none; }
.dm-agent .ag-step {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--a-line);
  border-radius: 10px;
  background: var(--a-panel);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s, transform 0.5s var(--a-ease), border-color 0.3s, background 0.3s;
}
.dm-agent .ag-step.on { opacity: 1; transform: none; }
.dm-agent .ag-step b { display: block; font-size: 13.5px; font-weight: 500; line-height: 1.45; }
.dm-agent .ag-step small {
  display: block;
  margin-top: 1px;
  color: var(--a-muted);
  font-size: 12px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.dm-agent .ag-step.done small { color: #9fded4; }
.dm-agent .ag-step.wait small { color: #f3cf8a; }
.dm-agent .ag-tag {
  padding: 0 6px;
  border: 1px solid var(--a-border);
  border-radius: 5px;
  background: #1a2330;
  color: var(--a-muted);
  font-size: 10.5px;
  line-height: 18px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.dm-agent .ag-step .ag-tag { margin-top: 1px; }
.dm-agent .ag-st {
  position: relative;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.5px solid #3a4757;
  border-radius: 50%;
}
.dm-agent .ag-step.run {
  border-color: rgba(45, 212, 191, 0.45);
  background: #14212a;
}
.dm-agent .ag-step.run .ag-st {
  border: 2px solid var(--a-teal);
  border-right-color: transparent;
  animation: ag-spin 0.8s linear infinite;
}
.dm-agent .ag-step.done .ag-st { border: 0; background: var(--a-teal); }
.dm-agent .ag-step.done .ag-st::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  width: 5px;
  height: 9px;
  border: solid #06302a;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.dm-agent .ag-step.wait {
  border-color: rgba(245, 181, 68, 0.5);
  background: #201c14;
}
.dm-agent .ag-step.wait .ag-st { border: 0; background: var(--a-amber); }
.dm-agent .ag-step.wait .ag-st::before,
.dm-agent .ag-step.wait .ag-st::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 2.5px;
  height: 8px;
  border-radius: 1px;
  background: #2a1a05;
}
.dm-agent .ag-step.wait .ag-st::before { left: 6px; }
.dm-agent .ag-step.wait .ag-st::after { left: 11.5px; }

.dm-agent .ag-act { position: relative; height: 38px; margin-top: 12px; }
.dm-agent .ag-go,
.dm-agent .ag-state {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  opacity: 0;
  transition: opacity 0.35s, transform 0.4s var(--a-ease), filter 0.2s;
}
.dm-agent .ag-go {
  display: grid;
  place-items: center;
  background: var(--a-amber);
  color: #2a1a05;
  font-size: 13.5px;
  font-weight: 600;
  transform: translateY(6px);
}
.dm-agent .ag-act[data-s="go"] .ag-go { opacity: 1; transform: none; }
.dm-agent .ag-go.press { filter: brightness(0.88); transform: scale(0.97); }
.dm-agent .ag-state {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--a-line);
  color: var(--a-muted);
  font-size: 13px;
}
.dm-agent .ag-act[data-s="run"] .ag-state,
.dm-agent .ag-act[data-s="wait"] .ag-state,
.dm-agent .ag-act[data-s="done"] .ag-state { opacity: 1; }
.dm-agent .ag-state i {
  position: relative;
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.dm-agent .ag-act[data-s="run"] .ag-state i {
  border: 2px solid var(--a-teal);
  border-right-color: transparent;
  animation: ag-spin 0.8s linear infinite;
}
.dm-agent .ag-act[data-s="wait"] .ag-state {
  border-color: rgba(245, 181, 68, 0.4);
  background: var(--a-amber-d);
  color: var(--a-amber);
}
.dm-agent .ag-act[data-s="wait"] .ag-state i {
  width: 9px;
  height: 9px;
  margin: 0 2px;
  background: var(--a-amber);
  box-shadow: 0 0 0 3px rgba(245, 181, 68, 0.22);
  animation: ag-blink 1.4s ease-in-out infinite;
}
.dm-agent .ag-act[data-s="done"] .ag-state {
  border-color: rgba(45, 212, 191, 0.4);
  background: var(--a-teal-d);
  color: var(--a-teal);
}
.dm-agent .ag-act[data-s="done"] .ag-state i { background: var(--a-teal); }
.dm-agent .ag-act[data-s="done"] .ag-state i::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2.5px;
  width: 4px;
  height: 7px;
  border: solid #06302a;
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(45deg);
}

.dm-agent .ag-conn {
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid var(--a-line);
}
.dm-agent .ag-conn .ag-sec { padding: 0 0 10px; }
.dm-agent .ag-tiles { display: flex; justify-content: space-between; }
.dm-agent .ag-tile {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 50px;
}
.dm-agent .ag-tile b {
  display: grid;
  place-items: center;
  width: 46px;
  height: 40px;
  border: 1px solid var(--a-border);
  border-radius: 10px;
  background: var(--a-panel);
  color: var(--a-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: border-color 0.35s, background 0.35s, color 0.35s, box-shadow 0.35s;
}
.dm-agent .ag-tile small { color: var(--a-faint); font-size: 10.5px; white-space: nowrap; }
.dm-agent .ag-tile.act b {
  border-color: var(--a-teal);
  background: var(--a-teal-d);
  color: var(--a-teal);
  animation: ag-glow 1.1s ease-in-out infinite;
}
.dm-agent .ag-tile.used b { border-color: #2c5a58; color: var(--a-text); }
.dm-agent .ag-tile.used::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -1px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--a-panel2);
  border-radius: 50%;
  background: var(--a-teal);
}
.dm-agent .ag-tile.wait b {
  border-color: rgba(245, 181, 68, 0.6);
  background: var(--a-amber-d);
  color: var(--a-amber);
}

/* Audit page */
.dm-agent .ag-audit {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  bottom: 0;
  left: 200px;
  display: flex;
  flex-direction: column;
  background: var(--a-bg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.45s, transform 0.55s var(--a-ease), visibility 0s 0.45s;
}
.dm-agent .ag-audit.on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.45s, transform 0.55s var(--a-ease), visibility 0s;
}
.dm-agent .ag-a-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px 16px;
}
.dm-agent .ag-a-head > div:first-child { margin-right: auto; }
.dm-agent .ag-a-head b { display: block; font-size: 17px; font-weight: 700; }
.dm-agent .ag-a-head small { display: block; color: var(--a-muted); font-size: 12.5px; }
.dm-agent .ag-filters {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--a-line);
  border-radius: 9px;
  background: var(--a-panel);
}
.dm-agent .ag-filters span {
  padding: 2px 10px;
  border-radius: 6px;
  color: var(--a-muted);
  font-size: 12.5px;
}
.dm-agent .ag-filters .on { background: #1f2a38; color: var(--a-text); }
.dm-agent .ag-a-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 280px;
  align-items: start;
  gap: 16px;
  padding: 0 24px 22px;
}
.dm-agent .ag-log {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 16px;
  border: 1px solid var(--a-line);
  border-radius: 12px;
  background: var(--a-panel2);
}
.dm-agent .ag-log-top {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  color: var(--a-muted);
  font-size: 12.5px;
}
.dm-agent .ag-log-top b { color: var(--a-text); font-size: 13px; font-weight: 500; }
.dm-agent .ag-row {
  position: relative;
  display: grid;
  grid-template-columns: 40px 96px 1fr auto;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 6px;
  border-top: 1px solid var(--a-line);
  font-size: 13px;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.35s, transform 0.45s var(--a-ease), background 0.25s;
}
.dm-agent .ag-row.on { opacity: 1; transform: none; }
.dm-agent .ag-row.key {
  background: linear-gradient(90deg, rgba(245, 181, 68, 0.1), transparent 75%);
  box-shadow: inset 2px 0 0 var(--a-amber);
}
.dm-agent .ag-row.hl { background: #1a2532; }
.dm-agent .ag-row time { color: var(--a-faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dm-agent .ag-actor {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--a-soft);
  white-space: nowrap;
}
.dm-agent .ag-actor::before {
  content: attr(data-i);
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  font-size: 10.5px;
  font-weight: 700;
}
.dm-agent .ag-actor.ai::before {
  border-radius: 6px;
  background: linear-gradient(140deg, #f8c766, #e2891d);
  color: #2a1a05;
}
.dm-agent .ag-actor.hu::before {
  border-radius: 50%;
  background: var(--a-teal-d);
  color: var(--a-teal);
}
.dm-agent .ag-act-t { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-agent .ag-row.key .ag-tag {
  border-color: rgba(245, 181, 68, 0.45);
  background: var(--a-amber-d);
  color: var(--a-amber);
}
.dm-agent .ag-pop {
  position: absolute;
  z-index: 2;
  top: calc(100% - 4px);
  left: 150px;
  padding: 8px 12px;
  border: 1px solid #304055;
  border-radius: 8px;
  background: #1c2633;
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.75);
  color: var(--a-soft);
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s, transform 0.35s var(--a-ease);
}
.dm-agent .ag-pop.on { opacity: 1; transform: none; }
.dm-agent .ag-pop code {
  color: var(--a-amber);
  font: 11.5px "Cascadia Code", Consolas, monospace;
}
.dm-agent .ag-chain {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--a-line);
  color: var(--a-faint);
  font-size: 11.5px;
}

.dm-agent .ag-a-side { display: flex; flex-direction: column; gap: 10px; }
.dm-agent .ag-sched {
  padding: 13px 16px 14px;
  border: 1px solid var(--a-line);
  border-radius: 12px;
  background: var(--a-panel2);
  transition: border-color 0.4s;
}
.dm-agent .ag-sched.on { border-color: rgba(45, 212, 191, 0.45); }
.dm-agent .ag-sched .ag-sec { padding: 0 0 5px; }
.dm-agent .ag-sched b { display: block; font-size: 15px; }
.dm-agent .ag-sched p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  font-size: 13.5px;
}
.dm-agent .ag-sched p svg { color: var(--a-amber); }
.dm-agent .ag-sched > small { display: block; margin-top: 2px; color: var(--a-muted); font-size: 12px; }
.dm-agent .ag-sw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--a-line);
  color: var(--a-muted);
  font-size: 12.5px;
}
.dm-agent .ag-sched.on .ag-sw-txt { color: var(--a-teal); }
.dm-agent .ag-sw {
  position: relative;
  flex: none;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--a-border);
  transition: background 0.3s;
}
.dm-agent .ag-sw i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8b98a9;
  transition: transform 0.35s var(--a-ease), background 0.3s;
}
.dm-agent .ag-sched.on .ag-sw { background: var(--a-teal); }
.dm-agent .ag-sched.on .ag-sw i { transform: translateX(18px); background: #fff; }
.dm-agent .ag-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 11px 16px 12px;
  border: 1px solid var(--a-line);
  border-radius: 12px;
  background: var(--a-panel2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s, transform 0.5s var(--a-ease);
}
.dm-agent .ag-stat.on { opacity: 1; transform: none; }
.dm-agent .ag-stat > span { color: var(--a-muted); font-size: 12.5px; }
.dm-agent .ag-stat b { color: var(--a-muted); font-size: 13px; font-weight: 500; }
.dm-agent .ag-stat .v {
  margin-right: 4px;
  color: var(--a-text);
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dm-agent .ag-stat.teal .v { color: var(--a-teal); }

/* Toast */
.dm-agent .ag-toast {
  position: absolute;
  z-index: 5;
  top: 66px;
  left: 470px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px 9px 12px;
  border: 1px solid rgba(45, 212, 191, 0.45);
  border-radius: 10px;
  background: #12261f;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.65);
  color: var(--a-text);
  font-size: 13.5px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -16px);
  transition: opacity 0.35s, transform 0.45s var(--a-ease);
}
.dm-agent .ag-toast svg { color: var(--a-teal); }
.dm-agent .ag-toast.on { opacity: 1; transform: translate(-50%, 0); }

@keyframes ag-spin { to { transform: rotate(360deg); } }
@keyframes ag-dot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
@keyframes ag-glow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.07), 0 0 10px rgba(45, 212, 191, 0.2); }
  50% { box-shadow: 0 0 0 5px rgba(45, 212, 191, 0.12), 0 0 20px rgba(45, 212, 191, 0.42); }
}
@keyframes ag-blink { 50% { opacity: 0.45; } }
