/* 本地字体 */
@font-face {
  font-family: "Comfortaa";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/comfortaa-500.ttf") format("truetype");
}
@font-face {
  font-family: "Comfortaa";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/comfortaa-700.ttf") format("truetype");
}

:root {
  --bg0: #eef8f4;
  --bg1: #e6f3fa;
  --line: rgba(45, 140, 120, 0.14);
  --text: #1c322e;
  --muted: #6b857e;
  --accent: #2f9d8a;
  --accent-soft: rgba(47, 157, 138, 0.12);
  --danger: #d45d6a;
  --radius: 14px;
  --shadow: 0 10px 28px rgba(45, 100, 90, 0.08);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body, #app {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(900px 480px at 8% 0%, rgba(126, 201, 180, 0.35), transparent 55%),
    radial-gradient(800px 420px at 100% 10%, rgba(150, 205, 230, 0.32), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 55%, #f7fcfa);
}
#app { background: transparent; }
[v-cloak] { display: none !important; }

/* ---- login ---- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: 24px;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(700px 360px at 15% 20%, rgba(94, 189, 168, 0.28), transparent 60%),
    radial-gradient(640px 320px at 85% 75%, rgba(130, 190, 220, 0.26), transparent 55%),
    linear-gradient(160deg, #eaf7f2, #e8f4fa 50%, #f5fbf8);
}
.glass {
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
  border-radius: 18px;
}
.login-card {
  position: relative;
  width: min(420px, 92vw);
  padding: 28px 28px 22px;
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.brand h1 {
  margin: 0;
  font-family: Comfortaa, "PingFang SC", sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: #1a3d36;
}
.brand p { margin: 6px 0 0; color: var(--muted); font-size: .86rem; }
.logo-mark {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #5ec4b0, #6eb8d0);
  color: #fff; font-weight: 700; font-family: Comfortaa, sans-serif;
  box-shadow: 0 8px 20px rgba(47, 157, 138, 0.28);
}
.logo-mark.sm { width: 36px; height: 36px; font-size: .85rem; border-radius: 10px; }
.captcha-row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; align-items: center; width: 100%; }
.captcha-img {
  height: 32px; width: 120px; border-radius: 4px; cursor: pointer;
  border: 1px solid #dcdfe6; background: #fff; object-fit: cover;
}
.login-extra { margin: 2px 0 8px; }
.login-btn { width: 100%; margin-top: 4px; }
.msg { min-height: 1.2em; color: var(--danger); font-size: .86rem; margin: 8px 0 0; }

/* ---- layout：左侧固定，右侧独立滚动 ---- */
.layout {
  height: 100vh !important;
  max-height: 100vh;
  overflow: hidden !important;
}
.layout > .el-container {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sider {
  background: rgba(255, 255, 255, 0.86) !important;
  border-right: 1px solid var(--line);
  padding: 12px 8px 16px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  height: 100vh !important;
  overflow: hidden;
  flex-shrink: 0;
}
.sider-brand {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 10px 12px; margin-bottom: 4px;
}
.sider-brand strong {
  display: block;
  font-family: Comfortaa, "PingFang SC", sans-serif;
  font-size: 1rem;
  color: #1a3d36;
}
.sider-brand small { color: var(--muted); font-size: 12px; }

/* 统一菜单高度：Element 默认偏高且易不一致 */
.side-menu {
  border-right: none !important;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: transparent !important;
}
.side-menu.el-menu {
  border-right: none !important;
  background: transparent !important;
}
.side-menu .el-menu-item {
  height: 40px !important;
  line-height: 40px !important;
  margin: 2px 6px !important;
  padding: 0 14px !important;
  border-radius: 10px !important;
  font-size: 13px !important;
}
.side-menu .el-menu-item:hover {
  background: rgba(47, 157, 138, 0.08) !important;
}
.side-menu .el-menu-item.is-active {
  background: var(--accent-soft) !important;
  color: #176b5c !important;
  font-weight: 600;
}
.logout-btn { margin: 10px 8px 0; width: calc(100% - 16px); }

.topbar {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.78) !important;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  padding: 0 20px !important;
}
.topbar h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1a3d36;
}
.top-right { display: flex; gap: 8px; align-items: center; }
.tenant-config-header { margin-bottom: 8px; }
.tenant-config-name { margin-left: 8px; font-weight: 600; color: #334155; }
.ml8 { margin-left: 8px; }
.page {
  padding: 18px 20px 32px !important;
  background: transparent !important;
  flex: 1 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  box-sizing: border-box;
}
.pager-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.cache-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.4;
  font-size: 12px;
}

