:root {
  --font-title: system-ui, -apple-system, "Segoe UI", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --font-text: system-ui, -apple-system, "Segoe UI", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --weight-regular: 400;
  --weight-medium: 400;
  --weight-strong: 500;
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-soft: #fcfdff;
  --bg-muted: #f9fafb;
  --bg-strong: #111111;
  --line: #e8edf3;
  --line-strong: #dde4ec;
  --text-main: #111827;
  --text-muted: #6b7280;
  --success-bg: #ecfdf3;
  --success-text: #067647;
  --success-line: #ccead8;
  --danger-bg: #fef3f2;
  --danger-text: #b42318;
  --danger-line: #f2d2cf;
  --warning-bg: #fff7ed;
  --warning-text: #9a3412;
  --warning-line: #f5d8b4;
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --control-height: 36px;
  --sidebar-width: 248px;
  --app-height: 100vh;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 38px rgba(15, 23, 42, 0.16);
  --scrollbar-size: 8px;
  --scrollbar-track: rgba(15, 23, 42, 0.06);
  --scrollbar-thumb: rgba(100, 116, 139, 0.48);
  --scrollbar-thumb-hover: rgba(71, 85, 105, 0.66);
  --scrollbar-thumb-active: rgba(51, 65, 85, 0.78);
}

@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

*::-webkit-scrollbar-track {
  border-radius: 999px;
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--scrollbar-thumb);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:active {
  background: var(--scrollbar-thumb-active);
  background-clip: padding-box;
}

*::-webkit-scrollbar-button,
*::-webkit-scrollbar-corner {
  display: none;
  width: 0;
  height: 0;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-text);
  font-weight: var(--weight-regular);
  color: var(--text-main);
  background: var(--bg-main);
  min-height: var(--app-height);
  height: var(--app-height);
  overflow: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  display: block;
}

h1,
h2,
h3 {
  font-family: var(--font-title);
}

strong {
  font-family: inherit;
  font-weight: inherit;
}

h1,
h2,
h3,
p,
pre {
  margin: 0;
}

h1 {
  font-size: 1.18rem;
  line-height: 1.2;
  font-weight: var(--weight-strong);
}

h2 {
  font-size: 0.95rem;
  line-height: 1.3;
  font-weight: var(--weight-strong);
}

h3 {
  font-weight: var(--weight-regular);
}

.hidden,
[hidden] {
  display: none !important;
}

.mono-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: var(--app-height);
  background: var(--bg-main);
}

.mono-rail {
  position: sticky;
  top: 0;
  height: var(--app-height);
  padding: 14px 10px 10px;
  border-right: 1px solid var(--line);
  background: var(--bg-surface);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.mono-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid var(--line);
}

.mono-brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow-sm);
  color: var(--text-main);
  display: grid;
  place-items: center;
  flex: none;
}

.mono-brand-mark svg {
  width: 18px;
  height: 18px;
}

.mono-brand-copy {
  min-width: 0;
}

.mono-brand-copy strong {
  display: block;
  font-size: 0.94rem;
  font-weight: var(--weight-strong);
}

.mono-nav {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  align-content: start;
  gap: 10px;
}

.mono-nav-group {
  display: grid;
  gap: 6px;
}

