@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-sans-400.ttf") format("truetype");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-sans-500.ttf") format("truetype");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-sans-600.ttf") format("truetype");
}
:root {
  --bg: #ffffff;
  --sidebar: #fafafa;
  --ink: #202020;
  --secondary: #444444;
  --muted: #737373;
  --faint: #767676;
  --dim: #bbbbbb;
  --line: #e9e9e9;
  --control-border: #dddddd;
  --soft: #f4f4f4;
  --active: #eaeaea;
  --control-shadow: #00000003;
  --drawer-shadow: #0000000a;
  --toast-shadow: #0002;
  --backdrop: #0003;
  --radius: 5px;
  --font:
    "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
a,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  background: none;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--muted);
  outline-offset: 3px;
}
svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
button svg {
  pointer-events: none;
}
[hidden] {
  display: none !important;
}
.sidebar {
  width: 208px;
  height: 100dvh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 0 12px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 79px;
  padding: 0 9px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.8px;
}
.brand-mark {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--bg);
  font-size: 30px;
  line-height: 1;
  padding-bottom: 6px;
  letter-spacing: -3px;
}
.brand-mark span {
  color: var(--dim);
  font-size: 20px;
  margin-top: 12px;
}
.brand-caption {
  display: block;
  font-size: 9px;
  line-height: 1.3;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.2px;
}
.version {
  margin-left: auto;
  color: var(--faint);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
}
.workspace {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: var(--radius);
  margin: 0 3px 30px;
  padding: 10px 8px;
  font-size: 11px;
  font-weight: 500;
}
.workspace-icon {
  width: 27px;
  height: 27px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.workspace small,
.local-state small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}
.nav-caption {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--faint);
  padding: 0 11px;
  margin-bottom: 9px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 33px;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}
.nav-link svg {
  width: 15px;
  height: 15px;
}
.nav-link:hover {
  background: var(--active);
  color: var(--ink);
}
.nav-link.active {
  background: var(--active);
  color: var(--ink);
  font-weight: 500;
}
.nav-count {
  margin-left: auto;
  font-size: 10px;
  background: var(--bg);
  border: 1px solid var(--control-border);
  border-radius: 3px;
  min-width: 19px;
  text-align: center;
}
.sidebar-bottom {
  margin-top: auto;
  padding-bottom: 14px;
}
.external {
  margin-left: auto;
  font-size: 13px;
}
.local-state {
  border-top: 1px solid var(--line);
  margin: 16px 3px 0;
  padding: 17px 7px 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
}
.dot {
  width: 5px;
  height: 5px;
  background: var(--muted);
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.shell {
  margin-left: 208px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 49px;
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 11px;
  color: var(--muted);
}
.breadcrumb > svg {
  width: 14px;
  height: 14px;
  color: var(--faint);
}
.breadcrumb #breadcrumb-current {
  color: var(--secondary);
}
.slash {
  color: var(--dim);
}
.environment {
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--muted);
}
main {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 38px 38px 26px;
  flex: 1;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 30px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--faint);
  font-weight: 500;
  margin-bottom: 6px;
}
h1 {
  font-size: 25px;
  letter-spacing: -0.7px;
  font-weight: 500;
  line-height: 1.3;
  margin: 0 0 7px;
}
.page-heading p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.button {
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  height: 31px;
  padding: 0 11px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--bg);
  box-shadow: 0 1px 1px var(--control-shadow);
}
.button:hover {
  background: var(--soft);
}
.button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}
.button.primary:hover {
  background: var(--secondary);
}
.button svg {
  width: 13px;
  height: 13px;
}
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 20px 0 21px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 29px;
}
.summary > div {
  padding-left: 24px;
  border-left: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
}
.summary > div:first-child {
  padding-left: 0;
  border: 0;
}
.summary-label {
  color: var(--muted);
  font-size: 11px;
}
.summary-number {
  font-size: 25px;
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.summary-note {
  font-size: 10px;
  color: var(--faint);
}
.tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  height: 35px;
}
.tab {
  font-size: 11px;
  color: var(--muted);
  border: 0;
  padding: 0 0 12px;
  position: relative;
}
.tab.active {
  color: var(--ink);
  font-weight: 500;
}
.tab.active:after {
  content: "";
  height: 2px;
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  background: var(--ink);
}
.tab span {
  font-size: 9px;
  background: var(--soft);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 5px;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 12px;
}
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 30px;
  width: 280px;
  padding: 0 9px;
  color: var(--faint);
}
.search svg {
  width: 13px;
  height: 13px;
}
.search input {
  border: 0;
  outline: none !important;
  font-size: 11px;
  width: 100%;
  min-width: 0;
  background: transparent;
}
.search:focus-within {
  outline: 2px solid var(--faint);
  outline-offset: 1px;
}
.search input::placeholder {
  color: var(--faint);
}
.search kbd {
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
  color: var(--dim);
}
.sort {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
}
.sort svg {
  width: 13px;
  height: 13px;
}
.sort select {
  border: 0;
  background: transparent;
  max-width: 145px;
  font-size: 11px;
  cursor: pointer;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  font-size: 11px;
}
th {
  position: relative;
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
  background: var(--sidebar);
  height: 34px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
td {
  height: 65px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--soft);
}
tbody tr:last-child td {
  border: 0;
}
tbody tr:hover {
  background: var(--sidebar);
}
.row-name {
  display: flex;
  align-items: center;
  gap: 11px;
}
.row-avatar {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar);
  color: var(--muted);
}
.row-title {
  border: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}
.row-title:hover {
  text-decoration: underline;
}
.row-description {
  font-size: 10px;
  color: var(--faint);
  max-width: 270px;
  text-overflow: ellipsis;
  overflow: hidden;
  margin-top: 2px;
}
.mono {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  color: var(--muted);
}
.status {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  font-size: 10px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: var(--sidebar);
}
.status .dot {
  width: 4px;
  height: 4px;
}
.status.ready {
  color: var(--secondary);
  background: var(--soft);
  border-color: var(--control-border);
}
.status.ready .dot {
  background: var(--secondary);
}
.status.draft .dot {
  background: none;
  border: 1px solid var(--faint);
  width: 5px;
  height: 5px;
}
.status.paused .dot {
  border-radius: 0;
  background: var(--faint);
  width: 4px;
  height: 5px;
}
.number-cell {
  color: var(--muted);
  font-size: 11px;
}
.icon-button {
  border: 0;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--faint);
}
.icon-button:hover {
  background: var(--active);
  color: var(--ink);
}
.icon-button svg {
  width: 14px;
  height: 14px;
}
.table-footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  color: var(--faint);
  font-size: 10px;
}
.footer-divider {
  color: var(--dim);
  margin: 0 8px;
}
.note {
  margin-top: 24px;
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
}
.note > svg {
  width: 14px;
  height: 14px;
  color: var(--faint);
}
.note p {
  margin: 0;
}
.note p span {
  color: var(--faint);
}
.note a {
  margin-left: auto;
  white-space: nowrap;
  color: var(--muted);
}
.note a:hover {
  text-decoration: underline;
}
.note a span {
  margin-left: 5px;
}
.page-footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 15px 38px;
  font-size: 9px;
  color: var(--faint);
}
.page-footer > span:first-child {
  color: var(--muted);
}
.empty {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 30px;
  color: var(--faint);
}
.empty-symbol {
  border: 1px solid var(--line);
  border-radius: 9px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: var(--sidebar);
  color: var(--muted);
}
.empty-symbol svg {
  width: 20px;
  height: 20px;
}
.empty h2 {
  font-size: 13px;
  color: var(--secondary);
  font-weight: 500;
  margin: 0 0 5px;
}
.empty p {
  font-size: 11px;
  max-width: 310px;
  margin: 0 0 17px;
  color: var(--faint);
}
.empty-actions {
  display: flex;
  gap: 7px;
}
.error-banner,
.form-error {
  padding: 10px;
  background: var(--sidebar);
  border: 1px solid var(--dim);
  border-radius: 4px;
  font-size: 11px;
  margin-bottom: 12px;
}
.settings-panel {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 20px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.setting-row:last-child {
  border: 0;
}
.setting-row span {
  color: var(--muted);
}
.setting-row a {
  text-decoration: underline;
}
dialog#editor {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  border: 0;
  border-left: 1px solid var(--control-border);
  padding: 0;
  width: 540px;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  box-shadow: -10px 0 50px var(--drawer-shadow);
}
dialog::backdrop {
  background: var(--backdrop);
}
#editor-form {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.drawer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 23px 25px;
  border-bottom: 1px solid var(--line);
}
.drawer-heading h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.4px;
}
.drawer-body {
  overflow: auto;
  padding: 22px 25px;
  flex: 1;
}
.editor-intro {
  margin: 0 0 23px;
  font-size: 12px;
  color: var(--muted);
}
.field {
  display: block;
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 16px;
}
.field input,
.field textarea,
.field select,
#config-json {
  display: block;
  width: 100%;
  border: 1px solid var(--control-border);
  background: var(--bg);
  border-radius: 4px;
  padding: 8px 9px;
  margin-top: 6px;
  font-size: 12px;
}
.field textarea {
  resize: vertical;
}
.optional {
  font-size: 10px;
  color: var(--faint);
  font-weight: 400;
  margin-left: 4px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.config-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
}
.text-button {
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 10px;
}
.text-button:hover {
  text-decoration: underline;
}
.field-help {
  font-size: 10px;
  color: var(--faint);
  margin: 6px 0 9px;
}
#config-json {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.6;
  resize: vertical;
  background: var(--sidebar);
  tab-size: 2;
}
.drawer-footer {
  padding: 16px 25px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-actions {
  display: flex;
  gap: 7px;
  margin-left: auto;
}
.danger {
  color: var(--muted);
}
.danger:hover {
  border-color: var(--muted);
}
#delete-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  max-width: 360px;
  width: calc(100% - 32px);
}
#delete-dialog h2 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 8px;
}
#delete-dialog p {
  font-size: 12px;
  color: var(--muted);
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: calc(50% + 104px);
  transform: translateX(-50%);
  padding: 10px 17px;
  background: var(--ink);
  color: white;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 3px 15px var(--toast-shadow);
  z-index: 10;
}
@media (min-width: 1600px) {
  main {
    padding-top: 48px;
  }
}
@media (max-width: 1000px) {
  main {
    padding: 28px 24px;
  }
  .topbar {
    padding: 0 24px;
  }
  .sidebar {
    width: 184px;
  }
  .shell {
    margin-left: 184px;
  }
  .note p span {
    display: none;
  }
  .summary > div {
    padding-left: 15px;
  }
  .summary-note {
    font-size: 9px;
  }
  .row-description {
    max-width: 190px;
  }
}
@media (max-width: 700px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 0 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    height: 58px;
    padding: 0 2px;
    max-width: 180px;
  }
  .brand-caption,
  .workspace,
  .nav-caption,
  .sidebar-bottom {
    display: none;
  }
  .sidebar nav {
    display: flex;
    gap: 8px;
    padding-bottom: 7px;
  }
  .nav-link {
    font-size: 11px;
    min-height: 30px;
  }
  .nav-count {
    margin-left: 4px;
  }
  .shell {
    margin: 0;
    min-height: calc(100dvh - 98px);
  }
  .topbar {
    padding: 0 20px;
    height: 40px;
  }
  main {
    padding: 24px 20px;
  }
  .page-heading {
    align-items: flex-start;
    margin-bottom: 23px;
  }
  .page-heading p {
    font-size: 11px;
    max-width: 225px;
  }
  .page-heading .button {
    font-size: 10px;
    padding: 0 8px;
    margin-top: 20px;
  }
  h1 {
    font-size: 23px;
  }
  .summary {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 20px;
    margin-bottom: 22px;
    padding: 17px 0;
  }
  .summary > div:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }
  .summary-note {
    font-size: 10px;
  }
  .summary-number {
    font-size: 23px;
  }
  .tabs {
    gap: 19px;
  }
  .toolbar {
    gap: 12px;
  }
  .search {
    width: 100%;
    max-width: 270px;
  }
  .search kbd {
    display: none;
  }
  .sort select {
    font-size: 10px;
    max-width: 100px;
  }
  .note {
    align-items: flex-start;
    margin-top: 20px;
  }
  .note a {
    font-size: 9px;
  }
  .table-footer > span:last-child {
    display: none;
  }
  .page-footer {
    padding: 13px 20px;
  }
  .page-footer > span:last-child {
    display: none;
  }
  #toast {
    left: 50%;
    max-width: 90vw;
    white-space: nowrap;
  }
  .drawer-heading {
    padding: 18px 20px;
  }
  .drawer-body {
    padding: 20px;
  }
  .drawer-footer {
    padding: 15px 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.form-error {
  white-space: pre-line;
}

.mobile-settings {
  display: none;
}
@media (max-width: 700px) {
  .mobile-settings {
    display: flex;
    margin-left: auto;
  }
}

.creation-note {
  margin: -5px 0 18px;
}
.advanced-config {
  border-top: 1px solid var(--line);
  margin-top: 22px;
}
.advanced-config summary {
  padding: 14px 0;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}
.advanced-config summary:focus-visible {
  outline: 2px solid var(--muted);
  outline-offset: 3px;
}
.advanced-body {
  padding-bottom: 5px;
}

/* Full-page agent workspace; the creation dialog remains a separate flow. */
.canvas-mode {
  overflow: hidden;
}
.canvas-mode > .sidebar,
.canvas-mode > .shell {
  display: none;
}
.agent-workspace {
  position: fixed;
  inset: 0;
  background: var(--bg);
  --inspector-space: 0px;
}
.inspector-open .agent-workspace {
  --inspector-space: 400px;
}
.workspace-header {
  position: absolute;
  inset: 0 0 auto;
  height: 54px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 23px;
  background: var(--bg);
  z-index: 2;
}
.workspace-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}
.workspace-back:hover {
  color: var(--ink);
}
.workspace-back svg {
  width: 14px;
  height: 14px;
}
.workspace-separator {
  color: var(--dim);
}
.workspace-header h1 {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  margin: 0;
  max-width: 35vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-caption {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
}
.agent-canvas {
  position: absolute;
  inset: 54px var(--inspector-space) 0 0;
  overflow: hidden;
  touch-action: none;
  background-color: var(--bg);
  background-image:
    linear-gradient(
      to right,
      color-mix(in srgb, var(--line) 55%, transparent) 1px,
      transparent 1px
    ),
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--line) 55%, transparent) 1px,
      transparent 1px
    );
  background-size: 24px 24px;
}
.agent-canvas:focus-visible {
  outline-offset: -3px;
}
.agent-node {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 248px;
  padding: 17px 17px 0;
  background: var(--bg);
  border: 1px solid var(--control-border);
  border-radius: 9px;
  box-shadow: 0 3px 12px var(--drawer-shadow);
  text-align: left;
  display: flex;
  flex-direction: column;
  transform: translate(-50%, -50%);
  transform-origin: center;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.agent-node:hover {
  border-color: var(--dim);
}
.agent-node[aria-expanded="true"] {
  border-color: var(--muted);
  outline: 2px solid var(--line);
  outline-offset: 3px;
}
.node-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
}
.node-top > svg:first-child {
  width: 26px;
  height: 26px;
  padding: 5px;
  box-sizing: content-box;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.node-type {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
}
.node-top > svg:last-child {
  margin-left: auto;
  color: var(--dim);
  width: 13px;
}
.node-name {
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.node-objective {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0 17px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.node-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: calc(100% + 34px);
  margin: auto -17px 0;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 9px;
  color: var(--muted);
}
.node-footer > span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--secondary);
}
.node-footer svg {
  width: 11px;
  height: 11px;
}
.canvas-tools,
.canvas-controls {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 2px 8px var(--drawer-shadow);
}
.canvas-tools {
  top: 73px;
  left: calc((100% - var(--inspector-space)) / 2);
  transform: translateX(-50%);
}
.canvas-tools .icon-button {
  width: 30px;
  height: 29px;
}
.canvas-tools .active {
  background: var(--active);
  color: var(--ink);
}
.canvas-controls {
  bottom: 19px;
  left: 20px;
}
.canvas-controls .icon-button {
  height: 27px;
  width: 27px;
}
.zoom-level {
  width: 45px;
  border: 0;
  font-size: 10px;
  padding: 4px 0;
  color: var(--muted);
  border-radius: 4px;
}
.zoom-level:hover {
  background: var(--soft);
}
.control-divider {
  width: 1px;
  height: 17px;
  background: var(--line);
  margin: 0 3px;
}
.canvas-help {
  position: absolute;
  right: calc(23px + var(--inspector-space));
  bottom: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
}
.canvas-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  align-content: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  padding: 25px;
  text-align: center;
}
.canvas-message p {
  flex-basis: 100%;
}
.hand-tool,
.hand-tool .agent-node {
  cursor: grab;
}
.agent-canvas.dragging,
.agent-canvas.dragging .agent-node {
  cursor: grabbing;
}
.canvas-mode dialog#editor {
  top: 54px;
  bottom: 0;
  width: 400px;
  height: calc(100dvh - 54px);
  max-height: calc(100dvh - 54px);
  box-shadow: none;
}
.canvas-mode .drawer-heading {
  padding: 20px;
}
.canvas-mode .drawer-heading h2 {
  font-size: 16px;
}
.canvas-mode .drawer-body {
  padding: 20px;
}
.canvas-mode .drawer-footer {
  padding: 14px 20px;
}
.canvas-mode #toast {
  left: calc((100% - 0px) / 2);
  z-index: 5;
}
@media (max-width: 700px) {
  .workspace-header {
    padding: 0 15px;
    gap: 9px;
  }
  .workspace-header h1 {
    max-width: 40vw;
  }
  .workspace-caption {
    display: none;
  }
  .canvas-help {
    left: 20px;
    right: 20px;
    bottom: 68px;
    text-align: center;
    font-size: 9px;
  }
  .inspector-open .agent-workspace {
    --inspector-space: 0px;
  }
  .canvas-mode dialog#editor {
    top: auto;
    bottom: 0;
    width: 100%;
    height: 72dvh;
    max-height: 72dvh;
    border-top: 1px solid var(--control-border);
    border-left: 0;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -5px 24px var(--drawer-shadow);
  }
  .canvas-controls {
    bottom: 17px;
    left: 15px;
  }
}

