/* Estúdio: tarefa, conversa e peça; Inter e superfícies da marca. */
.toe-studio {
  --toe-muted: var(--ink-2, var(--muted));
  --toe-well: var(--bg-well, var(--well));
  --toe-line: var(--hairline);
  --toe-action: var(--accent-ink, var(--gain));
  --toe-paper: #f5f1e6;
  --toe-print: #17382e;
  --toe-space: 8px;
  font-family: Inter, var(--font-ui, system-ui), system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  font-size: 14px;
  line-height: 1.5;
}
.toe-studio * {
  box-sizing: border-box;
}
.toe-studio button,
.toe-studio input,
.toe-studio textarea,
.toe-studio select {
  font: inherit;
}
.toe-studio button {
  cursor: pointer;
}
.toe-studio button:disabled {
  cursor: default;
  opacity: 0.45;
}
.toe-studio button:focus-visible,
.toe-studio input:focus-visible,
.toe-studio textarea:focus-visible,
.toe-studio select:focus-visible {
  outline: 2px solid var(--toe-action);
  outline-offset: 3px;
}
.toe-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--toe-line);
}
.toe-identity {
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.toe-studio h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.7px;
}
.toe-studio h2 {
  font-size: 18px;
  line-height: 1.3;
  font-weight: 500;
  margin: 6px 0 0;
  letter-spacing: -0.3px;
}
.toe-kicker {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--toe-muted);
}
.toe-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.toe-button {
  padding: 8px 12px;
  min-height: 40px;
  border: 1px solid var(--toe-line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  white-space: normal;
}
.toe-button:hover {
  background: var(--toe-well);
}
.toe-button--primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.toe-button--primary:hover {
  background: var(--toe-action);
  color: var(--bg);
}
.toe-nav .toe-button {
  border-color: transparent;
  background: transparent;
  color: var(--toe-muted);
}
.toe-nav [aria-current='true'] {
  background: var(--toe-well);
  color: var(--ink);
}
.toe-layout {
  display: grid;
  grid-template-columns: 184px minmax(240px, 0.8fr) minmax(380px, 1.5fr);
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.toe-queue {
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-right: 1px solid var(--toe-line);
  overflow: auto;
}
.toe-queue > .toe-kicker {
  padding: 0 8px;
  margin: 0 0 8px;
}
.toe-task {
  display: grid;
  grid-template-columns: 24px 1fr;
  text-align: left;
  gap: 4px 8px;
  padding: 12px 8px;
  color: var(--toe-muted);
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
}
.toe-task strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.toe-task > span:last-child {
  grid-column: 2;
  font-size: 11px;
}
.toe-task-mark {
  grid-row: span 2;
  font-size: 11px;
  color: var(--toe-action);
  padding-top: 3px;
}
.toe-task[aria-pressed='true'] {
  background: var(--surface);
  border-color: var(--toe-line);
  box-shadow: var(--shadow-card);
}
.toe-text-button {
  background: none;
  border: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 4px;
  color: var(--toe-action);
  padding: 16px 8px;
  font-size: 12px;
}
.toe-local-note {
  font-size: 11px;
  color: var(--toe-muted);
  line-height: 1.6;
}
.toe-queue > .toe-local-note {
  margin-top: auto;
  padding: 24px 8px 0;
}
.toe-conversation {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid var(--toe-line);
}
.toe-conversation-head {
  padding: 24px;
}
.toe-messages {
  padding: 0 24px 24px;
  overflow: auto;
  flex: 1;
  min-height: 80px;
}
.toe-brief {
  padding: 20px 0;
  border-top: 1px solid var(--toe-line);
}
.toe-speaker {
  font-size: 11px;
  font-weight: 600;
  color: var(--toe-action);
  letter-spacing: 0.04em;
}
.toe-studio p {
  margin: 8px 0 0;
}
.toe-note {
  margin: 20px 0;
  padding: 16px 0;
}
.toe-note--operator {
  background: var(--toe-well);
  border-radius: 12px;
  padding: 16px;
}
.toe-note p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.toe-composer {
  padding: 16px;
  border-top: 1px solid var(--toe-line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.toe-composer > .toe-field {
  width: 100%;
}
.toe-composer > .toe-local-note {
  flex: 1;
  text-align: right;
}
.toe-editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--toe-well);
}
.toe-editor-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
}
.toe-editor-top h2 {
  font-size: 14px;
}
.toe-editor-work {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 224px;
  flex: 1;
  overflow: auto;
  min-height: 0;
  align-items: start;
}
.toe-canvas-area {
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100%;
}
.toe-art {
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 2px 4px #0000000a,
    0 16px 44px -24px #00000060;
  background: var(--toe-paper);
}
.toe-art svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
}
.toe-controls {
  padding: 16px 20px;
  min-width: 0;
  border-left: 1px solid var(--toe-line);
  align-self: stretch;
  background: var(--surface);
}
.toe-editor-tabs {
  display: flex;
  gap: 0;
  margin: 0 -8px 20px;
}
.toe-editor-tabs .toe-button {
  padding: 8px;
  border: 0;
  background: transparent;
  font-size: 12px;
  border-radius: 4px;
}
.toe-editor-tabs [aria-pressed='true'] {
  color: var(--toe-action);
  box-shadow: inset 0 -2px var(--toe-action);
}
.toe-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
}
.toe-field input,
.toe-field textarea,
.toe-field select {
  border: 1px solid var(--toe-line);
  border-radius: 8px;
  background: var(--toe-well);
  color: var(--ink);
  padding: 10px;
  width: 100%;
  min-width: 0;
  line-height: 1.5;
}
.toe-field textarea {
  resize: vertical;
  min-height: 56px;
  max-height: 200px;
}
.toe-field input,
.toe-field select {
  min-height: 40px;
}
.toe-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.toe-gallery > .toe-kicker {
  grid-column: 1/-1;
}
.toe-image-choice {
  padding: 6px;
  border: 1px solid var(--toe-line);
  border-radius: 8px;
  background: var(--toe-well);
  color: var(--ink);
  font-size: 12px;
}
.toe-image-choice svg {
  width: 100%;
  max-height: 90px;
  display: block;
  margin-bottom: 6px;
}
.toe-image-choice[aria-pressed='true'] {
  outline: 2px solid var(--toe-action);
  outline-offset: 1px;
}
.toe-editor-footer {
  padding: 12px 20px;
  background: var(--surface);
  border-top: 1px solid var(--toe-line);
}
.toe-save-status {
  font-size: 11px;
  color: var(--toe-muted);
}
.toe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}
.toe-actions .toe-button {
  font-size: 12px;
}
.toe-version {
  padding: 12px 0;
  border-bottom: 1px solid var(--toe-line);
  display: grid;
  gap: 8px;
  overflow-wrap: anywhere;
}
.toe-status {
  padding: 8px 24px;
  background: var(--surface);
  border-top: 1px solid var(--toe-line);
  font-size: 12px;
  color: var(--toe-action);
}
.toe-studio[data-expanded='true'] .toe-layout {
  grid-template-columns: minmax(0, 1fr);
}
.toe-studio[data-expanded='true'] .toe-queue,
.toe-studio[data-expanded='true'] .toe-conversation {
  display: none;
}
.toe-studio[data-expanded='true'] .toe-editor-work {
  grid-template-columns: minmax(0, 1fr) 300px;
}
.toe-studio[data-expanded='true'] .toe-art {
  max-width: 480px;
}
.toe-studio[data-expanded='true'] .toe-art svg {
  max-height: 650px;
}
#toe-workspace {
  flex: 1;
  min-height: 0;
}
#toe-workspace[hidden],
.shell[hidden] {
  display: none;
}
@media (max-width: 1200px) {
  .toe-layout {
    grid-template-columns: 160px minmax(220px, 0.85fr) minmax(330px, 1.2fr);
  }
  .toe-editor-work {
    grid-template-columns: 1fr;
  }
  .toe-controls {
    border-left: 0;
    border-top: 1px solid var(--toe-line);
  }
  .toe-art {
    max-width: 300px;
  }
  .toe-canvas-area {
    min-height: 0;
    padding: 20px;
  }
  .toe-art svg {
    max-height: 360px;
  }
  .toe-editor-tabs {
    margin-bottom: 12px;
  }
  .toe-studio[data-expanded='true'] .toe-art {
    max-width: 480px;
  }
}
@media (max-width: 800px) {
  .toe-top {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .toe-identity {
    gap: 8px;
  }
  .toe-layout {
    grid-template-columns: minmax(180px, 0.8fr) minmax(280px, 1.2fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .toe-queue {
    grid-column: 1/-1;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--toe-line);
    overflow: visible;
  }
  .toe-queue > .toe-kicker,
  .toe-queue > .toe-local-note {
    display: none;
  }
  .toe-task {
    padding: 6px 8px;
  }
  .toe-task > span:last-child {
    display: none;
  }
  .toe-task-mark {
    grid-row: auto;
  }
  .toe-text-button {
    padding: 8px;
  }
  .toe-conversation-head,
  .toe-messages {
    padding: 16px;
  }
  .toe-editor-top {
    padding: 12px;
  }
  .toe-studio[data-expanded='true'] .toe-layout {
    grid-template-rows: 1fr;
  }
  .toe-studio[data-expanded='true'] .toe-editor-work {
    grid-template-columns: minmax(0, 1fr) 240px;
  }
}
@media (max-width: 560px) {
  .toe-studio {
    height: auto;
    min-height: 100%;
  }
  .toe-layout {
    display: flex;
    flex-direction: column;
  }
  .toe-conversation {
    border-right: 0;
  }
  .toe-messages {
    max-height: 220px;
  }
  .toe-conversation-head h2 {
    font-size: 16px;
  }
  .toe-brief {
    padding: 12px 0;
  }
  .toe-composer {
    padding: 12px 16px;
  }
  .toe-editor {
    min-height: 600px;
  }
  .toe-editor-work,
  .toe-studio[data-expanded='true'] .toe-editor-work {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }
  .toe-canvas-area,
  .toe-controls {
    width: 100%;
  }
  .toe-editor-top {
    flex-wrap: wrap;
    padding: 16px;
  }
  .toe-art {
    max-width: 280px;
  }
  .toe-field input,
  .toe-field textarea,
  .toe-field select {
    font-size: 16px;
  }
  .toe-studio[data-expanded='true'] .toe-art {
    max-width: 300px;
  }
  .toe-studio[data-expanded='true'] .toe-art svg {
    max-height: 520px;
  }
  #toe-workspace {
    overflow: auto;
  }
  .toe-nav .toe-button {
    min-height: 44px;
  }
  .toe-button {
    min-height: 44px;
  }
  .toe-top h1 {
    font-size: 21px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .toe-studio button:active:not(:disabled) {
    transform: scale(0.98);
  }
}

/* Ajustar a peça ao espaço medido do canvas, sem cortar sua chamada final. */
@media (min-width: 1201px) {
  .toe-editor-work {
    grid-template-rows: minmax(0, 1fr);
  }
  .toe-canvas-area {
    container-type: size;
    min-height: 0;
    height: 100%;
    align-self: stretch;
  }
  .toe-art {
    width: min(100cqw, calc(100cqh * var(--toe-ratio)));
    max-width: 420px;
  }
  .toe-art svg {
    max-height: none;
  }
}
@media (min-width: 561px) {
  .toe-studio[data-expanded='true'] .toe-editor-work {
    grid-template-rows: minmax(0, 1fr);
  }
  .toe-studio[data-expanded='true'] .toe-canvas-area {
    container-type: size;
    min-height: 0;
    height: 100%;
    align-self: stretch;
  }
  .toe-studio[data-expanded='true'] .toe-art {
    width: min(100cqw, calc(100cqh * var(--toe-ratio)));
    max-width: 600px;
  }
  .toe-studio[data-expanded='true'] .toe-art svg {
    max-height: none;
  }
}
@media (max-width: 1200px) {
  .toe-editor-work {
    display: block;
  }
  .toe-canvas-area {
    height: auto;
  }
}
@media (min-width: 561px) {
  .toe-studio[data-expanded='true'] .toe-editor-work {
    display: grid;
  }
  .toe-studio[data-expanded='true'] .toe-canvas-area {
    height: 100%;
  }
  .toe-studio[data-expanded='true'] .toe-top {
    padding-block: 8px;
  }
  .toe-studio[data-expanded='true'] .toe-editor-top {
    padding-block: 12px;
  }
}
.toe-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.toe-editor-footer .toe-actions {
  margin-top: 0;
}

.toe-mobile-nav {
  display: none;
}
@media (max-width: 560px) {
  .toe-mobile-nav {
    display: flex;
    gap: 8px;
    width: 100%;
  }
  .toe-mobile-nav .toe-button {
    flex: 1;
  }
  .toe-mobile-nav [aria-pressed='true'] {
    background: var(--ink);
    color: var(--bg);
  }
  .toe-studio[data-mobile-view='peca'] .toe-conversation {
    display: none;
  }
  .toe-studio[data-mobile-view='conversa']:not([data-expanded='true'])
    .toe-editor {
    display: none;
  }
  .toe-studio .toe-art svg {
    max-height: 300px;
  }
  .toe-studio .toe-task {
    min-height: 44px;
  }
  .toe-queue {
    gap: 4px;
  }
  .toe-text-button {
    font-size: 11px;
    padding: 4px 8px;
    min-height: 40px;
  }
  .toe-studio[data-expanded='true'] .toe-art svg {
    max-height: 460px;
  }
}
