/* ===== Button (antd 5) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  height: 32px;
  padding: 0 15px;
  font-size: 14px;
  line-height: 1;
  font-family: inherit;
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.btn:hover {
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid rgba(22, 119, 255, 0.4);
  outline-offset: 1px;
}

.btn-primary {
  color: #fff;
  background: #1677ff;
  border-color: #1677ff;
}

.btn-primary:hover {
  background: #4096ff;
  border-color: #4096ff;
}

.btn-primary:active {
  background: #0958d9;
  border-color: #0958d9;
}

.btn-default {
  color: rgba(0, 0, 0, 0.88);
  background: #fff;
  border-color: #d9d9d9;
}

.btn-default:hover {
  color: #1677ff;
  border-color: #1677ff;
}

.btn-dashed {
  color: rgba(0, 0, 0, 0.88);
  background: #fff;
  border-color: #d9d9d9;
  border-style: dashed;
}

.btn-dashed:hover {
  color: #1677ff;
  border-color: #1677ff;
}

.btn-text {
  color: rgba(0, 0, 0, 0.88);
  background: transparent;
  border-color: transparent;
}

.btn-text:hover {
  background: rgba(0, 0, 0, 0.06);
}

.btn-link {
  height: auto;
  padding: 0;
  color: #1677ff;
  background: transparent;
  border-color: transparent;
}

.btn-link:hover {
  color: #4096ff;
}

.btn-danger {
  color: #fff;
  background: #ff4d4f;
  border-color: #ff4d4f;
}

.btn-danger:hover {
  background: #ff7875;
  border-color: #ff7875;
}

.btn-default.btn-danger {
  color: #ff4d4f;
  background: #fff;
  border-color: #ff4d4f;
}

.btn-sm {
  height: 24px;
  padding: 0 7px;
  font-size: 14px;
}

.btn-lg {
  height: 40px;
  padding: 0 15px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

.btn:disabled,
.btn[disabled],
.btn.btn-disabled {
  cursor: not-allowed;
  opacity: 0.65;
  pointer-events: none;
}

.btn-default:disabled,
.btn-default[disabled],
.btn-default.btn-disabled,
.btn-dashed:disabled,
.btn-dashed[disabled],
.btn-dashed.btn-disabled {
  color: rgba(0, 0, 0, 0.25);
  background: #f5f5f5;
  border-color: #d9d9d9;
}

.btn-round {
  border-radius: 999px;
}

.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -1px;
  animation: btn-spin 0.8s linear infinite;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Modal ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
}

.modal {
  position: relative;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.88);
  line-height: 1.5;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.45);
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover {
  color: rgba(0, 0, 0, 0.88);
}

.modal-body {
  padding: 24px;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.88);
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid #f0f0f0;
}

.modal-btn {
  height: 32px;
  padding: 0 15px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
  color: rgba(0, 0, 0, 0.88);
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.modal-btn:hover {
  color: #1677ff;
  border-color: #1677ff;
}

.modal-btn-primary {
  background: #1677ff;
  border-color: #1677ff;
  color: #fff;
}

.modal-btn-primary:hover {
  background: #4096ff;
  border-color: #4096ff;
  color: #fff;
}

.modal-btn-danger {
  background: #ff4d4f;
  border-color: #ff4d4f;
  color: #fff;
}

.modal-btn-danger:hover {
  background: #ff7875;
  border-color: #ff7875;
  color: #fff;
}

.modal-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.modal-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: modal-spin 0.8s linear infinite;
}

@keyframes modal-spin {
  to {
    transform: rotate(360deg);
  }
}

.modal-confirm-body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.modal-confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.modal-confirm-icon-primary {
  background: #1677ff;
}

.modal-confirm-icon-danger {
  background: #ff4d4f;
}

.modal-confirm-content {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.88);
}

.modal-prompt-desc {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.88);
  margin-bottom: 8px;
}

.modal-prompt-input {
  box-sizing: border-box;
  width: 100%;
  height: 32px;
  padding: 4px 11px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.88);
}

.modal-prompt-input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
  outline: 0;
}

.modal-prompt-error {
  min-height: 18px;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
  color: #ff4d4f;
}

/* ===== Message ===== */
.app-message-container {
  position: fixed;
  top: 24px;
  left: 0;
  right: 0;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.app-message {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 90vw;
  padding: 10px 16px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  font-size: 14px;
  color: rgba(0, 0, 0, 0.88);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}

.app-message-show {
  opacity: 1;
  transform: translateY(0);
}

.app-message-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.app-message-success .app-message-icon {
  background: #52c41a;
}

.app-message-error .app-message-icon {
  background: #ff4d4f;
}

.app-message-warning .app-message-icon {
  background: #faad14;
}

.app-message-info .app-message-icon {
  background: #1677ff;
}

/* ===== Form ===== */
.ant-form-item {
  box-sizing: border-box;
  margin: 0 0 24px;
  padding: 0;
  vertical-align: top;
}

.ant-form-item:last-child {
  margin-bottom: 0;
}

.ant-form-item-row {
  display: flex;
  flex-flow: row wrap;
  min-width: 0;
}

.ant-form-item-label {
  display: inline-block;
  flex-grow: 0;
  overflow: hidden;
  white-space: nowrap;
  text-align: end;
  vertical-align: middle;
}

.ant-form-item-label > label {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  height: 32px;
  color: rgba(0, 0, 0, 0.88);
  font-size: 14px;
  font-weight: normal;
}

.ant-form-item-label > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before {
  display: inline-block;
  margin-inline-end: 4px;
  color: #ff4d4f;
  font-size: 14px;
  font-family: SimSun, sans-serif;
  line-height: 1;
  content: "*";
}

.ant-form-item-label > label::after {
  content: ":";
  position: relative;
  margin-block: 0;
  margin-inline: 2px 8px;
}

.ant-form-item-label > label.ant-form-item-no-colon::after {
  content: " ";
}

.ant-form-item-control {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.ant-form-item-control-input {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 32px;
  overflow: visible;
}

.ant-form-item-control-input-content {
  flex: auto;
  max-width: 100%;
  overflow: visible;
}

.ant-form-item-explain,
.ant-form-item-extra {
  clear: both;
  color: rgba(0, 0, 0, 0.45);
  font-size: 14px;
  line-height: 1.5715;
  min-height: 0;
}

.ant-form-item-explain {
  margin-top: 4px;
}

.ant-form-item-extra {
  margin-top: 4px;
  word-break: break-all;
}

.ant-form-item-explain-error {
  color: #ff4d4f;
}

.ant-form-item-has-error .ant-input,
.ant-form-item-has-error .ant-input:hover {
  border-color: #ff4d4f;
}

.ant-form-item-has-error .ant-input:focus,
.ant-form-item-has-error .ant-input-focused {
  border-color: #ff7875;
  box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.1);
  outline: 0;
}

.ant-form-horizontal .ant-form-item-label {
  flex: 0 0 110px;
  max-width: 110px;
  padding: 0;
  text-align: end;
}

.ant-form-horizontal .ant-form-item-control {
  flex: 1 1 0;
  min-width: 0;
}

.ant-form-vertical .ant-form-item-row {
  flex-direction: column;
}

.ant-form-vertical .ant-form-item-label {
  flex: none;
  max-width: 100%;
  text-align: start;
  padding: 0 0 8px;
}

.ant-form-vertical .ant-form-item-label > label {
  height: auto;
}

.ant-form-vertical .ant-form-item-label > label::after {
  display: none;
}

.ant-form-vertical .ant-form-item-control {
  flex: none;
  width: 100%;
}

.ant-form-horizontal.ant-form-label-w-100 .ant-form-item-label {
  flex: 0 0 100px;
  max-width: 100px;
}

.ant-form-horizontal.ant-form-label-w-120 .ant-form-item-label {
  flex: 0 0 120px;
  max-width: 120px;
}

.ant-form-horizontal.ant-form-label-w-140 .ant-form-item-label {
  flex: 0 0 140px;
  max-width: 140px;
}

.ant-form-text {
  display: inline-block;
  padding: 5px 0;
  color: rgba(0, 0, 0, 0.88);
  font-size: 14px;
  line-height: 1.5715;
}

.ant-form-item-control > .btn {
  align-self: flex-start;
}

.ant-input-group {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.ant-input-group > .ant-input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.ant-input-group > .btn {
  flex: none;
}

.ant-input-group > img {
  flex: none;
  height: 32px;
  width: auto;
  cursor: pointer;
  border-radius: 4px;
}

/* ===== Input ===== */
.ant-input {
  box-sizing: border-box;
  margin: 0;
  padding: 4px 11px;
  color: rgba(0, 0, 0, 0.88);
  font-size: 14px;
  line-height: 1.5715;
  list-style: none;
  position: relative;
  display: inline-block;
  width: 100%;
  min-width: 0;
  background-color: #fff;
  background-image: none;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  transition: all 0.2s;
  height: 32px;
}

.ant-input::placeholder {
  color: rgba(0, 0, 0, 0.25);
}

.ant-input:hover {
  border-color: #4096ff;
}

.ant-input:focus,
.ant-input-focused {
  border-color: #4096ff;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
  outline: 0;
}

.ant-input-disabled,
.ant-input[disabled] {
  color: rgba(0, 0, 0, 0.25);
  background-color: rgba(0, 0, 0, 0.04);
  border-color: #d9d9d9;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

.ant-input-status-error,
.ant-input-status-error:hover {
  border-color: #ff4d4f;
}

.ant-input-status-error:focus,
.ant-input-status-error.ant-input-focused {
  border-color: #ff7875;
  box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.1);
  outline: 0;
}

.ant-input-lg {
  padding: 7px 11px;
  font-size: 16px;
  height: 40px;
  border-radius: 8px;
}

/* ===== Checkbox ===== */
.ant-checkbox-wrapper {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.88);
  line-height: 1.5715;
  cursor: pointer;
}

.ant-checkbox-wrapper input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: #1677ff;
  cursor: pointer;
  flex-shrink: 0;
}

