* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f5f7fa;
  color: #303133;
  line-height: 1.5;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  background: #ffffff;
  border-right: 1px solid #e4e7ed;
}

.brand-card,
.panel-card,
.stat-card,
.auth-card,
.hint-card {
  background: #ffffff;
  border: 1px solid #ebeef5;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.brand-card {
  padding: 16px;
  margin-bottom: 12px;
}

.brand-title {
  font-size: 24px;
  font-weight: 700;
  color: #303133;
}

.brand-subtitle {
  margin-top: 6px;
  color: #909399;
  font-size: 13px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 4px;
  color: #606266;
  transition: all 0.2s ease;
  font-size: 14px;
}

.nav-item:hover,
.nav-item.active {
  background: #ecf5ff;
  color: #409eff;
  box-shadow: none;
}

.content {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 24px;
}

.content > * + * {
  margin-top: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: #303133;
}

.page-subtitle {
  margin-top: 6px;
  color: #909399;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #ebeef5;
  border-radius: 8px;
  color: #606266;
}

.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 15px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: all 0.2s ease;
}

.ghost-button {
  color: #606266;
  background: #ffffff;
  border-color: #dcdfe6;
}

.ghost-button:hover {
  color: #409eff;
  border-color: #c6e2ff;
  background: #ecf5ff;
}

.primary-button {
  background: #409eff;
  border-color: #409eff;
  color: #ffffff;
}

.primary-button:hover {
  background: #66b1ff;
  border-color: #66b1ff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 18px 16px;
}

.stat-label {
  color: #909399;
  font-size: 13px;
}

.stat-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 700;
  color: #303133;
}

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

.admin-grid {
  align-items: start;
}

.panel-head-tight {
  margin-bottom: 18px;
}

.panel-subtitle {
  margin-top: 6px;
  color: #909399;
  font-size: 13px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-card {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.table-toolbar .panel-subtitle {
  margin-top: 4px;
}

.multi-select-list {
  min-height: 180px;
  padding: 8px;
}

.language-check-panel {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #dce6f2;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdff 0%, #f6faff 100%);
}

.language-check-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.language-check-summary {
  min-width: 0;
}

.language-check-count {
  color: #6b84a4;
  font-size: 12px;
  font-weight: 600;
}

.language-check-text {
  color: #8ea1b8;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.language-check-toolbar-actions {
  gap: 6px;
}

.language-check-body {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed #dce6f2;
}

.language-check-body[hidden] {
  display: none !important;
}

.language-check-grid-box {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
}

.language-check-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  color: #606266;
  font-size: 13px;
}

.language-check-option input {
  margin: 0;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  color: #303133;
}

.mini-list {
  display: grid;
  gap: 12px;
}

.mini-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 6px;
  background: #fafafa;
  border: 1px solid #ebeef5;
}

.mini-title {
  font-weight: 600;
  color: #303133;
}

.mini-text,
.mini-time {
  color: #909399;
  font-size: 13px;
}

.counter-chip,
.auth-badge,
.alert {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 13px;
}

.counter-chip,
.auth-badge {
  color: #409eff;
  background: #ecf5ff;
  border: 1px solid #d9ecff;
}

.alert.error {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  margin-bottom: 16px;
  color: #f56c6c;
  background: #fef0f0;
  border: 1px solid #fde2e2;
  border-radius: 4px;
}

.alert.success,
.alert.warning,
.alert.info {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
}

.alert.success {
  color: #67c23a;
  background: #f0f9eb;
  border-color: #e1f3d8;
}

.alert.warning {
  color: #e6a23c;
  background: #fdf6ec;
  border-color: #faecd8;
}

.alert.info {
  color: #909399;
  background: #f4f4f5;
  border-color: #e9e9eb;
}

.page-banner {
  width: 100%;
}

.table-shell {
  overflow: auto;
  border: 1px solid #ebeef5;
  border-radius: 8px;
  background: #ffffff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  color: #606266;
}

