/* ============================================================
   Element 风格基础样式（手写，零依赖）
   ============================================================ */

:root {
  --el-primary: #409eff;
  --el-primary-light: #66b1ff;
  --el-success: #67c23a;
  --el-warning: #e6a23c;
  --el-danger: #f56c6c;
  --el-info: #909399;

  --el-text: #606266;
  --el-text-strong: #303133;
  --el-text-secondary: #909399;

  --el-border: #dcdfe6;
  --el-border-light: #e4e7ed;
  --el-border-lighter: #ebeef5;

  --el-bg: #ffffff;
  --el-bg-page: #f5f7fa;
  --el-bg-hover: #f5f7fa;

  --el-radius: 8px;
  --el-radius-lg: 14px;
  --el-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --el-shadow-lg: 0 12px 32px rgba(31, 34, 51, 0.12);
  --el-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--el-text);
  background: var(--el-bg-page);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--el-primary);
  text-decoration: none;
}

/* ---------------------------------------------------------- 按钮 */
.el-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 20px;
  border: 1px solid var(--el-border);
  border-radius: var(--el-radius);
  background: #fff;
  color: var(--el-text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--el-transition);
}

.el-button:hover {
  color: var(--el-primary);
  border-color: #c6e2ff;
  background: #ecf5ff;
}

.el-button:active {
  transform: translateY(1px);
}

.el-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.el-button--primary {
  background: linear-gradient(135deg, #409eff, #3a8ee6);
  border-color: #409eff;
  color: #fff;
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.26);
}

.el-button--primary:hover {
  background: linear-gradient(135deg, #66b1ff, #409eff);
  border-color: #66b1ff;
  color: #fff;
}

.el-button--success {
  background: linear-gradient(135deg, #67c23a, #5daE32);
  border-color: #67c23a;
  color: #fff;
}

.el-button--success:hover {
  background: linear-gradient(135deg, #85ce61, #67c23a);
  border-color: #85ce61;
  color: #fff;
}

.el-button--danger {
  background: linear-gradient(135deg, #f56c6c, #e05252);
  border-color: #f56c6c;
  color: #fff;
}

.el-button--danger:hover {
  background: linear-gradient(135deg, #f78989, #f56c6c);
  border-color: #f78989;
  color: #fff;
}

.el-button--info {
  background: linear-gradient(135deg, #909399, #7f8286);
  border-color: #909399;
  color: #fff;
}

.el-button--info:hover {
  background: linear-gradient(135deg, #a6a9ad, #909399);
  border-color: #a6a9ad;
  color: #fff;
}

.el-button--small {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 6px;
}

.el-button--text {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--el-text-secondary);
}

.el-button--text:hover {
  background: rgba(144, 147, 153, 0.1);
  color: var(--el-danger);
  border-color: transparent;
}

/* ---------------------------------------------------------- 输入 */
.el-input {
  position: relative;
  display: inline-block;
  width: 100%;
}

.el-input__inner {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--el-border);
  border-radius: var(--el-radius);
  background: #fff;
  color: var(--el-text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--el-transition), box-shadow var(--el-transition);
}

.el-input__inner::placeholder {
  color: #c0c4cc;
}

.el-input__inner:focus {
  border-color: var(--el-primary);
  box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.12);
}

.el-input__inner:disabled,
.el-input__inner[readonly] {
  background: #f5f7fa;
  cursor: not-allowed;
}

.el-input__inner.is-error {
  border-color: var(--el-danger);
}

.el-input__suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--el-text-secondary);
  pointer-events: none;
}

/* 下拉选择 */
.el-select {
  position: relative;
  display: inline-block;
  width: 100%;
}

.el-select .el-input__inner {
  cursor: pointer;
  padding-right: 30px;
}

.el-select__caret {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--el-text-secondary);
  pointer-events: none;
  display: inline-flex;
}

.el-select-dropdown {
  position: absolute;
  z-index: 2200;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px 0;
  border: 1px solid var(--el-border-lighter);
  border-radius: var(--el-radius);
  background: #fff;
  box-shadow: var(--el-shadow-lg);
}

.el-select-dropdown__item {
  padding: 9px 14px;
  font-size: 14px;
  color: var(--el-text);
  cursor: pointer;
  transition: background-color var(--el-transition);
}

.el-select-dropdown__item:hover {
  background: var(--el-bg-hover);
  color: var(--el-primary);
}

.el-select-dropdown__item.selected {
  color: var(--el-primary);
  font-weight: 600;
  background: #ecf5ff;
}

/* ---------------------------------------------------------- 卡片 */
.el-card {
  border: 1px solid var(--el-border-lighter);
  border-radius: var(--el-radius-lg);
  background: #fff;
  box-shadow: var(--el-shadow);
}

.el-card__body {
  padding: 20px;
}

/* ---------------------------------------------------------- 表格 */
.el-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.el-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.el-table th {
  padding: 14px 12px;
  background: #fafbfc;
  color: var(--el-text-strong);
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--el-border-lighter);
}

