/* 与业务后台一致的尺寸与表面规范；网关只拥有自身组件和公开品牌资源。 */
:root {
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
}
.brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}
.brand-copy strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-copy small {
  font-size: 11px;
  line-height: 1.3;
}
.brand-copy {
  flex: 1;
}
header {
  height: 50px;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.sidebar-head {
  height: 50px;
  min-height: 50px;
}
main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px;
}
.header-actions {
  gap: 8px;
}
summary {
  list-style: none;
  cursor: pointer;
}
summary::-webkit-details-marker {
  display: none;
}
.locale-menu,
.account-menu {
  position: relative;
}
summary.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.menu-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 176px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 20px #0002;
  z-index: 45;
}
.menu-popover button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 7px 10px;
  font-weight: 400;
}
.menu-popover button:hover,
.menu-popover button[aria-pressed="true"] {
  background: var(--soft);
}
.locale-check {
  visibility: hidden;
}
[aria-pressed="true"] .locale-check {
  visibility: visible;
}
.avatar-button {
  width: 34px;
  height: 34px;
  padding: 1px;
  border-radius: 50%;
}
#avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--button-ink);
  font-size: 10px;
}
.account-copy {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.account-copy strong,
.account-copy small {
  display: block;
}
.account-copy small {
  color: var(--muted);
  margin-top: 5px;
}
.page-panel {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  min-width: 0;
}
.page-panel > .title-row {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 9px 9px 0 0;
  margin: 0;
  padding: 12px 16px;
}
.workspace-body {
  padding: 16px;
  min-width: 0;
}
.page-actions,
.list-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.page-actions {
  justify-content: flex-end;
  flex-shrink: 1;
  max-width: 100%;
}
.list-toolbar {
  justify-content: space-between;
  margin-bottom: 12px;
}
.list-toolbar input {
  width: 280px;
  max-width: 100%;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.plugin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 10px;
}
.plugin-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 10px 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  min-width: 0;
}
.plugin-card-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  grid-column: 1 / -1;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 0;
}
.plugin-card h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.plugin-card .badges {
  gap: 4px;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.badge {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--soft);
  color: var(--ink);
  font-size: 11px;
  white-space: nowrap;
}
.plugin-card-footer {
  display: contents;
}
.plugin-card-footer button {
  grid-column: 2;
  grid-row: 2 / 4;
  padding: 5px 10px;
  min-height: max(var(--touch-target), 32px);
  font-size: 12px;
}
.plugin-card-footer small {
  grid-column: 1;
  grid-row: 3;
  color: var(--muted);
  font-size: 11px;
  margin-top: -4px;
}
#plugins > .title-row {
  padding: 14px 16px;
}
#plugins .workspace-body {
  padding: 14px 16px 16px;
}
#plugins .list-toolbar {
  margin-bottom: 12px;
}
#plugins .plugin-grid > p {
  grid-column: 1 / -1;
  margin: 12px 0;
}
.workspace-body > .table-wrap {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}
dialog {
  padding: 20px;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 80px #0004;
}
dialog.wide-dialog {
  width: min(780px, calc(100vw - 32px));
}
dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}
dialog .panel {
  border: 0;
  padding: 0;
  margin: 0;
}
dialog h2 {
  padding-right: 40px;
  margin: 0 0 14px;
}
.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
}
dialog form > button:last-of-type {
  display: block;
  margin-left: auto;
  margin-top: 12px;
}
input[type="file"]::file-selector-button {
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 6px 10px;
  margin-right: 10px;
  cursor: pointer;
  font: inherit;
}
button,
summary {
  -webkit-tap-highlight-color: transparent;
}
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
@media (max-width: 1023px) {
  main {
    padding: 16px;
  }
}
@media (max-width: 600px) {
  main {
    padding: 12px;
  }
  .plugin-card-footer button {
    min-height: max(var(--touch-target), 40px);
  }
  .workspace-body {
    padding: 14px;
  }
  .page-panel > .title-row {
    padding: 14px;
  }
  .page-actions {
    justify-content: flex-start;
  }
  .title-row {
    flex-wrap: wrap;
  }
  .title-row h1 {
    font-size: 16px;
  }
  dialog {
    padding: 16px;
  }
  main button,
  dialog button,
  dialog input:not([type="checkbox"]):not([type="radio"]),
  dialog select {
    min-height: max(var(--touch-target), 40px);
  }
  header .icon-button,
  header .avatar-button {
    width: 40px;
    height: 40px;
  }
  header {
    height: 58px;
  }
  .sidebar-head {
    height: 58px;
    min-height: 58px;
  }
  .avatar-button {
    display: grid;
    place-items: center;
  }
}

.console-shell.is-collapsed {
  --sidebar-width: 56px;
}
.sidebar-head {
  padding-inline: 10px;
  gap: 6px;
}
.brand {
  gap: 6px;
}
.brand-copy strong {
  font-size: 14px;
  letter-spacing: -0.25px;
}
.icon-button svg {
  width: 16px;
  height: 16px;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cell-caption {
  display: none;
}
.cell-content {
  min-width: 0;
}
.model-input {
  display: flex;
  gap: 8px;
}
.model-input button {
  flex-shrink: 0;
}
.model-results {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
}
.model-option {
  display: block;
  text-align: left;
  overflow-wrap: anywhere;
}
.model-option strong,
.model-option small {
  display: block;
}
.model-option small {
  color: var(--muted);
  font-weight: 400;
  margin-top: 4px;
}
#models-search {
  flex: 1;
  min-width: 120px;
}
#models-warning {
  color: var(--error);
}
/* 窄屏把同一条记录排列为卡片，保持操作按钮可见；不靠隐藏溢出来掩盖内容。 */
@media (max-width: 600px) {
  .responsive-table,
  .responsive-table tbody {
    display: block;
    width: 100%;
  }
  .responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .responsive-table tbody tr {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
  }
  .responsive-table tbody tr:last-child {
    margin-bottom: 0;
  }
  .responsive-table td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .cell-caption {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
  }
  .responsive-table td button {
    min-height: max(var(--touch-target), 40px);
    margin: 0;
    white-space: normal;
  }
}
.dialog-notice {
  margin: 0;
  padding: 4px 0 4px 10px;
  border: 0;
  border-left: 2px solid var(--error);
  border-radius: 0;
  color: var(--error);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.dialog-notice:empty,
.aggregation-notice:empty,
.legacy-unavailable:empty {
  display: none !important;
}
#channel-options {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
#channel-options summary {
  cursor: pointer;
  font-weight: 600;
}
#channel-options[open] summary {
  margin-bottom: 12px;
}
#credential-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
:root:has(dialog[open]) {
  overflow: hidden;
}
@media (prefers-reduced-motion: no-preference) {
  .console-shell {
    transition: grid-template-columns 180ms ease;
  }
}

:root {
  --control: #ffffff;
  --control-line: #e4e4e7;
  --field-focus-line: #8a8a94;
  --field-focus-ring: rgb(113 113 122 / 12%);
}
:root.dark {
  --control: #181b20;
  --control-line: #30343b;
  --field-focus-line: #8a93a3;
  --field-focus-ring: rgb(161 161 170 / 16%);
}
input,
select,
textarea,
button.secondary,
summary.secondary {
  background: var(--control);
  border-color: var(--control-line);
}
/* 输入控件使用柔和内聚的焦点提示，按钮和链接继续保留独立的键盘焦点轮廓。 */
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  outline-offset: 0;
  border-color: var(--field-focus-line);
  box-shadow: 0 0 0 2px var(--field-focus-ring);
}
