.ai-channel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.ai-channel-grid .ai-agent-card > p { min-height: auto; }
.ai-channel-grid .ai-agent-head { display: flex; justify-content: space-between; gap: 12px; }
.ai-channel-grid .ai-agent-head h2 { margin: 6px 0 2px; }
.ai-channel-grid .ai-agent-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 12px 0;
}
.ai-channel-grid .ai-agent-meta span {
  padding: 8px;
  background: #f7f9fc;
  border-radius: 8px;
  color: #667085;
  font-size: 11px;
}
.ai-channel-grid .ai-agent-meta strong { display: block; color: #344054; margin-top: 4px; }
.ai-channel-grid footer { justify-content: flex-start; margin-top: 13px; }
.ai-modal-grid > div > span { display: block; font-weight: 700; color: #344054; margin-bottom: 7px; }
.ai-modal-grid .ai-check-line { gap: 12px; flex-wrap: wrap; }
.ai-modal-grid .mini { display: flex; align-items: center; gap: 5px; }
.ai-modal-grid .mini input { width: auto; }
@media (max-width: 1200px) {
  .ai-channel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .ai-channel-grid { grid-template-columns: 1fr; }
}

/* Keep wide database records inside their own viewport. */
.ai-data-layout { min-width: 0; align-items: stretch; }
.ai-data-layout > * { min-width: 0; }
.ai-data-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.ai-data-panel .ai-panel-head {
  flex: 0 0 auto;
  align-items: center;
}
.ai-data-table {
  position: relative;
  flex: 1 1 auto;
  height: clamp(360px, calc(100vh - 405px), 660px);
  min-height: 360px;
  max-height: 660px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #e7ebf1;
  border-radius: 9px;
  background: #fff;
}
.ai-data-table table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.ai-data-table thead { position: sticky; top: 0; z-index: 4; }
.ai-data-table th {
  min-width: 108px;
  max-width: 210px;
  padding: 11px 12px;
  background: #f7f9fc;
  box-shadow: inset 0 -1px #dfe5ed;
  color: #475467;
  font-size: 12px;
  white-space: nowrap;
}
.ai-data-table td {
  min-width: 108px;
  max-width: 210px;
  padding: 10px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-data-table th:first-child,
.ai-data-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 170px;
  max-width: 210px;
  background: #fff;
  box-shadow: 1px 0 #e7ebf1;
}
.ai-data-table th:first-child { z-index: 5; background: #f7f9fc; }
.ai-data-table tbody tr:hover td { background-color: #f8fbff; }
.ai-data-pager {
  position: static;
  flex: 0 0 auto;
  min-height: 44px;
  margin-top: 10px;
  padding-top: 2px;
  background: #fff;
}
.ai-table-list {
  height: clamp(430px, calc(100vh - 330px), 735px);
  max-height: 735px;
}
@media (max-width: 1050px) {
  .ai-data-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .ai-data-search input { width: 190px; }
}