.el-table td {
  padding: 12px;
  border-bottom: 1px solid var(--el-border-lighter);
  color: var(--el-text);
  vertical-align: middle;
}

.el-table--border th,
.el-table--border td {
  border-right: 1px solid var(--el-border-lighter);
}

.el-table--border th:last-child,
.el-table--border td:last-child {
  border-right: none;
}

.el-table tbody tr:hover td {
  background: #f7fbff;
}

.el-table--striped tbody tr:nth-child(even) td {
  background: #fcfcfd;
}

.el-table--striped tbody tr:nth-child(even):hover td {
  background: #f7fbff;
}

.el-table--small th,
.el-table--small td {
  padding: 9px 10px;
}

.el-table .cell {
  word-break: break-word;
}

.el-table__empty-block {
  padding: 34px 12px;
  text-align: center;
  color: var(--el-text-secondary);
  font-size: 13px;
}

/* ---------------------------------------------------------- 分页 */
.el-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 4px 4px;
  font-size: 13px;
  color: var(--el-text-secondary);
  flex-wrap: wrap;
}

.el-pagination__total {
  margin-right: auto;
}

.el-pagination__select,
.el-pagination__input {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--el-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--el-text);
  background: #fff;
  outline: none;
}

.el-pagination__input {
  width: 54px;
  text-align: center;
}

.el-pager__btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--el-border);
  border-radius: 6px;
  background: #fff;
  color: var(--el-text);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--el-transition);
}

.el-pager__btn:hover:not(:disabled) {
  color: var(--el-primary);
  border-color: var(--el-primary);
}

.el-pager__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.el-pager__current {
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--el-primary);
  color: #fff;
  font-weight: 600;
}

/* ---------------------------------------------------------- 弹窗 */
.el-dialog__wrapper {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
  overflow-y: auto;
  background: rgba(31, 34, 51, 0.45);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.18s ease;
}

.el-dialog {
  width: 560px;
  max-width: 100%;
  border-radius: var(--el-radius-lg);
  background: #fff;
  box-shadow: var(--el-shadow-lg);
  animation: dialogUp 0.24s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.el-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--el-border-lighter);
}

.el-dialog__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--el-text-strong);
}

.el-dialog__headerbtn {
  border: none;
  background: transparent;
  color: var(--el-text-secondary);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  border-radius: 6px;
  transition: all var(--el-transition);
}

.el-dialog__headerbtn:hover {
  background: rgba(144, 147, 153, 0.12);
  color: var(--el-text-strong);
}

.el-dialog__body {
  padding: 22px;
  max-height: 66vh;
  overflow-y: auto;
}

.el-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--el-border-lighter);
}

/* ---------------------------------------------------------- 表单 */
.el-form-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 18px;
}

.el-form-item__label {
  flex: none;
  padding-top: 10px;
  font-size: 14px;
  color: var(--el-text);
  text-align: right;
  padding-right: 12px;
}

.el-form-item__content {
  flex: 1;
  min-width: 0;
}

.el-form-item__error {
  margin-top: 5px;
  color: var(--el-danger);
  font-size: 12px;
}

.el-form-item.is-error .el-input__inner {
  border-color: var(--el-danger);
}

/* ---------------------------------------------------------- 加载遮罩 */
.el-loading-mask {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  border-radius: inherit;
}

.el-loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(64, 158, 255, 0.2);
  border-top-color: var(--el-primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* ---------------------------------------------------------- 轻提示 */
.toast-host {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 11px 20px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--el-border-lighter);
  box-shadow: var(--el-shadow-lg);
  font-size: 14px;
  color: var(--el-text-strong);
  animation: toastIn 0.24s ease;
  max-width: min(88vw, 560px);
}

.toast.is-leaving {
  animation: toastOut 0.24s ease forwards;
}

.toast--success {
  border-color: rgba(103, 194, 58, 0.5);
  background: #f0f9eb;
  color: #4e8b27;
}

.toast--error {
  border-color: rgba(245, 108, 108, 0.5);
  background: #fef0f0;
  color: #c45656;
}

.toast--warning {
  border-color: rgba(230, 162, 60, 0.5);
  background: #fdf6ec;
  color: #b88230;
}

.toast--info {
  border-color: rgba(144, 147, 153, 0.4);
  background: #f4f4f5;
  color: #606266;
}

/* ---------------------------------------------------------- 动画 */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

@keyframes dialogUp {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}
