/* Saga Creative Agent — a calm command surface inspired by agent-led creative tools. */
:root {
  --agent-paper: rgba(248, 247, 243, .93);
  --agent-ink: #171819;
  --agent-muted: #676b6e;
  --agent-faint: rgba(21, 23, 24, .075);
  --agent-line: rgba(21, 23, 24, .11);
  --agent-ease: cubic-bezier(.2, .8, .2, 1);
}

.agent-console,
body.agent-has-run:not(.agent-collapsed) .agent-console {
  top: 20px;
  right: 20px;
  bottom: auto;
  left: auto;
  display: flex;
  width: min(480px, calc(100vw - 40px));
  max-height: calc(100% - 40px);
  overflow: hidden;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, .66);
  border-radius: 28px;
  background:
    radial-gradient(circle at 8% -8%, rgba(255, 255, 255, .92), transparent 33%),
    linear-gradient(150deg, rgba(255, 255, 255, .5), transparent 48%),
    var(--agent-paper);
  color: var(--agent-ink);
  box-shadow:
    0 30px 100px rgba(0, 0, 0, .52),
    inset 0 1px rgba(255, 255, 255, .9),
    inset 0 -1px rgba(0, 0, 0, .035);
  transform: none;
  -webkit-backdrop-filter: blur(28px) saturate(1.16);
  backdrop-filter: blur(28px) saturate(1.16);
  transition:
    width 150ms var(--agent-ease),
    max-height 150ms var(--agent-ease),
    box-shadow 150ms var(--agent-ease);
}

.agent-console-head {
  min-height: 67px;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(18, 20, 21, .07);
}

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

.agent-orb {
  width: 36px;
  height: 36px;
  border-color: rgba(20, 22, 23, .1);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .28), transparent 45%),
    #191a1b;
  color: #f7f7f4;
  box-shadow: 0 7px 19px rgba(0, 0, 0, .16), inset 0 1px rgba(255, 255, 255, .14);
}

.agent-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.agent-title strong,
.agent-title small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-title strong {
  color: var(--agent-ink);
  font-size: 13px;
  letter-spacing: -.01em;
}

.agent-title small {
  color: #737779;
  font-size: 7.5px;
}

.agent-live-dot {
  background: #37a886;
  box-shadow: 0 0 7px rgba(55, 168, 134, .48);
}

.agent-access {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  margin-left: auto;
  flex: 0 0 auto;
  padding: 0 8px;
  border: 1px solid rgba(18, 20, 21, .075);
  border-radius: 999px;
  background: rgba(255, 255, 255, .36);
  color: #777a7c;
  font: 600 7.5px/1 var(--mono);
  white-space: nowrap;
}

.agent-access svg {
  width: 11px;
  height: 11px;
}

.agent-minimise {
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #737779;
  transition:
    transform 100ms var(--agent-ease),
    color 100ms var(--agent-ease),
    background-color 100ms var(--agent-ease);
}

.agent-minimise:hover {
  border-color: rgba(18, 20, 21, .07);
  background: rgba(18, 20, 21, .055);
  color: #171819;
}

.agent-dialogue {
  min-height: 0;
  overflow-y: auto;
  padding: 20px 20px 13px;
  scrollbar-color: rgba(21, 23, 24, .14) transparent;
  scrollbar-width: thin;
}

.agent-welcome {
  display: grid;
  gap: 10px;
  padding: 1px 2px 10px;
}

.agent-welcome > strong {
  color: var(--agent-ink);
  font: 600 22px/1.1 var(--serif);
  letter-spacing: -.025em;
}

.agent-welcome > p {
  max-width: 390px;
  margin: 0;
  color: var(--agent-muted);
  font-size: 12px;
  line-height: 1.55;
}

.agent-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 3px;
}

.agent-capabilities > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  padding: 0 9px;
  border: 1px solid rgba(18, 20, 21, .075);
  border-radius: 999px;
  background: rgba(255, 255, 255, .42);
  color: #626668;
  font: 600 7.5px/1 var(--mono);
}

.agent-capabilities svg {
  width: 11px;
  height: 11px;
}

.agent-user-brief {
  width: fit-content;
  max-width: 88%;
  margin: 1px 0 18px auto;
  padding: 11px 14px;
  border: 1px solid rgba(18, 20, 21, .055);
  border-radius: 17px 17px 5px;
  background: rgba(20, 22, 23, .055);
  color: #292b2c;
  font-size: 12px;
  line-height: 1.5;
}

.agent-run {
  max-height: none;
  padding: 0;
  color: var(--agent-ink);
}

.agent-run > header {
  align-items: flex-start;
  padding: 0 0 11px;
  border-top: 0;
  border-bottom: 1px solid rgba(18, 20, 21, .075);
}