.stat-card { margin-bottom: 0; }
.stat-label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.stat-num {
  font-size: 26px;
  font-family: Comfortaa, sans-serif;
  font-weight: 700;
  color: var(--accent);
}

/* 总览授权条 */
.lic-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}
.lic-banner.is-ok {
  border-color: rgba(47, 157, 138, 0.35);
  background:
    linear-gradient(120deg, rgba(47, 157, 138, 0.12), rgba(255, 255, 255, 0.92) 45%);
}
.lic-banner.is-warn {
  border-color: rgba(212, 93, 106, 0.35);
  background:
    linear-gradient(120deg, rgba(212, 93, 106, 0.10), rgba(255, 255, 255, 0.92) 45%);
}
.lic-banner-main { flex: 1; min-width: 0; }
.lic-banner-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 700;
  color: #1a3d36;
}
.lic-banner-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.lic-item {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(45, 140, 120, 0.10);
}
.lic-k {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.lic-v {
  font-size: 18px;
  font-weight: 700;
  color: #1a3d36;
  word-break: break-all;
  line-height: 1.35;
}
@media (max-width: 960px) {
  .lic-banner { flex-direction: column; align-items: stretch; }
  .lic-banner-grid { grid-template-columns: 1fr; }
}
.hint { margin: 0; color: var(--muted); line-height: 1.7; font-size: 14px; }
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar .search-input {
  width: 320px;
  max-width: 100%;
}
.toolbar .lang-select {
  width: 200px;
  max-width: 100%;
}
.toolbar-spacer { flex: 1; min-width: 8px; }
/* 搜索区控件略放大，查询按钮更醒目 */
.toolbar .el-input,
.toolbar .el-select {
  --el-component-size: 36px;
}
.toolbar .el-input__wrapper {
  min-height: 36px;
  font-size: 14px;
}
.toolbar .el-select .el-select__wrapper {
  min-height: 36px;
  font-size: 14px;
}
.toolbar .el-button {
  min-height: 36px;
  padding: 8px 18px;
  font-size: 14px;
}
.toolbar .el-button--primary.is-query,
.toolbar .btn-query {
  min-width: 88px;
  font-weight: 600;
}
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mb14 { margin-bottom: 14px; }

/* 表格操作按钮：始终可见、对比清晰（避免 link 按钮在自定义主题下“看不见字”） */
.op-btns {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.op-btns .el-button {
  margin: 0 !important;
  height: 28px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  line-height: 26px !important;
}
.op-btns .el-button--primary {
  color: #fff !important;
  background-color: #2f9d8a !important;
  border-color: #2f9d8a !important;
}
.op-btns .el-button--primary:hover,
.op-btns .el-button--primary:focus {
  color: #fff !important;
  background-color: #278f7d !important;
  border-color: #278f7d !important;
}
.op-btns .el-button--danger {
  color: #fff !important;
  background-color: #d45d6a !important;
  border-color: #d45d6a !important;
}
.op-btns .el-button--danger:hover,
.op-btns .el-button--danger:focus {
  color: #fff !important;
  background-color: #c04b58 !important;
  border-color: #c04b58 !important;
}
.op-btns .el-button--info {
  color: #1a3d36 !important;
  background-color: #e8f4f1 !important;
  border-color: #b7d9d0 !important;
}
.op-btns .el-button--info:hover,
.op-btns .el-button--info:focus {
  color: #176b5c !important;
  background-color: #d7efe8 !important;
  border-color: #2f9d8a !important;
}
.op-btns .el-button.is-plain {
  --el-button-bg-color: #fff;
}
.cfg-switch-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}
.cfg-op-hint {
  color: var(--muted);
  font-size: 12px;
}
.pre {
  white-space: pre-wrap;
  color: var(--muted);
  background: #f5faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  margin: 0 0 12px;
}

/* Element 主题微调：小清新 */
.el-button--primary {
  background-color: #2f9d8a !important;
  border-color: #2f9d8a !important;
}
.el-button--primary:hover,
.el-button--primary:focus {
  background-color: #278f7d !important;
  border-color: #278f7d !important;
}
.el-input__inner:focus,
.el-textarea__inner:focus {
  border-color: #2f9d8a !important;
}
.el-select .el-input.is-focus .el-input__inner {
  border-color: #2f9d8a !important;
}
.el-switch.is-checked .el-switch__core {
  border-color: #2f9d8a !important;
  background-color: #2f9d8a !important;
}
.el-checkbox__input.is-checked .el-checkbox__inner,
.el-radio__input.is-checked .el-radio__inner {
  border-color: #2f9d8a !important;
  background: #2f9d8a !important;
}
.el-card {
  border-radius: 12px !important;
  border-color: var(--line) !important;
}
.el-table {
  border-radius: 10px;
}
/*
 * 列宽交给 Element Plus（width/min-width + 拖拽调整）。
 * 禁止再用 col:nth-child + !important 锁死百分比，否则：
 * 1) 列宽与内容不符  2) 表头拖拽改宽无效
 */
.el-table.ait-table {
  width: 100%;
}
.el-table.ait-table .el-table__body-wrapper {
  overflow-x: auto;
}
.el-table .col-index,
.el-table .col-index .cell {
  text-align: center !important;
  vertical-align: middle !important;
}
.el-table.ait-table .cell {
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* 拖拽分隔线更易点中 */
.el-table.ait-table .el-table__column-resize-proxy {
  background-color: var(--brand, #2f9d8a);
}
.el-table.ait-table th.el-table__cell {
  user-select: none;
}
.el-dialog { border-radius: 12px; }
.el-dialog.engine-dlg {
  --engine-dlg-width: 1280px;
  width: var(--engine-dlg-width) !important;
  max-width: calc(100vw - 24px);
  margin-top: 2vh !important;
}
.el-dialog.engine-dlg .el-dialog__header {
  padding: 14px 18px 10px;
  margin-right: 0;
}
.el-dialog.engine-dlg .el-dialog__body {
  max-height: calc(96vh - 150px);
  min-height: 62vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: 8px;
}
.el-dialog.engine-dlg.is-maximized,
.el-dialog.engine-dlg.is-fullscreen {
  width: 100% !important;
  max-width: 100vw;
  margin: 0 !important;
  border-radius: 0;
}
.el-dialog.engine-dlg.is-maximized .el-dialog__body,
.el-dialog.engine-dlg.is-fullscreen .el-dialog__body {
  max-height: calc(100vh - 120px);
  min-height: calc(100vh - 120px);
}
.engine-dlg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding-right: 0;
}
.engine-dlg-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.engine-dlg-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.engine-dlg-hdr-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.engine-dlg-hdr-btn:hover {
  background: rgba(47, 157, 138, 0.12);
  color: var(--accent);
}
.engine-dlg-hdr-btn.is-close:hover {
  background: rgba(212, 93, 106, 0.12);
  color: var(--danger);
}
.engine-dlg-ico {
  display: block;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  position: relative;
}
.engine-dlg-ico-max {
  border: 1.5px solid currentColor;
  border-radius: 1px;
}
.engine-dlg-ico-restore {
  border: 1.5px solid currentColor;
  border-radius: 1px;
  width: 10px;
  height: 10px;
  margin-top: 2px;
  margin-left: -2px;
  background: #fff;
  box-shadow: 3px -3px 0 -1px #fff, 3px -3px 0 0 currentColor;
}
.engine-dlg-ico-close::before,
.engine-dlg-ico-close::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
}
.engine-dlg-ico-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.engine-dlg-ico-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.engine-form {
  max-width: 100%;
  overflow-x: hidden;
}
.engine-form .el-row {
  max-width: 100%;
}
.engine-form .el-col {
  min-width: 0;
}
.engine-form .el-form-item {
  margin-bottom: 14px;
  max-width: 100%;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
}
/* 多行：标签贴顶，避免和 textarea 垂直居中错位 */
.engine-form .el-form-item:has(.el-textarea),
.engine-form .el-form-item:has(.engine-prompt-area) {
  align-items: flex-start;
}
.engine-form .el-form-item:has(.el-textarea) .el-form-item__label,
.engine-form .el-form-item:has(.engine-prompt-area) .el-form-item__label {
  padding-top: 4px !important;
  line-height: 22px !important;
  height: auto !important;
}
.engine-form .el-form-item__label {
  white-space: nowrap;
  height: auto !important;
  line-height: 32px !important;
  padding: 0 12px 0 0 !important;
  justify-content: flex-end;
  align-items: center;
  box-sizing: border-box;
}
.engine-form .el-form-item__content {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-height: 32px;
  line-height: 32px;
}
.engine-form .el-input,
.engine-form .el-select,
.engine-form .el-input-number,
.engine-form .el-textarea,
.engine-form .engine-num {
  width: 100%;
  max-width: 100%;
}
.engine-form .el-input-number.engine-num .el-input__wrapper {
  width: 100%;
}
.engine-form .el-textarea .el-textarea__inner {
  line-height: 1.5;
}
.engine-form-hint {
  margin: 0 0 10px;
  padding: 0 4px 0 140px;
  line-height: 1.45;
  box-sizing: border-box;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.engine-form-hint.is-inline {
  padding-left: 4px;
}
@media (max-width: 768px) {
  .engine-form-hint { padding-left: 4px; }
}
.el-form--label-top .el-form-item__label {
  padding: 0 0 4px;
  line-height: 1.2;
  color: var(--muted);
}

/* 开关行：标签与开关垂直居中 */
.engine-form .engine-form-switch.el-form-item {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
}
.engine-form .engine-form-switch .el-form-item__label {
  height: auto !important;
  line-height: 32px !important;
  padding-bottom: 0 !important;
  white-space: nowrap;
}
.engine-form .engine-form-switch .el-form-item__content {
  display: flex;
  align-items: center;
  min-height: 32px;
  line-height: 32px;
}
.engine-form .engine-form-switch.is-placeholder {
  visibility: hidden;
  pointer-events: none;
}
.engine-form .engine-form-actions .el-form-item__content {
  margin-left: 0 !important;
  justify-content: flex-start;
}
.engine-map-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}
.engine-dlg-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
}
.el-dialog.engine-dlg .el-dialog__footer {
  padding: 10px 18px 16px;
}