/* Reusable components and personality atelier. Color lives in the portrait coins. */
.components-nav {
  margin: 5px 0;
}
.components-nav > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
}
.components-nav > summary::-webkit-details-marker {
  display: none;
}
.components-nav > summary:hover {
  background: var(--soft);
}
.components-nav > summary:focus-visible {
  outline: 2px solid var(--muted);
  outline-offset: 2px;
}
.components-nav > summary svg {
  width: 15px;
  height: 15px;
}
.components-chevron {
  margin-left: auto;
  transition: transform 0.15s;
}
.components-nav:not([open]) .components-chevron {
  transform: rotate(-90deg);
}
.component-subnav {
  margin: 3px 0 7px 17px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.component-subnav .nav-link {
  font-size: 11px;
}
.personality-view .summary,
.personality-view .registry,
.personality-view main > .note {
  display: none;
}
.personality-intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 25px 0;
  margin-bottom: 23px;
  gap: 20px;
}
.personality-intro h2 {
  font-size: 19px;
  letter-spacing: -0.4px;
  font-weight: 500;
  margin: 4px 0 6px;
}
.personality-intro p {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}
.intro-coins {
  display: flex;
  padding-right: 8px;
}
.intro-coins img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin-left: -9px;
  border: 3px solid var(--bg);
  transform: rotate(-8deg);
}
.intro-coins img:nth-child(2) {
  transform: translateY(-6px) rotate(7deg);
}
.personality-library-tools {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 28px;
}
#personality-library-count {
  font-size: 10px;
  color: var(--muted);
}
.personality-library-tools > button {
  margin-left: auto;
}
.personality-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 22px 15px;
  align-items: start;
}
.personality-library-item {
  display: flex;
  align-items: center;
  flex-direction: column;
  border: 1px solid transparent;
  background: transparent;
  padding: 17px 5px;
  border-radius: 10px;
  min-width: 0;
}
.personality-library-item:hover {
  background: var(--sidebar);
  border-color: var(--line);
}
.avatar-coin {
  display: inline-flex;
  position: relative;
  border-radius: 50%;
  padding: 4px;
  border: 1px solid var(--control-border);
  background: var(--bg);
  box-shadow:
    0 3px 0 var(--line),
    0 5px 12px var(--drawer-shadow);
}
.avatar-coin img {
  display: block;
  width: 78px;
  height: 78px;
  border-radius: 50%;
}
.personality-library-item:hover .avatar-coin {
  transform: translateY(-3px) rotate(-4deg);
}
.personality-coin-name {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-top: 11px;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}
.personality-coin-traits {
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
}
.personality-edit-hint {
  font-size: 9px;
  color: var(--muted);
  margin-top: 8px;
  opacity: 0;
}
.personality-library-item:hover .personality-edit-hint,
.personality-library-item:focus-visible .personality-edit-hint {
  opacity: 1;
}
.personality-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 42px 20px 50px;
  border: 1px dashed var(--control-border);
  border-radius: 7px;
}
.personality-empty h3 {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.25px;
  margin: 14px 0 7px;
}
.personality-empty p {
  color: var(--muted);
  font-size: 11px;
  margin: 0 0 18px;
}
.empty-portrait-row {
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-portrait-row img {
  width: 65px;
  height: 65px;
  margin: 0 -3px;
  border: 3px solid var(--bg);
  border-radius: 50%;
}
.empty-portrait-row img:nth-child(2) {
  width: 78px;
  height: 78px;
  margin-top: -8px;
}
.personality-starters {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 21px;
}
.personality-starters button {
  font-size: 10px;
  padding: 7px 10px;
  background: var(--sidebar);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
}
.personality-starters button:hover {
  border-color: var(--dim);
  color: var(--ink);
}
#personality-editor {
  width: 860px;
  max-width: calc(100% - 36px);
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 15px 70px var(--toast-shadow);
}
#personality-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 42px);
}
.personality-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 25px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.personality-dialog-header h2 {
  font-size: 19px;
  margin: 2px 0 0;
  font-weight: 500;
  letter-spacing: -0.4px;
}
.personality-dialog-body {
  display: grid;
  grid-template-columns: 254px 1fr;
  overflow: auto;
  min-height: 0;
}
.personality-dressing-room {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 28px 23px 23px;
  text-align: center;
}
.personality-preview-coin {
  display: inline-flex;
  padding: 6px;
  border-radius: 50%;
  border: 1px solid var(--control-border);
  background: var(--bg);
  box-shadow:
    0 5px 0 var(--line),
    0 8px 18px var(--drawer-shadow);
  transform: rotate(-5deg);
}
.personality-preview-coin img {
  width: 112px;
  height: 112px;
  display: block;
  border-radius: 50%;
}
.personality-dressing-room h3 {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  margin: 21px 0 5px;
  overflow-wrap: anywhere;
}
.personality-dressing-room > p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
  margin: 0;
}
.personality-preview-traits {
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 13px;
  min-height: 45px;
}
.personality-preview-traits span {
  font-size: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 12px;
  padding: 3px 7px;
  align-self: start;
  animation: personality-pop 0.18s ease-out;
}
@keyframes personality-pop {
  from {
    transform: scale(0.85);
    opacity: 0.5;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.avatar-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  margin: 24px 0 10px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
.avatar-heading > span:last-child {
  font-size: 9px;
  color: var(--muted);
}
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.avatar-picker button {
  padding: 2px;
  border: 1px solid transparent;
  border-radius: 50%;
  line-height: 0;
  background: var(--bg);
}
.avatar-picker button img {
  width: 100%;
  border-radius: 50%;
}
.avatar-picker button:hover {
  transform: translateY(-2px);
}
.avatar-picker button[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--bg);
}
.shuffle-personality {
  width: 100%;
  margin-top: 16px;
  background: var(--bg);
  font-size: 10px;
}
.personality-fields {
  padding: 24px;
  min-width: 0;
}
.personality-field-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  margin: 0 0 8px;
}
.personality-field-heading > span:last-child {
  font-size: 9px;
  color: var(--muted);
  font-weight: 400;
}
.markdown-editor {
  border: 1px solid var(--control-border);
  border-radius: 6px;
  overflow: hidden;
}
.markdown-tabs {
  display: flex;
  align-items: center;
  padding: 5px;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  background: var(--sidebar);
}
.markdown-tabs button {
  border: 0;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--muted);
}
.markdown-tabs button:hover,
.markdown-tabs button.active {
  color: var(--ink);
  background: var(--bg);
}
.markdown-formatting {
  display: flex;
  margin-left: auto;
}
.markdown-formatting button {
  padding: 4px 6px;
}
#personality-description {
  display: block;
  width: 100%;
  min-height: 190px;
  max-height: 360px;
  border: 0;
  padding: 12px;
  font-family: var(--font);
  font-size: 11px;
  line-height: 1.7;
  resize: vertical;
  background: var(--bg);
}
#personality-description::placeholder {
  color: var(--faint);
}
.markdown-preview {
  min-height: 190px;
  max-height: 360px;
  overflow: auto;
  padding: 12px 15px;
  font-size: 11px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  margin: 8px 0;
}
.markdown-preview p {
  margin: 0 0 9px;
}
.markdown-preview ul,
.markdown-preview ol {
  padding-left: 20px;
}
.markdown-preview a {
  text-decoration: underline;
}
.markdown-preview blockquote {
  border-left: 2px solid var(--line);
  padding-left: 10px;
  margin-left: 0;
  color: var(--muted);
}
.markdown-preview pre {
  padding: 8px;
  background: var(--soft);
  border-radius: 4px;
  white-space: pre-wrap;
}
.markdown-placeholder {
  color: var(--muted);
}
.traits-heading {
  margin-top: 22px;
  margin-bottom: 5px;
}
.personality-fields .field-help {
  margin-bottom: 12px;
}
.trait-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.trait-picker button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--control-border);
  border-radius: 20px;
  padding: 5px 9px;
  font-size: 10px;
  background: var(--bg);
  color: var(--muted);
}
.trait-picker button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.trait-picker button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--muted);
}
.trait-plus {
  width: 9px;
  font-size: 11px;
}
#personality-form-error {
  margin-top: 15px;
  margin-bottom: 0;
}
.personality-dialog-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.personality-dialog-footer > span {
  margin-right: auto;
  font-size: 10px;
  color: var(--muted);
}
.workspace-components-button {
  margin-left: auto;
  height: 29px;
  font-size: 10px;
}
.agent-workspace {
  --component-space: 0px;
}
.components-open .agent-workspace {
  --component-space: 280px;
}
.agent-canvas {
  left: var(--component-space);
}
.canvas-tools {
  left: calc((100% + var(--component-space) - var(--inspector-space)) / 2);
}
.canvas-controls {
  left: calc(20px + var(--component-space));
}
.agent-components {
  position: absolute;
  left: 16px;
  top: 72px;
  bottom: 78px;
  width: 250px;
  padding: 18px 14px 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 9px;
  box-shadow: 0 3px 15px var(--drawer-shadow);
  overflow: auto;
}
.component-tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.component-tray-header h2 {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}
.component-tray-header .eyebrow {
  font-size: 8px;
}
.component-tray-help {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.7;
  margin: 15px 0 20px;
}
.personality-selection {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 19px 6px;
  align-items: start;
}
.personality-option {
  border: 0;
  padding: 0;
  background: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.personality-option .avatar-coin {
  padding: 2px;
}
.personality-option .avatar-coin img {
  width: 52px;
  height: 52px;
  filter: grayscale(1);
  opacity: 0.6;
}
.personality-option .personality-coin-name {
  font-size: 10px;
  margin-top: 8px;
  font-weight: 400;
}
.personality-use-state {
  font-size: 8px;
  color: var(--muted);
  margin-top: 3px;
}
.personality-option.selected .avatar-coin {
  border-color: var(--ink);
}
.personality-option.selected .avatar-coin img {
  filter: none;
  opacity: 1;
}
.personality-option.selected .personality-coin-name {
  font-weight: 500;
}
.personality-option:hover .avatar-coin {
  transform: translateY(-2px);
}
.coin-check {
  display: none;
  position: absolute;
  right: -2px;
  bottom: 0;
  width: 17px;
  height: 17px;
  background: var(--ink);
  border: 2px solid var(--bg);
  border-radius: 50%;
  color: var(--bg);
  font-size: 9px;
  line-height: 13px;
}
.selected .coin-check {
  display: block;
}
#personality-selection-status {
  margin: 20px 0 15px;
  font-size: 9px;
}
.component-selection-empty {
  grid-column: 1/-1;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
  padding: 30px 8px;
  background: var(--sidebar);
  border-radius: 6px;
}
.component-tray-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 10px;
}
.component-tray-footer a {
  text-align: center;
  font-size: 9px;
  color: var(--muted);
}
.node-personalities {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -3px 0 14px;
  font-size: 9px;
  color: var(--muted);
}
.node-personality-stack {
  display: flex;
  padding-left: 0;
}
.node-personality-stack img {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  margin-left: -6px;
}
.node-personality-stack img:first-child {
  margin-left: 0;
}
.avatar-coin,
.avatar-picker button,
.trait-picker button {
  transition:
    transform 0.15s ease,
    filter 0.15s ease;
}
@media (max-width: 900px) {
  .personality-dialog-body {
    grid-template-columns: 220px 1fr;
  }
  .personality-dressing-room {
    padding: 24px 18px;
  }
}
@media (max-width: 700px) {
  .sidebar nav {
    flex-wrap: wrap;
  }
  .components-nav {
    order: 3;
    width: 100%;
    margin: 0;
  }
  .components-nav > summary {
    font-size: 10px;
    padding: 5px 10px;
  }
  .component-subnav {
    display: flex;
    gap: 6px;
    margin: 0;
    padding-left: 0;
    border-left: 0;
    flex-wrap: wrap;
  }
  .component-subnav .nav-link {
    font-size: 10px;
    padding: 5px 8px;
  }
  .components-chevron {
    margin-left: 5px;
  }
  .personality-intro {
    padding: 20px 0;
    gap: 10px;
  }
  .personality-intro h2 {
    font-size: 17px;
  }
  .intro-coins {
    display: none;
  }
  .personality-library-tools {
    flex-wrap: wrap;
    gap: 10px;
  }
  .personality-library-tools .search {
    max-width: none;
    width: 100%;
  }
  #personality-library-count {
    margin-right: auto;
  }
  .personality-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .personality-starters {
    gap: 7px;
  }
  .personality-starters button {
    font-size: 9px;
  }
  #personality-editor {
    max-width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 9px;
  }
  #personality-form {
    max-height: calc(100dvh - 18px);
  }
  .personality-dialog-header {
    padding: 16px;
  }
  .personality-dialog-header h2 {
    font-size: 17px;
  }
  .personality-dialog-body {
    display: block;
  }
  .personality-dressing-room {
    padding: 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .personality-preview-coin img {
    width: 87px;
    height: 87px;
  }
  .personality-dressing-room h3 {
    margin-top: 16px;
  }
  .personality-preview-traits {
    min-height: 0;
  }
  .avatar-heading {
    margin-top: 18px;
  }
  .avatar-picker {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
  }
  .shuffle-personality {
    width: auto;
  }
  .personality-fields {
    padding: 20px;
  }
  .personality-dialog-footer {
    padding: 13px 15px;
  }
  .personality-dialog-footer > span {
    display: none;
  }
  .components-open .agent-workspace {
    --component-space: 0px;
  }
  .agent-components {
    left: 15px;
    right: 15px;
    width: auto;
    bottom: auto;
    max-height: calc(100dvh - 155px);
    top: 70px;
    padding: 16px;
    z-index: 3;
  }
  .personality-selection {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .canvas-controls {
    left: 15px;
  }
  .workspace-components-button {
    padding: 0 7px;
    font-size: 9px;
  }
  .workspace-header h1 {
    max-width: 24vw;
  }
  .workspace-back {
    font-size: 10px;
  }
  .workspace-header {
    gap: 7px;
  }
  .workspace-header .status {
    font-size: 8px;
    padding: 2px 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .avatar-coin,
  .avatar-picker button,
  .trait-picker button,
  .components-chevron {
    transition: none;
  }
  .personality-preview-traits span {
    animation: none;
  }
}

/* Personality wiring shares the canvas coordinate system. */
.personality-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.personality-link {
  stroke: var(--dim);
  stroke-width: 1.5;
  fill: none;
  vector-effect: non-scaling-stroke;
}
.personality-links circle {
  fill: var(--bg);
  stroke: var(--muted);
  stroke-width: 1.3;
}
.personality-nodes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.personality-canvas-node {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 112px;
  height: 102px;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  cursor: grab;
  pointer-events: auto;
  user-select: none;
  touch-action: none;
}
.personality-canvas-node .avatar-coin {
  padding: 3px;
}
.personality-canvas-node .avatar-coin img {
  width: 56px;
  height: 56px;
}
.linked-personality-name {
  display: block;
  max-width: 110px;
  font-size: 10px;
  font-weight: 500;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--bg);
  border-radius: 3px;
  padding: 0 3px;
}
.linked-personality-type {
  font-size: 8px;
  color: var(--muted);
  background: var(--bg);
  margin-top: 2px;
  border-radius: 3px;
  padding: 0 3px;
}
.personality-canvas-node:hover .avatar-coin {
  border-color: var(--muted);
}
.agent-canvas.dragging .personality-canvas-node,
.hand-tool .personality-canvas-node {
  cursor: grabbing;
}
.personality-option {
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.personality-option img,
.personality-canvas-node img {
  -webkit-user-drag: none;
}
.personality-drag-active,
.personality-drag-active * {
  cursor: grabbing !important;
  user-select: none !important;
}
.personality-drag-active .agent-components {
  pointer-events: none;
}
.personality-drag-source {
  opacity: 0.35;
}
.personality-drag-ghost {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  transform: translate(-50%, -65%);
  max-width: 140px;
}
.personality-drag-ghost img {
  width: 64px;
  height: 64px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  box-shadow: 0 5px 20px var(--toast-shadow);
  transform: rotate(-8deg);
}
.personality-drag-ghost span {
  font-size: 10px;
  background: var(--ink);
  color: var(--bg);
  padding: 3px 8px;
  border-radius: 12px;
  margin-top: 4px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 140px;
}
.personality-drop-target {
  outline: 2px dashed var(--muted);
  outline-offset: 7px;
  box-shadow: 0 0 0 10px var(--soft);
}
.personality-drop-target::after {
  content: "Solte para conectar";
  position: absolute;
  bottom: -34px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--bg);
  background: var(--ink);
  border-radius: 12px;
  padding: 4px 10px;
  white-space: nowrap;
}
.agent-node[aria-busy="true"] {
  border-style: dashed;
}
@media (max-width: 700px) {
  .personality-drag-active .agent-components {
    opacity: 0.12;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .personality-canvas-node {
    animation: connected-personality 0.2s ease-out;
  }
  @keyframes connected-personality {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}

.canvas-marquee {
  position: absolute;
  z-index: 4;
  border: 1px solid var(--muted);
  background: color-mix(in srgb, var(--muted) 9%, transparent);
  border-radius: 2px;
  pointer-events: none;
}
.agent-node.canvas-selected {
  outline: 2px solid var(--muted);
  outline-offset: 5px;
}
.personality-canvas-node.canvas-selected .avatar-coin {
  outline: 2px solid var(--muted);
  outline-offset: 4px;
}
.personality-link.canvas-selected-link {
  stroke: var(--muted);
  stroke-width: 2;
}
.canvas-selection-actions {
  position: absolute;
  top: 122px;
  left: calc((100% + var(--component-space) - var(--inspector-space)) / 2);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px 6px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 2px 8px var(--drawer-shadow);
  white-space: nowrap;
}
#canvas-selection-count {
  font-size: 10px;
  color: var(--muted);
}
.canvas-selection-actions .button {
  height: 27px;
  font-size: 10px;
}
#canvas-selection-error {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  white-space: normal;
  margin: 0;
}
@media (max-width: 700px) {
  .canvas-selection-actions {
    max-width: calc(100% - 24px);
    gap: 6px;
    padding: 5px 6px 5px 9px;
  }
  #canvas-selection-count {
    font-size: 9px;
  }
  .canvas-selection-actions .button {
    font-size: 9px;
    padding: 0 7px;
  }
}