.agent-run > header > span {
  gap: 5px;
}

.agent-run > header strong {
  color: #202223;
  font-size: 13px;
}

.agent-run > header small {
  max-width: 335px;
  color: var(--agent-muted);
  font-size: 9.5px;
  line-height: 1.4;
}

.agent-stop {
  padding-top: 3px;
  color: #a45b5b;
  font-size: 7.5px;
}

.agent-run ol {
  display: grid;
  gap: 0;
  overflow: visible;
  padding: 8px 0 2px;
}

.agent-step {
  position: relative;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  min-width: 0;
  padding: 8px 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #8a8d8f;
  transition:
    color 110ms var(--agent-ease),
    background-color 110ms var(--agent-ease);
}

.agent-step + .agent-step::before {
  position: absolute;
  top: -9px;
  left: 15px;
  width: 1px;
  height: 18px;
  background: rgba(18, 20, 21, .1);
  content: "";
}

.agent-step > span:first-child {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(18, 20, 21, .08);
  border-radius: 999px;
  background: rgba(20, 22, 23, .04);
}

.agent-step svg {
  width: 12px;
  height: 12px;
}

.agent-step strong {
  color: inherit;
  font: 600 9px/1.25 var(--mono);
}

.agent-step small {
  color: inherit;
  font-size: 7.5px;
}

.agent-step.running {
  border-color: transparent;
  background: rgba(55, 168, 134, .065);
  color: #247e66;
}

.agent-step.running > span:first-child {
  border-color: rgba(55, 168, 134, .2);
  background: rgba(55, 168, 134, .11);
}

.agent-step.done {
  color: #292b2c;
}

.agent-step.done > span:first-child {
  border-color: rgba(55, 168, 134, .22);
  background: rgba(55, 168, 134, .1);
  color: #25896d;
}

.agent-step.failed {
  border-color: transparent;
  background: rgba(164, 91, 91, .065);
  color: #a45b5b;
}

.agent-examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 7px 0 0;
}

.agent-examples button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: none;
  height: 54px;
  padding: 7px 9px;
  border-color: rgba(18, 20, 21, .08);
  border-radius: 13px;
  background: rgba(255, 255, 255, .34);
  color: #6b6f71;
  text-align: left;
}

.agent-examples button:hover {
  border-color: rgba(18, 20, 21, .16);
  background: rgba(255, 255, 255, .72);
  color: #1c1e1f;
}

.agent-examples button > svg {
  width: 28px;
  height: 28px;
  padding: 7px;
  border-radius: 9px;
  background: rgba(18, 20, 21, .05);
  color: #387f6d;
}

.agent-examples button > span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.agent-examples button strong {
  color: #282a2b;
  font: 600 9px/1 var(--sans);
}

.agent-examples button small {
  overflow: hidden;
  color: #828587;
  font: 500 7px/1.2 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-form {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "prompt"
    "attachments"
    "actions";
  gap: 7px;
  margin: 0 14px 14px;
  padding: 13px;
  border: 1px solid rgba(18, 20, 21, .1);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .62), transparent 46%),
    rgba(20, 22, 23, .045);
  box-shadow: inset 0 1px rgba(255, 255, 255, .66);
  transition:
    border-color 120ms var(--agent-ease),
    box-shadow 120ms var(--agent-ease),
    background-color 120ms var(--agent-ease);
}

.agent-form:focus-within {
  border-color: rgba(18, 20, 21, .2);
  background-color: rgba(255, 255, 255, .34);
  box-shadow:
    0 0 0 3px rgba(18, 20, 21, .035),
    inset 0 1px rgba(255, 255, 255, .8);
}

.agent-form textarea {
  min-height: 65px;
  max-height: 130px;
  padding: 0 1px;
  color: var(--agent-ink);
  caret-color: #171819;
  font-size: 13px;
  line-height: 1.5;
}

.agent-form textarea::placeholder {
  color: #8a8d8f;
}

.agent-attachments {
  grid-area: attachments;
  padding-bottom: 2px;
}

.agent-attachment {
  border-color: rgba(18, 20, 21, .1);
  background: rgba(255, 255, 255, .57);
  color: #5f6365;
}

.agent-attachment button {
  color: #85898b;
}

.agent-attachment button:hover {
  color: #171819;
}

.agent-form-foot {
  grid-area: actions;
  min-width: 0;
  padding-top: 5px;
  border-top: 0;
}

.agent-input-tools {
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  color: #7b7f81;
  font-size: 7.5px;
}

.agent-tool {
  width: 34px;
  height: 34px;
  padding: 0;
  border-color: rgba(18, 20, 21, .07);
  border-radius: 999px;
  background: rgba(255, 255, 255, .52);
  color: #1d1f20;
  box-shadow: inset 0 1px rgba(255, 255, 255, .7);
}

