/* One chat presentation across the app; Studio canvas and conversation ownership stay route-specific. */

html.zimla-ai-start .zimla-ai-composer__box > button,
html.zimla-ai-start .zimla-ai-composer__box > .zimla-ai-attachments summary,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer__box > button,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer__box > .zimla-ai-attachments summary {
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  line-height: 0;
}
html.zimla-ai-start .zimla-ai-attachments,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-attachments {
  position: relative;
}
html.zimla-ai-start .zimla-ai-attachments__body,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-attachments__body {
  right: auto;
  width: min(15.5rem, calc(100vw - 2.5rem));
  max-height: min(40dvh, 18rem);
  transform-origin: 1.1rem bottom;
}
html.zimla-ai-start .zimla-ai-attachments__upload button,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-attachments__upload button {
  display: flex;
  width: 100%;
  height: auto;
  min-height: 2.25rem;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.55rem;
  line-height: 1.3;
  background: transparent;
  color: #35574a;
}
html.zimla-ai-start .zimla-ai-attachments__upload button .material-symbols-outlined,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-attachments__upload button .material-symbols-outlined {
  display: inline-block;
  font-size: 1.1rem;
  line-height: 1;
}
html.zimla-ai-start .zimla-ai-attachments__body p,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-attachments__body p {
  margin: 0.2rem 0.5rem 0.35rem;
  font-size: 0.72rem;
  line-height: 1.4;
}


html.zimla-ai-start.zimla-ai-start-working .zimla-chat-run--answered .zimla-chat-run__reasoning,
html.zimla-ai-start.zimla-ai-start-working .zimla-chat-run--answered .zimla-chat-run__tools,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run--answered .zimla-chat-run__reasoning,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run--answered .zimla-chat-run__tools {
  display: none !important;
}


html:not(.zimla-ai-start) .zimla-ai-panel {
  --bg-recessed: #F2F2F2;
  --radius-control: 8px;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --elevation-sm: 0px 2px 3px -1px rgba(0, 0, 0, .1), 0px 1px 0px 0px rgba(25, 28, 33, .02), 0px 0px 0px 1px rgba(25, 28, 33, .08);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.2px;
}