.canvas-context-menu {
  position: fixed;
  z-index: 10;
  min-width: 180px;
  padding: 5px;
  background: var(--bg);
  border: 1px solid var(--control-border);
  border-radius: 6px;
  box-shadow: 0 6px 24px var(--toast-shadow);
}
.canvas-context-menu button {
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 4px;
  text-align: left;
  font-size: 11px;
}
.canvas-context-menu button:hover:not(:disabled),
.canvas-context-menu button:focus-visible {
  background: var(--soft);
  outline-offset: -1px;
}
.canvas-context-menu button:disabled {
  cursor: default;
  opacity: 0.45;
}
.canvas-context-menu button span {
  font-size: 10px;
  color: var(--muted);
}

/* Biblioteca: capas compactas, sumário lateral e página de leitura. */
.book-view .summary,
.book-view .registry,
.book-view main > .note {
  display: none;
}
.book-open .page-heading {
  display: none;
}
.book-open main {
  padding-top: 20px;
}
@media (min-width: 701px) {
  .book-open .book-workspace {
    min-height: max(590px, calc(100dvh - 185px));
  }
}
.book-library {
  min-width: 0;
}
.book-shelf-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 0 30px;
  border-top: 1px solid var(--line);
}
.book-shelf-heading h2 {
  margin: 8px 0;
  font-size: 21px;
  font-weight: 500;
  max-width: 440px;
  line-height: 1.3;
}
.book-shelf-heading p {
  margin: 0;
  color: var(--muted);
  max-width: 440px;
  font-size: 12px;
}
.book-shelf-mark {
  display: grid;
  place-items: center;
  width: 94px;
  height: 94px;
  background: var(--sidebar);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.book-shelf-mark svg {
  width: 38px;
  height: 38px;
  stroke-width: 1;
  color: var(--muted);
}
.book-library-tools {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}
.book-library-tools .search {
  flex: 1;
  max-width: 380px;
}
.book-library-tools > button {
  margin-left: auto;
}
.book-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 220px));
  gap: 16px;
}
.book-shelf > .empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--control-border);
  border-radius: var(--radius);
}
.book-cover {
  display: flex;
  flex-direction: column;
  min-height: 180px;
  padding: 16px 16px 14px 22px;
  border: 1px solid var(--control-border);
  border-radius: 3px 7px 7px 3px;
  background: var(--sidebar);
  position: relative;
  box-shadow:
    3px 3px 0 var(--bg),
    4px 4px 0 var(--line);
  overflow-wrap: anywhere;
}
.book-cover::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 7px;
  border-left: 1px solid var(--line);
}
.book-cover:hover {
  border-color: var(--muted);
  background: var(--soft);
}
.book-cover-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.book-cover h3 {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  margin: 16px 0 6px;
}
.book-cover p {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 16px;
}
.book-cover-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  margin-top: auto;
  font-size: 10px;
  color: var(--secondary);
}
.book-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
#book-save-state {
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
}
.book-workspace {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  min-height: 590px;
}
.book-contents {
  padding: 24px 14px 18px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.book-contents-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.05em;
}
.book-contents h2 {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
  margin: 16px 0 8px;
  overflow-wrap: anywhere;
}
.book-contents > p {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 24px;
  overflow-wrap: anywhere;
}
.book-contents-label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.05em;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.book-contents > .book-reorder-help {
  font-size: 9px;
  margin: 5px 0 14px;
}
#book-chapters {
  max-height: 410px;
  overflow-y: auto;
}
.book-chapter-row {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  margin-bottom: 4px;
  padding-right: 3px;
}
.book-chapter-row:hover {
  background: var(--soft);
}
.book-chapter-row.active {
  background: var(--active);
}
.book-drag {
  display: flex;
  padding: 10px 1px;
  color: var(--dim);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.book-drag svg {
  width: 13px;
}
.book-chapter-row [role="tab"] {
  display: flex;
  text-align: left;
  gap: 8px;
  align-items: baseline;
  border: 0;
  padding: 10px 3px;
  font-size: 11px;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.chapter-number {
  color: var(--muted);
  font-size: 9px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.chapter-movers {
  display: flex;
  flex-direction: column;
}
.chapter-movers .icon-button {
  width: 20px;
  height: 19px;
  padding: 0;
  font-size: 10px;
}
.chapter-movers button:disabled {
  cursor: default;
  opacity: 0.25;
}
.book-chapter-row.drop-target {
  border-color: var(--ink);
  border-top-width: 2px;
}
.book-chapter-row.is-dragging {
  opacity: 0.45;
}
.book-add-chapter {
  margin-top: 12px;
  justify-content: center;
  border-style: dashed;
  font-size: 11px;
}
.book-delete-link {
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 10px;
  color: var(--muted);
  padding: 8px 0;
  align-self: flex-start;
}
.book-contents > .book-delete-link {
  margin-top: auto;
  padding-top: 30px;
}
.book-page {
  min-width: 0;
  padding: 25px 36px 20px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.book-page-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.book-edit-link {
  font-size: 10px;
  border-color: transparent;
  padding: 4px 5px;
}
.book-edit-link svg {
  width: 13px;
  height: 13px;
}
.book-edit-link kbd {
  font-size: 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 3px;
  letter-spacing: 0;
}
.book-chapter-title {
  font-size: 24px;
  line-height: 1.35;
  font-weight: 500;
  margin: 30px 0 22px;
  overflow-wrap: anywhere;
}
.book-title-input {
  width: 100%;
  min-width: 0;
  margin: 24px 0 16px;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-size: 24px;
  background: var(--bg);
}
.book-reading.markdown-preview {
  padding: 0;
  font-size: 13px;
  line-height: 1.85;
  max-height: none;
  min-height: 280px;
  overflow: visible;
}
.book-reading h1,
.book-reading h2,
.book-reading h3 {
  font-size: 18px;
  line-height: 1.45;
  margin: 22px 0 12px;
}
.book-reading p {
  margin-bottom: 14px;
}
.book-reading hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
.book-reading code {
  font-size: 11px;
  background: var(--soft);
  padding: 2px 3px;
}
.book-blank-page {
  padding: 45px 0;
  color: var(--muted);
}
.book-markdown-editor {
  margin-top: 4px;
}
.book-markdown-editor .markdown-tabs > span {
  padding-left: 8px;
  font-size: 10px;
  color: var(--muted);
}
#chapter-content {
  display: block;
  width: 100%;
  min-height: 330px;
  resize: vertical;
  border: 0;
  padding: 16px;
  background: var(--bg);
  font:
    12px/1.85 ui-monospace,
    monospace;
}
.book-writing-help {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 9px;
  padding: 8px 0;
}
.book-page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 28px;
  font-size: 10px;
  color: var(--muted);
}
.book-page-footer .button {
  font-size: 10px;
}
.book-page-footer button:disabled {
  cursor: default;
}
#book-dialog {
  width: min(460px, calc(100% - 32px));
  border: 1px solid var(--control-border);
  border-radius: 8px;
  padding: 26px;
}
#book-dialog::backdrop {
  background: var(--backdrop);
}
#book-dialog fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.book-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.book-dialog-header h2 {
  margin: 4px 0 14px;
  font-size: 22px;
  font-weight: 500;
}
#book-dialog label {
  display: block;
  font-size: 12px;
  margin-top: 18px;
}
#book-dialog input,
#book-dialog textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 9px 10px;
  font-size: 12px;
}
#book-dialog textarea {
  resize: vertical;
}
.book-dialog-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}
@media (max-width: 1100px) {
  .book-workspace {
    grid-template-columns: 215px minmax(0, 1fr);
  }
  .book-page {
    padding: 22px;
  }
  .book-edit-link kbd {
    display: none;
  }
}
@media (max-width: 700px) {
  .book-shelf-mark {
    display: none;
  }
  .book-shelf-heading h2 {
    font-size: 19px;
  }
  .book-library-tools {
    flex-wrap: wrap;
    gap: 8px;
  }
  .book-library-tools .search {
    flex-basis: 100%;
    max-width: none;
  }
  .book-shelf {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  .book-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .book-contents {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px 14px;
  }
  .book-contents h2 {
    margin-top: 10px;
  }
  .book-contents > p {
    margin-bottom: 12px;
  }
  #book-chapters {
    max-height: 200px;
  }
  .book-contents > .book-delete-link {
    padding-top: 12px;
  }
  .book-page {
    padding: 22px 18px;
    min-height: 440px;
  }
  .book-topbar {
    gap: 6px;
  }
  #book-save-state {
    order: 4;
    width: 100%;
    margin: 2px 0 0;
  }
  .book-topbar [data-book-action="details"] {
    margin-left: auto;
  }
  .book-topbar .button {
    font-size: 10px;
  }
  .book-chapter-title,
  .book-title-input {
    font-size: 21px;
  }
  .book-page-meta {
    font-size: 8px;
  }
}