@media (max-width: 960px) {
  html, body, #app { height: auto; overflow: auto; }
  .layout {
    display: block !important;
    height: auto !important;
    max-height: none;
    overflow: visible !important;
  }
  .sider {
    width: 100% !important;
    height: auto !important;
    overflow: visible;
  }
  .page {
    overflow: visible !important;
    height: auto !important;
  }
}

.ml8 { margin-left: 8px; }


.lbl-with-tip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 32px;
  height: 32px;
}
.tip-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(47, 157, 138, 0.45);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  user-select: none;
  background: rgba(47, 157, 138, 0.08);
  flex-shrink: 0;
}
.tip-q:hover {
  background: rgba(47, 157, 138, 0.18);
}
.tip-pop {
  max-width: 320px;
  line-height: 1.55;
  font-size: 13px;
}
.engine-advanced {
  width: 100%;
  border: none;
}
.engine-advanced .el-collapse-item__header {
  font-size: 13px;
  color: var(--muted);
  height: 36px;
  line-height: 36px;
  border: none;
  background: transparent;
}
.engine-advanced .el-collapse-item__wrap {
  border: none;
}
.engine-advanced .el-collapse-item__content {
  padding-bottom: 4px;
}

.engine-prompt-area textarea {
  min-height: 160px;
  font-family: Consolas, ""Courier New"", monospace;
  line-height: 1.5;
}