/* ===== Upload ===== */
.ant-upload {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  box-sizing: border-box;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.88);
  line-height: 1.5715;
}

.ant-upload-select-picture-card {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 104px;
  margin: 0;
  padding: 8px;
  overflow: hidden;
  text-align: center;
  vertical-align: top;
  background: rgba(0, 0, 0, 0.02);
  border: 1px dashed #d9d9d9;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.ant-upload-size-large .ant-upload-select-picture-card {
  width: 132px;
  height: 92px;
  padding: 0;
}

.ant-upload-select-picture-card:hover {
  border-color: #1677ff;
}

.ant-upload-select-picture-card.ant-upload-has-file {
  padding: 0;
  border-style: solid;
  background: #fff;
}

.ant-upload-disabled .ant-upload-select-picture-card {
  cursor: not-allowed;
  opacity: 0.6;
}

.ant-upload-plus {
  color: rgba(0, 0, 0, 0.45);
  font-size: 28px;
  line-height: 1;
}

.ant-upload-select-picture-card:hover .ant-upload-plus,
.ant-upload-select-picture-card:hover .ant-upload-text {
  color: #1677ff;
}

.ant-upload-text {
  margin-top: 8px;
  color: rgba(0, 0, 0, 0.45);
  font-size: 14px;
  line-height: 1.5;
}

.ant-upload-preview-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fafafa;
}

.ant-upload-has-file .ant-upload-preview-img {
  object-fit: cover;
  background: #fff;
}

.ant-upload-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1;
  pointer-events: none;
}

.ant-upload-select-picture-card:hover .ant-upload-mask {
  opacity: 1;
}

.ant-upload-loading-mask {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.ant-upload-select-picture-card input[type="file"],
.ant-upload-select-picture-card .ant-upload-input {
  position: absolute !important;
  inset: 0 !important;
  z-index: 2;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  cursor: pointer;
  font-size: 0 !important;
  color: transparent !important;
  border: 0 !important;
  background: transparent !important;
}

.ant-upload-tip {
  width: 100%;
  max-width: 280px;
  margin-top: 8px;
  color: rgba(0, 0, 0, 0.45);
  font-size: 12px;
  line-height: 1.5715;
  text-align: left;
  word-break: break-all;
}