/* Revisão editorial: uma pequena oficina de palavras. */
.book-ai-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}
.markdown-tabs .book-ai-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 0;
  border: 1px solid var(--control-border);
  background: var(--bg);
  color: var(--ink);
  font-size: 10px;
  position: relative;
  overflow: hidden;
}
.book-ai-button svg {
  width: 13px;
  height: 13px;
}
.book-ai-button:not(:disabled):hover svg {
  animation: format-twinkle 0.8s ease-in-out;
}
.book-ai-button::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-120%);
  background: linear-gradient(
    110deg,
    transparent 20%,
    var(--soft) 50%,
    transparent 80%
  );
  pointer-events: none;
}
.book-ai-button:not(:disabled):hover::after {
  animation: format-sweep 0.8s ease;
}
.book-ai-button:disabled {
  cursor: default;
}
.book-markdown-editor .markdown-formatting {
  margin-left: 4px;
}
#book-format-dialog {
  width: min(940px, calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  border: 1px solid var(--control-border);
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 18px 70px var(--drawer-shadow);
}
#book-format-dialog::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(3px);
}
#book-format-dialog[open] {
  animation: format-appear 0.24s ease-out;
}
.book-format-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 25px 28px 20px;
  border-bottom: 1px solid var(--line);
}
.book-format-heading > .icon-button {
  margin-left: auto;
  flex-shrink: 0;
}
.book-format-heading h2 {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  margin: 5px 0 0;
}
.book-format-heading .eyebrow {
  font-size: 8px;
}
.format-magic-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sidebar);
  flex-shrink: 0;
}
.format-magic-icon svg {
  width: 22px;
  height: 22px;
}
.is-formatting .format-magic-icon svg {
  animation: format-twinkle 2.4s ease-in-out infinite;
}
#book-format-body {
  padding: 22px 28px;
}
.book-format-working {
  min-height: 310px;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.format-orbit {
  position: relative;
  height: 46px;
  width: 86px;
  margin: 8px 0 18px;
  color: var(--secondary);
}
.format-orbit span {
  position: absolute;
  font-size: 27px;
  animation: format-float 2.5s ease-in-out infinite;
}
.format-orbit span:nth-child(1) {
  left: 30px;
  top: 0;
}
.format-orbit span:nth-child(2) {
  left: 8px;
  top: 24px;
  font-size: 15px;
  animation-delay: -0.8s;
}
.format-orbit span:nth-child(3) {
  right: 3px;
  top: 19px;
  font-size: 19px;
  animation-delay: -1.6s;
}
.format-shimmer {
  font-size: 19px;
  margin: 0 0 7px;
  font-weight: 500;
  background: linear-gradient(
    100deg,
    var(--ink) 30%,
    var(--dim) 50%,
    var(--ink) 70%
  );
  background-size: 240% 100%;
  color: transparent;
  background-clip: text;
  animation: format-shimmer 2.8s linear infinite;
}
.book-format-working .field-help {
  max-width: 300px;
  margin: 0;
}
.format-paper {
  width: min(270px, 85%);
  padding: 19px 22px;
  border: 1px solid var(--line);
  border-radius: 5px;
  margin: 26px 0 4px;
  transform: rotate(-2deg);
  background: var(--sidebar);
}
.format-paper i {
  display: block;
  height: 5px;
  width: 100%;
  background: var(--line);
  border-radius: 2px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}
.format-paper i:first-child {
  width: 55%;
  height: 7px;
  margin-bottom: 16px;
}
.format-paper i:last-child {
  width: 70%;
  margin: 0;
}
.format-paper i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--bg), transparent);
  animation: format-sweep 2s ease-in-out infinite;
}
.format-paper i:nth-child(2)::after {
  animation-delay: 0.15s;
}
.format-paper i:nth-child(3)::after {
  animation-delay: 0.3s;
}
.format-paper i:nth-child(4)::after {
  animation-delay: 0.45s;
}
.book-format-summary {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 18px;
}
.book-format-comparison {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.book-format-comparison section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.book-format-comparison > section > h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--sidebar);
}
.book-format-comparison > section > h3 > span {
  font-size: 7px;
  margin-left: auto;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.book-format-comparison > section > h3 svg {
  width: 13px;
  height: 13px;
}
.book-format-comparison pre,
.book-format-comparison .markdown-preview {
  height: min(42dvh, 400px);
  min-height: 220px;
  max-height: none;
  overflow: auto;
  margin: 0;
  padding: 16px;
  font-size: 12px;
  line-height: 1.8;
}
.book-format-comparison pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font);
  color: var(--muted);
}
.book-format-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: var(--sidebar);
}
.book-format-footer > span {
  font-size: 10px;
  color: var(--muted);
  margin-right: auto;
}
.book-format-footer .button {
  font-size: 11px;
}
.book-format-error {
  min-height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}
.book-format-error > span {
  font-size: 32px;
  color: var(--muted);
}
.book-format-error p {
  max-width: 430px;
  font-size: 13px;
  margin: 15px 0 22px;
}
.book-format-undo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--sidebar);
  border-radius: var(--radius);
  margin: 10px 0;
  font-size: 10px;
  animation: format-appear 0.3s ease-out;
}
.book-format-undo svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}
.book-format-undo button {
  margin-left: auto;
  font-size: 10px;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.format-applied {
  animation: format-ink 0.9s ease-out;
}
@keyframes format-twinkle {
  0%,
  100% {
    transform: rotate(0) scale(1);
  }
  50% {
    transform: rotate(25deg) scale(1.18);
  }
}
@keyframes format-float {
  0%,
  100% {
    transform: translateY(0) rotate(-8deg);
    opacity: 0.5;
  }
  50% {
    transform: translateY(-7px) rotate(12deg);
    opacity: 1;
  }
}
@keyframes format-sweep {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(120%);
  }
}
@keyframes format-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -140% 0;
  }
}
@keyframes format-appear {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes format-ink {
  0% {
    box-shadow: 0 0 0 4px var(--line);
    background: var(--soft);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
    background: var(--bg);
  }
}
@media (max-width: 700px) {
  .book-markdown-editor .markdown-tabs {
    flex-wrap: wrap;
  }
  .book-markdown-editor .markdown-formatting {
    margin-left: auto;
  }
  .book-format-comparison {
    grid-template-columns: minmax(0, 1fr);
  }
  .book-format-heading {
    padding: 18px 16px;
    gap: 10px;
  }
  .book-format-heading h2 {
    font-size: 17px;
  }
  .format-magic-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }
  #book-format-body {
    padding: 18px 16px;
  }
  .book-format-footer {
    padding: 14px 16px;
    flex-wrap: wrap;
  }
  .book-format-footer > span {
    width: 100%;
    margin-bottom: 4px;
  }
  .book-format-footer > button:first-of-type {
    margin-left: auto;
  }
  .format-shimmer {
    font-size: 17px;
  }
  .book-format-comparison pre,
  .book-format-comparison .markdown-preview {
    height: 220px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #book-format-dialog[open],
  .format-magic-icon svg,
  .format-orbit span,
  .format-shimmer,
  .format-paper i::after,
  .book-ai-button svg,
  .book-ai-button::after,
  .format-applied,
  .book-format-undo {
    animation: none !important;
  }
  .format-shimmer {
    background: none;
    color: var(--ink);
  }
  #book-format-dialog::backdrop {
    backdrop-filter: none;
  }
}