.data-table th,
.data-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ebeef5;
  vertical-align: middle;
}

.data-table th {
  color: #909399;
  background: #fafafa;
  font-weight: 500;
}

.data-table tbody tr:hover {
  background: #f5f7fa;
}

.user-table th,
.user-table td {
  white-space: nowrap;
}

.table-title {
  font-weight: 600;
  color: #303133;
}

.table-desc {
  margin-top: 4px;
  color: #909399;
  font-size: 12px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-empty {
  padding: 40px 16px;
  text-align: center;
  color: #909399;
}

.small-button {
  min-height: 28px;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 13px;
}

.pager-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.pager-summary {
  color: #909399;
  font-size: 13px;
}

.pager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pager-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 4px;
  color: #606266;
  background: #ffffff;
  border: 1px solid #dcdfe6;
}

.pager-link.active {
  color: #ffffff;
  background: #409eff;
  border-color: #409eff;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: #f5f7fa;
}

.auth-card {
  width: min(100%, 520px);
  padding: 28px;
}

.auth-title {
  margin: 16px 0 8px;
  font-size: 34px;
}

.auth-text {
  margin: 0 0 20px;
  color: #909399;
  line-height: 1.7;
}

.auth-header {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  color: #606266;
  font-size: 14px;
}

.field input,
.field select,
.field textarea {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 4px;
  border: 1px solid #dcdfe6;
  background: #ffffff;
  color: #606266;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #409eff;
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
}

.field textarea {
  min-height: 100px;
  padding: 12px 14px;
  resize: vertical;
}

.field-help {
  color: #909399;
  font-size: 12px;
  line-height: 1.6;
}

.hint-card {
  margin-top: 18px;
  padding: 16px 18px;
  color: #606266;
  line-height: 1.8;
}

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

.hint-item strong {
  color: #303133;
}

.full-span {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 10px 0 2px;
}

.field-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #606266;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid transparent;
}

.status-chip.ok {
  background: #f0f9eb;
  color: #67c23a;
  border-color: #e1f3d8;
}

.status-chip.danger {
  background: #fef0f0;
  color: #f56c6c;
  border-color: #fde2e2;
}

.status-chip.warning {
  background: #fdf6ec;
  color: #e6a23c;
  border-color: #faecd8;
}

.status-chip.info {
  background: #f4f4f5;
  color: #909399;
  border-color: #e9e9eb;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 15px;
  border-radius: 4px;
  border: 1px solid #f56c6c;
  background: #ffffff;
  color: #f56c6c;
  cursor: pointer;
  transition: all 0.2s ease;
}

.danger-button:hover {
  background: #fef0f0;
}

.inline-form {
  margin: 0;
}

.stt-panel-card {
  padding: 16px 18px;
}

.stt-panel-card .table-toolbar {
  margin-bottom: 12px;
}

.stt-meta-compact {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 10px;
}

.stt-meta-card {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid #ebeef5;
  min-width: 0;
}

.stt-meta-label {
  margin-bottom: 4px;
  color: #909399;
  font-size: 12px;
  line-height: 1.3;
}

.stt-meta-value {
  color: #303133;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-all;
}

.stt-filter-grid {
  margin-top: 12px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stt-filter-actions {
  align-self: end;
}

.stt-history-filter-grid {
  margin-top: 12px;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)) minmax(0, 1.4fr);
}

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

.overview-item {
  padding: 16px 18px;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid #ebeef5;
}

.overview-label {
  margin-bottom: 8px;
  color: #909399;
  font-size: 13px;
}

.overview-value {
  color: #303133;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
}

.stt-code-value {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 14px;
  word-break: break-all;
}

.stt-message-value {
  font-size: 14px;
  font-weight: 500;
}

.finance-stats-grid {
  margin-bottom: 18px;
}

.stat-value-small {
  font-size: 24px;
}

.history-title {
  color: #303133;
  font-weight: 600;
  line-height: 1.4;
}