html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message:has(> .zimla-ai-message__avatar),
html.zimla-ai-start.zimla-ai-start-working .zimla-chat-run:has(> .zimla-ai-message__avatar),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message:has(> .zimla-ai-message__avatar),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run:has(> .zimla-ai-message__avatar) {
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-template-columns: 1.85rem minmax(0, 1fr);
  column-gap: 0.75rem;
  row-gap: 0.2rem;
  align-items: start;
  flex-wrap: nowrap;
}
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message--user:has(> .zimla-ai-message__avatar),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message--user:has(> .zimla-ai-message__avatar) {
  grid-template-columns: minmax(0, 1fr) 1.85rem;
}
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message > .zimla-ai-message__avatar,
html.zimla-ai-start.zimla-ai-start-working .zimla-chat-run > .zimla-ai-message__avatar,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message > .zimla-ai-message__avatar,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run > .zimla-ai-message__avatar {
  grid-column: 1;
  grid-row: 1;
}
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message > .zimla-ai-message__stack,
html.zimla-ai-start.zimla-ai-start-working .zimla-chat-run > .zimla-ai-message__stack,
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message > .zimla-ai-message__bubble,
html.zimla-ai-start.zimla-ai-start-working .zimla-chat-run > .zimla-ai-message__bubble,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message > .zimla-ai-message__stack,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run > .zimla-ai-message__stack,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message > .zimla-ai-message__bubble,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run > .zimla-ai-message__bubble {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  width: auto;
}
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message--user > .zimla-ai-message__avatar,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message--user > .zimla-ai-message__avatar {
  grid-column: 2;
}
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message--user > .zimla-ai-message__stack,
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message--user > .zimla-ai-message__bubble,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message--user > .zimla-ai-message__stack,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message--user > .zimla-ai-message__bubble {
  grid-column: 1;
}
html.zimla-ai-start .zimla-ai-message__stack,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__stack {
  display: grid;
  min-width: 0;
  gap: 0.28rem;
}
/* Optimistic user bubble drawn at submit, before the server exchange lands. */
.zimla-ai-message--user.zimla-ai-message--pending {
  opacity: 0.62;
  transition: opacity 160ms ease-out;
}
html.zimla-ai-start .zimla-ai-message__meta,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__meta {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
  padding-inline: 0.15rem;
}
html.zimla-ai-start .zimla-ai-message--user .zimla-ai-message__meta,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message--user .zimla-ai-message__meta {
  justify-content: flex-end;
}
html.zimla-ai-start .zimla-ai-message__name,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__name {
  color: #2a322c;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}
html.zimla-ai-start .zimla-ai-message__time,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__time {
  color: #8a948c;
  font-size: 0.66rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
html.zimla-ai-start .zimla-ai-message__avatar,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__avatar {
  display: inline-flex;
  width: 1.85rem;
  height: 1.85rem;
  flex: none;
  align-items: center;
  justify-content: center;
  margin-top: 0.05rem;
  border-radius: 999px;
  background: #eaf6ef;
}
html.zimla-ai-start .zimla-ai-message__avatar--ai,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__avatar--ai {
  background: transparent;
}
html.zimla-ai-start .zimla-ai-message__avatar--user,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__avatar--user {
  color: #086b4d;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
html.zimla-ai-start .zimla-ai-message__mark,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__mark {
  display: grid;
  width: 0.82rem;
  height: 0.82rem;
  grid-template-columns: 1fr 1fr;
  gap: 0.12rem;
}
html.zimla-ai-start .zimla-ai-message__mark span,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__mark span {
  display: block;
  border-radius: 999px;
}
html.zimla-ai-start .zimla-ai-message__mark span:nth-child(1),
html.zimla-ai-start .zimla-ai-message__mark span:nth-child(3),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__mark span:nth-child(1),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__mark span:nth-child(3) {
  background: #27272a;
}
html.zimla-ai-start .zimla-ai-message__mark span:nth-child(2),
html.zimla-ai-start .zimla-ai-message__mark span:nth-child(4),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__mark span:nth-child(2),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__mark span:nth-child(4) {
  background: #087858;
}
html.zimla-ai-start .zimla-ai-message__bubble,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__bubble {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: none;
}
html.zimla-ai-start.zimla-ai-start-working .zimla-chat-run__answer .zimla-ai-message__bubble,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__answer .zimla-ai-message__bubble {
  width: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}



html.zimla-ai-start.zimla-ai-start-working .zimla-chat-message-actions,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-message-actions {
  grid-column: 2;
  grid-row: 2;
  flex: none;
  width: auto;
  margin-top: 0.1rem;
}
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message--user > .zimla-chat-message-actions,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message--user > .zimla-chat-message-actions {
  grid-column: 1;
  justify-self: end;
}



html.zimla-ai-start.zimla-ai-start-working .zimla-ai-composer__box,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer__box {
  order: 1;
  min-height: 2.9rem;
  align-items: center;
  padding: 0.28rem 0.32rem;
  border-radius: 999px;
  overflow: visible;
}
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-composer textarea,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer textarea {
  min-height: 2.25rem;
  padding: 0.5rem 0.45rem;
  font-size: 0.9rem;
  line-height: 1.25rem;
}
html.zimla-ai-start .zimla-ai-composer__box > button .material-symbols-outlined,
html.zimla-ai-start .zimla-ai-composer__box > .zimla-ai-attachments summary .material-symbols-outlined,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer__box > button .material-symbols-outlined,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer__box > .zimla-ai-attachments summary .material-symbols-outlined {
  display: block;
  font-size: 1.2rem;
  line-height: 1;
}



html.zimla-ai-start .zimla-chat-run__activity,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.1rem 0.5rem; max-width: none; padding: 0; }
html.zimla-ai-start .zimla-chat-run__elapsed,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__elapsed { grid-area: 1 / 2; margin: 0; color: #8a948c; font-size: 0.64rem; font-variant-numeric: tabular-nums; }
html.zimla-ai-start .zimla-chat-run[data-chat-state="completed"] .zimla-chat-run__elapsed,
html.zimla-ai-start .zimla-chat-run[data-chat-state="failed"] .zimla-chat-run__elapsed,
html.zimla-ai-start .zimla-chat-run[data-chat-state="cancelled"] .zimla-chat-run__elapsed,
html.zimla-ai-start .zimla-chat-run[data-chat-state="interrupted"] .zimla-chat-run__elapsed,
html.zimla-ai-start .zimla-chat-run--history .zimla-chat-run__elapsed,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run[data-chat-state="completed"] .zimla-chat-run__elapsed,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run[data-chat-state="failed"] .zimla-chat-run__elapsed,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run[data-chat-state="cancelled"] .zimla-chat-run__elapsed,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run[data-chat-state="interrupted"] .zimla-chat-run__elapsed,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run--history .zimla-chat-run__elapsed {
  display: none;
}
html.zimla-ai-start .zimla-chat-run__activity > :not(.zimla-chat-run__elapsed):not(.zimla-chat-run__activity-current),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity > :not(.zimla-chat-run__elapsed):not(.zimla-chat-run__activity-current) { grid-column: 1 / -1; }
html.zimla-ai-start .zimla-chat-run__activity-current,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-current {
  grid-area: 1 / 1;
  display: inline-flex !important;
  position: relative;
  align-items: center;
  gap: 0.38rem;
  justify-self: start;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  min-height: 1.55rem;
  padding: 0.18rem 0.62rem 0.18rem 0.34rem;
  overflow: hidden;
  border: 1px solid #d7e3db;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #3e4a3d;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
html.zimla-ai-start .zimla-chat-run__activity-current [data-chat-activity-label],
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-current [data-chat-activity-label] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html.zimla-ai-start .zimla-chat-run[data-chat-state="completed"] .zimla-chat-run__activity-current,
html.zimla-ai-start .zimla-chat-run[data-chat-state="failed"] .zimla-chat-run__activity-current,
html.zimla-ai-start .zimla-chat-run[data-chat-state="cancelled"] .zimla-chat-run__activity-current,
html.zimla-ai-start .zimla-chat-run[data-chat-state="interrupted"] .zimla-chat-run__activity-current,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run[data-chat-state="completed"] .zimla-chat-run__activity-current,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run[data-chat-state="failed"] .zimla-chat-run__activity-current,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run[data-chat-state="cancelled"] .zimla-chat-run__activity-current,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run[data-chat-state="interrupted"] .zimla-chat-run__activity-current {
  display: none !important;
}
html.zimla-ai-start .zimla-chat-run__activity-current[data-chat-activity-state] .zimla-chat-run__activity-mark,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-current[data-chat-activity-state] .zimla-chat-run__activity-mark {
  display: grid;
  width: 0.72rem;
  height: 0.72rem;
  margin: 0;
  flex: none;
  grid-template-columns: 1fr 1fr;
  gap: 0.1rem;
  border: 0;
  background: transparent;
  box-shadow: none;
  animation: zimla-status-spin 1.15s linear infinite;
}
html.zimla-ai-start .zimla-chat-run__activity-current .zimla-chat-run__activity-mark span,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-current .zimla-chat-run__activity-mark span {
  display: block;
  border-radius: 999px;
}
html.zimla-ai-start .zimla-chat-run__activity-current .zimla-chat-run__activity-mark span:nth-child(1),
html.zimla-ai-start .zimla-chat-run__activity-current .zimla-chat-run__activity-mark span:nth-child(3),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-current .zimla-chat-run__activity-mark span:nth-child(1),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-current .zimla-chat-run__activity-mark span:nth-child(3) { background: #27272a; }
html.zimla-ai-start .zimla-chat-run__activity-current .zimla-chat-run__activity-mark span:nth-child(2),
html.zimla-ai-start .zimla-chat-run__activity-current .zimla-chat-run__activity-mark span:nth-child(4),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-current .zimla-chat-run__activity-mark span:nth-child(2),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-current .zimla-chat-run__activity-mark span:nth-child(4) { background: #087858; }
html.zimla-ai-start .zimla-chat-run__activity-history summary,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-history summary {
  display: flex;
  width: fit-content;
  min-height: 36px;
  align-items: center;
  gap: 0.32rem;
  cursor: pointer;
  list-style: none;
  color: #6b776f;
  font-size: 0.74rem;
  font-weight: 500;
}
html.zimla-ai-start .zimla-chat-run__activity-history summary::-webkit-details-marker,
html.zimla-ai-start .zimla-chat-run__activity-history summary::before,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-history summary::-webkit-details-marker,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-history summary::before {
  display: none;
  content: none;
}
html.zimla-ai-start .zimla-chat-run__activity-history summary::after,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-history summary::after {
  content: "";
  width: 0.32rem;
  height: 0.32rem;
  flex: none;
  margin-top: -0.08rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
}
html.zimla-ai-start .zimla-chat-run__activity-history[open] summary::after,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-history[open] summary::after {
  margin-top: 0.02rem;
  transform: rotate(45deg);
}
html.zimla-ai-start .zimla-chat-run__activity-history:not([open]) ol,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-history:not([open]) ol {
  display: none !important;
}
html.zimla-ai-start .zimla-chat-run__activity-history[open] ol,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-history[open] ol {
  display: grid;
  gap: 0.08rem;
  margin: 0.15rem 0 0;
  padding: 0;
}

@media (max-width: 1023px) {

html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message:has(> .zimla-ai-message__avatar),
  html.zimla-ai-start.zimla-ai-start-working .zimla-chat-run:has(> .zimla-ai-message__avatar),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message:has(> .zimla-ai-message__avatar),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run:has(> .zimla-ai-message__avatar) {
    grid-template-columns: 1.5rem minmax(0, 1fr);
    column-gap: 0.5rem;
  }
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message--user:has(> .zimla-ai-message__avatar),
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message--user:has(> .zimla-ai-message__avatar) {
    grid-template-columns: minmax(0, 1fr) 1.5rem;
  }
html.zimla-ai-start .zimla-ai-message__avatar,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__avatar {
    width: 1.5rem;
    height: 1.5rem;
    margin-top: 0.05rem;
  }
html.zimla-ai-start .zimla-ai-message__avatar--ai,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__avatar--ai {
    background: transparent;
  }
html.zimla-ai-start .zimla-ai-message__meta,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__meta {
    flex-wrap: nowrap;
    gap: 0.28rem;
    min-width: 0;
  }
html.zimla-ai-start .zimla-ai-message__name,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.74rem;
  }
html.zimla-ai-start .zimla-ai-message__time,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__time {
    flex: none;
    font-size: 0.62rem;
  }
html.zimla-ai-start.zimla-ai-start-working .zimla-chat-message-actions button,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-message-actions button {
    width: 44px;
    min-height: 44px;
  }
html.zimla-ai-start .zimla-ai-message__mark,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__mark {
    width: 0.66rem;
    height: 0.66rem;
    gap: 0.1rem;
  }


}


html.zimla-ai-start.zimla-ai-start-working .zimla-ai-composer__box,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer__box {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0;
  border-radius: var(--radius-control);
  box-shadow: var(--elevation-sm);
}
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-composer__box:focus-within,
html.zimla-ai-start [data-chat-runtime-root] .zimla-ai-composer__box:focus-within,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer__box:focus-within,
html:not(.zimla-ai-start) .zimla-ai-panel [data-chat-runtime-root] .zimla-ai-composer__box:focus-within {
  border-color: inherit;
  box-shadow: var(--elevation-sm);
  outline: none;
}
html.zimla-ai-start .zimla-ai-composer__box > button[type="submit"],
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer__box > button[type="submit"] {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: #2a332c;
  box-shadow: none;
  color: #fff;
}
html.zimla-ai-start .zimla-ai-composer__box > button[type="submit"]:hover,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer__box > button[type="submit"]:hover {
  background: #1d241f;
}
html.zimla-ai-start .zimla-ai-composer__box > button[type="submit"]:disabled,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer__box > button[type="submit"]:disabled {
  background: #2a332c;
  opacity: 0.55;
  color: #fff;
}
html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message--assistant .zimla-ai-message__bubble,
html.zimla-ai-start.zimla-ai-start-working .zimla-chat-run .zimla-ai-message__bubble,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message--assistant .zimla-ai-message__bubble,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run .zimla-ai-message__bubble {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0 0 0 0.75rem;
  border-left: 2px solid #45A557;
}



html.zimla-ai-start.zimla-ai-start-working .zimla-ai-message--user .zimla-ai-message__bubble,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message--user .zimla-ai-message__bubble {
  background: var(--bg-recessed);
  border: 0;
  border-radius: 12px 12px 4px 12px;
  padding: 12px 16px;
  box-shadow: none;
}


/* These do not change the panel's route-specific position or open/close lifecycle. */
html:not(.zimla-ai-start) .zimla-ai-panel__header {
  min-height: 3.35rem;
  padding: 0.45rem 0.75rem 0.45rem 3.25rem;
  border-bottom: 1px solid #edf1ee;
  background: linear-gradient(180deg, #fbfcfb, #fff);
  border-radius: 0;
}
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-panel__context-inline { display: block; }
html:not(.zimla-ai-start) .zimla-ai-panel__header-actions > [data-chat-new],
html:not(.zimla-ai-start) .zimla-ai-panel__header-actions > [data-chat-history-toggle] {
  width: 2rem;
  height: 2rem;
  border: 0;
  background: transparent;
  color: #7a867e;
  box-shadow: none;
}
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-panel__body { padding-inline: 0; }
/* The body has no side padding (the thread brings its own 1rem); the empty
   state's intro, signals and shortcuts must not sit on the paper's edge. */
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-chat__intro,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-chat__signals,
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-chat__actions { padding-inline: 1rem; }
html:not(.zimla-ai-start) .zimla-ai-panel:has(.zimla-ai-chat__messages .zimla-ai-message, .zimla-ai-chat__messages .zimla-chat-run) .zimla-ai-chat__intro {
  display: none !important;
}
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-chat__messages {
  max-height: none;
  gap: 1rem;
  padding: 0.9rem 1rem 1.1rem;
}
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer {
  background: #fff;
  border-top: 1px solid #edf1ee;
  backdrop-filter: none;
  box-shadow: none;
  padding: 0.55rem 0.85rem 0.75rem;
}
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-message__stack { gap: 0.12rem; }
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__answer {
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__answer .zimla-ai-message__bubble {
  padding: 0;
  border: 0;
  background: transparent;
}
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-analysis-progress {
  display: none;
}
/* Analysis discoveries are information, not eleven oversized destination cards. */
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-room-cards {
  display: grid;
  gap: 0;
  margin: 0.4rem 0;
}
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-room-cards li {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  grid-template-columns: 1.2rem minmax(0, 1fr) auto;
  grid-template-rows: auto;
  gap: 0.45rem;
  padding: 0.4rem 0;
  border: 0;
  border-bottom: 1px solid #edf1ee;
  border-radius: 0;
  background: transparent;
}
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-room-cards li .material-symbols-outlined { grid-row: auto; }
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-room-cards li small { text-align: right; }
/* Functional result controls remain visible outside Studio, using its flat text surface. */
html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-result {
  max-width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
@media (max-width: 1023px) {
  html:not(.zimla-ai-start) .zimla-ai-panel .zimla-ai-composer textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html:not(.zimla-ai-start) .zimla-ai-panel .zimla-chat-run__activity-mark { animation: none; }
}

@keyframes zimla-status-spin {
  to { transform: rotate(360deg); }
}

/* Voice uses the existing control cells throughout connecting/listening/stop.
   No collapse or composer pulsing when the AI starts replying. Outside Studio-start the microphone is a
   hold-to-talk button (walkie-talkie, ägaren 2026-10-02) with its own states at the end of this file. */
[data-chat-runtime-root] .zimla-ai-composer__box .zimla-ai-composer__voice {
  min-width: 36px;
  min-height: 36px;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease, transform 90ms ease;
}
[data-chat-runtime-root] .zimla-ai-composer__box[data-on-air="1"] {
  --zimla-voice-composer-scale: 1;
  --zimla-voice-composer-ring: 2px;
  --zimla-voice-composer-opacity: 0.08;
  transform: none;
  animation: none;
}
/* Skicka kommer tillbaka när texten väntar på granskning (tappat ljud, redigering, tvetydigt projekt). */
[data-chat-runtime-root] .zimla-ai-composer__box[data-on-air="1"] > .zimla-ai-attachments,
[data-chat-runtime-root] .zimla-ai-composer__box[data-on-air="1"]:not([data-on-air-review]) > button[type="submit"] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Pillen: hela ytan är knappen. Samma höjd som skicka. */
[data-chat-runtime-root] .zimla-ai-composer__box .zimla-ai-composer__voice.is-on-air {
  --zimla-voice-scale: 1;
  --zimla-voice-ring: 0px;
  display: inline-flex;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 3px;
  border: 1px solid #b9dcc8;
  border-radius: 999px;
  background: #eaf6ef;
  color: #087858;
  box-shadow: none;
  transform: none;
  white-space: nowrap;
}
[data-chat-runtime-root] .zimla-ai-composer__box .zimla-ai-composer__voice.is-on-air::before,
[data-chat-runtime-root] .zimla-ai-composer__box .zimla-ai-composer__voice.is-on-air::after { content: none; }
[data-chat-runtime-root] .zimla-ai-composer__box .zimla-ai-composer__voice.is-on-air .material-symbols-outlined {
  font-size: 1.05rem;
  transform: none;
  transition: none;
}
[data-chat-runtime-root] .zimla-ai-composer__box .zimla-ai-composer__voice.is-on-air:hover { background: #dff0e6; }
/* Shared iOS 9 waveform; green layers remain legible on Zimla's light surfaces. */
.zimla-voice-wave {
  position: relative;
  display: block;
  flex: 0 0 112px;
  width: 112px;
  height: 28px;
  overflow: hidden;
  contain: layout paint;
  pointer-events: none;
}
.zimla-voice-wave::before {
  content: '';
  position: absolute;
  inset: 50% 8% auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, #7ebda4 35%, #2e6b58 50%, #7ebda4 65%, transparent);
  opacity: .55;
}
.zimla-voice-wave canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 120ms ease-out; }
.zimla-voice-wave[data-sounding="true"] canvas { opacity: 1; }
/* Recording replaces the composer's contents, never its draft or controls. */
.is-voice-wave:is(.zimla-ai-composer__box, .zimla-ai-peek__composer, [data-studio-voice-composer], [data-zimla-dock-voice-composer]) {
  position: relative;
  height: var(--zimla-voice-composer-height, 60px) !important;
  max-height: var(--zimla-voice-composer-height, 60px) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  overflow: hidden;
  border-color: #b9dcc8 !important;
}
.is-voice-wave > :not(.zimla-voice-wave):not([data-chat-voice-toggle]):not([data-chat-voice-peek-toggle]):not([data-studio-voice-toggle]) {
  visibility: hidden !important;
  pointer-events: none !important;
}
.is-voice-wave > .zimla-ai-composer__live { display: none !important; }
.is-voice-wave > .zimla-voice-wave {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 160px);
  max-width: 480px;
  height: calc(100% - 12px);
  max-height: 80px;
  z-index: 1;
}
.is-voice-wave > :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle], [data-studio-voice-toggle]) {
  position: relative;
  z-index: 2;
  align-self: center;
}
/* Keep voice status announced, without a second visible row – except a microphone warning. */
.is-voice-wave:not([data-on-air-alert]) ~ :is(.zimla-chat-voice-feedback, .zimla-ai-peek__voice-feedback),
.zimla-ai-composer__box:is([data-on-air-state="connecting"], [data-on-air-state="reconnecting"], [data-on-air-state="stopping"]) ~ .zimla-chat-voice-feedback {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%);
  white-space: nowrap;
}
.is-voice-wave ~ :is(.zimla-chat-voice-provisional, .zimla-ai-peek__voice-provisional, .zimla-ai-composer__counter) { display: none !important; }
.zimla-chat-voice-feedback:has([data-chat-voice-status]:not([hidden])),
.zimla-ai-peek__voice-feedback:has([data-chat-voice-peek-status]:not([hidden])) { min-height: 32px; }
.zimla-chat-voice-feedback > .zimla-chat-voice-status,
.zimla-ai-peek__voice-feedback > .zimla-ai-peek__voice-status { flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.zimla-ai-composer__box .zimla-ai-composer__voice.is-recording,
.zimla-ai-peek__composer .zimla-ai-peek__voice.is-recording {
  background: #eaf6ef; color: #087858; border-color: #b9dcc8; box-shadow: none; transform: none;
}
.zimla-ai-composer__voice.is-recording::before,
.zimla-ai-composer__voice.is-recording::after,
.zimla-ai-peek__voice.is-recording::before,
.zimla-ai-peek__voice.is-recording::after { content: none; }
/* Fältet på luften: kön, alltid synlig. Placeholder bär "lyssnar"/"svarar". */
[data-chat-runtime-root] .zimla-ai-composer__box[data-on-air="1"] > textarea { min-height: 2.25rem; }
[data-chat-runtime-root] .zimla-ai-composer__box[data-on-air="1"] > textarea::placeholder { color: #98a58f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Det som hörs just nu: grå svans under fältet, samma typ, max tre rader. */
.zimla-ai-composer__live {
  grid-column: 1 / -1;
  margin: 0 0 0.1rem;
  padding: 0 0.4rem 0.2rem;
  color: #8a978f;
  font-size: 0.84rem;
  line-height: 1.4rem;
  letter-spacing: 0.005em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 180ms ease, transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.zimla-ai-composer__live:empty, .zimla-ai-composer__live[hidden] { display: none; }
.zimla-ai-composer__live.is-visible { opacity: 1; transform: none; }
/* Status stays readable when a draft occupies the placeholder. */
[data-chat-runtime-root] .zimla-ai-composer__box[data-on-air="1"] ~ .zimla-chat-voice-feedback .zimla-chat-voice-status { text-align: left; }
/* Connection has one status inside the same composer, not a second row. */
.zimla-ai-composer__voice-progress {
  position: absolute;
  inset-inline: 3.5rem 6.5rem;
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
  color: #526158;
  font-size: .82rem;
  line-height: 1.25;
  pointer-events: none;
}
.zimla-ai-composer__box:is([data-on-air-state="connecting"], [data-on-air-state="reconnecting"], [data-on-air-state="stopping"]) > :is(textarea, .zimla-ai-composer__live, .zimla-ai-composer__stop) {
  visibility: hidden !important;
  pointer-events: none;
}
[data-chat-voice-toggle][data-voice-state="connecting"],
[data-chat-voice-toggle][data-voice-state="reconnecting"],
[data-chat-voice-toggle][data-voice-state="stopping"],
[data-studio-voice-toggle][data-voice-state="connecting"] {
  color: #526158;
  background: #f1f4f2;
  box-shadow: none;
  animation: none;
  transform: none;
}
.zimla-chat-voice-status { overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) {
  [data-chat-runtime-root] .zimla-ai-composer__box .zimla-ai-composer__voice,
  [data-chat-runtime-root] .zimla-ai-composer__box[data-on-air="1"] > *,
  .zimla-voice-wave canvas,
  .zimla-ai-composer__live { transition: none; }
}
@media (max-width: 1023px) {
  [data-chat-runtime-root] .zimla-ai-composer__box .zimla-ai-composer__voice,
  [data-chat-runtime-root] .zimla-ai-composer__box .zimla-ai-composer__voice.is-on-air { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  /* 16 px så iOS inte zoomar när kön redigeras. */
  html.zimla-ai-start [data-chat-runtime-root] .zimla-ai-composer__box[data-on-air="1"] > textarea { font-size: 16px; }
  .zimla-ai-composer__live { font-size: 15px; }
  .zimla-voice-wave { flex-basis: 76px; width: 76px; }
  .zimla-dock-orb-button:is(.is-voice-pressing, .is-voice-connecting, .is-voice-active, .is-voice-processing) .zimla-dock-orb {
    background: #2e6b58;
    box-shadow: none;
    transform: none;
  }
  .zimla-dock-orb-button:is(.is-voice-pressing, .is-voice-connecting, .is-voice-active, .is-voice-processing) { color: #526158; }
  .zimla-dock-orb-button:is(.is-voice-pressing, .is-voice-connecting, .is-voice-active) .zimla-dock-voice-ui { visibility: hidden; opacity: 0; }
  .zimla-dock-orb-button.is-voice-processing .zimla-dock-orb::after { content: none; }
}

/* Local conversation recovery stays reachable next to the preserved draft. */
.zimla-chat-runtime-error .zimla-chat-recovery-action {
  display: block;
  min-height: 44px;
  max-width: 100%;
  margin-block-start: .35rem;
  white-space: normal;
  text-align: start;
  overflow-wrap: anywhere;
}

/* ── Röstläget: composern (samma storlek) förvandlas till en grön vågyta ─────────────────────
   Gäller huvudcomposern och trådens peek-composer, desktop och mobil. En mörkgrön kornig yta
   tonas in över rutan, vågen ritas ljust (mörkt tema i zimla-voice-wave.js), tiden står till
   vänster om mikrofonen och mikrofonen blir en ljus stoppknapp. */
:is(.zimla-ai-composer__box, .zimla-ai-peek__composer, [data-zimla-dock-voice-composer]).is-voice-wave.is-voice-green {
  isolation: isolate;
  border-color: #0d6e45 !important;
  box-shadow: 0 14px 34px -20px rgb(11 79 52 / 65%) !important;
}
:is(.zimla-ai-composer__box, .zimla-ai-peek__composer, [data-zimla-dock-voice-composer]).is-voice-green::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 240px 240px repeat,
    radial-gradient(ellipse 55% 120% at 50% 50%, rgb(64 196 140 / 24%), transparent 70%),
    linear-gradient(180deg, #0f6b45, #0b4f34);
  pointer-events: none;
  animation: zimla-voice-green-in 320ms cubic-bezier(.22, 1, .36, 1) both;
}
.is-voice-green.is-voice-green > .zimla-voice-wave {
  --zimla-voice-wave-theme: dark;
  --zimla-voice-wave-gain: 3.6;
  position: absolute !important;
  z-index: 1 !important;
  top: 50% !important;
  left: 20px !important;
  right: var(--zimla-voice-reserve, 150px) !important;
  width: auto !important;
  max-width: none !important;
  flex: none !important;
  transform: translateY(-50%) !important;
  animation: zimla-voice-green-in 420ms cubic-bezier(.22, 1, .36, 1) 60ms both;
}
.is-voice-green > .zimla-voice-wave::before {
  inset: 50% 0 auto;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 45%) 18%, rgb(255 255 255 / 90%) 50%, rgb(255 255 255 / 45%) 82%, transparent);
  opacity: .7;
}
.zimla-voice-wave__time { display: none; }
:is(.zimla-ai-composer__box, .zimla-ai-peek__composer, [data-zimla-dock-voice-composer]).is-voice-wave.is-voice-green.is-voice-green > .zimla-voice-wave__time {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: block;
  visibility: visible !important;
  transform: translateY(-50%);
  color: rgb(255 255 255 / 80%);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  white-space: nowrap;
  pointer-events: none;
  animation: zimla-voice-green-in 420ms ease 120ms both;
}
.is-voice-green.is-voice-green > :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]) {
  z-index: 2 !important;
  border-color: transparent !important;
  background: rgb(255 255 255 / 16%) !important;
  color: #fff !important;
  box-shadow: none !important;
}
.is-voice-green.is-voice-green > :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]):hover { background: rgb(255 255 255 / 26%) !important; }
/* Mobil: samma yta, lite tätare – kortare kant, mindre tid. */
@media (max-width: 1023px) {
  .is-voice-green.is-voice-green > .zimla-voice-wave { left: 14px !important; }
  :is(.zimla-ai-composer__box, .zimla-ai-peek__composer, [data-zimla-dock-voice-composer]).is-voice-wave.is-voice-green.is-voice-green > .zimla-voice-wave__time { font-size: .76rem; }
}
@keyframes zimla-voice-green-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .is-voice-green::after, .is-voice-green > * { animation: none !important; }
}
/* Skicka/stopp är dolda i röstläget men tog plats: mikrofonen ska stå i kanten. */
.is-voice-green.is-voice-green > :is(button[type="submit"], .zimla-ai-composer__stop, .zimla-ai-peek__send) { display: none !important; }
/* Dockans composer (följer med på sidorna): samma gröna yta; mikrofonen sitter i en wrapper med ledtexten. */
/* Wrappern döljs annars av regeln ovan (fem klasser/pseudo) – här med högre vikt, utan att röra den regeln. */
[data-zimla-dock-voice-composer].is-voice-wave.is-voice-wave.is-voice-wave.is-voice-wave > .zimla-dock__voice-wrap { visibility: visible !important; pointer-events: auto !important; }
.is-voice-green.is-voice-green > .zimla-dock__voice-wrap { position: relative; z-index: 2; margin-left: auto; }
.is-voice-green .zimla-dock__voice { background: rgb(255 255 255 / 16%) !important; color: #fff !important; transform: none !important; animation: none !important; }
.is-voice-green .zimla-dock__voice:hover { background: rgb(255 255 255 / 26%) !important; }
/* Studios telefonregel gör mikrofonen genomskinlig (!important, hög specificitet) – röstläget
   vinner, och mikrofonen tar skicka-knappens kolumn så den står i kanten. */
:root .is-voice-green.is-voice-green.is-voice-green.is-voice-green.is-voice-green > :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]) {
  grid-column: -2 / -1 !important;
  justify-self: end;
  background: rgb(255 255 255 / 16%) !important;
  color: #fff !important;
}
:root .is-voice-green.is-voice-green.is-voice-green.is-voice-green.is-voice-green > :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]):hover { background: rgb(255 255 255 / 26%) !important; }