/* Live Testing follows the compact monochrome workspace. */
#live-testing-toggle {
  height: 29px;
  font-size: 10px;
  white-space: nowrap;
}
#live-testing-dialog {
  width: min(1080px, calc(100vw - 40px));
  max-width: none;
  height: min(760px, calc(100dvh - 48px));
  max-height: none;
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  color: var(--ink);
  background: var(--bg);
}
.live-testing-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.live-testing-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.live-testing-header > div {
  margin-right: auto;
}
.live-testing-header h2 {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 500;
}
.live-testing-shell .eyebrow {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}
.live-testing-body {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
.live-testing-settings {
  padding: 22px 20px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.live-testing-settings h3 {
  margin: 5px 0 8px;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.live-testing-settings p,
.live-testing-settings small {
  font-size: 11px;
  color: var(--muted);
}
.live-testing-settings .field {
  margin: 22px 0 0;
}
.live-testing-settings select {
  width: 100%;
  border: 1px solid var(--control-border);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 7px;
}
.live-testing-settings textarea {
  font-family: monospace;
  font-size: 11px;
}
#live-testing-summary {
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}
.live-testing-settings details {
  margin-top: 22px;
  font-size: 11px;
}
.live-testing-settings .live-testing-note {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.live-testing-shell pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 10px;
  font-family: monospace;
  max-height: 260px;
  overflow-y: auto;
}
.live-testing-conversation {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
#live-testing-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}
.live-testing-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100%;
  max-width: 350px;
  margin: auto;
  color: var(--muted);
}
.live-testing-empty-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 22px;
  color: var(--ink);
}
.live-testing-empty h3 {
  font-weight: 500;
  font-size: 16px;
  color: var(--ink);
  margin: 18px 0 0;
}
.live-testing-empty p {
  font-size: 12px;
}
.live-testing-empty > span:last-child {
  font-size: 10px;
}
.live-testing-message {
  width: fit-content;
  max-width: 92%;
  margin: 0 0 22px;
  overflow-wrap: anywhere;
}
.live-testing-message > strong {
  display: block;
  font-weight: 500;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 5px;
}
.live-testing-message > div {
  white-space: pre-wrap;
  line-height: 1.7;
}
.live-testing-message.user {
  margin-left: auto;
  background: var(--soft);
  border-radius: 6px;
  padding: 10px 14px;
}
.live-testing-message details {
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}
.live-testing-message details pre {
  background: var(--sidebar);
  padding: 10px;
  border: 1px solid var(--line);
}
#live-testing-status {
  color: var(--muted);
  font-size: 10px;
  margin: 0;
  padding: 0 24px 10px;
  min-height: 25px;
}
.live-testing-error {
  margin: 0 20px 10px;
  border: 1px solid var(--control-border);
  border-left: 3px solid var(--ink);
  padding: 10px 12px;
  font-size: 11px;
}
#live-testing-form {
  margin: 0 20px 20px;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  padding: 12px;
}
#live-testing-input {
  width: 100%;
  border: 0;
  background: transparent;
  resize: vertical;
  min-height: 64px;
  max-height: 160px;
  font-size: 12px;
}
.live-testing-composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.live-testing-composer-footer > span {
  font-size: 9px;
  color: var(--muted);
}
.live-testing-composer-footer .button {
  font-size: 11px;
}
@media (max-width: 640px) {
  #live-testing-dialog {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    margin: 0;
  }
  .live-testing-header {
    padding: 12px;
  }
  .live-testing-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .live-testing-settings {
    max-height: 175px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .live-testing-settings .field {
    margin-top: 12px;
  }
  #live-testing-messages {
    padding: 16px;
  }
  #live-testing-form {
    margin: 0 12px 12px;
  }
  .live-testing-composer-footer > span {
    max-width: 160px;
  }
  .workspace-header {
    gap: 7px;
    padding: 0 10px;
  }
  .workspace-header h1 {
    min-width: 0;
    flex: 1;
    max-width: none;
  }
  .workspace-back span {
    display: none;
  }
  #live-testing-toggle {
    padding: 0 8px;
  }
  .workspace-components-button {
    padding: 0 8px;
  }
}

/* Fontes locais do agente: biblioteca por consulta, com cópias explícitas. */
.component-category-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 16px;
}
.component-category-tabs button {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 40px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 10px;
  text-align: left;
}
.component-category-tabs button svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.component-category-tabs button span {
  min-width: 0;
  white-space: nowrap;
}
.component-category-tabs button:hover {
  color: var(--ink);
  border-color: var(--control-border);
  background: var(--sidebar);
}
.component-category-tabs button[aria-selected="true"] {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
  font-weight: 500;
}
.agent-book-search {
  width: 100%;
  margin-bottom: 14px;
}
.agent-book-search input {
  min-width: 0;
}
.agent-book-selection {
  display: grid;
  gap: 10px;
}
.agent-book-option {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 9px 7px;
  border: 0;
  text-align: left;
  touch-action: none;
}
.agent-book-option img {
  width: 35px;
  height: 42px;
  flex-shrink: 0;
  -webkit-user-drag: none;
}
.agent-book-option > span:not(.agent-book-check) {
  min-width: 0;
  flex: 1;
}
.agent-book-option strong {
  display: block;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.agent-book-option small,
.agent-book-option span span {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
}
.agent-book-check {
  color: var(--muted);
  font-size: 11px;
}
.agent-book-item {
  min-width: 0;
}
.agent-book-item .personality-option {
  width: 100%;
}
.agent-book-item .personality-use-state {
  text-align: center;
  overflow-wrap: anywhere;
}
.agent-book-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
}
.agent-book-actions button {
  font-size: 8px;
  color: var(--muted);
  padding: 4px 2px;
  min-height: 24px;
  max-width: 100%;
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.agent-book-actions button:hover {
  color: var(--ink);
}
#agent-book-status {
  margin: 20px 0 15px;
  font-size: 9px;
}
.node-books {
  font-size: 9px;
  color: var(--muted);
  margin: 3px 0;
}
.node-books:empty {
  display: none;
}
#agent-source-dialog {
  width: min(980px, calc(100% - 30px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: 9px;
}
#agent-source-dialog::backdrop {
  background: var(--backdrop);
}
.agent-source-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 24px 15px;
  border-bottom: 1px solid var(--line);
}
.agent-source-header h2 {
  font-size: 20px;
  font-weight: 500;
  margin: 5px 0 8px;
  overflow-wrap: anywhere;
}
.agent-source-header > div {
  min-width: 0;
}
.agent-source-header > button {
  margin-left: auto;
  flex-shrink: 0;
}
.agent-source-header p {
  margin: 0;
  font-size: 10px;
  color: var(--muted);
}
.agent-source-search {
  display: flex;
  padding: 14px 24px;
  gap: 8px;
}
.agent-source-search .search {
  flex: 1;
  min-width: 0;
}
.agent-source-search input {
  min-width: 0;
}
.agent-source-search .button {
  font-size: 11px;
}
#agent-source-error {
  margin: 0 24px 12px;
}
.agent-source-results {
  padding: 0 24px 16px;
  max-height: 200px;
  overflow: auto;
}
.agent-source-results button {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  margin-bottom: 6px;
  padding: 10px 12px;
}
.agent-source-results strong {
  display: block;
  font-size: 11px;
  font-weight: 500;
}
.agent-source-results span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.agent-source-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  border-top: 1px solid var(--line);
  min-height: 400px;
}
#agent-source-toc {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 15px 12px;
  overflow: auto;
  max-height: 54dvh;
}
#agent-source-toc button {
  display: block;
  border: 0;
  border-radius: var(--radius);
  text-align: left;
  padding: 9px 8px;
  font-size: 11px;
  width: 100%;
  overflow-wrap: anywhere;
}
#agent-source-toc button > span {
  font-size: 9px;
  color: var(--muted);
  margin-right: 7px;
}
#agent-source-toc button.active {
  background: var(--active);
}
#agent-source-toc button:hover {
  background: var(--soft);
}
#agent-source-toc .agent-source-section {
  padding: 5px 8px 5px 28px;
  font-size: 9px;
  color: var(--muted);
}
.agent-source-reading {
  min-width: 0;
  padding: 25px;
  max-height: 54dvh;
  overflow: auto;
}
.agent-source-reading > h3 {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
#agent-source-content {
  padding: 0;
  min-height: 0;
  max-height: none;
  overflow: visible;
  font-size: 12px;
}
#agent-source-more {
  margin-top: 18px;
  font-size: 10px;
}
@media (max-width: 700px) {
  .agent-source-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  #agent-source-toc {
    max-height: 150px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .agent-source-reading {
    padding: 20px 16px;
    min-height: 240px;
    max-height: 42dvh;
  }
  .agent-source-header {
    padding: 20px 16px 14px;
  }
  .agent-source-search {
    padding: 12px 16px;
  }
  .agent-source-results {
    padding: 0 16px 12px;
  }
}

/* A resposta usa Markdown; rótulos e inspeção continuam separados do conteúdo. */
.live-testing-message > .live-testing-markdown {
  white-space: normal;
  min-width: 0;
}
.live-testing-markdown > :first-child {
  margin-top: 0;
}
.live-testing-markdown > :last-child {
  margin-bottom: 0;
}
.live-testing-markdown p {
  margin: 0 0 12px;
}
.live-testing-markdown strong {
  font-weight: 600;
}
.live-testing-markdown h1,
.live-testing-markdown h2,
.live-testing-markdown h3,
.live-testing-markdown h4,
.live-testing-markdown h5,
.live-testing-markdown h6 {
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
  margin: 20px 0 10px;
  letter-spacing: 0;
}
.live-testing-markdown ul,
.live-testing-markdown ol {
  margin: 8px 0 14px;
  padding-left: 22px;
}
.live-testing-markdown li {
  margin: 4px 0;
}
.live-testing-markdown li > p {
  margin-bottom: 6px;
}
.live-testing-markdown a {
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.live-testing-markdown a:hover {
  color: var(--muted);
}
.live-testing-markdown blockquote {
  border-left: 2px solid var(--control-border);
  padding-left: 12px;
  margin: 12px 0;
  color: var(--muted);
}
.live-testing-markdown code {
  font:
    11px/1.6 ui-monospace,
    monospace;
  background: var(--soft);
  padding: 2px 4px;
  border-radius: 3px;
}
.live-testing-markdown pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
  background: var(--sidebar);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin: 12px 0;
}
.live-testing-markdown pre code {
  padding: 0;
  background: none;
}
.live-testing-markdown hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}
.live-testing-markdown table {
  white-space: normal;
  display: block;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 12px;
  margin: 12px 0;
}
.live-testing-markdown th,
.live-testing-markdown td {
  height: auto;
  font-size: inherit;
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
}
.live-testing-markdown th {
  background: var(--sidebar);
  font-weight: 500;
}

.live-testing-markdown tbody tr:last-child td {
  border: 1px solid var(--line);
}
.live-testing-markdown tbody tr:hover {
  background: transparent;
}

/* AI Modelos reuse the workspace's compact component library and dialogs. */
.ai-model-view .summary,
.ai-model-view .registry,
.ai-model-view main > .note {
  display: none;
}
.ai-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.ai-model-card {
  text-align: left;
  background: var(--bg);
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  display: grid;
  gap: 7px;
  font: inherit;
}
.ai-model-card:hover {
  background: var(--sidebar);
}
.ai-model-card img {
  width: 40px;
  height: 40px;
}
.ai-model-card small {
  color: var(--muted);
}
#ai-model-editor {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.ai-model-fields {
  padding: 24px;
  display: grid;
  gap: 10px;
}
.ai-model-fields label {
  font-weight: 500;
}
.ai-model-fields input,
.ai-model-fields select,
#book-ai-model {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  font: inherit;
  color: inherit;
  background: var(--bg);
}
#book-ai-model {
  width: auto;
  max-width: 160px;
  font-size: 11px;
  padding: 5px;
}

.ai-model-advanced-fields {
  display: grid;
  gap: 10px;
  padding-top: 14px;
}
#ai-model-advanced summary {
  cursor: pointer;
  font-weight: 500;
}

/* Communication channels share the compact component library and native dialog. */
.channel-view .summary,
.channel-view .registry,
.channel-view main > .note {
  display: none;
}
.channel-intro-icon {
  width: 64px;
  height: 64px;
}
.channel-library-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.channel-library-tools .search {
  flex: 1;
}
.channel-library-tools > span {
  font-size: 11px;
  color: var(--muted);
}
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.channel-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  text-align: left;
  min-width: 0;
  gap: 9px;
}
.channel-card img,
.channel-card-top img {
  width: 40px;
  height: 40px;
}
.channel-card strong {
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.channel-card p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  flex: 1;
}
.channel-card > span:not(.channel-provider-symbol) {
  font-size: 11px;
}
.channel-card .button,
.channel-card > .status {
  margin-top: 8px;
}
.channel-card-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.channel-card-action {
  margin-top: 10px;
  color: var(--secondary);
}
.channel-saved:hover {
  border-color: var(--dim);
  background: var(--sidebar);
}
.channel-soon {
  background: var(--sidebar);
}
.channel-provider-symbol {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-size: 28px;
  color: var(--muted);
}
.channel-catalog-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 32px 0 14px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.channel-catalog-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}
.channel-catalog-heading > span {
  font-size: 11px;
  color: var(--muted);
}
.channel-empty {
  grid-column: 1 / -1;
  padding: 34px 20px;
  border: 1px dashed var(--control-border);
  border-radius: 8px;
  text-align: center;
}
.channel-empty h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 5px;
}
.channel-empty p {
  color: var(--muted);
  margin: 0 0 18px;
}
#channel-editor {
  width: 820px;
  max-width: calc(100% - 28px);
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: 12px;
  box-shadow: 0 15px 70px var(--toast-shadow);
}
#channel-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 30px);
}
.channel-dialog-body {
  display: grid;
  grid-template-columns: 270px 1fr;
  overflow: auto;
}
.channel-guide {
  background: var(--sidebar);
  padding: 24px;
  border-right: 1px solid var(--line);
  font-size: 12px;
}
.channel-guide > img {
  width: 42px;
  height: 42px;
}
.channel-guide h3 {
  font-size: 16px;
  line-height: 1.4;
  font-weight: 500;
  margin: 16px 0;
}
.channel-guide ol {
  padding-left: 18px;
}
.channel-guide li {
  padding: 0 0 13px 4px;
}
.channel-guide p {
  margin: 5px 0 0;
  color: var(--muted);
}
.channel-guide a {
  color: var(--secondary);
  text-underline-offset: 3px;
}
.channel-fields {
  padding: 24px;
  min-width: 0;
}
.channel-fields .field {
  margin-bottom: 20px;
}
.channel-fields input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 9px 10px;
}
.channel-fields label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
}
.channel-fields small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}
.channel-token-row {
  display: flex;
  gap: 6px;
}
.channel-token-row input {
  flex: 1;
  font-size: 11px;
}
.channel-identity {
  font-size: 11px;
  padding: 10px;
  background: var(--soft);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}