.agent-tool span:last-child {
  display: none;
}

.agent-tool:hover {
  border-color: rgba(18, 20, 21, .14);
  background: rgba(255, 255, 255, .84);
  color: #171819;
}

.agent-input-tools > span {
  display: inline;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-shortcut {
  display: none;
  color: #949799;
  font: 500 7px/1 var(--mono);
}

.agent-mode-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  margin-left: auto;
  flex: 0 0 auto;
  padding: 0 7px;
  border: 1px solid rgba(18, 20, 21, .07);
  border-radius: 999px;
  background: rgba(255, 255, 255, .42);
  color: #777a7c;
}

.agent-mode-control > svg {
  width: 11px;
  height: 11px;
}

.agent-mode-control select {
  max-width: 80px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #626668;
  cursor: pointer;
  font: 600 7px/1 var(--mono);
}

.agent-submit {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  margin-left: 2px;
  padding: 0;
  border: 1px solid #151617;
  border-radius: 999px;
  background: #171819;
  color: #f8f8f5;
  box-shadow: 0 7px 17px rgba(0, 0, 0, .17), inset 0 1px rgba(255, 255, 255, .12);
}

.agent-submit span:last-child {
  display: none;
}

.agent-submit:hover {
  border-color: #000;
  background: #050606;
  box-shadow: 0 9px 21px rgba(0, 0, 0, .22);
}

.agent-submit:disabled {
  background: #5f6263;
  opacity: .52;
}

.agent-submit svg {
  width: 16px;
  height: 16px;
}

.board-tools,
body.agent-collapsed .board-tools,
body.agent-has-run:not(.agent-collapsed) .board-tools {
  top: 20px;
  right: 516px;
}

.drop-guide,
body.agent-collapsed .drop-guide,
body.agent-has-run:not(.agent-collapsed) .drop-guide {
  top: 72px;
  right: 516px;
}

.agent-restore {
  top: auto;
  right: 20px;
  bottom: 20px;
  left: auto;
  height: 42px;
  border-color: rgba(255, 255, 255, .15);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .09), transparent 42%),
    rgba(17, 19, 21, .88);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .42), inset 0 1px rgba(255, 255, 255, .08);
  transform: none;
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

/* Keep canvas interactions on the compositor: translucent fills retain the look
   without forcing the moving 12k canvas through live backdrop filters. */
.agent-console,
.agent-restore,
.board-tools .segmented,
.board-tools .scope-toggle,
.board-tools .search-box,
.board-tools > .icon-btn,
.mix-launch,
.zoom-tools,
.lane-heading,
.lane-add {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

@media (max-width: 1180px) {
  .agent-console,
  body.agent-has-run:not(.agent-collapsed) .agent-console {
    width: min(430px, calc(100vw - 40px));
  }

  .board-tools,
  body.agent-collapsed .board-tools,
  body.agent-has-run:not(.agent-collapsed) .board-tools {
    right: 466px;
  }

  .board-tools .search-box {
    width: 44px;
    overflow: hidden;
  }

  .board-tools .search-box:focus-within {
    width: 180px;
  }
}

@media (max-width: 900px) {
  .agent-console,
  body.agent-has-run:not(.agent-collapsed) .agent-console {
    top: auto;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
    max-height: min(72dvh, 650px);
    border-radius: 23px;
  }

  .board-tools,
  body.agent-collapsed .board-tools,
  body.agent-has-run:not(.agent-collapsed) .board-tools {
    top: 50px;
    right: 8px;
    left: 8px;
  }

  .drop-guide,
  body.agent-collapsed .drop-guide,
  body.agent-has-run:not(.agent-collapsed) .drop-guide {
    top: 102px;
    right: 8px;
  }

  .agent-restore {
    right: 10px;
    bottom: 10px;
  }
}

@media (max-width: 560px) {
  .agent-console-head {
    min-height: 58px;
    padding: 9px 10px 8px;
  }

  .agent-access {
    display: none;
  }

  .agent-dialogue {
    padding: 14px 14px 9px;
  }

  .agent-welcome > strong {
    font-size: 19px;
  }

  .agent-capabilities {
    display: none;
  }

  .agent-examples {
    grid-template-columns: 1fr;
  }

  .agent-examples button:nth-child(n + 4) {
    display: none;
  }

  .agent-form {
    margin: 0 8px 8px;
    padding: 11px;
    border-radius: 18px;
  }

  .agent-form textarea {
    min-height: 51px;
  }

  .agent-input-tools > span,
  .agent-shortcut,
  .agent-mode-control > svg {
    display: none;
  }

  .agent-mode-control {
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-console,
  .agent-form,
  .agent-minimise,
  .agent-step {
    transition: none;
  }
}
