/* Runa ファイルエージェント — ダッシュボード用パネル */

.runa-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.5rem;
  height: 3.5rem;
  padding: 0 1rem;
  border: none;
  border-radius: var(--cf-radius, 8px);
  background: var(--cf-orange, #f38020);
  color: #fff;
  font-family: var(--cf-font, Inter, sans-serif);
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: var(--cf-shadow, 0 1px 3px rgb(0 0 0 / 0.06));
  cursor: pointer;
}

.runa-fab:hover {
  background: var(--cf-orange-hover, #e5700f);
}

.runa-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
}

.runa-panel.is-open {
  pointer-events: auto;
}

.runa-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.runa-panel.is-open .runa-backdrop {
  opacity: 1;
}

.runa-dialog {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(100vw, 720px);
  height: min(92vh, 760px);
  background: var(--cf-bg, #fff);
  border-top-left-radius: var(--cf-radius-lg, 12px);
  border: 1px solid var(--cf-border, #e2e5e9);
  box-shadow: 0 -2px 8px rgb(0 0 0 / 0.08);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.runa-panel.is-open .runa-dialog {
  transform: translateY(0);
}

.runa-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--cf-border, #e2e5e9);
}

.runa-kicker {
  margin: 0;
  font-size: 0.75rem;
  color: var(--cf-muted, #6b7280);
}

.runa-title {
  margin: 0.15rem 0 0;
  font-size: 1.25rem;
}

.runa-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.runa-new-chat {
  border: 1px solid var(--cf-border, #e2e5e9);
  background: var(--cf-bg, #fff);
  border-radius: var(--cf-radius, 8px);
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--cf-text, #1d2433);
  cursor: pointer;
}

.runa-new-chat:hover {
  background: var(--cf-surface, #f6f6f7);
}

.runa-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--cf-muted, #6b7280);
  cursor: pointer;
}

.runa-status {
  margin: 0;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  color: var(--cf-orange, #f38020);
  background: var(--cf-orange-soft, #fff4eb);
}

.runa-context-hint {
  margin: 0;
  padding: 0 1.25rem 0.35rem;
  font-size: 0.78rem;
  color: var(--cf-muted, #6b7280);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runa-context-usage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  font-size: 0.72rem;
  color: var(--cf-muted, #6b7280);
}

.runa-context-usage[hidden] {
  display: none !important;
}

.runa-context-usage-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
  min-width: 0;
}

.runa-context-usage-actions[hidden] {
  display: none !important;
}

.runa-context-usage-warn {
  color: var(--cf-orange, #f38020);
  font-weight: 600;
  font-size: 0.62rem;
  line-height: 1.2;
  text-align: center;
}

.runa-context-summarize-btn {
  flex: 0 0 auto;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--cf-orange, #f38020);
  border-radius: var(--cf-radius, 8px);
  background: var(--cf-orange-soft, #fff4eb);
  color: var(--cf-orange, #f38020);
  font: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
}

.runa-context-summarize-btn:hover:not(:disabled) {
  background: var(--cf-orange, #f38020);
  color: #fff;
}

.runa-context-summarize-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.runa-context-usage-cycle {
  position: relative;
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
}

.runa-context-usage-svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.runa-context-usage-ring-bg,
.runa-context-usage-ring-fill {
  fill: none;
  stroke-width: 3.5;
}

.runa-context-usage-ring-bg {
  stroke: var(--cf-border, #e2e5e9);
}

.runa-context-usage-ring-fill {
  stroke: var(--cf-teal, #0d9488);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition:
    stroke-dashoffset 0.25s ease,
    stroke 0.25s ease;
}

.runa-context-usage.is-warning .runa-context-usage-ring-fill {
  stroke: var(--cf-orange, #f38020);
}

.runa-context-usage.is-critical .runa-context-usage-ring-fill {
  stroke: #dc2626;
}

.runa-context-usage-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.48rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #525252;
  pointer-events: none;
}

.runa-context-usage.is-warning .runa-context-usage-pct {
  color: var(--cf-orange, #f38020);
}

.runa-context-usage.is-critical .runa-context-usage-pct {
  color: #dc2626;
}

.runa-msg--summary .runa-msg-bubble {
  border-style: dashed;
  background: var(--cf-bg-muted, #f8fafc);
  font-size: 0.92rem;
}

.runa-msg--summary .runa-msg-content {
  opacity: 0.92;
}

.runa-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.runa-body.is-drag-over::after {
  content: "ファイルをドロップして添付";
  position: absolute;
  inset: 0.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--cf-orange, #f38020);
  border-radius: var(--cf-radius-lg, 12px);
  background: rgba(255, 244, 235, 0.92);
  color: var(--cf-orange, #f38020);
  font-size: 0.95rem;
  font-weight: 600;
  pointer-events: none;
}

.runa-messages {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.25rem;
  min-height: 0;
}

.runa-msg {
  display: flex;
  margin-bottom: 0.75rem;
}

.runa-msg--user {
  justify-content: flex-end;
}

.runa-msg--assistant {
  justify-content: flex-start;
}

.runa-msg-bubble {
  max-width: 92%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--cf-radius-lg, 12px);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
  line-height: 1.5;
}

.runa-msg--user .runa-msg-bubble {
  background: var(--cf-orange, #f38020);
  color: #fff;
}

.runa-msg--assistant .runa-msg-bubble {
  background: var(--cf-surface, #f6f6f7);
  color: var(--cf-text, #1d2433);
}

.runa-msg-bubble.is-streaming::after {
  content: "▍";
  display: inline-block;
  margin-left: 0.1em;
  color: var(--cf-orange, #f38020);
  animation: runa-cursor-blink 1s step-end infinite;
}

@keyframes runa-cursor-blink {
  50% {
    opacity: 0;
  }
}

.runa-live-phase {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: var(--cf-orange-soft, #fff4eb);
  border: 1px solid rgb(243 128 32 / 0.22);
  font-size: 0.84rem;
  color: var(--cf-text, #1d2433);
  animation: runa-live-phase-in 0.18s ease-out;
}

@keyframes runa-live-phase-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.runa-live-phase-dot {
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--cf-orange, #f38020);
  animation: runa-live-phase-pulse 1.1s ease-in-out infinite;
}

@keyframes runa-live-phase-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.82);
  }
}

.runa-live-phase-text {
  min-width: 0;
  line-height: 1.35;
}

.runa-live-phase-compact {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

.runa-live-phase.is-clickable {
  cursor: pointer;
}

.runa-live-phase.is-clickable:hover {
  border-color: rgb(243 128 32 / 0.45);
}

.runa-live-phase-kind {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: rgb(243 128 32 / 0.14);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  color: var(--cf-orange, #f38020);
}

.runa-chat-todos {
  margin-bottom: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--cf-border, #e2e5e9);
  background: #fff;
  font-size: 0.8rem;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

.runa-chat-todos-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.runa-chat-todos-title {
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--cf-text, #1d2433);
}

.runa-chat-todos-meta {
  font-size: 0.72rem;
  color: var(--cf-muted, #6b7280);
}

.runa-chat-todos-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.runa-todo-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: var(--cf-muted, #6b7280);
}

.runa-todo-item.is-current {
  color: var(--cf-text, #1d2433);
  font-weight: 600;
}

.runa-todo-item.is-done {
  color: #94a3b8;
}

.runa-todo-item.is-done .runa-todo-label {
  text-decoration: line-through;
}

.runa-todo-item.is-failed {
  color: #dc2626;
}

.runa-todo-check {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  min-height: 1rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #94a3b8;
}

.runa-todo-item.is-done .runa-todo-check {
  color: #16a34a;
}

.runa-todo-item.is-current .runa-todo-check {
  color: var(--cf-orange, #f38020);
}

.runa-todo-label {
  flex: 1;
  min-width: 0;
}

.runa-todo-spinner {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid rgb(243 128 32 / 0.25);
  border-top-color: var(--cf-orange, #f38020);
  border-radius: 50%;
  animation: runa-todo-spin 0.75s linear infinite;
}

@keyframes runa-todo-spin {
  to {
    transform: rotate(360deg);
  }
}

.runa-activities {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.runa-activity {
  border: 1px solid var(--cf-border, #e5e7eb);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 0.82rem;
}

.runa-activity summary {
  cursor: pointer;
  list-style: none;
  padding: 0.4rem 0.55rem;
  color: var(--cf-muted, #6b7280);
  user-select: none;
}

.runa-activity summary::-webkit-details-marker {
  display: none;
}

.runa-activity-phase {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--cf-text, #1d2433);
}

.runa-activity-chevron {
  display: inline-block;
  color: var(--cf-orange, #f38020);
  transition: transform 0.15s ease;
}

.runa-activity.is-active summary {
  color: var(--cf-text, #1d2433);
  font-weight: 500;
}

.runa-activity.is-active {
  border-color: rgb(243 128 32 / 0.35);
  box-shadow: 0 0 0 1px rgb(243 128 32 / 0.08);
}

.runa-activity.is-done {
  opacity: 0.72;
  transition: opacity 0.2s ease;
}

.runa-activity.is-done .runa-activity-detail {
  color: var(--cf-text, #1d2433);
}

.runa-activity[open] summary .runa-activity-chevron {
  transform: rotate(90deg);
}

.runa-activity-detail {
  padding: 0.35rem 0.55rem 0.5rem;
  border-top: 1px solid var(--cf-border, #e5e7eb);
  color: var(--cf-muted, #6b7280);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  line-height: 1.45;
  max-height: 16rem;
  overflow: auto;
}

.runa-activity--working.is-active .runa-activity-detail {
  max-height: min(32rem, 55vh);
}

.runa-activity-detail.is-streaming::after {
  content: "▍";
  display: inline-block;
  margin-left: 0.1em;
  color: var(--cf-orange, #f38020);
  animation: runa-cursor-blink 1s step-end infinite;
}

.runa-msg-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.runa-md strong {
  font-weight: 700;
}

.runa-md em {
  font-style: italic;
}

.runa-md-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
}

.runa-msg--user .runa-md-code {
  background: rgba(255, 255, 255, 0.2);
}

.runa-md-pre {
  margin: 0.5rem 0;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.45;
}

.runa-md-pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}

.runa-md a {
  color: var(--cf-orange, #f38020);
  text-decoration: underline;
}

.runa-web-image-grid {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.runa-web-image-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.runa-web-image-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.04);
  cursor: zoom-in;
  line-height: 0;
}

.runa-web-image-preview:hover {
  border-color: rgba(59, 130, 246, 0.45);
}

.runa-web-image-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.runa-web-image-caption {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: inherit;
  opacity: 0.85;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.runa-web-image-source {
  font-size: 0.72rem;
  color: #2563eb;
  text-decoration: none;
}

.runa-web-image-source:hover {
  text-decoration: underline;
}

.runa-msg--user .runa-web-image-source {
  color: #bfdbfe;
}

.runa-file-refs {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.runa-file-ref {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.85rem;
}

.runa-file-ref-preview-wrap {
  flex: 0 0 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.runa-file-ref-preview {
  display: block;
  max-width: 240px;
  border-radius: var(--cf-radius, 8px);
  overflow: hidden;
  border: 1px solid var(--cf-border, #e2e5e9);
  line-height: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
  font: inherit;
}

.runa-file-ref-preview:hover {
  border-color: var(--cf-orange, #f38020);
}

.runa-file-ref-edit {
  flex: 0 0 auto;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--cf-border, #e2e5e9);
  border-radius: var(--cf-radius, 8px);
  background: var(--cf-bg, #fff);
  color: var(--cf-text, #1f2937);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.runa-file-ref-edit:hover {
  border-color: var(--cf-orange, #f38020);
  color: var(--cf-orange, #f38020);
}

.runa-msg--user .runa-file-ref-edit {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.runa-msg--user .runa-file-ref-edit:hover {
  border-color: #fff;
  color: #fff;
}

.runa-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.runa-image-lightbox[hidden] {
  display: none !important;
}

.runa-image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  background: rgba(15, 23, 42, 0.82);
  cursor: zoom-out;
}

.runa-image-lightbox-dialog {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(95vw, 1200px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.runa-image-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 3rem);
  object-fit: contain;
  border-radius: var(--cf-radius, 8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.runa-image-lightbox-caption {
  max-width: 100%;
  font-size: 0.85rem;
  color: #f8fafc;
  text-align: center;
  word-break: break-all;
}

.runa-image-lightbox-edit {
  padding: 0.45rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--cf-radius, 8px);
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.runa-image-lightbox-edit:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
}

.runa-image-lightbox-edit[hidden] {
  display: none;
}

.runa-image-lightbox-close {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #111827;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.runa-image-lightbox-close:hover {
  background: #fff;
}

body.runa-lightbox-open {
  overflow: hidden;
}

.runa-file-ref-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  word-break: break-all;
}

.runa-file-ref-link {
  color: var(--cf-orange, #f38020);
  text-decoration: underline;
  font-size: 0.8rem;
  white-space: nowrap;
}

.runa-msg--user .runa-file-ref-link {
  color: #fff;
}

.runa-attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 1rem 0;
}

.runa-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.2rem 0.45rem;
  border-radius: var(--cf-radius, 8px);
  background: var(--cf-surface, #f6f6f7);
  border: 1px solid var(--cf-border, #e2e5e9);
  font-size: 0.78rem;
}

.runa-attach-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 12rem;
}

.runa-attach-chip-remove {
  border: none;
  background: transparent;
  color: var(--cf-muted, #6b7280);
  cursor: pointer;
  line-height: 1;
  padding: 0 0.1rem;
}

.runa-composer {
  flex-shrink: 0;
  border-top: 1px solid #dcdcdc;
  background: var(--cf-bg, #fff);
}

.runa-composer .runa-attach-list {
  padding: 0.5rem 1rem 0;
}

.runa-composer-rise {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 1rem;
  border-bottom: 1px solid transparent;
  transition:
    max-height 0.32s ease,
    opacity 0.24s ease,
    padding 0.32s ease,
    border-color 0.24s ease;
}

.runa-composer.is-deep-research .runa-composer-rise {
  max-height: 4.5rem;
  opacity: 1;
  padding: 0.55rem 1rem 0.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.runa-composer.is-deep-research .runa-composer-rise:has(.runa-deep-research-hint:not([hidden])) {
  max-height: 6.5rem;
}

.runa-composer-rise-lead {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #737373;
  letter-spacing: 0.01em;
}

.runa-composer-modes {
  display: flex;
  align-items: flex-end;
  padding: 0.4rem 1rem 0;
}

.runa-deep-research-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.32rem 0.55rem;
  border: 1px solid #b3b3b3;
  border-radius: 0;
  background: #fafafa;
  color: #404040;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.25;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.runa-deep-research-toggle-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.runa-deep-research-toggle:hover {
  background: #f2f2f2;
  border-color: #8a8a8a;
  color: #262626;
}

.runa-deep-research-toggle.is-active {
  background: #ececec;
  border-color: #525252;
  color: #171717;
  box-shadow: inset 0 -2px 0 #525252;
}

.runa-composer.is-deep-research .runa-form {
  border-top: 1px solid #e0e0e0;
}

.runa-deep-research-hint {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #525252;
}

.runa-deep-research-hint:not([hidden]) {
  display: block;
}

.runa-form {
  position: relative;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  padding: 0.55rem 1rem 1rem;
  border-top: none;
}

.runa-form-trailing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.28rem;
  flex-shrink: 0;
}

.runa-attach-menu {
  position: absolute;
  left: 1rem;
  bottom: calc(100% + 0.35rem);
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 12.5rem;
  padding: 0.35rem;
  border: 1px solid var(--cf-border, #e2e5e9);
  border-radius: var(--cf-radius, 8px);
  background: var(--cf-bg, #fff);
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.12);
}

.runa-attach-menu[hidden] {
  display: none !important;
}

.runa-attach-menu-item {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--cf-text, #1d2433);
  font: inherit;
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
}

.runa-attach-menu-item:hover {
  background: var(--cf-surface, #f6f6f7);
}

.runa-storage-picker {
  width: min(92vw, 520px);
  max-height: min(88vh, 640px);
  padding: 0;
  border: 1px solid var(--cf-border, #e2e5e9);
  border-radius: var(--cf-radius-lg, 12px);
  background: var(--cf-bg, #fff);
  box-shadow: 0 16px 48px rgb(15 23 42 / 0.2);
}

.runa-storage-picker::backdrop {
  background: rgb(15 23 42 / 0.45);
}

.runa-storage-picker-form {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 640px);
}

.runa-storage-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid var(--cf-border, #e2e5e9);
}

.runa-storage-picker-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.runa-storage-picker-close {
  border: none;
  background: transparent;
  color: var(--cf-muted, #6b7280);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.runa-storage-picker-status {
  margin: 0;
  padding: 0.45rem 1rem 0;
  font-size: 0.78rem;
  color: var(--cf-muted, #6b7280);
}

.runa-storage-picker-status.is-error {
  color: #dc2626;
}

.runa-storage-picker-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.35rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--cf-border, #e2e5e9);
  font-size: 0.76rem;
}

.runa-storage-picker-crumb-btn,
.runa-storage-picker-root {
  border: none;
  background: transparent;
  color: var(--cf-orange, #f38020);
  font: inherit;
  cursor: pointer;
  padding: 0.1rem 0.2rem;
}

.runa-storage-picker-crumb-sep {
  color: var(--cf-muted, #6b7280);
}

.runa-storage-picker-roots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.35rem;
}

.runa-storage-picker-root {
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: var(--cf-surface, #f6f6f7);
}

.runa-storage-picker-list {
  flex: 1;
  min-height: 12rem;
  max-height: 22rem;
  overflow: auto;
  padding: 0.35rem;
}

.runa-storage-picker-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--cf-text, #1d2433);
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.runa-storage-picker-row:hover:not(:disabled) {
  background: var(--cf-surface, #f6f6f7);
}

.runa-storage-picker-row--file {
  grid-template-columns: 1.1rem auto 1fr auto;
}

.runa-storage-picker-row.is-selected {
  background: rgb(243 128 32 / 0.1);
}

.runa-storage-picker-row.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.runa-storage-picker-check {
  color: var(--cf-orange, #f38020);
  font-weight: 700;
}

.runa-storage-picker-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runa-storage-picker-meta {
  color: var(--cf-muted, #6b7280);
  font-size: 0.74rem;
  white-space: nowrap;
}

.runa-storage-picker-empty {
  margin: 0.75rem;
  font-size: 0.82rem;
  color: var(--cf-muted, #6b7280);
}

.runa-storage-picker-empty.is-error {
  color: #dc2626;
}

.runa-storage-picker-load-more {
  margin: 0 1rem 0.35rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--cf-border, #e2e5e9);
  border-radius: 8px;
  background: var(--cf-bg, #fff);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.runa-storage-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid var(--cf-border, #e2e5e9);
}

.runa-storage-picker-selected {
  margin: 0;
  font-size: 0.78rem;
  color: var(--cf-muted, #6b7280);
}

.runa-storage-picker-actions {
  display: flex;
  gap: 0.45rem;
}

.runa-storage-picker-cancel,
.runa-storage-picker-confirm {
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.runa-storage-picker-cancel {
  border: 1px solid var(--cf-border, #e2e5e9);
  background: var(--cf-bg, #fff);
  color: var(--cf-text, #1d2433);
}

.runa-storage-picker-confirm {
  border: none;
  background: var(--cf-orange, #f38020);
  color: #fff;
}

.runa-storage-picker-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.runa-attach-btn {
  flex: 0 0 auto;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  min-height: 2.75rem;
  height: auto;
  border: 1px solid var(--cf-border, #e2e5e9);
  border-radius: var(--cf-radius, 8px);
  background: var(--cf-bg, #fff);
  color: var(--cf-muted, #6b7280);
  cursor: pointer;
}

.runa-attach-btn-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.runa-attach-btn:hover:not(:disabled) {
  background: var(--cf-surface, #f6f6f7);
  color: var(--cf-text, #1d2433);
}

.runa-attach-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.runa-input {
  flex: 1;
  resize: vertical;
  min-height: 2.75rem;
  max-height: 8rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--cf-border, #e2e5e9);
  border-radius: var(--cf-radius, 8px);
  font: inherit;
}

.runa-send {
  border: none;
  border-radius: var(--cf-radius, 8px);
  padding: 0.65rem 1rem;
  background: var(--cf-orange, #f38020);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.runa-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.runa-stop {
  border: 1px solid rgba(220, 38, 38, 0.45);
  border-radius: var(--cf-radius, 8px);
  padding: 0.55rem 0.65rem;
  min-width: 2.5rem;
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  font-size: 0.85rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

.runa-stop:hover {
  background: rgba(220, 38, 38, 0.2);
}

.runa-files,
.runa-preview {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 1rem 1rem;
}

.runa-file-item {
  display: flex;
  gap: 0.65rem;
  width: 100%;
  margin-bottom: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--cf-border, #e2e5e9);
  border-radius: var(--cf-radius, 8px);
  background: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.runa-file-item.is-active {
  border-color: var(--cf-orange, #f38020);
  background: var(--cf-orange-soft, #fff4eb);
}

.runa-file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.runa-file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runa-file-path,
.runa-file-sub {
  font-size: 0.8rem;
  color: var(--cf-muted, #6b7280);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runa-empty {
  margin: 0;
  color: var(--cf-muted, #6b7280);
  font-size: 0.9rem;
}

.runa-preview-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--cf-radius, 8px);
}

.runa-preview-text {
  margin: 0;
  padding: 0.75rem;
  background: var(--cf-surface, #f6f6f7);
  border-radius: var(--cf-radius, 8px);
  overflow: auto;
  max-height: 60vh;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.runa-preview-link {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--cf-orange, #f38020);
  font-weight: 600;
  text-decoration: none;
}

.runa-preview-hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--cf-muted, #6b7280);
}

@media (min-width: 900px) {
  .runa-dialog {
    width: min(96vw, 960px);
    height: min(88vh, 820px);
    right: 1rem;
    bottom: 1rem;
    border-radius: var(--cf-radius-lg, 12px);
    border: 1px solid var(--cf-border, #e2e5e9);
  }

  .runa-panel.is-open .runa-dialog {
    transform: translateY(0);
  }
}