.channel-scope {
  font-size: 11px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}
.channel-scope p {
  color: var(--muted);
  margin: 6px 0;
}
#channel-form .personality-dialog-footer > span {
  flex: 1;
}
#channel-form [data-for][hidden] {
  display: none;
}
.channel-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.channel-fields small.channel-hint {
  margin: -8px 0 18px;
}
.channel-webhook,
.channel-qr {
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sidebar);
  font-size: 12px;
}
.channel-webhook p {
  margin: 6px 0 0;
  color: var(--muted);
}
.channel-webhook label {
  margin: 12px 0 6px;
}
.channel-webhook input {
  font-family: var(--mono, monospace);
}
.channel-warning {
  margin: 0 0 16px;
  padding: 10px;
  border-left: 3px solid var(--dim);
  background: var(--soft);
  font-size: 12px;
}
.channel-qr {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}
.channel-qr img {
  width: 220px;
  height: 220px;
  padding: 8px;
  border-radius: var(--radius);
  background: #fff;
}
.channel-qr p {
  margin: 0;
  color: var(--muted);
}
.channel-qr-actions {
  display: flex;
  gap: 8px;
}
@media (max-width: 650px) {
  .channel-dialog-body {
    grid-template-columns: 1fr;
  }
  .channel-field-row {
    grid-template-columns: 1fr;
  }
  .channel-guide {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .channel-guide ol {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 22px;
  }
  .channel-library-tools {
    flex-wrap: wrap;
    gap: 10px;
  }
  .channel-library-tools .search {
    flex-basis: 100%;
  }
  .channel-library-tools > span {
    flex: 1;
  }
  .channel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .channel-card {
    padding: 14px;
  }
  .channel-card-top {
    align-items: flex-start;
    flex-direction: column;
  }
  #channel-form .personality-dialog-footer {
    flex-wrap: wrap;
    padding: 14px;
    gap: 8px;
  }
}
@media (max-width: 380px) {
  .channel-grid {
    grid-template-columns: 1fr;
  }
}

/* Saved connector sessions, sharing the canvas header and compact type scale. */
.sessions-mode {
  overflow: hidden;
}
.sessions-mode > .sidebar,
.sessions-mode > .shell {
  display: none;
}
.agent-sessions {
  position: fixed;
  inset: 0;
  background: var(--bg);
}
.sessions-header {
  height: 54px;
  padding: 0 23px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-bottom: 1px solid var(--line);
}
.sessions-header h1 {
  display: flex;
  gap: 13px;
  align-items: center;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  margin: 0;
}
#sessions-agent-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sessions-refresh {
  margin-left: auto;
  flex-shrink: 0;
}
.sessions-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: calc(100% - 54px);
}
.sessions-sidebar {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--sidebar);
}
.sessions-sidebar-heading {
  padding: 16px 16px 0;
}
.sessions-sidebar-heading h2 {
  font-size: 13px;
  margin: 0 0 4px;
  font-weight: 500;
}
.sessions-sidebar-heading > span {
  color: var(--muted);
  font-size: 10px;
}
#sessions-list {
  overflow-y: auto;
  min-height: 0;
  padding: 0;
}
.session-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 0;
  border-left: 2px solid transparent;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
}
.session-list-item:hover {
  background: var(--soft);
}
.session-list-item.selected {
  background: var(--active);
  border-left-color: var(--ink);
}
.session-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.session-item-top strong {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-item-meta {
  display: flex;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-item-preview {
  color: var(--secondary);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-conversation,
#session-detail {
  min-height: 0;
  height: 100%;
}
#session-detail {
  display: flex;
  flex-direction: column;
}
.session-detail-header {
  border-bottom: 1px solid var(--line);
  padding: 14px 24px 11px;
}
.session-detail-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}
.session-detail-title h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.session-detail-header p {
  color: var(--muted);
  font-size: 10px;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}
.session-transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 16px 24px;
}
.session-messages {
  max-width: 820px;
  margin: 0 auto;
}
.session-message {
  width: fit-content;
  max-width: 85%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}
.session-message.from-participant {
  margin-left: auto;
  background: var(--soft);
  border-color: transparent;
}
.session-message-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 5px;
}
.session-message-meta strong {
  color: var(--secondary);
  font-weight: 500;
}
.session-message-text {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 12px;
}
.session-delivery {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 4px;
}
.session-message-error {
  color: var(--secondary);
  font-size: 11px;
  border-top: 1px solid var(--control-border);
  padding-top: 9px;
  margin: 10px 0 0;
}
.sessions-empty {
  margin: auto;
  text-align: center;
  padding: 50px 24px;
  max-width: 440px;
}
.sessions-empty h2 {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 9px;
}
.sessions-empty p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.sessions-sidebar .sessions-empty {
  padding: 30px 12px;
}
.sessions-sidebar .sessions-empty h2 {
  font-size: 12px;
}
.sessions-sidebar .sessions-empty p {
  font-size: 11px;
}
.sessions-list-note {
  padding: 15px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  overflow-wrap: anywhere;
}
.sessions-list-note .button {
  display: block;
  margin: 12px auto 0;
}
.session-history-end {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 9px;
}
.sessions-mobile-back {
  display: none;
}

.session-item-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.session-contact-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--control-border);
  background: var(--bg);
  color: var(--muted);
}

.session-contact-avatar svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.session-item-top time {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sessions-search {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 14px;
  padding: 7px 9px;
  background: var(--bg);
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
}

.sessions-search svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--muted);
}

.sessions-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  font-size: 10px;
  background: transparent;
}

.sessions-search:focus-within {
  outline: 2px solid var(--muted);
  outline-offset: 2px;
}

.session-metadata {
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
}

.session-metadata summary {
  cursor: pointer;
  width: fit-content;
  font-size: 9px;
}

.session-tool-group {
  max-width: 85%;
  margin: 3px 0 10px;
  color: var(--muted);
  font-size: 10px;
}

.session-tool-group > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 0;
  list-style: none;
}

.session-tool-group > summary::-webkit-details-marker {
  display: none;
}

.session-tool-group > summary::after {
  content: "›";
  font-size: 13px;
  margin-left: 1px;
}

.session-tool-group[open] > summary::after {
  transform: rotate(90deg);
}

.session-tool-group > summary svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.session-tool-names {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 9px;
}

.session-tool-count {
  font-size: 9px;
  background: var(--soft);
  border-radius: var(--radius);
  padding: 0 4px;
}

.session-tool-records {
  border-left: 1px solid var(--control-border);
  padding-left: 12px;
  margin: 5px 0 10px 5px;
}

.session-tool-record {
  padding: 6px 0;
}

.session-tool-record > div {
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-size: 10px;
  color: var(--secondary);
}

.session-tool-record time {
  font-size: 9px;
  color: var(--muted);
}

.session-tool-record pre {
  margin: 6px 0 0;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--soft);
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 10px;
  line-height: 1.5;
}

.session-date-divider {
  text-align: center;
  color: var(--muted);
  font-size: 9px;
  margin: 8px 0 16px;
}

.session-older {
  padding: 0 0 12px;
}
@media (max-width: 760px) {
  .workspace-header {
    flex-wrap: wrap;
    align-content: center;
    height: 94px;
    padding: 10px 14px;
    gap: 6px 8px;
  }
  .workspace-header::before {
    content: "";
    flex-basis: 100%;
    order: 1;
  }
  .workspace-header h1 {
    max-width: none;
    flex: 1;
  }
  .workspace-header .button {
    order: 2;
  }
  .workspace-components-button {
    margin-left: 0;
  }
  .workspace-header .button {
    font-size: 10px;
    padding: 6px 8px;
  }
  .agent-canvas {
    top: 94px;
  }
  .canvas-tools {
    top: 113px;
  }
  .agent-components {
    top: 110px;
    max-height: calc(100dvh - 135px);
  }
  .sessions-header {
    padding: 0 14px;
    gap: 9px;
  }
  .sessions-header h1 {
    gap: 9px;
  }
  .sessions-layout {
    grid-template-columns: 1fr;
  }
  .session-conversation {
    display: none;
  }
  .has-session .sessions-sidebar {
    display: none;
  }
  .has-session .session-conversation {
    display: block;
  }
  .sessions-mobile-back {
    display: inline-flex;
    margin-bottom: 15px;
  }
  .session-detail-header {
    padding: 18px;
  }
  .session-transcript {
    padding: 20px 16px;
  }
  .session-message {
    max-width: 96%;
  }
}

.ai-model-footer {
  flex-wrap: wrap;
}
#delete-ai-model {
  margin-right: auto;
}

/* Attached books share one canvas connection and open a document picker. */
.book-stack .avatar-coin {
  isolation: isolate;
}
.book-stack .avatar-coin::before,
.book-stack .avatar-coin::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--control-border);
  border-radius: inherit;
  background: var(--bg);
  box-shadow: 0 3px 0 var(--line);
  z-index: -1;
  transform: translate(7px, -5px);
}
.book-stack .avatar-coin::before {
  transform: translate(14px, -10px);
  z-index: -2;
}
.book-stack .avatar-coin img {
  background: var(--bg);
}
.book-count {
  position: absolute;
  right: -3px;
  bottom: -2px;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border: 2px solid var(--bg);
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 9px;
  line-height: 15px;
  text-align: center;
}
#agent-books-dialog {
  width: min(560px, calc(100% - 30px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: 9px;
}
#agent-books-dialog::backdrop {
  background: var(--backdrop);
}
#agent-books-list {
  padding: 0 24px 12px;
}
.attached-book-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.attached-book-row:last-child {
  border-bottom: 0;
}
.attached-book-row > img {
  width: 40px;
  height: 40px;
}
.attached-book-row > div:first-of-type {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.attached-book-row strong {
  font-size: 12px;
  font-weight: 500;
}
.attached-book-row .field-help {
  margin: 4px 0 0;
}
.attached-book-actions,
.agent-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.attached-book-actions .button {
  font-size: 10px;
}
.agent-source-actions {
  padding: 14px 24px 0;
}
@media (max-width: 600px) {
  .attached-book-row {
    flex-wrap: wrap;
  }
  .attached-book-actions {
    width: 100%;
    padding-left: 52px;
  }
}

/* Conversation inbox: fixed-height virtual rows and compact native filters. */
#sessions-list {
  flex: 1;
  overflow-anchor: none;
}
#sessions-list .session-list-item {
  height: 80px;
  box-sizing: border-box;
}
.inbox-tabs {
  display: flex;
  gap: 4px;
  padding: 0 14px 10px;
}
.inbox-tabs button {
  flex: 1;
  font-size: 10px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.inbox-tabs button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--active);
  border-color: var(--control-border);
}
.inbox-filters {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 9px 16px;
  color: var(--muted);
  font-size: 10px;
  flex-shrink: 0;
}
.inbox-filters > summary {
  cursor: pointer;
}
#inbox-filter-count:not(:empty) {
  padding: 1px 5px;
  margin-left: 5px;
  background: var(--active);
  border-radius: var(--radius);
  color: var(--ink);
}
.inbox-filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 8px;
  padding: 12px 0 3px;
  max-height: 225px;
  overflow: auto;
}
.inbox-filter-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  font-size: 10px;
}
.inbox-filter-grid select,
.inbox-filter-grid input {
  width: 100%;
  min-width: 0;
  height: 29px;
  font-size: 10px;
  padding: 4px 6px;
  background: var(--bg);
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  color: var(--ink);
}
#inbox-clear {
  grid-column: 1/-1;
  justify-self: start;
  font-size: 10px;
  height: 27px;
}
.inbox-updates {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}
.inbox-updates button {
  width: 100%;
  padding: 7px;
  cursor: pointer;
  font-size: 10px;
  color: var(--secondary);
  background: var(--soft);
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
}
.session-detail-title {
  flex-wrap: wrap;
}
.session-detail-title h2 {
  flex: 1;
  min-width: 0;
}
.session-archive {
  margin-left: auto;
  font-size: 10px;
  height: 27px;
  padding: 0 9px;
}
.session-history-picker {
  margin-top: 8px;
  font-size: 10px;
  color: var(--secondary);
}
.session-history-picker > summary {
  cursor: pointer;
  width: fit-content;
}
.session-history-picker > summary span {
  font-size: 9px;
  color: var(--muted);
  margin-left: 4px;
}
[data-session-history] {
  max-height: 160px;
  overflow: auto;
  max-width: 440px;
  margin-top: 8px;
  border-left: 1px solid var(--line);
  padding-left: 10px;
}
[data-session-history] a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 7px 8px;
  border-radius: var(--radius);
  color: var(--secondary);
}
[data-session-history] a[aria-current] {
  background: var(--active);
  color: var(--ink);
}
[data-session-history] a:hover {
  background: var(--soft);
}
[data-session-history] small {
  color: var(--muted);
  font-size: 9px;
}
[data-session-history] .button {
  font-size: 10px;
  margin: 6px 0;
}
[data-session-history] p {
  padding: 6px;
}
@media (max-width: 760px) {
  .session-archive {
    font-size: 9px;
  }
  .inbox-filter-grid {
    max-height: 190px;
  }
}
.inbox-channel-error {
  color: var(--muted);
  font-size: 10px;
  margin: 8px 16px;
}