.history-subtitle {
  margin-top: 4px;
  color: #909399;
  font-size: 12px;
  line-height: 1.4;
}

.history-code-cell {
  max-width: 180px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12px;
  word-break: break-all;
}

.history-model-cell {
  min-width: 180px;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 1360px) {
  .stt-meta-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .stt-history-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .stt-meta-compact,
  .stt-filter-grid,
  .stt-history-filter-grid {
    grid-template-columns: 1fr;
  }
}

.modal-mask {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
}

.modal-mask.active {
  display: flex;
}

.modal-card {
  width: min(100%, 920px);
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 0;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #ebeef5;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 20px 12px;
  border-bottom: 1px solid #ebeef5;
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: #303133;
}

.modal-close {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 4px;
  border: 1px solid #dcdfe6;
  background: #ffffff;
  color: #606266;
  cursor: pointer;
}

.modal-close:hover {
  color: #409eff;
  border-color: #c6e2ff;
  background: #ecf5ff;
}

.modal-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px 20px 20px;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid #ebeef5;
  margin-top: 6px;
  padding-top: 16px;
}

body.modal-open {
  overflow: hidden;
}

.message-box {
  width: min(100%, 420px);
}

.message-box-body {
  padding: 20px;
  color: #606266;
  line-height: 1.7;
}

.message-box-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-box-title::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e6a23c;
  box-shadow: 0 0 0 4px rgba(230, 162, 60, 0.12);
}

.message-box-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 20px 20px;
}

.value-positive {
  color: #1f8a5a;
  font-weight: 700;
}

.value-negative {
  color: #c15a52;
  font-weight: 700;
}

.balance-grid {
  display: grid;
  gap: 12px;
}

.inline-link {
  color: #409eff;
  font-size: 14px;
}

.inline-link:hover {
  color: #66b1ff;
}

.settings-stats-grid {
  margin-bottom: 18px;
}

.settings-time-value {
  font-size: 18px;
}

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

.settings-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.settings-guide-item {
  min-height: 56px;
  align-items: flex-start;
  line-height: 1.7;
}

.settings-guide-item strong {
  margin-right: 4px;
}

.settings-section-title {
  padding-top: 6px;
  margin-bottom: -4px;
  color: #303133;
  font-size: 16px;
  font-weight: 600;
}

.settings-route-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.settings-route-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.settings-route-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.7fr) minmax(120px, 1fr) minmax(180px, 1.4fr) minmax(90px, 0.7fr);
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.settings-route-row label {
  display: grid;
  gap: 5px;
}

.settings-route-row label span {
  font-size: 12px;
  color: var(--muted);
}

.settings-route-row .route-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  color: var(--text);
  font-weight: 700;
}

.settings-route-row .route-check input {
  width: auto;
}

.route-delete-button {
  align-self: end;
  min-height: 34px;
}

.azure-route-row {
  grid-template-columns: minmax(90px, 0.7fr) minmax(120px, 1fr) minmax(180px, 1.4fr) minmax(120px, 1fr) minmax(220px, 1.8fr);
}

.engine-node-table td {
  vertical-align: top;
}

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

.engine-node-form .settings-section-title {
  margin-top: 4px;
}

.engine-node-form [hidden] {
  display: none !important;
}

.settings-check-row {
  padding-top: 4px;
}

.settings-submit-bar {
  margin-top: 12px;
}

@media (max-width: 1180px) {
  html,
  body {
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid #dae6f3;
  }

  .content {
    height: auto;
    overflow: visible;
  }

  .stats-grid,
  .panel-grid,
  .detail-grid,
  .stt-filter-grid {
    grid-template-columns: 1fr;
  }

  .modal-form-grid {
    grid-template-columns: 1fr;
  }

  .settings-form-grid {
    grid-template-columns: 1fr;
  }

  .settings-guide-grid {
    grid-template-columns: 1fr;
  }

  .pager-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}