.mono-nav-group-bottom {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.mono-nav-group-title,
.stage-tag,
.detail-row span,
.channel-table thead th {
  font-size: 0.68rem;
  font-weight: var(--weight-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mono-nav-group-title {
  padding-left: 8px;
  color: var(--text-muted);
}

.mono-nav-group-list {
  display: grid;
  gap: 4px;
}

.mono-nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: none;
}

.mono-nav-icon svg {
  width: 18px;
  height: 18px;
}

.mono-nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  font-weight: var(--weight-medium);
}

.mono-stage {
  min-width: 0;
  height: var(--app-height);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mono-header {
  flex: none;
  margin: 8px 10px 0;
  padding: 8px 10px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.mono-header.is-page-toolbar {
  justify-content: stretch;
  min-height: 56px;
  padding: 6px 12px;
  border-color: #dce6f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}

.mono-header .page-header-toolbar {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}

.mono-header .page-header-toolbar .select-input,
.mono-header .page-header-toolbar .btn {
  min-height: var(--control-height);
}

.mono-header .header-filter-group {
  display: grid;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid #dce5ee;
  border-radius: 12px;
  background: #f5f8fb;
  min-width: 0;
}

.mono-header .header-filter-group .select-input {
  min-width: 0;
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  border-color: transparent;
  border-radius: 8px;
  background-color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.mono-header .header-filter-group .select-input:hover {
  border-color: #b7c4d1;
  background-color: #ffffff;
}

.mono-header .header-filter-group .select-input:focus {
  border-color: #7f8d9b;
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.12), 0 1px 2px rgba(15, 23, 42, 0.04);
}

.mono-header .header-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-left: 14px;
  border-left: 1px solid #cbd6e0;
  min-width: 0;
  flex-wrap: nowrap;
}

.mono-header .header-filter-actions .btn {
  white-space: nowrap;
}

.mono-header .page-header-toolbar .btn:not(.btn-primary) {
  border-color: #aab7c4;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.mono-header .page-header-toolbar .btn:not(.btn-primary):hover:not(:disabled) {
  border-color: #7f8d9b;
  background: #f3f6fa;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.1);
}

.mono-header .page-header-toolbar .btn:not(.btn-primary):focus-visible {
  border-color: #111111;
  outline: 2px solid rgba(17, 17, 17, 0.18);
  outline-offset: 1px;
}

.mono-header .page-header-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.mono-header .page-header-toolbar-actions .toolbar-actions {
  width: 100%;
}

.mono-header .page-header-toolbar-actions .btn {
  min-width: 88px;
}

.mono-header .page-header-toolbar-actions .btn-secondary {
  border-color: #cfd9e5;
  background: #ffffff;
  color: #374151;
}

.mono-header .page-header-toolbar-actions .btn-secondary:hover:not(:disabled) {
  border-color: #b8c6d5;
  background: #f3f6fa;
}

@media (max-width: 760px) {
  .mono-header .header-filter-actions {
    justify-content: flex-start;
    padding-left: 0;
    border-left: 0;
  }
}

.mono-header-copy {
  display: grid;
  gap: 2px;
}

.stage-tag {
  color: var(--text-muted);
}

.mono-header-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

.global-error {
  margin: 6px 10px 0;
}

.mono-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
}

.page-screen {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  overflow: auto;
}

#page-chat.page-screen {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.page-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.page-grid {
  display: grid;
  gap: 16px;
  align-items: start;
}

.guide-doc {
  display: grid;
  gap: 12px;
  align-content: start;
}

.page-column,
.page-main {
  min-width: 0;
  display: grid;
  gap: 16px;
  align-content: start;
}

.page-panel-narrow {
  max-width: 720px;
}

.panel,
.list-item,
.detail-row,
.modal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.panel {
  min-width: 0;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.panel-head,
.chat-header,
.composer-actions,
.list-item-head,
.panel-actions-inline,
.toolbar-actions,
.modal-actions,
.detail-actions,
.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-head h2,
.chat-header h2 {
  font-family: var(--font-title);
}

.panel-head-wrap {
  align-items: flex-start;
}

.panel-head-compact {
  margin-top: -2px;
}

.panel-divider {
  width: 100%;
  height: 1px;
  background: var(--line);
}

.detail-actions,
.toolbar-actions,
.modal-actions,
.table-actions {
  flex-wrap: wrap;
}

.toolbar-actions,
.table-actions {
  justify-content: flex-end;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-overlay-nested {
  z-index: 60;
}

.modal-card {
  width: min(920px, 100%);
  padding: 16px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow-lg);
}

.modal-card-compact {
  width: min(760px, 100%);
}

.modal-card-wide {
  width: min(1100px, 100%);
}

.modal-form {
  display: grid;
  gap: 14px;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.field-span-3 {
  grid-column: 1 / -1;
}

.list-item-head strong,
.message-card header strong,
.table-primary strong {
  font-weight: var(--weight-strong);
}

.nav-btn-mono {
  width: 100%;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.nav-btn-mono:hover {
  background: #f8fafc;
  border-color: #eef2f7;
}

.nav-btn-mono.is-active,
.nav-btn-mono.is-active:hover {
  background: var(--bg-strong);
  border-color: var(--bg-strong);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.nav-btn-mono:focus-visible {
  outline: 2px solid rgba(17, 17, 17, 0.5);
  outline-offset: 1px;
}

.header-chip,
.status-chip,
.status-pill,
.meta-tag,
.tag-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: var(--weight-medium);
}

.header-chip,
.status-chip,
.status-neutral,
.meta-tag,
.tag-chip {
  border: 1px solid var(--line);
  background: var(--bg-muted);
  color: #374151;
}

.status-online {
  border: 1px solid var(--success-line);
  background: var(--success-bg);
  color: var(--success-text);
}

.status-offline {
  border: 1px solid var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.status-chip.status-busy {
  border-color: var(--warning-line);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.error-banner,
.empty-card,
.empty-thread {
  border-radius: var(--radius-md);
  padding: 12px;
}

.error-banner {
  border: 1px solid var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.app-toast-region {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 120;
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.app-toast {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  color: var(--text-main);
  font-size: 0.8rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: auto;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-toast.is-leaving {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
}

.app-toast-success {
  border-color: var(--success-line);
  background: var(--success-bg);
  color: var(--success-text);
}

.app-toast-warning {
  border-color: var(--warning-line);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.app-toast-error {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.app-toast-info {
  border-color: #cbdced;
  background: #f0f6fc;
  color: #315b7e;
}

.app-toast-icon {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: var(--weight-strong);
}

.app-toast-success .app-toast-icon::after {
  content: "✓";
}

.app-toast-warning .app-toast-icon::after {
  content: "!";
}

.app-toast-error .app-toast-icon::after {
  content: "×";
}

.app-toast-info .app-toast-icon::after {
  content: "i";
}

.app-toast-message {
  min-width: 0;
  overflow-wrap: anywhere;
}

.app-toast-close {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: currentColor;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.72;
}

.app-toast-close:hover,
.app-toast-close:focus-visible {
  background: rgba(15, 23, 42, 0.08);
  opacity: 1;
}

.button-loading-spinner {
  width: 12px;
  height: 12px;
  flex: none;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: button-loading-spin 760ms linear infinite;
}

.btn .button-loading-spinner {
  margin-right: 7px;
}

@keyframes button-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.channel-table tbody tr.is-removing {
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.empty-card,
.empty-thread {
  border: 1px dashed var(--line-strong);
  background: var(--bg-muted);
  color: var(--text-muted);
  padding: 20px 16px;
  text-align: center;
}

.empty-thread {
  min-height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
}

.empty-thread h3 {
  font-size: 0.95rem;
}

.field {
  display: flex;
  flex-direction: column;
  align-self: start;
  min-width: 0;
  gap: 8px;
}

.field span,
.inline-note,
.muted,
.list-item p,
.list-item small,
.detail-row p {
  color: var(--text-muted);
}

.field span {
  font-size: 0.84rem;
  font-weight: var(--weight-medium);
  line-height: 1.35;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.field-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: var(--weight-strong);
  line-height: 1;
  cursor: help;
}

.field-note {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.input-with-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

textarea,
.text-input {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--bg-surface);
  color: var(--text-main);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.text-input:hover:not(:focus):not(:disabled):not([readonly]),
.select-input:hover:not(:focus):not(:disabled) {
  border-color: #d3dce6;
}

.text-input[type="password"] {
  font-family: Arial, sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
}

.text-input:-webkit-autofill,
.text-input:-webkit-autofill:hover,
.text-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-main);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-surface) inset;
  box-shadow: 0 0 0 1000px var(--bg-surface) inset;
  caret-color: var(--text-main);
}

textarea {
  min-height: 104px;
  resize: vertical;
}

textarea:focus,
.text-input:focus,
.select-input:focus {
  outline: none;
  border-color: #c5d1de;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}

.text-input-readonly {
  background: var(--bg-muted);
}

.select-input {
  min-width: 220px;
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 12px;
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

select.select-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
}

.icon-btn,
.btn {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  flex: none;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn:hover,
.btn:hover:not(:disabled) {
  background: #f3f4f6;
}

.icon-btn.is-active {
  border-color: var(--bg-strong);
  background: var(--bg-strong);
  color: #ffffff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  font-family: var(--font-text);
  font-size: 0.82rem;
  font-weight: var(--weight-medium);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.btn:disabled,
.icon-btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.btn-primary {
  border-color: var(--bg-strong);
  background: var(--bg-strong);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16);
}

.btn-primary:hover:not(:disabled) {
  background: #000000;
}

.btn-secondary {
  color: #374151;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.btn-danger {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.btn-danger:hover:not(:disabled),
.btn-danger:focus-visible {
  border-color: var(--danger-text);
  background: #fde8e6;
  color: var(--danger-text);
}

.inline-note,
.muted {
  font-size: 0.8rem;
  line-height: 1.5;
}

.list-stack,
.detail-stack {
  display: grid;
  gap: 8px;
}

.list-stack {
  max-height: 28vh;
  overflow: auto;
}

.list-stack-tall {
  max-height: 34vh;
}

.list-stack-wide {
  max-height: 58vh;
}

.list-item {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  display: grid;
  gap: 6px;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.list-item:hover {
  border-color: #cfd7e3;
  background: #fbfcfe;
}

.list-item.active {
  border-color: var(--bg-strong);
  background: var(--bg-muted);
}

.list-item.is-static {
  cursor: default;
}

.list-item.is-static:hover {
  border-color: var(--line);
  background: var(--bg-surface);
}

.list-item p,
.list-item small {
  font-size: 0.78rem;
  line-height: 1.45;
}

.list-item p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.meta-tag {
  min-width: 28px;
}

.detail-row {
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  background: var(--bg-surface-soft);
}

.detail-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-row strong {
  font-size: 0.86rem;
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}

.detail-row-code {
  gap: 10px;
}

.app-bindings-meta {
  gap: 10px;
  grid-auto-rows: max-content;
}

.app-bindings-meta .detail-row {
  min-height: auto;
}

.app-bindings-meta .code-block {
  max-height: 220px;
}

.detail-copy-btn {
  min-height: 28px;
  padding: 0 10px;
  flex-shrink: 0;
}

.detail-stack-spacious .detail-row {
  min-height: 76px;
}

.code-block {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--bg-muted);
  color: var(--text-main);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.77rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

.code-block-tall {
  min-height: 240px;
  max-height: 360px;
}

.panel-table {
  padding-top: 14px;
}

.panel-table-head {
  padding: 0 14px 0 14px;
}

.table-wrap {
  overflow: auto;
}

.channel-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
}

.channel-table th,
.channel-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.81rem;
  font-variant-numeric: tabular-nums;
}

.channel-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-main);
  color: var(--text-muted);
  border-bottom: 1px solid var(--line-strong);
}

.channel-table tbody tr {
  transition: background-color 120ms ease;
}

.channel-table tbody tr:hover {
  background: #f9fafb;
}

.channel-table tbody tr.table-row-active {
  background: #f4f7fb;
}

.channel-table tbody tr:last-child td {
  border-bottom: none;
}

.table-primary {
  display: grid;
  gap: 4px;
}

.table-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.cell-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-chip {
  padding: 0 9px;
  min-height: 24px;
  font-size: 0.72rem;
}

.tag-chip-overflow {
  min-width: 24px;
  cursor: help;
}

.table-muted,
.channel-empty-cell {
  color: var(--text-muted);
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 14px;
}

.table-pager-info {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table-pager:empty {
  display: none;
}

.channel-empty-cell {
  text-align: center !important;
  padding: 28px 16px !important;
}

.chat-client-select {
  width: min(240px, 100%);
  max-width: 100%;
  min-width: 112px;
  min-height: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-inline: 10px;
  font-size: 0.78rem;
  border-color: #aab7c4;
  background: var(--bg-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  text-align: left;
  cursor: pointer;
}

.chat-client-select:hover:not(:disabled),
.chat-client-select:focus-visible {
  border-color: var(--bg-strong);
  background: var(--bg-surface);
}

.chat-client-select span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-client-selection-copy {
  flex: 1 1 auto;
  display: block;
  text-align: left;
}

.chat-client-selection-copy strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: var(--weight-medium);
  line-height: 1;
}

.chat-client-selection-status {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--success-text);
}

.chat-client-selection-status.is-unavailable {
  background: var(--danger-text);
}

.chat-client-select svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.chat-workspace {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: clamp(200px, 20vw, 260px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  min-height: 0;
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.chat-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0;
}

.chat-sidebar-panel {
  flex: 1 1 auto;
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 10px;
  gap: 8px;
  overflow: hidden;
}

.chat-conversation-header-actions {
  flex: none;
  gap: 4px;
}

.chat-conversation-selection-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0;
  grid-row: 1;
}

.chat-conversation-select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: max-content;
  color: var(--text-muted);
  font-size: 0.76rem;
  cursor: pointer;
}

.chat-conversation-select-all-label input,
.chat-conversation-checkbox input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.chat-conversation-select-all-label input:focus-visible + span,
.chat-conversation-checkbox input:focus-visible + .chat-conversation-checkbox-mark {
  outline: 2px solid var(--bg-strong);
  outline-offset: 2px;
}

.chat-conversation-select-all-label span {
  user-select: none;
}

.chat-conversation-select-all-label input + span::before {
  content: '';
  display: inline-grid;
  width: 15px;
  height: 15px;
  margin-right: 5px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg-surface);
  color: #ffffff;
  font-size: 0.66rem;
  line-height: 1;
  vertical-align: -3px;
}

.chat-conversation-select-all-label input:checked + span::before,
.chat-conversation-select-all-label input:indeterminate + span::before {
  border-color: var(--bg-strong);
  background: var(--bg-strong);
}

.chat-conversation-select-all-label input:checked + span::before {
  content: '✓';
}

.chat-conversation-select-all-label input:indeterminate + span::before {
  content: '−';
}

.chat-conversation-selection-count {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation-selection-toolbar .chat-conversation-selection-count {
  margin-right: auto;
}

.chat-conversation-search-field {
  display: block;
  min-width: 0;
}

.chat-conversation-search {
  width: 100%;
  min-height: 32px;
  height: 32px;
  padding-inline: 9px;
  font-size: 0.78rem;
}

.chat-conversation-list {
  display: flex;
  flex-direction: column;
  grid-row: 2;
  gap: 3px;
  min-height: 0;
  align-items: stretch;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.chat-conversation-list > .list-item,
.chat-conversation-list > .empty-card {
  flex: 0 0 auto;
}

.chat-conversation-list > .empty-card {
  flex: 1 1 auto;
  min-height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
}

.chat-conversation-list > .list-item {
  width: 100%;
  min-height: 0;
  height: auto;
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  justify-items: stretch;
  max-height: 56px;
  border-radius: 10px;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: 56px;
}

.chat-conversation-selection-toolbar:not(.hidden) ~ .chat-conversation-list {
  grid-row: 2;
}

.chat-conversation-item {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0;
  padding: 0;
  overflow: visible;
  transition: opacity 180ms ease, transform 220ms ease, max-height 220ms ease, border-color 180ms ease;
}

.chat-conversation-item.is-removing {
  max-height: 0;
  min-height: 0;
  border-color: transparent;
  box-shadow: none;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(-10px) scale(0.985);
}

.chat-conversation-item.is-selection-mode {
  grid-template-columns: 24px minmax(0, 1fr);
}

.chat-conversation-item.is-selection-mode.is-selected:not(.active) {
  border-color: #cbd8e6;
  background: #f5f8fc;
}

.chat-conversation-checkbox {
  grid-column: 1;
  grid-row: 1;
  align-self: stretch;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.chat-conversation-checkbox-mark {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--bg-surface);
  color: #ffffff;
  font-size: 0.68rem;
  line-height: 1;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.chat-conversation-checkbox input:checked + .chat-conversation-checkbox-mark {
  border-color: var(--bg-strong);
  background: var(--bg-strong);
}

.chat-conversation-checkbox input:checked + .chat-conversation-checkbox-mark::after {
  content: '✓';
}

.chat-conversation-list > .list-item.active .chat-conversation-checkbox-mark {
  border-color: rgba(255, 255, 255, 0.48);
  background: transparent;
}

.chat-conversation-list > .list-item.active .chat-conversation-checkbox input:checked + .chat-conversation-checkbox-mark {
  border-color: #ffffff;
  background: #ffffff;
  color: var(--bg-strong);
}

.chat-conversation-item.is-selection-mode .chat-conversation-select {
  grid-column: 2;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  cursor: pointer;
}

.chat-conversation-item.is-selection-mode .chat-conversation-actions {
  display: none;
}

.chat-conversation-select {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-column: 1;
  grid-row: 1;
  grid-template-rows: auto auto;
  gap: 1px;
  padding: 4px 4px 4px 8px;
  border: 0;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.chat-conversation-select:hover:not(:disabled),
.chat-conversation-select:focus-visible {
  background: transparent;
}

.chat-conversation-select:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.chat-conversation-item.is-loading:not(.active) {
  border-color: var(--line-strong);
  background: linear-gradient(100deg, var(--bg-surface), #f4f8fb, var(--bg-surface));
  background-size: 220% 100%;
  animation: chat-conversation-loading-sheen 1.8s ease-in-out infinite;
}

.chat-conversation-item.is-loading .chat-conversation-select {
  cursor: progress;
}

.chat-conversation-loading-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-conversation-loading-spinner {
  width: 11px;
  height: 11px;
  flex: none;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: chat-conversation-loading-spin 760ms linear infinite;
}

.chat-conversation-actions {
  position: relative;
  z-index: 2;
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  padding: 2px 2px 0 0;
}

.chat-conversation-more {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.chat-conversation-more svg {
  width: 14px;
  height: 14px;
}

.chat-conversation-more:hover:not(:disabled),
.chat-conversation-more:focus-visible {
  border-color: var(--line-strong);
  background: var(--bg-muted);
  color: var(--text-main);
}

.chat-conversation-item.active .chat-conversation-more {
  color: rgba(255, 255, 255, 0.82);
}

.chat-conversation-item.active .chat-conversation-more:hover:not(:disabled),
.chat-conversation-item.active .chat-conversation-more:focus-visible {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.chat-conversation-menu {
  position: absolute;
  top: 38px;
  right: 7px;
  z-index: 12;
  width: 112px;
  display: grid;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg-surface);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.chat-conversation-menu button {
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-main);
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}

.chat-conversation-menu button:hover,
.chat-conversation-menu button:focus-visible {
  background: var(--bg-muted);
}

.chat-conversation-menu button:last-child {
  color: var(--danger-text);
}

.chat-conversation-empty {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}

.chat-conversation-empty small {
  color: var(--text-muted);
}

.chat-conversation-delete-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-md);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 0.82rem;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-conversation-list > .list-item.active,
.chat-conversation-list > .list-item.active:hover {
  border-color: var(--bg-strong);
  background: var(--bg-strong);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
}

.chat-conversation-list > .list-item .list-item-head {
  min-width: 0;
  gap: 4px;
  align-items: flex-start;
}

.chat-conversation-list > .list-item .list-item-head strong {
  min-width: 0;
  flex: 1 1 auto;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  font-size: 0.88rem;
  line-height: 1.25;
  overflow: hidden;
}

.chat-conversation-list > .list-item small {
  margin: 0;
}

.chat-conversation-list > .list-item.active small {
  color: rgba(255, 255, 255, 0.76);
}

.chat-conversation-list > .list-item small {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-conversation-list > .list-item.active .meta-tag {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.chat-conversation-list > .list-item .meta-tag {
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  font-size: 0.68rem;
}

@keyframes chat-conversation-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes chat-conversation-loading-sheen {
  0%,
  100% {
    background-position: 100% 0;
  }
  50% {
    background-position: 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-toast,
  .chat-conversation-item,
  .chat-conversation-item.is-loading:not(.active),
  .chat-conversation-loading-spinner,
  .button-loading-spinner {
    animation: none;
    transition: none;
  }
}

.chat-panel {
  flex: 1 1 auto;
  display: grid;
  min-height: 0;
  padding: 0;
  gap: 0;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr) auto auto;
}

.image-task-center {
  max-height: min(33vh, 280px);
  overflow: auto;
  padding: 10px 14px 0;
  border-top: 1px solid var(--line);
  background: var(--bg-surface);
}

.image-task-center-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.image-task-center-head > div {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.image-task-center-head strong {
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: var(--weight-strong);
}

.image-task-center-head span,
.image-task-center-note {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.image-task-list {
  display: grid;
  gap: 7px;
  padding-bottom: 10px;
}

.image-task-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid #94a3b8;
  border-radius: 10px;
  background: var(--bg-surface-soft);
}

.image-task-card.is-uploading,
.image-task-card.is-queued,
.image-task-card.is-generating,
.image-task-card.is-retrying,
.image-task-card.is-cancelling {
  border-left-color: #2d6074;
}

.image-task-card.is-success {
  border-left-color: var(--success-text);
}

.image-task-card.is-failed {
  border-left-color: var(--danger-text);
  background: var(--danger-bg);
}

.image-task-card.is-cancelled {
  border-left-color: #94a3b8;
}

.image-task-card-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.image-task-card-head,
.image-task-meta,
.image-task-card-actions,
.image-task-status-wrap {
  display: flex;
  align-items: center;
}

.image-task-card-head {
  justify-content: space-between;
  gap: 10px;
}

.image-task-status-wrap {
  min-width: 0;
  gap: 6px;
  color: var(--text-main);
  font-size: 0.76rem;
}

.image-task-status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #94a3b8;
}

.image-task-card.is-uploading .image-task-status-dot,
.image-task-card.is-queued .image-task-status-dot,
.image-task-card.is-generating .image-task-status-dot,
.image-task-card.is-retrying .image-task-status-dot,
.image-task-card.is-cancelling .image-task-status-dot {
  background: #2d6074;
  box-shadow: 0 0 0 3px rgba(45, 96, 116, 0.12);
}

.image-task-card.is-success .image-task-status-dot {
  background: var(--success-text);
}

.image-task-card.is-failed .image-task-status-dot {
  background: var(--danger-text);
}

.image-task-card-head time {
  flex: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.image-task-prompt {
  overflow: hidden;
  color: var(--text-main);
  font-size: 0.78rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-task-meta {
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.image-task-request-id {
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.image-task-detail {
  color: var(--danger-text);
  font-size: 0.7rem;
  line-height: 1.4;
}

.image-task-card.is-success .image-task-detail {
  color: var(--success-text);
}

.image-task-card-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.image-task-results {
  display: flex;
  gap: 5px;
  max-width: 220px;
  overflow: hidden;
  padding-top: 3px;
}

.image-task-results img {
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-muted);
}

.chat-header-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.chat-conversation-toolbar {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-conversation-toolbar .chat-conversation-search-field {
  flex: 0 1 190px;
  width: min(190px, 100%);
}

.chat-conversation-toolbar .chat-conversation-header-actions .btn {
  min-height: 30px;
  height: 30px;
  padding-inline: 9px;
  font-size: 0.76rem;
}

.chat-header-toolbar .chat-header-actions {
  justify-content: flex-end;
  flex: 0 1 auto;
  width: auto;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.chat-request-mode {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  color: var(--text-muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.chat-delivery-mode {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  color: var(--text-muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.chat-delivery-mode-select {
  flex: 0 0 clamp(132px, 11vw, 160px);
  width: clamp(132px, 11vw, 160px);
  min-width: 132px;
  min-height: 32px;
  height: 32px;
  padding-inline: 8px 24px;
  font-size: 0.78rem;
}

.chat-request-mode-select {
  flex: 0 0 clamp(150px, 12vw, 180px);
  width: clamp(150px, 12vw, 180px);
  min-width: 150px;
  min-height: 32px;
  height: 32px;
  padding-inline: 8px 24px;
  font-size: 0.78rem;
}

.message-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.image-result-comparison {
  display: grid;
  gap: 6px;
  padding: 7px 0 1px;
}

.image-result-comparison-label {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.image-result-reference-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.image-result-reference-list img {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  object-fit: cover;
  background: var(--bg-muted);
}

.message-card.has-images {
  max-width: min(92%, 960px);
}

.message-image {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.message-image.is-selected {
  border-color: var(--bg-strong);
  box-shadow: 0 0 0 2px rgba(45, 96, 116, 0.18);
}

.message-image img {
  display: block;
  width: 100%;
  min-height: 180px;
  max-height: min(62vh, 640px);
  object-fit: contain;
  background: #f8fafc;
}

.image-result-detail,
.image-result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-result-detail {
  justify-content: space-between;
  flex-wrap: wrap;
  padding-top: 2px;
}

.image-result-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.image-result-actions {
  flex-wrap: wrap;
}

.message-image > .image-result-actions {
  min-height: 42px;
  padding: 6px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.message-image > .image-result-actions .image-result-action {
  flex: 0 1 auto;
}

.image-result-action {
  flex: 1 1 0;
  min-width: 76px;
  white-space: nowrap;
}

.chat-header-label {
  flex: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: var(--weight-medium);
}

.chat-client-picker {
  order: 3;
  flex: 0 0 clamp(180px, 22vw, 300px);
  position: relative;
  width: clamp(180px, 22vw, 300px);
  min-width: 180px;
  max-width: 300px;
}

.chat-client-select {
  width: 100%;
  min-width: 0;
}

.chat-selected-channels {
  order: 2;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: auto;
  max-width: none;
  overflow-x: auto;
  padding: 0 2px;
  border-bottom: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.chat-selected-channel {
  flex: 0 0 auto;
  min-width: 118px;
  max-width: min(190px, 36vw);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-muted);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.chat-selected-channel:hover,
.chat-selected-channel:focus-visible {
  border-color: var(--line-strong);
  background: var(--bg-muted);
}

.chat-selected-channel-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--success-text);
}

.chat-selected-channel-dot.is-error {
  background: var(--danger-text);
}

.chat-selected-channel.is-focused {
  border-color: var(--bg-strong);
  border-bottom-color: var(--bg-strong);
  background: var(--bg-strong);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
  box-shadow: none;
}

.chat-selected-channel.is-focused .chat-selected-channel-copy strong,
.chat-selected-channel.is-focused .chat-selected-channel-copy small {
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.chat-selected-channel.is-unavailable {
  opacity: 0.62;
}

.chat-selected-channel.is-pending .chat-selected-channel-status {
  background: var(--warning-text);
}

.chat-selected-channel.is-error .chat-selected-channel-status {
  background: var(--danger-text);
}

.chat-selected-channel-status {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--danger-text);
}

.chat-selected-channel:not(.is-unavailable) .chat-selected-channel-status {
  background: var(--success-text);
}

.chat-selected-channel-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.chat-selected-channel-copy strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.chat-selected-channel-copy strong {
  font-size: 0.74rem;
  font-weight: var(--weight-medium);
}

.chat-selected-channel-copy small {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.66rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-selected-channel.is-focused .chat-selected-channel-copy small {
  color: rgba(255, 255, 255, 0.76);
}

.chat-client-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: min(360px, calc(100vw - 64px));
  max-height: min(52vh, 420px);
  display: grid;
  gap: 2px;
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-surface);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.chat-client-menu-empty {
  padding: 10px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.chat-client-option {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.chat-client-option:hover:not(:disabled),
.chat-client-option.is-selected {
  border-color: var(--line);
  background: var(--bg-muted);
}

.chat-client-option:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.chat-client-option-check {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: #ffffff;
  background: var(--bg-surface);
  font-size: 0.72rem;
  font-weight: var(--weight-strong);
}

.chat-client-option.is-selected .chat-client-option-check {
  border-color: var(--bg-strong);
  background: var(--bg-strong);
}

.chat-client-option-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.chat-client-option-copy strong,
.chat-client-option-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-client-option-copy strong {
  font-size: 0.82rem;
  font-weight: var(--weight-medium);
}

.chat-client-option-copy small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.chat-panels {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 12px 14px;
  overflow: hidden;
  background: #f8fafc;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.chat-panels.is-multi {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  overflow: hidden;
}

.chat-panels.is-single {
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

.chat-panels.is-single .chat-result-panel {
  height: 100%;
}

.chat-panels.is-empty {
  place-content: center;
  padding: 16px;
  background: var(--bg-surface);
}

.chat-result-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #d5dee9;
  border-radius: 12px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.chat-result-panel.is-hidden {
  display: none;
}

.chat-result-panel.is-focused {
  border-color: var(--bg-strong);
  box-shadow: 0 0 0 1px var(--bg-strong), var(--shadow-sm);
}

.chat-result-panel-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fbfdff;
}

.chat-result-panel-title-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-result-panel-title-wrap h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: var(--weight-medium);
}

.chat-result-panel-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--success-text);
}

.chat-result-panel-dot.is-busy {
  background: var(--warning-text, #b7791f);
}

.chat-result-panel-status.is-busy {
  color: var(--warning-text, #9a6700);
}

.chat-result-panel-dot.is-error {
  background: var(--danger-text);
}

.chat-result-panel-status.is-error {
  color: var(--danger-text);
}

.chat-result-panel-status {
  flex: none;
  color: var(--success-text);
  font-size: 0.68rem;
  white-space: nowrap;
}

.chat-panel-messages {
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

@media (max-width: 1280px) {
  .chat-panels.is-multi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-y: auto;
  }
}

@media (max-width: 860px) {
  .chat-header-actions {
    flex-wrap: wrap;
  }

  .chat-selected-channels {
    order: 4;
    flex-basis: 100%;
  }

  .chat-panels.is-multi {
    grid-template-columns: minmax(0, 1fr);
    overflow-y: auto;
  }
}

.messages {
  min-height: 0;
  padding: 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: transparent;
}

.messages > .empty-thread {
  display: grid;
  place-content: center;
  flex: 1 1 auto;
  width: 100%;
  min-height: 100%;
  text-align: center;
  gap: 0;
  border: 0;
  background: transparent;
}

.chat-empty-state {
  gap: 8px;
}

.chat-empty-state h3,
.chat-empty-state small {
  margin: 0;
}

.chat-empty-state .btn {
  justify-self: center;
}

.chat-conversation-loading {
  gap: 10px;
}

.chat-conversation-loading .chat-conversation-loading-spinner {
  width: 24px;
  height: 24px;
  justify-self: center;
  border-width: 2px;
  color: var(--bg-strong);
}

.empty-thread-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: var(--weight-medium);
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.empty-thread-label::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: #cbd5e1;
}

.message-row {
  display: flex;
  content-visibility: auto;
  contain-intrinsic-size: 96px;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.assistant {
  justify-content: flex-start;
}

.message-row.system {
  justify-content: center;
}

.message-card {
  min-width: 0;
  max-width: min(78%, 760px);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  border: 1px solid #dbe5ef;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.04);
}

.message-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.message-card header small {
  color: #718096;
  font-size: 0.72rem;
  opacity: 1;
}

.message-card p {
  margin: 0;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-markdown {
  display: grid;
  gap: 10px;
  min-width: 0;
  color: inherit;
  line-height: 1.7;
  word-break: break-word;
}

.message-card[data-activity="receiving"] .message-markdown.is-streaming::after {
  content: "▋";
  display: inline-block;
  margin-left: 2px;
  color: currentColor;
  opacity: 0.86;
  animation: chat-stream-caret 1s steps(1, end) infinite;
}

.message-markdown > * {
  margin: 0;
}

.message-markdown h1,
.message-markdown h2,
.message-markdown h3,
.message-markdown h4,
.message-markdown h5,
.message-markdown h6 {
  margin: 0 0 10px;
  font-weight: var(--weight-strong);
  line-height: 1.35;
}

.message-markdown h1 {
  font-size: 1.2rem;
}

.message-markdown h2 {
  font-size: 1.08rem;
}

.message-markdown h3 {
  font-size: 1rem;
}

.message-markdown p,
.message-markdown ul,
.message-markdown ol,
.message-markdown pre,
.message-markdown blockquote {
  margin: 0 0 10px;
}

.message-markdown > :last-child {
  margin-bottom: 0;
}

.message-markdown ul,
.message-markdown ol {
  padding-left: 1.4em;
}

.message-markdown li + li {
  margin-top: 4px;
}

.message-markdown a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-markdown code {
  padding: 0.15em 0.38em;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.08);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}

.message-markdown pre {
  overflow: auto;
  padding: 12px;
  border-radius: 14px;
  background: #0f172a;
  color: #e2e8f0;
}

.message-markdown pre code {
  display: block;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 0.86rem;
  line-height: 1.65;
  white-space: pre;
}

.message-markdown blockquote {
  padding: 10px 12px;
  border-left: 3px solid rgba(15, 23, 42, 0.2);
  background: rgba(15, 23, 42, 0.04);
  border-radius: 0 12px 12px 0;
}

.message-markdown hr {
  border: 0;
  border-top: 1px solid rgba(15, 23, 42, 0.12);
  margin: 12px 0;
}

.message-card.user {
  border-color: #202a39;
  background: #151a22;
  color: #f8fafc;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.1);
}

.message-card.user header small {
  color: #aeb9c7;
}

.message-card.user .message-markdown code {
  background: rgba(255, 255, 255, 0.12);
}

.message-card.user .message-markdown blockquote {
  border-left-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.message-card.user[data-activity="sending"] {
  animation: chat-message-send-in 240ms ease-out both;
}

.message-card.user.failed {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.message-card.assistant {
  border-color: #dbe5ef;
  background: #ffffff;
  color: var(--text-main);
}

.message-card.assistant.pending,
.message-card.assistant.streaming {
  border-color: var(--line-strong);
  background: var(--bg-surface);
}

.message-status,
.chat-result-panel-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.chat-activity-spinner,
.composer-submit .btn.is-busy::before {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: none;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: chat-activity-spin 800ms linear infinite;
}

.chat-activity-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 12px;
}

.chat-activity-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  animation: chat-activity-dot 1.2s ease-in-out infinite;
}

.chat-activity-dots i:nth-child(2) { animation-delay: 150ms; }
.chat-activity-dots i:nth-child(3) { animation-delay: 300ms; }

.chat-selected-channel-dot.is-busy {
  background: currentColor;
  animation: chat-waiting-breathe 1.6s ease-in-out infinite;
}

.message-card[data-activity="waiting"] {
  min-width: min(220px, 100%);
}

.chat-waiting-lines {
  display: grid;
  gap: 8px;
  padding-block: 6px;
}

.chat-waiting-lines i {
  display: block;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  opacity: 0.6;
  animation: chat-waiting-breathe 1.6s ease-in-out infinite;
}

.chat-waiting-lines i:last-child {
  width: 62%;
  animation-delay: 200ms;
}

@keyframes chat-activity-spin { to { transform: rotate(360deg); } }
@keyframes chat-activity-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-2px); opacity: 1; }
}
@keyframes chat-waiting-breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.85; }
}
@keyframes chat-message-send-in {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.message-row.image-generation-row {
  width: 100%;
}

.message-card.image-generation-card {
  width: min(100%, 780px);
  max-width: min(94%, 780px);
  padding: 14px;
  overflow: hidden;
  border: 1px solid #d8e2eb;
  border-style: solid;
  background: linear-gradient(145deg, #ffffff 0%, #fbfcfe 68%, #f5f8fb 100%);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.message-card.image-generation-card header {
  padding: 0 2px;
}

.image-generation-placeholder {
  display: grid;
  grid-template-columns: minmax(176px, 0.78fr) minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.image-generation-preview {
  position: relative;
  min-height: 218px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 18px;
  background: linear-gradient(135deg, #173b55 0%, #2d6074 100%);
  box-shadow: 0 10px 22px rgba(25, 47, 73, 0.14);
}

.image-generation-preview-center {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
}

.image-generation-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.36);
  border-top-color: #ffffff;
  border-right-color: rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  animation: image-generation-spin 1.1s linear infinite;
}

.image-generation-copy {
  display: grid;
  align-content: center;
  gap: 12px;
  min-width: 0;
  padding: 4px 2px 2px;
}

.image-generation-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.image-generation-heading {
  display: grid;
  gap: 5px;
}

.image-generation-heading h3 {
  color: var(--text-main);
  font-size: 1rem;
  font-weight: var(--weight-strong);
  line-height: 1.35;
}

.image-generation-heading p {
  min-height: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.image-generation-progress-wrap {
  display: grid;
  gap: 7px;
}

.image-generation-progress-label {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.image-generation-progress-label strong {
  color: var(--text-main);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.image-generation-progress {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef3;
}

.image-generation-progress-fill {
  position: relative;
  display: block;
  height: 100%;
  min-width: 8%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2aa893, #7ec9aa 48%, #e6b36d);
  transition: width 600ms ease;
}

.message-card.has-images {
  animation: image-result-card-in 460ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.message-card.has-images .message-image {
  animation: image-result-reveal 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.message-card.has-images .message-image:nth-child(2) {
  animation-delay: 70ms;
}

.message-card.has-images .message-image:nth-child(3) {
  animation-delay: 140ms;
}

.message-image img {
  transition: transform 280ms ease, filter 280ms ease;
}

.message-image img.is-thumbnail {
  cursor: zoom-in;
}

.message-image img.is-thumbnail[aria-busy="true"] {
  cursor: progress;
  opacity: 0.72;
}

.message-image:hover img {
  filter: saturate(1.04);
  transform: scale(1.012);
}

.image-context-menu {
  position: fixed;
  z-index: 180;
  width: 156px;
  padding: 5px;
  border: 1px solid #d7e0e8;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
  display: grid;
  gap: 2px;
}

.image-context-menu button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}

.image-context-menu button:hover,
.image-context-menu button:focus-visible {
  background: #f1f5f9;
  outline: none;
}

.image-context-menu button > span:first-child {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
}

.message-card.system {
  border-style: dashed;
  background: var(--bg-muted);
}

.message-card.system.is-error {
  max-width: min(92%, 520px);
  gap: 7px;
  border-style: solid;
  border-color: var(--danger-line);
  background: linear-gradient(145deg, #fffaf8 0%, var(--danger-bg) 100%);
  color: var(--danger-text);
  box-shadow: 0 8px 20px rgba(180, 35, 24, 0.06);
}

.message-card.system.is-error header strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.message-card.system.is-error header strong::before {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--danger-text);
  color: #ffffff;
  content: "!";
  font-size: 0.7rem;
  font-weight: var(--weight-strong);
  line-height: 1;
}

.message-card.system.is-error p {
  color: #8f2d25;
  font-size: 0.82rem;
  line-height: 1.5;
}

.message-card-note {
  display: grid;
  gap: 3px;
  padding-top: 8px;
  border-top: 1px solid currentColor;
  color: inherit;
  opacity: 0.82;
  line-height: 1.45;
}

.message-card-failure-reason {
  font-size: 0.78rem;
  font-weight: var(--weight-medium);
}

.message-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.message-card-actions-conversation {
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.1);
}

.message-card-actions-conversation .table-btn {
  min-height: 28px;
  border-radius: 8px;
}

.message-card.system.is-error .message-card-actions {
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--danger-line);
}

.message-card.user .message-card-actions-conversation {
  border-top-color: rgba(255, 255, 255, 0.16);
}

.message-card.user .message-card-actions-conversation .btn-secondary {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
}

.message-card.user .message-card-actions-conversation .btn-secondary:hover:not(:disabled),
.message-card.user .message-card-actions-conversation .btn-secondary:focus-visible {
  border-color: rgba(255, 255, 255, 0.46);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

@keyframes image-generation-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes image-result-card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes image-result-reveal {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .message-card.image-generation-card {
    max-width: 96%;
  }

  .image-generation-placeholder {
    grid-template-columns: 1fr;
  }

  .image-generation-preview {
    min-height: 180px;
    aspect-ratio: 16 / 9;
  }

  .image-generation-copy {
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-activity-spinner,
  .chat-activity-dots i,
  .chat-waiting-lines i,
  .chat-selected-channel-dot.is-busy,
  .message-card.user[data-activity="sending"],
  .composer-submit .btn.is-busy::before,
  .message-markdown.is-streaming::after,
  .image-generation-spinner,
  .message-card.has-images,
  .message-card.has-images .message-image {
    animation: none !important;
  }

  .image-generation-progress-fill,
  .message-image img {
    transition-duration: 1ms !important;
  }
}

.image-task-execution {
  position: relative;
  overflow: hidden;
  height: 4px;
  border-radius: 4px;
  background: var(--bg-muted);
}

.image-task-execution-sweep {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: var(--text-main);
  animation: image-task-execution-sweep 1.6s ease-in-out infinite alternate;
}

@keyframes image-task-execution-sweep {
  to { transform: translateX(150%); }
}

@media (prefers-reduced-motion: reduce) {
  .image-task-execution-sweep {
    animation: none;
  }
}

.composer {
  --composer-control-height: 42px;
  position: relative;
  display: grid;
  gap: 10px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
  background: var(--bg-surface-soft);
}

.composer::before {
  position: absolute;
  top: -1px;
  right: 0;
  left: 0;
  height: 2px;
  content: "";
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    transparent 24%,
    rgba(17, 24, 39, 0.16) 38%,
    var(--bg-strong) 50%,
    rgba(17, 24, 39, 0.16) 62%,
    transparent 76%,
    transparent 100%
  );
  background-size: 220% 100%;
  transition: opacity 160ms ease;
}

.composer.is-sending::before {
  opacity: 1;
  animation: composer-progress-sweep 1.25s linear infinite;
}

.composer-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.composer-attach-btn {
  width: var(--composer-control-height);
  min-width: var(--composer-control-height);
  height: var(--composer-control-height);
  padding: 0;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  line-height: 0;
  flex: none;
  align-self: center;
}

.composer-attach-btn svg {
  display: block;
  width: 18px;
  height: 18px;
}

.composer-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.composer-field {
  gap: 4px;
}

.composer-input {
  min-height: var(--composer-control-height);
  height: var(--composer-control-height);
  max-height: 120px;
  padding-block: 10px;
  line-height: 20px;
  overflow-y: auto;
  resize: none;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.composer-input:disabled {
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

.composer-input:disabled::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.composer-input::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

.composer-input::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.composer-input::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--scrollbar-thumb);
  background-clip: padding-box;
}

.composer-input::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

.composer-input::-webkit-scrollbar-button,
.composer-input::-webkit-resizer,
.composer-input::-webkit-scrollbar-corner {
  display: none;
  width: 0;
  height: 0;
}

.composer-submit {
  display: flex;
  align-items: stretch;
  justify-content: end;
  align-self: center;
  max-width: 100%;
}

.composer-submit .btn {
  min-width: 0;
  min-width: 92px;
  min-height: var(--composer-control-height);
  height: var(--composer-control-height);
  padding-inline: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.composer-submit .btn.is-busy::before {
  content: "";
}

@keyframes composer-progress-sweep {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .composer.is-sending::before {
    animation: none;
    background-position: 50% 0;
  }
}

.composer.is-image-mode .composer-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.composer.is-image-mode .composer-attach-btn {
  display: none;
}

.composer-attachments {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.composer-attachments .attachment-card {
  flex: 0 0 clamp(180px, 22vw, 240px);
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg-surface);
}

.composer-attachments .attachment-thumb,
.composer-attachments .attachment-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.composer-attachments .attachment-body {
  gap: 2px;
}

.composer-attachments .attachment-remove {
  align-self: center;
}

.image-reference-board {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.image-reference-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

.image-reference-add {
  display: grid;
  place-items: center;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1.5px dashed rgba(100, 116, 139, 0.4);
  border-radius: 10px;
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.image-reference-add svg {
  width: 20px;
  height: 20px;
}

.image-reference-add:hover {
  border-color: rgba(100, 116, 139, 0.75);
  background: var(--bg-surface);
  color: var(--text-main);
}

.image-reference-add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.image-reference-add:disabled:hover {
  border-color: rgba(100, 116, 139, 0.4);
  background: var(--bg-muted);
  color: var(--text-muted);
}

.image-reference-add:focus-visible {
  outline: 2px solid var(--line-strong);
  outline-offset: 2px;
}

.image-reference-options {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.image-reference-options .select-input {
  width: auto;
  min-width: 0;
  min-height: 32px;
  height: 32px;
  padding-block: 0;
  font-size: 0.75rem;
}

.image-reference-item {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  cursor: grab;
}

.image-reference-item.is-dragging {
  opacity: 0.5;
}

.image-reference-item.is-drag-over {
  outline: 2px solid var(--line-strong);
  outline-offset: 2px;
}

.image-reference-preview {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: inherit;
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: pointer;
}

.image-reference-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-reference-preview > svg {
  width: 24px;
  height: 24px;
}

.image-reference-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
}

.image-reference-remove svg {
  width: 12px;
  height: 12px;
}

.image-reference-remove:hover {
  background: var(--bg-muted);
  border-color: var(--line-strong);
}

.image-reference-preview:focus-visible,
.image-reference-remove:focus-visible {
  outline: 2px solid var(--line-strong);
  outline-offset: 2px;
}

.image-reference-remove:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.message-attachments {
  display: grid;
  gap: 8px;
}

.attachment-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.attachment-thumb,
.attachment-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  flex: 0 0 auto;
}

.attachment-thumb {
  object-fit: cover;
  background: #e5e7eb;
}

.attachment-icon {
  display: grid;
  place-items: center;
  background: #e5e7eb;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.attachment-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.attachment-body strong,
.attachment-body small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-body small {
  white-space: nowrap;
}

.attachment-link,
.attachment-remove {
  border: 0;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.attachment-link:hover,
.attachment-remove:hover {
  text-decoration: underline;
}

@keyframes chat-stream-caret {
  0%,
  50% {
    opacity: 0.9;
  }
  50.01%,
  100% {
    opacity: 0.1;
  }
}

.message-card.is-executing-image .attachment-card.is-image {
  position: relative;
  overflow: hidden;
}

.message-card.is-executing-image .attachment-card.is-image::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.42) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: image-input-sweep 1.8s ease-in-out infinite;
}

.message-card.is-executing-image .attachment-thumb {
  animation: image-input-pulse 1.8s ease-in-out infinite;
}

@keyframes image-input-sweep {
  to { transform: translateX(100%); }
}

@keyframes image-input-pulse {
  50% { opacity: 0.65; }
}

@media (prefers-reduced-motion: reduce) {
  .message-card.is-executing-image .attachment-card.is-image::after,
  .message-card.is-executing-image .attachment-thumb {
    animation: none;
  }
}


.mono-shell.is-auth-page {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: var(--app-height);
  min-height: var(--app-height);
}

.mono-shell.is-auth-page .mono-rail,
.mono-shell.is-auth-page .mono-header,
.mono-shell.is-auth-page .global-error {
  display: none;
}

.mono-shell.is-auth-page .mono-stage {
  width: 100%;
  height: var(--app-height);
  min-height: var(--app-height);
}

.mono-shell.is-auth-page .mono-main {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 24px;
  overflow: auto;
}

.mono-shell.is-auth-page .page-screen[data-page-screen="login"] {
  width: min(100%, 440px);
  flex: 0 1 auto;
  min-height: auto;
  overflow: visible;
}

.login-page,
.login-panel {
  width: 100%;
}

.login-panel {
  max-width: 440px;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.login-panel-head {
  display: grid;
  gap: 6px;
  margin-bottom: 20px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-submit-btn {
  width: 100%;
}

.login-error {
  margin: 0;
}

@media (max-width: 760px) {
  .mono-shell.is-auth-page .mono-main {
    padding: 12px;
  }

  .login-panel {
    padding: 18px;
  }
}

.settings-tabs-panel {
  width: 100%;
  max-width: none;
  padding: 0;
  gap: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.mono-header.is-settings-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "tabs meta";
  align-items: stretch;
  padding: 8px 20px 0;
  row-gap: 0;
}

.mono-header.is-settings-header .mono-header-copy {
  display: none;
}

.mono-header.is-settings-header .mono-header-meta {
  grid-area: meta;
}

.mono-header.is-settings-header .settings-tabs {
  grid-area: tabs;
}

.mono-header.is-log-tabs-header {
  flex-wrap: wrap;
  row-gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.mono-header.is-log-tabs-header .log-tabs {
  flex-basis: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.log-tabs.settings-tabs {
  border-bottom: 0;
}

.log-tabs .settings-tab {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.log-tabs .settings-tab.is-active,
.log-tabs .settings-tab.is-active:hover {
  margin-bottom: 0;
  border: 1px solid var(--bg-strong);
}

.mono-header.is-log-tabs-header .page-header-toolbar {
  flex-basis: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 0;
  padding: 0;
  border-bottom: 2px solid var(--bg-strong);
}

.settings-tab {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: #4b5563;
  padding: 0 12px;
  font-size: 0.82rem;
  text-align: center;
  cursor: pointer;
}

.settings-tab:hover {
  background: #f3f4f6;
  color: var(--text-main);
}

.settings-tab.is-active,
.settings-tab.is-active:hover {
  border: 1px solid var(--bg-strong);
  border-bottom: 2px solid var(--bg-strong);
  margin-bottom: -2px;
  background: var(--bg-strong);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
}

.settings-tab:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 2px;
}

.settings-tabs-body {
  padding: 0;
  display: grid;
  gap: 0;
}

.settings-form-section {
  display: grid;
  gap: 12px;
}

.settings-tabs-body > .settings-form-section {
  padding: 0;
}

.settings-tabs-body > .settings-form-section > .panel,
.settings-tabs-body > .settings-form-section > form,
.settings-tabs-body > .settings-form-section > .detail-stack,
.settings-tabs-body > .settings-form-section > .list-stack {
  min-width: 0;
}

#settings-section-auth > .panel {
  padding: 18px 16px 16px;
  border-color: var(--line-strong);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-surface-soft) 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

#settings-section-preferences > .panel {
  padding: 18px 16px 16px;
  border-color: var(--line-strong);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-surface-soft) 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

#settings-section-openlist > .panel {
  padding: 18px 16px 16px;
  border-color: var(--line-strong);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-surface-soft) 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.settings-admin-form {
  display: grid;
  gap: 12px;
}

.settings-runtime-grid,
.settings-preferences-grid {
  display: grid;
  gap: 10px;
}

.settings-runtime-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-preferences-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.settings-field-status {
  margin-left: 6px;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}

.settings-field-status.is-configured {
  color: var(--text-main);
}

.settings-connection-status {
  color: var(--text-muted);
}

.settings-connection-status.is-success {
  color: var(--text-main);
}

.settings-runtime-stat {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.settings-runtime-stat span {
  font-size: 0.72rem;
  font-weight: var(--weight-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.settings-runtime-stat strong {
  min-width: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.settings-admin-footer {
  display: grid;
  gap: 10px;
  justify-items: end;
  align-items: end;
  padding-top: 2px;
}

.settings-admin-footer .inline-note {
  color: var(--text-muted);
}

.settings-admin-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.system-reverse-modal-body {
  max-height: min(72vh, 980px);
  overflow: auto;
  padding-right: 4px;
  display: grid;
  gap: 16px;
}

.diagnosis-check-list {
  display: grid;
  gap: 6px;
}

.diagnosis-check-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.diagnosis-check-item strong,
.diagnosis-check-item p {
  margin: 0;
}

.diagnosis-check-item p {
  margin-top: 3px;
  color: var(--text-muted);
  line-height: 1.4;
}

.diagnosis-check-status,
.diagnosis-overall {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.diagnosis-check-status-passed,
.diagnosis-check-status-started,
.diagnosis-overall-passed {
  color: #166534;
  background: #dcfce7;
}

.diagnosis-check-status-blocked,
.diagnosis-overall-attention {
  color: #92400e;
  background: #fef3c7;
}

.diagnosis-check-status-failed {
  color: #991b1b;
  background: #fee2e2;
}

.diagnosis-request-row {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.docs-section {
  gap: 16px;
}

.docs-tabs-panel {
  gap: 18px;
  padding: 14px;
}

.docs-tabs {
  display: inline-flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
}

.docs-tab {
  height: 36px;
  padding: 0 16px;
  margin-bottom: -1px;
  border: 1px solid transparent;
  border-bottom: 1px solid transparent;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-size: 0.88rem;
  font-weight: var(--weight-medium);
  cursor: pointer;
  white-space: nowrap;
}

.docs-tab:hover,
.docs-tab:focus-visible {
  background: var(--bg-muted);
  color: var(--text-main);
  outline: none;
}

.docs-tab.is-active {
  border-color: var(--bg-strong);
  background: var(--bg-strong);
  color: #ffffff;
}

.docs-tab-content {
  display: grid;
  gap: 14px;
}

.docs-flow {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  padding: 4px 0 0;
}

.docs-step-dot {
  position: relative;
  flex: 1 1 0;
  min-width: 120px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0 8px;
  cursor: pointer;
  font: inherit;
  text-align: center;
}

.docs-step-dot::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
  z-index: 0;
}

.docs-step-dot:first-child::before {
  left: 50%;
}

.docs-step-dot:last-child::before {
  right: 50%;
}

.docs-step-dot span {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-main);
  place-items: center;
  display: grid;
  font-weight: var(--weight-strong);
}

.docs-step-dot strong {
  font-size: 0.84rem;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}

.docs-step-dot:hover span,
.docs-step-dot:focus-visible span,
.docs-step-dot.is-active span {
  border-color: var(--bg-strong);
  background: var(--bg-strong);
  color: #ffffff;
}

.docs-step-dot:focus-visible {
  outline: none;
}

.docs-step-dot.is-active strong {
  color: var(--text-main);
}

.docs-step-detail {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 14px 14px;
  background: #ffffff;
  display: grid;
  gap: 0;
}


.docs-step-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.9rem;
}

.docs-step-table th,
.docs-step-table td {
  border-top: 1px solid var(--line);
  padding: 11px 0;
  vertical-align: top;
  line-height: 1.5;
}

.docs-step-table th {
  width: 136px;
  padding-right: 16px;
  color: var(--text-main);
  font-weight: var(--weight-medium);
  text-align: left;
}

.docs-step-key {
  border-radius: 6px;
  padding: 2px 6px;
  background: var(--bg-muted);
  color: var(--text-main);
  font-size: 0.82rem;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-weight: var(--weight-medium);
}

.docs-step-table td {
  color: var(--text-muted);
}

.docs-step-copy-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.docs-step-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.docs-step-copy-btn {
  margin-left: auto;
}

.docs-action-table {
  margin-top: 4px;
}

.docs-step-code {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.docs-step-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.docs-step-code-list {
  gap: 10px;
}

.docs-step-code-row {
  display: grid;
  gap: 6px;
}

.docs-step-code-row-label {
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: var(--weight-medium);
}

.docs-step-code-label {
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: var(--weight-medium);
}

.docs-step-code .code-block {
  margin: 0;
}

.docs-card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.docs-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-surface-soft) 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
  display: grid;
  gap: 12px;
}

.docs-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.docs-card-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.docs-card-copy h3 {
  font-size: 0.96rem;
}

.docs-card-source,
.docs-card-summary,
.docs-card-row p {
  color: var(--text-muted);
}

.docs-card-source,
.docs-card-summary {
  line-height: 1.55;
}

.docs-card-source {
  font-size: 0.8rem;
}

.docs-card-summary {
  min-height: 0;
}

.docs-card-list {
  display: grid;
  gap: 8px;
}

.docs-card-row {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  display: grid;
  gap: 4px;
}

.docs-card-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.docs-card-row span {
  font-size: 0.72rem;
  font-weight: var(--weight-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.docs-card .code-block {
  min-height: 0;
}

.docs-card-actions {
  display: flex;
  justify-content: flex-end;
}

.docs-detail-body {
  max-height: min(72vh, 980px);
  overflow: auto;
  padding-right: 4px;
  display: grid;
  gap: 14px;
}

.docs-detail-hero {
  display: grid;
  gap: 14px;
}

.docs-detail-hero-copy {
  display: grid;
  gap: 8px;
}

.docs-detail-hero-copy p {
  color: var(--text-muted);
  line-height: 1.6;
}

.docs-detail-section {
  display: grid;
  gap: 12px;
}

.docs-detail-section-warning .detail-row {
  border-color: var(--warning-line);
  background: var(--warning-bg);
}

.docs-detail-row {
  min-height: 0;
}

.guide-target-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.guide-tabs {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.guide-target-card {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
  display: grid;
  gap: 4px;
}

.guide-target-card span {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.guide-target-card strong {
  min-width: 0;
  font-size: 0.82rem;
  font-weight: var(--weight-medium);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.guide-flow {
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  padding: 4px 0 2px;
}

.guide-step-item {
  flex: 0 0 148px;
  min-width: 148px;
  display: grid;
  justify-items: center;
}

.guide-step {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 0;
  cursor: pointer;
  text-align: center;
  font: inherit;
}

.guide-step-dot {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-main);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: var(--weight-strong);
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.guide-step-label {
  max-width: 12ch;
  font-size: 0.8rem;
  line-height: 1.45;
}

.guide-step-connector {
  flex: 1 0 28px;
  min-width: 28px;
  height: 2px;
  margin-top: 19px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dbe3ea 0%, #c7d2dd 100%);
}

.guide-step:hover .guide-step-dot,
.guide-step:focus-visible .guide-step-dot {
  border-color: #c5d1de;
  background: #f8fafc;
  transform: translateY(-1px);
}

.guide-step:focus-visible {
  outline: none;
}

.guide-step.is-active {
  color: var(--text-main);
}

.guide-step.is-active .guide-step-dot {
  border-color: var(--bg-strong);
  background: var(--bg-strong);
  color: #ffffff;
}

.guide-step.is-active .guide-step-label {
  font-weight: var(--weight-medium);
  color: var(--text-main);
}

.guide-doc-active {
  gap: 14px;
}

.guide-doc-header,
.guide-doc-code {
  display: grid;
  gap: 8px;
}

.guide-doc-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.guide-doc-title-row h3 {
  margin: 0;
  font-size: 1.1rem;
}

.guide-doc-count {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: var(--weight-medium);
}

.guide-flow-chart {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0 4px;
}

.guide-flow-node {
  flex: 1 0 150px;
  min-width: 150px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.guide-flow-node:hover,
.guide-flow-node:focus-visible {
  border-color: #c5d1de;
  background: #f8fafc;
  outline: none;
}

.guide-flow-node.is-active {
  border-color: var(--bg-strong);
  box-shadow: inset 0 0 0 1px var(--bg-strong);
}

.guide-flow-node.is-done {
  background: var(--bg-surface-soft);
}

.guide-flow-node-index {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: var(--weight-strong);
}

.guide-flow-node.is-active .guide-flow-node-index {
  border-color: var(--bg-strong);
  background: var(--bg-strong);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
}

.guide-flow-node.is-done .guide-flow-node-index {
  border-color: #111827;
  color: #111827;
}

.guide-flow-node-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.guide-flow-node-copy strong {
  min-width: 0;
  font-size: 0.88rem;
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-flow-node-copy small {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.guide-flow-arrow {
  flex: 0 0 auto;
  align-self: center;
  color: var(--text-muted);
  font-size: 1rem;
}

.guide-field-list {
  display: grid;
  gap: 8px;
}

.guide-field-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.guide-field-row span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.guide-field-row strong {
  min-width: 0;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}

.guide-doc-code-list {
  gap: 10px;
}

.guide-doc-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

/* Keep the connection guide dense without shrinking its controls. */
#page-guide .page-stack {
  gap: 8px;
}

#page-guide .page-stack > .panel {
  gap: 6px;
  padding: 7px;
}

#page-guide .page-stack > .panel .panel-head {
  gap: 5px;
}

#page-guide .guide-target-list {
  gap: 4px;
}

#page-guide .guide-target-card {
  gap: 2px;
  padding: 4px 5px;
}

#page-guide .guide-flow {
  padding: 2px 0 1px;
}

#page-guide .guide-step {
  gap: 5px;
}

#page-guide .guide-doc-active {
  gap: 7px;
}

#page-guide .guide-doc-header,
#page-guide .guide-doc-code {
  gap: 4px;
}

#page-guide .guide-doc-title-row {
  gap: 5px;
}

#page-guide .guide-flow-chart {
  gap: 4px;
  padding: 1px 0 2px;
}

#page-guide .guide-field-list {
  gap: 4px;
}

#page-guide .guide-field-row {
  gap: 5px;
  padding: 5px 6px;
}

#page-guide .guide-doc-code-list {
  gap: 5px;
}

#page-guide .guide-doc-actions {
  gap: 4px;
  padding-top: 1px;
}

.guide-doc-code-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.guide-doc-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.guide-doc-list li {
  padding-left: 2px;
  line-height: 1.6;
  color: var(--text-main);
}

.guide-doc-list li::marker {
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

.engineering-doc-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.engineering-doc-sidebar {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 4px;
  padding: 10px;
}

.engineering-nav-link {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  font-size: 0.88rem;
  font-weight: var(--weight-medium);
  font: inherit;
  cursor: pointer;
}

.engineering-nav-link:hover,
.engineering-nav-link:focus-visible {
  background: var(--bg-surface-soft);
  color: var(--text-main);
  outline: none;
}

.engineering-nav-link.is-active {
  background: var(--bg-strong);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
}

.engineering-doc-content {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.engineering-doc-section {
  min-width: 0;
  display: grid;
  gap: 14px;
  scroll-margin-top: 16px;
}

.engineering-doc-hero,
.engineering-section-head {
  display: grid;
  gap: 8px;
}

.engineering-doc-hero h2,
.engineering-section-head h2 {
  margin: 0;
  color: var(--text-main);
  font-size: 1.16rem;
  line-height: 1.45;
}

.engineering-doc-hero p {
  max-width: 780px;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.65;
}

.engineering-section-head span,
.engineering-node span,
.engineering-compare span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.engineering-flow {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
}

.engineering-diagram,
.engineering-sequence,
.engineering-auth-diagram,
.engineering-debug-flow,
.engineering-bridge-diagram,
.engineering-code-flow {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-surface-soft) 100%);
}

.engineering-diagram b,
.engineering-sequence b,
.engineering-auth-diagram b,
.engineering-debug-flow b,
.engineering-bridge-diagram b,
.engineering-code-flow b {
  flex: 0 0 auto;
  align-self: center;
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

.engineering-lane,
.engineering-sequence article,
.engineering-auth-diagram article,
.engineering-debug-flow article,
.engineering-bridge-diagram article,
.engineering-code-flow article {
  flex: 1 0 142px;
  min-width: 142px;
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-surface);
}

.engineering-lane.is-core,
.engineering-auth-diagram article.is-core {
  border-color: var(--bg-strong);
  box-shadow: inset 0 0 0 1px var(--bg-strong);
}

.engineering-lane span,
.engineering-sequence span,
.engineering-auth-diagram span,
.engineering-debug-flow span,
.engineering-bridge-diagram span,
.engineering-code-flow span,
.engineering-code-map span {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.engineering-lane strong,
.engineering-sequence strong,
.engineering-auth-diagram strong,
.engineering-debug-flow strong,
.engineering-bridge-diagram strong,
.engineering-code-flow strong,
.engineering-code-map strong,
.engineering-detail-grid strong {
  color: var(--text-main);
  font-size: 0.94rem;
  font-weight: var(--weight-strong);
}

.engineering-lane small,
.engineering-sequence small {
  color: var(--text-muted);
  line-height: 1.4;
}

.engineering-bridge-diagram article p,
.engineering-code-map p,
.engineering-detail-grid p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.52;
}

.engineering-bridge-diagram article span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--bg-strong);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
  font-weight: var(--weight-strong);
}

.engineering-code-flow article code {
  width: fit-content;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 8px;
  background: var(--bg-surface-soft);
  color: var(--text-main);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.engineering-explain-block {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.engineering-explain-block p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.engineering-code-map,
.engineering-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.engineering-code-map article,
.engineering-detail-grid article {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.engineering-code-map strong {
  overflow-wrap: anywhere;
}

.engineering-sequence article span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--bg-strong);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
  font-weight: var(--weight-strong);
}

.engineering-hub-diagram {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.engineering-hub-diagram article {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-surface);
}

.engineering-hub-diagram article.is-core {
  grid-column: 1 / -1;
  border-color: var(--bg-strong);
  box-shadow: inset 0 0 0 1px var(--bg-strong);
}

.engineering-hub-diagram span {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.engineering-hub-diagram strong {
  color: var(--text-main);
  font-size: 0.94rem;
}

.engineering-node {
  flex: 1 0 168px;
  min-width: 168px;
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.engineering-node.is-core {
  border-color: var(--bg-strong);
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--bg-strong);
}

.engineering-node strong {
  font-size: 0.92rem;
  font-weight: var(--weight-strong);
}

.engineering-arrow {
  flex: 0 0 auto;
  align-self: center;
  color: var(--text-muted);
}

.engineering-point-grid,
.engineering-compare {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.engineering-point-grid article,
.engineering-compare article {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.engineering-point-grid strong,
.engineering-compare strong {
  font-size: 0.92rem;
}

.engineering-point-grid p,
.engineering-compare p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.engineering-steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.engineering-steps li {
  color: var(--text-main);
  line-height: 1.55;
}

.engineering-steps li::marker {
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

.engineering-mini-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.engineering-mini-flow span {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: var(--weight-medium);
}

.engineering-mini-flow b {
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

.engineering-check-list {
  display: grid;
  gap: 8px;
}

.engineering-check-list article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.engineering-check-list strong {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--bg-strong);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
  font-size: 0.8rem;
}

.engineering-check-list span {
  min-width: 0;
  color: var(--text-main);
  overflow-wrap: anywhere;
}


.api-keys-filter-panel {
  container-type: inline-size;
  padding-block: 8px;
  gap: 8px;
}

.api-keys-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
}

.api-keys-filter-filters {
  grid-template-columns: minmax(220px, 320px);
}

.api-keys-filter-toolbar .select-input {
  min-width: 0;
  width: 100%;
}

.api-keys-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}

.api-keys-filter-toolbar .btn {
  min-height: var(--control-height);
  white-space: nowrap;
}

.api-keys-metrics-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  padding: 2px;
  min-width: 0;
}

.api-keys-metrics-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.06fr) minmax(180px, 1fr) minmax(160px, 0.86fr);
  gap: 6px;
  padding: 2px;
  border: 1px solid #e1e8f0;
  border-radius: 12px;
  background: rgba(246, 249, 252, 0.92);
  align-self: center;
  align-items: center;
  min-width: 0;
}

.api-keys-metrics-filters .select-input {
  min-width: 0;
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  border-color: transparent;
  border-radius: 8px;
  background-color: var(--bg-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.api-keys-metrics-filters .select-input:hover {
  border-color: #cbd8e5;
  background-color: #ffffff;
}

.api-keys-metrics-filters .select-input:focus {
  border-color: #88a8c7;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 1px 2px rgba(15, 23, 42, 0.04);
}

.api-keys-metrics-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-left: 14px;
  border-left: 1px solid #e1e8f0;
  min-width: 0;
  flex-wrap: nowrap;
}

.api-keys-metrics-context {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 0;
  color: var(--text-muted);
  min-width: 0;
  max-width: clamp(180px, 20vw, 300px);
  overflow: hidden;
  white-space: nowrap;
  flex-wrap: nowrap;
  flex: 0 1 auto;
}

.api-keys-metrics-context.is-empty {
  display: none;
}

.api-keys-metrics-context .meta-tag {
  min-width: 0;
  min-height: 30px;
  padding-inline: 9px;
  max-width: 100%;
  border-color: #d7e4f1;
  background: #f0f6fc;
  color: #536b82;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-keys-metrics-actions .btn {
  min-height: var(--control-height);
  border-radius: 8px;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.api-keys-metrics-actions .btn {
  white-space: nowrap;
}

.api-keys-metrics-actions a.btn {
  border-color: #d7e1ec;
  background: #ffffff;
  color: #40566c;
}

.api-keys-metrics-actions a.btn:hover {
  border-color: #b8c9da;
  background: #f6f9fc;
  color: #263b50;
}

#api-key-metrics-clear-focus-btn:disabled {
  opacity: 1;
  border-color: #e5eaf0;
  background: #f8fafc;
  color: #a3afbd;
}

#api-key-metrics-refresh-btn {
  border-color: #1f2937;
  background: #1f2937;
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.12);
}

#api-key-metrics-refresh-btn:hover:not(:disabled) {
  border-color: #2b3a4d;
  background: #2b3a4d;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.16);
}

#api-key-metrics-refresh-btn:disabled {
  border-color: #7b8794;
  background: #7b8794;
  color: #ffffff;
}

.api-key-billing-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
}

.api-key-billing-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(170px, 0.9fr);
  max-width: 560px;
  min-width: 0;
}

.mono-header .api-key-billing-filters .select-input {
  padding-left: 8px;
  padding-right: 30px;
}

.api-key-billing-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}

@container (max-width: 760px) {
  .api-keys-metrics-toolbar,
  .api-key-billing-toolbar {
    grid-template-columns: 1fr;
  }

  .api-keys-metrics-filters,
  .api-key-billing-filters {
    grid-template-columns: 1fr;
  }

  .api-keys-metrics-actions,
  .api-key-billing-actions {
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
  }

  .api-key-billing-filters {
    max-width: none;
  }
}

.api-keys-metrics-overview {
  margin-top: 0;
  display: grid;
  gap: 8px;
}

.api-key-metrics-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.api-key-metrics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
  gap: 10px;
}

.api-key-billing-card {
  min-width: 0;
}

.api-key-billing-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.api-key-billing-table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}

.api-key-billing-table {
  width: max-content;
  min-width: 2410px;
  table-layout: fixed;
}

.api-key-billing-table .billing-col-time {
  width: 170px;
}

.api-key-billing-table .billing-col-type {
  width: 180px;
}

.api-key-billing-table .billing-col-key-id {
  width: 220px;
}

.api-key-billing-table .billing-col-key-name {
  width: 160px;
}

.api-key-billing-table .billing-col-request-id {
  width: 220px;
}

.api-key-billing-table .billing-col-http {
  width: 90px;
}

.api-key-billing-table .billing-col-error {
  width: 220px;
}

.api-key-billing-table .billing-col-app,
.api-key-billing-table .billing-col-client {
  width: 180px;
}

.api-key-billing-table .billing-col-model {
  width: 180px;
}

.api-key-billing-table .billing-col-status {
  width: 90px;
}

.api-key-billing-table .billing-col-token {
  width: 110px;
}

.api-key-billing-table .billing-col-latency {
  width: 90px;
}

.api-key-billing-table .billing-col-amount {
  width: 100px;
}

.api-key-billing-table th,
.api-key-billing-table td {
  padding: 9px 12px;
}

.api-key-billing-table th {
  white-space: nowrap;
}
.api-key-billing-table td {
  vertical-align: top;
}

.billing-identifier-cell {
  min-width: 0;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.billing-context-cell,
.billing-error-cell {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.35;
}

.billing-error-cell {
  color: var(--danger-text);
}

.billing-http-cell,
.billing-status-cell {
  white-space: nowrap;
}

.billing-time-cell,
.billing-number-cell {
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
}

.billing-number-cell {
  padding-inline: 6px !important;
}

.billing-amount-cell {
  font-weight: var(--weight-strong);
}


.api-key-trend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18px, 1fr));
  gap: 6px;
  align-items: end;
  min-height: 128px;
}

.api-key-trend-item {
  min-width: 0;
  display: grid;
  gap: 6px;
  align-content: end;
}

.api-key-trend-bar-wrap {
  height: 98px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.api-key-trend-bar {
  display: block;
  width: 100%;
  max-width: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
}

.api-key-trend-item small {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
}

.api-key-metrics-key-list {
  display: grid;
  gap: 8px;
}

.api-key-metrics-key-item {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-surface-soft) 100%);
}

.api-key-metrics-key-item.is-active {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 1px rgba(29, 78, 216, 0.18);
}

.api-key-metrics-key-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.api-key-metrics-key-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--text-main);
}

.api-key-metrics-key-time {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.api-key-metrics-key-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.api-key-metrics-key-meta small {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.api-keys-metrics-overview .requests-chart-empty {
  min-height: 120px;
}

.api-key-modal-card {
  width: min(980px, 100%);
  max-height: calc(100vh - 24px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}

.api-key-modal-grid {
  min-height: 0;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  overflow: auto;
  overscroll-behavior: contain;
  align-content: start;
  padding-right: 4px;
}

.api-key-scope-section {
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
}

.api-key-scope-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.api-key-table-meta {
  display: grid;
  gap: 4px;
}

.api-key-table-meta small {
  color: var(--text-muted);
  line-height: 1.4;
}

.api-key-usage-stack {
  display: grid;
  gap: 4px;
}

.api-key-usage-stack strong {
  font-size: 0.84rem;
  font-weight: var(--weight-strong);
  color: var(--text-main);
}

.api-key-status-stack {
  display: grid;
  gap: 4px;
  justify-items: start;
}

.api-key-status-stack small {
  line-height: 1.35;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .api-keys-filter-toolbar {
    grid-template-columns: 1fr;
  }

  .api-keys-metrics-toolbar {
    grid-template-columns: 1fr;
  }

  .api-key-billing-toolbar {
    grid-template-columns: 1fr;
  }

  .api-key-metrics-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .api-key-metrics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .mono-header.is-page-toolbar .api-keys-metrics-toolbar {
    grid-template-columns: 1fr;
  }

  .mono-header.is-page-toolbar .api-keys-metrics-actions {
    justify-content: flex-start;
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .mono-header .page-header-toolbar-actions .toolbar-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
  }

  .mono-header .page-header-toolbar-actions .btn {
    flex: 1 1 auto;
  }

  .api-keys-filter-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .api-keys-filter-toolbar .btn {
    width: 100%;
  }

  .api-keys-metrics-actions {
    flex-direction: column;
    align-items: stretch;
    justify-items: stretch;
  }

  .api-key-billing-actions {
    flex-direction: column;
    align-items: stretch;
    justify-items: stretch;
  }

  .api-keys-metrics-context {
    justify-content: flex-start;
    min-height: 0;
    max-width: none;
    white-space: normal;
  }

  .api-key-metrics-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .api-keys-metrics-filters {
    grid-template-columns: 1fr;
  }

  .api-key-billing-filters {
    grid-template-columns: 1fr;
  }
}

.app-policy-section {
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
}

.personal-chat-setup-card {
  width: min(1180px, 100%);
  max-height: calc(100vh - 24px);
  min-height: min(680px, calc(100vh - 24px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.personal-chat-setup-card > .panel-head {
  align-items: flex-start;
}

.personal-chat-setup-body {
  min-height: 0;
  display: grid;
  gap: 10px;
  overflow: auto;
  overscroll-behavior: contain;
  align-content: start;
  padding-right: 4px;
}

.personal-chat-setup-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.personal-chat-setup-steps > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.personal-chat-setup-steps strong {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-main);
  color: #fff;
  font-size: 0.74rem;
}

.personal-chat-setup-notice {
  padding: 10px 12px;
  border: 1px solid #cfe0f4;
  border-radius: var(--radius-md);
  background: #f3f8ff;
  color: #37526e;
  font-size: 0.82rem;
  line-height: 1.55;
}

.personal-chat-setup-table-wrap {
  min-height: 170px;
}

.personal-chat-setup-table th,
.personal-chat-setup-table td {
  vertical-align: middle;
}

.personal-chat-setup-table td > .table-subtle,
.personal-chat-setup-table td > .status-pill {
  display: block;
  margin-top: 3px;
}

.personal-chat-setup-warnings {
  padding: 10px 12px;
  border: 1px solid #f2c7c7;
  border-radius: var(--radius-md);
  background: #fff7f7;
  color: #8a3030;
  font-size: 0.82rem;
  line-height: 1.5;
}

.personal-chat-setup-warnings ul {
  margin: 5px 0 0 18px;
  padding: 0;
}

.personal-chat-setup-config {
  display: grid;
  gap: 8px;
}

.personal-chat-setup-config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.personal-chat-setup-config-head p {
  margin: 3px 0 0;
}

.personal-chat-setup-config .code-block {
  max-height: 260px;
  overflow: auto;
}

.personal-chat-setup-actions {
  justify-content: flex-start;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  background: var(--bg-surface);
}

.personal-chat-setup-actions-note {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.app-policy-head {
  display: grid;
  gap: 4px;
}

.app-policy-grid,
.app-policy-limits {
  display: grid;
  gap: 8px;
}

.app-policy-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.app-policy-limits {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.toggle-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.toggle-field input {
  margin: 0;
  flex: 0 0 auto;
}

.toggle-field-copy {
  min-width: 0;
  display: flex;
  align-items: center;
}

.toggle-field-copy strong {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.84rem;
  font-weight: var(--weight-strong);
  color: var(--text-main);
}

.toggle-field-copy small {
  color: var(--text-muted);
  line-height: 1.4;
}

.app-modal-card {
  width: min(1120px, 100%);
  max-height: calc(100vh - 24px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}

.modal-card.app-bindings-modal-card {
  width: min(920px, 100%);
  height: min(760px, calc(var(--app-height) - 36px));
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  overflow: hidden;
}

.modal-card.app-bindings-modal-card .app-bindings-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.modal-card.app-bindings-modal-card .app-bindings-meta {
  min-width: 0;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  overflow: auto;
  overscroll-behavior: contain;
  align-content: start;
  gap: 8px;
  padding-right: 4px;
}

.modal-card.app-bindings-modal-card .app-bindings-meta > * {
  min-width: 0;
}

.modal-card.app-bindings-modal-card .app-bindings-meta .code-block {
  max-height: none;
  overflow: visible;
}

.modal-card.app-bindings-modal-card .app-bindings-meta .table-wrap {
  max-height: none;
  overflow: visible;
}

.modal-card.app-bindings-modal-card .app-bindings-meta .channel-table {
  min-width: 0;
  table-layout: fixed;
}

.modal-card.app-bindings-modal-card .app-bindings-meta .channel-table th,
.modal-card.app-bindings-modal-card .app-bindings-meta .channel-table td {
  overflow-wrap: anywhere;
}

.app-modal-form {
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.app-modal-grid {
  min-height: 0;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  overflow: auto;
  overscroll-behavior: contain;
  align-content: start;
  padding-right: 4px;
}

.app-modal-grid .field {
  gap: 6px;
}

.app-modal-grid textarea {
  min-height: 84px;
}

.app-modal-grid .field-note {
  line-height: 1.4;
}

.app-modal-actions {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  background: var(--bg-surface);
}

.app-diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.app-diagnostics-grid .detail-row {
  min-height: 88px;
}

.app-diagnostics-table {
  margin-top: 0;
}

.browser-instance-pool-card {
  width: min(1280px, 100%);
  max-height: calc(100vh - 24px);
  min-height: min(640px, calc(100vh - 24px));
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.browser-instance-pool-card > .modal-form {
  min-height: 0;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.browser-instance-pool-card > .modal-form > .table-wrap {
  min-height: 0;
}

.browser-instance-pool-card > .panel-head {
  justify-content: flex-start;
}

.browser-instance-pool-card > .panel-head > div:first-child {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 8px;
}

.browser-instance-pool-card .modal-actions {
  justify-content: flex-start;
}

.browser-instance-pool-card > .panel-head h2 {
  flex: 0 0 auto;
  white-space: nowrap;
}

.browser-instance-pool-card > .panel-head #app-browser-instance-pool-meta {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-instance-pool-card .form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
}

.browser-instance-pool-card .field-checkbox {
  flex-direction: row;
  align-items: center;
  min-height: var(--control-height);
  gap: 8px;
  padding: 0 8px;
}

.browser-instance-pool-card .field-checkbox input {
  flex: 0 0 auto;
  margin: 0;
}

.browser-instance-pool-card .form-grid > .field:first-child {
  flex-direction: row;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.browser-instance-pool-card .form-grid > .field:first-child > span {
  flex: 0 0 auto;
}

.browser-instance-pool-card .form-grid > .field:first-child > .text-input {
  min-width: 0;
  flex: 1 1 auto;
}

.browser-instance-pool-runtime {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
}

.browser-instance-pool-runtime-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border-right: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.browser-instance-pool-runtime-stat strong {
  color: var(--text-main);
  font-size: 0.9rem;
}

.browser-instance-pool-runtime-note {
  flex: 1 1 260px;
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-instance-pool-queue {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.browser-instance-pool-queue-label {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 92px;
  color: var(--text-main);
  white-space: nowrap;
}

.browser-instance-pool-queue-label > span {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.browser-instance-pool-queue-track {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: thin;
}

.browser-instance-pool-queue-item {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 190px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-main);
  font-size: 0.78rem;
}

.browser-instance-pool-queue-item strong {
  color: var(--success-text);
  font-size: 0.72rem;
}

.browser-instance-pool-queue-item > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-instance-pool-queue-arrow {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.browser-instance-pool-queue-empty {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.browser-instance-pool-table {
  width: 100%;
  min-width: 1610px;
  table-layout: fixed;
}

.browser-instance-pool-table th,
.browser-instance-pool-table td {
  padding: 9px 10px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-instance-pool-table th:nth-child(1) {
  width: 52px;
}

.browser-instance-pool-table th:nth-child(2) {
  width: 230px;
}

.browser-instance-pool-table th:nth-child(3) {
  width: 220px;
}

.browser-instance-pool-table th:nth-child(4) {
  width: 105px;
}

.browser-instance-pool-table th:nth-child(5) {
  width: 190px;
}

.browser-instance-pool-table th:nth-child(6) {
  width: 190px;
}

.browser-instance-pool-table th:nth-child(7) {
  width: 220px;
}

.browser-instance-pool-table th:nth-child(8) {
  width: 110px;
}

.browser-instance-pool-table th:nth-child(9) {
  width: 265px;
}

.browser-instance-pool-table th:nth-child(10) {
  width: 72px;
}

.browser-instance-pool-table td > .table-subtle {
  display: inline-block;
  max-width: 48%;
  margin-left: 6px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.75rem;
  vertical-align: middle;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-instance-pool-table td:nth-child(4) > .table-subtle {
  max-width: 42%;
}

.browser-instance-pool-table td:nth-child(3) > .table-subtle,
.browser-instance-pool-table td:nth-child(6) > .table-subtle,
.browser-instance-pool-table td:nth-child(7) > .table-subtle,
.browser-instance-pool-table td:nth-child(4) > .table-subtle,
.browser-instance-pool-table td:nth-child(9) > .table-subtle {
  max-width: 42%;
}

.browser-instance-pool-table .status-pill {
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.browser-instance-pool-table .browser-instance-pool-queue-cell,
.browser-instance-pool-table .browser-instance-pool-degraded-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-instance-pool-empty-value {
  margin-left: 0 !important;
}

.browser-instance-pool-table .table-number-input {
  width: 64px;
  min-width: 64px;
  padding: 6px 8px;
}

.browser-instance-pool-diagnostics-card {
  width: min(1280px, 100%);
  max-height: calc(100vh - 32px);
  min-height: min(560px, calc(100vh - 32px));
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.browser-instance-pool-diagnostics-card > .table-wrap {
  min-height: 0;
}

.browser-instance-pool-diagnostics-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px;
}

.browser-instance-pool-diagnostics-stat {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
}

.browser-instance-pool-diagnostics-stat span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-instance-pool-diagnostics-stat strong {
  color: var(--text-main);
  font-size: 1.1rem;
  line-height: 1;
}

.browser-instance-pool-diagnostics-table {
  min-width: 1460px;
}

.browser-instance-pool-diagnostics-table th,
.browser-instance-pool-diagnostics-table td {
  padding: 9px 12px;
}

.browser-instance-pool-diagnostics-table th:nth-child(1) {
  width: 90px;
}

.browser-instance-pool-diagnostics-table th:nth-child(2) {
  width: 210px;
}

.browser-instance-pool-diagnostics-table th:nth-child(3) {
  width: 110px;
}

.browser-instance-pool-diagnostics-table th:nth-child(4) {
  width: 150px;
}

.browser-instance-pool-diagnostics-table th:nth-child(5) {
  width: 190px;
}

.browser-instance-pool-diagnostics-table th:nth-child(6) {
  width: 220px;
}

.browser-instance-pool-diagnostics-table th:nth-child(7) {
  width: 100px;
}

.browser-instance-pool-diagnostics-table th:nth-child(8) {
  width: 230px;
}

.browser-instance-pool-diagnostics-table th:nth-child(9) {
  width: 260px;
}

.browser-instance-pool-diagnostics-table td {
  vertical-align: top;
}

.diagnostics-failure {
  max-width: 250px;
  overflow: hidden;
  color: var(--danger-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-table-actions,
.app-client-table-actions {
  flex-wrap: nowrap;
  gap: 8px;
  min-width: max-content;
}

.management-action-menu {
  position: relative;
}

.management-action-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 72px;
}

.management-action-menu-chevron {
  flex: 0 0 auto;
  transition: transform 160ms ease;
}

.management-action-menu-trigger[aria-expanded="true"] .management-action-menu-chevron {
  transform: rotate(180deg);
}

.management-action-menu-list {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  z-index: 1000;
  display: grid;
  min-width: 144px;
  max-height: min(320px, calc(100vh - 16px));
  overflow-y: auto;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.management-action-menu-list[hidden] {
  display: none;
}

.management-action-menu-item {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

#page-routes .panel-table {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

#page-routes .table-wrap {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}

#page-routes .routes-table {
  min-width: 1120px;
  table-layout: fixed;
}

#page-routes .routes-table th,
#page-routes .routes-table td {
  padding: 9px 12px;
}

#page-routes .routes-table th {
  white-space: nowrap;
}

#page-routes .routes-table td {
  white-space: normal;
}

#page-routes .routes-table th:nth-child(1) {
  width: 14%;
}

#page-routes .routes-table th:nth-child(2) {
  width: 9%;
}

#page-routes .routes-table th:nth-child(3) {
  width: 9%;
}

#page-routes .routes-table th:nth-child(4) {
  width: 7%;
}

#page-routes .routes-table th:nth-child(5) {
  width: 11%;
}

#page-routes .routes-table th:nth-child(6) {
  width: 12%;
}

#page-routes .routes-table th:nth-child(7) {
  width: 7%;
}

#page-routes .routes-table th:nth-child(8) {
  width: 7%;
}

#page-routes .routes-table th:nth-child(9) {
  width: 7%;
}

#page-routes .routes-table th:nth-child(10) {
  width: 17%;
}

#page-routes .routes-table .table-primary {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#page-routes .routes-table .table-primary strong,
#page-routes .routes-cell-text {
  display: -webkit-box;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#page-routes .routes-table .table-primary {
  gap: 0;
}

#page-routes .routes-table .cell-tags {
  min-width: 0;
  max-width: 100%;
  max-height: 50px;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  overflow: hidden;
}

#page-routes .routes-table .tag-chip {
  flex: 0 1 auto;
  max-width: 112px;
  min-height: 22px;
  padding-inline: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.69rem;
}

#page-routes .routes-table td:nth-child(9) .routes-cell-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#page-routes .routes-table .status-pill {
  min-height: 24px;
  padding-inline: 8px;
  font-size: 0.71rem;
}

#page-routes .routes-table-actions {
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 4px;
  min-width: max-content;
}

#page-routes .routes-table-actions .table-btn {
  min-width: 48px;
  min-height: 28px;
  padding-inline: 7px;
  font-size: 0.73rem;
}

.client-filter-panel {
  padding-block: 12px;
}

.client-filter-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.client-filter-toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.client-filter-toolbar-group:first-child {
  flex: 0 0 auto;
}

.client-filter-toolbar-search-group {
  flex: 1 1 auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.client-filter-toolbar .select-input {
  min-width: 160px;
  flex: 0 0 178px;
}

.client-search-input {
  min-width: 260px;
  width: 100%;
  flex: 1 1 auto;
}

.client-filter-toolbar .btn {
  min-height: var(--control-height);
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .client-filter-toolbar {
    flex-wrap: wrap;
  }

  .client-filter-toolbar-group:first-child {
    flex: 1 1 auto;
  }
}

@media (max-width: 980px) {
  .client-search-input {
    min-width: 180px;
  }
}

@media (max-width: 760px) {
  .client-filter-toolbar-group {
    flex-direction: column;
    align-items: stretch;
  }

  .client-filter-toolbar .select-input,
  .client-filter-toolbar .btn {
    min-width: 0;
    width: 100%;
  }
}

.clients-page-summary {
  margin-bottom: 12px;
}

.clients-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.client-list-item {
  gap: 12px;
  padding: 14px;
}

.client-list-item-head {
  align-items: center;
}

.client-list-item-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.client-list-item-copy strong {
  font-size: 1rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.client-list-item-copy small,
.client-list-item-actions .inline-note {
  color: var(--text-muted);
}

.client-list-item-status {
  justify-content: flex-end;
}

.client-list-item-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.client-list-item-meta-cell {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.client-list-item-meta-cell span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.client-list-item-meta-cell strong {
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.client-list-item-summary {
  margin: 0;
  color: var(--text-subtle);
  line-height: 1.55;
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.client-list-item-tags-wrap {
  display: grid;
  gap: 8px;
  align-content: start;
}

.client-list-item-tags-title,
.client-list-item-tags-empty {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.client-list-item-tags .cell-tags {
  gap: 6px;
}

.client-list-item-actions {
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  margin-top: 2px;
  align-items: center;
}

@media (max-width: 980px) {
  .client-list-item-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .client-list-item-meta-grid {
    grid-template-columns: 1fr;
  }
}

.client-detail-modal-card {
  width: min(1120px, 100%);
  max-height: calc(100vh - 16px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  overflow: hidden;
}

.client-detail-modal-head {
  padding-bottom: 0;
}

.client-detail-modal-body {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  align-content: start;
  gap: 8px;
}

#client-detail-modal {
  align-items: start;
  overflow-y: auto;
}

.client-detail-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.client-detail-section .panel-head {
  align-items: center;
  gap: 8px;
}

.client-detail-section .panel-head h2 {
  margin: 0;
  font-size: 0.96rem;
}

.client-detail-section .detail-row {
  min-height: 0;
  padding: 7px 8px;
  gap: 3px;
}

.client-detail-section .detail-row p,
.client-detail-section .detail-row small {
  margin: 0;
  line-height: 1.4;
}

.client-detail-section .detail-row small {
  color: var(--text-muted);
}

.client-detail-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.client-detail-two-column-dense {
  gap: 8px;
}

.client-detail-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.client-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.client-overview-grid-primary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.client-overview-grid-usage {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.client-overview-stat {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.client-overview-stat span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.client-overview-stat strong {
  min-width: 0;
  font-size: 0.84rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.client-overview-stat-value {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  flex-wrap: wrap;
}

.client-detail-section .cell-tags {
  gap: 4px;
}

.client-detail-section .tag-chip,
.client-detail-section .status-pill {
  min-height: 24px;
  padding: 0 8px;
  font-size: 0.7rem;
}

.client-log-list {
  display: grid;
  gap: 8px;
}

.client-log-item {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.client-log-item p,
.client-log-item small {
  margin: 0;
}

.client-log-item p {
  font-size: 0.78rem;
  line-height: 1.42;
}

.client-log-item small {
  color: var(--text-muted);
  line-height: 1.35;
}

.client-log-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.client-log-content > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.client-log-content > div > span {
  font-size: 0.76rem;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}

.client-log-code {
  min-height: 72px;
  max-height: 144px;
  margin: 0;
}

.client-detail-code {
  max-height: 160px;
}

.compact-disclosure {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
  overflow: hidden;
}

.compact-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: var(--weight-medium);
  color: var(--text-main);
  list-style: none;
}

.compact-disclosure summary::-webkit-details-marker {
  display: none;
}

.compact-disclosure summary::after {
  content: "+";
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
}

.compact-disclosure[open] summary::after {
  content: "-";
}

.compact-disclosure-body {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.client-detail-disclosure .detail-row {
  box-shadow: none;
}

.client-detail-disclosure .code-block {
  max-height: 160px;
}

.request-filter-panel {
  padding-block: 8px;
}

.request-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
}

.request-filter-filters {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  max-width: 900px;
}

@media (max-width: 980px) {
  .request-filter-filters {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    max-width: none;
  }
}

@media (max-width: 760px) {
  .request-filter-toolbar {
    grid-template-columns: 1fr;
  }

  .request-filter-filters {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

.requests-overview {
  display: grid;
  gap: 10px;
}

.requests-inline-alert {
  padding: 10px 12px;
  border: 1px solid #f5c2c7;
  border-radius: var(--radius-md);
  background: #fff7f7;
  color: #991b1b;
  font-size: 0.78rem;
  line-height: 1.45;
}

.requests-inline-alert.is-warning {
  border-color: var(--warning-line);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.requests-overview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.requests-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.requests-stat-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-surface-soft) 100%);
}

.requests-stat-card span,
.requests-chart-head p,
.requests-status-label,
.requests-trend-labels text,
.requests-trend-guides text {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.requests-stat-card strong {
  min-width: 0;
  font-size: 0.94rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.requests-stat-card small {
  color: var(--text-muted);
  line-height: 1.4;
}

.requests-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.9fr);
  gap: 10px;
}

.requests-chart-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.requests-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.requests-chart-head > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.requests-chart-head h3 {
  font-size: 0.86rem;
  font-weight: var(--weight-strong);
}

.requests-chart-body {
  min-width: 0;
}

.requests-chart-footnote {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.requests-trend-svg {
  width: 100%;
  height: auto;
  min-height: 168px;
}

.requests-trend-point {
  cursor: pointer;
}

.requests-trend-guides line {
  stroke: var(--line);
  stroke-width: 1;
}

.requests-trend-guides text {
  fill: var(--text-muted);
}

.requests-trend-line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.requests-trend-area {
  fill: rgba(37, 99, 235, 0.12);
}

.requests-trend-points circle {
  fill: #ffffff;
  stroke: #2563eb;
  stroke-width: 1.8;
}

.requests-trend-point.is-active circle {
  fill: rgba(37, 99, 235, 0.16);
  stroke-width: 2.4;
}

.requests-trend-svg.is-tokens .requests-trend-line {
  stroke: #7c3aed;
}

.requests-trend-svg.is-tokens .requests-trend-area {
  fill: rgba(124, 58, 237, 0.12);
}

.requests-trend-svg.is-tokens .requests-trend-points circle {
  stroke: #7c3aed;
}

.requests-trend-svg.is-latency .requests-trend-line {
  stroke: #0f766e;
}

.requests-trend-svg.is-latency .requests-trend-area {
  fill: rgba(15, 118, 110, 0.12);
}

.requests-trend-svg.is-latency .requests-trend-points circle {
  stroke: #0f766e;
}

.requests-trend-labels text {
  fill: var(--text-muted);
}

.requests-chart-empty {
  display: grid;
  place-items: center;
  min-height: 168px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-align: center;
  background: #ffffff;
}

.requests-status-list {
  display: grid;
  gap: 8px;
}

.requests-status-row {
  display: grid;
  gap: 6px;
}

.requests-status-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.requests-status-row-head strong {
  font-size: 0.78rem;
  color: var(--text-main);
}

.requests-status-pill-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.requests-status-track {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.requests-status-fill {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: #94a3b8;
}

.requests-status-fill.is-completed {
  background: #16a34a;
}

.requests-status-fill.is-failed {
  background: #dc2626;
}

.requests-status-fill.is-queued {
  background: #f59e0b;
}

.requests-status-fill.is-dispatched {
  background: #6366f1;
}

.requests-status-fill.is-acked {
  background: #0ea5e9;
}

.requests-filter-card {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-surface-soft) 100%);
}

.requests-filter-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.requests-filter-card p,
.requests-filter-card small {
  margin: 0;
}

.requests-bucket-clear-btn {
  flex: 0 0 auto;
}

.requests-table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}

.request-details-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.requests-log-table {
  width: max-content;
  min-width: 1180px;
}

.requests-log-table th,
.requests-log-table td {
  white-space: nowrap;
}

.requests-log-table td {
  vertical-align: top;
}

.requests-log-table td:nth-child(1),
.requests-log-table td:nth-child(8),
.requests-log-table td:nth-child(9),
.requests-log-table td:nth-child(10) {
  white-space: nowrap;
}

.requests-status-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-items: start;
  flex-wrap: nowrap;
}

.requests-log-table .table-primary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: nowrap;
}

.requests-log-table .table-primary .table-muted {
  white-space: nowrap;
}

.request-detail-stack {
  gap: 12px;
}

.request-detail-hero {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.request-detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.request-detail-title-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.request-detail-title-copy strong {
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}

.request-detail-title-copy small {
  color: var(--text-muted);
  line-height: 1.45;
}

.request-detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.request-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.request-summary-stat {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface-soft);
}

.request-summary-stat span,
.request-detail-field span,
.request-body-panel > span {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.request-summary-stat strong,
.request-detail-field strong {
  min-width: 0;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

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

.request-detail-field,
.request-body-panel {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.request-detail-field {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.request-detail-field p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.request-detail-field-wide {
  min-width: 0;
}

.request-detail-field-wide p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.request-attempts-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-surface-soft);
}

.request-attempt-list {
  display: grid;
  gap: 8px;
}

.request-attempt-item {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.request-attempt-head,
.request-attempt-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.request-attempt-meta {
  justify-content: flex-start;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.request-attempt-failure {
  margin: 0;
  color: var(--text-danger, #b42318);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.request-body-code {
  min-height: 120px;
  max-height: 280px;
  margin: 0;
}

.request-detail-json {
  margin: 0;
}

.request-trace-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-surface-soft);
}

.request-trace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.request-trace-head > div {
  min-width: 0;
}

.request-trace-head h3 {
  font-size: 0.92rem;
}

.request-trace-head p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.request-trace-meta-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.request-trace-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 900px) {
  .request-summary-grid,
  .request-trace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .request-detail-grid,
  .request-body-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .request-summary-grid,
  .request-trace-grid {
    grid-template-columns: 1fr;
  }
}

.instance-executions-overview {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.instance-executions-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.instance-executions-summary-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.instance-executions-summary-item {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.instance-executions-summary-item strong {
  color: var(--text-main);
  font-size: 0.9rem;
}

.instance-executions-table {
  width: max-content;
  min-width: 1120px;
}

.instance-executions-table th,
.instance-executions-table td {
  white-space: nowrap;
}

.instance-executions-table td {
  vertical-align: top;
}

.instance-executions-table th:nth-child(1) {
  width: 170px;
}

.instance-executions-table th:nth-child(2) {
  width: 260px;
}

.instance-executions-table th:nth-child(3) {
  width: 180px;
}

.instance-executions-table th:nth-child(4) {
  width: 170px;
}

.instance-executions-table th:nth-child(5) {
  width: 210px;
}

.instance-executions-table th:nth-child(6) {
  width: 100px;
}

.instance-executions-table th:nth-child(7) {
  width: 90px;
}

.instance-executions-table th:nth-child(8) {
  width: 72px;
}

.instance-executions-id-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.instance-executions-id-cell strong {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .instance-executions-summary-row {
    align-items: flex-start;
    flex-direction: column;
  }
}



@media (max-width: 1180px) {
  body {
    overflow: auto;
    min-height: auto;
    height: auto;
  }

  .mono-shell {
    grid-template-columns: 1fr;
  }

  .mono-rail {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mono-nav {
    overflow: visible;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .mono-nav-group-bottom {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .mono-stage {
    height: auto;
    min-height: calc(var(--app-height) - 1px);
  }

  .page-grid,
  .page-column,
  .page-main {
    grid-template-columns: 1fr;
  }

  .settings-runtime-grid,
  .settings-openlist-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .docs-card-grid {
    grid-template-columns: 1fr;
  }

  .guide-target-list {
    grid-template-columns: 1fr;
  }

  .engineering-doc-layout {
    grid-template-columns: 1fr;
  }

  .engineering-doc-sidebar {
    position: static;
    display: flex;
    gap: 6px;
    overflow-x: auto;
  }

  .engineering-nav-link {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .engineering-point-grid,
  .engineering-compare {
    grid-template-columns: 1fr;
  }

  .guide-step-item {
    flex-basis: 132px;
    min-width: 132px;
  }

  .client-detail-two-column,
  .client-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .requests-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .requests-chart-grid {
    grid-template-columns: 1fr;
  }

  .request-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .select-input {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 980px) {
  .chat-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(200px, 28vh) minmax(0, 1fr);
  }

  .chat-header-toolbar {
    flex-wrap: wrap;
  }

  .chat-conversation-toolbar {
    flex: 1 1 360px;
  }

  .chat-header-toolbar .chat-header-actions {
    flex: 1 1 360px;
    justify-content: flex-start;
  }

  .chat-sidebar {
    position: static;
  }

  .chat-sidebar-panel,
  .chat-panel {
    height: 100%;
    max-height: none;
  }

  .chat-sidebar-panel {
    min-height: 0;
  }

  .chat-conversation-list {
    max-height: none;
  }

  .chat-panel {
    min-height: 0;
  }

  .image-task-card {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .image-task-card-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .mono-header,
  .panel-head,
  .chat-header,
  .composer-actions,
  .panel-actions-inline,
  .toolbar-actions,
  .modal-actions,
  .detail-actions,
  .table-actions,
  .list-item-head,
  .message-card header {
    flex-direction: column;
    align-items: flex-start;
  }

  .composer-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }

  .chat-header-actions {
    width: 100%;
  }

  .chat-header-toolbar .chat-header-actions {
    justify-content: flex-start;
  }

  .chat-header-toolbar {
    flex-wrap: wrap;
  }

  .chat-conversation-toolbar {
    flex: 1 1 360px;
  }

  .chat-header-toolbar .chat-header-actions {
    flex: 1 1 360px;
  }

  .chat-sidebar-panel {
    min-height: 0;
  }

  .chat-conversation-list {
    max-height: none;
  }

  .chat-panel {
    min-height: 0;
  }

  .chat-workspace {
    grid-template-rows: minmax(160px, 24vh) minmax(0, 1fr);
  }

  .image-reference-options {
    grid-template-columns: 1fr;
  }

  .image-reference-option .select-input {
    width: 100%;
  }

  .image-submit-summary span {
    white-space: normal;
  }

  .guide-flow {
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
  }

  .docs-flow {
    overflow-x: auto;
  }

  .docs-step-dot {
    flex: 0 0 120px;
  }

  .docs-step-table th {
    width: 96px;
    padding-right: 10px;
  }

  .guide-step-item {
    width: 100%;
    min-width: 0;
    justify-items: stretch;
  }

  .guide-step {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    text-align: left;
    gap: 12px;
  }

  .guide-step-label {
    max-width: none;
  }

  .guide-field-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .guide-field-row .detail-copy-btn {
    justify-self: start;
  }

  .guide-flow-chart {
    flex-direction: column;
    overflow: visible;
  }

  .engineering-flow {
    flex-direction: column;
    overflow: visible;
  }

  .engineering-diagram,
  .engineering-sequence,
  .engineering-auth-diagram,
  .engineering-debug-flow,
  .engineering-bridge-diagram,
  .engineering-code-flow {
    flex-direction: column;
    overflow: visible;
  }

  .engineering-hub-diagram {
    grid-template-columns: 1fr;
  }

  .guide-flow-node {
    flex-basis: auto;
    min-width: 0;
  }

  .engineering-node {
    flex-basis: auto;
    min-width: 0;
  }

  .engineering-lane,
  .engineering-sequence article,
  .engineering-auth-diagram article,
  .engineering-debug-flow article,
  .engineering-bridge-diagram article,
  .engineering-code-flow article {
    flex-basis: auto;
    min-width: 0;
  }

  .engineering-code-map,
  .engineering-detail-grid {
    grid-template-columns: 1fr;
  }

  .guide-flow-arrow {
    align-self: flex-start;
    padding-left: 14px;
    transform: rotate(90deg);
  }

  .engineering-arrow {
    align-self: flex-start;
    padding-left: 14px;
    transform: rotate(90deg);
  }

  .engineering-diagram b,
  .engineering-sequence b,
  .engineering-auth-diagram b,
  .engineering-debug-flow b,
  .engineering-bridge-diagram b,
  .engineering-code-flow b {
    align-self: flex-start;
    padding-left: 14px;
    transform: rotate(90deg);
  }

  .guide-step-connector {
    width: 2px;
    min-width: 2px;
    min-height: 18px;
    height: 22px;
    margin: 0 0 0 19px;
  }

  .composer-submit {
    width: auto;
  }

  .composer-submit .btn {
    width: auto;
  }

  .composer-attachments .attachment-card {
    flex-basis: 180px;
  }

  .composer-attachments .attachment-remove,
  .composer-attachments .attachment-link {
    grid-column: auto;
  }

  .client-list-item-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-policy-grid,
  .app-policy-limits,
  .client-detail-info-grid,
  .client-detail-two-column,
  .client-overview-grid,
  .settings-runtime-grid,
  .settings-openlist-grid,
  .settings-preferences-grid,
  .requests-stat-grid,
  .client-log-content,
  .request-summary-grid,
  .request-detail-grid,
  .request-body-grid {
    grid-template-columns: 1fr;
  }

  .request-detail-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .requests-chart-head,
  .requests-status-row-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .attachment-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .attachment-remove,
  .attachment-link {
    grid-column: 1 / -1;
  }

  .mono-main {
    padding: 6px;
  }

  .global-error {
    margin: 6px 6px 0;
  }

  .mono-header {
    margin: 6px 6px 0;
    padding: 6px;
  }

  .mono-header-meta {
    width: 100%;
    justify-content: flex-start;
  }

  .mono-header.is-settings-header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "tabs"
      "meta";
    padding: 8px 12px 0;
  }

  .mono-header.is-log-tabs-header {
    padding: 0;
  }

  .mono-nav {
    grid-template-columns: 1fr;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .field-span-3 {
    grid-column: auto;
  }

  .input-with-action {
    align-items: stretch;
  }

  .input-with-action .text-input {
    min-width: 0;
  }

  .message-card {
    max-width: 92%;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-card {
    width: 100%;
    padding: 14px;
  }

  .app-modal-card {
    max-height: calc(100vh - 24px);
    padding: 12px;
  }

  .app-modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-card.app-bindings-modal-card .app-bindings-detail-grid {
    grid-template-columns: 1fr;
  }

  .modal-card.app-bindings-modal-card {
    height: calc(var(--app-height) - 24px);
  }

  .browser-instance-pool-diagnostics-card {
    min-height: calc(var(--app-height) - 24px);
    max-height: calc(var(--app-height) - 24px);
  }

  .browser-instance-pool-card {
    min-height: calc(var(--app-height) - 24px);
    max-height: calc(var(--app-height) - 24px);
  }

  .browser-instance-pool-diagnostics-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .client-detail-modal-card {
    max-height: calc(100vh - 24px);
    padding: 12px;
  }
}

@media (max-width: 760px) {
  .chat-header-main {
    flex-wrap: nowrap;
    align-items: center;
  }

  .browser-instance-pool-diagnostics-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-header-actions {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .chat-header-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .chat-conversation-toolbar {
    width: 100%;
    flex: 0 0 auto;
    flex-wrap: wrap;
  }

  .chat-conversation-toolbar .chat-conversation-search-field {
    flex: 1 1 140px;
    width: auto;
  }

  .chat-conversation-header-actions {
    flex-direction: row;
    align-items: center;
  }

  .chat-header-toolbar .chat-header-actions {
    width: 100%;
    flex: none;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .message-card header {
    flex-direction: row;
    align-items: center;
  }

  .chat-conversation-list > .list-item .list-item-head {
    flex-direction: row;
    align-items: center;
  }

  .chat-workspace {
    grid-template-rows: minmax(72px, 112px) minmax(360px, 1fr);
  }

  .chat-request-mode > span {
    display: none;
  }

  .chat-request-mode-select {
    flex: 0 0 96px;
    width: 96px;
    min-width: 96px;
  }

  .chat-client-picker {
    flex: 0 0 108px;
    width: 108px;
    min-width: 108px;
    max-width: 108px;
  }

  .chat-selected-channel {
    min-width: 96px;
    max-width: 150px;
  }

  .chat-client-select {
    width: 100%;
  }

  .chat-client-menu {
    width: min(360px, calc(100vw - 32px));
  }

  .chat-panels {
    padding: 10px;
  }

}