/* Mini CRM: funil Kanban, lista, pendências e editor lateral do lead. */
.crm-view .summary,
.crm-view .registry,
.crm-view main > .note {
  display: none;
}
.crm-library {
  --crm-overdue: #b42318;
}
.crm-tabs {
  margin-bottom: 4px;
}
.crm-tabs .tab {
  display: inline-flex;
  align-items: flex-end;
}
.crm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
}
.crm-toolbar .search {
  flex: 1 1 240px;
  width: auto;
}
.crm-toolbar .button.primary {
  margin-left: auto;
}
.crm-filter {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 9px;
  font-size: 11px;
  background: var(--bg);
  min-width: 0;
}
input.crm-filter {
  width: 120px;
}
.crm-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--secondary);
}
.crm-muted {
  color: var(--faint);
  font-size: 11px;
  margin: 4px 0;
}
.crm-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: stretch;
  /* Colunas com altura fixa: cada uma rola sozinha e os cabeçalhos ficam visíveis. */
  height: max(420px, calc(100dvh - 330px));
}
.crm-column {
  background: var(--sidebar);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 0 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.crm-column > header,
.crm-recency {
  margin: 0 10px;
}
.crm-recency {
  font-size: 10px;
  color: var(--faint);
}
.crm-recency .text-button {
  font-size: 10px;
  text-decoration: underline;
}
.crm-column-more {
  padding: 2px 0 8px;
}
.crm-column.drop {
  outline: 2px dashed var(--faint);
  outline-offset: -2px;
}
.crm-column > header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 2px 4px;
}
.crm-column h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
}
.crm-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
}
.crm-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
  background: var(--active);
  padding: 1px 6px;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}
.crm-outcome {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.crm-cards {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 10px 10px;
}
.crm-card {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  cursor: grab;
  box-shadow: 0 1px 1px var(--control-shadow);
}
.crm-card:hover,
.crm-card:focus-visible {
  border-color: var(--control-border);
  outline: none;
  box-shadow: 0 2px 8px var(--drawer-shadow);
}
.crm-card.dragging {
  opacity: 0.5;
}
.crm-card strong {
  font-size: 12px;
  font-weight: 500;
}
.crm-card-meta {
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-card-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--faint);
}
.crm-card-foot time {
  margin-left: auto;
}
.crm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.crm-tags span {
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 7px;
  color: var(--secondary);
  background: var(--bg);
}
.crm-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  background: var(--soft);
  border-radius: 3px;
  padding: 0 5px;
  color: var(--secondary);
}
.crm-badge svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.crm-badge.overdue {
  color: var(--crm-overdue, #b42318);
  background: #fdecea;
}
.crm-more {
  width: 100%;
}
.crm-more-row {
  display: flex;
  justify-content: center;
  padding: 14px 0;
}
.crm-stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.crm-task-group {
  margin-bottom: 22px;
}
.crm-task-group h3,
.crm-section h3 {
  font-size: 12px;
  font-weight: 500;
  margin: 0 0 8px;
}
.crm-task-group h3 span,
.crm-section h3 span {
  font-size: 10px;
  color: var(--muted);
  background: var(--soft);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
}
.crm-task-group.overdue h3 {
  color: var(--crm-overdue, #b42318);
}
.crm-tasks,
.crm-notes,
.crm-contacts,
.crm-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.crm-tasks li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.crm-tasks label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1 1 200px;
  font-size: 12px;
}
.crm-tasks label input {
  margin-top: 3px;
}
.crm-tasks small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.crm-tasks li.done label span {
  text-decoration: line-through;
  color: var(--faint);
}
.crm-tasks li.overdue .crm-task-meta {
  color: var(--crm-overdue, #b42318);
}
.crm-task-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 10px;
  color: var(--faint);
}
.crm-author {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--secondary);
}
.crm-agent-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--ink);
  color: white;
  border-radius: 3px;
  padding: 0 4px;
}
.crm-settings-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  margin: 16px 0;
}
.crm-settings-card.column {
  flex-direction: column;
  align-items: stretch;
}
.crm-settings-card h3 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 500;
}
.crm-settings-card p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  max-width: 640px;
}
.crm-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.crm-stage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.crm-stage-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.crm-stage-list input[name="name"] {
  flex: 1 1 160px;
}
.crm-stage-list input,
.crm-stage-list select,
.crm-inline-form input,
.crm-note-form textarea,
.crm-attribute input,
.crm-stage-select select {
  height: 30px;
  border: 1px solid var(--control-border);
  border-radius: 4px;
  padding: 0 8px;
  font-size: 12px;
  background: var(--bg);
  min-width: 0;
}
.crm-stage-list input[type="color"],
.crm-inline-form input[type="color"] {
  width: 34px;
  padding: 2px;
}
.crm-stage-list .crm-count {
  margin-left: 0;
}
.crm-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.crm-inline-form input:not([type="color"]) {
  flex: 1 1 140px;
}
.crm-note-form {
  display: grid;
  gap: 6px;
  justify-items: start;
  margin-bottom: 8px;
}
.crm-note-form textarea {
  width: 100%;
  height: auto;
  padding: 7px 8px;
  resize: vertical;
}