/* Working-containern: allt Zimla gör (steg, verktyg, uppslag, kvitton, källor) ligger bakom
   en stängd rad. Under körningen bär raden aktuell status och tid, efteråt "Arbetade N s".
   Planen står utanför och syns alltid; svaret, kalkylkortet och frågan står i tråden. */
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__activity-history > summary {
  display: flex !important;
  width: fit-content;
  max-width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0 0.1rem;
  border: 0;
  background: transparent;
  color: #6b776f;
  font-size: 0.74rem;
  font-weight: 500;
}
@media (pointer: coarse) {
  :is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__activity-history > summary { min-height: 44px; width: 100%; }
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__activity-history > summary .zimla-chat-run__activity-current {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  color: #2f3b33;
  font-family: inherit !important;
  font-size: inherit !important;
}
/* Statusraden följer körningens läge, inte om svarstexten börjat synas (ägaren 2026-10-28: "oklart när Zimla AI
   jobbat klart"): snurran och statusen står kvar hela körningen. Klar här: bock + "Klart" i raden och en ring från
   avataren (skrivbordet: orben vid namnet, zimla-chat-desk.css) en gång – JS sätter .is-done-pulse. Väntar den på
   användaren står det i raden utan bock. Historik och omladdning: som förut. */
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run[data-chat-state="completed"]:is(.is-just-done, .is-waiting) .zimla-chat-run__activity-current {
  display: inline-flex !important;
  color: #2f3b33;
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run.is-waiting .zimla-chat-run__activity-current .zimla-chat-run__activity-mark {
  display: none !important;
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run.is-just-done .zimla-chat-run__activity-current .zimla-chat-run__activity-mark {
  display: block !important;
  width: 0.85rem !important;
  height: 0.85rem !important;
  min-width: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: #087858 !important;
  animation: none !important;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.5 16.2 5.3 12l-1.4 1.4 5.6 5.6 11.2-11.2-1.4-1.4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.5 16.2 5.3 12l-1.4 1.4 5.6 5.6 11.2-11.2-1.4-1.4z'/%3E%3C/svg%3E") center / contain no-repeat;
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run.is-just-done .zimla-chat-run__activity-current .zimla-chat-run__activity-mark span {
  display: none;
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-ai-message__avatar--ai { position: relative; }
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run.is-done-pulse .zimla-ai-message__avatar--ai::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid #0a8a62;
  border-radius: 999px;
  pointer-events: none;
  animation: zimla-done-ring 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes zimla-done-ring { from { transform: scale(0.7); opacity: 0.6; } to { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  :is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run.is-done-pulse .zimla-ai-message__avatar--ai::after { animation: none; }
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__worked {
  flex: none;
  color: #8a948c;
  font-variant-numeric: tabular-nums;
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run:not(.zimla-chat-run--answered) .zimla-chat-run__worked::before,
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run:not([data-chat-state="completed"]):not([data-chat-state="failed"]):not([data-chat-state="cancelled"]):not([data-chat-state="interrupted"]) .zimla-chat-run__worked::before,
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run:is(.is-just-done, .is-waiting) .zimla-chat-run__worked::before {
  content: "· ";
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__activity-history[open] > :not(summary) {
  margin-left: 0.4rem;
  padding-left: 0.7rem;
  border-left: 1px solid #dce7df;
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__activity-history .zimla-chat-run__reasoning {
  margin-left: 0.4rem;
  padding-block: 0.1rem 0.3rem;
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__work-results {
  display: grid;
  gap: 0.35rem;
  padding-block: 0.35rem 0.2rem;
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__work-results:empty {
  display: none;
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__activity-history .zimla-chat-run__tools,
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__activity-history .zimla-chat-run__sources {
  padding-block: 0.3rem 0.1rem;
}
/* Studio visar resultaten på duken; containern döljer inget där den redan gömmer korten. */
html.zimla-ai-start.zimla-ai-start-working .zimla-chat-run__work-results { display: none; }

/* Långa länkar och ord (inklistrade mejl, URL:er) bryts i rutan – i Studio och panelen. */
.zimla-ai-message__stack { min-width: 0; max-width: 100%; }
.zimla-ai-message__bubble { min-width: 0; overflow-wrap: anywhere; }

/* Panelens samtal syns även utanför Hem (stenkoll P0 – ett trådbyte får inte vara tyst): titel · tid
   i huvudet i stället för sidans etikett. Hör tråden till ett annat projekt än sidan står raden
   "Du skriver i samtalet om … · Byt" där (och i mobilens snabbfråga). Återhållsam vikt, en rad. */
html:not(.zimla-ai-start) [data-chat-runtime-root] .zimla-ai-panel .zimla-ai-panel__context-inline { display: none; }
html:not(.zimla-ai-start) [data-chat-runtime-root] .zimla-ai-panel .zimla-ai-start-thread {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 0.3rem;
  overflow: hidden;
  color: #7a867d;
  font-size: 0.68rem;
  line-height: 1.3;
  white-space: nowrap;
}
html:not(.zimla-ai-start) [data-chat-runtime-root] .zimla-ai-start-thread strong {
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  color: #4f5b53;
  font-weight: 400;
  text-overflow: ellipsis;
}
html:not(.zimla-ai-start) [data-chat-runtime-root] .zimla-ai-start-thread:not(.is-away) [data-zimla-ai-thread-meta] { flex: 0 0 auto; }
html:not(.zimla-ai-start) [data-chat-runtime-root] .zimla-ai-start-thread:not(.is-away) [data-zimla-ai-thread-meta]::before { content: "·"; margin-right: 0.3rem; }
html:not(.zimla-ai-start) [data-chat-runtime-root] .zimla-ai-start-thread.is-away strong { display: none; }
.zimla-ai-thread-away { display: inline-flex; min-width: 0; max-width: 100%; align-items: baseline; gap: 0.25rem; white-space: nowrap; }
.zimla-ai-thread-away__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.zimla-ai-thread-away__switch {
  position: relative;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: none;
  color: #1f6b52;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
/* Träffytan växer till ~44 px utan att raden blir högre. */
.zimla-ai-thread-away__switch::after { content: ""; position: absolute; inset: -14px -10px; }
.zimla-ai-thread-away__switch:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.zimla-ai-thread-away__switch:focus-visible { outline: 2px solid #087c60; outline-offset: 2px; border-radius: 4px; }
.zimla-ai-peek__thread { display: block; min-width: 0; margin-top: 0.2rem; overflow: hidden; color: #66746b; font-size: 0.7rem; line-height: 1.3; }
.zimla-ai-peek__thread[hidden] { display: none; }

/* Trådbytet sätter sig som ett sidbyte (rörelseklass drill): gamla tråden står kvar tills den nya finns,
   den nya börjar på 72 % och 6 px ner och sätter sig på 200 ms. Ingen rörelse vid reduced motion. */
.zimla-ai-chat__messages.is-thread-landing { opacity: 0.72; transform: translate3d(0, 6px, 0); }
.zimla-ai-chat__messages.is-thread-landed {
  transition: opacity 200ms cubic-bezier(0.215, 0.61, 0.355, 1), transform 200ms cubic-bezier(0.215, 0.61, 0.355, 1);
}
@media (prefers-reduced-motion: reduce) {
  .zimla-ai-chat__messages.is-thread-landing { opacity: 1; transform: none; }
  .zimla-ai-chat__messages.is-thread-landed { transition: none; }
}

/* ── Walkie-talkie: håll in mikrofonen och prata, släpp = skicka (ägaren 2026-10-02) ──────────────────────
   Bara utanför Studio-start (där är knappen "På luften"). Tryck ner men inte lyssnar än: ljusgrön, "Startar …".
   Lyssnar: composern är den gröna vågytan – knappen blir vit med grön mikrofon och en vit ring som andas
   (transform/opacity, högst ~4 px så composerns kant inte klipper den). Hover bara med mus. */
html:not(.zimla-ai-start) :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]) {
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
@media (hover: hover) and (pointer: fine) {
  html:not(.zimla-ai-start) :not(.is-voice-green) > :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]):not(:disabled):not(.is-held):hover {
    background: #eaf6ef;
    color: #087858;
    border-color: #b9dcc8;
  }
  html:not(.zimla-ai-start) :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]):not(:disabled):hover > .material-symbols-outlined {
    transform: translateY(-1px);
  }
}
html:not(.zimla-ai-start) :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]) > .material-symbols-outlined { transition: transform 150ms cubic-bezier(.22, 1, .36, 1); }
html:not(.zimla-ai-start) :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]).is-held:not(.is-recording) {
  background: #eaf6ef !important;
  color: #087858 !important;
  border-color: #b9dcc8 !important;
}
html:not(.zimla-ai-start) .is-voice-green.is-voice-green > :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]).is-held.is-recording {
  background: #fff !important;
  color: #0b4f34 !important;
}
html:not(.zimla-ai-start) .is-voice-green.is-voice-green > :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]).is-held.is-recording::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 2px rgb(255 255 255 / 55%);
  pointer-events: none;
  animation: zimla-hold-ring 1.4s ease-out infinite;
}
@keyframes zimla-hold-ring { from { transform: scale(1); opacity: .9; } to { transform: scale(1.22); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html:not(.zimla-ai-start) .is-voice-green.is-voice-green > :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]).is-held.is-recording::after { animation: none; opacity: .5; }
  html:not(.zimla-ai-start) :is([data-chat-voice-toggle], [data-chat-voice-peek-toggle]) > .material-symbols-outlined { transition: none; }
}
/* Tiden i vågen säger vad ett släpp gör (datorn; på mobil räcker tiden – texten finns i knappens etikett). */
@media (min-width: 1024px) {
  html:not(.zimla-ai-start) [data-voice-hold="1"].is-voice-green.is-voice-green > .zimla-voice-wave__time::after { content: " · släpp för att skicka"; }
}
/* Kort tryck (eller ett släpp innan den lyssnar): en mening ovanför mikrofonen i 1,6 s. */
.zimla-voice-hold-hint {
  position: fixed;
  z-index: 1000;
  margin: 0;
  padding: 6px 10px;
  border-radius: 9px;
  background: #1d2420;
  color: #fff;
  font-size: 12.5px;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 120ms ease;
}
.zimla-voice-hold-hint.is-visible { opacity: 1; }

/* Steget medan Zimla arbetar (steps.py via tool.completed.summary): en rad under statusraden som byts mot nästa steg
   (ägaren 2026-10-05: "en i taget"), utanför den stängda loggen. ~20 px, 0.75rem, dämpad, aldrig fet; kapas; bara opacitet. */
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__steps {
  display: grid;
  gap: 0.1rem;
  margin: 0.25rem 0 0 0.4rem;
  padding: 0 0 0 0.7rem;
  border-left: 1px solid #dce7df;
  list-style: none;
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__steps[hidden] {
  display: none;
}
:is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__steps li {
  overflow: hidden;
  color: #69766e;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.25rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  animation: zimla-step-in 150ms ease-out both;
}
@keyframes zimla-step-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  :is(html.zimla-ai-start, html:not(.zimla-ai-start) .zimla-ai-panel) .zimla-chat-run__steps li { animation: none; }
}

/* Kön (UX-flocken 2026-10-05): ett meddelande som väntar på sin tur är dämpat med "I kö", Kör nu och Ta bort; dess
   körning syns först när den startar. Knapparna får 44 px träffyta på mobil. */
.zimla-chat-run--queued { display: none !important; }
.zimla-ai-message--user.is-queued .zimla-ai-message__bubble { opacity: 0.6; }
.zimla-ai-message__queue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem 0.5rem;
  margin-top: 0.2rem;
  color: #69766e;
  font-size: 0.75rem;
}
.zimla-ai-message__queue-label { font-weight: 500; }
.zimla-ai-message__queue button {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  min-height: 1.75rem;
  padding: 0 0.4rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #2f3b33;
  font: inherit;
  cursor: pointer;
}
.zimla-ai-message__queue button:hover { background: #eef3ef; }
.zimla-ai-message__queue .material-symbols-outlined { font-size: 1rem; }
@media (max-width: 1023px) {
  .zimla-ai-message__queue button { min-height: 2.75rem; }
}
/* Omsändning efter nätverksfel: en dämpad rad under frågan. */
.zimla-ai-message__resend { display: block; margin-top: 0.15rem; color: #69766e; font-size: 0.75rem; text-align: right; }
/* Mobilloopen 2026-10-10, varv 18: på telefonen – skrivfältet 16 px (under det zoomar iOS in), snabbförslagen
   minst 36 px höga och läsbara, dockans "Håll & prata" på en rad även på 320 px. Startsidans tillstånd
   (html.zimla-ai-start …) sätter fältet till 14,4 px med högre specificitet – därav !important här. */
@media (max-width: 1023px) {
  .zimla-ai-panel .zimla-ai-composer textarea { font-size: 16px !important; }
  .zimla-ai-panel .zimla-ai-composer__quick button { min-height: 36px !important; padding-inline: 12px !important; font-size: 13px !important; }
  [data-zimla-dock-label] { white-space: nowrap; }
  .zimla-ai-panel .zimla-ai-composer textarea::placeholder { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}
@media (max-width: 359px) {
  [data-zimla-dock-label] { font-size: 10px; letter-spacing: -0.01em; }
}
