.telegram-transcription-modal {
  width: min(1120px, calc(100vw - 24px));
}

.telegram-bots-layout {
  grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1.75fr);
}

.telegram-bots-list-panel {
  align-self: start;
  min-width: 0;
}

.telegram-bots-list-panel .ai-bot-list-item {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
}

.telegram-bots-list-panel .ai-bot-list-item span {
  color: var(--text-muted, #8b8b8b);
  font-size: 12px;
}

.telegram-feature-section {
  border-top: 1px solid var(--border-color, rgba(127, 127, 127, 0.25));
  margin-top: 16px;
  padding-top: 12px;
}

.telegram-feature-section.is-disabled {
  opacity: 0.55;
}

.telegram-capability-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.telegram-capability-grid .settings-item {
  margin: 0;
}

.telegram-setup-card,
.telegram-bot-identity,
.telegram-warning,
.telegram-provider-readiness,
.telegram-runtime {
  border: 1px solid var(--border-color, rgba(127, 127, 127, 0.25));
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--surface-muted, rgba(127, 127, 127, 0.08));
}

.telegram-setup-card .voice-form-hint {
  margin: 6px 0 8px;
}

.telegram-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  text-decoration: none;
}

.telegram-action-link:hover {
  text-decoration: none;
}

.telegram-bot-identity,
.telegram-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.telegram-warning,
.telegram-provider-readiness.error,
.telegram-runtime-error {
  color: var(--danger-color, #c43d3d);
}

.telegram-provider-readiness.ready {
  color: var(--success-color, #2d8a50);
}

.telegram-allowlist {
  resize: vertical;
  min-height: 88px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.telegram-runtime {
  margin-top: 12px;
  font-size: 13px;
}

.telegram-runtime-error {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.telegram-bot-test-status {
  margin: -4px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color, rgba(127, 127, 127, 0.25));
  border-radius: 10px;
  background: var(--surface-muted, rgba(127, 127, 127, 0.08));
  font-size: 13px;
  overflow-wrap: anywhere;
}

.telegram-bot-test-status.pending {
  color: var(--text-muted, #8b8b8b);
}

.telegram-bot-test-status.success {
  color: var(--success-color, #2d8a50);
  border-color: color-mix(in srgb, currentColor 45%, transparent);
}

.telegram-bot-test-status.warning,
.telegram-bot-test-status.error {
  color: var(--danger-color, #c43d3d);
  border-color: color-mix(in srgb, currentColor 45%, transparent);
}

.telegram-history-modal {
  width: min(940px, calc(100vw - 24px));
}

.telegram-history-toolbar,
.telegram-history-pager,
.telegram-history-item-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.telegram-history-toolbar {
  justify-content: space-between;
  margin-bottom: 12px;
}

.telegram-history-toolbar .field-group {
  flex: 1 1 260px;
  margin: 0;
}

.telegram-history-list {
  display: grid;
  gap: 12px;
  max-height: min(60vh, 620px);
  overflow: auto;
}

.telegram-history-item {
  border: 1px solid var(--border-color, rgba(127, 127, 127, 0.25));
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-muted, rgba(127, 127, 127, 0.08));
}

.telegram-history-item-head {
  justify-content: space-between;
}

.telegram-history-item-head span,
.telegram-history-meta {
  color: var(--text-muted, #8b8b8b);
  font-size: 12px;
}

.telegram-history-meta {
  margin-top: 4px;
}

.telegram-history-item details {
  margin-top: 10px;
}

.telegram-history-item summary {
  cursor: pointer;
  font-weight: 600;
}

.telegram-history-item pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
}

.telegram-history-image,
.telegram-history-missing-image {
  margin-top: 10px;
}

.telegram-history-image {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.telegram-history-image img {
  display: block;
  max-width: min(100%, 420px);
  max-height: 360px;
  margin-top: 6px;
  border-radius: 8px;
}

.telegram-history-missing-image {
  color: var(--danger-color, #c43d3d);
}

.telegram-history-pager {
  justify-content: center;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .telegram-bots-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .telegram-transcription-modal {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
  }

  .telegram-history-modal {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
  }

  .telegram-capability-grid {
    grid-template-columns: 1fr;
  }
}

/* Appearance surfaces; keep media geometry owned by this feature. */
html[data-visual-mode="glass"] .telegram-bot-editor .voice-inline-actions {
  gap: 10px; margin: 10px 0 12px;
}
html[data-visual-mode="glass"] .telegram-bot-editor .voice-inline-actions > button {
  min-height: 44px; margin: 0;
}
html[data-visual-mode="glass"] :is(.telegram-setup-card, .telegram-bots-list-panel, .telegram-history-toolbar) { background: var(--glass-dialog); color: var(--text-primary); border: 1px solid var(--glass-line); border-radius: 20px; box-shadow: var(--glass-shadow); }
html[data-visual-mode="glass"] .telegram-history-toolbar { padding: 12px; align-items: flex-end; gap: 10px; }
html[data-visual-mode="glass"] .telegram-history-toolbar .field-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
html[data-visual-mode="glass"] .telegram-history-toolbar label { margin: 0; font-size: 13px; line-height: 1.3; }
html[data-visual-mode="glass"] .telegram-history-toolbar .modal-input { min-width: 0; min-height: 44px; margin: 0; }
html[data-visual-mode="glass"] :is(.telegram-history-toolbar button) { border-radius: 16px; min-height: 44px; color: var(--text-primary); background-color: var(--glass-control); border-color: var(--border-light); }
@media (max-width: 640px) {
  html[data-visual-mode="glass"] .telegram-history-toolbar { flex-direction: column; align-items: stretch; }
  html[data-visual-mode="glass"] .telegram-history-toolbar .field-group { flex: 0 0 auto; }
}