/* Editor lateral do lead. */
dialog.crm-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  border: 0;
  border-left: 1px solid var(--control-border);
  padding: 0;
  width: 620px;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  box-shadow: -10px 0 50px var(--drawer-shadow);
}
dialog.crm-drawer[open] {
  display: flex;
  flex-direction: column;
}
.crm-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 25px;
  border-bottom: 1px solid var(--line);
}
.crm-drawer-head .eyebrow {
  margin: 0;
}
.crm-drawer-body {
  overflow: auto;
  padding: 20px 25px 30px;
  flex: 1;
}
.crm-new-lead h2,
.crm-lead-head h2 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.4px;
}
.crm-new-lead h2 {
  margin-bottom: 18px;
}
.crm-lead-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.crm-lead-head > div {
  flex: 1;
  min-width: 0;
}
.crm-lead-head p {
  margin: 0;
  font-size: 10px;
  color: var(--faint);
}
.crm-section {
  border-top: 1px solid var(--line);
}
.crm-section > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  cursor: pointer;
  list-style: none;
}
.crm-section > summary::-webkit-details-marker {
  display: none;
}
.crm-section > summary::before {
  content: "›";
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  width: 10px;
  transition: transform 0.15s ease;
}
.crm-section[open] > summary::before {
  transform: rotate(90deg);
}
.crm-section > summary h3 {
  margin: 0;
}
.crm-section > summary:hover::before {
  color: var(--ink);
}
.crm-section > summary:focus-visible {
  outline: 2px solid var(--faint);
  outline-offset: 2px;
}
.crm-section[open] {
  padding-bottom: 14px;
}
@media (prefers-reduced-motion: reduce) {
  .crm-section > summary::before {
    transition: none;
  }
}
.crm-attributes {
  display: grid;
  gap: 4px;
}
.crm-attribute {
  display: grid;
  grid-template-columns: minmax(90px, 32%) 1fr auto;
  align-items: center;
  gap: 8px;
}
.crm-attribute > span {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "SFMono-Regular", Consolas, monospace;
}
.crm-notes li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.crm-notes p {
  margin: 0 0 3px;
  font-size: 12px;
  white-space: pre-wrap;
}
.crm-contacts li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.crm-contacts li > span:first-child {
  flex: 1;
  display: grid;
}
.crm-contacts small {
  font-size: 10px;
  color: var(--muted);
}
.crm-timeline li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  padding: 5px 0;
  color: var(--secondary);
}
.crm-timeline time {
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
}
.crm-lead-footer {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.crm-compact-fields summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 0;
}
.crm-lead.compact .crm-lead-head {
  align-items: center;
  margin-bottom: 8px;
}
.crm-lead.compact .crm-section > summary {
  padding: 9px 0;
}
@media (max-width: 700px) {
  .crm-board {
    grid-auto-columns: 82%;
    height: 70dvh;
  }
  .crm-toolbar .button.primary {
    margin-left: 0;
  }
  .crm-lead-head {
    flex-wrap: wrap;
  }
  .crm-attribute {
    grid-template-columns: 1fr auto;
  }
  .crm-attribute > span {
    grid-column: 1 / -1;
  }
}
.agent-crm {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px 2px;
  margin: 0 0 16px;
}
.agent-crm legend {
  font-size: 11px;
  font-weight: 500;
  padding: 0 4px;
}
.session-crm {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--bg);
}
.session-crm > summary {
  cursor: pointer;
  font-size: 11px;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.session-crm[open] > summary {
  border-bottom: 1px solid var(--line);
}
.session-crm-body {
  max-height: 46vh;
  overflow: auto;
  padding: 10px 0;
}
.session-crm-picker {
  display: grid;
  gap: 8px;
}
.session-crm-picker .search {
  width: 100%;
}
.session-crm-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.session-crm-actions:not(:empty) + * {
  margin-top: 8px;
}

/* Settings: compact administrator management, using the shared controls. */
.settings-view .summary,
.settings-view main > .note,
.settings-view .table-footer {
  display: none;
}
.users-section {
  max-width: 1040px;
}
.users-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.users-heading h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 5px;
  font-size: 16px;
  font-weight: 500;
}
.users-heading p,
.users-role-note,
.users-footer,
.workspace-details {
  font-size: 12px;
  color: var(--muted);
}
.users-heading p {
  margin: 0;
}
.users-count,
.user-self {
  border-radius: 4px;
  background: var(--soft);
  padding: 2px 6px;
  font-size: 10px;
  color: var(--muted);
}
.users-role-note {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  margin-bottom: 20px;
}
.users-role-note strong {
  color: var(--ink);
  font-weight: 500;
}
.users-search {
  max-width: 340px;
  margin-bottom: 14px;
}
.users-search input {
  min-width: 0;
  width: 100%;
}
.users-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.users-table {
  width: 100%;
  border-collapse: collapse;
}
.users-table th {
  background: var(--sidebar);
  color: var(--muted);
  font-weight: 400;
  font-size: 11px;
}
.users-table th,
.users-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.users-table tr:last-child td {
  border-bottom: 0;
}
.user-identity {
  display: flex;
  gap: 10px;
  align-items: center;
}
.user-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--sidebar);
  font-size: 11px;
  color: var(--secondary);
}
.user-identity strong {
  font-weight: 500;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.user-self {
  margin-left: 7px;
}
.user-email {
  display: block;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.user-role {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
}
.users-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.users-table .users-actions-heading {
  text-align: right;
}
.users-footer {
  margin: 12px 0 0;
  font-size: 11px;
}
.users-feedback {
  padding: 36px 18px;
  text-align: center;
  border: 1px dashed var(--control-border);
  border-radius: 5px;
  color: var(--muted);
}
.users-feedback h3 {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}
.users-feedback p {
  font-size: 12px;
}
.workspace-details {
  max-width: 1040px;
  margin-top: 36px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.workspace-details summary {
  cursor: pointer;
  margin-bottom: 16px;
}
.user-dialog {
  width: 440px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  color: var(--ink);
  background: var(--bg);
}
.user-dialog form {
  display: flex;
  flex-direction: column;
}
.user-dialog-body {
  padding: 0 24px 20px;
  font-size: 12px;
}
.user-dialog-body > p:first-child {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}
.user-dialog-body .field-help {
  line-height: 1.5;
  color: var(--muted);
}
.user-fixed-role {
  margin-top: 6px;
  font-size: 12px;
  background: var(--sidebar);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 9px;
  color: var(--muted);
}
@media (max-width: 600px) {
  .users-heading {
    align-items: flex-start;
  }
  .users-heading p {
    max-width: 210px;
  }
  .users-heading > button {
    flex-shrink: 0;
  }
  .users-role-note {
    align-items: flex-start;
  }
  .users-search {
    max-width: none;
  }
  .users-table th,
  .users-table td {
    padding: 10px;
  }
  .users-table th:nth-child(2),
  .users-table td:nth-child(2) {
    display: none;
  }
  .user-avatar {
    display: none;
  }
  .users-actions {
    flex-direction: column;
  }
  .user-dialog .personality-dialog-header {
    padding: 18px 20px;
  }
  .user-dialog-body {
    padding: 0 20px 16px;
  }
}

/* Agendamentos: tarefas dos agentes, histórico de execuções e automação. */
.schedules-view .summary,
.schedules-view .registry,
.schedules-view main > .note {
  display: none;
}
.schedules-library {
  max-width: 1180px;
}
.schedule-tabs {
  margin-bottom: 18px;
}
.schedule-tabs .tab {
  display: inline-flex;
  align-items: flex-end;
}
.schedule-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.schedule-toolbar .search {
  flex: 1;
  max-width: 340px;
}
.schedule-toolbar .search input {
  width: 100%;
  min-width: 0;
}
.schedule-toolbar .button.primary {
  margin-left: auto;
}
.schedule-name {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
.schedule-name:hover {
  text-decoration: underline;
}
.schedule-badge {
  display: inline-block;
  margin-left: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 9px;
  color: var(--muted);
  vertical-align: 1px;
}
.schedule-status {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  font-size: 10px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: var(--sidebar);
  white-space: nowrap;
}
.schedule-status .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--dim);
}
.schedule-status.succeeded .dot {
  background: #15803d;
}
.schedule-status.failed,
.schedule-status.interrupted {
  color: #b42318;
}
.schedule-status.failed .dot,
.schedule-status.interrupted .dot {
  background: #b42318;
}
.schedule-status.running .dot {
  background: #2563eb;
  animation: schedule-pulse 1s ease-in-out infinite alternate;
}
@keyframes schedule-pulse {
  to {
    opacity: 0.3;
  }
}
@media (prefers-reduced-motion: reduce) {
  .schedule-status.running .dot {
    animation: none;
  }
}
.schedule-table td {
  vertical-align: top;
}
.schedule-muted {
  color: var(--muted);
  font-size: 12px;
}
.schedule-detail .users-heading {
  margin-top: 12px;
}
.schedule-detail .users-heading p {
  max-width: 640px;
}
.schedule-facts {
  max-width: 760px;
}
.schedule-subtitle {
  margin: 24px 0 8px;
  font-size: 12px;
  font-weight: 500;
}
.schedule-pre {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--sidebar);
  font: 11px/1.55 "SFMono-Regular", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.schedule-dialog {
  width: 680px;
}
.schedule-dialog form {
  max-height: calc(100dvh - 32px);
}
.schedule-dialog .user-dialog-body {
  overflow-y: auto;
  padding-top: 20px;
}
.schedule-form > p:first-child {
  margin-bottom: 20px;
}
.schedule-kind {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  border: 0;
  padding: 0;
  margin: 0 0 14px;
  font-size: 12px;
}
.schedule-kind legend {
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 8px;
  padding: 0;
}
.schedule-kind label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.mono-input {
  font-family: "SFMono-Regular", Consolas, monospace !important;
}
.schedule-invalid {
  color: #b42318;
}
.schedule-narrow {
  max-width: 200px;
}
.schedule-secrets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.schedule-secrets li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.schedule-secrets li .user-email {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.schedule-secret-agents {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.schedule-secret-agents legend {
  padding: 0;
  margin-bottom: 6px;
}
.schedule-secret-agents label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.schedule-log .schedule-subtitle:first-of-type {
  margin-top: 12px;
}
@media (max-width: 760px) {
  .schedule-table th:nth-child(2),
  .schedule-table td:nth-child(2),
  .schedule-table th:nth-child(4),
  .schedule-table td:nth-child(4) {
    display: none;
  }
  .schedule-toolbar .button.primary {
    margin-left: 0;
  }
  .schedule-dialog .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Célio: avatar com aceno na sidebar e tela do agente de gestão. */
.celio-cta {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
  margin: 0 3px 26px;
  color: inherit;
}
.celio-cta-avatar {
  position: relative;
  width: 54px;
  height: 54px;
  grid-row: span 1;
}
.celio-cta-avatar img,
.celio-avatar {
  display: block;
  border-radius: 50%;
  flex-shrink: 0;
}
.celio-cta-avatar img {
  width: 54px;
  height: 54px;
  box-shadow: 0 2px 6px var(--drawer-shadow);
  transition: transform 0.2s;
}
.celio-cta-bubble {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px 10px 10px 3px;
  padding: 7px 9px;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--secondary);
}
.celio-cta-bubble strong {
  color: var(--ink);
  font-weight: 600;
}
.celio-cta-button {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 31px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 11px;
  font-weight: 500;
  transition:
    background 0.15s,
    gap 0.15s;
}
.celio-cta:hover .celio-cta-button,
.celio-cta:focus-visible .celio-cta-button {
  background: var(--secondary);
  gap: 10px;
}
.celio-cta:hover .celio-cta-avatar img {
  transform: translateY(-2px);
}
.celio-cta.active .celio-cta-button {
  background: var(--active);
  color: var(--ink);
}
.celio-cta:focus-visible {
  outline: none;
}
.celio-cta:focus-visible .celio-cta-button {
  outline: 2px solid var(--muted);
  outline-offset: 2px;
}
.celio-mode {
  overflow: hidden;
}
.celio-mode > .sidebar,
.celio-mode > .shell {
  display: none;
}
.celio-workspace {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.celio-header h1 {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
}
.celio-header h1 .celio-avatar {
  width: 24px;
  height: 24px;
}
.celio-subtitle {
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.celio-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.celio-model {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.celio-model select {
  height: 31px;
  max-width: 220px;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0 6px;
  font-size: 11px;
  color: var(--ink);
}
.celio-toggle {
  display: none;
}
.celio-count:not(:empty) {
  padding: 0 5px;
  border-radius: var(--radius);
  background: var(--active);
  font-size: 10px;
}
.celio-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  position: relative;
}
.celio-history,
.celio-created {
  min-height: 0;
}
.celio-history {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
}
.celio-conversations {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
.celio-empty-list {
  padding: 18px 16px;
}
.celio-empty-list h2 {
  font-size: 12px;
  margin: 0 0 4px;
  font-weight: 500;
}
.celio-empty-list p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}
.celio-conversation-item .session-item-body {
  display: grid;
  gap: 3px;
  min-width: 0;
  width: 100%;
}
.celio-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.celio-chat-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 14px 28px 12px;
  min-width: 0;
}
.celio-chat-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#celio-chat-meta {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}
.celio-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px max(28px, calc((100% - 760px) / 2));
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.celio-welcome {
  margin: auto 0;
  max-width: 560px;
  align-self: center;
  text-align: center;
}
.celio-welcome-avatar {
  margin: 0 auto;
}
.celio-welcome h3 {
  margin: 14px 0 6px;
  font-size: 18px;
  font-weight: 600;
}
.celio-welcome p {
  margin: 0 0 18px;
  color: var(--secondary);
}
.celio-suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  text-align: left;
}
.celio-suggestion {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12px;
  background: var(--bg);
}
.celio-suggestion:hover {
  background: var(--soft);
  border-color: var(--control-border);
}
.celio-hint {
  margin-top: 16px !important;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--soft);
  font-size: 12px;
}
.celio-hint a,
.celio-action-link {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.celio-message {
  display: flex;
  gap: 12px;
  min-width: 0;
}
.celio-message-avatar {
  width: 28px;
  height: 28px;
}
.celio-message-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.celio-message.user {
  align-self: flex-end;
  max-width: 80%;
  background: var(--soft);
  border-radius: 10px 10px 2px 10px;
  padding: 9px 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.celio-markdown {
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.celio-markdown table {
  border-collapse: collapse;
  font-size: 12px;
}
.celio-markdown th,
.celio-markdown td {
  border: 1px solid var(--line);
  padding: 4px 6px;
}
.celio-steps {
  color: var(--muted);
  font-size: 11px;
}
.celio-steps summary {
  cursor: pointer;
  width: fit-content;
}
.celio-steps ul {
  margin: 4px 0 0;
  padding-left: 18px;
}
.celio-thinking {
  color: var(--muted);
  font-size: 12px;
  padding-left: 36px;
  animation: celio-pulse 1.4s ease-in-out infinite;
}
@keyframes celio-pulse {
  50% {
    opacity: 0.4;
  }
}
@media (prefers-reduced-motion: reduce) {
  .celio-thinking {
    animation: none;
  }
}
.celio-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.celio-action,
.celio-activity-item {
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: grid;
  gap: 6px;
  background: var(--bg);
}
.celio-action.pending,
.celio-activity-item.pending {
  border-color: var(--ink);
}
.celio-action.cancelled {
  opacity: 0.6;
}
.celio-action header,
.celio-activity-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.celio-action.applied .celio-action-status::before,
.celio-activity-item.applied .celio-activity-status::before {
  content: "✓ ";
}
.celio-action.failed .celio-action-status,
.celio-activity-item.failed .celio-activity-status,
.celio-action-error {
  color: #b42318;
}
.celio-action p,
.celio-activity-item p {
  margin: 0;
  font-size: 12px;
}
.celio-action code,
.celio-activity-item code {
  font:
    11px/1.6 ui-monospace,
    monospace;
  background: var(--soft);
  padding: 1px 4px;
  border-radius: 3px;
}
.celio-action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.celio-error {
  margin: 0 28px 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: #fef3f2;
  color: #b42318;
  font-size: 12px;
  white-space: pre-line;
}
.celio-composer {
  border-top: 1px solid var(--line);
  padding: 14px max(28px, calc((100% - 760px) / 2)) 16px;
  display: grid;
  gap: 8px;
}
.celio-composer textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.5;
  background: var(--bg);
}
.celio-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--faint);
  font-size: 10px;
}
.celio-created {
  border-left: 1px solid var(--line);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
}
.celio-created .sessions-sidebar-heading {
  padding-bottom: 12px;
}
.celio-activity {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 14px 16px;
  display: grid;
  align-content: start;
  gap: 18px;
}
.celio-activity-empty p {
  margin: 8px 2px;
  color: var(--muted);
  font-size: 11px;
}
.celio-activity-group {
  display: grid;
  gap: 8px;
}
.celio-activity-group h3 {
  margin: 0;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.celio-activity-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  color: var(--muted);
}
.celio-activity-origin {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.celio-activity-origin:hover,
.celio-activity-link:hover {
  color: var(--ink);
}
.celio-activity-link {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}
/* Telas médias: as criações viram uma gaveta; estreitas: o histórico também. */
@media (max-width: 1180px) {
  .celio-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .celio-created {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 100%);
    z-index: 5;
    box-shadow: -12px 0 32px var(--drawer-shadow);
    display: none;
  }
  .celio-workspace.created-open .celio-created {
    display: flex;
  }
  #celio-created-toggle {
    display: inline-flex;
  }
}
@media (max-width: 820px) {
  .celio-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .celio-history {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 100%);
    z-index: 5;
    box-shadow: 12px 0 32px var(--drawer-shadow);
    display: none;
  }
  .celio-workspace.history-open .celio-history {
    display: flex;
  }
  #celio-history-toggle {
    display: inline-flex;
  }
  .celio-subtitle,
  .celio-model > span {
    display: none;
  }
  .celio-model select {
    max-width: 150px;
  }
}
@media (max-width: 700px) {
  .celio-cta {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    margin: 0 0 10px;
  }
  .celio-cta-avatar,
  .celio-cta-avatar img {
    width: 40px;
    height: 40px;
  }
  .celio-cta-button {
    grid-column: auto;
    margin: 0;
    padding: 0 12px;
  }
  .celio-header {
    padding: 0 12px;
    gap: 8px;
  }
  .celio-header .workspace-back span:last-child,
  .celio-header .workspace-separator {
    display: none;
  }
  .celio-header-actions {
    gap: 4px;
  }
  .celio-header-actions .button {
    padding: 0 8px;
  }
  .celio-new-label {
    display: none;
  }
  .celio-model select {
    max-width: 96px;
  }
  .celio-messages,
  .celio-composer {
    padding-left: 14px;
    padding-right: 14px;
  }
  .celio-chat-header {
    padding: 12px 14px 10px;
  }
  .celio-suggestions {
    grid-template-columns: 1fr;
  }
  #celio-chat-meta {
    display: none;
  }
}

/* Website widget configuration uses the existing channel editor primitives. */
.widget-site-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;margin-bottom:10px;padding:10px;border:1px solid var(--line,#e9e9e9);border-radius:5px}.widget-site-row input,.widget-site-row select{min-width:0;width:100%}.widget-site-row [data-origin]{grid-column:1/-1}.widget-site-row [data-path]{grid-column:1}.widget-site-row [data-mode]{grid-column:1}.widget-site-row [data-widget-remove]{grid-column:2;grid-row:2/4}.widget-preview{display:flex;flex-direction:column;gap:12px;background:#fafafa;border:1px solid #ddd;border-radius:8px;padding:16px;width:100%;margin-top:8px}.widget-preview.mobile{max-width:280px}.widget-preview p{white-space:pre-wrap;overflow-wrap:anywhere;background:white;padding:12px;border-radius:5px}.widget-preview span{font-size:12px;color:#737373}.widget-preview button{border:0;border-radius:50%;width:40px;height:40px;color:white}#widget-settings select,#widget-settings textarea{width:100%}#widget-settings small{display:block;margin:6px 0 12px}#widget-settings details{margin:12px 0}#widget-settings input[type=checkbox]{width:auto}#widget-install textarea{font-family:monospace;font-size:11px}
#webpage-settings select,#webpage-settings textarea{width:100%}#webpage-settings small{display:block;margin:6px 0 12px}#webpage-settings details{margin:12px 0}#webpage-settings input[type=checkbox]{width:auto}#webpage-auth>label{display:block}.webpage-share{margin-top:16px;padding-top:12px;border-top:1px solid var(--line,#e9e9e9)}.webpage-share-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}.webpage-share-actions a.button{text-decoration:none}.webpage-qr{width:168px;height:168px;margin-top:8px;padding:8px;background:#fff;border:1px solid var(--line,#e9e9e9);border-radius:8px}.webpage-qr svg{display:block;width:100%;height:100%;stroke:none}.webpage-qr svg path{stroke:none;fill:#000}
